OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_util.h" | 5 #include "base/win_util.h" |
6 | 6 |
7 #include <aclapi.h> | 7 #include <aclapi.h> |
8 #include <propvarutil.h> | 8 #include <propvarutil.h> |
9 #include <sddl.h> | 9 #include <sddl.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 HRESULT result = property_store->SetValue(kPKEYAppUserModelID, | 409 HRESULT result = property_store->SetValue(kPKEYAppUserModelID, |
410 property_value); | 410 property_value); |
411 if (S_OK == result) | 411 if (S_OK == result) |
412 result = property_store->Commit(); | 412 result = property_store->Commit(); |
413 | 413 |
414 PropVariantClear(&property_value); | 414 PropVariantClear(&property_value); |
415 return SUCCEEDED(result); | 415 return SUCCEEDED(result); |
416 } | 416 } |
417 | 417 |
| 418 static const char16 kAutoRunKeyPath[] = |
| 419 L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"; |
| 420 |
| 421 bool AddCommandToAutoRun(HKEY root_key, const string16& name, |
| 422 const string16& command) { |
| 423 RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); |
| 424 return autorun_key.WriteValue(name.c_str(), command.c_str()); |
| 425 } |
| 426 |
| 427 bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name) { |
| 428 RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); |
| 429 return autorun_key.DeleteValue(name.c_str()); |
| 430 } |
| 431 |
418 } // namespace win_util | 432 } // namespace win_util |
419 | 433 |
420 #ifdef _MSC_VER | 434 #ifdef _MSC_VER |
421 // | 435 // |
422 // If the ASSERT below fails, please install Visual Studio 2005 Service Pack 1. | 436 // If the ASSERT below fails, please install Visual Studio 2005 Service Pack 1. |
423 // | 437 // |
424 extern char VisualStudio2005ServicePack1Detection[10]; | 438 extern char VisualStudio2005ServicePack1Detection[10]; |
425 COMPILE_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == sizeof(void*), | 439 COMPILE_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == sizeof(void*), |
426 VS2005SP1Detect); | 440 VS2005SP1Detect); |
427 // | 441 // |
428 // Chrome requires at least Service Pack 1 for Visual Studio 2005. | 442 // Chrome requires at least Service Pack 1 for Visual Studio 2005. |
429 // | 443 // |
430 #endif // _MSC_VER | 444 #endif // _MSC_VER |
431 | 445 |
432 #ifndef COPY_FILE_COPY_SYMLINK | 446 #ifndef COPY_FILE_COPY_SYMLINK |
433 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 447 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
434 set it as your default include path to build this library. You can grab it by \ | 448 set it as your default include path to build this library. You can grab it by \ |
435 searching for "download windows sdk 2008" in your favorite web search engine. \ | 449 searching for "download windows sdk 2008" in your favorite web search engine. \ |
436 Also make sure you register the SDK with Visual Studio, by selecting \ | 450 Also make sure you register the SDK with Visual Studio, by selecting \ |
437 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 451 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
438 menu (see Start - All Programs - Microsoft Windows SDK - \ | 452 menu (see Start - All Programs - Microsoft Windows SDK - \ |
439 Visual Studio Registration). | 453 Visual Studio Registration). |
440 #endif | 454 #endif |
OLD | NEW |