OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // ============================================================================= | 5 // ============================================================================= |
6 // PLEASE READ | 6 // PLEASE READ |
7 // | 7 // |
8 // In general, you should not be adding stuff to this file. | 8 // In general, you should not be adding stuff to this file. |
9 // | 9 // |
10 // - If your thing is only used in one place, just put it in a reasonable | 10 // - If your thing is only used in one place, just put it in a reasonable |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 int iMenuWidth; | 49 int iMenuWidth; |
50 int iMenuHeight; | 50 int iMenuHeight; |
51 LOGFONTW lfMenuFont; | 51 LOGFONTW lfMenuFont; |
52 LOGFONTW lfStatusFont; | 52 LOGFONTW lfStatusFont; |
53 LOGFONTW lfMessageFont; | 53 LOGFONTW lfMessageFont; |
54 }; | 54 }; |
55 | 55 |
56 namespace base { | 56 namespace base { |
57 namespace win { | 57 namespace win { |
58 | 58 |
| 59 inline uint32_t HandleToUint32(HANDLE h) { |
| 60 // Cast through uintptr_t and then unsigned int to make the truncation to |
| 61 // 32 bits explicit. Handles are size of-pointer but are always 32-bit values. |
| 62 // https://msdn.microsoft.com/en-us/library/aa384203(VS.85).aspx says: |
| 63 // 64-bit versions of Windows use 32-bit handles for interoperability. |
| 64 return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(h)); |
| 65 } |
| 66 |
59 BASE_EXPORT void GetNonClientMetrics(NONCLIENTMETRICS_XP* metrics); | 67 BASE_EXPORT void GetNonClientMetrics(NONCLIENTMETRICS_XP* metrics); |
60 | 68 |
61 // Returns the string representing the current user sid. | 69 // Returns the string representing the current user sid. |
62 BASE_EXPORT bool GetUserSidString(std::wstring* user_sid); | 70 BASE_EXPORT bool GetUserSidString(std::wstring* user_sid); |
63 | 71 |
64 // Returns false if user account control (UAC) has been disabled with the | 72 // Returns false if user account control (UAC) has been disabled with the |
65 // EnableLUA registry flag. Returns true if user account control is enabled. | 73 // EnableLUA registry flag. Returns true if user account control is enabled. |
66 // NOTE: The EnableLUA registry flag, which is ignored on Windows XP | 74 // NOTE: The EnableLUA registry flag, which is ignored on Windows XP |
67 // machines, might still exist and be set to 0 (UAC disabled), in which case | 75 // machines, might still exist and be set to 0 (UAC disabled), in which case |
68 // this function will return false. You should therefore check this flag only | 76 // this function will return false. You should therefore check this flag only |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // CreateWindow and CreateDC. Windows 8 and above allow the kernel component | 164 // CreateWindow and CreateDC. Windows 8 and above allow the kernel component |
157 // of these calls to be disabled which can cause undefined behaviour such as | 165 // of these calls to be disabled which can cause undefined behaviour such as |
158 // crashes. This function can be used to guard areas of code using these calls | 166 // crashes. This function can be used to guard areas of code using these calls |
159 // and provide a fallback path if necessary. | 167 // and provide a fallback path if necessary. |
160 BASE_EXPORT bool IsUser32AndGdi32Available(); | 168 BASE_EXPORT bool IsUser32AndGdi32Available(); |
161 | 169 |
162 } // namespace win | 170 } // namespace win |
163 } // namespace base | 171 } // namespace base |
164 | 172 |
165 #endif // BASE_WIN_WIN_UTIL_H_ | 173 #endif // BASE_WIN_WIN_UTIL_H_ |
OLD | NEW |