winapi\shared/
guiddef.rs

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
7use ctypes::{c_uchar, c_ulong, c_ushort};
8STRUCT!{#[debug] struct GUID {
9    Data1: c_ulong,
10    Data2: c_ushort,
11    Data3: c_ushort,
12    Data4: [c_uchar; 8],
13}}
14pub type LPGUID = *mut GUID;
15pub type LPCGUID = *const GUID;
16pub type IID = GUID;
17pub type LPIID = *mut IID;
18pub use self::IsEqualGUID as IsEqualIID;
19pub type CLSID = GUID;
20pub type LPCLSID = *mut CLSID;
21pub use self::IsEqualGUID as IsEqualCLSID;
22pub type FMTID = GUID;
23pub type LPFMTID = *mut FMTID;
24pub use self::IsEqualGUID as IsEqualFMTID;
25pub type REFGUID = *const GUID;
26pub type REFIID = *const IID;
27pub type REFCLSID = *const IID;
28pub type REFFMTID = *const IID;
29DEFINE_GUID!{IID_NULL,
30    0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
31#[inline]
32pub 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}