• David Ostrovsky's avatar
    tdf#105311 VC++ Runtime installed in wrong directory · 30473907
    David Ostrovsky yazdı
    Starting from MSVC 14.0, the directory table layout of VC++ Runtime merge
    module changed. As consequence, all MSI produced with newer compilers,
    including MSVC 15.0 (aka VS 2017) are broken in term that the VC++
    Runtime DLLs are installed in the wrong directory, e.g.: C:\System64.
    
    According to the specification for merging merge module (msm), see:
    "Authoring Merge Module Directory Tables": [1], custom action 51 (set
    property) must be emitted for every directory name in the merge module
    directory table if the directory name is starting with the standard
    directory name.
    
    Quoting it here:
    
    "
    When a predefined directory is included in a merge module, the merge
    tool automatically adds a Custom Action Type 51 to the target database.
    The merge module author must ensure that a CustomAction table is also
    included. The CustomAction table may be empty, but this table is required
    to exist in the target database and ensures that the modified predefined
    directories are written to the correct locations. For example, when a
    system directory is included in a merge module, the merge module author
    must ensure that a Custom Action table exists.
    
    Note that the matching algorithm for the generation of these type 51
    custom actions only checks that the directory name begins with one of
    the predefined SystemFolder properties. It does not verify that the
    directory name exactly equals the directory property. Any directory
    beginning with one of these standard folder names gets a type 51 custom
    action, even if the rest of the name is not a GUID. Authors need to take
    care that this does not generate false positive matches, and unintended
    custom action generation, on derivative primary keys that begin with one
    of the SystemFolder properties."
    
    Rectify the problem by analyzing the directory table from the merge
    module, checking whether the directory name starts with the standard
    prefix name and if it is the case, emitting custom action 51 to set this
    variable to the standard directory name.
    
    Implementation details:
    
    We use the existing facility for emitting the custom action table events
    including referencing them in the corresponding sequence tables. Given
    that the specification above doesn't mention what sequence table should
    be referencing this emitted custom action, we reversed engineer this
    information from WiX toolkit. Merging the VC++ CRT module with WiX
    toolkit and investigating the resulting MSI with Orca MSI reader, reveals
    that these sequence tables were referencing from these sequence tables:
    
    * AdminExecuteSequence
    * AdminUISequence
    * AdvtExecuteSequence
    * InstallExecuteSequence
    * InstallUISequence
    
    Replicate this behaviour here as well. Note, though, that custom actions
    are generally not referenced in AdminUISequence and AdvtExecuteSequence
    tables in LibreOffice MSI building tool chain.
    
    Rendering of the custom action is achieved by programmatic emulation of
    custom action in SCP module. Consider this similar SCP module based
    action:
    
      Name = "MigrateInstallPath";
      Typ = "321";
      Source = "shlxtmsi.dll";
      Target = "MigrateInstallPath";
      Inbinarytable = 1;
      Assignment1 = ("InstallExecuteSequence", "", "CostInitialize");
      Assignment2 = ("InstallUISequence", "", "CostInitialize");
    
    We instantiate the following data structure to emit custom action
    System64Folder.3CFBED52_9B44_3A4D_953C_90E456671BA1:
    
      Name = "System64Folder.3CFBED52_9B44_3A4D_953C_90E456671BA1"
      Typ = "51"
      Source = "System64Folder.3CFBED52_9B44_3A4D_953C_90E456671BA1"
      Target = "[System64Folder]"
      Styles = "NO_FILES"
      Assignment1 = ("AdminExecuteSequence", "", "CostInitialize")
      Assignment2 = ("InstallExecuteSequence", "", "CostInitialize")
      Assignment3 = ("InstallUISequence", "", "CostInitialize")
    
    [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa367787%28v=vs.85%29.aspx
    
    Change-Id: I2fbd37ff63298d99b2ba1b6afe6e875f56d8e378
    Reviewed-on: https://gerrit.libreoffice.org/33366Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarDavid Ostrovsky <david@ostrovsky.org>
    30473907
Adı
Son kayıt (commit)
Son güncelleme
..
bin Loading commit data...
buck Loading commit data...
doc/gbuild Loading commit data...
gbuild Loading commit data...
gbuildtojson Loading commit data...
gcc-wrappers Loading commit data...
gdb Loading commit data...
inc Loading commit data...
lldb/libreoffice Loading commit data...
maven Loading commit data...
qa/python Loading commit data...
sanitizers Loading commit data...
CompilerTest_compilerplugins_clang.mk Loading commit data...
CustomTarget_gbuildtesttools.mk Loading commit data...
Executable_concat-deps.mk Loading commit data...
Executable_g++-wrapper.mk Loading commit data...
Executable_gbuildtojson.mk Loading commit data...
Executable_gcc-wrapper.mk Loading commit data...
Makefile Loading commit data...
Module_solenv.mk Loading commit data...
PythonTest_solenv_python.mk Loading commit data...
README Loading commit data...
StaticLibrary_wrapper.mk Loading commit data...