summaryrefslogtreecommitdiffstats
path: root/media/base/media_win.cc
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-30 22:43:37 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-30 22:43:37 +0000
commit971b3c5679671ae9f08190a54d7cd0ed30ec9cfb (patch)
tree6b7f897c063ec9ec91514fde0d2695a79f94b78d /media/base/media_win.cc
parenta59a8e0ba416724167265b4147aef6b44dcbc801 (diff)
downloadchromium_src-971b3c5679671ae9f08190a54d7cd0ed30ec9cfb.zip
chromium_src-971b3c5679671ae9f08190a54d7cd0ed30ec9cfb.tar.gz
chromium_src-971b3c5679671ae9f08190a54d7cd0ed30ec9cfb.tar.bz2
Use LoadLibraryEx() instead of SetDllDirectory() for overriding DLL loading path.
BUG=35857 TEST=install a real version of chrome (don't simply unzip a build). close chrome. create an empty file named C:\Windows\avutil-50.dll. start chrome and go to www.youtube.com/html5. no error dialog box should appear. repeat these steps with an earlier version of chrome to verify that an error dialog box appears complaining about C:\Windows\avutil-50.dll. Review URL: http://codereview.chromium.org/2853018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/media_win.cc')
-rw-r--r--media/base/media_win.cc17
1 files changed, 5 insertions, 12 deletions
diff --git a/media/base/media_win.cc b/media/base/media_win.cc
index b0357f7..cc4f736 100644
--- a/media/base/media_win.cc
+++ b/media/base/media_win.cc
@@ -66,21 +66,16 @@ bool InitializeMediaLibrary(const FilePath& base_path) {
};
HMODULE libs[arraysize(path_keys)] = {NULL};
- // Limit the DLL search path so we don't load dependencies from the system
- // path. Refer to http://crbug.com/35857
- scoped_array<wchar_t> previous_dll_directory(new wchar_t[MAX_PATH]);
- if (!GetDllDirectory(MAX_PATH, previous_dll_directory.get())) {
- previous_dll_directory.reset();
- }
- SetDllDirectory(base_path.value().c_str());
-
for (size_t i = 0; i < arraysize(path_keys); ++i) {
- FilePath path(GetDLLName(path_keys[i]));
+ FilePath path = base_path.Append(GetDLLName(path_keys[i]));
#ifdef TESTING
double dll_loadtime_start = GetTime();
#endif
+
+ // Use alternate DLL search path so we don't load dependencies from the
+ // system path. Refer to http://crbug.com/35857
const wchar_t* cpath = path.value().c_str();
- libs[i] = LoadLibrary(cpath);
+ libs[i] = LoadLibraryEx(cpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (!libs[i])
break;
#ifdef TESTING
@@ -92,8 +87,6 @@ bool InitializeMediaLibrary(const FilePath& base_path) {
#endif
}
- SetDllDirectory(previous_dll_directory.get());
-
// Check that we loaded all libraries successfully. We only need to check the
// last array element because the loop above will break without initializing
// it on any prior error.