forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_util.cc
625 lines (548 loc) · 21.8 KB
/
install_util.cc
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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// See the corresponding header file for description of the functions in this
// file.
#include "chrome/installer/util/install_util.h"
#include <windows.h>
#include <shellapi.h>
#include <shlobj.h>
#include <algorithm>
#include <iterator>
#include <string_view>
#include "base/check.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/system/sys_info.h"
#include "base/values.h"
#include "base/win/shlwapi.h"
#include "base/win/shortcut.h"
#include "base/win/win_util.h"
#include "base/win/windows_version.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/install_static/install_details.h"
#include "chrome/install_static/install_modes.h"
#include "chrome/install_static/install_util.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/installation_state.h"
#include "chrome/installer/util/installer_util_strings.h"
#include "chrome/installer/util/l10n_string_util.h"
#include "chrome/installer/util/shell_util.h"
#include "chrome/installer/util/util_constants.h"
#include "chrome/installer/util/work_item_list.h"
using base::win::RegKey;
using installer::ProductState;
namespace {
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class StartMenuShortcutStatus {
kSuccess = 0,
kGetShortcutPathFailed = 1,
kShortcutMissing = 2,
kToastActivatorClsidIncorrect = 3,
kReadShortcutPropertyFailed = 4,
kMaxValue = kReadShortcutPropertyFailed,
};
void LogStartMenuShortcutStatus(StartMenuShortcutStatus status) {
UMA_HISTOGRAM_ENUMERATION("Notifications.Windows.StartMenuShortcutStatus",
status);
}
// Creates a zero-sized non-decorated foreground window that doesn't appear
// in the taskbar. This is used as a parent window for calls to ShellExecuteEx
// in order for the UAC dialog to appear in the foreground and for focus
// to be returned to this process once the UAC task is dismissed. Returns
// nullptr on failure, a handle to the UAC window on success.
HWND CreateUACForegroundWindow() {
HWND foreground_window = ::CreateWindowEx(
WS_EX_TOOLWINDOW, L"STATIC", nullptr, WS_POPUP | WS_VISIBLE, 0, 0, 0, 0,
nullptr, nullptr, ::GetModuleHandle(nullptr), nullptr);
if (foreground_window) {
HMONITOR monitor =
::MonitorFromWindow(foreground_window, MONITOR_DEFAULTTONEAREST);
if (monitor) {
MONITORINFO mi = {0};
mi.cbSize = sizeof(mi);
::GetMonitorInfo(monitor, &mi);
RECT screen_rect = mi.rcWork;
int x_offset = (screen_rect.right - screen_rect.left) / 2;
int y_offset = (screen_rect.bottom - screen_rect.top) / 2;
::MoveWindow(foreground_window, screen_rect.left + x_offset,
screen_rect.top + y_offset, 0, 0, FALSE);
} else {
NOTREACHED() << "Unable to get default monitor";
}
::SetForegroundWindow(foreground_window);
}
return foreground_window;
}
// Returns Registry key path of Chrome policies. This is used by the policies
// that are shared between Chrome and installer.
std::wstring GetChromePoliciesRegistryPath() {
std::wstring key_path = L"SOFTWARE\\Policies\\";
install_static::AppendChromeInstallSubDirectory(
install_static::InstallDetails::Get().mode(), /*include_suffix=*/false,
&key_path);
return key_path;
}
std::wstring GetCloudManagementPoliciesRegistryPath() {
std::wstring key_path = L"SOFTWARE\\Policies\\";
key_path.append(install_static::kCompanyPathName);
key_path.append(L"\\CloudManagement");
return key_path;
}
// Reruns the registry key path and value name where the cloud management
// enrollment option is stored.
void GetCloudManagementBlockOnFailureRegistryPath(std::wstring* key_path,
std::wstring* value_name) {
*key_path = GetChromePoliciesRegistryPath();
*value_name = L"CloudManagementEnrollmentMandatory";
}
} // namespace
void InstallUtil::TriggerActiveSetupCommand() {
std::wstring active_setup_reg(install_static::GetActiveSetupPath());
base::win::RegKey active_setup_key(HKEY_LOCAL_MACHINE,
active_setup_reg.c_str(), KEY_QUERY_VALUE);
std::wstring cmd_str;
LONG read_status = active_setup_key.ReadValue(L"StubPath", &cmd_str);
if (read_status != ERROR_SUCCESS) {
LOG(ERROR) << active_setup_reg << ", " << read_status;
// This should never fail if Chrome is registered at system-level, but if it
// does there is not much else to be done.
return;
}
base::CommandLine cmd(base::CommandLine::FromString(cmd_str));
// Force creation of shortcuts as the First Run beacon might land between now
// and the time setup.exe checks for it.
cmd.AppendSwitch(installer::switches::kForceConfigureUserSettings);
base::Process process =
base::LaunchProcess(cmd.GetCommandLineString(), base::LaunchOptions());
if (!process.IsValid())
PLOG(ERROR) << cmd.GetCommandLineString();
}
bool InstallUtil::ExecuteExeAsAdmin(const base::CommandLine& cmd,
DWORD* exit_code) {
base::FilePath::StringType program(cmd.GetProgram().value());
DCHECK(!program.empty());
DCHECK_NE(program[0], L'\"');
base::CommandLine::StringType params(cmd.GetCommandLineString());
if (params[0] == '"') {
DCHECK_EQ('"', params[program.length() + 1]);
DCHECK_EQ(program, params.substr(1, program.length()));
params = params.substr(program.length() + 2);
} else {
DCHECK_EQ(program, params.substr(0, program.length()));
params = params.substr(program.length());
}
base::TrimWhitespace(params, base::TRIM_ALL, ¶ms);
HWND uac_foreground_window = CreateUACForegroundWindow();
SHELLEXECUTEINFO info = {0};
info.cbSize = sizeof(SHELLEXECUTEINFO);
info.fMask = SEE_MASK_NOCLOSEPROCESS;
info.hwnd = uac_foreground_window;
info.lpVerb = L"runas";
info.lpFile = program.c_str();
info.lpParameters = params.c_str();
info.nShow = SW_SHOW;
bool success = false;
if (::ShellExecuteEx(&info) == TRUE) {
::WaitForSingleObject(info.hProcess, INFINITE);
DWORD ret_val = 0;
if (::GetExitCodeProcess(info.hProcess, &ret_val)) {
success = true;
if (exit_code)
*exit_code = ret_val;
}
}
if (uac_foreground_window) {
DestroyWindow(uac_foreground_window);
}
return success;
}
base::CommandLine InstallUtil::GetChromeUninstallCmd(bool system_install) {
ProductState state;
if (state.Initialize(system_install))
return state.uninstall_command();
return base::CommandLine(base::CommandLine::NO_PROGRAM);
}
base::Version InstallUtil::GetChromeVersion(bool system_install) {
base::Version version;
RegKey key;
std::wstring version_str;
if (key.Open(system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
install_static::GetClientsKeyPath().c_str(),
KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS &&
key.ReadValue(google_update::kRegVersionField, &version_str) ==
ERROR_SUCCESS &&
!version_str.empty()) {
version = base::Version(base::WideToASCII(version_str));
}
if (version.IsValid())
VLOG(1) << "Existing Chrome version found: " << version.GetString();
else
VLOG(1) << "No existing Chrome install found.";
return version;
}
base::Version InstallUtil::GetCriticalUpdateVersion() {
base::Version version;
RegKey key;
std::wstring version_str;
if (key.Open(install_static::IsSystemInstall() ? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER,
install_static::GetClientsKeyPath().c_str(),
KEY_QUERY_VALUE | KEY_WOW64_32KEY) == ERROR_SUCCESS &&
key.ReadValue(google_update::kRegCriticalVersionField, &version_str) ==
ERROR_SUCCESS &&
!version_str.empty()) {
version = base::Version(base::WideToASCII(version_str));
}
if (version.IsValid())
VLOG(1) << "Critical Update version found: " << version.GetString();
else
VLOG(1) << "No existing Chrome install found.";
return version;
}
bool InstallUtil::IsOSSupported() {
// We do not support anything prior to Windows 10.
VLOG(1) << base::SysInfo::OperatingSystemName() << ' '
<< base::SysInfo::OperatingSystemVersion();
return base::win::GetVersion() >= base::win::Version::WIN10;
}
void InstallUtil::AddInstallerResultItems(bool system_install,
const std::wstring& state_key,
installer::InstallStatus status,
int string_resource_id,
const std::wstring* const launch_cmd,
WorkItemList* install_list) {
DCHECK(install_list);
DCHECK(install_list->best_effort());
DCHECK(!install_list->rollback_enabled());
const HKEY root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
DWORD installer_result = (GetInstallReturnCode(status) == 0) ? 0 : 1;
install_list->AddCreateRegKeyWorkItem(root, state_key, KEY_WOW64_32KEY);
install_list->AddSetRegValueWorkItem(root, state_key, KEY_WOW64_32KEY,
installer::kInstallerResult,
installer_result, true);
install_list->AddSetRegValueWorkItem(root, state_key, KEY_WOW64_32KEY,
installer::kInstallerError,
static_cast<DWORD>(status), true);
if (string_resource_id != 0) {
std::wstring msg = installer::GetLocalizedString(string_resource_id);
install_list->AddSetRegValueWorkItem(root, state_key, KEY_WOW64_32KEY,
installer::kInstallerResultUIString,
msg, true);
}
if (launch_cmd != nullptr && !launch_cmd->empty()) {
install_list->AddSetRegValueWorkItem(
root, state_key, KEY_WOW64_32KEY,
installer::kInstallerSuccessLaunchCmdLine, *launch_cmd, true);
}
}
bool InstallUtil::IsPerUserInstall() {
return !install_static::InstallDetails::Get().system_level();
}
// static
bool InstallUtil::IsFirstRunSentinelPresent() {
// TODO(msw): Consolidate with first_run::internal::IsFirstRunSentinelPresent.
base::FilePath user_data_dir;
return !base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir) ||
base::PathExists(user_data_dir.Append(chrome::kFirstRunSentinel));
}
// static
bool InstallUtil::IsStartMenuShortcutWithActivatorGuidInstalled() {
base::FilePath shortcut_path;
if (!ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT,
install_static::IsSystemInstall()
? ShellUtil::SYSTEM_LEVEL
: ShellUtil::CURRENT_USER,
&shortcut_path)) {
LogStartMenuShortcutStatus(StartMenuShortcutStatus::kGetShortcutPathFailed);
return false;
}
shortcut_path = shortcut_path.Append(GetShortcutName() + installer::kLnkExt);
if (!base::PathExists(shortcut_path)) {
LogStartMenuShortcutStatus(StartMenuShortcutStatus::kShortcutMissing);
return false;
}
base::win::ShortcutProperties properties;
if (!base::win::ResolveShortcutProperties(
shortcut_path,
base::win::ShortcutProperties::PROPERTIES_TOAST_ACTIVATOR_CLSID,
&properties)) {
LogStartMenuShortcutStatus(
StartMenuShortcutStatus::kReadShortcutPropertyFailed);
return false;
}
if (!::IsEqualCLSID(properties.toast_activator_clsid,
install_static::GetToastActivatorClsid())) {
LogStartMenuShortcutStatus(
StartMenuShortcutStatus::kToastActivatorClsidIncorrect);
return false;
}
LogStartMenuShortcutStatus(StartMenuShortcutStatus::kSuccess);
return true;
}
// static
bool InstallUtil::IsRunningAsInteractiveUser() {
// Get the SID for interactive user.
DWORD sid_size = SECURITY_MAX_SID_SIZE;
uint8_t sid_bytes[SECURITY_MAX_SID_SIZE] = {};
SID* interactive_sid = reinterpret_cast<SID*>(sid_bytes);
if (!::CreateWellKnownSid(WinInteractiveSid, nullptr, interactive_sid,
&sid_size)) {
PLOG(ERROR) << "Failed to create well known SID";
return false;
}
BOOL is_member = FALSE;
if (!::CheckTokenMembership(nullptr, interactive_sid, &is_member)) {
PLOG(ERROR) << "Failed to check token membership for WinInteractiveSid";
return false;
}
return is_member;
}
// static
std::wstring InstallUtil::GetToastActivatorRegistryPath() {
return L"Software\\Classes\\CLSID\\" +
base::win::WStringFromGUID(install_static::GetToastActivatorClsid());
}
// static
bool InstallUtil::GetEulaSentinelFilePath(base::FilePath* path) {
base::FilePath user_data_dir;
if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir))
return false;
*path = user_data_dir.Append(installer::kEulaSentinelFile);
return true;
}
// static
int InstallUtil::GetInstallReturnCode(installer::InstallStatus status) {
switch (status) {
case installer::FIRST_INSTALL_SUCCESS:
case installer::INSTALL_REPAIRED:
case installer::NEW_VERSION_UPDATED:
case installer::IN_USE_UPDATED:
case installer::OLD_VERSION_DOWNGRADE:
case installer::IN_USE_DOWNGRADE:
return 0;
default:
return status;
}
}
// static
void InstallUtil::ComposeCommandLine(const std::wstring& program,
const std::wstring& arguments,
base::CommandLine* command_line) {
*command_line =
base::CommandLine::FromString(L"\"" + program + L"\" " + arguments);
}
void InstallUtil::AppendModeAndChannelSwitches(
base::CommandLine* command_line) {
const install_static::InstallDetails& install_details =
install_static::InstallDetails::Get();
if (*install_details.install_switch())
command_line->AppendSwitch(install_details.install_switch());
if (install_details.channel_origin() ==
install_static::ChannelOrigin::kPolicy) {
// Use channel_override rather than simply channel so that extended stable
// is differentiated from regular.
command_line->AppendSwitchNative(installer::switches::kChannel,
install_details.channel_override());
}
}
// static
std::wstring InstallUtil::GetCurrentDate() {
static const wchar_t kDateFormat[] = L"yyyyMMdd";
wchar_t date_str[std::size(kDateFormat)] = {};
int len = GetDateFormatW(LOCALE_INVARIANT, 0, nullptr, kDateFormat, date_str,
std::size(date_str));
if (len) {
--len; // Subtract terminating \0.
} else {
PLOG(DFATAL) << "GetDateFormat";
}
return std::wstring(date_str, len);
}
// static
std::optional<base::Version> InstallUtil::GetDowngradeVersion() {
RegKey key;
std::wstring downgrade_version;
if (key.Open(install_static::IsSystemInstall() ? HKEY_LOCAL_MACHINE
: HKEY_CURRENT_USER,
install_static::GetClientStateKeyPath().c_str(),
KEY_QUERY_VALUE | KEY_WOW64_32KEY) != ERROR_SUCCESS ||
key.ReadValue(installer::kRegDowngradeVersion, &downgrade_version) !=
ERROR_SUCCESS ||
downgrade_version.empty()) {
return std::nullopt;
}
base::Version version(base::WideToASCII(downgrade_version));
if (!version.IsValid())
return std::nullopt;
return version;
}
// static
std::vector<std::pair<std::wstring, std::wstring>>
InstallUtil::GetCloudManagementEnrollmentTokenRegistryPaths() {
std::vector<std::pair<std::wstring, std::wstring>> paths;
// Prefer the product-agnostic location used by Google Update.
paths.emplace_back(GetCloudManagementPoliciesRegistryPath(),
L"EnrollmentToken");
// Follow that with the Google Chrome policy.
paths.emplace_back(GetChromePoliciesRegistryPath(),
L"CloudManagementEnrollmentToken");
return paths;
}
// static
std::pair<std::wstring, std::wstring>
InstallUtil::GetCloudManagementDmTokenPath(BrowserLocation browser_location) {
std::wstring key_path = L"SOFTWARE\\";
if (browser_location) {
install_static::AppendChromeInstallSubDirectory(
install_static::InstallDetails::Get().mode(), /*include_suffix=*/false,
&key_path);
} else {
key_path.append(install_static::kCompanyPathName);
}
key_path.append(L"\\Enrollment");
return {key_path, L"dmtoken"};
}
// static
std::pair<base::win::RegKey, std::wstring>
InstallUtil::GetCloudManagementDmTokenLocation(
ReadOnly read_only,
BrowserLocation browser_location) {
// The location dictates the WoW bit.
REGSAM wow_access = browser_location ? KEY_WOW64_64KEY : KEY_WOW64_32KEY;
auto [key_path, value_name] = GetCloudManagementDmTokenPath(browser_location);
base::win::RegKey key;
if (read_only) {
(void)key.Open(HKEY_LOCAL_MACHINE, key_path.c_str(),
KEY_QUERY_VALUE | wow_access);
} else {
auto result = key.Create(HKEY_LOCAL_MACHINE, key_path.c_str(),
KEY_SET_VALUE | wow_access);
if (result != ERROR_SUCCESS) {
::SetLastError(result);
PLOG(ERROR) << "Failed to create/open registry key HKLM\\" << key_path
<< " for writing";
}
}
return {std::move(key), value_name};
}
// static
std::tuple<base::win::RegKey, std::wstring, std::wstring>
InstallUtil::GetDeviceTrustSigningKeyLocation(ReadOnly read_only) {
// The location dictates the path and WoW bit.
std::wstring key_path = L"SOFTWARE\\";
install_static::AppendChromeInstallSubDirectory(
install_static::InstallDetails::Get().mode(), /*include_suffix=*/false,
&key_path)
.append(L"\\DeviceTrust");
base::win::RegKey key;
if (read_only) {
(void)key.Open(HKEY_LOCAL_MACHINE, key_path.c_str(),
KEY_QUERY_VALUE | KEY_WOW64_64KEY);
} else {
auto result = key.Create(HKEY_LOCAL_MACHINE, key_path.c_str(),
KEY_SET_VALUE | KEY_WOW64_64KEY);
if (result != ERROR_SUCCESS) {
::SetLastError(result);
PLOG(ERROR) << "Failed to create/open registry key HKLM\\" << key_path
<< " for writing";
}
}
return {std::move(key), L"signing_key", L"trust_level"};
}
// static
std::wstring InstallUtil::GetCloudManagementEnrollmentToken() {
// Because chrome needs to know if machine level user cloud policies must be
// initialized even before the entire policy service is brought up, this
// helper function exists to directly read the token from the system policies.
//
// Putting the enrollment token in the system policy area is a convenient
// way for administrators to enroll chrome throughout their fleet by pushing
// this token via SCCM.
// TODO(rogerta): This may not be the best place for the helpers dealing with
// the enrollment and/or DM tokens. See crbug.com/823852 for details.
RegKey key;
std::wstring value;
for (const auto& key_and_value :
GetCloudManagementEnrollmentTokenRegistryPaths()) {
if (key.Open(HKEY_LOCAL_MACHINE, key_and_value.first.c_str(),
KEY_QUERY_VALUE) == ERROR_SUCCESS &&
key.ReadValue(key_and_value.second.c_str(), &value) == ERROR_SUCCESS) {
return value;
}
}
return std::wstring();
}
// static
bool InstallUtil::ShouldCloudManagementBlockOnFailure() {
std::wstring key_path;
std::wstring value_name;
GetCloudManagementBlockOnFailureRegistryPath(&key_path, &value_name);
DWORD value = 0;
RegKey(HKEY_LOCAL_MACHINE, key_path.c_str(), KEY_QUERY_VALUE)
.ReadValueDW(value_name.c_str(), &value);
return value != 0;
}
// static
std::wstring InstallUtil::GetDisplayName() {
return GetShortcutName();
}
// static
std::wstring InstallUtil::GetAppDescription() {
return installer::GetLocalizedString(IDS_SHORTCUT_TOOLTIP_BASE);
}
// static
std::wstring InstallUtil::GetPublisherName() {
return installer::GetLocalizedString(IDS_ABOUT_VERSION_COMPANY_NAME_BASE);
}
// static
std::wstring InstallUtil::GetShortcutName() {
// IDS_PRODUCT_NAME is automatically mapped to the mode-specific shortcut
// name; see MODE_SPECIFIC_STRINGS in prebuild/create_string_rc.py.
return installer::GetLocalizedString(IDS_PRODUCT_NAME_BASE);
}
// static
std::wstring InstallUtil::GetChromeShortcutDirNameDeprecated() {
return GetShortcutName();
}
// static
std::wstring InstallUtil::GetChromeAppsShortcutDirName() {
// IDS_APP_SHORTCUTS_SUBDIR_NAME is automatically mapped to the mode-specific
// dir name; see MODE_SPECIFIC_STRINGS in prebuild/create_string_rc.py.
return installer::GetLocalizedString(IDS_APP_SHORTCUTS_SUBDIR_NAME_BASE);
}
// static
std::wstring InstallUtil::GetLongAppDescription() {
return installer::GetLocalizedString(IDS_PRODUCT_DESCRIPTION_BASE);
}
// static
std::wstring InstallUtil::GuidToSquid(std::wstring_view guid) {
std::wstring squid;
squid.reserve(32);
auto input = guid.begin();
auto output = std::back_inserter(squid);
// Reverse-copy relevant characters, skipping separators.
std::reverse_copy(input + 0, input + 8, output);
std::reverse_copy(input + 9, input + 13, output);
std::reverse_copy(input + 14, input + 18, output);
std::reverse_copy(input + 19, input + 21, output);
std::reverse_copy(input + 21, input + 23, output);
std::reverse_copy(input + 24, input + 26, output);
std::reverse_copy(input + 26, input + 28, output);
std::reverse_copy(input + 28, input + 30, output);
std::reverse_copy(input + 30, input + 32, output);
std::reverse_copy(input + 32, input + 34, output);
std::reverse_copy(input + 34, input + 36, output);
return squid;
}