1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
7  * Source: $(DRUNTIMESRC core/sys/windows/_objbase.d)
8  */
9 module core.sys.windows.objbase;
10 version (Windows):
11 nothrow:
12 pragma(lib, "ole32");
13 
14 import core.sys.windows.cguid, core.sys.windows.objidl, core.sys.windows.unknwn, core.sys.windows.wtypes;
15 import core.sys.windows.basetyps, core.sys.windows.objfwd, core.sys.windows.rpcdce, core.sys.windows.winbase,
16   core.sys.windows.windef;
17 
18 // DAC: Not needed for D?
19 //MACRO #define LISet32(li, v) ((li).HighPart=(v)<0?-1:0, (li).LowPart=(v))
20 //MACRO #define ULISet32(li, v) ((li).HighPart=0, (li).LowPart=(v))
21 
22 enum CLSCTX_ALL    = CLSCTX.CLSCTX_INPROC_SERVER|CLSCTX.CLSCTX_INPROC_HANDLER|CLSCTX.CLSCTX_LOCAL_SERVER;
23 enum CLSCTX_INPROC = CLSCTX.CLSCTX_INPROC_SERVER|CLSCTX.CLSCTX_INPROC_HANDLER;
24 enum CLSCTX_SERVER = CLSCTX.CLSCTX_INPROC_SERVER|CLSCTX.CLSCTX_LOCAL_SERVER|CLSCTX.CLSCTX_REMOTE_SERVER;
25 enum MARSHALINTERFACE_MIN=500;
26 enum CWCSTORAGENAME=32;
27 
28 enum STGM_DIRECT           = 0;
29 enum STGM_TRANSACTED       = 0x10000L;
30 enum STGM_SIMPLE           = 0x8000000L;
31 enum STGM_READ             = 0;
32 enum STGM_WRITE            = 1;
33 enum STGM_READWRITE        = 2;
34 enum STGM_SHARE_DENY_NONE  = 0x40;
35 enum STGM_SHARE_DENY_READ  = 0x30;
36 enum STGM_SHARE_DENY_WRITE = 0x20;
37 enum STGM_SHARE_EXCLUSIVE  = 0x10;
38 enum STGM_PRIORITY         = 0x40000L;
39 enum STGM_DELETEONRELEASE  = 0x4000000;
40 enum STGM_NOSCRATCH        = 0x100000;
41 enum STGM_CREATE           = 0x1000;
42 enum STGM_CONVERT          = 0x20000;
43 enum STGM_NOSNAPSHOT       = 0x200000;
44 enum STGM_FAILIFTHERE      = 0;
45 
46 enum ASYNC_MODE_COMPATIBILITY = 1;
47 enum ASYNC_MODE_DEFAULT       = 0;
48 
49 enum STGTY_REPEAT = 256;
50 enum STG_TOEND = 0xFFFFFFFF;
51 enum STG_LAYOUT_SEQUENTIAL  = 0;
52 enum STG_LAYOUT_INTERLEAVED = 1;
53 
54 enum COM_RIGHTS_EXECUTE            = 1;
55 enum COM_RIGHTS_SAFE_FOR_SCRIPTING = 2;
56 
57 enum STGOPTIONS_VERSION = 2;
58 
59 enum STGFMT {
60     STGFMT_STORAGE = 0,
61     STGFMT_FILE = 3,
62     STGFMT_ANY = 4,
63     STGFMT_DOCFILE = 5
64 }
65 
66 struct STGOPTIONS {
67     USHORT usVersion;
68     USHORT reserved;
69     ULONG ulSectorSize;
70 const(WCHAR)* pwcsTemplateFile;
71 }
72 
73 enum REGCLS {
74     REGCLS_SINGLEUSE = 0,
75     REGCLS_MULTIPLEUSE = 1,
76     REGCLS_MULTI_SEPARATE = 2
77 }
78 
79 /*
80 BOOL IsEqualGUID(GUID rguid1, GUID rguid2) {
81     return rguid1 == rguid2;
82 }
83 */
84 
85 extern (Windows) BOOL IsEqualGUID(
86   REFGUID rguid1,
87   REFGUID rguid2
88 );
89 
90 alias IsEqualGUID IsEqualIID;
91 alias IsEqualGUID IsEqualCLSID;
92 
93 enum COINIT {
94     COINIT_APARTMENTTHREADED = 2,
95     COINIT_MULTITHREADED     = 0,
96     COINIT_DISABLE_OLE1DDE   = 4,
97     COINIT_SPEED_OVER_MEMORY = 8
98 }
99 
100 enum STDMSHLFLAGS {
101     SMEXF_SERVER  = 1,
102     SMEXF_HANDLER
103 }
104 
105 extern(Windows) {
106     alias HRESULT function(REFCLSID, REFIID, PVOID*) LPFNGETCLASSOBJECT;
107     alias HRESULT function() LPFNCANUNLOADNOW;
108 
109     DWORD CoBuildVersion();
110     HRESULT CoInitialize(PVOID);
111     HRESULT CoInitializeEx(LPVOID, DWORD);
112     void CoUninitialize();
113     HRESULT CoGetMalloc(DWORD, LPMALLOC*);
114     DWORD CoGetCurrentProcess();
115     HRESULT CoRegisterMallocSpy(LPMALLOCSPY);
116     HRESULT CoRevokeMallocSpy();
117     HRESULT CoCreateStandardMalloc(DWORD, IMalloc*);
118     //#ifdef DBG
119     ULONG DebugCoGetRpcFault();
120     void DebugCoSetRpcFault(ULONG);
121     //#endif
122     HRESULT CoGetClassObject(REFCLSID, DWORD, COSERVERINFO*, REFIID, PVOID*);
123     HRESULT CoRegisterClassObject(REFCLSID, LPUNKNOWN, DWORD, DWORD, PDWORD);
124     HRESULT CoRevokeClassObject(DWORD);
125     HRESULT CoGetMarshalSizeMax(ULONG*, REFIID, LPUNKNOWN, DWORD, PVOID, DWORD);
126     HRESULT CoMarshalInterface(LPSTREAM, REFIID, LPUNKNOWN, DWORD, PVOID, DWORD);
127     HRESULT CoUnmarshalInterface(LPSTREAM, REFIID, PVOID*);
128     HRESULT CoMarshalHresult(LPSTREAM, HRESULT);
129     HRESULT CoUnmarshalHresult(LPSTREAM, HRESULT*);
130     HRESULT CoReleaseMarshalData(LPSTREAM);
131     HRESULT CoDisconnectObject(LPUNKNOWN, DWORD);
132     HRESULT CoLockObjectExternal(LPUNKNOWN, BOOL, BOOL);
133     HRESULT CoGetStandardMarshal(REFIID, LPUNKNOWN, DWORD, PVOID, DWORD, LPMARSHAL*);
134     HRESULT CoGetStdMarshalEx(LPUNKNOWN, DWORD, LPUNKNOWN*);
135     BOOL CoIsHandlerConnected(LPUNKNOWN);
136     BOOL CoHasStrongExternalConnections(LPUNKNOWN);
137     HRESULT CoMarshalInterThreadInterfaceInStream(REFIID, LPUNKNOWN, LPSTREAM*);
138     HRESULT CoGetInterfaceAndReleaseStream(LPSTREAM, REFIID, PVOID*);
139     HRESULT CoCreateFreeThreadedMarshaler(LPUNKNOWN, LPUNKNOWN*);
140     HINSTANCE CoLoadLibrary(LPOLESTR, BOOL);
141     void CoFreeLibrary(HINSTANCE);
142     void CoFreeAllLibraries();
143     void CoFreeUnusedLibraries();
144     HRESULT CoCreateInstance(REFCLSID, LPUNKNOWN, DWORD, REFIID, PVOID*);
145     HRESULT CoCreateInstanceEx(REFCLSID, IUnknown, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
146     HRESULT StringFromCLSID(REFCLSID, LPOLESTR*);
147     HRESULT CLSIDFromString(LPOLESTR, LPCLSID);
148     HRESULT StringFromIID(REFIID, LPOLESTR*);
149     HRESULT IIDFromString(LPOLESTR, LPIID);
150     BOOL CoIsOle1Class(REFCLSID);
151     HRESULT ProgIDFromCLSID(REFCLSID, LPOLESTR*);
152     HRESULT CLSIDFromProgID(LPCOLESTR, LPCLSID);
153     int StringFromGUID2(REFGUID, LPOLESTR, int);
154     HRESULT CoCreateGuid(GUID*);
155     BOOL CoFileTimeToDosDateTime(FILETIME*, LPWORD, LPWORD);
156     BOOL CoDosDateTimeToFileTime(WORD, WORD, FILETIME*);
157     HRESULT CoFileTimeNow(FILETIME*);
158     HRESULT CoRegisterMessageFilter(LPMESSAGEFILTER, LPMESSAGEFILTER*);
159     HRESULT CoGetTreatAsClass(REFCLSID, LPCLSID);
160     HRESULT CoTreatAsClass(REFCLSID, REFCLSID);
161     HRESULT DllGetClassObject(REFCLSID, REFIID, PVOID*);
162     HRESULT DllCanUnloadNow();
163     PVOID CoTaskMemAlloc(SIZE_T);
164     PVOID CoTaskMemRealloc(PVOID, SIZE_T);
165     void CoTaskMemFree(PVOID);
166     HRESULT CreateDataAdviseHolder(LPDATAADVISEHOLDER*);
167     HRESULT CreateDataCache(LPUNKNOWN, REFCLSID, REFIID, PVOID*);
168     HRESULT StgCreateDocfile(const(OLECHAR)*, DWORD, DWORD, IStorage*);
169     HRESULT StgCreateDocfileOnILockBytes(ILockBytes, DWORD, DWORD, IStorage*);
170     HRESULT StgOpenStorage(const(OLECHAR)*, IStorage, DWORD, SNB, DWORD, IStorage*);
171     HRESULT StgOpenStorageOnILockBytes(ILockBytes, IStorage, DWORD, SNB, DWORD, IStorage*);
172     HRESULT StgIsStorageFile(const(OLECHAR)*);
173     HRESULT StgIsStorageILockBytes(ILockBytes);
174     HRESULT StgSetTimes(OLECHAR *, FILETIME *, FILETIME *, FILETIME *);
175     HRESULT StgCreateStorageEx(const(WCHAR)*, DWORD, DWORD, DWORD, STGOPTIONS*, void*, REFIID, void**);
176     HRESULT StgOpenStorageEx(const(WCHAR)*, DWORD, DWORD, DWORD, STGOPTIONS*, void*, REFIID, void**);
177     HRESULT BindMoniker(LPMONIKER, DWORD, REFIID, PVOID*);
178     HRESULT CoGetObject(LPCWSTR, BIND_OPTS*, REFIID, void**);
179     HRESULT MkParseDisplayName(LPBC, LPCOLESTR, ULONG*, LPMONIKER*);
180     HRESULT MonikerRelativePathTo(LPMONIKER, LPMONIKER, LPMONIKER*, BOOL);
181     HRESULT MonikerCommonPrefixWith(LPMONIKER, LPMONIKER, LPMONIKER*);
182     HRESULT CreateBindCtx(DWORD, LPBC*);
183     HRESULT CreateGenericComposite(LPMONIKER, LPMONIKER, LPMONIKER*);
184     HRESULT GetClassFile (LPCOLESTR, CLSID*);
185     HRESULT CreateFileMoniker(LPCOLESTR, LPMONIKER*);
186     HRESULT CreateItemMoniker(LPCOLESTR, LPCOLESTR, LPMONIKER*);
187     HRESULT CreateAntiMoniker(LPMONIKER*);
188     HRESULT CreatePointerMoniker(LPUNKNOWN, LPMONIKER*);
189     HRESULT GetRunningObjectTable(DWORD, LPRUNNINGOBJECTTABLE*);
190     HRESULT CoInitializeSecurity(PSECURITY_DESCRIPTOR, LONG, SOLE_AUTHENTICATION_SERVICE*, void*, DWORD, DWORD, void*, DWORD, void*);
191     HRESULT CoGetCallContext(REFIID, void**);
192     HRESULT CoQueryProxyBlanket(IUnknown*, DWORD*, DWORD*, OLECHAR**, DWORD*, DWORD*, RPC_AUTH_IDENTITY_HANDLE*, DWORD*);
193     HRESULT CoSetProxyBlanket(IUnknown*, DWORD, DWORD, OLECHAR*, DWORD, DWORD, RPC_AUTH_IDENTITY_HANDLE, DWORD);
194     HRESULT CoCopyProxy(IUnknown*, IUnknown**);
195     HRESULT CoQueryClientBlanket(DWORD*, DWORD*, OLECHAR**, DWORD*, DWORD*, RPC_AUTHZ_HANDLE*, DWORD*);
196     HRESULT CoImpersonateClient();
197     HRESULT CoRevertToSelf();
198     HRESULT CoQueryAuthenticationServices(DWORD*, SOLE_AUTHENTICATION_SERVICE**);
199     HRESULT CoSwitchCallContext(IUnknown*, IUnknown**);
200     HRESULT CoGetInstanceFromFile(COSERVERINFO*, CLSID*, IUnknown*, DWORD, DWORD, OLECHAR*, DWORD, MULTI_QI*);
201     HRESULT CoGetInstanceFromIStorage(COSERVERINFO*, CLSID*, IUnknown*, DWORD, IStorage*, DWORD, MULTI_QI*);
202     ULONG CoAddRefServerProcess();
203     ULONG CoReleaseServerProcess();
204     HRESULT CoResumeClassObjects();
205     HRESULT CoSuspendClassObjects();
206     HRESULT CoGetPSClsid(REFIID, CLSID*);
207     HRESULT CoRegisterPSClsid(REFIID, REFCLSID);
208 }