Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
robmen committed Feb 24, 2024
1 parent ec1284a commit fea9a1b
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ enum BOOTSTRAPPER_ENGINE_MESSAGE
typedef struct _BAENGINE_APPLY_ARGS
{
DWORD cbSize;
HWND hwndParent;
DWORD64 hwndParent;
} BAENGINE_APPLY_ARGS;

typedef struct _BAENGINE_APPLY_RESULTS
Expand Down Expand Up @@ -148,13 +148,13 @@ typedef struct _BAENGINE_COMPAREVERSIONS_ARGS
typedef struct _BAENGINE_COMPAREVERSIONS_RESULTS
{
DWORD cbSize;
int nResult;
INT32 nResult;
} BAENGINE_COMPAREVERSIONS_RESULTS;

typedef struct _BAENGINE_DETECT_ARGS
{
DWORD cbSize;
HWND hwndParent;
DWORD64 hwndParent;
} BAENGINE_DETECT_ARGS;

typedef struct _BAENGINE_DETECT_RESULTS
Expand All @@ -165,7 +165,7 @@ typedef struct _BAENGINE_DETECT_RESULTS
typedef struct _BAENGINE_ELEVATE_ARGS
{
DWORD cbSize;
HWND hwndParent;
DWORD64 hwndParent;
} BAENGINE_ELEVATE_ARGS;

