aboutsummaryrefslogtreecommitdiff
path: root/src/stub
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2018-12-29 22:12:08 -0600
committerSean Hall <r.sean.hall@gmail.com>2018-12-29 22:12:08 -0600
commit61847dddd4fd497057c780658e383c4627de19ec (patch)
treef85a845182922538ab9aa6ee85b0db3ab40c1f6e /src/stub
parent8295f5f8fd28042e1a0a172d5afbba79178064c2 (diff)
downloadwix-61847dddd4fd497057c780658e383c4627de19ec.tar.gz
wix-61847dddd4fd497057c780658e383c4627de19ec.tar.bz2
wix-61847dddd4fd497057c780658e383c4627de19ec.zip
Import code from old v4 repo
Diffstat (limited to 'src/stub')
-rw-r--r--src/stub/StubSection.cpp23
-rw-r--r--src/stub/precomp.h13
-rw-r--r--src/stub/stub.cpp64
-rw-r--r--src/stub/stub.icobin0 -> 2238 bytes
-rw-r--r--src/stub/stub.manifest18
-rw-r--r--src/stub/stub.rc14
6 files changed, 132 insertions, 0 deletions
diff --git a/src/stub/StubSection.cpp b/src/stub/StubSection.cpp
new file mode 100644
index 00000000..962bb3cf
--- /dev/null
+++ b/src/stub/StubSection.cpp
@@ -0,0 +1,23 @@
1// 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.
2
3#include "precomp.h"
4
5#pragma section(".wixburn",read)
6
7// If these defaults ever change, be sure to update constants in burn\engine\section.cpp as well.
8#pragma data_seg(push, ".wixburn")
9static DWORD dwMagic = 0x00f14300;
10static DWORD dwVersion = 0x00000002;
11
12static GUID guidBundleId = { };
13
14static DWORD dwStubSize = 0;
15static DWORD dwOriginalChecksum = 0;
16static DWORD dwOriginalSignatureOffset = 0;
17static DWORD dwOriginalSignatureSize = 0;
18
19static DWORD dwContainerFormat = 1;
20static DWORD dwContainerCount = 0;
21static DWORD qwBootstrapperApplicationContainerSize = 0;
22static DWORD qwAttachedContainerSize = 0;
23#pragma data_seg(pop)
diff --git a/src/stub/precomp.h b/src/stub/precomp.h
new file mode 100644
index 00000000..387d4f0f
--- /dev/null
+++ b/src/stub/precomp.h
@@ -0,0 +1,13 @@
1#pragma once
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
5#include <windows.h>
6
7#include <dutil.h>
8#include <apputil.h>
9#include <strutil.h>
10#include <fileutil.h>
11#include <pathutil.h>
12
13#include "engine.h"
diff --git a/src/stub/stub.cpp b/src/stub/stub.cpp
new file mode 100644
index 00000000..2f09eede
--- /dev/null
+++ b/src/stub/stub.cpp
@@ -0,0 +1,64 @@
1// 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.
2
3#include "precomp.h"
4
5
6int WINAPI wWinMain(
7 __in HINSTANCE hInstance,
8 __in_opt HINSTANCE /* hPrevInstance */,
9 __in_z_opt LPWSTR lpCmdLine,
10 __in int nCmdShow
11 )
12{
13 HRESULT hr = S_OK;
14 DWORD dwExitCode = 0;
15 LPWSTR sczPath = NULL;
16 HANDLE hEngineFile = INVALID_HANDLE_VALUE;
17
18 LPCWSTR rgsczSafelyLoadSystemDlls[] =
19 {
20 L"cabinet.dll", // required by Burn.
21 L"msi.dll", // required by Burn.
22 L"version.dll", // required by Burn.
23 L"wininet.dll", // required by Burn.
24
25 L"comres.dll", // required by CLSIDFromProgID() when loading clbcatq.dll.
26 L"clbcatq.dll", // required by CLSIDFromProgID() when loading msxml?.dll.
27
28 L"msasn1.dll", // required by DecryptFile() when loading crypt32.dll.
29 L"crypt32.dll", // required by DecryptFile() when loading feclient.dll.
30 L"feclient.dll", // unsafely loaded by DecryptFile().
31 };
32
33 // Best effort attempt to get our file handle as soon as possible.
34 hr = PathForCurrentProcess(&sczPath, NULL);
35 if (SUCCEEDED(hr))
36 {
37 hEngineFile = ::CreateFileW(sczPath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
38 }
39
40 // If the engine is in the clean room, we'll do the unsafe initialization
41 // because some systems in Windows (namely GDI+) will fail when run in
42 // a process that protects against DLL hijacking. Since we know the clean
43 // room is in a clean folder and not subject to DLL hijacking we won't
44 // make ourselves perfectly secure so that we can load BAs that still
45 // depend on those parts of Windows that are insecure to DLL hijacking.
46 if (EngineInCleanRoom(lpCmdLine))
47 {
48 AppInitializeUnsafe();
49 }
50 else
51 {
52 AppInitialize(rgsczSafelyLoadSystemDlls, countof(rgsczSafelyLoadSystemDlls));
53 }
54
55 // call run
56 hr = EngineRun(hInstance, hEngineFile, lpCmdLine, nCmdShow, &dwExitCode);
57 ExitOnFailure(hr, "Failed to run application.");
58
59LExit:
60 ReleaseFileHandle(hEngineFile);
61 ReleaseStr(sczPath);
62
63 return FAILED(hr) ? (int)hr : (int)dwExitCode;
64}
diff --git a/src/stub/stub.ico b/src/stub/stub.ico
new file mode 100644
index 00000000..c2e2717c
--- /dev/null
+++ b/src/stub/stub.ico
Binary files differ
diff --git a/src/stub/stub.manifest b/src/stub/stub.manifest
new file mode 100644
index 00000000..d5767cdb
--- /dev/null
+++ b/src/stub/stub.manifest
@@ -0,0 +1,18 @@
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
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
5<assembly xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" manifestVersion="1.0">
6 <assemblyIdentity name="setup.exe" version="1.0.0.0" processorArchitecture="x86" type="win32"/>
7 <description>WiX Toolset Bootstrapper</description>
8 <asmv3:application><asmv3:windowsSettings><ws:dpiAware xmlns:ws="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</ws:dpiAware></asmv3:windowsSettings></asmv3:application>
9 <dependency><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /></dependentAssembly></dependency>
10 <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"><application>
11 <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
12 <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
13 <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
14 <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
15 <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
16 </application></compatibility>
17 <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"><security><requestedPrivileges><requestedExecutionLevel level="asInvoker" uiAccess="false"/></requestedPrivileges></security></trustInfo>
18</assembly>
diff --git a/src/stub/stub.rc b/src/stub/stub.rc
new file mode 100644
index 00000000..5601703d
--- /dev/null
+++ b/src/stub/stub.rc
@@ -0,0 +1,14 @@
1// 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.
2
3#define VER_APP
4#define VER_ORIGINAL_FILENAME "setup.exe"
5#define VER_INTERNAL_NAME "setup"
6#define VER_FILE_DESCRIPTION "WiX Toolset Bootstrapper"
7#include "wix.rc"
8
91 ICON "stub.ico"
10
11//#define MANIFEST_RESOURCE_ID 1
12#ifndef ARM // the ARM manifest is automatically injected but other platforms need it done manually.
13//MANIFEST_RESOURCE_ID RT_MANIFEST "stub.manifest"
14#endif