Chromium Code Reviews| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 if (!::ConvertSidToStringSid(user->User.Sid, &sid_string)) | 64 if (!::ConvertSidToStringSid(user->User.Sid, &sid_string)) |
| 65 return false; | 65 return false; |
| 66 | 66 |
| 67 *user_sid = sid_string; | 67 *user_sid = sid_string; |
| 68 | 68 |
| 69 ::LocalFree(sid_string); | 69 ::LocalFree(sid_string); |
| 70 | 70 |
| 71 return true; | 71 return true; |
| 72 } | 72 } |
| 73 | 73 |
| 74 std::string GetComputerName() { | |
| 75 char computer_name[MAX_COMPUTERNAME_LENGTH + 1]; | |
| 76 DWORD size = sizeof(computer_name); | |
| 77 if (GetComputerNameA(computer_name, &size)) { | |
| 78 return computer_name; | |
| 79 } | |
| 80 return ""; | |
|
darin (slow to review)
2011/08/31 05:52:01
return std::string();
Yaron
2011/08/31 23:23:22
Done.
| |
| 81 } | |
| 82 | |
| 74 bool IsShiftPressed() { | 83 bool IsShiftPressed() { |
| 75 return (::GetKeyState(VK_SHIFT) & 0x8000) == 0x8000; | 84 return (::GetKeyState(VK_SHIFT) & 0x8000) == 0x8000; |
| 76 } | 85 } |
| 77 | 86 |
| 78 bool IsCtrlPressed() { | 87 bool IsCtrlPressed() { |
| 79 return (::GetKeyState(VK_CONTROL) & 0x8000) == 0x8000; | 88 return (::GetKeyState(VK_CONTROL) & 0x8000) == 0x8000; |
| 80 } | 89 } |
| 81 | 90 |
| 82 bool IsAltPressed() { | 91 bool IsAltPressed() { |
| 83 return (::GetKeyState(VK_MENU) & 0x8000) == 0x8000; | 92 return (::GetKeyState(VK_MENU) & 0x8000) == 0x8000; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 | 170 |
| 162 #ifndef COPY_FILE_COPY_SYMLINK | 171 #ifndef COPY_FILE_COPY_SYMLINK |
| 163 #error You must install the Windows 2008 or Vista Software Development Kit and \ | 172 #error You must install the Windows 2008 or Vista Software Development Kit and \ |
| 164 set it as your default include path to build this library. You can grab it by \ | 173 set it as your default include path to build this library. You can grab it by \ |
| 165 searching for "download windows sdk 2008" in your favorite web search engine. \ | 174 searching for "download windows sdk 2008" in your favorite web search engine. \ |
| 166 Also make sure you register the SDK with Visual Studio, by selecting \ | 175 Also make sure you register the SDK with Visual Studio, by selecting \ |
| 167 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ | 176 "Integrate Windows SDK with Visual Studio 2005" from the Windows SDK \ |
| 168 menu (see Start - All Programs - Microsoft Windows SDK - \ | 177 menu (see Start - All Programs - Microsoft Windows SDK - \ |
| 169 Visual Studio Registration). | 178 Visual Studio Registration). |
| 170 #endif | 179 #endif |
| OLD | NEW |