Bug 1496179 - Make mozglue.dll a private SxS assembly. r=aklotz,froydnj

SxS assemblies do not obey the usual DLL search order. It will make it possible
to load mozglue.dll from appdir even if the PreferSystem32Images mitigation is
enabled and System32 has a random mozglue.dll.
This commit is contained in:
Masatoshi Kimura 2018-10-10 22:57:53 +09:00
parent 771886a06d
commit f38cdcfbf1
10 changed files with 96 additions and 0 deletions

View File

@ -19,6 +19,16 @@
/>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="mozglue"
version="1.0.0.0"
language="*"
/>
</dependentAssembly>
</dependency>
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
<ms_asmv3:security>
<ms_asmv3:requestedPrivileges>

View File

@ -274,12 +274,14 @@ print RCFILE qq{
my $versionlevel=0;
my $insideversion=0;
my $has_manifest=0;
if (open(RCINCLUDE, "<$rcinclude"))
{
print RCFILE "// From included resource $rcinclude\n";
# my $mstring="";
while (<RCINCLUDE>)
{
$has_manifest = 1 if /^1 (24|RT_MANIFEST) "$binary.manifest"/;
$_ =~ s/\@MOZ_APP_DISPLAYNAME\@/$displayname/g;
print RCFILE $_;
# my $instr=$_;
@ -330,6 +332,10 @@ if (open(RCINCLUDE, "<$rcinclude"))
my $fileflags = join(' | ', @fileflags);
print RCFILE qq{
1 RT_MANIFEST "$binary.manifest"
} if !$has_manifest && $binary =~ /\.exe$/ && -e "$objdir/$binary.manifest";
print RCFILE qq{

View File

@ -18,6 +18,16 @@
language="*"
/>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="mozglue"
version="1.0.0.0"
language="*"
/>
</dependentAssembly>
</dependency>
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
<ms_asmv3:security>

View File

@ -12,6 +12,16 @@
type="win32"
/>
<description>XPConnect Shell</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="mozglue"
version="1.0.0.0"
language="*"
/>
</dependentAssembly>
</dependency>
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
<ms_asmv3:security>
<ms_asmv3:requestedPrivileges>

View File

@ -11,6 +11,12 @@ mozglue.def: mozglue.def.in $(GLOBAL_DEPS)
$(call py_action,preprocessor,$(if $(MOZ_REPLACE_MALLOC),-DMOZ_REPLACE_MALLOC) $(ACDEFINES) $< -o $@)
GARBAGE += mozglue.def
# Rebuild mozglue.dll if the manifest changes - it's included by mozglue.rc.
# (this dependency should really be just for mozglue.dll, not other targets)
# Note the manifest file exists in the tree, so we use the explicit filename
# here.
EXTRA_DEPS += mozglue.dll.manifest
endif
include $(topsrcdir)/mozglue/build/replace_malloc.mk

View File

@ -35,6 +35,7 @@ if CONFIG['OS_TARGET'] == 'WINNT':
DELAYLOAD_DLLS += [
'user32.dll',
]
RCINCLUDE = 'mozglue.rc'
if CONFIG['MOZ_PGO'] and CONFIG['CC_TYPE'] == 'clang-cl':
SOURCES += ['cygprofile.cpp']

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
name="mozglue"
type="win32"
/>
<file name="mozglue.dll"/>
</assembly>

6
mozglue/build/mozglue.rc Normal file
View File

@ -0,0 +1,6 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
1 RT_MANIFEST "mozglue.dll.manifest"

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="pingsender"
type="win32"
/>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="mozglue"
version="1.0.0.0"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="minidump-analyzer"
type="win32"
/>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="mozglue"
version="1.0.0.0"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>