1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 //! GUID definition
7 use ctypes::{c_uchar, c_ulong, c_ushort};
8 STRUCT!{#[debug] struct GUID {
9     Data1: c_ulong,
10     Data2: c_ushort,
11     Data3: c_ushort,
12     Data4: [c_uchar; 8],
13 }}
14 pub type LPGUID = *mut GUID;
15 pub type LPCGUID = *const GUID;
16 pub type IID = GUID;
17 pub type LPIID = *mut IID;
18 pub use self::IsEqualGUID as IsEqualIID;
19 pub type CLSID = GUID;
20 pub type LPCLSID = *mut CLSID;
21 pub use self::IsEqualGUID as IsEqualCLSID;
22 pub type FMTID = GUID;
23 pub type LPFMTID = *mut FMTID;
24 pub use self::IsEqualGUID as IsEqualFMTID;
25 pub type REFGUID = *const GUID;
26 pub type REFIID = *const IID;
27 pub type REFCLSID = *const IID;
28 pub type REFFMTID = *const IID;
29 DEFINE_GUID!{IID_NULL,
30     0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
31 #[inline]
IsEqualGUID(g1: &GUID, g2: &GUID) -> bool32 pub fn IsEqualGUID(g1: &GUID, g2: &GUID) -> bool {
33     let a = unsafe { &*(g1 as *const _ as *const [u32; 4]) };
34     let b = unsafe { &*(g2 as *const _ as *const [u32; 4]) };
35     a[0] == b[0] && a[1] == b[1] && a[2] == b[2] && a[3] == b[3]
36 }
37