Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ add_subdirectory(nuget)
add_subdirectory(msixgluepackage)
add_subdirectory(msipackage)
add_subdirectory(msixinstaller)
add_subdirectory(wslamsi)
add_subdirectory(src/windows/common)
add_subdirectory(src/windows/service)
add_subdirectory(src/windows/wslaservice)
Expand Down
49 changes: 49 additions & 0 deletions wslamsi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
set(BIN ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE})
set(OUTPUT_PACKAGE ${BIN}/wsla.msi)
set(PACKAGE_WIX_IN ${CMAKE_CURRENT_LIST_DIR}/package.wix.in)
set(PACKAGE_WIX ${BIN}/package.wix)
set(CAB_CACHE ${BIN}/cab)
set(BINARIES wslaserviceproxystub.dll;wslaservice.exe)

set(BINARIES_DEPENDENCIES)
foreach(binary ${BINARIES})
list(APPEND BINARIES_DEPENDENCIES "${BIN}/${binary}")
endforeach()

if (${WSL_BUILD_THIN_PACKAGE})
set(COMPRESS_PACKAGE "no")
else()
set(COMPRESS_PACKAGE "yes")
endif()

configure_file(${PACKAGE_WIX_IN} ${PACKAGE_WIX})
file(MAKE_DIRECTORY ${CAB_CACHE})

