Fix bugs around mbanative's InitializeFromCreateArgs.

This commit is contained in:
Sean Hall 2020-04-28 11:17:29 +10:00
Родитель efbe40802d
Коммит 1e7800b811
8 изменённых файлов: 19 добавлений и 18 удалений

Просмотреть файл

@ -23,19 +23,20 @@ namespace WixToolset.Mba.Core
[GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")] [GeneratedCodeAttribute("WixToolset.Bootstrapper.InteropCodeGenerator", "1.0.0.0")]
public struct Command public struct Command
{ {
// Strings must be declared as pointers so that Marshaling doesn't free them.
[MarshalAs(UnmanagedType.I4)] internal int cbSize; [MarshalAs(UnmanagedType.I4)] internal int cbSize;
[MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action; [MarshalAs(UnmanagedType.U4)] private readonly LaunchAction action;
[MarshalAs(UnmanagedType.U4)] private readonly Display display; [MarshalAs(UnmanagedType.U4)] private readonly Display display;
[MarshalAs(UnmanagedType.U4)] private readonly Restart restart; [MarshalAs(UnmanagedType.U4)] private readonly Restart restart;
[MarshalAs(UnmanagedType.LPWStr)] private readonly string wzCommandLine; private readonly IntPtr wzCommandLine;
[MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow; [MarshalAs(UnmanagedType.I4)] private readonly int nCmdShow;
[MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume; [MarshalAs(UnmanagedType.U4)] private readonly ResumeType resume;
private readonly IntPtr hwndSplashScreen; private readonly IntPtr hwndSplashScreen;
[MarshalAs(UnmanagedType.I4)] private readonly RelationType relation; [MarshalAs(UnmanagedType.I4)] private readonly RelationType relation;
[MarshalAs(UnmanagedType.Bool)] private readonly bool passthrough; [MarshalAs(UnmanagedType.Bool)] private readonly bool passthrough;
[MarshalAs(UnmanagedType.LPWStr)] private readonly string wzLayoutDirectory; private readonly IntPtr wzLayoutDirectory;
[MarshalAs(UnmanagedType.LPWStr)] private readonly string wzBootstrapperWorkingFolder; private readonly IntPtr wzBootstrapperWorkingFolder;
[MarshalAs(UnmanagedType.LPWStr)] private readonly string wzBootstrapperApplicationDataPath; private readonly IntPtr wzBootstrapperApplicationDataPath;
public IBootstrapperCommand GetBootstrapperCommand() public IBootstrapperCommand GetBootstrapperCommand()
{ {
@ -43,15 +44,15 @@ namespace WixToolset.Mba.Core
this.action, this.action,
this.display, this.display,
this.restart, this.restart,
this.wzCommandLine, Marshal.PtrToStringUni(this.wzCommandLine),
this.nCmdShow, this.nCmdShow,
this.resume, this.resume,
this.hwndSplashScreen, this.hwndSplashScreen,
this.relation, this.relation,
this.passthrough, this.passthrough,
this.wzLayoutDirectory, Marshal.PtrToStringUni(this.wzLayoutDirectory),
this.wzBootstrapperWorkingFolder, Marshal.PtrToStringUni(this.wzBootstrapperWorkingFolder),
this.wzBootstrapperApplicationDataPath); Marshal.PtrToStringUni(this.wzBootstrapperApplicationDataPath));
} }
} }

Просмотреть файл

@ -2,7 +2,7 @@
<!-- 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. --> <!-- 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. -->
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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')" /> <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')" />
<Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" /> <Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
@ -90,7 +90,7 @@
<PropertyGroup> <PropertyGroup>
<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> <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>
</PropertyGroup> </PropertyGroup>
<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'))" /> <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'))" />
<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'))" /> <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'))" />
<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'))" /> <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'))" />
</Target> </Target>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" /> <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
<package id="WixToolset.BootstrapperCore.Native" version="4.0.14" targetFramework="native" /> <package id="WixToolset.BootstrapperCore.Native" version="4.0.15" targetFramework="native" />
<package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" /> <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
</packages> </packages>

Просмотреть файл

@ -2,7 +2,7 @@
<!-- 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. --> <!-- 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. -->
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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')" /> <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')" />
<Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" /> <Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
@ -79,7 +79,7 @@
<PropertyGroup> <PropertyGroup>
<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> <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>
</PropertyGroup> </PropertyGroup>
<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'))" /> <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'))" />
<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'))" /> <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'))" />
<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'))" /> <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'))" />
</Target> </Target>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" /> <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
<package id="WixToolset.BootstrapperCore.Native" version="4.0.14" targetFramework="native" /> <package id="WixToolset.BootstrapperCore.Native" version="4.0.15" targetFramework="native" />
<package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" /> <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
</packages> </packages>

Просмотреть файл

@ -14,7 +14,7 @@ extern "C" HRESULT WINAPI InitializeFromCreateArgs(
hr = BalInitializeFromCreateArgs(pArgs, ppEngine); hr = BalInitializeFromCreateArgs(pArgs, ppEngine);
ExitOnFailure(hr, "Failed to initialize Bal."); ExitOnFailure(hr, "Failed to initialize Bal.");
memcpy_s(pCommand, pCommand->cbSize, pArgs->pCommand, pArgs->pCommand->cbSize); memcpy_s(pCommand, pCommand->cbSize, pArgs->pCommand, min(pArgs->pCommand->cbSize, pCommand->cbSize));
LExit: LExit:
return hr; return hr;
} }

Просмотреть файл

@ -2,7 +2,7 @@
<!-- 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. --> <!-- 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. -->
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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')" /> <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')" />
<Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" /> <Import Project="..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
@ -69,7 +69,7 @@
<PropertyGroup> <PropertyGroup>
<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> <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>
</PropertyGroup> </PropertyGroup>
<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'))" /> <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'))" />
<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'))" /> <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'))" />
<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'))" /> <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'))" />
</Target> </Target>

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" /> <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
<package id="WixToolset.BootstrapperCore.Native" version="4.0.14" targetFramework="native" /> <package id="WixToolset.BootstrapperCore.Native" version="4.0.15" targetFramework="native" />
<package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" /> <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
</packages> </packages>