summaryrefslogtreecommitdiffstats
path: root/public/sdk/inc/wtypes.idl
blob: 8de4a9a9c61c085f0634600dfba5d3d4437c1cdd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1992 - 1996.
//
//  File: wtypes.idl
//
//  Contents: This interface definition contains typedefs for remotable
//            data types.
//
//  History:  09-May-96  MikeHill  Updated VARENUM comments.
//            22-May-96  MikeHill  Added FMTID defintions/macros.
//            06-Jun-96  MikeHill  Added CBPCLIPDATA macro.
//
//--------------------------------------------------------------------------

cpp_quote("//+-------------------------------------------------------------------------")
cpp_quote("//")
cpp_quote("//  Microsoft Windows")
cpp_quote("//  Copyright (C) Microsoft Corporation, 1992 - 1996.")
cpp_quote("//")
cpp_quote("//--------------------------------------------------------------------------")

[ uuid(D3980A60-910C-1068-9341-00DD010F2F1C),
  version(0.1), pointer_default(unique) ]

interface IWinTypes
{

typedef struct tagRemHGLOBAL
{
        long fNullHGlobal;
        unsigned long cbData;
        [size_is(cbData)] byte data[];
} RemHGLOBAL;

typedef struct tagRemHMETAFILEPICT
{
        long        mm;
        long        xExt;
        long        yExt;
        unsigned long cbData;
        [size_is(cbData)] byte data[];
} RemHMETAFILEPICT;


typedef struct tagRemHENHMETAFILE
{
        unsigned long cbData;
        [size_is(cbData)] byte data[];
} RemHENHMETAFILE;

typedef struct tagRemHBITMAP
{
        unsigned long cbData;
        [size_is(cbData)] byte data[];
} RemHBITMAP;

typedef struct tagRemHPALETTE
{
        unsigned long cbData;
        [size_is(cbData)] byte data[];
} RemHPALETTE;

typedef struct tagRemBRUSH
{
        unsigned long cbData;
        [size_is(cbData)] byte data[];
} RemHBRUSH;

cpp_quote("#if !defined(_WIN32) && !defined(_MPPC_)" )
cpp_quote("// The following code is for Win16 only")

cpp_quote("#ifndef WINAPI          // If not included with 3.1 headers...")

cpp_quote("#define FAR             _far")
cpp_quote("#define PASCAL          _pascal")
cpp_quote("#define CDECL           _cdecl")

cpp_quote("#define VOID            void")
cpp_quote("#define WINAPI      FAR PASCAL")
cpp_quote("#define CALLBACK    FAR PASCAL")


cpp_quote("#ifndef FALSE")
cpp_quote("#define FALSE 0")
cpp_quote("#define TRUE 1")
cpp_quote("#endif // !FALSE")

cpp_quote("#ifndef _BYTE_DEFINED")
cpp_quote("#define _BYTE_DEFINED")
typedef unsigned char BYTE;
cpp_quote("#endif // !_BYTE_DEFINED")

cpp_quote("#ifndef _WORD_DEFINED")
cpp_quote("#define _WORD_DEFINED")
typedef unsigned short WORD;
cpp_quote("#endif // !_WORD_DEFINED")

typedef unsigned int UINT;
typedef int  INT;
typedef long BOOL;

cpp_quote("#ifndef _LONG_DEFINED")
cpp_quote("#define _LONG_DEFINED")
typedef long LONG;
cpp_quote("#endif // !_LONG_DEFINED")

cpp_quote("#ifndef _WPARAM_DEFINED")
cpp_quote("#define _WPARAM_DEFINED")
typedef UINT WPARAM;
cpp_quote("#endif // _WPARAM_DEFINED")

cpp_quote("#ifndef _DWORD_DEFINED")
cpp_quote("#define _DWORD_DEFINED")
typedef unsigned long DWORD;
cpp_quote("#endif // !_DWORD_DEFINED")

cpp_quote("#ifndef _LPARAM_DEFINED")
cpp_quote("#define _LPARAM_DEFINED")
typedef LONG LPARAM;//BUGBUG: this should be a discriminated union.
cpp_quote("#endif // !_LPARAM_DEFINED")

cpp_quote("#ifndef _LRESULT_DEFINED")
cpp_quote("#define _LRESULT_DEFINED")
typedef LONG LRESULT;
cpp_quote("#endif // !_LRESULT_DEFINED")

typedef void * HANDLE;
#define DECLARE_WIREM_HANDLE(name)  \
                             typedef [wire_marshal(wire ## name)] void * name
#define DECLARE_HANDLE(name) typedef void * name

DECLARE_HANDLE(HMODULE);
DECLARE_HANDLE(HINSTANCE);
DECLARE_HANDLE(HRGN);
DECLARE_HANDLE(HTASK);
DECLARE_HANDLE(HKEY);

DECLARE_HANDLE(HDESK);

DECLARE_HANDLE(HMF);
DECLARE_HANDLE(HEMF);

DECLARE_HANDLE(HPEN);
DECLARE_HANDLE(HRSRC);
DECLARE_HANDLE(HSTR);
DECLARE_HANDLE(HWINSTA);
DECLARE_HANDLE(HKL);
DECLARE_HANDLE(HGDIOBJ);

typedef HANDLE HDWP;

cpp_quote("#ifndef _HFILE_DEFINED")
cpp_quote("#define _HFILE_DEFINED")
typedef INT HFILE;      /* Polymorphic with C runtime file handle type */
cpp_quote("#endif // !_HFILE_DEFINED")


cpp_quote("#ifndef _LPWORD_DEFINED")
cpp_quote("#define _LPWORD_DEFINED")
typedef WORD *LPWORD;
cpp_quote("#endif // !_LPWORD_DEFINED")


cpp_quote("#ifndef _LPDWORD_DEFINED")
cpp_quote("#define _LPDWORD_DEFINED")
typedef DWORD *LPDWORD;
cpp_quote("#endif // !_LPDWORD_DEFINED")


typedef char CHAR;
typedef [string] CHAR *LPSTR;
typedef [string] const CHAR *LPCSTR;


cpp_quote("#ifndef _WCHAR_DEFINED")
cpp_quote("#define _WCHAR_DEFINED")
typedef wchar_t WCHAR;
typedef WCHAR   TCHAR;
cpp_quote("#endif // !_WCHAR_DEFINED")

typedef [string] WCHAR *LPWSTR;


typedef [string] TCHAR *LPTSTR;

typedef [string] const WCHAR *LPCWSTR;
typedef [string] const TCHAR *LPCTSTR;


typedef struct tagPALETTEENTRY {
    BYTE        peRed;
    BYTE        peGreen;
    BYTE        peBlue;
    BYTE        peFlags;
} PALETTEENTRY, *PPALETTEENTRY, *LPPALETTEENTRY;

// Logical Palette
cpp_quote("#if 0")

    typedef struct tagLOGPALETTE {
        WORD        palVersion;
        WORD        palNumEntries;
        [size_is(palNumEntries)] PALETTEENTRY        palPalEntry[];
    } LOGPALETTE, *PLOGPALETTE, *LPLOGPALETTE;

cpp_quote("#else")
cpp_quote("typedef struct tagLOGPALETTE {")
cpp_quote("    WORD        palVersion;")
cpp_quote("    WORD        palNumEntries;")
cpp_quote("    PALETTEENTRY        palPalEntry[1];")
cpp_quote("} LOGPALETTE, *PLOGPALETTE, *LPLOGPALETTE;")
cpp_quote("#endif")


cpp_quote("#ifndef _COLORREF_DEFINED")
cpp_quote("#define _COLORREF_DEFINED")
typedef DWORD COLORREF;
cpp_quote("#endif // !_COLORREF_DEFINED")

cpp_quote("#ifndef _LPCOLORREF_DEFINED")
cpp_quote("#define _LPCOLORREF_DEFINED")
typedef DWORD *LPCOLORREF;
cpp_quote("#endif // !_LPCOLORREF_DEFINED")


typedef HANDLE *LPHANDLE;

//typedefs for remotable types from wingdi.h

typedef struct _RECTL
{
    LONG    left;
    LONG    top;
    LONG    right;
    LONG    bottom;
} RECTL, *PRECTL, *LPRECTL;


typedef struct tagPOINT
{
    LONG  x;
    LONG  y;
} POINT, *PPOINT, *LPPOINT;

typedef struct _POINTL
{
    LONG  x;
    LONG  y;
} POINTL, *PPOINTL;


cpp_quote("#ifndef WIN16")
typedef struct tagSIZE
{
    LONG        cx;
    LONG        cy;
} SIZE, *PSIZE, *LPSIZE;
cpp_quote("#else // WIN16")
cpp_quote("typedef struct tagSIZE")
cpp_quote("{")
cpp_quote("    INT cx;")
cpp_quote("    INT cy;")
cpp_quote("} SIZE, *PSIZE, *LPSIZE;")
cpp_quote("#endif // WIN16")


typedef struct tagSIZEL
{
    LONG cx;
    LONG cy;
} SIZEL, *PSIZEL, *LPSIZEL;


cpp_quote("#endif  //WINAPI")
cpp_quote("#endif  //!WIN32 && !MPPC")

cpp_quote("#if defined(_WIN32) && !defined(OLE2ANSI)")

typedef WCHAR                   OLECHAR;
typedef [string] OLECHAR       *LPOLESTR;
typedef [string] const OLECHAR *LPCOLESTR;
cpp_quote("#define OLESTR(str) L##str")

cpp_quote("")
cpp_quote("#else")
cpp_quote("")

cpp_quote("typedef char      OLECHAR;")
cpp_quote("typedef LPSTR     LPOLESTR;")
cpp_quote("typedef LPCSTR    LPCOLESTR;")
cpp_quote("#define OLESTR(str) str")

cpp_quote("#endif")


// This block contains types that are normally defined by the nt sdk in WINDEF.H
// but we need them here for definitions that follow in this file.  If WINDEF.H
// hasn't been included then we need to define them now so that WTYPES.H
// will compile.
cpp_quote("#ifndef _WINDEF_")
typedef const RECTL *LPCRECTL;

typedef void * PVOID, * LPVOID;
typedef float   FLOAT;

typedef struct tagRECT
{
    LONG    left;
    LONG    top;
    LONG    right;
    LONG    bottom;
} RECT, *PRECT, *LPRECT;
typedef const RECT *LPCRECT;

cpp_quote("#endif  //_WINDEF_")


typedef unsigned char   UCHAR;
typedef short           SHORT;
typedef unsigned short  USHORT;
typedef DWORD           ULONG;
typedef double          DOUBLE;

cpp_quote("#ifndef _DWORDLONG_")
typedef unsigned __int64 DWORDLONG;
typedef DWORDLONG *PDWORDLONG;
cpp_quote("#endif // !_DWORDLONG_")

//
// __int64 is only supported by 2.0 and later midl.
// __midl is set by the 2.0 midl and not by 1.0 midl.
//

cpp_quote("#ifndef _ULONGLONG_")

#if (defined(__midl))
typedef __int64 LONGLONG;
typedef unsigned __int64 ULONGLONG;
#else
typedef double LONGLONG;
typedef double ULONGLONG;
#endif

typedef LONGLONG *PLONGLONG;
typedef ULONGLONG *PULONGLONG;
cpp_quote("#endif // _ULONGLONG_")

// just for local wtypes
cpp_quote("#if 0")

typedef struct _LARGE_INTEGER {
    LONGLONG QuadPart;
} LARGE_INTEGER;

typedef LARGE_INTEGER *PLARGE_INTEGER;

typedef struct _ULARGE_INTEGER {
    ULONGLONG QuadPart;
} ULARGE_INTEGER;

// just for local wtypes
cpp_quote("#endif // 0")


cpp_quote("#ifndef _WINBASE_")

cpp_quote("#ifndef _FILETIME_")
cpp_quote("#define _FILETIME_")
typedef struct _FILETIME
{
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME, *PFILETIME, *LPFILETIME;
cpp_quote("#endif // !_FILETIME")

cpp_quote("#ifndef _SYSTEMTIME_")
cpp_quote("#define _SYSTEMTIME_")
typedef struct _SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;

cpp_quote("#endif // !_SYSTEMTIME")

cpp_quote("#ifndef _SECURITY_ATTRIBUTES_")
cpp_quote("#define _SECURITY_ATTRIBUTES_")
typedef struct _SECURITY_ATTRIBUTES {
    DWORD nLength;
    [size_is(nLength)] LPVOID lpSecurityDescriptor;
    BOOL bInheritHandle;
} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
cpp_quote("#endif // !_SECURITY_ATTRIBUTES_")

cpp_quote("#ifndef SECURITY_DESCRIPTOR_REVISION")

typedef USHORT SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;

typedef PVOID PSID;     // winnt

typedef struct _ACL {
    UCHAR AclRevision;
    UCHAR Sbz1;
    USHORT AclSize;
    USHORT AceCount;
    USHORT Sbz2;
} ACL;
typedef ACL *PACL;

typedef struct _SECURITY_DESCRIPTOR {
    UCHAR Revision;
    UCHAR Sbz1;
    SECURITY_DESCRIPTOR_CONTROL Control;
    PSID Owner;
    PSID Group;
    PACL Sacl;
    PACL Dacl;
} SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;

cpp_quote("#endif // !SECURITY_DESCRIPTOR_REVISION")

cpp_quote("#endif //_WINBASE_")

typedef struct _COAUTHIDENTITY
{
  [size_is(UserLength+1)] USHORT *      User;
  ULONG                                 UserLength;
  [size_is(DomainLength+1)] USHORT *    Domain;
  ULONG                                 DomainLength;
  [size_is(PasswordLength+1)] USHORT *  Password;
  ULONG                                 PasswordLength;
  ULONG                                 Flags;
} COAUTHIDENTITY;

typedef struct _COAUTHINFO
{
    DWORD               dwAuthnSvc;
    DWORD               dwAuthzSvc;
    LPWSTR              pwszServerPrincName;
    DWORD               dwAuthnLevel;
    DWORD               dwImpersonationLevel;
    COAUTHIDENTITY *    pAuthIdentityData;
    DWORD               dwCapabilities;
} COAUTHINFO;

typedef struct _COSERVERINFO
{
    DWORD           dwReserved1;
    LPWSTR          pwszName;
    COAUTHINFO *    pAuthInfo;
    DWORD           dwReserved2;
} COSERVERINFO;

//
// SCODE, HRESULT
//
//
//  Status values are 32 bit values layed out as follows:
//
//   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
//   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
//  +-+-----------------------------+-------------------------------+
//  |S|       Facility              |               Code            |
//  +-+-----------------------------+-------------------------------+
//
//  where
//
//      S - is the severity code
//
//          0 - Success
//          1 - Error
//
//
//      Facility - is the facility code
//
//      Code - is the facility's status code
//
// SCODE and HRESULT are mktyplib base types.
//
typedef LONG SCODE;
cpp_quote("#ifndef _HRESULT_DEFINED")
cpp_quote("#define _HRESULT_DEFINED")
#if defined(_STRICT_HRESULT)
typedef struct _HRESULT_STRUCT {
        DWORD Data1;
} HRESULT_STRUCT, *PHRESULT_STRUCT;
typedef PHRESULT_STRUCT HRESULT;
#else // defined(_STRICT_HRESULT)
typedef LONG HRESULT;
#endif // defined(_STRICT_HRESULT)
cpp_quote("#endif // !_HRESULT_DEFINED")

typedef SCODE *PSCODE;


cpp_quote("#ifndef GUID_DEFINED")
cpp_quote("#define GUID_DEFINED")
typedef struct _GUID
{
    DWORD Data1;
    WORD  Data2;
    WORD  Data3;
    BYTE  Data4[8];
} GUID;
cpp_quote("#endif // !GUID_DEFINED")

cpp_quote("#if !defined( __LPGUID_DEFINED__ )")
cpp_quote("#define __LPGUID_DEFINED__")
typedef GUID *LPGUID;
cpp_quote("#endif // !__LPGUID_DEFINED__")

cpp_quote("#ifndef __OBJECTID_DEFINED")
cpp_quote("#define __OBJECTID_DEFINED")
cpp_quote("#define _OBJECTID_DEFINED")
typedef struct _OBJECTID     // NOTE!! Order of structure members is important for OFS
{                            // enumeration.
   GUID Lineage;             // Unique for objects copied from same original and copies of.
   unsigned long Uniquifier; // Random, to provide uniqueness within small set with same
} OBJECTID;                  // lineage id.
cpp_quote("#endif // !_OBJECTID_DEFINED")




cpp_quote("#if !defined( __IID_DEFINED__ )")
cpp_quote("#define __IID_DEFINED__")

// Interface ID are just a kind of GUID
typedef GUID IID;
typedef IID *LPIID;
cpp_quote("#define IID_NULL            GUID_NULL")
cpp_quote("#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)")

// Class ID are just a kind of GUID
typedef GUID CLSID;
typedef              CLSID *LPCLSID;
cpp_quote("#define CLSID_NULL          GUID_NULL")
cpp_quote("#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)")

// Format ID are just a kind of GUID
typedef GUID FMTID;
typedef              FMTID *LPFMTID;
cpp_quote("#define FMTID_NULL          GUID_NULL")
cpp_quote("#define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)")

//The following typedefs are used internally by MIDL.
cpp_quote("#if 0")
#if defined(__midl)
    /* MIDL 2.0 definitions */
    typedef GUID *REFGUID;
    typedef IID *REFIID;
    typedef CLSID *REFCLSID;
    typedef FMTID *REFFMTID;
#else
    /* MIDL 1.1 definitions */
    typedef GUID REFGUID;
    typedef IID REFIID;
    typedef CLSID REFCLSID;
    typedef FMTID REFFMTID;
#endif
cpp_quote("#endif // 0")

cpp_quote("#if defined(__cplusplus)")

cpp_quote("#ifndef _REFGUID_DEFINED")
cpp_quote("#define _REFGUID_DEFINED")
cpp_quote("#define REFGUID             const GUID &")
cpp_quote("#endif // !_REFGUID_DEFINED")

cpp_quote("#ifndef _REFIID_DEFINED")
cpp_quote("#define _REFIID_DEFINED")
cpp_quote("#define REFIID              const IID &")
cpp_quote("#endif // !_REFIID_DEFINED")

cpp_quote("#ifndef _REFCLSID_DEFINED")
cpp_quote("#define _REFCLSID_DEFINED")
cpp_quote("#define REFCLSID            const CLSID &")
cpp_quote("#endif // !_REFCLSID_DEFINED")

cpp_quote("#ifndef _REFFMTID_DEFINED")
cpp_quote("#define _REFFMTID_DEFINED")
cpp_quote("#define REFFMTID            const FMTID &")
cpp_quote("#endif // !_REFFMTID_DEFINED")


cpp_quote("#else // !__cplusplus")

cpp_quote("#ifndef _REFGUID_DEFINED")
cpp_quote("#define _REFGUID_DEFINED")
cpp_quote("#define REFGUID             const GUID * const")
cpp_quote("#endif // !_REFGUID_DEFINED")

cpp_quote("#ifndef _REFIID_DEFINED")
cpp_quote("#define _REFIID_DEFINED")
cpp_quote("#define REFIID              const IID * const")
cpp_quote("#endif // !_REFIID_DEFINED")


cpp_quote("#ifndef _REFCLSID_DEFINED")
cpp_quote("#define _REFCLSID_DEFINED")
cpp_quote("#define REFCLSID            const CLSID * const")
cpp_quote("#endif // !_REFCLSID_DEFINED")

cpp_quote("#ifndef _REFFMTID_DEFINED")
cpp_quote("#define _REFFMTID_DEFINED")
cpp_quote("#define REFFMTID            const FMTID * const")
cpp_quote("#endif // !_REFFMTID_DEFINED")

cpp_quote("#endif // !__cplusplus")

cpp_quote("#endif // !__IID_DEFINED__")

/************************* Misc types ***********************************/

// Common typdefs used in API paramaters, gleamed from compobj.h

// memory context values; passed to CoGetMalloc
typedef enum tagMEMCTX
{
    MEMCTX_TASK = 1,            // task (private) memory
    MEMCTX_SHARED = 2,          // shared memory (between processes)
    MEMCTX_MACSYSTEM = 3,       // on the mac, the system heap
    // these are mostly for internal use...
    MEMCTX_UNKNOWN = -1,        // unknown context (when asked about it)
    MEMCTX_SAME = -2,           // same context (as some other pointer)
} MEMCTX;


// For IRunningObjectTable::Register
cpp_quote("#ifndef _ROTFLAGS_DEFINED")
cpp_quote("#define _ROTFLAGS_DEFINED")
cpp_quote("#define ROTFLAGS_REGISTRATIONKEEPSALIVE 0x1")
cpp_quote("#define ROTFLAGS_ALLOWANYCLIENT 0x2")
cpp_quote("#endif // !_ROTFLAGS_DEFINED")

// Maximum size of comparison buffer for IROTData::GetComparisonData
cpp_quote("#ifndef _ROT_COMPARE_MAX_DEFINED")
cpp_quote("#define _ROT_COMPARE_MAX_DEFINED")
cpp_quote("#define ROT_COMPARE_MAX 2048")
cpp_quote("#endif // !_ROT_COMPARE_MAX_DEFINED")


// class context: used to determine what scope and kind of class object to use
// NOTE: this is a bitwise enum
typedef enum tagCLSCTX
{
    CLSCTX_INPROC_SERVER = 0x01,   // server dll (runs in same process as caller)
    CLSCTX_INPROC_HANDLER = 0x02,  // handler dll (runs in same process as caller)
    CLSCTX_LOCAL_SERVER = 0x04,    // server exe (runs on same machine; diff proc)
    CLSCTX_INPROC_SERVER16 = 0x08, // 16-bit server dll (runs in same process as caller)
    CLSCTX_REMOTE_SERVER = 0x10,    // remote server exe (runs on different machine)
    CLSCTX_INPROC_HANDLER16 = 0x20, // 16-bit handler dll (runs in same process as caller)
    CLSCTX_INPROC_SERVERX86 = 0x40, // Wx86 server dll (runs in same process as caller)
    CLSCTX_INPROC_HANDLERX86 = 0x80, // Wx86 handler dll (runs in same process as caller)
} CLSCTX;


    // marshaling flags; passed to CoMarshalInterface
    typedef enum tagMSHLFLAGS
    {
        MSHLFLAGS_NORMAL = 0,       // normal marshaling via proxy/stub
        MSHLFLAGS_TABLESTRONG = 1,  // keep object alive; must explicitly release
        MSHLFLAGS_TABLEWEAK = 2,    // doesn't hold object alive; still must release
        MSHLFLAGS_NOPING = 4        // remote clients dont 'ping' to keep objects alive
    } MSHLFLAGS;


// marshal context: determines the destination context of the marshal operation
typedef enum tagMSHCTX
{
    MSHCTX_LOCAL = 0,           // unmarshal context is local (eg.shared memory)
    MSHCTX_NOSHAREDMEM = 1,     // unmarshal context has no shared memory access
    MSHCTX_DIFFERENTMACHINE = 2,// unmarshal context is on a different machine
    MSHCTX_INPROC = 3,          // unmarshal context is on different thread
} MSHCTX;


//
// Common typedefs for paramaters used in data view API's, gleamed
// from dvobj.h
//

// Data/View aspect; specifies the desired aspect of the object when
// drawing or getting data.
typedef enum tagDVASPECT
{
    DVASPECT_CONTENT = 1,
    DVASPECT_THUMBNAIL = 2,
    DVASPECT_ICON = 4,
    DVASPECT_DOCPRINT = 8
} DVASPECT;

/****** Storage types *************************************************/


/* Storage commit types */
typedef enum tagSTGC
{
    STGC_DEFAULT        = 0,
    STGC_OVERWRITE      = 1,
    STGC_ONLYIFCURRENT  = 2,
    STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4
} STGC;


typedef enum tagSTGMOVE
{
    STGMOVE_MOVE    = 0,
    STGMOVE_COPY    = 1,
    STGMOVE_SHALLOWCOPY = 2
} STGMOVE;

typedef enum tagSTATFLAG
{
    STATFLAG_DEFAULT = 0,
    STATFLAG_NONAME = 1,
    STATFLAG_NOOPEN = 2
} STATFLAG;


typedef [context_handle] void *HCONTEXT;

/****** Critical Section Wrappers ***********************************/


/* if not already picked up from olenls.h */
cpp_quote("#ifndef _LCID_DEFINED")
cpp_quote("#define _LCID_DEFINED")
typedef DWORD LCID;
cpp_quote("#endif // !_LCID_DEFINED")

// #######################################################################
//
//  User marshal support for Windows data types.

//
//  Frequently used helpers: sized blobs
//
//      Never put [user_marshal] or [wire_marshal] on the helpers directly.
//

// Simple blobs.

typedef struct _BYTE_BLOB {
                        unsigned long   clSize;
    [size_is(clSize)]   byte            abData[];
} BYTE_BLOB;

typedef [unique] BYTE_BLOB * UP_BYTE_BLOB;

typedef struct _WORD_BLOB {
                        unsigned long   clSize;
    [size_is(clSize)]   unsigned short  asData[];
} WORD_BLOB;

typedef [unique] WORD_BLOB * UP_WORD_BLOB;

typedef struct _DWORD_BLOB {
                        unsigned long   clSize;
    [size_is(clSize)]   unsigned long   alData[];
} DWORD_BLOB;

typedef [unique] DWORD_BLOB * UP_DWORD_BLOB;

// Flagged blobs.

typedef struct _FLAGGED_BYTE_BLOB {
                        unsigned long   fFlags;
                        unsigned long   clSize;
    [size_is(clSize)]   byte            abData[];
} FLAGGED_BYTE_BLOB;

typedef [unique] FLAGGED_BYTE_BLOB * UP_FLAGGED_BYTE_BLOB;

typedef struct _FLAGGED_WORD_BLOB {
                        unsigned long   fFlags;
                        unsigned long   clSize;
    [size_is(clSize)]   unsigned short  asData[];
} FLAGGED_WORD_BLOB;

typedef [unique] FLAGGED_WORD_BLOB * UP_FLAGGED_WORD_BLOB;

// Frequently used helpers with sized pointers.

typedef struct _BYTE_SIZEDARR {
                        unsigned long   clSize;
    [size_is(clSize)]   byte     *      pData ;
} BYTE_SIZEDARR;

typedef struct _SHORT_SIZEDARR {
                        unsigned long   clSize;
    [size_is(clSize)]   unsigned short* pData ;
} WORD_SIZEDARR;

typedef struct _LONG_SIZEDARR {
                        unsigned long   clSize;
    [size_is(clSize)]   unsigned long * pData ;
} DWORD_SIZEDARR;

typedef struct _HYPER_SIZEDARR {
                        unsigned long   clSize;
    [size_is(clSize)]   hyper         * pData ;
} HYPER_SIZEDARR;


// #########################################################################
//
//   Constants for the call context
//

const unsigned long WDT_INPROC_CALL = 0x48746457;
const unsigned long WDT_REMOTE_CALL = 0x52746457;


// #########################################################################
//
//  CLIPFORMAT
//

typedef union _userCLIPFORMAT switch(long fContext) u
{
    case WDT_INPROC_CALL:            DWORD     dwValue;
    case WDT_REMOTE_CALL:   [string] wchar_t * pwszName;
} userCLIPFORMAT;

typedef [unique] userCLIPFORMAT *  wireCLIPFORMAT;

typedef [wire_marshal(wireCLIPFORMAT)] WORD  CLIPFORMAT;


// #########################################################################
//
//  Good for most of the gdi handles.

typedef union _GDI_NONREMOTE switch( long fContext ) u
{
    case WDT_INPROC_CALL:   long        hInproc;
    case WDT_REMOTE_CALL:   DWORD_BLOB *hRemote;
} GDI_NONREMOTE;

// #########################################################################
//
//  HGLOBAL
//
// A global may be Null or may be non-NULL with 0 length.

typedef union _userHGLOBAL switch( long fContext ) u
{
    case WDT_INPROC_CALL:   long            hInproc;
    case WDT_REMOTE_CALL:   FLAGGED_BYTE_BLOB *     hRemote;
    default:                long            hGlobal;
} userHGLOBAL;

typedef [unique] userHGLOBAL       * wireHGLOBAL;

// #########################################################################
//
//  HMETAFILE
//

typedef union _userHMETAFILE switch( long fContext ) u
{
    case WDT_INPROC_CALL:   long            hInproc;
    case WDT_REMOTE_CALL:   BYTE_BLOB *     hRemote;
    default:                long            hGlobal;
} userHMETAFILE;

// #########################################################################
//
//  HMETAFILEPICT
//
typedef struct _remoteMETAFILEPICT
{
    long            mm;
    long            xExt;
    long            yExt;
    userHMETAFILE * hMF;
} remoteMETAFILEPICT;

typedef union _userHMETAFILEPICT switch( long fContext ) u
{
    case WDT_INPROC_CALL:   long                hInproc;
    case WDT_REMOTE_CALL:   remoteMETAFILEPICT* hRemote;
    default:                long                hGlobal;
} userHMETAFILEPICT;

// #########################################################################
//
//  HENHMETAFILE
//

typedef union _userHENHMETAFILE switch( long fContext ) u
{
    case WDT_INPROC_CALL:   long            hInproc;
    case WDT_REMOTE_CALL:   BYTE_BLOB *     hRemote;
    default:                long            hGlobal;
} userHENHMETAFILE;

// #########################################################################
//
//  HBITMAP
//

// RemHBITMAP was just a byte blob, but the whole bitmap structure was copied
// at the beginning of the buffer.

// So, we take BITMAP fields from wingdi.x

typedef struct _userBITMAP
{
    LONG            bmType;
    LONG            bmWidth;
    LONG            bmHeight;
    LONG            bmWidthBytes;
    WORD            bmPlanes;
    WORD            bmBitsPixel;
    ULONG                       cbSize;
    [size_is(cbSize)]   byte    pBuffer[];
} userBITMAP;


typedef union _userHBITMAP switch( long fContext ) u
{
    case WDT_INPROC_CALL:   long            hInproc;
    case WDT_REMOTE_CALL:   userBITMAP *    hRemote;
    default:                long            hGlobal;
} userHBITMAP;

// #########################################################################
//
//  HPALETTE
//

// PALETTEENTRY is in wingdi.x, it is a struct with 4 bytes.
// LOGPALETTE   is in wingdi.x, it is a conf struct with paletteentries and
//                                    a version field

typedef struct tagrpcLOGPALETTE {
    WORD                        palVersion;
    WORD                        palNumEntries;
    [size_is( palNumEntries )]  PALETTEENTRY        palPalEntry[];
} rpcLOGPALETTE;

typedef union _userHPALETTE switch( long fContext ) u
{
    case WDT_INPROC_CALL:   long            hInproc;
    case WDT_REMOTE_CALL:   rpcLOGPALETTE * hRemote;
    default:                long            hGlobal;
} userHPALETTE;


// #########################################################################
//
//  Handles passed locally as longs.
//

typedef union _RemotableHandle switch( long fContext ) u
{
    case WDT_INPROC_CALL:   long   hInproc;
    case WDT_REMOTE_CALL:   long   hRemote;
} RemotableHandle;

typedef [unique] RemotableHandle * wireHWND;
typedef [unique] RemotableHandle * wireHMENU;
typedef [unique] RemotableHandle * wireHACCEL;
typedef [unique] RemotableHandle * wireHBRUSH;
typedef [unique] RemotableHandle * wireHFONT;
typedef [unique] RemotableHandle * wireHDC;
typedef [unique] RemotableHandle * wireHICON;


cpp_quote("#if 0")
#ifndef _MIDL_DECLARE_WIREM_HANDLE
DECLARE_WIREM_HANDLE( HWND );
DECLARE_WIREM_HANDLE( HMENU );
DECLARE_WIREM_HANDLE( HACCEL );
DECLARE_WIREM_HANDLE( HBRUSH );
DECLARE_WIREM_HANDLE( HFONT );
DECLARE_WIREM_HANDLE( HDC );
DECLARE_WIREM_HANDLE( HICON );
#endif

cpp_quote("#ifndef _HCURSOR_DEFINED")
cpp_quote("#define _HCURSOR_DEFINED")
typedef HICON HCURSOR;      /* HICONs & HCURSORs are polymorphic */
cpp_quote("#endif // !_HCURSOR_DEFINED")

cpp_quote("/* tagTEXTMETRICW was copied from wingdi.h for MIDL */")
typedef struct tagTEXTMETRICW {
    LONG  tmHeight;
    LONG  tmAscent;
    LONG  tmDescent;
    LONG  tmInternalLeading;
    LONG  tmExternalLeading;
    LONG  tmAveCharWidth;
    LONG  tmMaxCharWidth;
    LONG  tmWeight;
    LONG  tmOverhang;
    LONG  tmDigitizedAspectX;
    LONG  tmDigitizedAspectY;
    WCHAR tmFirstChar;
    WCHAR tmLastChar;
    WCHAR tmDefaultChar;
    WCHAR tmBreakChar;
    BYTE  tmItalic;
    BYTE  tmUnderlined;
    BYTE  tmStruckOut;
    BYTE  tmPitchAndFamily;
    BYTE  tmCharSet;
} TEXTMETRICW;

cpp_quote("#endif //0")

cpp_quote("#ifndef _WIN32           // The following code is for Win16 only")
cpp_quote("#ifndef WINAPI          // If not included with 3.1 headers...")

// Message structure

typedef struct tagMSG {
    HWND        hwnd;
    UINT        message;
    WPARAM      wParam;
    LPARAM      lParam;
    DWORD       time;
    POINT       pt;
} MSG, *PMSG, *NPMSG, *LPMSG;
cpp_quote("#endif // _WIN32")
cpp_quote("#endif // WINAPI")


typedef [unique] userHBITMAP      * wireHBITMAP;
typedef [unique] userHPALETTE     * wireHPALETTE;
typedef [unique] userHENHMETAFILE * wireHENHMETAFILE;
typedef [unique] userHMETAFILE    * wireHMETAFILE;
typedef [unique] userHMETAFILEPICT* wireHMETAFILEPICT;

cpp_quote("#if 0")

DECLARE_WIREM_HANDLE( HGLOBAL );
typedef HGLOBAL HLOCAL;

DECLARE_WIREM_HANDLE( HBITMAP );
DECLARE_WIREM_HANDLE( HPALETTE );
DECLARE_WIREM_HANDLE( HENHMETAFILE );
DECLARE_WIREM_HANDLE( HMETAFILE );
cpp_quote("#endif //0")

DECLARE_WIREM_HANDLE( HMETAFILEPICT );

}

// #########################################################################
//

typedef double DATE;

/* This is a helper struct for use in handling currency. */
cpp_quote("#ifndef _tagCY_DEFINED")
cpp_quote("#define _tagCY_DEFINED")
cpp_quote("#define _CY_DEFINED")

cpp_quote("#if 0")

cpp_quote("/* the following isn't the real definition of CY, but it is */")
cpp_quote("/* what RPC knows how to remote */")
typedef struct tagCY {
    LONGLONG    int64;
} CY;


cpp_quote("#else /* 0 */")

cpp_quote("/* real definition that makes the C++ compiler happy */")
cpp_quote("typedef union tagCY {")
cpp_quote("    struct {")
cpp_quote("#ifdef _MAC")
cpp_quote("        long      Hi;")
cpp_quote("        long Lo;")
cpp_quote("#else")
cpp_quote("        unsigned long Lo;")
cpp_quote("        long      Hi;")
cpp_quote("#endif")
cpp_quote("    };")
cpp_quote("    LONGLONG int64;")
cpp_quote("} CY;")
cpp_quote("#endif /* 0 */")

cpp_quote("#endif /* _tagCY_DEFINED */")

cpp_quote("#if 0 /* _tagDEC_DEFINED */")
cpp_quote("/* The following isn't the real definition of Decimal type, */")
cpp_quote("/* but it is what RPC knows how to remote */")

typedef struct tagDEC {
    USHORT wReserved;
    BYTE  scale;
    BYTE  sign;
    ULONG Hi32;
    ULONGLONG Lo64;
} DECIMAL;

cpp_quote("#else /* _tagDEC_DEFINED */")

cpp_quote("/* real definition that makes the C++ compiler happy */")
cpp_quote("typedef struct tagDEC {")
cpp_quote("    USHORT wReserved;")
cpp_quote("    union {")
cpp_quote("        struct {")
cpp_quote("            BYTE scale;")
cpp_quote("            BYTE sign;")
cpp_quote("        };")
cpp_quote("        USHORT signscale;")
cpp_quote("    };")
cpp_quote("    ULONG Hi32;")
cpp_quote("    union {")
cpp_quote("        struct {")
cpp_quote("#ifdef _MAC")
cpp_quote("            ULONG Mid32;")
cpp_quote("            ULONG Lo32;")
cpp_quote("#else")
cpp_quote("            ULONG Lo32;")
cpp_quote("            ULONG Mid32;")
cpp_quote("#endif")
cpp_quote("        };")
cpp_quote("        ULONGLONG Lo64;")
cpp_quote("    };")
cpp_quote("} DECIMAL;")

cpp_quote("#define DECIMAL_NEG ((BYTE)0x80)")
cpp_quote("#define DECIMAL_SETZERO(dec) \\")
cpp_quote("        {(dec).Lo64 = 0; (dec).Hi32 = 0; (dec).signscale = 0;}")

cpp_quote("#endif /* _tagDEC_DEFINED */")

/* IDL declarations for BSTR how to transmit them */
//
typedef [unique] FLAGGED_WORD_BLOB * wireBSTR;
typedef [wire_marshal( wireBSTR )] OLECHAR *  BSTR;
typedef BSTR * LPBSTR;

cpp_quote("/* 0 == FALSE, -1 == TRUE */")
typedef short VARIANT_BOOL;
cpp_quote("#if !__STDC__ && (_MSC_VER <= 1000)")
cpp_quote("/* For backward compatibility */")
typedef VARIANT_BOOL _VARIANT_BOOL;
cpp_quote("#else")
cpp_quote("/* ANSI C/C++ reserve bool as keyword */")
cpp_quote("#define _VARIANT_BOOL    /##/")
cpp_quote("#endif")
typedef boolean BOOLEAN;

cpp_quote("/* The BSTRBLOB structure is used by some implementations */")
cpp_quote("/* of the IPropertyStorage interface when marshaling BSTRs */")
cpp_quote("/* on systems which don't support BSTR marshaling. */")

cpp_quote("#ifndef _tagBSTRBLOB_DEFINED")
cpp_quote("#define _tagBSTRBLOB_DEFINED")
typedef struct tagBSTRBLOB
{
                          ULONG   cbSize;
    [size_is(cbSize)]     BYTE    *pData;
} BSTRBLOB, *LPBSTRBLOB;
cpp_quote("#endif")

cpp_quote("#define VARIANT_TRUE ((VARIANT_BOOL)0xffff)")
cpp_quote("#define VARIANT_FALSE ((VARIANT_BOOL)0)")

cpp_quote("#ifndef _tagBLOB_DEFINED")
cpp_quote("#define _tagBLOB_DEFINED")
cpp_quote("#define _BLOB_DEFINED")
cpp_quote("#define _LPBLOB_DEFINED")
typedef struct tagBLOB {
    ULONG cbSize;
    [size_is(cbSize)]
    BYTE  *pBlobData;
} BLOB, * LPBLOB;
cpp_quote("#endif")

typedef struct tagCLIPDATA {
    ULONG cbSize;       // count that includes sizeof(ulClipFmt)
    long ulClipFmt;     // long to keep alignment
    [size_is(cbSize-4)]
    BYTE * pClipData;   // cbSize-sizeof(ULONG) bytes of data in clipboard format
} CLIPDATA;

cpp_quote("// Macro to calculate the size of the above pClipData")
cpp_quote("#define CBPCLIPDATA(clipdata)    ( (clipdata).cbSize - sizeof((clipdata).ulClipFmt) )")


typedef unsigned short VARTYPE;

// #########################################################################
//
//  VARTYPE
//
// #########################################################################


cpp_quote("/*")
cpp_quote(" * VARENUM usage key,")
cpp_quote(" *")
cpp_quote(" * * [V] - may appear in a VARIANT")
cpp_quote(" * * [T] - may appear in a TYPEDESC")
cpp_quote(" * * [P] - may appear in an OLE property set")
cpp_quote(" * * [S] - may appear in a Safe Array")
cpp_quote(" *")
cpp_quote(" *")
cpp_quote(" *  VT_EMPTY            [V]   [P]     nothing")
cpp_quote(" *  VT_NULL             [V]   [P]     SQL style Null")
cpp_quote(" *  VT_I2               [V][T][P][S]  2 byte signed int")
cpp_quote(" *  VT_I4               [V][T][P][S]  4 byte signed int")
cpp_quote(" *  VT_R4               [V][T][P][S]  4 byte real")
cpp_quote(" *  VT_R8               [V][T][P][S]  8 byte real")
cpp_quote(" *  VT_CY               [V][T][P][S]  currency")
cpp_quote(" *  VT_DATE             [V][T][P][S]  date")
cpp_quote(" *  VT_BSTR             [V][T][P][S]  OLE Automation string")
cpp_quote(" *  VT_DISPATCH         [V][T][P][S]  IDispatch *")
cpp_quote(" *  VT_ERROR            [V][T][P][S]  SCODE")
cpp_quote(" *  VT_BOOL             [V][T][P][S]  True=-1, False=0")
cpp_quote(" *  VT_VARIANT          [V][T][P][S]  VARIANT *")
cpp_quote(" *  VT_UNKNOWN          [V][T]   [S]  IUnknown *")
cpp_quote(" *  VT_DECIMAL          [V][T]   [S]  16 byte fixed point")
cpp_quote(" *  VT_I1                  [T]        signed char")
cpp_quote(" *  VT_UI1              [V][T][P][S]  unsigned char")
cpp_quote(" *  VT_UI2                 [T][P]     unsigned short")
cpp_quote(" *  VT_UI4                 [T][P]     unsigned short")
cpp_quote(" *  VT_I8                  [T][P]     signed 64-bit int")
cpp_quote(" *  VT_UI8                 [T][P]     unsigned 64-bit int")
cpp_quote(" *  VT_INT                 [T]        signed machine int")
cpp_quote(" *  VT_UINT                [T]        unsigned machine int")
cpp_quote(" *  VT_VOID                [T]        C style void")
cpp_quote(" *  VT_HRESULT             [T]        Standard return type")
cpp_quote(" *  VT_PTR                 [T]        pointer type")
cpp_quote(" *  VT_SAFEARRAY           [T]        (use VT_ARRAY in VARIANT)")
cpp_quote(" *  VT_CARRAY              [T]        C style array")
cpp_quote(" *  VT_USERDEFINED         [T]        user defined type")
cpp_quote(" *  VT_LPSTR               [T][P]     null terminated string")
cpp_quote(" *  VT_LPWSTR              [T][P]     wide null terminated string")
cpp_quote(" *  VT_FILETIME               [P]     FILETIME")
cpp_quote(" *  VT_BLOB                   [P]     Length prefixed bytes")
cpp_quote(" *  VT_STREAM                 [P]     Name of the stream follows")
cpp_quote(" *  VT_STORAGE                [P]     Name of the storage follows")
cpp_quote(" *  VT_STREAMED_OBJECT        [P]     Stream contains an object")
cpp_quote(" *  VT_STORED_OBJECT          [P]     Storage contains an object")
cpp_quote(" *  VT_BLOB_OBJECT            [P]     Blob contains an object")
cpp_quote(" *  VT_CF                     [P]     Clipboard format")
cpp_quote(" *  VT_CLSID                  [P]     A Class ID")

cpp_quote(" *  VT_VECTOR                 [P]     simple counted array")
cpp_quote(" *  VT_ARRAY            [V]           SAFEARRAY*")
cpp_quote(" *  VT_BYREF            [V]           void* for local use")
cpp_quote(" *  VT_BSTR_BLOB                      Reserved for system use")
cpp_quote(" */")

enum VARENUM
{
    VT_EMPTY           = 0,
    VT_NULL            = 1,
    VT_I2              = 2,
    VT_I4              = 3,
    VT_R4              = 4,
    VT_R8              = 5,
    VT_CY              = 6,
    VT_DATE            = 7,
    VT_BSTR            = 8,
    VT_DISPATCH        = 9,
    VT_ERROR           = 10,
    VT_BOOL            = 11,
    VT_VARIANT         = 12,
    VT_UNKNOWN         = 13,
    VT_DECIMAL         = 14,

    VT_I1              = 16,
    VT_UI1             = 17,
    VT_UI2             = 18,
    VT_UI4             = 19,
    VT_I8              = 20,
    VT_UI8             = 21,
    VT_INT             = 22,
    VT_UINT            = 23,
    VT_VOID            = 24,
    VT_HRESULT         = 25,
    VT_PTR             = 26,
    VT_SAFEARRAY       = 27,
    VT_CARRAY          = 28,
    VT_USERDEFINED     = 29,
    VT_LPSTR           = 30,
    VT_LPWSTR          = 31,

    VT_FILETIME        = 64,
    VT_BLOB            = 65,
    VT_STREAM          = 66,
    VT_STORAGE         = 67,
    VT_STREAMED_OBJECT = 68,
    VT_STORED_OBJECT   = 69,
    VT_BLOB_OBJECT     = 70,
    VT_CF              = 71,
    VT_CLSID           = 72,

    VT_BSTR_BLOB       = 0x0fff,

    VT_VECTOR          = 0x1000,
    VT_ARRAY           = 0x2000,
    VT_BYREF           = 0x4000,
    VT_RESERVED        = 0x8000,

    VT_ILLEGAL         = 0xffff,
    VT_ILLEGALMASKED   = 0x0fff,
    VT_TYPEMASK        = 0x0fff
};

// Property stuff
typedef ULONG PROPID;

// Access Control - ntseapi.h
cpp_quote( "#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED" )
cpp_quote( "#define SID_IDENTIFIER_AUTHORITY_DEFINED" )
typedef struct _SID_IDENTIFIER_AUTHORITY {
    UCHAR Value[6];
} SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
cpp_quote( "#endif" )

cpp_quote( "#ifndef SID_DEFINED" )
cpp_quote( "#define SID_DEFINED" )
typedef struct _SID {
   UCHAR Revision;
   UCHAR SubAuthorityCount;
   SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
   [size_is(SubAuthorityCount)] ULONG SubAuthority[*];
} SID, *PISID;
cpp_quote( "#endif" )