Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef BASE_WIN_UTIL_H__ |
michael@0 | 6 | #define BASE_WIN_UTIL_H__ |
michael@0 | 7 | |
michael@0 | 8 | #include <windows.h> |
michael@0 | 9 | #include <aclapi.h> |
michael@0 | 10 | |
michael@0 | 11 | #include <string> |
michael@0 | 12 | |
michael@0 | 13 | #include "base/tracked.h" |
michael@0 | 14 | |
michael@0 | 15 | namespace win_util { |
michael@0 | 16 | |
michael@0 | 17 | // NOTE: Keep these in order so callers can do things like |
michael@0 | 18 | // "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values, |
michael@0 | 19 | // though. |
michael@0 | 20 | enum WinVersion { |
michael@0 | 21 | WINVERSION_PRE_2000 = 0, // Not supported |
michael@0 | 22 | WINVERSION_2000 = 1, |
michael@0 | 23 | WINVERSION_XP = 2, |
michael@0 | 24 | WINVERSION_SERVER_2003 = 3, |
michael@0 | 25 | WINVERSION_VISTA = 4, |
michael@0 | 26 | WINVERSION_2008 = 5, |
michael@0 | 27 | WINVERSION_WIN7 = 6 |
michael@0 | 28 | }; |
michael@0 | 29 | |
michael@0 | 30 | // Returns the running version of Windows. |
michael@0 | 31 | WinVersion GetWinVersion(); |
michael@0 | 32 | |
michael@0 | 33 | // Returns true if the shift key is currently pressed. |
michael@0 | 34 | bool IsShiftPressed(); |
michael@0 | 35 | |
michael@0 | 36 | // Returns true if the ctrl key is currently pressed. |
michael@0 | 37 | bool IsCtrlPressed(); |
michael@0 | 38 | |
michael@0 | 39 | // Returns true if the alt key is currently pressed. |
michael@0 | 40 | bool IsAltPressed(); |
michael@0 | 41 | |
michael@0 | 42 | // Use the Win32 API FormatMessage() function to generate a string, using |
michael@0 | 43 | // Windows's default Message Compiled resources; ignoring the inserts. |
michael@0 | 44 | std::wstring FormatMessage(unsigned messageid); |
michael@0 | 45 | |
michael@0 | 46 | // Uses the last Win32 error to generate a human readable message string. |
michael@0 | 47 | std::wstring FormatLastWin32Error(); |
michael@0 | 48 | |
michael@0 | 49 | } // namespace win_util |
michael@0 | 50 | |
michael@0 | 51 | #endif // BASE_WIN_UTIL_H__ |