1<?xml version="1.0"?>
2<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3
4  <?define EventSourceName = "chromoting" ?>
5  <?define ServiceName = "chromoting" ?>
6
7  <!-- TODO(alexeypa): There strings should be localized,
8       see http://crbug.com/121785 -->
9  <?if $(var.Branding) ~= Chrome ?>
10    <?define ChromotingHost = "Chrome Remote Desktop Host" ?>
11    <?define ChromotingServiceName = "Chrome Remote Desktop Service" ?>
12    <?define ChromotingServiceDescription = "This service enables incoming connections from Chrome Remote Desktop clients." ?>
13    <?define Manufacturer = "Google Inc." ?>
14  <?else?>
15    <?define ChromotingHost = "Chromoting Host" ?>
16    <?define ChromotingServiceName = "Chromoting Service" ?>
17    <?define ChromotingServiceDescription = "This service enables incoming connections from Chromoting clients." ?>
18    <?define Manufacturer = "The Chromium Authors" ?>
19  <?endif?>
20
21  <?if $(sys.BUILDARCH) = "x64" ?>
22    <?define ProgramFilesFolderForPlatform = "ProgramFiles64Folder" ?>
23  <?else?>
24    <?define ProgramFilesFolderForPlatform = "ProgramFilesFolder" ?>
25  <?endif?>
26
27  <?if $(var.OfficialBuild) != 0 ?>
28    <?define ChromotingKeyPath = "Google\Chrome Remote Desktop" ?>
29  <?else?>
30    <?define ChromotingKeyPath = "Chromoting" ?>
31  <?endif?>
32
33  <?define FirewallName = "$(var.ChromotingHost)" ?>
34
35  <?define OmahaAppid = "{b210701e-ffc4-49e3-932b-370728c72662}" ?>
36  <?define UpgradeCode = "2b21f767-e157-4fa6-963c-55834c1433a6" ?>
37
38  <?define CoreBinary = "remoting_core.dll" ?>
39  <?define HostBinary = "remoting_host.exe" ?>
40
41  <?define ChromotingTypelib = "{b6396c45-b0cc-456b-9f49-f12964ee6df4}" ?>
42
43  <!-- AppIDs used by the COM components. -->
44  <?define ControllerAppid = "{4ff35d5e-d226-4550-9248-03e7779e67de}" ?>
45  <?define RdpAppid = "{52e6fd1a-f16e-49c0-aacb-5436a915448b}" ?>
46
47  <?define ControllerClass = "ElevatedController Class" ?>
48  <?define ControllerProgid =
49      "ChromotingElevatedController.ElevatedController" ?>
50
51  <?define IRdpDesktopSessionId = "{6a7699f0-ee43-43e7-aa30-a6738f9bd470}" ?>
52  <?define IRdpDesktopSessionEventHandlerId =
53      "{b59b96da-83cb-40ee-9b91-c377400fc3e3}" ?>
54
55  <!--
56    The long hex value(s) below are security descriptors generated from SDDL
57    definition using the PowerShell script below:
58
59    $sddl = "<SDDL definition goes here>"
60    $i = ([wmiclass]"Win32_SecurityDescriptorHelper").SDDLToBinarySD($sddl).BinarySD
61    -join ($i | foreach {$_.ToString("X2")})
62  -->
63
64  <!--
65    A security descriptor that gives SYSTEM, built-in administrators and
66    LocalService accounts COM_RIGHTS_EXECUTE, COM_RIGHTS_EXECUTE_LOCAL, and
67    COM_RIGHTS_ACTIVATE_LOCAL rights. It specifies a mandatory label that
68    specifies "no execute up" policy for medium integrity level.
69
70    $sddl = "O:BAG:BAD:(A;;0xb;;;SY)(A;;0xb;;;BA)(A;;0xb;;;LS)S:(ML;;NX;;;ME)"
71  -->
72  <?define RdpSd = "010014807800000088000000140000003000000002001C000100000011001400040000000101000000000010002000000200480003000000000014000B000000010100000000000512000000000018000B00000001020000000000052000000020020000000014000B0000000101000000000005130000000102000000000005200000002002000001020000000000052000000020020000" ?>
73
74  <!-- Verify that all required parameters are defined. -->
75  <?ifndef ControllerClsid ?>
76    <?error ControllerClsid must be defined ?>
77  <?endif?>
78
79  <?ifndef RdpDesktopSessionClsid ?>
80    <?error RdpDesktopSessionClsid must be defined ?>
81  <?endif?>
82
83  <?ifndef Version ?>
84    <?error Version must be defined ?>
85  <?endif?>
86
87  <Product Id="*"
88           Language="1033"
89           Manufacturer="$(var.Manufacturer)"
90           Name="$(var.ChromotingHost)"
91           UpgradeCode="$(var.UpgradeCode)"
92           Version="$(var.Version)">
93
94    <Package Comments="$(var.ChromotingHost) Package"
95             Compressed="yes"
96             Description="$(var.ChromotingHost) Package"
97             InstallerVersion="200"
98             Manufacturer="$(var.Manufacturer)"
99             InstallScope="perMachine"/>
100
101    <PropertyRef Id="WIX_ACCOUNT_LOCALSYSTEM" />
102    <PropertyRef Id="WIX_ACCOUNT_ADMINISTRATORS" />
103
104    <Condition
105      Message="$(var.ChromotingHost) is only supported on Windows XP, Windows Server 2003, or higher.">
106      <![CDATA[Installed OR (VersionNT >= 501)]]>
107    </Condition>
108
109    <!-- The upgrade rules below could be expressed with MajorUpgrade element.
110         Unfortunately, there is a bug in WiX decompiler (Dark) corrupting
111         InstallExecuteSequence table. The installation compiled from
112         the disassembled .msi schedules RemoveExistingProducts after
113         InstallFinalize while the original installation schedules it after
114         InstallInitialize. Fortunately, the verbose version of the upgrade
115         rules below decompiles correctly, so we use it instead.
116         See http://crbug.com/145265 for more details.
117    -->
118    <Upgrade Id="$(var.UpgradeCode)">
119      <UpgradeVersion IncludeMinimum="no"
120                      Minimum="$(var.Version)"
121                      OnlyDetect="yes"
122                      Property="NEWERVERSIONDETECTED" />
123      <UpgradeVersion IncludeMaximum="yes"
124                      IncludeMinimum="yes"
125                      Maximum="$(var.Version)"
126                      Minimum="0.0.0.0"
127                      Property="OLDERVERSIONBEINGUPGRADED" />
128      <!-- Detect versions that didn't handle the usagestats value properly. -->
129      <UpgradeVersion IncludeMaximum="yes"
130                      IncludeMinimum="yes"
131                      Maximum="24.0.1312.29"
132                      Minimum="0.0.0.0"
133                      Property="BROKENUSAGESTATSVERSION" />
134    </Upgrade>
135
136    <Condition Message="A later version of [ProductName] is already installed. Setup will now exit.">
137      NOT NEWERVERSIONDETECTED
138    </Condition>
139
140    <Media Id="1" Cabinet="chromoting.cab" EmbedCab="yes"/>
141
142    <Directory Id="TARGETDIR" Name="SourceDir">
143      <Directory Id="$(var.ProgramFilesFolderForPlatform)">
144        <?if $(var.OfficialBuild) != 0 ?>
145          <Directory Id="program_files_google" Name="Google">
146            <Directory Id="chromoting" Name="Chrome Remote Desktop">
147              <Directory Id="binaries" Name="$(var.Version)"/>
148            </Directory>
149          </Directory>
150        <?else?>
151          <Directory Id="chromoting" Name="Chromoting">
152            <Directory Id="binaries" Name="$(var.Version)"/>
153          </Directory>
154        <?endif?>
155      </Directory>
156      <Directory Id="CommonAppDataFolder">
157        <?if $(var.OfficialBuild) != 0 ?>
158          <Directory Id="common_app_data_google" Name="Google">
159            <Directory Id="config_files" Name="Chrome Remote Desktop"/>
160          </Directory>
161        <?else?>
162          <Directory Id="config_files" Name="Chromoting"/>
163        <?endif?>
164      </Directory>
165    </Directory>
166
167    <DirectoryRef Id="binaries">
168      <Component Id="sas" Guid="*">
169        <File Id="sas.dll"
170              DiskId="1"
171              Name="sas.dll"
172              Vital="yes"/>
173      </Component>
174
175      <Component Id="remoting_core" Guid="*">
176        <File Id="$(var.CoreBinary)"
177              DiskId="1"
178              KeyPath="yes"
179              Name="$(var.CoreBinary)"
180              Vital="yes"/>
181
182        <util:EventSource xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
183                          Name="$(var.EventSourceName)"
184                          Log="Application"
185                          CategoryCount="1"
186                          CategoryMessageFile="[#$(var.CoreBinary)]"
187                          EventMessageFile="[#$(var.CoreBinary)]"
188                          SupportsErrors="yes"
189                          SupportsInformationals="yes"/>
190      </Component>
191
192      <Component Id="remoting_desktop" Guid="*">
193        <File Id="remoting_desktop.exe"
194              DiskId="1"
195              KeyPath="yes"
196              Name="remoting_desktop.exe"
197              Vital="yes"/>
198      </Component>
199
200      <Component Id="remoting_native_messaging_host" Guid="*">
201        <File Id="remoting_native_messaging_host.exe"
202              DiskId="1"
203              KeyPath="yes"
204              Name="remoting_native_messaging_host.exe"
205              Vital="yes"/>
206      </Component>
207
208      <Component Id="remote_assistance_host" Guid="*">
209        <File Id="remote_assistance_host.exe"
210              DiskId="1"
211              KeyPath="yes"
212              Name="remote_assistance_host.exe"
213              Vital="yes"/>
214      </Component>
215
216      <Component Id="native_messaging_host_manifest" Guid="*">
217        <File Id="com.google.chrome.remote_desktop.json"
218              DiskId="1"
219              KeyPath="yes"
220              Name="com.google.chrome.remote_desktop.json"
221              Vital="yes"/>
222      </Component>
223
224      <Component Id="remote_assistance_host_manifest" Guid="*">
225        <File Id="com.google.chrome.remote_assistance.json"
226              DiskId="1"
227              KeyPath="yes"
228              Name="com.google.chrome.remote_assistance.json"
229              Vital="yes"/>
230      </Component>
231
232      <Component Id="icudtl" Guid="*">
233        <File Id="icudtl.dat"
234              DiskId="1"
235              KeyPath="yes"
236              Name="icudtl.dat"
237              Vital="yes"/>
238      </Component>
239
240      <Component Id="remoting_host" Guid="*">
241        <File Id="remoting_host.exe"
242              DiskId="1"
243              Name="remoting_host.exe"
244              Vital="yes"/>
245
246        <ServiceInstall Id="install_service"
247                        Type="ownProcess"
248                        Vital="yes"
249                        Name="$(var.ServiceName)"
250                        DisplayName="[chromoting_service_display_name]"
251                        Description="[chromoting_service_description]"
252                        Arguments="--type=daemon --host-config=&quot;[config_files]host.json&quot;"
253                        Start="demand"
254                        Account="LocalSystem"
255                        ErrorControl="ignore"
256                        Interactive="no">
257          <!-- Configure the service to restart after one minute when it
258               crashes.
259          -->
260          <util:ServiceConfig
261              xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
262              FirstFailureActionType="restart"
263              ResetPeriodInDays="1"
264              RestartServiceDelayInSeconds="60"
265              SecondFailureActionType="restart"
266              ThirdFailureActionType="restart"/>
267        </ServiceInstall>
268
269        <ServiceControl Id="start_service"
270                        Stop="both"
271                        Remove="uninstall"
272                        Name="$(var.ServiceName)"
273                        Wait="yes" />
274
275        <fire:FirewallException xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension"
276                                Id="me2me_firewall_exception"
277                                IgnoreFailure="yes"
278                                Name="$(var.FirewallName)"
279                                Profile="all"
280                                Program="[#remoting_host.exe]"
281                                Scope="any" />
282      </Component>
283
284      <?if $(var.OfficialBuild) != 0 ?>
285        <Component Id="omaha_registration" Guid="*">
286          <RegistryKey Id="omaha_client_key"
287                       Root="HKLM"
288                       Key="SOFTWARE\Google\Update\Clients\$(var.OmahaAppid)"
289                       Action="create">
290            <RegistryValue Type="string"
291                           Name="pv"
292                           Value="$(var.Version)"/>
293
294            <RegistryValue Type="string"
295                           Name="name"
296                           Value="$(var.ChromotingHost)"/>
297          </RegistryKey>
298        </Component>
299      <?endif?>
300
301      <Component Id="remoting_lib" Guid="*">
302        <RegistryKey Root="HKLM"
303                     Key="SOFTWARE\Classes">
304          <RegistryKey Key="AppId">
305            <RegistryKey Key="$(var.ControllerAppid)" Action="create">
306              <RegistryValue Type="string"
307                             Value="ChromotingElevatedController"/>
308            </RegistryKey>
309
310            <RegistryKey Key="$(var.RdpAppid)" Action="create">
311              <RegistryValue Type="string"
312                             Value="ChromotingRdpDesktopSession"/>
313              <RegistryValue Name="AccessPermission"
314                             Type="binary"
315                             Value="$(var.RdpSd)"/>
316              <RegistryValue Name="LaunchPermission"
317                             Type="binary"
318                             Value="$(var.RdpSd)"/>
319              <RegistryValue Name="RunAs"
320                             Type="string"
321                             Value="NT AUTHORITY\LocalService"/>
322            </RegistryKey>
323
324          </RegistryKey>
325
326          <RegistryKey Key="$(var.ControllerProgid)" Action="create">
327            <RegistryValue Type="string"
328                           Value="$(var.ControllerClass)"/>
329
330            <RegistryKey Key="CLSID" Action="create">
331              <RegistryValue Type="string"
332                             Value="$(var.ControllerClsid)"/>
333            </RegistryKey>
334
335            <RegistryKey Key="CurVer" Action="create">
336              <RegistryValue Type="string"
337                             Value="$(var.ControllerProgid).$(var.Version)"/>
338            </RegistryKey>
339          </RegistryKey>
340
341          <RegistryKey Key="$(var.ControllerProgid).$(var.Version)"
342                       Action="create">
343            <RegistryValue Type="string"
344                           Value="$(var.ControllerClass)"/>
345
346            <RegistryKey Key="CLSID" Action="create">
347              <RegistryValue Type="string"
348                             Value="$(var.ControllerClsid)"/>
349            </RegistryKey>
350          </RegistryKey>
351
352          <RegistryKey Key="CLSID">
353            <RegistryKey Key="$(var.ControllerClsid)" Action="create">
354              <RegistryValue Type="string"
355                             Value="$(var.ControllerClass)"/>
356
357              <RegistryValue Type="string"
358                             Name="AppID"
359                             Value="$(var.ControllerAppid)"/>
360
361              <RegistryValue Type="string"
362                             Name="LocalizedString"
363                             Value="@[binaries]$(var.CoreBinary),-103"/>
364
365              <RegistryKey Key="LocalServer32" Action="create">
366                <RegistryValue Type="string"
367                               Value="[binaries]$(var.HostBinary) --type=controller"/>
368              </RegistryKey>
369
370              <RegistryKey Key="ProgID" Action="create">
371                <RegistryValue Type="string"
372                               Value="$(var.ControllerProgid).$(var.Version)"/>
373              </RegistryKey>
374
375              <RegistryKey Key="TypeLib" Action="create">
376                <RegistryValue Type="string"
377                               Value="$(var.ChromotingTypelib)"/>
378              </RegistryKey>
379
380              <RegistryKey Key="VersionIndependentProgID" Action="create">
381                <RegistryValue Type="string"
382                               Value="$(var.ControllerProgid)"/>
383              </RegistryKey>
384
385              <RegistryKey Key="Elevation" Action="create">
386                <RegistryValue Type="integer"
387                               Name="Enabled"
388                               Value="1"/>
389                <RegistryValue Type="string"
390                               Name="IconReference"
391                               Value="@[binaries]$(var.CoreBinary),-104"/>
392              </RegistryKey>
393            </RegistryKey>
394            <RegistryKey Key="$(var.RdpDesktopSessionClsid)" Action="create">
395              <RegistryValue Type="string"
396                             Value="RdpDesktopSession Class"/>
397
398              <RegistryValue Type="string"
399                             Name="AppID"
400                             Value="$(var.RdpAppid)"/>
401
402              <RegistryKey Key="LocalServer32" Action="create">
403                <RegistryValue Type="string"
404                               Value="[binaries]$(var.HostBinary) --type=rdp_desktop_session"/>
405              </RegistryKey>
406
407              <RegistryKey Key="TypeLib" Action="create">
408                <RegistryValue Type="string"
409                               Value="$(var.ChromotingTypelib)"/>
410              </RegistryKey>
411            </RegistryKey>
412
413            <!-- IRdpDesktopSession PSFactory -->
414            <RegistryKey Key="$(var.IRdpDesktopSessionId)"
415                         Action="create">
416              <RegistryValue Type="string"
417                             Value="IRdpDesktopSession PSFactory"/>
418
419              <RegistryKey Key="InprocServer32" Action="create">
420                <RegistryValue Type="string"
421                               Value="[binaries]$(var.CoreBinary)"/>
422              </RegistryKey>
423            </RegistryKey>
424
425            <!-- IRdpDesktopSessionEventHandler PSFactory -->
426            <RegistryKey Key="$(var.IRdpDesktopSessionEventHandlerId)"
427                         Action="create">
428              <RegistryValue Type="string"
429                             Value="IRdpDesktopSessionEventHandler PSFactory"/>
430
431              <RegistryKey Key="InprocServer32" Action="create">
432                <RegistryValue Type="string"
433                               Value="[binaries]$(var.CoreBinary)"/>
434              </RegistryKey>
435            </RegistryKey>
436          </RegistryKey>
437
438          <RegistryKey Key="Interface">
439            <!-- IDaemonControl2 interface -->
440            <RegistryKey Key="{655bd819-c08c-4b04-80c2-f160739ff6ef}"
441                         Action="create">
442              <RegistryKey Key="ProxyStubClsid32" Action="create">
443                <RegistryValue Type="string"
444                               Value="{00020424-0000-0000-C000-000000000046}"/>
445              </RegistryKey>
446
447              <RegistryKey Key="TypeLib" Action="create">
448                <RegistryValue Type="string"
449                               Value="$(var.ChromotingTypelib)"/>
450              </RegistryKey>
451            </RegistryKey>
452
453            <!-- IDaemonControl interface -->
454            <RegistryKey Key="{e051a481-6345-4ba1-bdb1-cf7929955268}"
455                         Action="create">
456              <RegistryKey Key="ProxyStubClsid32" Action="create">
457                <RegistryValue Type="string"
458                               Value="{00020424-0000-0000-C000-000000000046}"/>
459              </RegistryKey>
460
461              <RegistryKey Key="TypeLib" Action="create">
462                <RegistryValue Type="string"
463                               Value="$(var.ChromotingTypelib)"/>
464              </RegistryKey>
465            </RegistryKey>
466
467            <!-- IRdpDesktopSession interface -->
468            <RegistryKey Key="$(var.IRdpDesktopSessionId)"
469                         Action="create">
470              <RegistryValue Type="string"
471                             Value="IRdpDesktopSession"/>
472              <RegistryKey Key="ProxyStubClsid32" Action="create">
473                <RegistryValue Type="string"
474                               Value="$(var.IRdpDesktopSessionId)"/>
475              </RegistryKey>
476            </RegistryKey>
477
478            <!-- IRdpDesktopSessionEventHandler interface -->
479            <RegistryKey Key="$(var.IRdpDesktopSessionEventHandlerId)"
480                         Action="create">
481              <RegistryValue Type="string"
482                             Value="IRdpDesktopSessionEventHandler"/>
483              <RegistryKey Key="ProxyStubClsid32" Action="create">
484                <RegistryValue Type="string"
485                               Value="$(var.IRdpDesktopSessionEventHandlerId)"/>
486              </RegistryKey>
487
488              <RegistryKey Key="TypeLib" Action="create">
489                <RegistryValue Type="string"
490                               Value="$(var.ChromotingTypelib)"/>
491              </RegistryKey>
492            </RegistryKey>
493          </RegistryKey>
494
495          <RegistryKey Key="Typelib">
496            <RegistryKey Key="$(var.ChromotingTypelib)" Action="create">
497              <RegistryKey Key="1.0" Action="create">
498                <RegistryValue Type="string"
499                               Value="Chromoting 1.0 Type Library"/>
500                <RegistryKey Key="0" Action="create">
501                  <RegistryKey Key="win32" Action="create">
502                    <RegistryValue Type="string"
503                                   Value="[binaries]$(var.CoreBinary)"/>
504                  </RegistryKey>
505                </RegistryKey>
506
507                <RegistryKey Key="FLAGS" Action="create">
508                  <RegistryValue Type="string"
509                                 Value="0"/>
510                </RegistryKey>
511
512                <RegistryKey Key="HELPDIR" Action="create">
513                  <RegistryValue Type="string"
514                                 Value="[binaries]"/>
515                </RegistryKey>
516              </RegistryKey>
517            </RegistryKey>
518          </RegistryKey>
519        </RegistryKey>
520
521      </Component>
522
523      <!-- Creates the pairing registry store and protect it with an ACL. -->
524      <Component Id="remoting_pairing_registry" Guid="960bc7eb-a816-428b-90e8-ad13336955d5">
525        <RegistryKey Root="HKLM"
526                     Key="SOFTWARE\$(var.ChromotingKeyPath)\paired-clients"
527                     Action="create">
528          <RegistryKey Key="clients" Action="create"/>
529          <RegistryKey Key="secrets" Action="create">
530            <!-- Gives full access to SYSTEM only. -->
531            <!-- Cannot use the builtin PermissionEx element because it maps
532                 to the MsiLockPermissionsEx table which is not supported on
533                 Windows Installer version 4.5 or lower. Also Cannot use
534                 PermissionEx in WixUtilExtension because it automatically
535                 inherits all the ACLs from the parent. -->
536            <Permission User="[WIX_ACCOUNT_LOCALSYSTEM]"
537                        GenericAll="yes"
538                        ChangePermission="yes"
539                        TakeOwnership="yes"/>
540            <Permission User="[WIX_ACCOUNT_ADMINISTRATORS]"
541                        GenericAll="yes"
542                        ChangePermission="yes"
543                        TakeOwnership="yes"/>
544          </RegistryKey>
545        </RegistryKey>
546        <CreateFolder/>
547      </Component>
548
549      <Component Id="native_messaging_host_registry" Guid="*">
550        <RegistryKey Root="HKLM"
551                     Key="SOFTWARE\Google\chrome\NativeMessagingHosts"
552                     Action="create">
553          <RegistryKey Key="com.google.chrome.remote_desktop" Action="create">
554            <RegistryValue
555                Type="string"
556                Value="[binaries]com.google.chrome.remote_desktop.json"/>
557          </RegistryKey>
558        </RegistryKey>
559        <CreateFolder/>
560      </Component>
561
562      <Component Id="remote_assistance_host_registry" Guid="*">
563        <RegistryKey Root="HKLM"
564                     Key="SOFTWARE\Google\chrome\NativeMessagingHosts"
565                     Action="create">
566          <RegistryKey Key="com.google.chrome.remote_assistance"
567                       Action="create">
568            <RegistryValue
569                Type="string"
570                Value="[binaries]com.google.chrome.remote_assistance.json"/>
571          </RegistryKey>
572        </RegistryKey>
573        <CreateFolder/>
574      </Component>
575
576      <!-- Delete the usagestats flag to reset the crash dump reporting settings
577           for existing users. -->
578      <Component Id="delete_usagestats"
579                 Guid="5c73f2b9-b865-426f-81cc-90a27ebb54aa"
580                 KeyPath="yes">
581        <Condition>BROKENUSAGESTATSVERSION</Condition>
582        <RemoveRegistryValue
583            Id="usagestats"
584            Key="SOFTWARE\Google\Update\ClientStateMedium\$(var.OmahaAppid)"
585            Name="usagestats"
586            Root="HKLM" />
587      </Component>
588
589    </DirectoryRef>
590
591    <!-- Register with Sawbuck. See http://code.google.com/p/sawbuck/. -->
592    <DirectoryRef Id="TARGETDIR">
593      <Component Id="sawbuck_provider" Guid="*" Win64="no">
594        <RegistryKey Root="HKLM"
595                     Key="SOFTWARE\Google\Sawbuck\Providers">
596          <RegistryKey Key="{2db51ca1-4fd8-4b88-b5a2-fb8606b66b02}"
597                       Action="create">
598            <RegistryValue Type="string" Value="Chromoting"/>
599            <RegistryValue Name="default_flags" Type="integer" Value="1"/>
600            <RegistryValue Name="default_level" Type="integer" Value="4"/>
601            <RegistryKey Key="Flags" Action="create">
602              <RegistryKey Key="Stack Trace" Action="create">
603                <RegistryValue Type="integer" Value="1"/>
604              </RegistryKey>
605              <RegistryKey Key="Text Only" Action="create">
606                <RegistryValue Type="integer" Value="2"/>
607              </RegistryKey>
608            </RegistryKey>
609          </RegistryKey>
610        </RegistryKey>
611      </Component>
612    </DirectoryRef>
613
614    <DirectoryRef Id="config_files">
615      <!-- Delete debug.log from previous versions -->
616      <Component Id="delete_debug_log"
617                 Guid="b309082a-e6fa-4dc7-98e4-3d83c896561d">
618        <RemoveFile Id="debug.log"
619                    Name="debug.log"
620                    On="both" />
621      </Component>
622    </DirectoryRef>
623
624    <!-- The service is always installed in the stopped state with start type
625         set to 'manual'. This becomes a problem when upgrading an existing
626         installation that is configured to start the service automatically.
627
628         Here we check the startup type before making any changes, then restart
629         the service and change its startup type as needed once the installation
630         is finished. -->
631    <Property Id="CHROMOTING_SERVICE_START_TYPE">
632      <RegistrySearch Id="chromoting_service_start_type"
633                      Root="HKLM"
634                      Key="SYSTEM\CurrentControlSet\services\$(var.ServiceName)"
635                      Name="Start"
636                      Type="raw" />
637    </Property>
638
639    <CustomAction Id="query_auto_start_service"
640                  Property="auto_start_service"
641                  Value="[CHROMOTING_SERVICE_START_TYPE]" />
642
643    <CustomAction Id="set_auto_start_service"
644                  Impersonate="no"
645                  Execute="deferred"
646                  Script="jscript">
647      <![CDATA[
648        var controller = new ActiveXObject("$(var.ControllerProgid)");
649        controller.StartDaemon();
650      ]]>
651    </CustomAction>
652
653    <CustomAction Id="set_service_display_name"
654                  Property="chromoting_service_display_name"
655                  Value="@[binaries]$(var.CoreBinary),-101" />
656    <CustomAction Id="set_service_description"
657                  Property="chromoting_service_description"
658                  Value="@[binaries]$(var.CoreBinary),-102" />
659
660    <!-- XP does not support MUI strings in the service name and description, so
661         we fall back to plain strings on XP. -->
662    <CustomAction Id="set_service_display_name_xp"
663                  Property="chromoting_service_display_name"
664                  Value="$(var.ChromotingServiceName)" />
665    <CustomAction Id="set_service_description_xp"
666                  Property="chromoting_service_description"
667                  Value="$(var.ChromotingServiceDescription)" />
668
669    <UIRef Id="WixUI_ErrorProgressText" />
670
671    <Feature Id="chromoting_host" Level="1" Title="$(var.ChromotingHost)">
672      <ComponentRef Id="delete_debug_log"/>
673      <ComponentRef Id="delete_usagestats"/>
674      <?if $(var.OfficialBuild) != 0 ?>
675        <ComponentRef Id="omaha_registration"/>
676      <?endif?>
677      <ComponentRef Id="icudtl"/>
678      <ComponentRef Id="native_messaging_host_manifest"/>
679      <ComponentRef Id="native_messaging_host_registry"/>
680      <ComponentRef Id="remote_assistance_host"/>
681      <ComponentRef Id="remote_assistance_host_manifest"/>
682      <ComponentRef Id="remote_assistance_host_registry"/>
683      <ComponentRef Id="remoting_native_messaging_host"/>
684      <ComponentRef Id="remoting_core"/>
685      <ComponentRef Id="remoting_desktop"/>
686      <ComponentRef Id="remoting_host"/>
687      <ComponentRef Id="remoting_lib"/>
688      <ComponentRef Id="remoting_pairing_registry"/>
689      <ComponentRef Id="sas"/>
690      <ComponentRef Id="sawbuck_provider"/>
691    </Feature>
692
693    <!-- Set the icon shown in Add/Remove Programs. -->
694    <Icon Id="chromoting.ico" SourceFile="chromoting.ico"/>
695    <Property Id="ARPPRODUCTICON" Value="chromoting.ico" />
696
697    <InstallExecuteSequence>
698      <Custom Action="query_auto_start_service" Before="InstallInitialize"/>
699      <Custom Action="set_auto_start_service" After="StartServices">
700        <![CDATA[NOT REMOVE AND (auto_start_service = "#2")]]>
701      </Custom>
702
703      <!-- Set the service name and description -->
704      <Custom Action="set_service_display_name_xp" Before="InstallInitialize">
705        <![CDATA[VersionNT < 600]]>
706      </Custom>
707      <Custom Action="set_service_description_xp" Before="InstallInitialize">
708        <![CDATA[VersionNT < 600]]>
709      </Custom>
710      <Custom Action="set_service_display_name" Before="InstallInitialize">
711        <![CDATA[VersionNT >= 600]]>
712      </Custom>
713      <Custom Action="set_service_description" Before="InstallInitialize">
714        <![CDATA[VersionNT >= 600]]>
715      </Custom>
716
717      <!-- Schedule RemoveExistingProducts before installing any files.
718           See http://msdn.microsoft.com/en-us/library/aa371197.aspx. -->
719      <RemoveExistingProducts After="InstallInitialize" />
720    </InstallExecuteSequence>
721  </Product>
722</Wix>
723