OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <propkey.h> | 9 #include <propkey.h> |
10 #include <propvarutil.h> | 10 #include <propvarutil.h> |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); | 130 base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); |
131 return (autorun_key.WriteValue(name.c_str(), command.c_str()) == | 131 return (autorun_key.WriteValue(name.c_str(), command.c_str()) == |
132 ERROR_SUCCESS); | 132 ERROR_SUCCESS); |
133 } | 133 } |
134 | 134 |
135 bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name) { | 135 bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name) { |
136 base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); | 136 base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_SET_VALUE); |
137 return (autorun_key.DeleteValue(name.c_str()) == ERROR_SUCCESS); | 137 return (autorun_key.DeleteValue(name.c_str()) == ERROR_SUCCESS); |
138 } | 138 } |
139 | 139 |
| 140 bool ReadCommandFromAutoRun(HKEY root_key, |
| 141 const string16& name, |
| 142 string16* command) { |
| 143 base::win::RegKey autorun_key(root_key, kAutoRunKeyPath, KEY_QUERY_VALUE); |
| 144 return (autorun_key.ReadValue(name.c_str(), command) == ERROR_SUCCESS); |
| 145 } |
| 146 |
140 } // namespace win | 147 } // namespace win |
141 } // namespace base | 148 } // namespace base |
142 | 149 |
143 #ifdef _MSC_VER | 150 #ifdef _MSC_VER |
144 // | 151 // |
145 // If the ASSERT below fails, please install Visual Studio 2005 Service Pack 1. | 152 // If the ASSERT below fails, please install Visual Studio 2005 Service Pack 1. |
146 // | 153 // |
147 extern char VisualStudio2005ServicePack1Detection[10]; | 154 extern char VisualStudio2005ServicePack1Detection[10]; |
148 COMPILE_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == sizeof(void*), | 155 COMPILE_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == sizeof(void*), |
149 VS2005SP1Detect); | 156 VS2005SP1Detect); |
150 // | 157 // |
151 // Chrome requires at least Service Pack 1 for Visual Studio 2005. | 158 // Chrome requires at least Service Pack 1 for Visual Studio 2005. |
152 // | 159 // |
153 #endif // _MSC_VER | 160 #endif // _MSC_VER |
154 | 161 |
155 #ifndef COPY_FILE_COPY_SYMLINK | 162 #ifndef COPY_FILE_COPY_SYMLINK |
156 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 163 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
157 set it as your default include path to build this library. You can grab it by \ | 164 set it as your default include path to build this library. You can grab it by \ |
158 searching for "download windows sdk 2008" in your favorite web search engine. \ | 165 searching for "download windows sdk 2008" in your favorite web search engine. \ |
159 Also make sure you register the SDK with Visual Studio, by selecting \ | 166 Also make sure you register the SDK with Visual Studio, by selecting \ |
160 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 167 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
161 menu (see Start - All Programs - Microsoft Windows SDK - \ | 168 menu (see Start - All Programs - Microsoft Windows SDK - \ |
162 Visual Studio Registration). | 169 Visual Studio Registration). |
163 #endif | 170 #endif |
OLD | NEW |