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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 bool UserAccountControlIsEnabled() { | 83 bool UserAccountControlIsEnabled() { |
84 // This can be slow if Windows ends up going to disk. Should watch this key | 84 // This can be slow if Windows ends up going to disk. Should watch this key |
85 // for changes and only read it once, preferably on the file thread. | 85 // for changes and only read it once, preferably on the file thread. |
86 // http://code.google.com/p/chromium/issues/detail?id=61644 | 86 // http://code.google.com/p/chromium/issues/detail?id=61644 |
87 base::ThreadRestrictions::ScopedAllowIO allow_io; | 87 base::ThreadRestrictions::ScopedAllowIO allow_io; |
88 | 88 |
89 base::win::RegKey key(HKEY_LOCAL_MACHINE, | 89 base::win::RegKey key(HKEY_LOCAL_MACHINE, |
90 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", | 90 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", |
91 KEY_READ); | 91 KEY_READ); |
92 DWORD uac_enabled; | 92 DWORD uac_enabled; |
93 if (key.ReadValueDW(L"EnableLUA", &uac_enabled) != ERROR_SUCCESS) | 93 if (key.ReadValue(L"EnableLUA", &uac_enabled) != ERROR_SUCCESS) |
94 return true; | 94 return true; |
95 // Users can set the EnableLUA value to something arbitrary, like 2, which | 95 // Users can set the EnableLUA value to something arbitrary, like 2, which |
96 // Vista will treat as UAC enabled, so we make sure it is not set to 0. | 96 // Vista will treat as UAC enabled, so we make sure it is not set to 0. |
97 return (uac_enabled != 0); | 97 return (uac_enabled != 0); |
98 } | 98 } |
99 | 99 |
100 bool SetAppIdForPropertyStore(IPropertyStore* property_store, | 100 bool SetAppIdForPropertyStore(IPropertyStore* property_store, |
101 const wchar_t* app_id) { | 101 const wchar_t* app_id) { |
102 DCHECK(property_store); | 102 DCHECK(property_store); |
103 | 103 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 #ifndef COPY_FILE_COPY_SYMLINK | 159 #ifndef COPY_FILE_COPY_SYMLINK |
160 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 160 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
161 set it as your default include path to build this library. You can grab it by \ | 161 set it as your default include path to build this library. You can grab it by \ |
162 searching for "download windows sdk 2008" in your favorite web search engine. \ | 162 searching for "download windows sdk 2008" in your favorite web search engine. \ |
163 Also make sure you register the SDK with Visual Studio, by selecting \ | 163 Also make sure you register the SDK with Visual Studio, by selecting \ |
164 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 164 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
165 menu (see Start - All Programs - Microsoft Windows SDK - \ | 165 menu (see Start - All Programs - Microsoft Windows SDK - \ |
166 Visual Studio Registration). | 166 Visual Studio Registration). |
167 #endif | 167 #endif |
OLD | NEW |