summaryrefslogtreecommitdiffstats
path: root/remoting/host/installer/win/chromoting.wxs
blob: e3ae2bbe1f6150d08ea195d03579ba4ddbf44206 (plain)
1
2
3
4
5
6
7
8
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

  <?define EventSourceName = "chromoting" ?>
  <?define ServiceName = "chromoting" ?>

  <!-- TODO(alexeypa): There strings should be localized,
       see http://crbug.com/121785 -->
  <?if $(var.Branding) ~= Chrome ?>
    <?define ChromotingHost = "Chrome Remote Desktop Host" ?>
    <?define ChromotingServiceName = "Chrome Remote Desktop Service" ?>
    <?define ChromotingServiceDescription = "This service enables incoming connections from Chrome Remote Desktop clients." ?>
    <?define Manufacturer = "Google Inc." ?>
  <?else?>
    <?define ChromotingHost = "Chromoting Host" ?>
    <?define ChromotingServiceName = "Chromoting Service" ?>
    <?define ChromotingServiceDescription = "This service enables incoming connections from Chromoting clients." ?>
    <?define Manufacturer = "The Chromium Authors" ?>
  <?endif?>

  <?define FirewallName = "$(var.ChromotingHost)" ?>

  <?define OmahaAppid = "{b210701e-ffc4-49e3-932b-370728c72662}" ?>
  <?define UpgradeCode = "2b21f767-e157-4fa6-963c-55834c1433a6" ?>

  <?define CoreBinary = "remoting_core.dll" ?>

  <?define ControllerAppid = "{4ff35d5e-d226-4550-9248-03e7779e67de}" ?>
  <?define ControllerBinary = "remoting_controller.exe" ?>
  <?define ControllerClass = "ElevatedController Class" ?>
  <?define ControllerProgid =
    "ChromotingElevatedController.ElevatedController" ?>
  <?define ControllerTypelib = "{9d9a5a2c-576e-4acd-9c75-aabff74b205d}" ?>

  <!--
    The long hex value below is a security descriptor that allows SYSTEM,
    built-in administrators and interactive users to call methods of a COM
    object (COM_RIGHTS_EXECUTE and COM_RIGHTS_EXECUTE_LOCAL). The security
    descriptor was generated from SDDL definition using the PowerShell script
    below:

      $sddl = "O:BAG:BAD:(A;;0x3;;;IU)(A;;0x3;;;SY)(A;;0x3;;;BA)"
      $i = ([wmiclass]"Win32_SecurityDescriptorHelper").SDDLToBinarySD($sddl).BinarySD
      -join ($i | foreach {$_.ToString("X2")})
  -->
  <?define ControllerSd = "010004805C0000006C00000000000000140000000200480003000000000014000300000001010000000000050400000000001400030000000101000000000005120000000000180003000000010200000000000520000000200200000102000000000005200000002002000001020000000000052000000020020000" ?>

  <?ifndef ControllerClsid ?>
    <?error ControllerClsid must be defined ?>
  <?endif?>

  <?ifndef Version ?>
    <?error Version must be defined ?>
  <?endif?>

  <Product Id="*"
           Language="1033"
           Manufacturer="$(var.Manufacturer)"
           Name="$(var.ChromotingHost)"
           UpgradeCode="$(var.UpgradeCode)"
           Version="$(var.Version)">

    <Package Comments="$(var.ChromotingHost) Package"
             Compressed="yes"
             Description="$(var.ChromotingHost) Package"
             InstallerVersion="200"
             Manufacturer="$(var.Manufacturer)"
             InstallScope="perMachine"/>

    <Condition
      Message="$(var.ChromotingHost) is only supported on Windows XP, Windows Server 2003, or higher.">
      <![CDATA[Installed OR (VersionNT >= 501)]]>
    </Condition>

    <!-- The upgrade rules below could be expressed with MajorUpgrade element.
         Unfortunately, there is a bug in WiX decompiler (Dark) corrupting
         InstallExecuteSequence table. The installation compiled from
         the disassembled .msi schedules RemoveExistingProducts after
         InstallFinalize while the original installation schedules it after
         InstallInitialize. Fortunately, the verbose version of the upgrade
         rules below decompiles correctly, so we use it instead.
         See http://crbug.com/145265 for more details.
    -->
    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion IncludeMinimum="no"
                      Minimum="$(var.Version)"
                      OnlyDetect="yes"
                      Property="NEWERVERSIONDETECTED" />
      <UpgradeVersion IncludeMaximum="yes"
                      IncludeMinimum="yes"
                      Maximum="$(var.Version)"
                      Minimum="0.0.0.0"
                      Property="OLDERVERSIONBEINGUPGRADED" />
      <!-- Detect versions that didn't handle the usagestats value properly. -->
      <UpgradeVersion IncludeMaximum="yes"
                      IncludeMinimum="yes"
                      Maximum="24.0.1312.29"
                      Minimum="0.0.0.0"
                      Property="BROKENUSAGESTATSVERSION" />
    </Upgrade>

    <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
      NOT NEWERVERSIONDETECTED
    </Condition>

    <Media Id="1" Cabinet="chromoting.cab" EmbedCab="yes"/>

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <?if $(var.OfficialBuild) != 0 ?>
          <Directory Id="program_files_google" Name="Google">
            <Directory Id="chromoting" Name="Chrome Remote Desktop">
              <Directory Id="binaries" Name="$(var.Version)"/>
            </Directory>
          </Directory>
        <?else?>
          <Directory Id="chromoting" Name="Chromoting">
            <Directory Id="binaries" Name="$(var.Version)"/>
          </Directory>
        <?endif?>
      </Directory>
      <Directory Id="CommonAppDataFolder">
        <?if $(var.OfficialBuild) != 0 ?>
          <Directory Id="common_app_data_google" Name="Google">
            <Directory Id="config_files" Name="Chrome Remote Desktop"/>
          </Directory>
        <?else?>
          <Directory Id="config_files" Name="Chromoting"/>
        <?endif?>
      </Directory>
    </Directory>

    <DirectoryRef Id="binaries">
      <Component Id="sas" Guid="*">
        <File Id="sas.dll"
              DiskId="1"
              Name="sas.dll"
              Vital="yes"/>
      </Component>

      <Component Id="remoting_core" Guid="*">
        <File Id="$(var.CoreBinary)"
              DiskId="1"
              KeyPath="yes"
              Name="$(var.CoreBinary)"
              Vital="yes"/>

        <util:EventSource xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
                          Name="$(var.EventSourceName)"
                          Log="Application"
                          CategoryCount="1"
                          CategoryMessageFile="[#$(var.CoreBinary)]"
                          EventMessageFile="[#$(var.CoreBinary)]"
                          SupportsErrors="yes"
                          SupportsInformationals="yes"/>
      </Component>

      <?if $(var.RemotingMultiProcess) != 0 ?>
        <Component Id="remoting_desktop" Guid="*">
          <File Id="remoting_desktop.exe"
                DiskId="1"
                KeyPath="yes"
                Name="remoting_desktop.exe"
                Vital="yes"/>
        </Component>
      <?endif?>

      <Component Id="remoting_daemon" Guid="*">
        <File Id="remoting_daemon.exe"
              DiskId="1"
              KeyPath="yes"
              Name="remoting_daemon.exe"
              Vital="yes"/>

        <ServiceInstall Id="install_service"
                        Type="ownProcess"
                        Vital="yes"
                        Name="$(var.ServiceName)"
                        DisplayName="[chromoting_service_display_name]"
                        Description="[chromoting_service_description]"
                        Arguments="--host-config=&quot;[config_files]host.json&quot;"
                        Start="demand"
                        Account="LocalSystem"
                        ErrorControl="ignore"
                        Interactive="no" />

        <ServiceControl Id="start_service"
                        Stop="both"
                        Remove="uninstall"
                        Name="$(var.ServiceName)"
                        Wait="yes" />
      </Component>

      <Component Id="remoting_host" Guid="*">
        <File Id="remoting_host.exe"
              DiskId="1"
              Name="remoting_host.exe"
              Vital="yes"/>
        <fire:FirewallException xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension"
                                Id="me2me_firewall_exception"
                                IgnoreFailure="yes"
                                Name="$(var.FirewallName)"
                                Profile="all"
                                Program="[#remoting_host.exe]"
                                Scope="any" />
      </Component>

      <?if $(var.OfficialBuild) != 0 ?>
        <Component Id="omaha_registration" Guid="*">
          <RegistryKey Id="omaha_client_key"
                       Root="HKLM"
                       Key="SOFTWARE\Google\Update\Clients\$(var.OmahaAppid)"
                       Action="create">
            <RegistryValue Type="string"
                           Name="pv"
                           Value="$(var.Version)"/>

            <RegistryValue Type="string"
                           Name="name"
                           Value="$(var.ChromotingHost)"/>
          </RegistryKey>
        </Component>
      <?endif?>

      <Component Id="remoting_controller" Guid="*">
        <File Id="$(var.ControllerBinary)"
              DiskId="1"
              Name="$(var.ControllerBinary)"
              Vital="yes"/>

        <RegistryKey Root="HKLM"
                     Key="SOFTWARE\Classes">
          <RegistryKey Key="AppId">
            <RegistryKey Key="$(var.ControllerAppid)" Action="create">
              <RegistryValue Type="string"
                             Value="ChromotingElevatedController"/>
              <RegistryValue Name="AccessPermission"
                             Type="binary"
                             Value="$(var.ControllerSd)"/>
            </RegistryKey>

            <RegistryKey Key="$(var.ControllerBinary)" Action="create">
              <RegistryValue Type="string"
                             Name="AppID"
                             Value="$(var.ControllerAppid)"/>
            </RegistryKey>
          </RegistryKey>

          <RegistryKey Key="$(var.ControllerProgid)" Action="create">
            <RegistryValue Type="string"
                           Value="$(var.ControllerClass)"/>

            <RegistryKey Key="CLSID" Action="create">
              <RegistryValue Type="string"
                             Value="$(var.ControllerClsid)"/>
            </RegistryKey>

            <RegistryKey Key="CurVer" Action="create">
              <RegistryValue Type="string"
                             Value="$(var.ControllerProgid).$(var.Version)"/>
            </RegistryKey>
          </RegistryKey>

          <RegistryKey Key="$(var.ControllerProgid).$(var.Version)"
                       Action="create">
            <RegistryValue Type="string"
                           Value="$(var.ControllerClass)"/>

            <RegistryKey Key="CLSID" Action="create">
              <RegistryValue Type="string"
                             Value="$(var.ControllerClsid)"/>
            </RegistryKey>
          </RegistryKey>

          <RegistryKey Key="CLSID">
            <RegistryKey Key="$(var.ControllerClsid)" Action="create">
              <RegistryValue Type="string"
                             Value="$(var.ControllerClass)"/>

              <RegistryValue Type="string"
                             Name="AppID"
                             Value="$(var.ControllerAppid)"/>

              <RegistryValue Type="string"
                             Name="LocalizedString"
                             Value="@[binaries]$(var.CoreBinary),-103"/>

              <RegistryKey Key="LocalServer32" Action="create">
                <RegistryValue Type="string"
                               Value="[#$(var.ControllerBinary)]"/>
              </RegistryKey>

              <RegistryKey Key="ProgID" Action="create">
                <RegistryValue Type="string"
                               Value="$(var.ControllerProgid).$(var.Version)"/>
              </RegistryKey>

              <RegistryKey Key="TypeLib" Action="create">
                <RegistryValue Type="string"
                               Value="$(var.ControllerTypelib)"/>
              </RegistryKey>

              <RegistryKey Key="VersionIndependentProgID" Action="create">
                <RegistryValue Type="string"
                               Value="$(var.ControllerProgid)"/>
              </RegistryKey>

              <RegistryKey Key="Elevation" Action="create">
                <RegistryValue Type="integer"
                               Name="Enabled"
                               Value="1"/>
                <RegistryValue Type="string"
                               Name="IconReference"
                               Value="@[binaries]$(var.CoreBinary),-104"/>
              </RegistryKey>
            </RegistryKey>
          </RegistryKey>

          <RegistryKey Key="Interface">
            <RegistryKey Key="{655bd819-c08c-4b04-80c2-f160739ff6ef}"
                         Action="create">
              <RegistryKey Key="ProxyStubClsid32" Action="create">
                <RegistryValue Type="string"
                               Value="{00020424-0000-0000-C000-000000000046}"/>
              </RegistryKey>

              <RegistryKey Key="TypeLib" Action="create">
                <RegistryValue Type="string"
                               Value="$(var.ControllerTypelib)"/>
              </RegistryKey>
            </RegistryKey>

            <RegistryKey Key="{e051a481-6345-4ba1-bdb1-cf7929955268}"
                         Action="create">
              <RegistryKey Key="ProxyStubClsid32" Action="create">
                <RegistryValue Type="string"
                               Value="{00020424-0000-0000-C000-000000000046}"/>
              </RegistryKey>

              <RegistryKey Key="TypeLib" Action="create">
                <RegistryValue Type="string"
                               Value="$(var.ControllerTypelib)"/>
              </RegistryKey>
            </RegistryKey>
          </RegistryKey>

          <RegistryKey Key="Typelib">
            <RegistryKey Key="$(var.ControllerTypelib)" Action="create">
              <RegistryKey Key="1.1" Action="create">
                <RegistryKey Key="0" Action="create">
                  <RegistryKey Key="win32" Action="create">
                    <RegistryValue Type="string"
                                   Value="@[binaries]$(var.CoreBinary)"/>
                  </RegistryKey>
                </RegistryKey>

                <RegistryKey Key="FLAGS" Action="create">
                  <RegistryValue Type="string"
                                 Value="0"/>
                </RegistryKey>

                <RegistryKey Key="HELPDIR" Action="create">
                  <RegistryValue Type="string"
                                 Value="[binaries]"/>
                </RegistryKey>
              </RegistryKey>
            </RegistryKey>
          </RegistryKey>
        </RegistryKey>

      </Component>

      <!-- Register with Sawbuck. See http://code.google.com/p/sawbuck/. -->
      <Component Id="sawbuck_provider" Guid="*">
        <RegistryKey Root="HKLM"
                     Key="SOFTWARE\Google\Sawbuck\Providers">
          <RegistryKey Key="{2db51ca1-4fd8-4b88-b5a2-fb8606b66b02}"
                       Action="create">
            <RegistryValue Type="string" Value="Chromoting"/>
            <RegistryValue Name="default_flags" Type="integer" Value="1"/>
            <RegistryValue Name="default_level" Type="integer" Value="4"/>
            <RegistryKey Key="Flags" Action="create">
              <RegistryKey Key="Stack Trace" Action="create">
                <RegistryValue Type="integer" Value="1"/>
              </RegistryKey>
              <RegistryKey Key="Text Only" Action="create">
                <RegistryValue Type="integer" Value="2"/>
              </RegistryKey>
            </RegistryKey>
          </RegistryKey>
        </RegistryKey>
      </Component>

      <!-- Delete the usagestats flag to reset the crash dump reporting settings
           for existing users. -->
      <Component Id="delete_usagestats"
                 Guid="5c73f2b9-b865-426f-81cc-90a27ebb54aa"
                 KeyPath="yes">
        <Condition>BROKENUSAGESTATSVERSION</Condition>
        <RemoveRegistryValue
            Id="usagestats"
            Key="SOFTWARE\Google\Update\ClientStateMedium\$(var.OmahaAppid)"
            Name="usagestats"
            Root="HKLM" />
      </Component>

    </DirectoryRef>

    <DirectoryRef Id="config_files">
      <!-- Delete debug.log from previous versions -->
      <Component Id="delete_debug_log"
                 Guid="b309082a-e6fa-4dc7-98e4-3d83c896561d">
        <RemoveFile Id="debug.log"
                    Name="debug.log"
                    On="both" />
      </Component>
    </DirectoryRef>

    <!-- The service is always installed in the stopped state with start type
         set to 'manual'. This becomes a problem when upgrading an existing
         installation that is configured to start the service automatically.

         Here we check the startup type before making any changes, then restart
         the service and change its startup type as needed once the installation
         is finished. -->
    <Property Id="CHROMOTING_SERVICE_START_TYPE">
      <RegistrySearch Id="chromoting_service_start_type"
                      Root="HKLM"
                      Key="SYSTEM\CurrentControlSet\services\$(var.ServiceName)"
                      Name="Start"
                      Type="raw" />
    </Property>

    <CustomAction Id="query_auto_start_service"
                  Property="auto_start_service"
                  Value="[CHROMOTING_SERVICE_START_TYPE]" />

    <CustomAction Id="set_auto_start_service"
                  Impersonate="no"
                  Execute="deferred"
                  Script="jscript">
      <![CDATA[
        var controller = new ActiveXObject("$(var.ControllerProgid)");
        controller.StartDaemon();
      ]]>
    </CustomAction>

    <CustomAction Id="set_service_display_name"
                  Property="chromoting_service_display_name"
                  Value="@[binaries]$(var.CoreBinary),-101" />
    <CustomAction Id="set_service_description"
                  Property="chromoting_service_description"
                  Value="@[binaries]$(var.CoreBinary),-102" />

    <!-- XP does not support MUI strings in the service name and description, so
         we fall back to plain strings on XP. -->
    <CustomAction Id="set_service_display_name_xp"
                  Property="chromoting_service_display_name"
                  Value="$(var.ChromotingServiceName)" />
    <CustomAction Id="set_service_description_xp"
                  Property="chromoting_service_description"
                  Value="$(var.ChromotingServiceDescription)" />

    <UIRef Id="WixUI_ErrorProgressText" />

    <Feature Id="chromoting_host" Level="1" Title="$(var.ChromotingHost)">
      <ComponentRef Id="delete_debug_log"/>
      <ComponentRef Id="delete_usagestats"/>
      <?if $(var.OfficialBuild) != 0 ?>
        <ComponentRef Id="omaha_registration"/>
      <?endif?>
      <ComponentRef Id="remoting_controller"/>
      <ComponentRef Id="remoting_core"/>
      <ComponentRef Id="remoting_daemon"/>
      <?if $(var.RemotingMultiProcess) != 0 ?>
        <ComponentRef Id="remoting_desktop"/>
      <?endif?>
      <ComponentRef Id="remoting_host"/>
      <ComponentRef Id="sas"/>
      <ComponentRef Id="sawbuck_provider"/>
    </Feature>

    <!-- Set the icon shown in Add/Remove Programs. -->
    <Icon Id="chromoting.ico" SourceFile="chromoting.ico"/>
    <Property Id="ARPPRODUCTICON" Value="chromoting.ico" />

    <InstallExecuteSequence>
      <Custom Action="query_auto_start_service" Before="InstallInitialize"/>
      <Custom Action="set_auto_start_service" After="StartServices">
        <![CDATA[NOT REMOVE AND (auto_start_service = "#2")]]>
      </Custom>

      <!-- Set the serivce name and description -->
      <Custom Action="set_service_display_name_xp" Before="InstallInitialize">
        <![CDATA[VersionNT < 600]]>
      </Custom>
      <Custom Action="set_service_description_xp" Before="InstallInitialize">
        <![CDATA[VersionNT < 600]]>
      </Custom>
      <Custom Action="set_service_display_name" Before="InstallInitialize">
        <![CDATA[VersionNT >= 600]]>
      </Custom>
      <Custom Action="set_service_description" Before="InstallInitialize">
        <![CDATA[VersionNT >= 600]]>
      </Custom>

      <!-- Schedule RemoveExistingProducts before installing any files.
           See http://msdn.microsoft.com/en-us/library/aa371197.aspx. -->
      <RemoveExistingProducts After="InstallInitialize" />
    </InstallExecuteSequence>
  </Product>
</Wix>