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 use ctypes::{c_uchar, c_ulong};
7 use shared::guiddef::{GUID, REFGUID};
8 use shared::minwindef::{BOOL, BYTE, DWORD, UINT, ULONG};
9 use shared::wtypes::{BSTR, CLIPFORMAT};
10 use um::oaidl::LPSAFEARRAY;
11 use um::objidl::{IPersistStream, IPersistStreamVtbl};
12 use um::objidlbase::{IEnumUnknown, IStream};
13 use um::ocidl::{IPropertyBag2, PROPBAG2};
14 use um::propidl::PROPVARIANT;
15 use um::unknwnbase::{IUnknown, IUnknownVtbl};
16 use um::wincodec::{
17     IWICComponentInfo, IWICComponentInfoVtbl, IWICEnumMetadataItem, IWICImagingFactory,
18     IWICImagingFactoryVtbl, IWICMetadataQueryReader, IWICMetadataQueryWriter,
19 };
20 use um::winnt::{HRESULT, ULARGE_INTEGER, WCHAR};
21 DEFINE_GUID!{GUID_MetadataFormatUnknown,
22     0xa45e592f, 0x9078, 0x4a7c, 0xad, 0xb5, 0x4e, 0xdc, 0x4f, 0xd6, 0x1b, 0x1f}
23 DEFINE_GUID!{GUID_MetadataFormatIfd,
24     0x537396c6, 0x2d8a, 0x4bb6, 0x9b, 0xf8, 0x2f, 0x0a, 0x8e, 0x2a, 0x3a, 0xdf}
25 DEFINE_GUID!{GUID_MetadataFormatSubIfd,
26     0x58a2e128, 0x2db9, 0x4e57, 0xbb, 0x14, 0x51, 0x77, 0x89, 0x1e, 0xd3, 0x31}
27 DEFINE_GUID!{GUID_MetadataFormatExif,
28     0x1c3c4f9d, 0xb84a, 0x467d, 0x94, 0x93, 0x36, 0xcf, 0xbd, 0x59, 0xea, 0x57}
29 DEFINE_GUID!{GUID_MetadataFormatGps,
30     0x7134ab8a, 0x9351, 0x44ad, 0xaf, 0x62, 0x44, 0x8d, 0xb6, 0xb5, 0x02, 0xec}
31 DEFINE_GUID!{GUID_MetadataFormatInterop,
32     0xed686f8e, 0x681f, 0x4c8b, 0xbd, 0x41, 0xa8, 0xad, 0xdb, 0xf6, 0xb3, 0xfc}
33 DEFINE_GUID!{GUID_MetadataFormatApp0,
34     0x79007028, 0x268d, 0x45d6, 0xa3, 0xc2, 0x35, 0x4e, 0x6a, 0x50, 0x4b, 0xc9}
35 DEFINE_GUID!{GUID_MetadataFormatApp1,
36     0x8fd3dfc3, 0xf951, 0x492b, 0x81, 0x7f, 0x69, 0xc2, 0xe6, 0xd9, 0xa5, 0xb0}
37 DEFINE_GUID!{GUID_MetadataFormatApp13,
38     0x326556a2, 0xf502, 0x4354, 0x9c, 0xc0, 0x8e, 0x3f, 0x48, 0xea, 0xf6, 0xb5}
39 DEFINE_GUID!{GUID_MetadataFormatIPTC,
40     0x4fab0914, 0xe129, 0x4087, 0xa1, 0xd1, 0xbc, 0x81, 0x2d, 0x45, 0xa7, 0xb5}
41 DEFINE_GUID!{GUID_MetadataFormatIRB,
42     0x16100d66, 0x8570, 0x4bb9, 0xb9, 0x2d, 0xfd, 0xa4, 0xb2, 0x3e, 0xce, 0x67}
43 DEFINE_GUID!{GUID_MetadataFormat8BIMIPTC,
44     0x0010568c, 0x0852, 0x4e6a, 0xb1, 0x91, 0x5c, 0x33, 0xac, 0x5b, 0x04, 0x30}
45 DEFINE_GUID!{GUID_MetadataFormat8BIMResolutionInfo,
46     0x739f305d, 0x81db, 0x43cb, 0xac, 0x5e, 0x55, 0x01, 0x3e, 0xf9, 0xf0, 0x03}
47 DEFINE_GUID!{GUID_MetadataFormat8BIMIPTCDigest,
48     0x1ca32285, 0x9ccd, 0x4786, 0x8b, 0xd8, 0x79, 0x53, 0x9d, 0xb6, 0xa0, 0x06}
49 DEFINE_GUID!{GUID_MetadataFormatXMP,
50     0xbb5acc38, 0xf216, 0x4cec, 0xa6, 0xc5, 0x5f, 0x6e, 0x73, 0x97, 0x63, 0xa9}
51 DEFINE_GUID!{GUID_MetadataFormatThumbnail,
52     0x243dcee9, 0x8703, 0x40ee, 0x8e, 0xf0, 0x22, 0xa6, 0x00, 0xb8, 0x05, 0x8c}
53 DEFINE_GUID!{GUID_MetadataFormatChunktEXt,
54     0x568d8936, 0xc0a9, 0x4923, 0x90, 0x5d, 0xdf, 0x2b, 0x38, 0x23, 0x8f, 0xbc}
55 DEFINE_GUID!{GUID_MetadataFormatXMPStruct,
56     0x22383cf1, 0xed17, 0x4e2e, 0xaf, 0x17, 0xd8, 0x5b, 0x8f, 0x6b, 0x30, 0xd0}
57 DEFINE_GUID!{GUID_MetadataFormatXMPBag,
58     0x833cca5f, 0xdcb7, 0x4516, 0x80, 0x6f, 0x65, 0x96, 0xab, 0x26, 0xdc, 0xe4}
59 DEFINE_GUID!{GUID_MetadataFormatXMPSeq,
60     0x63e8df02, 0xeb6c, 0x456c, 0xa2, 0x24, 0xb2, 0x5e, 0x79, 0x4f, 0xd6, 0x48}
61 DEFINE_GUID!{GUID_MetadataFormatXMPAlt,
62     0x7b08a675, 0x91aa, 0x481b, 0xa7, 0x98, 0x4d, 0xa9, 0x49, 0x08, 0x61, 0x3b}
63 DEFINE_GUID!{GUID_MetadataFormatLSD,
64     0xe256031e, 0x6299, 0x4929, 0xb9, 0x8d, 0x5a, 0xc8, 0x84, 0xaf, 0xba, 0x92}
65 DEFINE_GUID!{GUID_MetadataFormatIMD,
66     0xbd2bb086, 0x4d52, 0x48dd, 0x96, 0x77, 0xdb, 0x48, 0x3e, 0x85, 0xae, 0x8f}
67 DEFINE_GUID!{GUID_MetadataFormatGCE,
68     0x2a25cad8, 0xdeeb, 0x4c69, 0xa7, 0x88, 0x0e, 0xc2, 0x26, 0x6d, 0xca, 0xfd}
69 DEFINE_GUID!{GUID_MetadataFormatAPE,
70     0x2e043dc2, 0xc967, 0x4e05, 0x87, 0x5e, 0x61, 0x8b, 0xf6, 0x7e, 0x85, 0xc3}
71 DEFINE_GUID!{GUID_MetadataFormatJpegChrominance,
72     0xf73d0dcf, 0xcec6, 0x4f85, 0x9b, 0x0e, 0x1c, 0x39, 0x56, 0xb1, 0xbe, 0xf7}
73 DEFINE_GUID!{GUID_MetadataFormatJpegLuminance,
74     0x86908007, 0xedfc, 0x4860, 0x8d, 0x4b, 0x4e, 0xe6, 0xe8, 0x3e, 0x60, 0x58}
75 DEFINE_GUID!{GUID_MetadataFormatJpegComment,
76     0x220e5f33, 0xafd3, 0x474e, 0x9d, 0x31, 0x7d, 0x4f, 0xe7, 0x30, 0xf5, 0x57}
77 DEFINE_GUID!{GUID_MetadataFormatGifComment,
78     0xc4b6e0e0, 0xcfb4, 0x4ad3, 0xab, 0x33, 0x9a, 0xad, 0x23, 0x55, 0xa3, 0x4a}
79 DEFINE_GUID!{GUID_MetadataFormatChunkgAMA,
80     0xf00935a5, 0x1d5d, 0x4cd1, 0x81, 0xb2, 0x93, 0x24, 0xd7, 0xec, 0xa7, 0x81}
81 DEFINE_GUID!{GUID_MetadataFormatChunkbKGD,
82     0xe14d3571, 0x6b47, 0x4dea, 0xb6, 0x0a, 0x87, 0xce, 0x0a, 0x78, 0xdf, 0xb7}
83 DEFINE_GUID!{GUID_MetadataFormatChunkiTXt,
84     0xc2bec729, 0x0b68, 0x4b77, 0xaa, 0x0e, 0x62, 0x95, 0xa6, 0xac, 0x18, 0x14}
85 DEFINE_GUID!{GUID_MetadataFormatChunkcHRM,
86     0x9db3655b, 0x2842, 0x44b3, 0x80, 0x67, 0x12, 0xe9, 0xb3, 0x75, 0x55, 0x6a}
87 DEFINE_GUID!{GUID_MetadataFormatChunkhIST,
88     0xc59a82da, 0xdb74, 0x48a4, 0xbd, 0x6a, 0xb6, 0x9c, 0x49, 0x31, 0xef, 0x95}
89 DEFINE_GUID!{GUID_MetadataFormatChunkiCCP,
90     0xeb4349ab, 0xb685, 0x450f, 0x91, 0xb5, 0xe8, 0x02, 0xe8, 0x92, 0x53, 0x6c}
91 DEFINE_GUID!{GUID_MetadataFormatChunksRGB,
92     0xc115fd36, 0xcc6f, 0x4e3f, 0x83, 0x63, 0x52, 0x4b, 0x87, 0xc6, 0xb0, 0xd9}
93 DEFINE_GUID!{GUID_MetadataFormatChunktIME,
94     0x6b00ae2d, 0xe24b, 0x460a, 0x98, 0xb6, 0x87, 0x8b, 0xd0, 0x30, 0x72, 0xfd}
95 DEFINE_GUID!{GUID_MetadataFormatDds,
96     0x4a064603, 0x8c33, 0x4e60, 0x9c, 0x29, 0x13, 0x62, 0x31, 0x70, 0x2d, 0x08}
97 DEFINE_GUID!{CLSID_WICUnknownMetadataReader,
98     0x699745c2, 0x5066, 0x4b82, 0xa8, 0xe3, 0xd4, 0x04, 0x78, 0xdb, 0xec, 0x8c}
99 DEFINE_GUID!{CLSID_WICUnknownMetadataWriter,
100     0xa09cca86, 0x27ba, 0x4f39, 0x90, 0x53, 0x12, 0x1f, 0xa4, 0xdc, 0x08, 0xfc}
101 DEFINE_GUID!{CLSID_WICApp0MetadataWriter,
102     0xf3c633a2, 0x46c8, 0x498e, 0x8f, 0xbb, 0xcc, 0x6f, 0x72, 0x1b, 0xbc, 0xde}
103 DEFINE_GUID!{CLSID_WICApp0MetadataReader,
104     0x43324b33, 0xa78f, 0x480f, 0x91, 0x11, 0x96, 0x38, 0xaa, 0xcc, 0xc8, 0x32}
105 DEFINE_GUID!{CLSID_WICApp1MetadataWriter,
106     0xee366069, 0x1832, 0x420f, 0xb3, 0x81, 0x04, 0x79, 0xad, 0x06, 0x6f, 0x19}
107 DEFINE_GUID!{CLSID_WICApp1MetadataReader,
108     0xdde33513, 0x774e, 0x4bcd, 0xae, 0x79, 0x02, 0xf4, 0xad, 0xfe, 0x62, 0xfc}
109 DEFINE_GUID!{CLSID_WICApp13MetadataWriter,
110     0x7b19a919, 0xa9d6, 0x49e5, 0xbd, 0x45, 0x02, 0xc3, 0x4e, 0x4e, 0x4c, 0xd5}
111 DEFINE_GUID!{CLSID_WICApp13MetadataReader,
112     0xaa7e3c50, 0x864c, 0x4604, 0xbc, 0x04, 0x8b, 0x0b, 0x76, 0xe6, 0x37, 0xf6}
113 DEFINE_GUID!{CLSID_WICIfdMetadataReader,
114     0x8f914656, 0x9d0a, 0x4eb2, 0x90, 0x19, 0x0b, 0xf9, 0x6d, 0x8a, 0x9e, 0xe6}
115 DEFINE_GUID!{CLSID_WICIfdMetadataWriter,
116     0xb1ebfc28, 0xc9bd, 0x47a2, 0x8d, 0x33, 0xb9, 0x48, 0x76, 0x97, 0x77, 0xa7}
117 DEFINE_GUID!{CLSID_WICSubIfdMetadataReader,
118     0x50d42f09, 0xecd1, 0x4b41, 0xb6, 0x5d, 0xda, 0x1f, 0xda, 0xa7, 0x56, 0x63}
119 DEFINE_GUID!{CLSID_WICSubIfdMetadataWriter,
120     0x8ade5386, 0x8e9b, 0x4f4c, 0xac, 0xf2, 0xf0, 0x00, 0x87, 0x06, 0xb2, 0x38}
121 DEFINE_GUID!{CLSID_WICExifMetadataReader,
122     0xd9403860, 0x297f, 0x4a49, 0xbf, 0x9b, 0x77, 0x89, 0x81, 0x50, 0xa4, 0x42}
123 DEFINE_GUID!{CLSID_WICExifMetadataWriter,
124     0xc9a14cda, 0xc339, 0x460b, 0x90, 0x78, 0xd4, 0xde, 0xbc, 0xfa, 0xbe, 0x91}
125 DEFINE_GUID!{CLSID_WICGpsMetadataReader,
126     0x3697790b, 0x223b, 0x484e, 0x99, 0x25, 0xc4, 0x86, 0x92, 0x18, 0xf1, 0x7a}
127 DEFINE_GUID!{CLSID_WICGpsMetadataWriter,
128     0xcb8c13e4, 0x62b5, 0x4c96, 0xa4, 0x8b, 0x6b, 0xa6, 0xac, 0xe3, 0x9c, 0x76}
129 DEFINE_GUID!{CLSID_WICInteropMetadataReader,
130     0xb5c8b898, 0x0074, 0x459f, 0xb7, 0x00, 0x86, 0x0d, 0x46, 0x51, 0xea, 0x14}
131 DEFINE_GUID!{CLSID_WICInteropMetadataWriter,
132     0x122ec645, 0xcd7e, 0x44d8, 0xb1, 0x86, 0x2c, 0x8c, 0x20, 0xc3, 0xb5, 0x0f}
133 DEFINE_GUID!{CLSID_WICThumbnailMetadataReader,
134     0xfb012959, 0xf4f6, 0x44d7, 0x9d, 0x09, 0xda, 0xa0, 0x87, 0xa9, 0xdb, 0x57}
135 DEFINE_GUID!{CLSID_WICThumbnailMetadataWriter,
136     0xd049b20c, 0x5dd0, 0x44fe, 0xb0, 0xb3, 0x8f, 0x92, 0xc8, 0xe6, 0xd0, 0x80}
137 DEFINE_GUID!{CLSID_WICIPTCMetadataReader,
138     0x03012959, 0xf4f6, 0x44d7, 0x9d, 0x09, 0xda, 0xa0, 0x87, 0xa9, 0xdb, 0x57}
139 DEFINE_GUID!{CLSID_WICIPTCMetadataWriter,
140     0x1249b20c, 0x5dd0, 0x44fe, 0xb0, 0xb3, 0x8f, 0x92, 0xc8, 0xe6, 0xd0, 0x80}
141 DEFINE_GUID!{CLSID_WICIRBMetadataReader,
142     0xd4dcd3d7, 0xb4c2, 0x47d9, 0xa6, 0xbf, 0xb8, 0x9b, 0xa3, 0x96, 0xa4, 0xa3}
143 DEFINE_GUID!{CLSID_WICIRBMetadataWriter,
144     0x5c5c1935, 0x0235, 0x4434, 0x80, 0xbc, 0x25, 0x1b, 0xc1, 0xec, 0x39, 0xc6}
145 DEFINE_GUID!{CLSID_WIC8BIMIPTCMetadataReader,
146     0x0010668c, 0x0801, 0x4da6, 0xa4, 0xa4, 0x82, 0x65, 0x22, 0xb6, 0xd2, 0x8f}
147 DEFINE_GUID!{CLSID_WIC8BIMIPTCMetadataWriter,
148     0x00108226, 0xee41, 0x44a2, 0x9e, 0x9c, 0x4b, 0xe4, 0xd5, 0xb1, 0xd2, 0xcd}
149 DEFINE_GUID!{CLSID_WIC8BIMResolutionInfoMetadataReader,
150     0x5805137a, 0xe348, 0x4f7c, 0xb3, 0xcc, 0x6d, 0xb9, 0x96, 0x5a, 0x05, 0x99}
151 DEFINE_GUID!{CLSID_WIC8BIMResolutionInfoMetadataWriter,
152     0x4ff2fe0e, 0xe74a, 0x4b71, 0x98, 0xc4, 0xab, 0x7d, 0xc1, 0x67, 0x07, 0xba}
153 DEFINE_GUID!{CLSID_WIC8BIMIPTCDigestMetadataReader,
154     0x02805f1e, 0xd5aa, 0x415b, 0x82, 0xc5, 0x61, 0xc0, 0x33, 0xa9, 0x88, 0xa6}
155 DEFINE_GUID!{CLSID_WIC8BIMIPTCDigestMetadataWriter,
156     0x2db5e62b, 0x0d67, 0x495f, 0x8f, 0x9d, 0xc2, 0xf0, 0x18, 0x86, 0x47, 0xac}
157 DEFINE_GUID!{CLSID_WICPngTextMetadataReader,
158     0x4b59afcc, 0xb8c3, 0x408a, 0xb6, 0x70, 0x89, 0xe5, 0xfa, 0xb6, 0xfd, 0xa7}
159 DEFINE_GUID!{CLSID_WICPngTextMetadataWriter,
160     0xb5ebafb9, 0x253e, 0x4a72, 0xa7, 0x44, 0x07, 0x62, 0xd2, 0x68, 0x56, 0x83}
161 DEFINE_GUID!{CLSID_WICXMPMetadataReader,
162     0x72b624df, 0xae11, 0x4948, 0xa6, 0x5c, 0x35, 0x1e, 0xb0, 0x82, 0x94, 0x19}
163 DEFINE_GUID!{CLSID_WICXMPMetadataWriter,
164     0x1765e14e, 0x1bd4, 0x462e, 0xb6, 0xb1, 0x59, 0x0b, 0xf1, 0x26, 0x2a, 0xc6}
165 DEFINE_GUID!{CLSID_WICXMPStructMetadataReader,
166     0x01b90d9a, 0x8209, 0x47f7, 0x9c, 0x52, 0xe1, 0x24, 0x4b, 0xf5, 0x0c, 0xed}
167 DEFINE_GUID!{CLSID_WICXMPStructMetadataWriter,
168     0x22c21f93, 0x7ddb, 0x411c, 0x9b, 0x17, 0xc5, 0xb7, 0xbd, 0x06, 0x4a, 0xbc}
169 DEFINE_GUID!{CLSID_WICXMPBagMetadataReader,
170     0xe7e79a30, 0x4f2c, 0x4fab, 0x8d, 0x00, 0x39, 0x4f, 0x2d, 0x6b, 0xbe, 0xbe}
171 DEFINE_GUID!{CLSID_WICXMPBagMetadataWriter,
172     0xed822c8c, 0xd6be, 0x4301, 0xa6, 0x31, 0x0e, 0x14, 0x16, 0xba, 0xd2, 0x8f}
173 DEFINE_GUID!{CLSID_WICXMPSeqMetadataReader,
174     0x7f12e753, 0xfc71, 0x43d7, 0xa5, 0x1d, 0x92, 0xf3, 0x59, 0x77, 0xab, 0xb5}
175 DEFINE_GUID!{CLSID_WICXMPSeqMetadataWriter,
176     0x6d68d1de, 0xd432, 0x4b0f, 0x92, 0x3a, 0x09, 0x11, 0x83, 0xa9, 0xbd, 0xa7}
177 DEFINE_GUID!{CLSID_WICXMPAltMetadataReader,
178     0xaa94dcc2, 0xb8b0, 0x4898, 0xb8, 0x35, 0x00, 0x0a, 0xab, 0xd7, 0x43, 0x93}
179 DEFINE_GUID!{CLSID_WICXMPAltMetadataWriter,
180     0x076c2a6c, 0xf78f, 0x4c46, 0xa7, 0x23, 0x35, 0x83, 0xe7, 0x08, 0x76, 0xea}
181 DEFINE_GUID!{CLSID_WICLSDMetadataReader,
182     0x41070793, 0x59e4, 0x479a, 0xa1, 0xf7, 0x95, 0x4a, 0xdc, 0x2e, 0xf5, 0xfc}
183 DEFINE_GUID!{CLSID_WICLSDMetadataWriter,
184     0x73c037e7, 0xe5d9, 0x4954, 0x87, 0x6a, 0x6d, 0xa8, 0x1d, 0x6e, 0x57, 0x68}
185 DEFINE_GUID!{CLSID_WICGCEMetadataReader,
186     0xb92e345d, 0xf52d, 0x41f3, 0xb5, 0x62, 0x08, 0x1b, 0xc7, 0x72, 0xe3, 0xb9}
187 DEFINE_GUID!{CLSID_WICGCEMetadataWriter,
188     0xaf95dc76, 0x16b2, 0x47f4, 0xb3, 0xea, 0x3c, 0x31, 0x79, 0x66, 0x93, 0xe7}
189 DEFINE_GUID!{CLSID_WICIMDMetadataReader,
190     0x7447a267, 0x0015, 0x42c8, 0xa8, 0xf1, 0xfb, 0x3b, 0x94, 0xc6, 0x83, 0x61}
191 DEFINE_GUID!{CLSID_WICIMDMetadataWriter,
192     0x8c89071f, 0x452e, 0x4e95, 0x96, 0x82, 0x9d, 0x10, 0x24, 0x62, 0x71, 0x72}
193 DEFINE_GUID!{CLSID_WICAPEMetadataReader,
194     0x1767b93a, 0xb021, 0x44ea, 0x92, 0x0f, 0x86, 0x3c, 0x11, 0xf4, 0xf7, 0x68}
195 DEFINE_GUID!{CLSID_WICAPEMetadataWriter,
196     0xbd6edfca, 0x2890, 0x482f, 0xb2, 0x33, 0x8d, 0x73, 0x39, 0xa1, 0xcf, 0x8d}
197 DEFINE_GUID!{CLSID_WICJpegChrominanceMetadataReader,
198     0x50b1904b, 0xf28f, 0x4574, 0x93, 0xf4, 0x0b, 0xad, 0xe8, 0x2c, 0x69, 0xe9}
199 DEFINE_GUID!{CLSID_WICJpegChrominanceMetadataWriter,
200     0x3ff566f0, 0x6e6b, 0x49d4, 0x96, 0xe6, 0xb7, 0x88, 0x86, 0x69, 0x2c, 0x62}
201 DEFINE_GUID!{CLSID_WICJpegLuminanceMetadataReader,
202     0x356f2f88, 0x05a6, 0x4728, 0xb9, 0xa4, 0x1b, 0xfb, 0xce, 0x04, 0xd8, 0x38}
203 DEFINE_GUID!{CLSID_WICJpegLuminanceMetadataWriter,
204     0x1d583abc, 0x8a0e, 0x4657, 0x99, 0x82, 0xa3, 0x80, 0xca, 0x58, 0xfb, 0x4b}
205 DEFINE_GUID!{CLSID_WICJpegCommentMetadataReader,
206     0x9f66347c, 0x60c4, 0x4c4d, 0xab, 0x58, 0xd2, 0x35, 0x86, 0x85, 0xf6, 0x07}
207 DEFINE_GUID!{CLSID_WICJpegCommentMetadataWriter,
208     0xe573236f, 0x55b1, 0x4eda, 0x81, 0xea, 0x9f, 0x65, 0xdb, 0x02, 0x90, 0xd3}
209 DEFINE_GUID!{CLSID_WICGifCommentMetadataReader,
210     0x32557d3b, 0x69dc, 0x4f95, 0x83, 0x6e, 0xf5, 0x97, 0x2b, 0x2f, 0x61, 0x59}
211 DEFINE_GUID!{CLSID_WICGifCommentMetadataWriter,
212     0xa02797fc, 0xc4ae, 0x418c, 0xaf, 0x95, 0xe6, 0x37, 0xc7, 0xea, 0xd2, 0xa1}
213 DEFINE_GUID!{CLSID_WICPngGamaMetadataReader,
214     0x3692ca39, 0xe082, 0x4350, 0x9e, 0x1f, 0x37, 0x04, 0xcb, 0x08, 0x3c, 0xd5}
215 DEFINE_GUID!{CLSID_WICPngGamaMetadataWriter,
216     0xff036d13, 0x5d4b, 0x46dd, 0xb1, 0x0f, 0x10, 0x66, 0x93, 0xd9, 0xfe, 0x4f}
217 DEFINE_GUID!{CLSID_WICPngBkgdMetadataReader,
218     0x0ce7a4a6, 0x03e8, 0x4a60, 0x9d, 0x15, 0x28, 0x2e, 0xf3, 0x2e, 0xe7, 0xda}
219 DEFINE_GUID!{CLSID_WICPngBkgdMetadataWriter,
220     0x68e3f2fd, 0x31ae, 0x4441, 0xbb, 0x6a, 0xfd, 0x70, 0x47, 0x52, 0x5f, 0x90}
221 DEFINE_GUID!{CLSID_WICPngItxtMetadataReader,
222     0xaabfb2fa, 0x3e1e, 0x4a8f, 0x89, 0x77, 0x55, 0x56, 0xfb, 0x94, 0xea, 0x23}
223 DEFINE_GUID!{CLSID_WICPngItxtMetadataWriter,
224     0x31879719, 0xe751, 0x4df8, 0x98, 0x1d, 0x68, 0xdf, 0xf6, 0x77, 0x04, 0xed}
225 DEFINE_GUID!{CLSID_WICPngChrmMetadataReader,
226     0xf90b5f36, 0x367b, 0x402a, 0x9d, 0xd1, 0xbc, 0x0f, 0xd5, 0x9d, 0x8f, 0x62}
227 DEFINE_GUID!{CLSID_WICPngChrmMetadataWriter,
228     0xe23ce3eb, 0x5608, 0x4e83, 0xbc, 0xef, 0x27, 0xb1, 0x98, 0x7e, 0x51, 0xd7}
229 DEFINE_GUID!{CLSID_WICPngHistMetadataReader,
230     0x877a0bb7, 0xa313, 0x4491, 0x87, 0xb5, 0x2e, 0x6d, 0x05, 0x94, 0xf5, 0x20}
231 DEFINE_GUID!{CLSID_WICPngHistMetadataWriter,
232     0x8a03e749, 0x672e, 0x446e, 0xbf, 0x1f, 0x2c, 0x11, 0xd2, 0x33, 0xb6, 0xff}
233 DEFINE_GUID!{CLSID_WICPngIccpMetadataReader,
234     0xf5d3e63b, 0xcb0f, 0x4628, 0xa4, 0x78, 0x6d, 0x82, 0x44, 0xbe, 0x36, 0xb1}
235 DEFINE_GUID!{CLSID_WICPngIccpMetadataWriter,
236     0x16671e5f, 0x0ce6, 0x4cc4, 0x97, 0x68, 0xe8, 0x9f, 0xe5, 0x01, 0x8a, 0xde}
237 DEFINE_GUID!{CLSID_WICPngSrgbMetadataReader,
238     0xfb40360c, 0x547e, 0x4956, 0xa3, 0xb9, 0xd4, 0x41, 0x88, 0x59, 0xba, 0x66}
239 DEFINE_GUID!{CLSID_WICPngSrgbMetadataWriter,
240     0xa6ee35c6, 0x87ec, 0x47df, 0x9f, 0x22, 0x1d, 0x5a, 0xad, 0x84, 0x0c, 0x82}
241 DEFINE_GUID!{CLSID_WICPngTimeMetadataReader,
242     0xd94edf02, 0xefe5, 0x4f0d, 0x85, 0xc8, 0xf5, 0xa6, 0x8b, 0x30, 0x00, 0xb1}
243 DEFINE_GUID!{CLSID_WICPngTimeMetadataWriter,
244     0x1ab78400, 0xb5a3, 0x4d91, 0x8a, 0xce, 0x33, 0xfc, 0xd1, 0x49, 0x9b, 0xe6}
245 DEFINE_GUID!{CLSID_WICDdsMetadataReader,
246     0x276c88ca, 0x7533, 0x4a86, 0xb6, 0x76, 0x66, 0xb3, 0x60, 0x80, 0xd4, 0x84}
247 DEFINE_GUID!{CLSID_WICDdsMetadataWriter,
248     0xfd688bbd, 0x31ed, 0x4db7, 0xa7, 0x23, 0x93, 0x49, 0x27, 0xd3, 0x83, 0x67}
249 ENUM!{enum WICMetadataCreationOptions {
250     WICMetadataCreationDefault = 0,
251     WICMetadataCreationAllowUnknown = WICMetadataCreationDefault,
252     WICMetadataCreationFailUnknown = 0x10000,
253     WICMetadataCreationMask = 0xffff0000,
254 }}
255 ENUM!{enum WICPersistOptions {
256     WICPersistOptionDefault = 0,
257     WICPersistOptionLittleEndian = 0,
258     WICPersistOptionBigEndian = 0x1,
259     WICPersistOptionStrictFormat = 0x2,
260     WICPersistOptionNoCacheStream = 0x4,
261     WICPersistOptionPreferUTF8 = 0x8,
262     WICPersistOptionMask = 0xffff,
263 }}
264 RIDL!{#[uuid(0xfeaa2a8d, 0xb3f3, 0x43e4, 0xb2, 0x5c, 0xd1, 0xde, 0x99, 0x0a, 0x1a, 0xe1)]
265 interface IWICMetadataBlockReader(IWICMetadataBlockReaderVtbl): IUnknown(IUnknownVtbl) {
266     fn GetContainerFormat(
267         pguidContainerFormat: *mut GUID,
268     ) -> HRESULT,
269     fn GetCount(
270         pcCount: *mut UINT,
271     ) -> HRESULT,
272     fn GetReaderByIndex(
273         ppIMetadataReader: *mut *mut IWICMetadataReader,
274     ) -> HRESULT,
275     fn GetEnumerator(
276         ppIEnumMetadata: *mut IEnumUnknown,
277     ) -> HRESULT,
278 }}
279 RIDL!{#[uuid(0x08fb9676, 0xb444, 0x41e8, 0x8d, 0xbe, 0x6a, 0x53, 0xa5, 0x42, 0xbf, 0xf1)]
280 interface IWICMetadataBlockWriter(IWICMetadataBlockWriterVtbl):
281     IWICMetadataBlockReader(IWICMetadataBlockReaderVtbl) {
282     fn InitializeFromBlockReader(
283         pIMDBlockReader: *mut IWICMetadataBlockReader,
284     ) -> HRESULT,
285     fn GetWriterByIndex(
286         ppIMetadataWriter: *mut *mut IWICMetadataWriter,
287     ) -> HRESULT,
288     fn AddWriter(
289         pIMetadataWriter: *mut IWICMetadataWriter,
290     ) -> HRESULT,
291     fn SetWriterByIndex(
292         pIMetadataWriter: *mut IWICMetadataWriter,
293     ) -> HRESULT,
294     fn RemoveWriterByIndex(
295         nIndex: UINT,
296     ) -> HRESULT,
297 }}
298 RIDL!{#[uuid(0x9204fe99, 0xd8fc, 0x4fd5, 0xa0, 0x01, 0x95, 0x36, 0xb0, 0x67, 0xa8, 0x99)]
299 interface IWICMetadataReader(IWICMetadataReaderVtbl): IUnknown(IUnknownVtbl) {
300     fn GetMetadataFormat(
301         pguidMetadataFormat: *mut GUID,
302     ) -> HRESULT,
303     fn GetMetadataHandlerInfo(
304         ppIHandler: *mut *mut IWICMetadataHandlerInfo,
305     ) -> HRESULT,
306     fn GetCount(
307         pcCount: *mut UINT,
308     ) -> HRESULT,
309     fn GetValueByIndex(
310         nIndex: UINT,
311         pvarSchema: *mut PROPVARIANT,
312         pvarId: *mut PROPVARIANT,
313         pvarValue: *mut PROPVARIANT,
314     ) -> HRESULT,
315     fn GetValue(
316         pvarSchema: *const PROPVARIANT,
317         pvarId: *const PROPVARIANT,
318         pvarValue: *mut PROPVARIANT,
319     ) -> HRESULT,
320     fn GetEnumerator(
321         ppIEnumMetadata: *mut *mut IWICEnumMetadataItem,
322     ) -> HRESULT,
323 }}
324 RIDL!{#[uuid(0xf7836e16, 0x3be0, 0x470b, 0x86, 0xbb, 0x16, 0x0d, 0x0a, 0xec, 0xd7, 0xde)]
325 interface IWICMetadataWriter(IWICMetadataWriterVtbl): IWICMetadataReader(IWICMetadataReaderVtbl) {
326     fn SetValue(
327         pvarSchema: *const PROPVARIANT,
328         pvarId: *const PROPVARIANT,
329         pvarValue: *const PROPVARIANT,
330     ) -> HRESULT,
331     fn SetValueByIndex(
332         nIndex: UINT,
333         pvarSchema: *const PROPVARIANT,
334         pvarId: *const PROPVARIANT,
335         pvarValue: *const PROPVARIANT,
336     ) -> HRESULT,
337     fn RemoveValue(
338         pvarSchema: *const PROPVARIANT,
339         pvarId: *const PROPVARIANT,
340     ) -> HRESULT,
341     fn RemoveValueByIndex(
342         nIndex: UINT,
343     ) -> HRESULT,
344 }}
345 RIDL!{#[uuid(0x449494bc, 0xb468, 0x4927, 0x96, 0xd7, 0xba, 0x90, 0xd3, 0x1a, 0xb5, 0x05)]
346 interface IWICStreamProvider(IWICStreamProviderVtbl): IUnknown(IUnknownVtbl) {
347     fn GetStream(
348         ppIStream: *mut *mut IStream,
349     ) -> HRESULT,
350     fn GetPersistOptions(
351         pdwPersistOptions: *mut DWORD,
352     ) -> HRESULT,
353     fn GetPreferredVendorGUID(
354         pguidPreferredVendor: *mut GUID,
355     ) -> HRESULT,
356     fn RefreshStream() -> HRESULT,
357 }}
358 RIDL!{#[uuid(0x00675040, 0x6908, 0x45f8, 0x86, 0xa3, 0x49, 0xc7, 0xdf, 0xd6, 0xd9, 0xad)]
359 interface IWICPersistStream(IWICPersistStreamVtbl): IPersistStream(IPersistStreamVtbl) {
360     fn LoadEx(
361         pIStream: *mut IStream,
362         pguidPreferredVendor: *const GUID,
363         dwPersistOptions: DWORD,
364     ) -> HRESULT,
365     fn SaveEx(
366         pIStream: *mut IStream,
367         dwPersistOptions: DWORD,
368         fClearDirty: BOOL,
369     ) -> HRESULT,
370 }}
371 RIDL!{#[uuid(0xaba958bf, 0xc672, 0x44d1, 0x8d, 0x61, 0xce, 0x6d, 0xf2, 0xe6, 0x82, 0xc2)]
372 interface IWICMetadataHandlerInfo(IWICMetadataHandlerInfoVtbl):
373     IWICComponentInfo(IWICComponentInfoVtbl) {
374     fn GetMetadataFormat(
375         pguidMetadataFormat: *mut GUID,
376     ) -> HRESULT,
377     fn GetContainerFormats(
378         cContainerFormats: UINT,
379         pguidContainerFormats: *mut GUID,
380         pcchActual: *mut UINT,
381     ) -> HRESULT,
382     fn GetDeviceManufacturer(
383         cchDeviceManufacturer: UINT,
384         wzDeviceManufacturer: *mut WCHAR,
385         pcchActual: *mut UINT,
386     ) -> HRESULT,
387     fn GetDeviceModels(
388         cchDeviceModels: UINT,
389         wzDeviceModels: *mut WCHAR,
390         pcchActual: *mut UINT,
391     ) -> HRESULT,
392     fn DoesRequireFullStream(
393         pfRequiresFullStream: *mut BOOL,
394     ) -> HRESULT,
395     fn DoesSupportPadding(
396         pfSupportsPadding: *mut BOOL,
397     ) -> HRESULT,
398     fn DoesRequireFixedSize(
399         pfFixedSize: *mut BOOL,
400     ) -> HRESULT,
401 }}
402 STRUCT!{struct WICMetadataPattern {
403     Position: ULARGE_INTEGER,
404     Length: ULONG,
405     Pattern: *mut BYTE,
406     Mask: *mut BYTE,
407     DataOffset: ULARGE_INTEGER,
408 }}
409 RIDL!{#[uuid(0xeebf1f5b, 0x07c1, 0x4447, 0xa3, 0xab, 0x22, 0xac, 0xaf, 0x78, 0xa8, 0x04)]
410 interface IWICMetadataReaderInfo(IWICMetadataReaderInfoVtbl):
411     IWICMetadataHandlerInfo(IWICMetadataHandlerInfoVtbl) {
412     fn GetPatterns(
413         guidContainerFormat: REFGUID,
414         cbSize: UINT,
415         pPattern: *mut WICMetadataPattern,
416         pcCount: *mut UINT,
417         pcbActual: *mut UINT,
418     ) -> HRESULT,
419     fn MatchesPattern(
420         guidContainerFormat: REFGUID,
421         pIStream: *mut IStream,
422         pfMatches: *mut BOOL,
423     ) -> HRESULT,
424     fn CreateInstance(
425         ppIReader: *mut *mut IWICMetadataReader,
426     ) -> HRESULT,
427 }}
428 STRUCT!{struct WICMetadataHeader {
429     Position: ULARGE_INTEGER,
430     Length: ULONG,
431     Header: *mut BYTE,
432     DataOffset: ULARGE_INTEGER,
433 }}
434 RIDL!{#[uuid(0xb22e3fba, 0x3925, 0x4323, 0xb5, 0xc1, 0x9e, 0xbf, 0xc4, 0x30, 0xf2, 0x36)]
435 interface IWICMetadataWriterInfo(IWICMetadataWriterInfoVtbl):
436     IWICMetadataHandlerInfo(IWICMetadataHandlerInfoVtbl) {
437     fn GetHeader(
438         guidContainerFormat: REFGUID,
439         cbSize: UINT,
440         pHeader: *mut WICMetadataHeader,
441         pcbActual: *mut UINT,
442     ) -> HRESULT,
443     fn CreateInstance(
444         ppIWriter: *mut *mut IWICMetadataWriter,
445     ) -> HRESULT,
446 }}
447 RIDL!{#[uuid(0x412d0c3a, 0x9650, 0x44fa, 0xaf, 0x5b, 0xdd, 0x2a, 0x06, 0xc8, 0xe8, 0xfb)]
448 interface IWICComponentFactory(IWICComponentFactoryVtbl):
449     IWICImagingFactory(IWICImagingFactoryVtbl) {
450     fn CreateMetadataReader(
451         guidMetadataFormat: REFGUID,
452         pguidVendor: *const GUID,
453         dwOptions: DWORD,
454         pIStream: *mut IStream,
455         ppIReader: *mut *mut IWICMetadataReader,
456     ) -> HRESULT,
457     fn CreateMetadataReaderFromContainer(
458         guidContainerFormat: REFGUID,
459         pguidVendor: *const GUID,
460         dwOptions: DWORD,
461         pIStream: *mut IStream,
462         ppIReader: *mut *mut IWICMetadataReader,
463     ) -> HRESULT,
464     fn CreateMetadataWriter(
465         guidMetadataFormat: REFGUID,
466         pguidVendor: *const GUID,
467         dwMetadataOptions: DWORD,
468         ppIWriter: *mut *mut IWICMetadataWriter,
469     ) -> HRESULT,
470     fn CreateMetadataWriterFromReader(
471         pIReader: *mut IWICMetadataReader,
472         pguidVendor: *const GUID,
473         ppIWriter: *mut *mut IWICMetadataWriter,
474     ) -> HRESULT,
475     fn CreateQueryReaderFromBlockReader(
476         pIBlockReader: *mut IWICMetadataBlockReader,
477         ppIQueryReader: *mut *mut IWICMetadataQueryReader,
478     ) -> HRESULT,
479     fn CreateQueryWriterFromBlockWriter(
480         pIBlockWriter: *mut IWICMetadataBlockWriter,
481         ppIQueryWriter: *mut *mut IWICMetadataQueryWriter,
482     ) -> HRESULT,
483     fn CreateEncoderPropertyBag(
484         ppropOptions: *mut PROPBAG2,
485         cCount: UINT,
486         ppIPropertyBag: *mut *mut IPropertyBag2,
487     ) -> HRESULT,
488 }}
489 extern "system" {
WICMatchMetadataContent( guidContainerFormat: REFGUID, pguidVendor: *const GUID, pIStream: *mut IStream, pguidMetadataFormat: *mut GUID, ) -> HRESULT490     pub fn WICMatchMetadataContent(
491         guidContainerFormat: REFGUID,
492         pguidVendor: *const GUID,
493         pIStream: *mut IStream,
494         pguidMetadataFormat: *mut GUID,
495     ) -> HRESULT;
WICSerializeMetadataContent( guidContainerFormat: REFGUID, pIWriter: *mut IWICMetadataWriter, dwPersistOptions: DWORD, pIStream: *mut IStream, ) -> HRESULT496     pub fn WICSerializeMetadataContent(
497         guidContainerFormat: REFGUID,
498         pIWriter: *mut IWICMetadataWriter,
499         dwPersistOptions: DWORD,
500         pIStream: *mut IStream,
501     ) -> HRESULT;
WICGetMetadataContentSize( guidContainerFormat: REFGUID, pIWriter: *mut IWICMetadataWriter, pcbSize: *mut ULARGE_INTEGER, ) -> HRESULT502     pub fn WICGetMetadataContentSize(
503         guidContainerFormat: REFGUID,
504         pIWriter: *mut IWICMetadataWriter,
505         pcbSize: *mut ULARGE_INTEGER,
506     ) -> HRESULT;
BSTR_UserSize( pFlags: *mut c_ulong, Offset: c_ulong, pBstr: *mut BSTR, ) -> c_ulong507     pub fn BSTR_UserSize(
508         pFlags: *mut c_ulong,
509         Offset: c_ulong,
510         pBstr: *mut BSTR,
511     ) -> c_ulong;
BSTR_UserMarshal( pFlags: *mut c_ulong, pBuffer: *mut c_uchar, pBstr: *mut BSTR, ) -> *mut c_uchar512     pub fn BSTR_UserMarshal(
513         pFlags: *mut c_ulong,
514         pBuffer: *mut c_uchar,
515         pBstr: *mut BSTR,
516     ) -> *mut c_uchar;
BSTR_UserUnmarshal( pFlags: *mut c_ulong, pBuffer: *mut c_uchar, pBstr: *mut BSTR, ) -> *mut c_uchar517     pub fn BSTR_UserUnmarshal(
518         pFlags: *mut c_ulong,
519         pBuffer: *mut c_uchar,
520         pBstr: *mut BSTR,
521     ) -> *mut c_uchar;
BSTR_UserFree( pFlags: *mut c_ulong, pBstr: *mut BSTR, )522     pub fn BSTR_UserFree(
523         pFlags: *mut c_ulong,
524         pBstr: *mut BSTR,
525     );
CLIPFORMAT_UserSize( pFlags: *mut c_ulong, Offset: c_ulong, pCF: *mut CLIPFORMAT, ) -> c_ulong526     pub fn CLIPFORMAT_UserSize(
527         pFlags: *mut c_ulong,
528         Offset: c_ulong,
529         pCF: *mut CLIPFORMAT,
530     ) -> c_ulong;
CLIPFORMAT_UserMarshal( pFlags: *mut c_ulong, pBuffer: *mut c_uchar, pCF: *mut CLIPFORMAT, ) -> *mut c_uchar531     pub fn CLIPFORMAT_UserMarshal(
532         pFlags: *mut c_ulong,
533         pBuffer: *mut c_uchar,
534         pCF: *mut CLIPFORMAT,
535     ) -> *mut c_uchar;
CLIPFORMAT_UserUnmarshal( pFlags: *mut c_ulong, pBuffer: *mut c_uchar, pCF: *mut CLIPFORMAT, ) -> *mut c_uchar536     pub fn CLIPFORMAT_UserUnmarshal(
537         pFlags: *mut c_ulong,
538         pBuffer: *mut c_uchar,
539         pCF: *mut CLIPFORMAT,
540     ) -> *mut c_uchar;
CLIPFORMAT_UserFree( pFlags: *mut c_ulong, pCF: *mut CLIPFORMAT, )541     pub fn CLIPFORMAT_UserFree(
542         pFlags: *mut c_ulong,
543         pCF: *mut CLIPFORMAT,
544     );
LPSAFEARRAY_UserSize( pFlags: *mut c_ulong, Offset: c_ulong, phBmp: *mut LPSAFEARRAY, ) -> c_ulong545     pub fn LPSAFEARRAY_UserSize(
546         pFlags: *mut c_ulong,
547         Offset: c_ulong,
548         phBmp: *mut LPSAFEARRAY,
549     ) -> c_ulong;
LPSAFEARRAY_UserMarshal( pFlags: *mut c_ulong, pBuffer: *mut c_uchar, pBstr: *mut LPSAFEARRAY, ) -> *mut c_uchar550     pub fn LPSAFEARRAY_UserMarshal(
551         pFlags: *mut c_ulong,
552         pBuffer: *mut c_uchar,
553         pBstr: *mut LPSAFEARRAY,
554     ) -> *mut c_uchar;
LPSAFEARRAY_UserUnmarshal( pFlags: *mut c_ulong, pBuffer: *mut c_uchar, pBstr: *mut LPSAFEARRAY, ) -> *mut c_uchar555     pub fn LPSAFEARRAY_UserUnmarshal(
556         pFlags: *mut c_ulong,
557         pBuffer: *mut c_uchar,
558         pBstr: *mut LPSAFEARRAY,
559     ) -> *mut c_uchar;
LPSAFEARRAY_UserFree( pFlags: *mut c_ulong, pBstr: *mut LPSAFEARRAY, )560     pub fn LPSAFEARRAY_UserFree(
561         pFlags: *mut c_ulong,
562         pBstr: *mut LPSAFEARRAY,
563     );
564 }
565