| 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | |
| 7 | |
| 8 | /* This file provides macros and procedures relevant to the PROPERTYKEY structure defined in wtypes.h. */ |
| 9 | |
| 10 | |
| 11 | /* Property identifiers passed to the DEFINE_PROPERTYKEY macro below should be greater than 1; IDs 0 and 1 are reserved. |
| 12 | * See also: |
| 13 | * https://web.archive.org/web/20221119001250/https://learn.microsoft.com/en-us/windows/win32/api/wtypes/ns-wtypes-propertykey |
| 14 | */ |
| 15 | #if !defined(PID_FIRST_USABLE) |
| 16 | #define PID_FIRST_USABLE 2 |
| 17 | #endif |
| 18 | |
| 19 | /* See the definitions of PROPERTYKEY in wtypes.h, and GUID in guiddef.h. "l" is short for "long", "w" for "word", "b" for "byte", and "pid" for "property identifier". */ |
| 20 | #undef DEFINE_PROPERTYKEY |
| 21 | #if defined(INITGUID) && defined(__cplusplus) |
| 22 | #define DEFINE_PROPERTYKEY(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8,pid) EXTERN_C const PROPERTYKEY DECLSPEC_SELECTANY name = {{l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}},pid} |
| 23 | #elif defined(INITGUID) && !defined(__cplusplus) |
| 24 | #define DEFINE_PROPERTYKEY(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8,pid) const PROPERTYKEY DECLSPEC_SELECTANY name = {{l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}},pid} |
| 25 | #else |
| 26 | #define DEFINE_PROPERTYKEY(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8,pid) EXTERN_C const PROPERTYKEY name |
| 27 | #endif |
| 28 | |
| 29 | |
| 30 | |
| 31 | /* This implementation differs from the Windows SDK in order to correctly match the type of REFGUID used in `IsEqualIID()` (defined in guiddef.h) when __cplusplus is not defined. */ |
| 32 | #if !defined(IsEqualPropertyKey) && defined(__cplusplus) |
| 33 | #define IsEqualPropertyKey(a,b) (((a).pid == (b).pid) && IsEqualIID( (a).fmtid, (b).fmtid)) |
| 34 | #elif !defined(IsEqualPropertyKey) && !defined(__cplusplus) |
| 35 | #define IsEqualPropertyKey(a,b) (((a).pid == (b).pid) && IsEqualIID(&(a).fmtid, &(b).fmtid)) |
| 36 | #endif |
| 37 | |
| 38 | |
| 39 | |
| 40 | #if !defined(REFPROPERTYKEY) && defined(__cplusplus) |
| 41 | #define REFPROPERTYKEY const PROPERTYKEY & |
| 42 | #elif !defined(REFPROPERTYKEY) && !defined(__cplusplus) |
| 43 | #define REFPROPERTYKEY const PROPERTYKEY * __MIDL_CONST |
| 44 | #endif |
| 45 | |
| 46 | #if !defined(_PROPERTYKEY_EQUALITY_OPERATORS_) |
| 47 | #define _PROPERTYKEY_EQUALITY_OPERATORS_ |
| 48 | #if defined(__cplusplus) |
| 49 | extern "C++" |
| 50 | { |
| 51 | inline bool operator == (REFPROPERTYKEY k0, REFPROPERTYKEY k1) { return IsEqualPropertyKey(k0, k1); } |
| 52 | inline bool operator != (REFPROPERTYKEY k0, REFPROPERTYKEY k1) { return !IsEqualPropertyKey(k0, k1); } |
| 53 | } |
| 54 | #endif |
| 55 | #endif |