| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/win/win_util.h" | 5 #include "base/win/win_util.h" |
| 6 | 6 |
| 7 #include <aclapi.h> | 7 #include <aclapi.h> |
| 8 #include <shobjidl.h> // Must be before propkey. | 8 #include <shobjidl.h> // Must be before propkey. |
| 9 #include <initguid.h> | 9 #include <initguid.h> |
| 10 #include <propkey.h> | 10 #include <propkey.h> |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // App id should be less than 64 chars and contain no space. And recommended | 168 // App id should be less than 64 chars and contain no space. And recommended |
| 169 // format is CompanyName.ProductName[.SubProduct.ProductNumber]. | 169 // format is CompanyName.ProductName[.SubProduct.ProductNumber]. |
| 170 // See http://msdn.microsoft.com/en-us/library/dd378459%28VS.85%29.aspx | 170 // See http://msdn.microsoft.com/en-us/library/dd378459%28VS.85%29.aspx |
| 171 DCHECK(lstrlen(app_id) < 64 && wcschr(app_id, L' ') == NULL); | 171 DCHECK(lstrlen(app_id) < 64 && wcschr(app_id, L' ') == NULL); |
| 172 | 172 |
| 173 return SetStringValueForPropertyStore(property_store, | 173 return SetStringValueForPropertyStore(property_store, |
| 174 PKEY_AppUserModel_ID, | 174 PKEY_AppUserModel_ID, |
| 175 app_id); | 175 app_id); |
| 176 } | 176 } |
| 177 | 177 |
| 178 bool SetDualModeForPropertyStore(IPropertyStore* property_store) { | 178 bool SetDualModeForPropertyStore(IPropertyStore* property_store, |
| 179 bool is_dual_mode) { |
| 179 return SetBooleanValueForPropertyStore(property_store, | 180 return SetBooleanValueForPropertyStore(property_store, |
| 180 PKEY_AppUserModel_DualMode, | 181 PKEY_AppUserModel_DualMode, |
| 181 true) && | 182 is_dual_mode) && |
| 183 // TODO (gab): This property no longer exists in the final Win8 release |
| 184 // and should be deleted from all shortcuts as it could interfere with |
| 185 // a future (Win9+) property. |
| 182 SetUInt32ValueForPropertyStore(property_store, | 186 SetUInt32ValueForPropertyStore(property_store, |
| 183 PKEY_AppUserModel_DualMode_UK, | 187 PKEY_AppUserModel_DualMode_UK, |
| 184 1U); | 188 is_dual_mode ? 1U : 0U); |
| 185 } | 189 } |
| 186 | 190 |
| 187 static const char16 kAutoRunKeyPath[] = | 191 static const char16 kAutoRunKeyPath[] = |
| 188 L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; | 192 L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; |
| 189 | 193 |
| 190 bool AddCommandToAutoRun(HKEY root_key, const string16& name, | 194 bool AddCommandToAutoRun(HKEY root_key, const string16& name, |
| 191 const string16& command) { | 195 const string16& command) { |
| 192 base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); | 196 base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); |
| 193 return (autorun_key.WriteValue(name.c_str(), command.c_str()) == | 197 return (autorun_key.WriteValue(name.c_str(), command.c_str()) == |
| 194 ERROR_SUCCESS); | 198 ERROR_SUCCESS); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 235 |
| 232 #ifndef COPY_FILE_COPY_SYMLINK | 236 #ifndef COPY_FILE_COPY_SYMLINK |
| 233 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 237 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
| 234 set it as your default include path to build this library. You can grab it by \ | 238 set it as your default include path to build this library. You can grab it by \ |
| 235 searching for "download windows sdk 2008" in your favorite web search engine. \ | 239 searching for "download windows sdk 2008" in your favorite web search engine. \ |
| 236 Also make sure you register the SDK with Visual Studio, by selecting \ | 240 Also make sure you register the SDK with Visual Studio, by selecting \ |
| 237 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 241 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
| 238 menu (see Start - All Programs - Microsoft Windows SDK - \ | 242 menu (see Start - All Programs - Microsoft Windows SDK - \ |
| 239 Visual Studio Registration). | 243 Visual Studio Registration). |
| 240 #endif | 244 #endif |
| OLD | NEW |