summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/installer/util')
-rw-r--r--chrome/installer/util/install_util.cc23
-rw-r--r--chrome/installer/util/install_util.h21
-rw-r--r--chrome/installer/util/self_reg_work_item.cc51
-rw-r--r--chrome/installer/util/self_reg_work_item.h40
-rw-r--r--chrome/installer/util/util.gyp2
-rw-r--r--chrome/installer/util/util.vcproj12
-rw-r--r--chrome/installer/util/work_item.cc6
-rw-r--r--chrome/installer/util/work_item.h8
-rw-r--r--chrome/installer/util/work_item_list.cc7
-rw-r--r--chrome/installer/util/work_item_list.h8
10 files changed, 8 insertions, 170 deletions
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 86f0847..6fc0328 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -5,14 +5,12 @@
// See the corresponding header file for description of the functions in this
// file.
-#include "chrome/installer/util/install_util.h"
+#include "install_util.h"
+#include <algorithm>
#include <shellapi.h>
#include <shlobj.h>
-#include <algorithm>
-
-#include "base/file_util.h"
#include "base/logging.h"
#include "base/registry.h"
#include "base/scoped_ptr.h"
@@ -117,6 +115,7 @@ void InstallUtil::WriteInstallerResult(bool system_install,
}
bool InstallUtil::IsPerUserInstall(const wchar_t* const exe_path) {
+
wchar_t program_files_path[MAX_PATH] = {0};
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL,
SHGFP_TYPE_CURRENT, program_files_path))) {
@@ -126,19 +125,3 @@ bool InstallUtil::IsPerUserInstall(const wchar_t* const exe_path) {
}
return true;
}
-
-bool InstallUtil::BuildDLLRegistrationList(const std::wstring& install_path,
- const wchar_t** const dll_names,
- int dll_names_count,
- bool do_register,
- WorkItemList* registration_list) {
- DCHECK(NULL != registration_list);
- bool success = true;
- for (int i = 0; i < dll_names_count; i++) {
- std::wstring dll_file_path(install_path);
- file_util::AppendToPath(&dll_file_path, dll_names[i]);
- success = registration_list->AddSelfRegWorkItem(dll_file_path,
- do_register) && success;
- }
- return (dll_names_count > 0) && success;
-}
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index 2bc5117..68b0538 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -9,16 +9,14 @@
#ifndef CHROME_INSTALLER_UTIL_INSTALL_UTIL_H__
#define CHROME_INSTALLER_UTIL_INSTALL_UTIL_H__
+#include <string>
#include <tchar.h>
#include <windows.h>
-#include <string>
#include "base/basictypes.h"
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/version.h"
-class WorkItemList;
-
// This is a utility class that provides common installation related
// utility methods that can be used by installer and also unit tested
// independently.
@@ -55,23 +53,6 @@ class InstallUtil {
// Program Files).
static bool IsPerUserInstall(const wchar_t* const exe_path);
- // Adds all DLLs in install_path whose names are given by dll_names to a
- // work item list containing registration or unregistration actions.
- //
- // install_path: Install path containing the registrable DLLs.
- // dll_names: the array of strings containing dll_names
- // dll_names_count: the number of DLL names in dll_names
- // do_register: whether to register or unregister the DLLs
- // registration_list: the WorkItemList that this method populates
- //
- // Returns true if at least one DLL was successfully added to
- // registration_list.
- static bool BuildDLLRegistrationList(const std::wstring& install_path,
- const wchar_t** const dll_names,
- int dll_names_count,
- bool do_register,
- WorkItemList* registration_list);
-
private:
DISALLOW_EVIL_CONSTRUCTORS(InstallUtil);
};
diff --git a/chrome/installer/util/self_reg_work_item.cc b/chrome/installer/util/self_reg_work_item.cc
deleted file mode 100644
index e413025..0000000
--- a/chrome/installer/util/self_reg_work_item.cc
+++ /dev/null
@@ -1,51 +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.
-
-#include "chrome/installer/util/self_reg_work_item.h"
-
-#include "chrome/installer/util/logging_installer.h"
-
-SelfRegWorkItem::SelfRegWorkItem(const std::wstring& dll_path,
- bool do_register)
- : do_register_(do_register), dll_path_(dll_path) {
-}
-
-SelfRegWorkItem::~SelfRegWorkItem() {
-}
-
-typedef HRESULT (STDAPICALLTYPE *DllRegisterServerFunc)();
-
-bool SelfRegWorkItem::RegisterDll(bool do_register) {
- HMODULE dll_module = ::LoadLibraryEx(dll_path_.c_str(), NULL,
- LOAD_WITH_ALTERED_SEARCH_PATH);
- bool success = false;
- if (NULL != dll_module) {
- DllRegisterServerFunc register_server_func = NULL;
- if (do_register) {
- register_server_func = reinterpret_cast<DllRegisterServerFunc>(
- ::GetProcAddress(dll_module, "DllRegisterServer"));
- } else {
- register_server_func = reinterpret_cast<DllRegisterServerFunc>(
- ::GetProcAddress(dll_module, "DllUnregisterServer"));
- }
-
- if (NULL != register_server_func) {
- success = SUCCEEDED(register_server_func());
- if (!success) {
- LOG(ERROR) << "Failed to " << (do_register ? "register" : "unregister")
- << " DLL at " << dll_path_.c_str();
- }
- }
- ::FreeLibrary(dll_module);
- }
- return success;
-}
-
-bool SelfRegWorkItem::Do() {
- return RegisterDll(do_register_);
-}
-
-void SelfRegWorkItem::Rollback() {
- RegisterDll(!do_register_);
-}
diff --git a/chrome/installer/util/self_reg_work_item.h b/chrome/installer/util/self_reg_work_item.h
deleted file mode 100644
index ae2041b..0000000
--- a/chrome/installer/util/self_reg_work_item.h
+++ /dev/null
@@ -1,40 +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 CHROME_INSTALLER_UTIL_SELF_REG_WORK_ITEM_H__
-#define CHROME_INSTALLER_UTIL_SELF_REG_WORK_ITEM_H__
-
-#include <windows.h>
-#include <string>
-
-#include "chrome/installer/util/work_item.h"
-
-// Registers or unregisters the DLL at the given path.
-class SelfRegWorkItem : public WorkItem {
- public:
- virtual ~SelfRegWorkItem();
-
- virtual bool Do();
- virtual void Rollback();
-
- private:
- friend class WorkItem;
-
- SelfRegWorkItem(const std::wstring& dll_path, bool do_register);
-
- // Examines the DLL at dll_path looking for either DllRegisterServer (if
- // do_register is true) or DllUnregisterServer (if do_register is false).
- // Returns true if the DLL exports the function and it a call to it
- // succeeds, false otherwise.
- bool RegisterDll(bool do_register);
-
- // The path to the dll to be registered.
- std::wstring dll_path_;
-
- // Whether this work item will register or unregister the dll. The rollback
- // action just inverts this parameter.
- bool do_register_;
-};
-
-#endif // CHROME_INSTALLER_UTIL_SELF_REG_WORK_ITEM_H__
diff --git a/chrome/installer/util/util.gyp b/chrome/installer/util/util.gyp
index 26b1418..ad5638e 100644
--- a/chrome/installer/util/util.gyp
+++ b/chrome/installer/util/util.gyp
@@ -67,8 +67,6 @@
'master_preferences.h',
'move_tree_work_item.cc',
'move_tree_work_item.h',
- 'self_reg_work_item.cc',
- 'self_reg_work_item.h',
'set_reg_value_work_item.cc',
'set_reg_value_work_item.h',
'shell_util.cc',
diff --git a/chrome/installer/util/util.vcproj b/chrome/installer/util/util.vcproj
index 33e6666..59f72da 100644
--- a/chrome/installer/util/util.vcproj
+++ b/chrome/installer/util/util.vcproj
@@ -261,23 +261,15 @@
>
</File>
<File
- RelativePath=".\move_tree_work_item.cc"
- >
- </File>
- <File
- RelativePath=".\move_tree_work_item.h"
- >
- </File>
- <File
RelativePath="..\..\common\pref_names.cc"
>
</File>
<File
- RelativePath=".\self_reg_work_item.cc"
+ RelativePath=".\move_tree_work_item.cc"
>
</File>
<File
- RelativePath=".\self_reg_work_item.h"
+ RelativePath=".\move_tree_work_item.h"
>
</File>
<File
diff --git a/chrome/installer/util/work_item.cc b/chrome/installer/util/work_item.cc
index dcb4293..6c56fa7 100644
--- a/chrome/installer/util/work_item.cc
+++ b/chrome/installer/util/work_item.cc
@@ -10,7 +10,6 @@
#include "chrome/installer/util/delete_tree_work_item.h"
#include "chrome/installer/util/delete_reg_value_work_item.h"
#include "chrome/installer/util/move_tree_work_item.h"
-#include "chrome/installer/util/self_reg_work_item.h"
#include "chrome/installer/util/set_reg_value_work_item.h"
#include "chrome/installer/util/work_item_list.h"
@@ -68,11 +67,6 @@ SetRegValueWorkItem* WorkItem::CreateSetRegValueWorkItem(
value_name, value_data, overwrite);
}
-SelfRegWorkItem* WorkItem::CreateSelfRegWorkItem(const std::wstring& dll_path,
- bool do_register) {
- return new SelfRegWorkItem(dll_path, do_register);
-}
-
WorkItemList* WorkItem::CreateWorkItemList() {
return new WorkItemList();
}
diff --git a/chrome/installer/util/work_item.h b/chrome/installer/util/work_item.h
index 1a29c2f0..86f4834 100644
--- a/chrome/installer/util/work_item.h
+++ b/chrome/installer/util/work_item.h
@@ -9,8 +9,8 @@
#ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_H_
#define CHROME_INSTALLER_UTIL_WORK_ITEM_H_
-#include <windows.h>
#include <string>
+#include <windows.h>
class CopyTreeWorkItem;
class CreateDirWorkItem;
@@ -18,7 +18,6 @@ class CreateRegKeyWorkItem;
class DeleteTreeWorkItem;
class DeleteRegValueWorkItem;
class MoveTreeWorkItem;
-class SelfRegWorkItem;
class SetRegValueWorkItem;
class WorkItemList;
@@ -84,11 +83,6 @@ class WorkItem {
HKEY predefined_root, std::wstring key_path,
std::wstring value_name, DWORD value_data, bool overwrite);
- // Add a SelfRegWorkItem that registers or unregisters a DLL at the
- // specified path.
- static SelfRegWorkItem* CreateSelfRegWorkItem(const std::wstring& dll_path,
- bool do_register);
-
// Create an empty WorkItemList. A WorkItemList can recursively contains
// a list of WorkItems.
static WorkItemList* CreateWorkItemList();
diff --git a/chrome/installer/util/work_item_list.cc b/chrome/installer/util/work_item_list.cc
index e5aa3bc..7913b8c 100644
--- a/chrome/installer/util/work_item_list.cc
+++ b/chrome/installer/util/work_item_list.cc
@@ -133,10 +133,3 @@ bool WorkItemList::AddSetRegValueWorkItem(HKEY predefined_root,
value_data, overwrite));
return AddWorkItem(item);
}
-
-bool WorkItemList::AddSelfRegWorkItem(const std::wstring& dll_path,
- bool do_register) {
- WorkItem* item = reinterpret_cast<WorkItem*>(
- WorkItem::CreateSelfRegWorkItem(dll_path, do_register));
- return AddWorkItem(item);
-}
diff --git a/chrome/installer/util/work_item_list.h b/chrome/installer/util/work_item_list.h
index b7b4fc3..a8e3bbb 100644
--- a/chrome/installer/util/work_item_list.h
+++ b/chrome/installer/util/work_item_list.h
@@ -5,11 +5,9 @@
#ifndef CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H__
#define CHROME_INSTALLER_UTIL_WORK_ITEM_LIST_H__
-#include <windows.h>
-
#include <list>
#include <string>
-
+#include <windows.h>
#include "chrome/installer/util/work_item.h"
// A WorkItem subclass that recursively contains a list of WorkItems. Thus it
@@ -72,10 +70,6 @@ class WorkItemList : public WorkItem {
std::wstring value_name, DWORD value_data,
bool overwrite);
- // Add a SelfRegWorkItem that registers or unregisters a DLL at the
- // specified path.
- bool AddSelfRegWorkItem(const std::wstring& dll_path, bool do_register);
-
private:
friend class WorkItem;