Index: base/win/win_util.h |
diff --git a/base/win/win_util.h b/base/win/win_util.h |
index 384db80567bf6d319df487fabae6948ce5aeb93f..c1249d9126d53ef90dff45574c478cfbfe03a25f 100644 |
--- a/base/win/win_util.h |
+++ b/base/win/win_util.h |
@@ -56,6 +56,14 @@ struct NONCLIENTMETRICS_XP { |
namespace base { |
namespace win { |
+inline uint32_t HandleToUint32(HANDLE h) { |
+ // Cast through uintptr_t and then unsigned int to make the truncation to |
+ // 32 bits explicit. Handles are size of-pointer but are always 32-bit values. |
+ // https://msdn.microsoft.com/en-us/library/aa384203(VS.85).aspx says: |
+ // 64-bit versions of Windows use 32-bit handles for interoperability. |
+ return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(h)); |
+} |
+ |
BASE_EXPORT void GetNonClientMetrics(NONCLIENTMETRICS_XP* metrics); |
// Returns the string representing the current user sid. |