@joebigelow / wix-1 / commits / 1e7800b8

Fix bugs around mbanative's InitializeFromCreateArgs.

Sean Hall committed Apr 28, 2020 at 11:17 UTC 1e7800b811b658659c8487bf2ccb541fdd6bd1be
8 files changed +19 -18
src/WixToolset.Mba.Core/IBootstrapperApplicationFactory.cs
+9 -8
@@ -23,19 +23,20 @@ namespace WixToolset.Mba.Core
23 [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")]
24 public struct Command
25 {
26 + // Strings must be declared as pointers so that Marshaling doesn't free them.
27 [MarshalAs(UnmanagedType.I4)] internal int cbSize;
28 [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action;
29 [MarshalAs(UnmanagedType.U4)] private readonly Display display;
30 [MarshalAs(UnmanagedType.U4)] private readonly Restart restart;
30 - [MarshalAs(UnmanagedType.LPWStr)] private readonly string wzCommandLine;
31 + private readonly IntPtr wzCommandLine;
32 [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow;
33 [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume;
34 private readonly IntPtr hwndSplashScreen;
35 [MarshalAs(UnmanagedType.I4)] private readonly RelationType relation;
36 [MarshalAs(UnmanagedType.Bool)] private readonly bool passthrough;
36 - [MarshalAs(UnmanagedType.LPWStr)] private readonly string wzLayoutDirectory;
37 - [MarshalAs(UnmanagedType.LPWStr)] private readonly string wzBootstrapperWorkingFolder;
38 - [MarshalAs(UnmanagedType.LPWStr)] private readonly string wzBootstrapperApplicationDataPath;
37 + private readonly IntPtr wzLayoutDirectory;
38 + private readonly IntPtr wzBootstrapperWorkingFolder;
39 + private readonly IntPtr wzBootstrapperApplicationDataPath;
40
41 public IBootstrapperCommand GetBootstrapperCommand()
42 {
@@ -43,15 +44,15 @@ namespace WixToolset.Mba.Core
44 this.action,
45 this.display,
46 this.restart,
46 - this.wzCommandLine,
47 + Marshal.PtrToStringUni(this.wzCommandLine),
48 this.nCmdShow,
49 this.resume,
50 this.hwndSplashScreen,
51 this.relation,
52 this.passthrough,
52 - this.wzLayoutDirectory,
53 - this.wzBootstrapperWorkingFolder,
54 - this.wzBootstrapperApplicationDataPath);
53 + Marshal.PtrToStringUni(this.wzLayoutDirectory),
54 + Marshal.PtrToStringUni(this.wzBootstrapperWorkingFolder),
55 + Marshal.PtrToStringUni(this.wzBootstrapperApplicationDataPath));
56 }
57 }
58
src/balutil/balutil.vcxproj
+2 -2
@@ -2,7 +2,7 @@
2 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 - <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props')" />
5 + <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props')" />
6 <Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
7
8 <ItemGroup Label="ProjectConfigurations">
@@ -90,7 +90,7 @@
90 <PropertyGroup>
91 <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
92 </PropertyGroup>
93 - <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props'))" />
93 + <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props'))" />
94 <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props'))" />
95 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
96 </Target>
src/balutil/packages.config
+1 -1
@@ -1,6 +1,6 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <packages>
3 <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
4 - <package id="WixToolset.BootstrapperCore.Native" version="4.0.14" targetFramework="native" />
4 + <package id="WixToolset.BootstrapperCore.Native" version="4.0.15" targetFramework="native" />
5 <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
6 </packages>
\ No newline at end of file
src/bextutil/bextutil.vcxproj
+2 -2
@@ -2,7 +2,7 @@
2 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 - <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props')" />
5 + <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props')" />
6 <Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
7
8 <ItemGroup Label="ProjectConfigurations">
@@ -79,7 +79,7 @@
79 <PropertyGroup>
80 <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
81 </PropertyGroup>
82 - <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props'))" />
82 + <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props'))" />
83 <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props'))" />
84 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
85 </Target>
src/bextutil/packages.config
+1 -1
@@ -1,6 +1,6 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <packages>
3 <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
4 - <package id="WixToolset.BootstrapperCore.Native" version="4.0.14" targetFramework="native" />
4 + <package id="WixToolset.BootstrapperCore.Native" version="4.0.15" targetFramework="native" />
5 <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
6 </packages>
\ No newline at end of file
src/mbanative/mbanative.cpp
+1 -1
@@ -14,7 +14,7 @@ extern "C" HRESULT WINAPI InitializeFromCreateArgs(
14 hr = BalInitializeFromCreateArgs(pArgs, ppEngine);
15 ExitOnFailure(hr, "Failed to initialize Bal.");
16
17 - memcpy_s(pCommand, pCommand->cbSize, pArgs->pCommand, pArgs->pCommand->cbSize);
17 + memcpy_s(pCommand, pCommand->cbSize, pArgs->pCommand, min(pArgs->pCommand->cbSize, pCommand->cbSize));
18 LExit:
19 return hr;
20 }
src/mbanative/mbanative.vcxproj
+2 -2
@@ -2,7 +2,7 @@
2 <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
3
4 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 - <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props')" />
5 + <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props')" />
6 <Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
7
8 <ItemGroup Label="ProjectConfigurations">
@@ -69,7 +69,7 @@
69 <PropertyGroup>
70 <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
71 </PropertyGroup>
72 - <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.14\build\WixToolset.BootstrapperCore.Native.props'))" />
72 + <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props'))" />
73 <Error Condition="!Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props'))" />
74 <Error Condition="!Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
75 </Target>
src/mbanative/packages.config
+1 -1
@@ -1,6 +1,6 @@
1 <?xml version="1.0" encoding="utf-8"?>
2 <packages>
3 <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
4 - <package id="WixToolset.BootstrapperCore.Native" version="4.0.14" targetFramework="native" />
4 + <package id="WixToolset.BootstrapperCore.Native" version="4.0.15" targetFramework="native" />
5 <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
6 </packages>
\ No newline at end of file