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

Unified Diff: services/service_manager/runner/host/child_process_host.cc

Issue 2574653002: Service Manager: Override DLL search path when launching services in component builds (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/service_manager/runner/host/child_process_host.cc
diff --git a/services/service_manager/runner/host/child_process_host.cc b/services/service_manager/runner/host/child_process_host.cc
index faf2ba589e29e34ca9b70a5ba18bc9a46b4afdf3..ddbf2c0f830cb74d76305fe5a23dfb326c58ea2b 100644
--- a/services/service_manager/runner/host/child_process_host.cc
+++ b/services/service_manager/runner/host/child_process_host.cc
@@ -11,6 +11,7 @@
#include "base/base_paths.h"
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/files/file_path.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
@@ -41,6 +42,28 @@
#include "services/service_manager/public/cpp/standalone_service/mach_broker.h"
#endif
+#if defined(OS_WIN) && defined(COMPONENT_BUILD)
+#include <windows.h>
+
+namespace {
+
+class ScopedDllDirectoryOverride {
+ public:
+ explicit ScopedDllDirectoryOverride(const base::FilePath& path) {
+ SetDllDirectory(path.value().c_str());
+ }
+
+ ~ScopedDllDirectoryOverride() {
+ SetDllDirectory(NULL);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedDllDirectoryOverride);
+};
+
+} // namespace
+#endif // defined(OS_WIN) && defined(COMPONENT_BUILD)
+
namespace service_manager {
ChildProcessHost::ChildProcessHost(base::TaskRunner* launch_process_runner,
@@ -205,6 +228,8 @@ void ChildProcessHost::DoLaunch(
#if defined(OS_MACOSX)
MachBroker* mach_broker = MachBroker::GetInstance();
base::AutoLock locker(mach_broker->GetLock());
+#elif defined(OS_WIN) && defined(COMPONENT_BUILD)
+ ScopedDllDirectoryOverride dll_override(exe_dir);
#endif
child_process_ = base::LaunchProcess(*child_command_line, options);
#if defined(OS_MACOSX)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698