зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1330529 - Part 2: Remove unused SetDllDirectory workaround for Shockwave Player plugin. r=jimm
This code was added in bug 607832 to work around a Shockwave Player bug where it tries to load some DLLs from the current directory, but the current directory is not the one it expects. We no longer support the Shockwave Player plugin, so this workaround is no longer necessary and we can always call SetDllDirectory("") to remove the current directory from the DLL search path. MozReview-Commit-ID: C4MjB1SkZE3 --HG-- extra : rebase_source : 6473ca88db6bee484c3c97669dca39daf31b438e extra : histedit_source : f4abb901979b07f0aa346508773a8e65f47451cd
This commit is contained in:
Родитель
203d98bd72
Коммит
f980f52b31
|
@ -26,41 +26,6 @@
|
|||
#include "nsIFile.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
||||
#include <shlwapi.h>
|
||||
#define SHOCKWAVE_BASE_FILENAME L"np32dsw"
|
||||
/**
|
||||
* Determines whether or not SetDllDirectory should be called for this plugin.
|
||||
*
|
||||
* @param pluginFilePath The full path of the plugin file
|
||||
* @return true if SetDllDirectory can be called for the plugin
|
||||
*/
|
||||
bool
|
||||
ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath)
|
||||
{
|
||||
LPCWSTR passedInFilename = PathFindFileName(pluginFilePath);
|
||||
if (!passedInFilename) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Somewhere in the middle of 11.6 version of Shockwave, naming of the DLL
|
||||
// after its version number is introduced.
|
||||
if (!wcsicmp(passedInFilename, SHOCKWAVE_BASE_FILENAME L".dll")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shockwave versions before 1202122 will break if you call SetDllDirectory
|
||||
const uint64_t kFixedShockwaveVersion = 1202122;
|
||||
uint64_t version;
|
||||
int found = swscanf(passedInFilename, SHOCKWAVE_BASE_FILENAME L"_%llu.dll",
|
||||
&version);
|
||||
if (found && version < kFixedShockwaveVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We always want to call SetDllDirectory otherwise
|
||||
return true;
|
||||
}
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/* Local helper functions */
|
||||
|
@ -283,12 +248,8 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
|
|||
if (!mPlugin)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
bool protectCurrentDirectory = true;
|
||||
|
||||
nsAutoString pluginFilePath;
|
||||
mPlugin->GetPath(pluginFilePath);
|
||||
protectCurrentDirectory =
|
||||
ShouldProtectPluginCurrentDirectory(pluginFilePath.BeginReading());
|
||||
|
||||
nsAutoString pluginFolderPath = pluginFilePath;
|
||||
int32_t idx = pluginFilePath.RFindChar('\\');
|
||||
|
@ -304,17 +265,14 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
|
|||
NS_ASSERTION(restoreOrigDir, "Error in Loading plugin");
|
||||
}
|
||||
|
||||
if (protectCurrentDirectory) {
|
||||
SetDllDirectory(nullptr);
|
||||
}
|
||||
// Temporarily add the current directory back to the DLL load path.
|
||||
SetDllDirectory(nullptr);
|
||||
|
||||
nsresult rv = mPlugin->Load(outLibrary);
|
||||
if (NS_FAILED(rv))
|
||||
*outLibrary = nullptr;
|
||||
|
||||
if (protectCurrentDirectory) {
|
||||
SetDllDirectory(L"");
|
||||
}
|
||||
SetDllDirectory(L"");
|
||||
|
||||
if (restoreOrigDir) {
|
||||
DebugOnly<BOOL> bCheck = SetCurrentDirectoryW(aOrigDir);
|
||||
|
|
|
@ -23,7 +23,6 @@ extern "C" CGError CGSSetDebugOptions(int options);
|
|||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
bool ShouldProtectPluginCurrentDirectory(char16ptr_t pluginFilePath);
|
||||
#if defined(MOZ_SANDBOX)
|
||||
#include "mozilla/sandboxTarget.h"
|
||||
#endif
|
||||
|
@ -111,10 +110,8 @@ PluginProcessChild::Init(int aArgc, char* aArgv[])
|
|||
CommandLine::ForCurrentProcess()->GetLooseValues();
|
||||
MOZ_ASSERT(values.size() >= 1, "not enough loose args");
|
||||
|
||||
if (ShouldProtectPluginCurrentDirectory(values[0].c_str())) {
|
||||
SanitizeEnvironmentVariables();
|
||||
SetDllDirectory(L"");
|
||||
}
|
||||
SanitizeEnvironmentVariables();
|
||||
SetDllDirectory(L"");
|
||||
|
||||
pluginFilename = WideToUTF8(values[0]);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче