├── .gitignore
├── DistroLauncher-Appx
├── Assets
│ ├── LargeTile.scale-100.png
│ ├── LargeTile.scale-125.png
│ ├── LargeTile.scale-150.png
│ ├── LargeTile.scale-200.png
│ ├── LargeTile.scale-400.png
│ ├── SmallTile.scale-100.png
│ ├── SmallTile.scale-125.png
│ ├── SmallTile.scale-150.png
│ ├── SmallTile.scale-200.png
│ ├── SmallTile.scale-400.png
│ ├── SplashScreen.scale-100.png
│ ├── SplashScreen.scale-125.png
│ ├── SplashScreen.scale-150.png
│ ├── SplashScreen.scale-200.png
│ ├── SplashScreen.scale-400.png
│ ├── Square150x150Logo.scale-100.png
│ ├── Square150x150Logo.scale-125.png
│ ├── Square150x150Logo.scale-150.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square150x150Logo.scale-400.png
│ ├── Square44x44Logo.altform-unplated_targetsize-16.png
│ ├── Square44x44Logo.altform-unplated_targetsize-256.png
│ ├── Square44x44Logo.altform-unplated_targetsize-32.png
│ ├── Square44x44Logo.altform-unplated_targetsize-48.png
│ ├── Square44x44Logo.scale-100.png
│ ├── Square44x44Logo.scale-125.png
│ ├── Square44x44Logo.scale-150.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.scale-400.png
│ ├── Square44x44Logo.targetsize-16.png
│ ├── Square44x44Logo.targetsize-24.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── Square44x44Logo.targetsize-256.png
│ ├── Square44x44Logo.targetsize-32.png
│ ├── Square44x44Logo.targetsize-48.png
│ ├── StoreLogo.scale-100.png
│ ├── StoreLogo.scale-125.png
│ ├── StoreLogo.scale-150.png
│ ├── StoreLogo.scale-200.png
│ ├── StoreLogo.scale-400.png
│ ├── Wide310x150Logo.scale-100.png
│ ├── Wide310x150Logo.scale-125.png
│ ├── Wide310x150Logo.scale-150.png
│ ├── Wide310x150Logo.scale-200.png
│ └── Wide310x150Logo.scale-400.png
├── DistroLauncher-Appx.vcxproj
├── DistroLauncher-Appx.vcxproj.filters
└── MyDistro.appxmanifest
├── DistroLauncher.sln
├── DistroLauncher
├── DistributionInfo.cpp
├── DistributionInfo.h
├── DistroLauncher.cpp
├── DistroLauncher.rc
├── DistroLauncher.vcxproj
├── DistroLauncher.vcxproj.filters
├── Helpers.cpp
├── Helpers.h
├── WslApiLoader.cpp
├── WslApiLoader.h
├── images
│ ├── icon.ico
│ └── icon.png
├── messages.mc
├── resource.h
├── stdafx.cpp
├── stdafx.h
└── targetver.h
├── LICENSE
├── README.md
├── SECURITY.md
└── build.bat
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.suo
8 | *.user
9 | *.userosscache
10 | *.sln.docstates
11 |
12 | # User-specific files (MonoDevelop/Xamarin Studio)
13 | *.userprefs
14 |
15 | # Build results
16 | [Dd]ebug/
17 | [Dd]ebugPublic/
18 | [Rr]elease/
19 | [Rr]eleases/
20 | x64/
21 | x86/
22 | bld/
23 | [Bb]in/
24 | [Oo]bj/
25 | [Ll]og/
26 |
27 | # Visual Studio 2015 cache/options directory
28 | .vs/
29 | # Uncomment if you have tasks that create the project's static files in wwwroot
30 | #wwwroot/
31 |
32 | # MSTest test Results
33 | [Tt]est[Rr]esult*/
34 | [Bb]uild[Ll]og.*
35 |
36 | # NUNIT
37 | *.VisualState.xml
38 | TestResult.xml
39 |
40 | # Build Results of an ATL Project
41 | [Dd]ebugPS/
42 | [Rr]eleasePS/
43 | dlldata.c
44 |
45 | # .NET Core
46 | project.lock.json
47 | project.fragment.lock.json
48 | artifacts/
49 | **/Properties/launchSettings.json
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 | *.VC.db
88 | *.VC.VC.opendb
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 | *.sap
95 |
96 | # TFS 2012 Local Workspace
97 | $tf/
98 |
99 | # Guidance Automation Toolkit
100 | *.gpState
101 |
102 | # ReSharper is a .NET coding add-in
103 | _ReSharper*/
104 | *.[Rr]e[Ss]harper
105 | *.DotSettings.user
106 |
107 | # JustCode is a .NET coding add-in
108 | .JustCode
109 |
110 | # TeamCity is a build add-in
111 | _TeamCity*
112 |
113 | # DotCover is a Code Coverage Tool
114 | *.dotCover
115 |
116 | # Visual Studio code coverage results
117 | *.coverage
118 | *.coveragexml
119 |
120 | # NCrunch
121 | _NCrunch_*
122 | .*crunch*.local.xml
123 | nCrunchTemp_*
124 |
125 | # MightyMoose
126 | *.mm.*
127 | AutoTest.Net/
128 |
129 | # Web workbench (sass)
130 | .sass-cache/
131 |
132 | # Installshield output folder
133 | [Ee]xpress/
134 |
135 | # DocProject is a documentation generator add-in
136 | DocProject/buildhelp/
137 | DocProject/Help/*.HxT
138 | DocProject/Help/*.HxC
139 | DocProject/Help/*.hhc
140 | DocProject/Help/*.hhk
141 | DocProject/Help/*.hhp
142 | DocProject/Help/Html2
143 | DocProject/Help/html
144 |
145 | # Click-Once directory
146 | publish/
147 |
148 | # Publish Web Output
149 | *.[Pp]ublish.xml
150 | *.azurePubxml
151 | # TODO: Comment the next line if you want to checkin your web deploy settings
152 | # but database connection strings (with potential passwords) will be unencrypted
153 | *.pubxml
154 | *.publishproj
155 |
156 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
157 | # checkin your Azure Web App publish settings, but sensitive information contained
158 | # in these scripts will be unencrypted
159 | PublishScripts/
160 |
161 | # NuGet Packages
162 | *.nupkg
163 | # The packages folder can be ignored because of Package Restore
164 | **/packages/*
165 | # except build/, which is used as an MSBuild target.
166 | !**/packages/build/
167 | # Uncomment if necessary however generally it will be regenerated when needed
168 | #!**/packages/repositories.config
169 | # NuGet v3's project.json files produces more ignorable files
170 | *.nuget.props
171 | *.nuget.targets
172 |
173 | # Microsoft Azure Build Output
174 | csx/
175 | *.build.csdef
176 |
177 | # Microsoft Azure Emulator
178 | ecf/
179 | rcf/
180 |
181 | # Windows Store app package directories and files
182 | AppPackages/
183 | BundleArtifacts/
184 | Package.StoreAssociation.xml
185 | _pkginfo.txt
186 |
187 | # Visual Studio cache files
188 | # files ending in .cache can be ignored
189 | *.[Cc]ache
190 | # but keep track of directories ending in .cache
191 | !*.[Cc]ache/
192 |
193 | # Others
194 | ClientBin/
195 | ~$*
196 | *~
197 | *.dbmdl
198 | *.dbproj.schemaview
199 | *.jfm
200 | *.pfx
201 | *.publishsettings
202 | orleans.codegen.cs
203 |
204 | # Since there are multiple workflows, uncomment next line to ignore bower_components
205 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
206 | #bower_components/
207 |
208 | # RIA/Silverlight projects
209 | Generated_Code/
210 |
211 | # Backup & report files from converting an old project file
212 | # to a newer Visual Studio version. Backup files are not needed,
213 | # because we have git ;-)
214 | _UpgradeReport_Files/
215 | Backup*/
216 | UpgradeLog*.XML
217 | UpgradeLog*.htm
218 |
219 | # SQL Server files
220 | *.mdf
221 | *.ldf
222 | *.ndf
223 |
224 | # Business Intelligence projects
225 | *.rdl.data
226 | *.bim.layout
227 | *.bim_*.settings
228 |
229 | # Microsoft Fakes
230 | FakesAssemblies/
231 |
232 | # GhostDoc plugin setting file
233 | *.GhostDoc.xml
234 |
235 | # Node.js Tools for Visual Studio
236 | .ntvs_analysis.dat
237 | node_modules/
238 |
239 | # Typescript v1 declaration files
240 | typings/
241 |
242 | # Visual Studio 6 build log
243 | *.plg
244 |
245 | # Visual Studio 6 workspace options file
246 | *.opt
247 |
248 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
249 | *.vbw
250 |
251 | # Visual Studio LightSwitch build output
252 | **/*.HTMLClient/GeneratedArtifacts
253 | **/*.DesktopClient/GeneratedArtifacts
254 | **/*.DesktopClient/ModelManifest.xml
255 | **/*.Server/GeneratedArtifacts
256 | **/*.Server/ModelManifest.xml
257 | _Pvt_Extensions
258 |
259 | # Paket dependency manager
260 | .paket/paket.exe
261 | paket-files/
262 |
263 | # FAKE - F# Make
264 | .fake/
265 |
266 | # JetBrains Rider
267 | .idea/
268 | *.sln.iml
269 |
270 | # CodeRush
271 | .cr/
272 |
273 | # Python Tools for Visual Studio (PTVS)
274 | __pycache__/
275 | *.pyc
276 |
277 | # Cake - Uncomment if you are using it
278 | # tools/**
279 | # !tools/packages.config
280 |
281 | # Telerik's JustMock configuration file
282 | *.jmconfig
283 |
284 | # BizTalk build output
285 | *.btp.cs
286 | *.btm.cs
287 | *.odx.cs
288 | *.xsd.cs
289 |
290 |
291 |
292 | DistroLauncher/MSG*.bin
293 | DistroLauncher/messages.rc
294 | DistroLauncher/messages.h
295 | *.lib
296 | *.dll
297 | *.exe
298 | *.tar.gz
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/LargeTile.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/LargeTile.scale-100.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/LargeTile.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/LargeTile.scale-125.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/LargeTile.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/LargeTile.scale-150.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/LargeTile.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/LargeTile.scale-200.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/LargeTile.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/LargeTile.scale-400.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SmallTile.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SmallTile.scale-100.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SmallTile.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SmallTile.scale-125.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SmallTile.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SmallTile.scale-150.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SmallTile.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SmallTile.scale-200.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SmallTile.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SmallTile.scale-400.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SplashScreen.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SplashScreen.scale-100.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SplashScreen.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SplashScreen.scale-125.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SplashScreen.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SplashScreen.scale-150.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/SplashScreen.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/SplashScreen.scale-400.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square150x150Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square150x150Logo.scale-100.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square150x150Logo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square150x150Logo.scale-125.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square150x150Logo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square150x150Logo.scale-150.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square150x150Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square150x150Logo.scale-400.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-16.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-256.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-32.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.altform-unplated_targetsize-48.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.scale-100.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.scale-125.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.scale-150.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.scale-400.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-16.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-256.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-32.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Square44x44Logo.targetsize-48.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/StoreLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/StoreLogo.scale-100.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/StoreLogo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/StoreLogo.scale-125.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/StoreLogo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/StoreLogo.scale-150.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/StoreLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/StoreLogo.scale-200.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/StoreLogo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/StoreLogo.scale-400.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-100.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-125.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-125.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-150.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-150.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher-Appx/Assets/Wide310x150Logo.scale-400.png
--------------------------------------------------------------------------------
/DistroLauncher-Appx/DistroLauncher-Appx.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {f63472f9-d0a0-412e-aa3d-a4e822970486}
5 | DistroLauncher_Appx
6 | en-US
7 | 14.0
8 | true
9 | Windows Store
10 | 10.0.16299.0
11 | 10.0.16215.0
12 | 10.0
13 | mydistro
14 | DistroLauncher-Appx
15 | True
16 |
17 |
18 |
19 |
20 | Debug
21 | ARM64
22 |
23 |
24 | Debug
25 | x64
26 |
27 |
28 | Release
29 | ARM64
30 |
31 |
32 | Release
33 | x64
34 |
35 |
36 |
37 | Application
38 | true
39 | v141
40 |
41 |
42 | Application
43 | true
44 | v141
45 | true
46 |
47 |
48 | Application
49 | false
50 | true
51 | v141
52 | true
53 |
54 |
55 | Application
56 | false
57 | true
58 | v141
59 | true
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | DistroLauncher-Appx_TemporaryKey.pfx
79 | True
80 | Always
81 | 9AA4CA850308B67D8F3536434BF4224C5CAC519F
82 | False
83 | x64|arm64
84 | 1
85 | OnApplicationRun
86 |
87 |
88 |
89 | false
90 |
91 |
92 |
93 |
94 |
95 | Designer
96 |
97 |
98 |
99 |
100 |
101 |
102 | true
103 |
104 |
105 |
106 |
107 | true
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 | true
148 |
149 |
150 |
151 |
152 | true
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 | Document
167 | false
168 | Copy $(SolutionDir)\$(platform)\$(Configuration)\launcher.exe into $(SolutionDir)\$(platform)\$(Configuration)\$(ProjectName)\$(targetname).exe
169 | copy $(SolutionDir)\$(platform)\$(Configuration)\launcher.exe $(SolutionDir)\$(platform)\$(Configuration)\$(ProjectName)\$(targetname).exe
170 | $(targetname).exe
171 |
172 |
173 |
174 |
175 |
176 |
177 |
--------------------------------------------------------------------------------
/DistroLauncher-Appx/DistroLauncher-Appx.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | f63472f9-d0a0-412e-aa3d-a4e822970486
6 |
7 |
8 | 3cd39ea5-301d-4878-9d47-b5dbb30f6c95
9 | bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png
10 |
11 |
12 |
13 |
14 | Assets
15 |
16 |
17 | Assets
18 |
19 |
20 | Assets
21 |
22 |
23 | Assets
24 |
25 |
26 | Assets
27 |
28 |
29 | Assets
30 |
31 |
32 | Assets
33 |
34 |
35 | Assets
36 |
37 |
38 | Assets
39 |
40 |
41 | Assets
42 |
43 |
44 | Assets
45 |
46 |
47 | Assets
48 |
49 |
50 | Assets
51 |
52 |
53 | Assets
54 |
55 |
56 | Assets
57 |
58 |
59 | Assets
60 |
61 |
62 | Assets
63 |
64 |
65 | Assets
66 |
67 |
68 | Assets
69 |
70 |
71 | Assets
72 |
73 |
74 | Assets
75 |
76 |
77 | Assets
78 |
79 |
80 | Assets
81 |
82 |
83 | Assets
84 |
85 |
86 | Assets
87 |
88 |
89 | Assets
90 |
91 |
92 | Assets
93 |
94 |
95 | Assets
96 |
97 |
98 | Assets
99 |
100 |
101 | Assets
102 |
103 |
104 | Assets
105 |
106 |
107 | Assets
108 |
109 |
110 | Assets
111 |
112 |
113 | Assets
114 |
115 |
116 | Assets
117 |
118 |
119 | Assets
120 |
121 |
122 | Assets
123 |
124 |
125 | Assets
126 |
127 |
128 | Assets
129 |
130 |
131 | Assets
132 |
133 |
134 | Assets
135 |
136 |
137 | Assets
138 |
139 |
140 | Assets
141 |
142 |
143 | Assets
144 |
145 |
146 | Assets
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
--------------------------------------------------------------------------------
/DistroLauncher-Appx/MyDistro.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | WSL-DistroLauncher
7 | Windows Console Dev Team
8 | Assets\StoreLogo.png
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/DistroLauncher.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27130.2036
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "launcher", "DistroLauncher\DistroLauncher.vcxproj", "{BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DistroLauncher-Appx", "DistroLauncher-Appx\DistroLauncher-Appx.vcxproj", "{F63472F9-D0A0-412E-AA3D-A4E822970486}"
9 | ProjectSection(ProjectDependencies) = postProject
10 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2} = {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}
11 | EndProjectSection
12 | EndProject
13 | Global
14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 | Debug|ARM64 = Debug|ARM64
16 | Debug|x64 = Debug|x64
17 | Release|ARM64 = Release|ARM64
18 | Release|x64 = Release|x64
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Debug|ARM64.ActiveCfg = Debug|ARM64
22 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Debug|ARM64.Build.0 = Debug|ARM64
23 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Debug|x64.ActiveCfg = Debug|x64
24 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Debug|x64.Build.0 = Debug|x64
25 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Release|ARM64.ActiveCfg = Release|ARM64
26 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Release|ARM64.Build.0 = Release|ARM64
27 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Release|x64.ActiveCfg = Release|x64
28 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}.Release|x64.Build.0 = Release|x64
29 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|ARM64.ActiveCfg = Debug|ARM64
30 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|ARM64.Build.0 = Debug|ARM64
31 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|ARM64.Deploy.0 = Debug|ARM64
32 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|x64.ActiveCfg = Debug|x64
33 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|x64.Build.0 = Debug|x64
34 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Debug|x64.Deploy.0 = Debug|x64
35 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|ARM64.ActiveCfg = Release|ARM64
36 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|ARM64.Build.0 = Release|ARM64
37 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|ARM64.Deploy.0 = Release|ARM64
38 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|x64.ActiveCfg = Release|x64
39 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|x64.Build.0 = Release|x64
40 | {F63472F9-D0A0-412E-AA3D-A4E822970486}.Release|x64.Deploy.0 = Release|x64
41 | EndGlobalSection
42 | GlobalSection(SolutionProperties) = preSolution
43 | HideSolutionNode = FALSE
44 | EndGlobalSection
45 | GlobalSection(ExtensibilityGlobals) = postSolution
46 | SolutionGuid = {1CBEEAE2-D963-465A-A538-A30F8D615037}
47 | EndGlobalSection
48 | EndGlobal
49 |
--------------------------------------------------------------------------------
/DistroLauncher/DistributionInfo.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) Microsoft. All rights reserved.
3 | // Licensed under the terms described in the LICENSE file in the root of this project.
4 | //
5 |
6 | #include "stdafx.h"
7 |
8 | bool DistributionInfo::CreateUser(std::wstring_view userName)
9 | {
10 | // Create the user account.
11 | DWORD exitCode;
12 | std::wstring commandLine = L"/usr/sbin/adduser --quiet --gecos '' ";
13 | commandLine += userName;
14 | HRESULT hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode);
15 | if ((FAILED(hr)) || (exitCode != 0)) {
16 | return false;
17 | }
18 |
19 | // Add the user account to any relevant groups.
20 | commandLine = L"/usr/sbin/usermod -aG adm,cdrom,sudo,dip,plugdev ";
21 | commandLine += userName;
22 | hr = g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode);
23 | if ((FAILED(hr)) || (exitCode != 0)) {
24 |
25 | // Delete the user if the group add command failed.
26 | commandLine = L"/usr/sbin/deluser ";
27 | commandLine += userName;
28 | g_wslApi.WslLaunchInteractive(commandLine.c_str(), true, &exitCode);
29 | return false;
30 | }
31 |
32 | return true;
33 | }
34 |
35 | ULONG DistributionInfo::QueryUid(std::wstring_view userName)
36 | {
37 | // Create a pipe to read the output of the launched process.
38 | HANDLE readPipe;
39 | HANDLE writePipe;
40 | SECURITY_ATTRIBUTES sa{sizeof(sa), nullptr, true};
41 | ULONG uid = UID_INVALID;
42 | if (CreatePipe(&readPipe, &writePipe, &sa, 0)) {
43 | // Query the UID of the supplied username.
44 | std::wstring command = L"/usr/bin/id -u ";
45 | command += userName;
46 | int returnValue = 0;
47 | HANDLE child;
48 | HRESULT hr = g_wslApi.WslLaunch(command.c_str(), true, GetStdHandle(STD_INPUT_HANDLE), writePipe, GetStdHandle(STD_ERROR_HANDLE), &child);
49 | if (SUCCEEDED(hr)) {
50 | // Wait for the child to exit and ensure process exited successfully.
51 | WaitForSingleObject(child, INFINITE);
52 | DWORD exitCode;
53 | if ((GetExitCodeProcess(child, &exitCode) == false) || (exitCode != 0)) {
54 | hr = E_INVALIDARG;
55 | }
56 |
57 | CloseHandle(child);
58 | if (SUCCEEDED(hr)) {
59 | char buffer[64];
60 | DWORD bytesRead;
61 |
62 | // Read the output of the command from the pipe and convert to a UID.
63 | if (ReadFile(readPipe, buffer, (sizeof(buffer) - 1), &bytesRead, nullptr)) {
64 | buffer[bytesRead] = ANSI_NULL;
65 | try {
66 | uid = std::stoul(buffer, nullptr, 10);
67 |
68 | } catch( ... ) { }
69 | }
70 | }
71 | }
72 |
73 | CloseHandle(readPipe);
74 | CloseHandle(writePipe);
75 | }
76 |
77 | return uid;
78 | }
79 |
--------------------------------------------------------------------------------
/DistroLauncher/DistributionInfo.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) Microsoft. All rights reserved.
3 | // Licensed under the terms described in the LICENSE file in the root of this project.
4 | //
5 |
6 | #pragma once
7 |
8 | namespace DistributionInfo
9 | {
10 | // The name of the distribution. This will be displayed to the user via
11 | // wslconfig.exe and in other places. It must conform to the following
12 | // regular expression: ^[a-zA-Z0-9._-]+$
13 | //
14 | // WARNING: This value must not change between versions of your app,
15 | // otherwise users upgrading from older versions will see launch failures.
16 | const std::wstring Name = L"MyDistribution";
17 |
18 | // The title bar for the console window while the distribution is installing.
19 | const std::wstring WindowTitle = L"My Distribution";
20 |
21 | // Create and configure a user account.
22 | bool CreateUser(std::wstring_view userName);
23 |
24 | // Query the UID of the user account.
25 | ULONG QueryUid(std::wstring_view userName);
26 | }
--------------------------------------------------------------------------------
/DistroLauncher/DistroLauncher.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) Microsoft. All rights reserved.
3 | // Licensed under the terms described in the LICENSE file in the root of this project.
4 | //
5 |
6 | #include "stdafx.h"
7 |
8 | // Commandline arguments:
9 | #define ARG_CONFIG L"config"
10 | #define ARG_CONFIG_DEFAULT_USER L"--default-user"
11 | #define ARG_INSTALL L"install"
12 | #define ARG_INSTALL_ROOT L"--root"
13 | #define ARG_RUN L"run"
14 | #define ARG_RUN_C L"-c"
15 |
16 | // Helper class for calling WSL Functions:
17 | // https://msdn.microsoft.com/en-us/library/windows/desktop/mt826874(v=vs.85).aspx
18 | WslApiLoader g_wslApi(DistributionInfo::Name);
19 |
20 | static HRESULT InstallDistribution(bool createUser);
21 | static HRESULT SetDefaultUser(std::wstring_view userName);
22 |
23 | HRESULT InstallDistribution(bool createUser)
24 | {
25 | // Register the distribution.
26 | Helpers::PrintMessage(MSG_STATUS_INSTALLING);
27 | HRESULT hr = g_wslApi.WslRegisterDistribution();
28 | if (FAILED(hr)) {
29 | return hr;
30 | }
31 |
32 | // Delete /etc/resolv.conf to allow WSL to generate a version based on Windows networking information.
33 | DWORD exitCode;
34 | hr = g_wslApi.WslLaunchInteractive(L"/bin/rm /etc/resolv.conf", true, &exitCode);
35 | if (FAILED(hr)) {
36 | return hr;
37 | }
38 |
39 | // Create a user account.
40 | if (createUser) {
41 | Helpers::PrintMessage(MSG_CREATE_USER_PROMPT);
42 | std::wstring userName;
43 | do {
44 | userName = Helpers::GetUserInput(MSG_ENTER_USERNAME, 32);
45 |
46 | } while (!DistributionInfo::CreateUser(userName));
47 |
48 | // Set this user account as the default.
49 | hr = SetDefaultUser(userName);
50 | if (FAILED(hr)) {
51 | return hr;
52 | }
53 | }
54 |
55 | return hr;
56 | }
57 |
58 | HRESULT SetDefaultUser(std::wstring_view userName)
59 | {
60 | // Query the UID of the given user name and configure the distribution
61 | // to use this UID as the default.
62 | ULONG uid = DistributionInfo::QueryUid(userName);
63 | if (uid == UID_INVALID) {
64 | return E_INVALIDARG;
65 | }
66 |
67 | HRESULT hr = g_wslApi.WslConfigureDistribution(uid, WSL_DISTRIBUTION_FLAGS_DEFAULT);
68 | if (FAILED(hr)) {
69 | return hr;
70 | }
71 |
72 | return hr;
73 | }
74 |
75 | int wmain(int argc, wchar_t const *argv[])
76 | {
77 | // Update the title bar of the console window.
78 | SetConsoleTitleW(DistributionInfo::WindowTitle.c_str());
79 |
80 | // Initialize a vector of arguments.
81 | std::vector arguments;
82 | for (int index = 1; index < argc; index += 1) {
83 | arguments.push_back(argv[index]);
84 | }
85 |
86 | // Ensure that the Windows Subsystem for Linux optional component is installed.
87 | DWORD exitCode = 1;
88 | if (!g_wslApi.WslIsOptionalComponentInstalled()) {
89 | Helpers::PrintErrorMessage(HRESULT_FROM_WIN32(ERROR_LINUX_SUBSYSTEM_NOT_PRESENT));
90 | if (arguments.empty()) {
91 | Helpers::PromptForInput();
92 | }
93 |
94 | return exitCode;
95 | }
96 |
97 | // Install the distribution if it is not already.
98 | bool installOnly = ((arguments.size() > 0) && (arguments[0] == ARG_INSTALL));
99 | HRESULT hr = S_OK;
100 | if (!g_wslApi.WslIsDistributionRegistered()) {
101 |
102 | // If the "--root" option is specified, do not create a user account.
103 | bool useRoot = ((installOnly) && (arguments.size() > 1) && (arguments[1] == ARG_INSTALL_ROOT));
104 | hr = InstallDistribution(!useRoot);
105 | if (FAILED(hr)) {
106 | if (hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)) {
107 | Helpers::PrintMessage(MSG_INSTALL_ALREADY_EXISTS);
108 | }
109 |
110 | } else {
111 | Helpers::PrintMessage(MSG_INSTALL_SUCCESS);
112 | }
113 |
114 | exitCode = SUCCEEDED(hr) ? 0 : 1;
115 | }
116 |
117 | // Parse the command line arguments.
118 | if ((SUCCEEDED(hr)) && (!installOnly)) {
119 | if (arguments.empty()) {
120 | hr = g_wslApi.WslLaunchInteractive(L"", false, &exitCode);
121 |
122 | // Check exitCode to see if wsl.exe returned that it could not start the Linux process
123 | // then prompt users for input so they can view the error message.
124 | if (SUCCEEDED(hr) && exitCode == UINT_MAX) {
125 | Helpers::PromptForInput();
126 | }
127 |
128 | } else if ((arguments[0] == ARG_RUN) ||
129 | (arguments[0] == ARG_RUN_C)) {
130 |
131 | std::wstring command;
132 | for (size_t index = 1; index < arguments.size(); index += 1) {
133 | command += L" ";
134 | command += arguments[index];
135 | }
136 |
137 | hr = g_wslApi.WslLaunchInteractive(command.c_str(), true, &exitCode);
138 |
139 | } else if (arguments[0] == ARG_CONFIG) {
140 | hr = E_INVALIDARG;
141 | if (arguments.size() == 3) {
142 | if (arguments[1] == ARG_CONFIG_DEFAULT_USER) {
143 | hr = SetDefaultUser(arguments[2]);
144 | }
145 | }
146 |
147 | if (SUCCEEDED(hr)) {
148 | exitCode = 0;
149 | }
150 |
151 | } else {
152 | Helpers::PrintMessage(MSG_USAGE);
153 | return exitCode;
154 | }
155 | }
156 |
157 | // If an error was encountered, print an error message.
158 | if (FAILED(hr)) {
159 | if (hr == HCS_E_HYPERV_NOT_INSTALLED) {
160 | Helpers::PrintMessage(MSG_ENABLE_VIRTUALIZATION);
161 |
162 | } else {
163 | Helpers::PrintErrorMessage(hr);
164 | }
165 |
166 | if (arguments.empty()) {
167 | Helpers::PromptForInput();
168 | }
169 | }
170 |
171 | return SUCCEEDED(hr) ? exitCode : 1;
172 | }
173 |
--------------------------------------------------------------------------------
/DistroLauncher/DistroLauncher.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 | /////////////////////////////////////////////////////////////////////////////
7 | //
8 | // Generated from the TEXTINCLUDE 2 resource.
9 | //
10 | #include "winres.h"
11 |
12 | /////////////////////////////////////////////////////////////////////////////
13 | #undef APSTUDIO_READONLY_SYMBOLS
14 |
15 | /////////////////////////////////////////////////////////////////////////////
16 | // English (United States) resources
17 |
18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
20 |
21 | #ifdef APSTUDIO_INVOKED
22 | /////////////////////////////////////////////////////////////////////////////
23 | //
24 | // TEXTINCLUDE
25 | //
26 |
27 | 1 TEXTINCLUDE
28 | BEGIN
29 | "resource.h\0"
30 | END
31 |
32 | 2 TEXTINCLUDE
33 | BEGIN
34 | "#include ""winres.h""\r\n"
35 | "\0"
36 | END
37 |
38 | 3 TEXTINCLUDE
39 | BEGIN
40 | "\r\n"
41 | "\0"
42 | END
43 |
44 | #endif // APSTUDIO_INVOKED
45 |
46 |
47 | /////////////////////////////////////////////////////////////////////////////
48 | //
49 | // Icon
50 | //
51 |
52 | // Icon with lowest ID value placed first to ensure application icon
53 | // remains consistent on all systems.
54 | IDI_ICON1 ICON ".\images\icon.ico"
55 |
56 | #endif // English (United States) resources
57 | /////////////////////////////////////////////////////////////////////////////
58 |
59 |
60 |
61 | #ifndef APSTUDIO_INVOKED
62 | /////////////////////////////////////////////////////////////////////////////
63 | //
64 | // Generated from the TEXTINCLUDE 3 resource.
65 | //
66 |
67 |
68 | /////////////////////////////////////////////////////////////////////////////
69 | #endif // not APSTUDIO_INVOKED
70 |
71 | #include "messages.rc"
72 |
73 |
--------------------------------------------------------------------------------
/DistroLauncher/DistroLauncher.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | ARM64
7 |
8 |
9 | Debug
10 | x64
11 |
12 |
13 | Release
14 | ARM64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | {BA627106-E5F7-46EE-B8D7-2D5A760F2FB2}
23 | Win32Proj
24 | DistroLauncher
25 | 10.0.16299.0
26 | launcher
27 |
28 |
29 |
30 | Application
31 | true
32 | v142
33 | Unicode
34 |
35 |
36 | Application
37 | true
38 | v142
39 | Unicode
40 | true
41 |
42 |
43 | Application
44 | false
45 | v142
46 | true
47 | Unicode
48 |
49 |
50 | Application
51 | false
52 | v142
53 | true
54 | Unicode
55 | true
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | true
68 | ClCompile
69 |
70 |
71 |
72 | Use
73 | Level3
74 | Disabled
75 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
76 | true
77 | stdcpp17
78 |
79 |
80 | Console
81 | true
82 | onecore.lib;
83 |
84 |
85 |
86 |
87 | Use
88 | Level3
89 | Disabled
90 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions)
91 | true
92 | stdcpp17
93 |
94 |
95 | Console
96 | true
97 | onecore.lib;
98 |
99 |
100 |
101 |
102 | Level3
103 | Use
104 | MaxSpeed
105 | true
106 | true
107 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
108 | true
109 | stdcpp17
110 | MultiThreaded
111 |
112 |
113 | Console
114 | true
115 | true
116 | true
117 | onecore.lib;
118 |
119 |
120 |
121 |
122 | Level3
123 | Use
124 | MaxSpeed
125 | true
126 | true
127 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
128 | true
129 | stdcpp17
130 | MultiThreaded
131 |
132 |
133 | Console
134 | true
135 | true
136 | true
137 | onecore.lib;
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 | Create
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 | Document
166 | false
167 | mc %(FullPath)
168 | Compiling Messages...
169 | %(Filename).rc;%(Filename).h;MSG0409.bin
170 |
171 |
172 |
173 |
174 |
175 |
176 |
--------------------------------------------------------------------------------
/DistroLauncher/DistroLauncher.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | Header Files
20 |
21 |
22 | Header Files
23 |
24 |
25 | Header Files
26 |
27 |
28 | Header Files
29 |
30 |
31 | Header Files
32 |
33 |
34 | Header Files
35 |
36 |
37 |
38 |
39 | Source Files
40 |
41 |
42 | Source Files
43 |
44 |
45 | Source Files
46 |
47 |
48 | Source Files
49 |
50 |
51 | Source Files
52 |
53 |
54 |
55 |
56 | Resource Files
57 |
58 |
59 |
60 |
61 | Resource Files
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/DistroLauncher/Helpers.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) Microsoft. All rights reserved.
3 | // Licensed under the terms described in the LICENSE file in the root of this project.
4 | //
5 |
6 | #include "stdafx.h"
7 |
8 | namespace {
9 | HRESULT FormatMessageHelperVa(DWORD messageId, va_list vaList, std::wstring* message);
10 | HRESULT PrintMessageVa(DWORD messageId, va_list vaList);
11 | }
12 |
13 | std::wstring Helpers::GetUserInput(DWORD promptMsg, DWORD maxCharacters)
14 | {
15 | Helpers::PrintMessage(promptMsg);
16 | size_t bufferSize = maxCharacters + 1;
17 | std::unique_ptr inputBuffer(new wchar_t[bufferSize]);
18 | std::wstring input;
19 | if (wscanf_s(L"%s", inputBuffer.get(), (unsigned int)bufferSize) == 1) {
20 | input = inputBuffer.get();
21 | }
22 |
23 | // Throw away any additional chracters that did not fit in the buffer.
24 | wchar_t wch;
25 | do {
26 | wch = getwchar();
27 |
28 | } while ((wch != L'\n') && (wch != WEOF));
29 |
30 | return input;
31 | }
32 |
33 | void Helpers::PrintErrorMessage(HRESULT error)
34 | {
35 | PWSTR buffer = nullptr;
36 | ::FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,
37 | nullptr,
38 | error,
39 | 0,
40 | (PWSTR)&buffer,
41 | 0,
42 | nullptr);
43 |
44 | Helpers::PrintMessage(MSG_ERROR_CODE, error, buffer);
45 | if (buffer != nullptr) {
46 | HeapFree(GetProcessHeap(), 0, buffer);
47 | }
48 |
49 | return;
50 | }
51 |
52 | HRESULT Helpers::PrintMessage(DWORD messageId, ...)
53 | {
54 | va_list argList;
55 | va_start(argList, messageId);
56 | HRESULT hr = PrintMessageVa(messageId, argList);
57 | va_end(argList);
58 | return hr;
59 | }
60 |
61 | void Helpers::PromptForInput()
62 | {
63 | Helpers::PrintMessage(MSG_PRESS_A_KEY);
64 | _getwch();
65 | return;
66 | }
67 |
68 | namespace {
69 | HRESULT FormatMessageHelperVa(DWORD messageId, va_list vaList, std::wstring* message)
70 | {
71 | PWSTR buffer = nullptr;
72 | DWORD written = ::FormatMessageW(FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_ALLOCATE_BUFFER,
73 | nullptr,
74 | messageId,
75 | 0,
76 | (PWSTR)&buffer,
77 | 10,
78 | &vaList);
79 | *message = buffer;
80 | if (buffer != nullptr) {
81 | HeapFree(GetProcessHeap(), 0, buffer);
82 | }
83 |
84 | return (written > 0) ? S_OK : HRESULT_FROM_WIN32(GetLastError());
85 | }
86 |
87 | HRESULT PrintMessageVa(DWORD messageId, va_list vaList)
88 | {
89 | std::wstring message;
90 | HRESULT hr = FormatMessageHelperVa(messageId, vaList, &message);
91 | if (SUCCEEDED(hr)) {
92 | wprintf(L"%ls", message.c_str());
93 | }
94 |
95 | return hr;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/DistroLauncher/Helpers.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) Microsoft. All rights reserved.
3 | // Licensed under the terms described in the LICENSE file in the root of this project.
4 | //
5 |
6 | #pragma once
7 |
8 | #define UID_INVALID ((ULONG)-1)
9 |
10 | namespace Helpers
11 | {
12 | std::wstring GetUserInput(DWORD promptMsg, DWORD maxCharacters);
13 | void PrintErrorMessage(HRESULT hr);
14 | HRESULT PrintMessage(DWORD messageId, ...);
15 | void PromptForInput();
16 | }
--------------------------------------------------------------------------------
/DistroLauncher/WslApiLoader.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) Microsoft. All rights reserved.
3 | // Licensed under the terms described in the LICENSE file in the root of this project.
4 | //
5 |
6 | #include "stdafx.h"
7 | #include "WslApiLoader.h"
8 |
9 | WslApiLoader::WslApiLoader(const std::wstring& distributionName) :
10 | _distributionName(distributionName)
11 | {
12 | _wslApiDll = LoadLibraryEx(L"wslapi.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
13 | if (_wslApiDll != nullptr) {
14 | _isDistributionRegistered = (WSL_IS_DISTRIBUTION_REGISTERED)GetProcAddress(_wslApiDll, "WslIsDistributionRegistered");
15 | _registerDistribution = (WSL_REGISTER_DISTRIBUTION)GetProcAddress(_wslApiDll, "WslRegisterDistribution");
16 | _configureDistribution = (WSL_CONFIGURE_DISTRIBUTION)GetProcAddress(_wslApiDll, "WslConfigureDistribution");
17 | _launchInteractive = (WSL_LAUNCH_INTERACTIVE)GetProcAddress(_wslApiDll, "WslLaunchInteractive");
18 | _launch = (WSL_LAUNCH)GetProcAddress(_wslApiDll, "WslLaunch");
19 | }
20 | }
21 |
22 | WslApiLoader::~WslApiLoader()
23 | {
24 | if (_wslApiDll != nullptr) {
25 | FreeLibrary(_wslApiDll);
26 | }
27 | }
28 |
29 | BOOL WslApiLoader::WslIsOptionalComponentInstalled()
30 | {
31 | return ((_wslApiDll != nullptr) &&
32 | (_isDistributionRegistered != nullptr) &&
33 | (_registerDistribution != nullptr) &&
34 | (_configureDistribution != nullptr) &&
35 | (_launchInteractive != nullptr) &&
36 | (_launch != nullptr));
37 | }
38 |
39 | BOOL WslApiLoader::WslIsDistributionRegistered()
40 | {
41 | return _isDistributionRegistered(_distributionName.c_str());
42 | }
43 |
44 | HRESULT WslApiLoader::WslRegisterDistribution()
45 | {
46 | HRESULT hr = _registerDistribution(_distributionName.c_str(), L"install.tar.gz");
47 | if (FAILED(hr)) {
48 | Helpers::PrintMessage(MSG_WSL_REGISTER_DISTRIBUTION_FAILED, hr);
49 | }
50 |
51 | return hr;
52 | }
53 |
54 | HRESULT WslApiLoader::WslConfigureDistribution(ULONG defaultUID, WSL_DISTRIBUTION_FLAGS wslDistributionFlags)
55 | {
56 | HRESULT hr = _configureDistribution(_distributionName.c_str(), defaultUID, wslDistributionFlags);
57 | if (FAILED(hr)) {
58 | Helpers::PrintMessage(MSG_WSL_CONFIGURE_DISTRIBUTION_FAILED, hr);
59 | }
60 |
61 | return hr;
62 | }
63 |
64 | HRESULT WslApiLoader::WslLaunchInteractive(PCWSTR command, BOOL useCurrentWorkingDirectory, DWORD *exitCode)
65 | {
66 | HRESULT hr = _launchInteractive(_distributionName.c_str(), command, useCurrentWorkingDirectory, exitCode);
67 | if (FAILED(hr)) {
68 | Helpers::PrintMessage(MSG_WSL_LAUNCH_INTERACTIVE_FAILED, command, hr);
69 | }
70 |
71 | return hr;
72 | }
73 |
74 | HRESULT WslApiLoader::WslLaunch(PCWSTR command, BOOL useCurrentWorkingDirectory, HANDLE stdIn, HANDLE stdOut, HANDLE stdErr, HANDLE *process)
75 | {
76 | HRESULT hr = _launch(_distributionName.c_str(), command, useCurrentWorkingDirectory, stdIn, stdOut, stdErr, process);
77 | if (FAILED(hr)) {
78 | Helpers::PrintMessage(MSG_WSL_LAUNCH_FAILED, command, hr);
79 | }
80 |
81 | return hr;
82 | }
83 |
--------------------------------------------------------------------------------
/DistroLauncher/WslApiLoader.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) Microsoft. All rights reserved.
3 | // Licensed under the terms described in the LICENSE file in the root of this project.
4 | //
5 |
6 | #pragma once
7 | #include
8 |
9 | // This error definition is present in the Spring Creators Update SDK.
10 | #ifndef ERROR_LINUX_SUBSYSTEM_NOT_PRESENT
11 | #define ERROR_LINUX_SUBSYSTEM_NOT_PRESENT 414L
12 | #endif // !ERROR_LINUX_SUBSYSTEM_NOT_PRESENT
13 |
14 | typedef BOOL (STDAPICALLTYPE* WSL_IS_DISTRIBUTION_REGISTERED)(PCWSTR);
15 | typedef HRESULT (STDAPICALLTYPE* WSL_REGISTER_DISTRIBUTION)(PCWSTR, PCWSTR);
16 | typedef HRESULT (STDAPICALLTYPE* WSL_CONFIGURE_DISTRIBUTION)(PCWSTR, ULONG, WSL_DISTRIBUTION_FLAGS);
17 | typedef HRESULT (STDAPICALLTYPE* WSL_GET_DISTRIBUTION_CONFIGURATION)(PCWSTR, ULONG *, ULONG *, WSL_DISTRIBUTION_FLAGS *, PSTR **, ULONG *);
18 | typedef HRESULT (STDAPICALLTYPE* WSL_LAUNCH_INTERACTIVE)(PCWSTR, PCWSTR, BOOL, DWORD *);
19 | typedef HRESULT (STDAPICALLTYPE* WSL_LAUNCH)(PCWSTR, PCWSTR, BOOL, HANDLE, HANDLE, HANDLE, HANDLE *);
20 |
21 | class WslApiLoader
22 | {
23 | public:
24 | WslApiLoader(const std::wstring& distributionName);
25 | ~WslApiLoader();
26 |
27 | BOOL WslIsOptionalComponentInstalled();
28 |
29 | BOOL WslIsDistributionRegistered();
30 |
31 | HRESULT WslRegisterDistribution();
32 |
33 | HRESULT WslConfigureDistribution(ULONG defaultUID,
34 | WSL_DISTRIBUTION_FLAGS wslDistributionFlags);
35 |
36 | HRESULT WslLaunchInteractive(PCWSTR command,
37 | BOOL useCurrentWorkingDirectory,
38 | DWORD *exitCode);
39 |
40 | HRESULT WslLaunch(PCWSTR command,
41 | BOOL useCurrentWorkingDirectory,
42 | HANDLE stdIn,
43 | HANDLE stdOut,
44 | HANDLE stdErr,
45 | HANDLE *process);
46 |
47 | private:
48 | std::wstring _distributionName;
49 | HMODULE _wslApiDll;
50 | WSL_IS_DISTRIBUTION_REGISTERED _isDistributionRegistered;
51 | WSL_REGISTER_DISTRIBUTION _registerDistribution;
52 | WSL_CONFIGURE_DISTRIBUTION _configureDistribution;
53 | WSL_LAUNCH_INTERACTIVE _launchInteractive;
54 | WSL_LAUNCH _launch;
55 | };
56 |
57 | extern WslApiLoader g_wslApi;
58 |
--------------------------------------------------------------------------------
/DistroLauncher/images/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher/images/icon.ico
--------------------------------------------------------------------------------
/DistroLauncher/images/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/WSL-DistroLauncher/e2953d68e0b5773c8c7259fca28f2a787d22c4c3/DistroLauncher/images/icon.png
--------------------------------------------------------------------------------
/DistroLauncher/messages.mc:
--------------------------------------------------------------------------------
1 | LanguageNames = (English=0x409:MSG00409)
2 |
3 | MessageId=1001 SymbolicName=MSG_WSL_REGISTER_DISTRIBUTION_FAILED
4 | Language=English
5 | WslRegisterDistribution failed with error: 0x%1!x!
6 | .
7 |
8 | MessageId=1002 SymbolicName=MSG_WSL_CONFIGURE_DISTRIBUTION_FAILED
9 | Language=English
10 | WslGetDistributionConfiguration failed with error: 0x%1!x!
11 | .
12 |
13 | MessageId=1003 SymbolicName=MSG_WSL_LAUNCH_INTERACTIVE_FAILED
14 | Language=English
15 | WslLaunchInteractive %1 failed with error: 0x%2!x!
16 | .
17 |
18 | MessageId=1004 SymbolicName=MSG_WSL_LAUNCH_FAILED
19 | Language=English
20 | WslLaunch %1 failed with error: 0x%2!x!
21 | .
22 |
23 | MessageId=1005 SymbolicName=MSG_USAGE
24 | Language=English
25 | Launches or configures a Linux distribution.
26 |
27 | Usage:
28 |
29 | Launches the user's default shell in the user's home directory.
30 |
31 | install [--root]
32 | Install the distribuiton and do not launch the shell when complete.
33 | --root
34 | Do not create a user account and leave the default user set to root.
35 |
36 | run
37 | Run the provided command line in the current working directory. If no
38 | command line is provided, the default shell is launched.
39 |
40 | config [setting [value]]
41 | Configure settings for this distribution.
42 | Settings:
43 | --default-user
44 | Sets the default user to . This must be an existing user.
45 |
46 | help
47 | Print usage information.
48 | .
49 |
50 | MessageId=1006 SymbolicName=MSG_STATUS_INSTALLING
51 | Language=English
52 | Installing, this may take a few minutes...
53 | .
54 |
55 | MessageId=1007 SymbolicName=MSG_INSTALL_SUCCESS
56 | Language=English
57 | Installation successful!
58 | .
59 |
60 | MessageId=1008 SymbolicName=MSG_ERROR_CODE
61 | Language=English
62 | Error: 0x%1!x! %2
63 | .
64 |
65 | MessageId=1009 SymbolicName=MSG_ENTER_USERNAME
66 | Language=English
67 | Enter new UNIX username: %0
68 | .
69 |
70 | MessageId=1010 SymbolicName=MSG_CREATE_USER_PROMPT
71 | Language=English
72 | Please create a default UNIX user account. The username does not need to match your Windows username.
73 | For more information visit: https://aka.ms/wslusers
74 | .
75 |
76 | MessageId=1011 SymbolicName=MSG_PRESS_A_KEY
77 | Language=English
78 | Press any key to continue...
79 | .
80 |
81 | MessageId=1013 SymbolicName=MSG_INSTALL_ALREADY_EXISTS
82 | Language=English
83 | The distribution installation has become corrupted.
84 | Please select Reset from App Settings or uninstall and reinstall the app.
85 | .
86 |
87 | MessageId=1014 SymbolicName=MSG_ENABLE_VIRTUALIZATION
88 | Language=English
89 | Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.
90 | For information please visit https://aka.ms/enablevirtualization
91 | .
92 |
--------------------------------------------------------------------------------
/DistroLauncher/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by DistroInstaller.rc
4 | //
5 | #define IDI_ICON1 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 103
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/DistroLauncher/stdafx.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) Microsoft. All rights reserved.
3 | // Licensed under the terms described in the LICENSE file in the root of this project.
4 | //
5 | // stdafx.cpp : source file that includes just the standard includes
6 | // DistroInstaller.pch will be the pre-compiled header
7 | // stdafx.obj will contain the pre-compiled type information
8 | //
9 |
10 | #include "stdafx.h"
11 |
12 | // Reference any additional headers you need in stdafx.h and not in this file.
13 |
14 |
--------------------------------------------------------------------------------
/DistroLauncher/stdafx.h:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) Microsoft. All rights reserved.
3 | // Licensed under the terms described in the LICENSE file in the root of this project.
4 | //
5 | // stdafx.h : include file for standard system include files,
6 | // or project specific include files that are used frequently, but
7 | // are changed infrequently
8 | //
9 |
10 | #pragma once
11 |
12 | #include "targetver.h"
13 |
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include "WslApiLoader.h"
29 | #include "Helpers.h"
30 | #include "DistributionInfo.h"
31 |
32 | // Message strings compiled from .MC file.
33 | #include "messages.h"
34 |
--------------------------------------------------------------------------------
/DistroLauncher/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation. All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WSL Distro Launcher Reference Implementation
2 |
3 | > [!NOTE]
4 | > There is a newer method for creating WSL distros please see [this doc page](https://learn.microsoft.com/windows/wsl/build-custom-distro).
5 |
6 | ## Introduction
7 | This is the C++ reference implementation for a Windows Subsystem for Linux (WSL) distribution installer/launcher application. Every distro package must include a launcher app, which is responsible for completing installation & registration of your distro with WSL, and for launching new distro instances atop WSL.
8 |
9 | Once you've built your distro launcher, packaged it along with the required art assets, manifest, and distro.tar.gz, and digitally signed the package, you will be able to sideload your distro on your own machine(s).
10 |
11 | ## Goals
12 | The goal of this project is to enable:
13 |
14 | * Linux distribution owners to package and submit an application that runs on top of WSL to the Microsoft Store
15 | * Developers to create custom Linux distributions that can be sideloaded onto their dev machine
16 |
17 | ## Contents
18 | This reference launcher provides the following functionality:
19 | (where `launcher.exe` is replaced by the distro-specific name)
20 |
21 | * `launcher.exe`
22 | - Launches the user's default shell in the user's home directory.
23 |
24 | * `launcher.exe install [--root]`
25 | - Install the distribution and do not launch the shell when complete.
26 | - `--root`: Do not create a user account and leave the default user set to root.
27 |
28 | * `launcher.exe run `
29 | - Run the provided command line in the current working directory. If no command line is provided, the default shell is launched.
30 | - Everything after `run` is passed to WslLaunchInteractive.
31 |
32 | * `launcher.exe config [setting [value]]`
33 | - Configure settings for this distribution.
34 | - Settings:
35 | - `--default-user `: Sets the default user to . This must be an existing user.
36 |
37 | * `launcher.exe help`
38 | - Print usage information.
39 |
40 | ## Launcher Outline
41 | This is the basic flow of how the launcher code is set up.
42 |
43 | 1. If the distribution is not registered with WSL, register it. Registration extracts the tar.gz file that is included in your distribution appx.
44 | 2. Once the distro is successfully registered, any other pre-launch setup is performed in `InstallDistribution()`. This is where distro-specific setup can be performed. As an example, the reference implementation creates a user account and sets this user account as the default for the distro.
45 | - Note: The commands used to query and create user accounts in this reference implementation are Ubuntu-specific; change as necessary to match the needs of your distro.
46 | 3. Once the distro is configured, parse any other command-line arguments. The details of these arguments are described above, in the [Introduction](#Introduction).
47 |
48 | ## Project Structure
49 | The distro launcher is comprised of two Visual Studio projects - `launcher` and `DistroLauncher-Appx`. The `launcher` project builds the actual executable that is run when a user launches the app. The `DistroLauncher-Appx` builds the distro package with all the correctly scaled assets and other dependencies. Code changes will be built in the `launcher` project (under `DistroLauncher/`). Manifest changes are applied in the `DistroLauncher-Appx` project (under `DistroLauncher-Appx/`).
50 |
51 | ## Getting Started
52 | 1. Generate a test certificate:
53 | 1. In Visual Studio, open `DistroLauncher-Appx/MyDistro.appxmanifest`
54 | 1. Select the Packaging tab
55 | 1. Select "Choose Certificate"
56 | 1. Click the Configure Certificate drop down and select Create test certificate.
57 |
58 | 2. Edit your distribution-specific information in `DistributionInfo.h` and `DistributionInfo.cpp`. **NOTE: The `DistributionInfo::Name` variable must uniquely identify your distribution and cannot change from one version of your app to the next.**
59 | > Note: The examples for creating a user account and querying the UID are from an Ubuntu-based system, and may need to be modified to work appropriately on your distribution.
60 |
61 | 3. Add an icon (.ico) and logo (.png) to the `/images` directory. The logo will be used in the Start Menu and the taskbar for your launcher, and the icon will appear on the Console window.
62 | > Note: The icon must be named `icon.ico`.
63 |
64 | 4. Pick the name you'd like to make this distro callable from the command line. For the rest of the README, I'll be using `mydistro` or `mydistro.exe`. **This is the name of your executable** and should be unique.
65 |
66 | 5. Make sure to change the name of the project in the `DistroLauncher-Appx/DistroLauncher-Appx.vcxproj` file to the name of your executable we picked in step 4. By default, the lines should look like:
67 |
68 | ``` xml
69 |
70 | ...
71 | mydistro
72 |
73 | ```
74 |
75 | So, if I wanted to instead call my distro "TheBestDistroEver", I'd change this to:
76 | ``` xml
77 |
78 | ...
79 | TheBestDistroEver
80 |
81 | ```
82 |
83 | > Note: **DO NOT** change the ProjectName of the `DistroLauncher/DistroLauncher.vcxproj` from the value `launcher`. Doing so will break the build, as the DistroLauncher-Appx project is looking for the output of this project as `launcher.exe`.
84 |
85 | 6. Update `MyDistro.appxmanifest`. There are several properties that are in the manifest that will need to be updated with your specific values:
86 | 1. Note the `Identity Publisher` value (by default, `"CN=DistroOwner"`). We'll need that for testing the application.
87 | 1. Ensure `` ends in ".exe". This is the command that will be used to launch your distro from the command line and should match the executable name we picked in step 4.
88 | 1. Make sure each of the `Executable` values matches the executable name we picked in step 4.
89 |
90 | 7. Copy your tar.gz containing your distro into the root of the project and rename it to `install.tar.gz`.
91 |
92 | ## Setting up your Windows Environment
93 | You will need a Windows environment to test that your app installs and works as expected. To set up a Windows environment for testing you can follow the steps from the [Windows Dev Center](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines).
94 |
95 | > Note: If you are using Hyper-V you can use the new VM gallery to easily spin up a Windows instance.
96 |
97 | Also, to allow your locally built distro package to be manually side-loaded, ensure you've enabled Developer Mode in the Settings app (sideloading won't work without it).
98 |
99 | ## Build and Test
100 |
101 | To help building and testing the DistroLauncher project, we've included several scripts to automate some tasks. You can either choose to use these scripts from the command line, or work directly in Visual Studio, whatever your preference is.
102 |
103 | > **Note**: some sideloading/deployment steps don't work if you mix and match Visual Studio and the command line for development. If you run into errors while trying to deploy your app after already deploying it once, the easiest step is usually just to uninstall the previously sideloaded version and try again.
104 |
105 | ### Building the Project (Command line):
106 | To compile the project, you can simply type `build` in the root of the project to use MSBuild to build the solution. This is useful for verifying that your application compiles. It will also build an appx for you to sideload on your dev machine for testing.
107 |
108 | > Note: We recommend that you build your launcher from the "Developer Command Prompt for Visual Studio" which can be launched from the start menu. This command-prompt sets up several path and environment variables to make building easier and smoother.
109 |
110 | `build.bat` assumes that MSBuild is installed at one of the following paths:
111 | `%ProgramFiles*%\MSBuild\14.0\bin\msbuild.exe` or
112 | `%ProgramFiles*%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe` or
113 | `%ProgramFiles*%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe`.
114 |
115 | If that's not the case, then you will need to modify that script.
116 |
117 | Once you've completed the build, the packaged appx should be placed in a directory like `WSL-DistroLauncher\x64\Release\DistroLauncher-Appx` and should be named something like `DistroLauncher-Appx_1.0.0.0_x64.appx`. Simply double click that appx file to open the sideloading dialog.
118 |
119 | You can also use the PowerShell cmdlet `Add-AppxPackage` to register your appx:
120 | ``` powershell
121 | powershell Add-AppxPackage x64\Debug\DistroLauncher-Appx\DistroLauncher-Appx_1.0.0.0_x64_Debug.appx
122 | ```
123 |
124 | ### Building Project (Visual Studio):
125 |
126 | You can also easily build and deploy the distro launcher from Visual Studio. To sideload your appx on your machine for testing, all you need to do is right-click on the "Solution (DistroLauncher)" in the Solution Explorer and click "Deploy Solution". This should build the project and sideload it automatically for testing.
127 |
128 | In order run your solution under the Visual Studio debugger, you will need to copy your install.tar.gz file into your output folder, for example: `x64\Debug`. **NOTE: If you have registered your distribution by this method, you will need to manually unregister it via wslconfig.exe /unregister**
129 |
130 | ### Installing & Testing
131 | You should now have a finished appx sideloaded on your machine for testing.
132 |
133 | To install your distro package, double click on the signed appx and click "Install". Note that this only installs the appx on your system - it doesn't unzip the tar.gz or register the distro yet.
134 |
135 | You should now find your distro in the Start menu, and you can launch your distro by clicking its Start menu tile or executing your distro from the command line by entering its name into a Cmd/PowerShell Console.
136 |
137 | When you first run your newly installed distro, it is unpacked and registered with WSL. This can take a couple of minutes while all your distro files are unpacked and copied to your drive.
138 |
139 | Once complete, you should see a Console window with your distro running inside it.
140 |
141 | ### Publishing
142 | If you are a distro vendor and want to publish your distro to the Windows store, you will need to complete some pre-requisite steps to ensure the quality and integrity of the WSL distro ecosystem, and to safeguard our users:
143 |
144 | #### Publishing Pre-Requisites
145 | 1. Sign up for an "Company" Windows Developer Account https://developer.microsoft.com/en-us/store/register.
146 | > Note: This can take a week or more since you'll be required to confirm your organization's identity with an independent verification service via email and/or telephone.
147 | 1. Follow the guides to publish your distro as a UWP app: https://docs.microsoft.com/en-us/windows/uwp/publish/
148 | 1. [Optional] Reach out to the WSL team at wslpartners@microsoft.com to introduce us to your distro!
149 |
150 | #### Publishing Code changes
151 | You'll also need to change a few small things in your project to prepare your distro for publishing to the Windows store
152 |
153 | 1. In your appxmanifest, you will need to change the values of the Identity field to match your identity in your Windows Store account:
154 |
155 | ``` xml
156 |
160 | ```
161 |
162 | > **NOTE**: Visual Studio can update this for you! You can do that by right-clicking on "DistroLauncher-Appx (Universal Windows)" in the solution explorer and clicking on "Store... Associate App with the Store..." and following the wizard.
163 |
164 | 2. You will either need to run `build rel` from the command line to generate the Release version of your appx or use Visual Studio directly to upload your package to the store. You can do this by right-clicking on "DistroLauncher-Appx (Universal Windows)" in the solution explorer and clicking on "Store... Create App Packages..." and following the wizard.
165 |
166 | Also, make sure to check out the [Notes for uploading to the Store](https://github.com/Microsoft/WSL-DistroLauncher/wiki/Notes-for-uploading-to-the-Store) page on our wiki for more information.
167 |
168 | # Issues & Contact
169 | Any bugs or problems discovered with the Launcher should be filed in this project's Issues list. The team will be notified and will respond to the reported issue within 3 (US) working days.
170 |
171 | You may also reach out to our team alias at wslpartners@microsoft.com for questions related to submitting your app to the Microsoft Store.
172 |
173 | # Contributing
174 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
175 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Security
4 |
5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6 |
7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
8 |
9 | ## Reporting Security Issues
10 |
11 | **Please do not report security vulnerabilities through public GitHub issues.**
12 |
13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
14 |
15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
16 |
17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
18 |
19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20 |
21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22 | * Full paths of source file(s) related to the manifestation of the issue
23 | * The location of the affected source code (tag/branch/commit or direct URL)
24 | * Any special configuration required to reproduce the issue
25 | * Step-by-step instructions to reproduce the issue
26 | * Proof-of-concept or exploit code (if possible)
27 | * Impact of the issue, including how an attacker might exploit the issue
28 |
29 | This information will help us triage your report more quickly.
30 |
31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
32 |
33 | ## Preferred Languages
34 |
35 | We prefer all communications to be in English.
36 |
37 | ## Policy
38 |
39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
40 |
41 |
42 |
--------------------------------------------------------------------------------
/build.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | rem Add path to MSBuild Binaries
4 | set MSBUILD=()
5 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" (
6 | set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
7 | goto :FOUND_MSBUILD
8 | )
9 | if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe" (
10 | set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
11 | goto :FOUND_MSBUILD
12 | )
13 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" (
14 | set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe"
15 | goto :FOUND_MSBUILD
16 | )
17 | if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe" (
18 | set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe"
19 | goto :FOUND_MSBUILD
20 | )
21 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" (
22 | set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
23 | goto :FOUND_MSBUILD
24 | )
25 | if exist "%ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" (
26 | set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"
27 | goto :FOUND_MSBUILD
28 | )
29 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe" (
30 | set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe"
31 | goto :FOUND_MSBUILD
32 | )
33 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" (
34 | set MSBUILD="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe"
35 | goto :FOUND_MSBUILD
36 | )
37 | if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" (
38 | set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe"
39 | goto :FOUND_MSBUILD
40 | )
41 | if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe" (
42 | set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe"
43 | goto :FOUND_MSBUILD
44 | )
45 | if exist "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe" (
46 | set MSBUILD="%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
47 | goto :FOUND_MSBUILD
48 | )
49 | if exist "%ProgramFiles(x86)%\MSBuild\14.0\bin" (
50 | set MSBUILD="%ProgramFiles(x86)%\MSBuild\14.0\bin\msbuild.exe"
51 | goto :FOUND_MSBUILD
52 | )
53 | if exist "%ProgramFiles%\MSBuild\14.0\bin" (
54 | set MSBUILD="%ProgramFiles%\MSBuild\14.0\bin\msbuild.exe"
55 | goto :FOUND_MSBUILD
56 | )
57 |
58 | if %MSBUILD%==() (
59 | echo "I couldn't find MSBuild on your PC. Make sure it's installed somewhere, and if it's not in the above if statements (in build.bat), add it."
60 | goto :EXIT
61 | )
62 | :FOUND_MSBUILD
63 | set _MSBUILD_TARGET=Build
64 | set _MSBUILD_CONFIG=Debug
65 |
66 | :ARGS_LOOP
67 | if (%1) == () goto :POST_ARGS_LOOP
68 | if (%1) == (clean) (
69 | set _MSBUILD_TARGET=Clean,Build
70 | )
71 | if (%1) == (rel) (
72 | set _MSBUILD_CONFIG=Release
73 | )
74 | shift
75 | goto :ARGS_LOOP
76 |
77 | :POST_ARGS_LOOP
78 | %MSBUILD% %~dp0\DistroLauncher.sln /t:%_MSBUILD_TARGET% /m /nr:true /p:Configuration=%_MSBUILD_CONFIG%;Platform=x64
79 |
80 | if (%ERRORLEVEL%) == (0) (
81 | echo.
82 | echo Created appx in %~dp0x64\%_MSBUILD_CONFIG%\DistroLauncher-Appx\
83 | echo.
84 | )
85 |
86 | :EXIT
87 |
--------------------------------------------------------------------------------