1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/chromium/src/base/win_util.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#ifndef BASE_WIN_UTIL_H__ 1.9 +#define BASE_WIN_UTIL_H__ 1.10 + 1.11 +#include <windows.h> 1.12 +#include <aclapi.h> 1.13 + 1.14 +#include <string> 1.15 + 1.16 +#include "base/tracked.h" 1.17 + 1.18 +namespace win_util { 1.19 + 1.20 +// NOTE: Keep these in order so callers can do things like 1.21 +// "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values, 1.22 +// though. 1.23 +enum WinVersion { 1.24 + WINVERSION_PRE_2000 = 0, // Not supported 1.25 + WINVERSION_2000 = 1, 1.26 + WINVERSION_XP = 2, 1.27 + WINVERSION_SERVER_2003 = 3, 1.28 + WINVERSION_VISTA = 4, 1.29 + WINVERSION_2008 = 5, 1.30 + WINVERSION_WIN7 = 6 1.31 +}; 1.32 + 1.33 +// Returns the running version of Windows. 1.34 +WinVersion GetWinVersion(); 1.35 + 1.36 +// Returns true if the shift key is currently pressed. 1.37 +bool IsShiftPressed(); 1.38 + 1.39 +// Returns true if the ctrl key is currently pressed. 1.40 +bool IsCtrlPressed(); 1.41 + 1.42 +// Returns true if the alt key is currently pressed. 1.43 +bool IsAltPressed(); 1.44 + 1.45 +// Use the Win32 API FormatMessage() function to generate a string, using 1.46 +// Windows's default Message Compiled resources; ignoring the inserts. 1.47 +std::wstring FormatMessage(unsigned messageid); 1.48 + 1.49 +// Uses the last Win32 error to generate a human readable message string. 1.50 +std::wstring FormatLastWin32Error(); 1.51 + 1.52 +} // namespace win_util 1.53 + 1.54 +#endif // BASE_WIN_UTIL_H__