Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1138)

Side by Side Diff: chrome/installer/gcapi/gcapi.cc

Issue 40226: Fix files with lines > 80 cols. Part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/win_util.cc ('k') | chrome/installer/mini_installer/mini_installer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/installer/gcapi/gcapi.h" 5 #include "chrome/installer/gcapi/gcapi.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlcom.h> 8 #include <atlcom.h>
9 #include <windows.h> 9 #include <windows.h>
10 #include <sddl.h> 10 #include <sddl.h>
11 #include <stdlib.h> 11 #include <stdlib.h>
12 #include <strsafe.h> 12 #include <strsafe.h>
13 #include <tlhelp32.h> 13 #include <tlhelp32.h>
14 14
15 #include "google_update_idl.h" 15 #include "google_update_idl.h"
16 16
17 namespace { 17 namespace {
18 18
19 const wchar_t kChromeRegClientsKey[] = L"Software\\Google\\Update\\Clients\\{8A6 9D345-D564-463c-AFF1-A69D9E530F96}"; 19 const wchar_t kChromeRegClientsKey[] =
20 const wchar_t kChromeRegClientStateKey[] = L"Software\\Google\\Update\\ClientSta te\\{8A69D345-D564-463c-AFF1-A69D9E530F96}"; 20 L"Software\\Google\\Update\\Clients\\"
21 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
22 const wchar_t kChromeRegClientStateKey[] =
23 L"Software\\Google\\Update\\ClientState\\"
24 L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
21 const wchar_t kChromeRegLaunchCmd[] = L"InstallerSuccessLaunchCmdLine"; 25 const wchar_t kChromeRegLaunchCmd[] = L"InstallerSuccessLaunchCmdLine";
22 const wchar_t kChromeRegLastLaunchCmd[] = L"LastInstallerSuccessLaunchCmdLine"; 26 const wchar_t kChromeRegLastLaunchCmd[] = L"LastInstallerSuccessLaunchCmdLine";
23 const wchar_t kChromeRegVersion[] = L"pv"; 27 const wchar_t kChromeRegVersion[] = L"pv";
24 const wchar_t kNoChromeOfferUntil[] = L"SOFTWARE\\Google\\No Chrome Offer Until" ; 28 const wchar_t kNoChromeOfferUntil[] =
29 L"SOFTWARE\\Google\\No Chrome Offer Until";
25 30
26 // Return the company name specified in the file version info resource. 31 // Return the company name specified in the file version info resource.
27 bool GetCompanyName(const wchar_t* filename, wchar_t* buffer, DWORD out_len) { 32 bool GetCompanyName(const wchar_t* filename, wchar_t* buffer, DWORD out_len) {
28 wchar_t file_version_info[8192]; 33 wchar_t file_version_info[8192];
29 DWORD handle = 0; 34 DWORD handle = 0;
30 DWORD buffer_size = 0; 35 DWORD buffer_size = 0;
31 36
32 buffer_size = ::GetFileVersionInfoSize(filename, &handle); 37 buffer_size = ::GetFileVersionInfoSize(filename, &handle);
33 // Cannot stats the file or our buffer size is too small (very unlikely). 38 // Cannot stats the file or our buffer size is too small (very unlikely).
34 if (buffer_size == 0 || buffer_size > _countof(file_version_info)) 39 if (buffer_size == 0 || buffer_size > _countof(file_version_info))
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 bool can_re_offer = true; 93 bool can_re_offer = true;
89 DWORD disposition = 0; 94 DWORD disposition = 0;
90 HKEY key = NULL; 95 HKEY key = NULL;
91 if (::RegCreateKeyEx(HKEY_LOCAL_MACHINE, kNoChromeOfferUntil, 96 if (::RegCreateKeyEx(HKEY_LOCAL_MACHINE, kNoChromeOfferUntil,
92 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, 97 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE,
93 NULL, &key, &disposition) == ERROR_SUCCESS) { 98 NULL, &key, &disposition) == ERROR_SUCCESS) {
94 // Get today's date, and format it as YYYYMMDD numeric value. 99 // Get today's date, and format it as YYYYMMDD numeric value.
95 SYSTEMTIME now; 100 SYSTEMTIME now;
96 GetLocalTime(&now); 101 GetLocalTime(&now);
97 DWORD today = now.wYear * 10000 + now.wMonth * 100 + now.wDay; 102 DWORD today = now.wYear * 10000 + now.wMonth * 100 + now.wDay;
98 103
99 // Cannot re-offer, if the timer already exists and is not expired yet. 104 // Cannot re-offer, if the timer already exists and is not expired yet.
100 DWORD value_type = REG_DWORD; 105 DWORD value_type = REG_DWORD;
101 DWORD value_data = 0; 106 DWORD value_data = 0;
102 DWORD value_length = sizeof(DWORD); 107 DWORD value_length = sizeof(DWORD);
103 if (::RegQueryValueEx(key, company, 0, &value_type, 108 if (::RegQueryValueEx(key, company, 0, &value_type,
104 reinterpret_cast<LPBYTE>(&value_data), 109 reinterpret_cast<LPBYTE>(&value_data),
105 &value_length) == ERROR_SUCCESS && 110 &value_length) == ERROR_SUCCESS &&
106 REG_DWORD == value_type && 111 REG_DWORD == value_type &&
107 value_data > today) { 112 value_data > today) {
108 // The time has not expired, we cannot offer Chrome. 113 // The time has not expired, we cannot offer Chrome.
109 can_re_offer = false; 114 can_re_offer = false;
110 } else { 115 } else {
111 // Delete the old or invalid value. 116 // Delete the old or invalid value.
112 ::RegDeleteValue(key, company); 117 ::RegDeleteValue(key, company);
113 if (set_flag) { 118 if (set_flag) {
114 // Set expiration date for offer as six months from today, 119 // Set expiration date for offer as six months from today,
115 // represented as a YYYYMMDD numeric value. 120 // represented as a YYYYMMDD numeric value.
116 SYSTEMTIME timer = now; 121 SYSTEMTIME timer = now;
117 timer.wMonth = timer.wMonth + 6; 122 timer.wMonth = timer.wMonth + 6;
118 if (timer.wMonth > 12) { 123 if (timer.wMonth > 12) {
119 timer.wMonth = timer.wMonth - 12; 124 timer.wMonth = timer.wMonth - 12;
120 timer.wYear = timer.wYear + 1; 125 timer.wYear = timer.wYear + 1;
121 } 126 }
122 DWORD value = timer.wYear * 10000 + timer.wMonth * 100 + timer.wDay; 127 DWORD value = timer.wYear * 10000 + timer.wMonth * 100 + timer.wDay;
123 ::RegSetValueEx(key, company, 0, REG_DWORD, (LPBYTE)&value, 128 ::RegSetValueEx(key, company, 0, REG_DWORD, (LPBYTE)&value,
124 sizeof(DWORD)); 129 sizeof(DWORD));
125 } 130 }
126 } 131 }
127 132
128 ::RegCloseKey(key); 133 ::RegCloseKey(key);
129 } 134 }
130 135
131 return can_re_offer; 136 return can_re_offer;
132 } 137 }
133 138
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 delete[] token_user; 276 delete[] token_user;
272 } 277 }
273 ::CloseHandle(process_token); 278 ::CloseHandle(process_token);
274 } 279 }
275 ::CloseHandle(process_handle); 280 ::CloseHandle(process_handle);
276 return result; 281 return result;
277 } 282 }
278 } // namespace 283 } // namespace
279 284
280 #pragma comment(linker, "/EXPORT:GoogleChromeCompatibilityCheck=_GoogleChromeCom patibilityCheck@8,PRIVATE") 285 #pragma comment(linker, "/EXPORT:GoogleChromeCompatibilityCheck=_GoogleChromeCom patibilityCheck@8,PRIVATE")
281 DLLEXPORT BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag, DWORD *re asons) { 286 DLLEXPORT BOOL __stdcall GoogleChromeCompatibilityCheck(BOOL set_flag,
287 DWORD *reasons) {
282 DWORD local_reasons = 0; 288 DWORD local_reasons = 0;
283 289
284 bool is_vista_or_later = false; 290 bool is_vista_or_later = false;
285 // System requirements? 291 // System requirements?
286 if (!IsWinXPSp1OrLater(&is_vista_or_later)) 292 if (!IsWinXPSp1OrLater(&is_vista_or_later))
287 local_reasons |= GCCC_ERROR_OSNOTSUPPORTED; 293 local_reasons |= GCCC_ERROR_OSNOTSUPPORTED;
288 294
289 if (IsChromeInstalled(HKEY_LOCAL_MACHINE)) 295 if (IsChromeInstalled(HKEY_LOCAL_MACHINE))
290 local_reasons |= GCCC_ERROR_SYSTEMLEVELALREADYPRESENT; 296 local_reasons |= GCCC_ERROR_SYSTEMLEVELALREADYPRESENT;
291 297
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (!FAILED(ipl->LaunchCmdLine(launch_cmd))) 401 if (!FAILED(ipl->LaunchCmdLine(launch_cmd)))
396 ret = true; 402 ret = true;
397 ipl.Release(); 403 ipl.Release();
398 } 404 }
399 405
400 if (impersonation_success) 406 if (impersonation_success)
401 ::RevertToSelf(); 407 ::RevertToSelf();
402 ::CoUninitialize(); 408 ::CoUninitialize();
403 return ret; 409 return ret;
404 } 410 }
OLDNEW
« no previous file with comments | « chrome/common/win_util.cc ('k') | chrome/installer/mini_installer/mini_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698