OLD | NEW |
1 // Copyright (c) 2006-2008 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 <propvarutil.h> | 7 #include <propvarutil.h> |
8 #include <sddl.h> | 8 #include <sddl.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/registry.h" | 11 #include "base/registry.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 output.resize(size_ret); | 343 output.resize(size_ret); |
344 return output; | 344 return output; |
345 } | 345 } |
346 buffer_size *= 2; | 346 buffer_size *= 2; |
347 } | 347 } |
348 return std::wstring(); // error | 348 return std::wstring(); // error |
349 } | 349 } |
350 | 350 |
351 bool UserAccountControlIsEnabled() { | 351 bool UserAccountControlIsEnabled() { |
352 RegKey key(HKEY_LOCAL_MACHINE, | 352 RegKey key(HKEY_LOCAL_MACHINE, |
353 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"); | 353 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System", |
| 354 KEY_READ); |
354 DWORD uac_enabled; | 355 DWORD uac_enabled; |
355 if (!key.ReadValueDW(L"EnableLUA", &uac_enabled)) | 356 if (!key.ReadValueDW(L"EnableLUA", &uac_enabled)) |
356 return true; | 357 return true; |
357 // Users can set the EnableLUA value to something arbitrary, like 2, which | 358 // Users can set the EnableLUA value to something arbitrary, like 2, which |
358 // Vista will treat as UAC enabled, so we make sure it is not set to 0. | 359 // Vista will treat as UAC enabled, so we make sure it is not set to 0. |
359 return (uac_enabled != 0); | 360 return (uac_enabled != 0); |
360 } | 361 } |
361 | 362 |
362 std::wstring FormatMessage(unsigned messageid) { | 363 std::wstring FormatMessage(unsigned messageid) { |
363 wchar_t* string_buffer = NULL; | 364 wchar_t* string_buffer = NULL; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 428 |
428 #ifndef COPY_FILE_COPY_SYMLINK | 429 #ifndef COPY_FILE_COPY_SYMLINK |
429 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 430 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
430 set it as your default include path to build this library. You can grab it by \ | 431 set it as your default include path to build this library. You can grab it by \ |
431 searching for "download windows sdk 2008" in your favorite web search engine. \ | 432 searching for "download windows sdk 2008" in your favorite web search engine. \ |
432 Also make sure you register the SDK with Visual Studio, by selecting \ | 433 Also make sure you register the SDK with Visual Studio, by selecting \ |
433 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 434 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
434 menu (see Start - All Programs - Microsoft Windows SDK - \ | 435 menu (see Start - All Programs - Microsoft Windows SDK - \ |
435 Visual Studio Registration). | 436 Visual Studio Registration). |
436 #endif | 437 #endif |
OLD | NEW |