OLD | NEW |
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 "base/win_util.h" | 5 #include "base/win_util.h" |
6 | 6 |
7 #include <sddl.h> | 7 #include <sddl.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/registry.h" | 10 #include "base/registry.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 return std::wstring(); // error | 322 return std::wstring(); // error |
323 } | 323 } |
324 | 324 |
325 bool UserAccountControlIsEnabled() { | 325 bool UserAccountControlIsEnabled() { |
326 RegKey key(HKEY_LOCAL_MACHINE, | 326 RegKey key(HKEY_LOCAL_MACHINE, |
327 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); | 327 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); |
328 DWORD uac_enabled; | 328 DWORD uac_enabled; |
329 if (!key.ReadValueDW(L"EnableLUA", &uac_enabled)) | 329 if (!key.ReadValueDW(L"EnableLUA", &uac_enabled)) |
330 return true; | 330 return true; |
331 return (uac_enabled == 1); | 331 // Users can set the EnableLUA value to something arbitrary, like 2, which |
| 332 // Vista will treat as UAC enabled, so we make sure it is not set to 0. |
| 333 return (uac_enabled != 0); |
332 } | 334 } |
333 | 335 |
334 } // namespace win_util | 336 } // namespace win_util |
335 | 337 |
336 #ifdef _MSC_VER | 338 #ifdef _MSC_VER |
337 // | 339 // |
338 // If the ASSERT below fails, please install Visual Studio 2005 Service Pack 1. | 340 // If the ASSERT below fails, please install Visual Studio 2005 Service Pack 1. |
339 // | 341 // |
340 extern char VisualStudio2005ServicePack1Detection[10]; | 342 extern char VisualStudio2005ServicePack1Detection[10]; |
341 COMPILE_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == sizeof(void*), | 343 COMPILE_ASSERT(sizeof(&VisualStudio2005ServicePack1Detection) == sizeof(void*), |
342 VS2005SP1Detect); | 344 VS2005SP1Detect); |
343 // | 345 // |
344 // Chrome requires at least Service Pack 1 for Visual Studio 2005. | 346 // Chrome requires at least Service Pack 1 for Visual Studio 2005. |
345 // | 347 // |
346 #endif // _MSC_VER | 348 #endif // _MSC_VER |
347 | 349 |
348 #ifndef COPY_FILE_COPY_SYMLINK | 350 #ifndef COPY_FILE_COPY_SYMLINK |
349 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 351 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
350 set it as your default include path to build this library. You can grab it by \ | 352 set it as your default include path to build this library. You can grab it by \ |
351 searching for "download windows sdk 2008" in your favorite web search engine. \ | 353 searching for "download windows sdk 2008" in your favorite web search engine. \ |
352 Also make sure you register the SDK with Visual Studio, by selecting \ | 354 Also make sure you register the SDK with Visual Studio, by selecting \ |
353 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 355 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
354 menu (see Start - All Programs - Microsoft Windows SDK - \ | 356 menu (see Start - All Programs - Microsoft Windows SDK - \ |
355 Visual Studio Registration). | 357 Visual Studio Registration). |
356 #endif | 358 #endif |
357 | 359 |
OLD | NEW |