mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 286382 - Don't load DLLs from the current directory; r=bsmedberg a=blocking-betaN+
This commit is contained in:
parent
d0803805a5
commit
2fdb64b721
@ -58,6 +58,17 @@ main(int argc, char* argv[])
|
||||
MessageBox(NULL, L"Hi", L"Hi", MB_OK);
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
typedef BOOL
|
||||
(WINAPI *pfnSetDllDirectory) (LPCWSTR);
|
||||
pfnSetDllDirectory setDllDirectory =
|
||||
reinterpret_cast<pfnSetDllDirectory>
|
||||
(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDllDirectoryW"));
|
||||
if (setDllDirectory) {
|
||||
setDllDirectory(L"");
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check for the absolute minimum number of args we need to move
|
||||
// forward here. We expect the last arg to be the child process type.
|
||||
if (argc < 1)
|
||||
|
@ -287,10 +287,23 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef BOOL
|
||||
(WINAPI *pfnSetDllDirectory) (LPCWSTR);
|
||||
pfnSetDllDirectory setDllDirectory =
|
||||
reinterpret_cast<pfnSetDllDirectory>
|
||||
(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDllDirectoryW"));
|
||||
if (setDllDirectory) {
|
||||
setDllDirectory(NULL);
|
||||
}
|
||||
|
||||
nsresult rv = plugin->Load(outLibrary);
|
||||
if (NS_FAILED(rv))
|
||||
*outLibrary = NULL;
|
||||
|
||||
if (setDllDirectory) {
|
||||
setDllDirectory(L"");
|
||||
}
|
||||
|
||||
#ifndef WINCE
|
||||
if (restoreOrigDir) {
|
||||
BOOL bCheck = SetCurrentDirectoryW(aOrigDir);
|
||||
|
@ -90,6 +90,15 @@ void ExtractEnvironmentFromCL(int &argc, char **&argv)
|
||||
|
||||
int wmain(int argc, WCHAR **argv)
|
||||
{
|
||||
typedef BOOL
|
||||
(WINAPI *pfnSetDllDirectory) (LPCWSTR);
|
||||
pfnSetDllDirectory setDllDirectory =
|
||||
reinterpret_cast<pfnSetDllDirectory>
|
||||
(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDllDirectoryW"));
|
||||
if (setDllDirectory) {
|
||||
setDllDirectory(L"");
|
||||
}
|
||||
|
||||
#ifdef XRE_WANT_DLL_BLOCKLIST
|
||||
SetupDllBlocklist();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user