Bug 1330529 - Part 3: Protect DLL loads in wmain instead of waiting until PluginProcessChild::Init. r=jimm

Removing #define XRE_DONT_PROTECT_DLL_LOAD from plugin-container.cpp and xpcshell.cpp allows the #included nsWindowsWMain.cpp to protect DLL loads much earlier in the plugin process startup.

MozReview-Commit-ID: HbgyfvljvFs

--HG--
extra : rebase_source : dccdabb2e5bee4472d5aef9400a58cb0e397c112
extra : histedit_source : da248fc6fbdf96f30979f3a0396aefcf4bfcd5d9
This commit is contained in:
Chris Peterson 2018-02-02 22:53:34 -08:00
parent f980f52b31
commit 4c4286f348
4 changed files with 2 additions and 24 deletions

View File

@ -31,7 +31,6 @@ extern "C" CGError CGSSetDebugOptions(int options);
using mozilla::ipc::IOThreadChild;
#ifdef OS_WIN
#include "nsSetDllDirectory.h"
#include <algorithm>
#endif
@ -110,9 +109,6 @@ PluginProcessChild::Init(int aArgc, char* aArgv[])
CommandLine::ForCurrentProcess()->GetLooseValues();
MOZ_ASSERT(values.size() >= 1, "not enough loose args");
SanitizeEnvironmentVariables();
SetDllDirectory(L"");
pluginFilename = WideToUTF8(values[0]);
// We don't initialize XPCOM but we need the thread manager and the

View File

@ -11,10 +11,7 @@
#ifdef XP_WIN
#include <windows.h>
// we want a wmain entry point
// but we don't want its DLL load protection, because we'll handle it here
#define XRE_DONT_PROTECT_DLL_LOAD
#include "nsWindowsWMain.cpp"
#include "nsSetDllDirectory.h"
#else
// FIXME/cjones testing
#include <unistd.h>
@ -50,16 +47,6 @@ content_process_main(mozilla::Bootstrap* bootstrap, int argc, char* argv[])
bootstrap->XRE_SetProcessType(argv[--argc]);
#ifdef XP_WIN
// For plugins, this is done in PluginProcessChild::Init, as we need to
// avoid it for unsupported plugins. See PluginProcessChild::Init for
// the details.
if (bootstrap->XRE_GetProcessType() != GeckoProcessType_Plugin) {
mozilla::SanitizeEnvironmentVariables();
SetDllDirectoryW(L"");
}
#endif
nsresult rv = bootstrap->XRE_InitChildProcess(argc, argv, &childData);
return NS_FAILED(rv);
}

View File

@ -20,7 +20,6 @@
#include <shlobj.h>
// we want a wmain entry point
#define XRE_DONT_PROTECT_DLL_LOAD
#define XRE_WANT_ENVIRON
#include "nsWindowsWMain.cpp"
#ifdef MOZ_SANDBOX

View File

@ -11,14 +11,12 @@
#endif
#include "mozilla/Char16.h"
#include "nsSetDllDirectory.h"
#include "nsUTF8Utils.h"
#include <intrin.h>
#include <math.h>
#ifndef XRE_DONT_PROTECT_DLL_LOAD
#include "nsSetDllDirectory.h"
#endif
#ifdef __MINGW32__
/* MingW currently does not implement a wide version of the
@ -79,10 +77,8 @@ FreeAllocStrings(int argc, char **argv)
int wmain(int argc, WCHAR **argv)
{
#ifndef XRE_DONT_PROTECT_DLL_LOAD
mozilla::SanitizeEnvironmentVariables();
SetDllDirectoryW(L"");
#endif
char **argvConverted = new char*[argc + 1];
if (!argvConverted)