typedef struct _BAENGINE_ELEVATE_RESULTS
Expand Down Expand Up @@ -267,7 +267,7 @@ typedef struct _BAENGINE_GETVARIABLEVERSION_RESULTS
typedef struct _BAENGINE_LAUNCHAPPROVEDEXE_ARGS
{
DWORD cbSize;
HWND hwndParent;
DWORD64 hwndParent;
LPCWSTR wzApprovedExeForElevationId;
LPCWSTR wzArguments;
DWORD dwWaitForInputIdleTimeout;
Expand Down Expand Up @@ -335,7 +335,7 @@ typedef struct _BAENGINE_SENDEMBEDDEDERROR_ARGS
typedef struct _BAENGINE_SENDEMBEDDEDERROR_RESULTS
{
DWORD cbSize;
int nResult;
INT32 nResult;
} BAENGINE_SENDEMBEDDEDERROR_RESULTS;

typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_ARGS
Expand All @@ -348,7 +348,7 @@ typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_ARGS
typedef struct _BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS
{
DWORD cbSize;
int nResult;
INT32 nResult;
} BAENGINE_SENDEMBEDDEDPROGRESS_RESULTS;

typedef struct _BAENGINE_SETDOWNLOADSOURCE_ARGS
Expand Down
16 changes: 8 additions & 8 deletions src/api/burn/balutil/BalBootstrapperEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1096,15 +1096,15 @@ class CBalBootstrapperEngine : public IBootstrapperEngine

// Init send structs.
args.cbSize = sizeof(args);
args.hwndParent = hwndParent;
args.hwndParent = reinterpret_cast<DWORD64>(hwndParent);

results.cbSize = sizeof(results);

// Send args.
hr = BuffWriteNumber(&pbData, &cbData, args.cbSize);
ExitOnFailure(hr, "Failed to write size of Detect args.");

hr = BuffWriteNumber64(&pbData, &cbData, reinterpret_cast<DWORD64>(args.hwndParent));
hr = BuffWriteNumber64(&pbData, &cbData, args.hwndParent);
ExitOnFailure(hr, "Failed to write parent window of Detect args.");

// Send results.
Expand Down Expand Up @@ -1172,15 +1172,15 @@ class CBalBootstrapperEngine : public IBootstrapperEngine

// Init send structs.
args.cbSize = sizeof(args);
args.hwndParent = hwndParent;
args.hwndParent = reinterpret_cast<DWORD64>(hwndParent);

results.cbSize = sizeof(results);

// Send args.
hr = BuffWriteNumber(&pbData, &cbData, args.cbSize);
ExitOnFailure(hr, "Failed to write size of Elevate args.");

hr = BuffWriteNumber64(&pbData, &cbData, reinterpret_cast<DWORD64>(args.hwndParent));
hr = BuffWriteNumber64(&pbData, &cbData, args.hwndParent);
ExitOnFailure(hr, "Failed to write parent window of Elevate args.");

// Send results.
Expand Down Expand Up @@ -1210,15 +1210,15 @@ class CBalBootstrapperEngine : public IBootstrapperEngine

// Init send structs.
args.cbSize = sizeof(args);
args.hwndParent = hwndParent;
args.hwndParent = reinterpret_cast<DWORD64>(hwndParent);

results.cbSize = sizeof(results);

// Send args.
hr = BuffWriteNumber(&pbData, &cbData, args.cbSize);
ExitOnFailure(hr, "Failed to write size of Apply args.");

hr = BuffWriteNumber64(&pbData, &cbData, reinterpret_cast<DWORD64>(args.hwndParent));
hr = BuffWriteNumber64(&pbData, &cbData, args.hwndParent);
ExitOnFailure(hr, "Failed to write parent window of Apply args.");

// Send results.
Expand Down Expand Up @@ -1290,7 +1290,7 @@ class CBalBootstrapperEngine : public IBootstrapperEngine

// Init send structs.
args.cbSize = sizeof(args);
args.hwndParent = hwndParent;
args.hwndParent = reinterpret_cast<DWORD64>(hwndParent);
args.wzApprovedExeForElevationId = wzApprovedExeForElevationId;
args.wzArguments = wzArguments;
args.dwWaitForInputIdleTimeout = dwWaitForInputIdleTimeout;
Expand All @@ -1301,7 +1301,7 @@ class CBalBootstrapperEngine : public IBootstrapperEngine
hr = BuffWriteNumberToBuffer(&buffer, args.cbSize);
ExitOnFailure(hr, "Failed to write size of LaunchApprovedExe args.");

hr = BuffWriteNumber64ToBuffer(&buffer, reinterpret_cast<DWORD64>(args.hwndParent));
hr = BuffWriteNumber64ToBuffer(&buffer, args.hwndParent);
ExitOnFailure(hr, "Failed to write parent window of LaunchApprovedExe args.");

hr = BuffWriteStringToBuffer(&buffer, args.wzApprovedExeForElevationId);
Expand Down
28 changes: 8 additions & 20 deletions src/burn/engine/baengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1118,17 +1118,14 @@ static HRESULT BAEngineDetect(
HRESULT hr = S_OK;
BAENGINE_DETECT_ARGS args = { };
BAENGINE_DETECT_RESULTS results = { };
DWORD64 dw64 = 0;

// Unpack args.
hr = BuffReaderReadNumber(pReader, &args.cbSize);
ExitOnFailure(hr, "Failed to read size of BAEngineDetect args.");

hr = BuffReaderReadNumber64(pReader, &dw64);
hr = BuffReaderReadNumber64(pReader, &args.hwndParent);
ExitOnFailure(hr, "Failed to read parent window of BAEngineDetect args.");

args.hwndParent = reinterpret_cast<HWND>(dw64);

hr = BuffReaderSkipExtraData(pReader, sizeof(args), args.cbSize);
ExitOnRootFailure(hr, "BAEngineDetect args size does not match expected size.");

Expand All @@ -1137,7 +1134,7 @@ static HRESULT BAEngineDetect(
ExitOnFailure(hr, "Failed to read size of BAEngineDetect results.");

// Execute.
hr = ExternalEngineDetect(pContext, args.hwndParent);
hr = ExternalEngineDetect(pContext, reinterpret_cast<HWND>(args.hwndParent));
ExitOnFailure(hr, "Failed to detect in the engine.");

// Pack result.
Expand Down Expand Up @@ -1193,17 +1190,14 @@ static HRESULT BAEngineElevate(
HRESULT hr = S_OK;
BAENGINE_ELEVATE_ARGS args = { };
BAENGINE_ELEVATE_RESULTS results = { };
DWORD64 dw64 = 0;

// Unpack args.
hr = BuffReaderReadNumber(pReader, &args.cbSize);
ExitOnFailure(hr, "Failed to read size of BAEngineElevate args.");

hr = BuffReaderReadNumber64(pReader, &dw64);
hr = BuffReaderReadNumber64(pReader, &args.hwndParent);
ExitOnFailure(hr, "Failed to read parent window of BAEngineElevate args.");

args.hwndParent = reinterpret_cast<HWND>(dw64);

hr = BuffReaderSkipExtraData(pReader, sizeof(args), args.cbSize);
ExitOnRootFailure(hr, "BAEngineElevate args size does not match expected size.");

Expand All @@ -1212,7 +1206,7 @@ static HRESULT BAEngineElevate(
ExitOnFailure(hr, "Failed to read size of BAEngineElevate results.");

// Execute.
hr = ExternalEngineElevate(pContext, args.hwndParent);
hr = ExternalEngineElevate(pContext, reinterpret_cast<HWND>(args.hwndParent));
ExitOnFailure(hr, "Failed to detect in the engine.");

// Pack result.
Expand All @@ -1232,17 +1226,14 @@ static HRESULT BAEngineApply(
HRESULT hr = S_OK;
BAENGINE_APPLY_ARGS args = { };
BAENGINE_APPLY_RESULTS results = { };
DWORD64 dw64 = 0;

// Unpack args.
hr = BuffReaderReadNumber(pReader, &args.cbSize);
ExitOnFailure(hr, "Failed to read size of BAEngineApply args.");

hr = BuffReaderReadNumber64(pReader, &dw64);
hr = BuffReaderReadNumber64(pReader, &args.hwndParent);
ExitOnFailure(hr, "Failed to read parent window of BAEngineApply args.");

args.hwndParent = reinterpret_cast<HWND>(dw64);

hr = BuffReaderSkipExtraData(pReader, sizeof(args), args.cbSize);
ExitOnRootFailure(hr, "BAEngineApply args size does not match expected size.");

Expand All @@ -1251,7 +1242,7 @@ static HRESULT BAEngineApply(
ExitOnFailure(hr, "Failed to read size of BAEngineApply results.");

// Execute.
hr = ExternalEngineApply(pContext, args.hwndParent);
hr = ExternalEngineApply(pContext, reinterpret_cast<HWND>(args.hwndParent));
ExitOnFailure(hr, "Failed to detect in the engine.");

// Pack result.
Expand Down Expand Up @@ -1309,17 +1300,14 @@ static HRESULT BAEngineLaunchApprovedExe(
BAENGINE_LAUNCHAPPROVEDEXE_RESULTS results = { };
LPWSTR sczApprovedExeForElevationId = NULL;
LPWSTR sczArguments = NULL;
DWORD64 dw64 = 0;

// Unpack args.
hr = BuffReaderReadNumber(pReader, &args.cbSize);
ExitOnFailure(hr, "Failed to read size of BAEngineLaunchApprovedExe args.");

hr = BuffReaderReadNumber64(pReader, &dw64);
hr = BuffReaderReadNumber64(pReader, &args.hwndParent);
ExitOnFailure(hr, "Failed to read parent window of BAEngineLaunchApprovedExe args.");

args.hwndParent = reinterpret_cast<HWND>(dw64);

hr = BuffReaderReadString(pReader, &sczApprovedExeForElevationId);
ExitOnFailure(hr, "Failed to read approved exe elevation id of BAEngineLaunchApprovedExe args.");

Expand All @@ -1341,7 +1329,7 @@ static HRESULT BAEngineLaunchApprovedExe(
ExitOnFailure(hr, "Failed to read size of BAEngineLaunchApprovedExe results.");

// Execute.
hr = ExternalEngineLaunchApprovedExe(pContext, args.hwndParent, args.wzApprovedExeForElevationId, args.wzArguments, args.dwWaitForInputIdleTimeout);
hr = ExternalEngineLaunchApprovedExe(pContext, reinterpret_cast<HWND>(args.hwndParent), args.wzApprovedExeForElevationId, args.wzArguments, args.dwWaitForInputIdleTimeout);
ExitOnFailure(hr, "Failed to quit the engine.");

// Pack result.
Expand Down
4 changes: 3 additions & 1 deletion src/ext/Bal/test/examples/EarliestCoreMBA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ namespace Example.EarliestCoreMBA

internal class Program
{
private static void Main()
private static int Main()
{
var application = new EarliestCoreBA();

ManagedBootstrapperApplication.Run(application);

return 0;
}
}
}
4 changes: 3 additions & 1 deletion src/ext/Bal/test/examples/FullFramework2MBA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ namespace Example.FullFramework2MBA

internal class Program
{
private static void Main()
private static int Main()
{
var application = new FullFramework2BA();

ManagedBootstrapperApplication.Run(application);

return 0;
}
}
}
4 changes: 3 additions & 1 deletion src/ext/Bal/test/examples/FullFramework4MBA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ namespace Example.FullFramework4MBA

internal class Program
{
private static void Main()
private static int Main()
{
var application = new FullFramework4BA();

ManagedBootstrapperApplication.Run(application);

return 0;
}
}
}
4 changes: 3 additions & 1 deletion src/ext/Bal/test/examples/LatestCoreMBA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ namespace Example.LatestCoreMBA

internal class Program
{
private static void Main()
private static int Main()
{
var application = new LatestCoreBA();

ManagedBootstrapperApplication.Run(application);

return 0;
}
}
}
4 changes: 3 additions & 1 deletion src/test/burn/TestBA/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ namespace WixToolset.Test.BA

internal class Program
{
private static void Main()
private static int Main()
{
var application = new TestBA();

ManagedBootstrapperApplication.Run(application);

return 0;
}
}
}
2 changes: 1 addition & 1 deletion src/test/burn/TestBA/TestBA.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<EnableDynamicLoading>true</EnableDynamicLoading>
<UseWindowsForms>true</UseWindowsForms>
<SelfContained>true</SelfContained>
<SelfContained>false</SelfContained>
<RollForward>Major</RollForward>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/test/burn/TestBA/TestBA_x64.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<EnableDynamicLoading>true</EnableDynamicLoading>
<UseWindowsForms>true</UseWindowsForms>
<SelfContained>true</SelfContained>
<SelfContained>false</SelfContained>
<RollForward>Major</RollForward>
</PropertyGroup>

Expand Down
1 change: 1 addition & 0 deletions src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Fragment>
<BootstrapperApplication Id="BrokenDnc" SourceFile="!(bindpath.dncx86)\TestBA.exe">
<Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" />
<Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" />
<Payload Name="good.runtimeconfig.json" SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" />
<Payload Name="TestBA.runtimeconfig.json" SourceFile="bad.runtimeconfig.json" />
<Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" />
Expand Down
1 change: 1 addition & 0 deletions src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Fragment>
<BootstrapperApplication Id="BrokenDncAlwaysPrereq" SourceFile="!(bindpath.dncx86)\TestBA.exe">
<Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" />
<Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" />
<Payload Name="good.runtimeconfig.json" SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" />
<Payload Name="TestBA.runtimeconfig.json" SourceFile="bad.runtimeconfig.json" />
<Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" />
Expand Down
1 change: 1 addition & 0 deletions src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Fragment>
<BootstrapperApplication Id="DncAlwaysPrereq" SourceFile="!(bindpath.dncx86)\TestBA.exe">
<Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" />
<Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" />
<Payload SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" />
<Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" />
<Payload SourceFile="!(bindpath.dncx86)\WixToolset.Mba.Core.dll" />
Expand Down
3 changes: 3 additions & 0 deletions src/test/burn/TestData/TestBA/TestBAWixlib/TestBA.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<Fragment>
<BootstrapperApplication SourceFile="!(bindpath.dncx86)\TestBA.exe">
<Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" />
<Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" />
<Payload SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" />
<Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" />
<Payload SourceFile="!(bindpath.dncx86)\WixToolset.Mba.Core.dll" />
</BootstrapperApplication>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Fragment>
<BootstrapperApplication SourceFile="!(bindpath.dncx64)\TestBA.exe">
<Payload SourceFile="!(bindpath.dncx64)\TestBA.deps.json" />
<Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" />
<Payload SourceFile="!(bindpath.dncx64)\TestBA.runtimeconfig.json" />
<Payload SourceFile="!(bindpath.dncx64)\mbanative.dll" />
<Payload SourceFile="!(bindpath.dncx64)\WixToolset.Mba.Core.dll" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Fragment>
<BootstrapperApplication SourceFile="!(bindpath.dncx64)\WixToolset.WixBA.exe">
<Payload SourceFile="!(bindpath.dncx64)\WixToolset.WixBA.deps.json" />
<Payload SourceFile="!(bindpath.dncx64)\WixToolset.WixBA.dll" />
<Payload SourceFile="!(bindpath.dncx64)\WixToolset.WixBA.runtimeconfig.json" />
<Payload SourceFile="!(bindpath.dncx64)\mbanative.dll" />
<Payload SourceFile="!(bindpath.dncx64)\WixToolset.Mba.Core.dll" />
Expand Down
Loading

0 comments on commit fea9a1b

Please sign in to comment.