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 #ifndef BASE_WIN_UTIL_H__ | 5 #ifndef BASE_WIN_UTIL_H__ |
6 #define BASE_WIN_UTIL_H__ | 6 #define BASE_WIN_UTIL_H__ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <aclapi.h> | 9 #include <aclapi.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/tracked.h" | |
14 | |
15 namespace win_util { | 13 namespace win_util { |
16 | 14 |
17 // NOTE: Keep these in order so callers can do things like | 15 // NOTE: Keep these in order so callers can do things like |
18 // "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values, | 16 // "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values, |
19 // though. | 17 // though. |
20 enum WinVersion { | 18 enum WinVersion { |
21 WINVERSION_PRE_2000 = 0, // Not supported | 19 WINVERSION_PRE_2000 = 0, // Not supported |
22 WINVERSION_2000 = 1, | 20 WINVERSION_2000 = 1, |
23 WINVERSION_XP = 2, | 21 WINVERSION_XP = 2, |
24 WINVERSION_SERVER_2003 = 3, | 22 WINVERSION_SERVER_2003 = 3, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // if the OS is Vista. | 95 // if the OS is Vista. |
98 bool UserAccountControlIsEnabled(); | 96 bool UserAccountControlIsEnabled(); |
99 | 97 |
100 // Use the Win32 API FormatMessage() function to generate a string, using | 98 // Use the Win32 API FormatMessage() function to generate a string, using |
101 // Windows's default Message Compiled resources; ignoring the inserts. | 99 // Windows's default Message Compiled resources; ignoring the inserts. |
102 std::wstring FormatMessage(unsigned messageid); | 100 std::wstring FormatMessage(unsigned messageid); |
103 | 101 |
104 // Uses the last Win32 error to generate a human readable message string. | 102 // Uses the last Win32 error to generate a human readable message string. |
105 std::wstring FormatLastWin32Error(); | 103 std::wstring FormatLastWin32Error(); |
106 | 104 |
107 // These 2 methods are used to track HWND creation/destruction to investigate | |
108 // a mysterious crasher http://crbugs.com/4714 (crasher in on NCDestroy) that | |
109 // might be caused by a multiple delete of an HWND. | |
110 void NotifyHWNDCreation(const tracked_objects::Location& from_here, HWND hwnd); | |
111 void NotifyHWNDDestruction(const tracked_objects::Location& from_here, | |
112 HWND hwnd); | |
113 | |
114 #ifdef NDEBUG | |
115 #define TRACK_HWND_CREATION(hwnd) | |
116 #define TRACK_HWND_DESTRUCTION(hwnd) | |
117 #else | |
118 #define TRACK_HWND_CREATION(hwnd) win_util::NotifyHWNDCreation(FROM_HERE, hwnd) | |
119 #define TRACK_HWND_DESTRUCTION(hwnd) \ | |
120 win_util::NotifyHWNDDestruction(FROM_HERE, hwnd) | |
121 #endif | |
122 | |
123 } // namespace win_util | 105 } // namespace win_util |
124 | 106 |
125 #endif // BASE_WIN_UTIL_H__ | 107 #endif // BASE_WIN_UTIL_H__ |
126 | 108 |
OLD | NEW |