Skip to content

Commit 4c4286f

Browse files
committed
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
1 parent f980f52 commit 4c4286f

File tree

4 files changed

+2
-24
lines changed

4 files changed

+2
-24
lines changed

dom/plugins/ipc/PluginProcessChild.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ extern "C" CGError CGSSetDebugOptions(int options);
3131
using mozilla::ipc::IOThreadChild;
3232

3333
#ifdef OS_WIN
34-
#include "nsSetDllDirectory.h"
3534
#include <algorithm>
3635
#endif
3736

@@ -110,9 +109,6 @@ PluginProcessChild::Init(int aArgc, char* aArgv[])
110109
CommandLine::ForCurrentProcess()->GetLooseValues();
111110
MOZ_ASSERT(values.size() >= 1, "not enough loose args");
112111

113-
SanitizeEnvironmentVariables();
114-
SetDllDirectory(L"");
115-
116112
pluginFilename = WideToUTF8(values[0]);
117113

118114
// We don't initialize XPCOM but we need the thread manager and the

ipc/contentproc/plugin-container.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
#ifdef XP_WIN
1212
#include <windows.h>
1313
// we want a wmain entry point
14-
// but we don't want its DLL load protection, because we'll handle it here
15-
#define XRE_DONT_PROTECT_DLL_LOAD
1614
#include "nsWindowsWMain.cpp"
17-
#include "nsSetDllDirectory.h"
1815
#else
1916
// FIXME/cjones testing
2017
#include <unistd.h>
@@ -50,16 +47,6 @@ content_process_main(mozilla::Bootstrap* bootstrap, int argc, char* argv[])
5047

5148
bootstrap->XRE_SetProcessType(argv[--argc]);
5249

53-
#ifdef XP_WIN
54-
// For plugins, this is done in PluginProcessChild::Init, as we need to
55-
// avoid it for unsupported plugins. See PluginProcessChild::Init for
56-
// the details.
57-
if (bootstrap->XRE_GetProcessType() != GeckoProcessType_Plugin) {
58-
mozilla::SanitizeEnvironmentVariables();
59-
SetDllDirectoryW(L"");
60-
}
61-
#endif
62-
6350
nsresult rv = bootstrap->XRE_InitChildProcess(argc, argv, &childData);
6451
return NS_FAILED(rv);
6552
}

js/xpconnect/shell/xpcshell.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <shlobj.h>
2121

2222
// we want a wmain entry point
23-
#define XRE_DONT_PROTECT_DLL_LOAD
2423
#define XRE_WANT_ENVIRON
2524
#include "nsWindowsWMain.cpp"
2625
#ifdef MOZ_SANDBOX

toolkit/xre/nsWindowsWMain.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@
1111
#endif
1212

1313
#include "mozilla/Char16.h"
14+
#include "nsSetDllDirectory.h"
1415
#include "nsUTF8Utils.h"
16+
1517
#include <intrin.h>
1618
#include <math.h>
1719

18-
#ifndef XRE_DONT_PROTECT_DLL_LOAD
19-
#include "nsSetDllDirectory.h"
20-
#endif
21-
2220
#ifdef __MINGW32__
2321

2422
/* MingW currently does not implement a wide version of the
@@ -79,10 +77,8 @@ FreeAllocStrings(int argc, char **argv)
7977

8078
int wmain(int argc, WCHAR **argv)
8179
{
82-
#ifndef XRE_DONT_PROTECT_DLL_LOAD
8380
mozilla::SanitizeEnvironmentVariables();
8481
SetDllDirectoryW(L"");
85-
#endif
8682

8783
char **argvConverted = new char*[argc + 1];
8884
if (!argvConverted)

0 commit comments

Comments
 (0)