if (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(COMPRESSION "high")
else()
set(COMPRESSION "none")
endif()

add_custom_command(
OUTPUT ${OUTPUT_PACKAGE}
COMMAND ${WIX_SOURCE_DIR}/wix.exe build ${PACKAGE_WIX} -o ${OUTPUT_PACKAGE} -arch ${TARGET_PLATFORM} -dcl ${COMPRESSION} -cc ${CAB_CACHE} -pdbtype none
COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/CmakeFiles/wslamsi"
VERBATIM
DEPENDS ${PACKAGE_WIX} ${BINARIES_DEPENDENCIES} # Make sure the package is rebuilt if any of the binaries or resources change
)

add_custom_target(wslamsi DEPENDS ${OUTPUT_PACKAGE})
set_target_properties(wslamsi PROPERTIES EXCLUDE_FROM_ALL FALSE SOURCES ${PACKAGE_WIX_IN})
add_dependencies(wslamsi wslaservice wslaserviceproxystub)

set_source_files_properties(${OUTPUT_PACKAGE} PROPERTIES GENERATED TRUE)

if (DEFINED WSL_POST_BUILD_COMMAND)
add_custom_command(
TARGET wslamsi
POST_BUILD
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
USES_TERMINAL
COMMAND ${WSL_POST_BUILD_COMMAND} -Platform ${TARGET_PLATFORM} -BuildType ${CMAKE_BUILD_TYPE})
endif()
144 changes: 144 additions & 0 deletions wslamsi/package.wix.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package Name="WSL For Apps" Language="1033" InstallerVersion="500" Version="${PACKAGE_VERSION}" Manufacturer="Microsoft Corporation" UpgradeCode="6A4F9463-A9C4-4C00-9634-88C41F915FF6" Scope="perMachine" Compressed="${COMPRESS_PACKAGE}">
<MajorUpgrade AllowDowngrades="yes" Disallow="no" />
<MediaTemplate EmbedCab="yes" />

<StandardDirectory Id="ProgramFiles64Folder">
<Directory Id="INSTALLDIR" Name="WSLA" />
</StandardDirectory>

<Icon Id="wsl.ico" SourceFile="${CMAKE_SOURCE_DIR}/images/wsl.ico"/>
<Property Id="ARPPRODUCTICON" Value="wsl.ico"/>

<DirectoryRef Id="INSTALLDIR">
<Component Id="wslaservice" Guid="DC97520E-BFA5-4559-960F-D580E151629F" UninstallWhenSuperseded="yes" DisableRegistryReflection="yes" Bitness="always64">
<!-- WSLAServiceProxyStub. -->
<RegistryKey Root="HKCR" Key="CLSID\{4EA0C6DD-E9FF-48E7-994E-13A31D10DC61}">
<RegistryValue Value="PSFactoryBuffer" Type="string" />
<RegistryKey Key="InProcServer32">
<RegistryValue Value="[INSTALLDIR]wslaserviceproxystub.dll" Type="string" />
<RegistryValue Name="ThreadingModel" Value="Both" Type="string" />
</RegistryKey>
</RegistryKey>

<!-- WSLAService COM app -->
<RegistryKey Root="HKCR" Key="AppID\{E9B79997-57E3-4201-AECC-6A464E530DD2}">

<!-- O:BAG:BAD:(A;;CCDCSW;;;AU)(A;;CCDCSW;;;PS)(A;;CCDCSW;;;SY) -->
<RegistryValue Name="AccessPermission" Value="01000480580000006800000000000000140000000200440003000000000014000B00000001010000000000050B000000000014000B00000001010000000000050A000000000014000B0000000101000000000005120000000102000000000005200000002002000001020000000000052000000020020000" Type="binary" />
<RegistryValue Name="LaunchPermission" Value="01000480580000006800000000000000140000000200440003000000000014000B00000001010000000000050B000000000014000B00000001010000000000050A000000000014000B0000000101000000000005120000000102000000000005200000002002000001020000000000052000000020020000" Type="binary" />
<RegistryValue Name="LocalService" Value="WSLAService" Type="string" />
</RegistryKey>

<!-- WSLAContainer -->
<RegistryKey Root="HKCR" Key="CLSID\{B1F1C4E3-C225-4CAE-AD8A-34C004DE1AE4}">
<RegistryValue Name="AppId" Value="{E9B79997-57E3-4201-AECC-6A464E530DD2}" Type="string" />
<RegistryValue Value="WSLAContainer" Type="string" />
</RegistryKey>

<!-- WSLAProcess -->
<RegistryKey Root="HKCR" Key="CLSID\{AFBEA6D6-D8A4-4F81-8FED-F947EB74B33B}">
<RegistryValue Name="AppId" Value="{E9B79997-57E3-4201-AECC-6A464E530DD2}" Type="string" />
<RegistryValue Value="WSLAProcess" Type="string" />
</RegistryKey>

<!-- WSLAUserSession -->
<RegistryKey Root="HKCR" Key="CLSID\{a9b7a1b9-0671-405c-95f1-e0612cb4ce8f}">
<RegistryValue Name="AppId" Value="{E9B79997-57E3-4201-AECC-6A464E530DD2}" Type="string" />
<RegistryValue Value="WSLAUserSession" Type="string" />
</RegistryKey>

<!-- WSLAVirtualMachine -->
<RegistryKey Root="HKCR" Key="CLSID\{0CFC5DC1-B6A7-45FC-8034-3FA9ED73CE30}">
<RegistryValue Name="AppId" Value="{E9B79997-57E3-4201-AECC-6A464E530DD2}" Type="string" />
<RegistryValue Value="WSLAVirtualMachine" Type="string" />
</RegistryKey>
<!-- WSLASession -->
<RegistryKey Root="HKCR" Key="CLSID\{4877FEFC-4977-4929-A958-9F36AA1892A4}">
<RegistryValue Name="AppId" Value="{E9B79997-57E3-4201-AECC-6A464E530DD2}" Type="string" />
<RegistryValue Value="WSLASession" Type="string" />
</RegistryKey>

<!-- IWSLAUserSession-->
<RegistryKey Root="HKCR" Key="Interface\{82A7ABC8-6B50-43FC-AB96-15FBBE7E8760}">
<RegistryValue Value="IWSLAUserSession" Type="string" />
<RegistryKey Key="ProxyStubClsid32">
<RegistryValue Value="{4EA0C6DD-E9FF-48E7-994E-13A31D10DC61}" Type="string" />
</RegistryKey>
</RegistryKey>

<!-- IWSLAVirtualMachine-->
<RegistryKey Root="HKCR" Key="Interface\{82A7ABC8-6B50-43FC-AB96-15FBBE7E8761}">
<RegistryValue Value="IWSLAVirtualMachine" Type="string" />
<RegistryKey Key="ProxyStubClsid32">
<RegistryValue Value="{4EA0C6DD-E9FF-48E7-994E-13A31D10DC61}" Type="string" />
</RegistryKey>
</RegistryKey>

<!-- IWSLAContainer-->
<RegistryKey Root="HKCR" Key="Interface\{7577FE8D-DE85-471E-B870-11669986F332}">
<RegistryValue Value="IWSLAContainer" Type="string" />
<RegistryKey Key="ProxyStubClsid32">
<RegistryValue Value="{4EA0C6DD-E9FF-48E7-994E-13A31D10DC61}" Type="string" />
</RegistryKey>
</RegistryKey>

<!-- IWSLAProcess-->
<RegistryKey Root="HKCR" Key="Interface\{1AD163CD-393D-4B33-83A2-8A3F3F23E608}">
<RegistryValue Value="IWSLAProcess" Type="string" />
<RegistryKey Key="ProxyStubClsid32">
<RegistryValue Value="{4EA0C6DD-E9FF-48E7-994E-13A31D10DC61}" Type="string" />
</RegistryKey>
</RegistryKey>

<!-- ITerminationCallback-->
<RegistryKey Root="HKCR" Key="Interface\{7BC4E198-6531-4FA6-ADE2-5EF3D2A04DFE}">
<RegistryValue Value="ITerminationCallback" Type="string" />
<RegistryKey Key="ProxyStubClsid32">
<RegistryValue Value="{4EA0C6DD-E9FF-48E7-994E-13A31D10DC61}" Type="string" />
</RegistryKey>
</RegistryKey>

<!-- IProgressCallback-->
<RegistryKey Root="HKCR" Key="Interface\{5038842F-53DB-4F30-A6D0-A41B02C94AC1}">
<RegistryValue Value="IProgressCallback" Type="string" />
<RegistryKey Key="ProxyStubClsid32">
<RegistryValue Value="{4EA0C6DD-E9FF-48E7-994E-13A31D10DC61}" Type="string" />
</RegistryKey>
</RegistryKey>

<!-- IWSLASession-->
<RegistryKey Root="HKCR" Key="Interface\{EF0661E4-6364-40EA-B433-E2FDF11F3519}">
<RegistryValue Value="IWSLASession" Type="string" />
<RegistryKey Key="ProxyStubClsid32">
<RegistryValue Value="{4EA0C6DD-E9FF-48E7-994E-13A31D10DC61}" Type="string" />
</RegistryKey>
</RegistryKey>

<File Id="wslaservice.exe" Source="${BIN}/wslaservice.exe" KeyPath="yes" />
<File Id="wslaserviceproxystub.dll" Name="wslaserviceproxystub.dll" Source="${BIN}/wslaserviceproxystub.dll" />

<ServiceInstall Name="WSLAService" DisplayName="WSLA Service" Description="WSLA Service" Start="auto" Type="ownProcess" ErrorControl="normal" Account="LocalSystem" Vital="yes" Interactive="no" />
<ServiceControl Id="StopWSLAService" Stop="both" Remove="uninstall" Name="WSLAService" Wait="yes" />
</Component>
</DirectoryRef>

<Feature Id="WSLA" Title="WSL For Apps" Level="1">
<ComponentRef Id="wslaservice" />
</Feature>

<!-- Don't show a 'Modify' button in settings since there is nothing to modify -->
<Property Id="ARPNOMODIFY" Value="yes" Secure="yes" />
<Property Id="ARPSYSTEMCOMPONENT" Value="yes" Secure="yes" />

<!-- Setting REINSTALLMODE to AMUS will force all re-installed components to re-install all files, registry keys and shortcuts.
This is useful during downgrades since components with KeyPath set will not removed if their KeyPath points to valid file / registry key.
-->
<Property Id="REINSTALLMODE" Value="AMUS" Secure="yes" />

<!-- Force all applications to exit during upgrade.
See: https://learn.microsoft.com/en-us/windows/win32/msi/msirmshutdown
-->
<Property Id="MSIRMSHUTDOWN" Value="0" Secure="yes" />
</Package>
</Wix>
Loading