hidclass.sys: Return STATUS_INVALID_USER_BUFFER if buffer_len is 0.
[wine.git] / include / atlbase.h
blobebf167480558295d3c4c6e731b97b7257469eaff
1 /*
2 * Implementation of the Active Template Library (atl.dll)
4 * Copyright 2004 Aric Stewart for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_ATLBASE_H__
22 #define __WINE_ATLBASE_H__
24 #include <atliface.h>
25 #include <comcat.h>
27 /* Wine extension: we (ab)use _ATL_VER to handle struct layout differences between ATL versions. */
28 #define _ATL_VER_30 0x0300
29 #define _ATL_VER_70 0x0700
30 #define _ATL_VER_80 0x0800
31 #define _ATL_VER_90 0x0900
32 #define _ATL_VER_100 0x0a00
33 #define _ATL_VER_110 0x0b00
35 #ifndef _ATL_VER
36 #define _ATL_VER _ATL_VER_100
37 #endif
39 typedef HRESULT (WINAPI _ATL_CREATORFUNC)(void* pv, REFIID riid, LPVOID* ppv);
40 typedef HRESULT (WINAPI _ATL_CREATORARGFUNC)(void* pv, REFIID riid, LPVOID* ppv, DWORD_PTR dw);
41 typedef HRESULT (WINAPI _ATL_MODULEFUNC)(DWORD_PTR dw);
42 typedef LPCSTR (WINAPI _ATL_DESCRIPTIONFUNCA)(void);
43 typedef LPCWSTR (WINAPI _ATL_DESCRIPTIONFUNCW)(void);
44 typedef const struct _ATL_CATMAP_ENTRY* (_ATL_CATMAPFUNC)(void);
45 typedef void (WINAPI _ATL_TERMFUNC)(DWORD_PTR dw);
47 typedef CRITICAL_SECTION CComCriticalSection;
49 typedef struct _ATL_OBJMAP_ENTRYA_V1_TAG
51 const CLSID* pclsid;
52 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
53 _ATL_CREATORFUNC* pfnGetClassObject;
54 _ATL_CREATORFUNC* pfnCreateInstance;
55 IUnknown* pCF;
56 DWORD dwRegister;
57 _ATL_DESCRIPTIONFUNCA* pfnGetObjectDescription;
58 }_ATL_OBJMAP_ENTRYA_V1;
60 typedef struct _ATL_OBJMAP_ENTRYW_V1_TAG
62 const CLSID* pclsid;
63 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
64 _ATL_CREATORFUNC* pfnGetClassObject;
65 _ATL_CREATORFUNC* pfnCreateInstance;
66 IUnknown* pCF;
67 DWORD dwRegister;
68 _ATL_DESCRIPTIONFUNCW* pfnGetObjectDescription;
69 } _ATL_OBJMAP_ENTRYW_V1;
71 typedef struct _ATL_OBJMAP_ENTRYA_TAG
73 const CLSID* pclsid;
74 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
75 _ATL_CREATORFUNC* pfnGetClassObject;
76 _ATL_CREATORFUNC* pfnCreateInstance;
77 IUnknown* pCF;
78 DWORD dwRegister;
79 _ATL_DESCRIPTIONFUNCA* pfnGetObjectDescription;
80 _ATL_CATMAPFUNC* pfnGetCategoryMap;
81 void (WINAPI *pfnObjectMain)(BOOL bStarting);
82 }_ATL_OBJMAP_ENTRYA;
84 typedef struct _ATL_OBJMAP_ENTRYW_TAG
86 const CLSID* pclsid;
87 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
88 _ATL_CREATORFUNC* pfnGetClassObject;
89 _ATL_CREATORFUNC* pfnCreateInstance;
90 IUnknown* pCF;
91 DWORD dwRegister;
92 _ATL_DESCRIPTIONFUNCW* pfnGetObjectDescription;
93 _ATL_CATMAPFUNC* pfnGetCategoryMap;
94 void (WINAPI *pfnObjectMain)(BOOL bStarting);
95 } _ATL_OBJMAP_ENTRYW, _ATL_OBJMAP_ENTRY30, _ATL_OBJMAP_ENTRY;
97 typedef struct _ATL_OBJMAP_CACHE
99 IUnknown *pCF;
100 DWORD dwRegister;
101 } _ATL_OBJMAP_CACHE;
103 typedef struct _ATL_OBJMAP_ENTRY110
105 const CLSID* pclsid;
106 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
107 _ATL_CREATORFUNC* pfnGetClassObject;
108 _ATL_CREATORFUNC* pfnCreateInstance;
109 _ATL_OBJMAP_CACHE* pCache;
110 _ATL_DESCRIPTIONFUNCW* pfnGetObjectDescription;
111 _ATL_CATMAPFUNC* pfnGetCategoryMap;
112 void (WINAPI *pfnObjectMain)(BOOL bStarting);
113 } _ATL_OBJMAP_ENTRY110, _ATL_OBJMAP_ENTRY_EX;
115 typedef struct _ATL_TERMFUNC_ELEM_TAG
117 _ATL_TERMFUNC* pFunc;
118 DWORD_PTR dw;
119 struct _ATL_TERMFUNC_ELEM_TAG* pNext;
120 } _ATL_TERMFUNC_ELEM;
122 typedef struct _AtlCreateWndData_TAG
124 void* m_pThis;
125 DWORD m_dwThreadID;
126 struct _AtlCreateWndData_TAG* m_pNext;
127 } _AtlCreateWndData;
129 typedef struct _ATL_MODULEA_TAG
131 UINT cbSize;
132 HINSTANCE m_hInst;
133 HINSTANCE m_hInstResource;
134 HINSTANCE m_hInstTypeLib;
135 _ATL_OBJMAP_ENTRYA* m_pObjMap;
136 LONG m_nLockCnt;
137 HANDLE m_hHeap;
138 union
140 CRITICAL_SECTION m_csTypeInfoHolder;
141 CRITICAL_SECTION m_csStaticDataInit;
142 } u;
143 CRITICAL_SECTION m_csWindowCreate;
144 CRITICAL_SECTION m_csObjMap;
146 DWORD dwAtlBuildVer;
147 _AtlCreateWndData* m_pCreateWndList;
148 BOOL m_bDestroyHeap;
149 GUID* pguidVer;
150 DWORD m_dwHeaps;
151 HANDLE* m_phHeaps;
152 int m_nHeap;
153 _ATL_TERMFUNC_ELEM* m_pTermFuncs;
154 } _ATL_MODULEA;
156 typedef struct _ATL_MODULEW_TAG
158 UINT cbSize;
159 HINSTANCE m_hInst;
160 HINSTANCE m_hInstResource;
161 HINSTANCE m_hInstTypeLib;
162 _ATL_OBJMAP_ENTRYW* m_pObjMap;
163 LONG m_nLockCnt;
164 HANDLE m_hHeap;
165 union
167 CRITICAL_SECTION m_csTypeInfoHolder;
168 CRITICAL_SECTION m_csStaticDataInit;
169 } u;
170 CRITICAL_SECTION m_csWindowCreate;
171 CRITICAL_SECTION m_csObjMap;
173 DWORD dwAtlBuildVer;
174 _AtlCreateWndData* m_pCreateWndList;
175 BOOL m_bDestroyHeap;
176 GUID* pguidVer;
177 DWORD m_dwHeaps;
178 HANDLE* m_phHeaps;
179 int m_nHeap;
180 _ATL_TERMFUNC_ELEM* m_pTermFuncs;
181 } _ATL_MODULEW;
183 typedef struct
185 void *m_aT;
186 int m_nSize;
187 int m_nAllocSize;
188 } CSimpleArray;
190 typedef struct _ATL_MODULE70
192 UINT cbSize;
193 LONG m_nLockCnt;
194 _ATL_TERMFUNC_ELEM *m_pTermFuncs;
195 CComCriticalSection m_csStaticDataInitAndTypeInfo;
196 } _ATL_MODULE70;
198 typedef struct _ATL_WIN_MODULE70
200 UINT cbSize;
201 CComCriticalSection m_csWindowCreate;
202 _AtlCreateWndData *m_pCreateWndList;
203 CSimpleArray /* <ATOM> */ m_rgWindowClassAtoms;
204 } _ATL_WIN_MODULE70;
206 #if _ATL_VER >= _ATL_VER_110
207 typedef struct _ATL_COM_MODULE70
209 UINT cbSize;
210 HINSTANCE m_hInstTypeLib;
211 _ATL_OBJMAP_ENTRY_EX **m_ppAutoObjMapFirst;
212 _ATL_OBJMAP_ENTRY_EX **m_ppAutoObjMapLast;
213 CComCriticalSection m_csObjMap;
214 } _ATL_COM_MODULE70, _ATL_COM_MODULE;
215 #else
216 typedef struct _ATL_COM_MODULE70
218 UINT cbSize;
219 HINSTANCE m_hInstTypeLib;
220 _ATL_OBJMAP_ENTRY **m_ppAutoObjMapFirst;
221 _ATL_OBJMAP_ENTRY **m_ppAutoObjMapLast;
222 CComCriticalSection m_csObjMap;
223 } _ATL_COM_MODULE70, _ATL_COM_MODULE;
224 #endif
226 #if _ATL_VER >= _ATL_VER_70
227 typedef _ATL_MODULE70 _ATL_MODULE;
228 typedef _ATL_WIN_MODULE70 _ATL_WIN_MODULE;
229 #else
230 typedef _ATL_MODULEW _ATL_MODULE;
231 typedef _ATL_MODULEW _ATL_WIN_MODULE;
232 #endif
234 typedef struct _ATL_INTMAP_ENTRY_TAG
236 const IID* piid;
237 DWORD_PTR dw;
238 _ATL_CREATORARGFUNC* pFunc;
239 } _ATL_INTMAP_ENTRY;
241 struct _ATL_REGMAP_ENTRY
243 LPCOLESTR szKey;
244 LPCOLESTR szData;
247 struct _ATL_CATMAP_ENTRY
249 int iType;
250 const CATID *pcatid;
253 #define _ATL_CATMAP_ENTRY_END 0
254 #define _ATL_CATMAP_ENTRY_IMPLEMENTED 1
255 #define _ATL_CATMAP_ENTRY_REQUIRED 2
257 HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID * iid, LPDWORD dpw);
258 HRESULT WINAPI AtlAxAttachControl(IUnknown*,HWND,IUnknown**);
259 HRESULT WINAPI AtlAxCreateControl(LPCOLESTR,HWND,IStream*,IUnknown**);
260 HRESULT WINAPI AtlAxCreateControlEx(LPCOLESTR,HWND,IStream*,IUnknown**,IUnknown**,REFIID,IUnknown*);
261 HRESULT WINAPI AtlFreeMarshalStream(IStream *pStream);
262 HRESULT WINAPI AtlInternalQueryInterface(void* pThis, const _ATL_INTMAP_ENTRY* pEntries, REFIID iid, void** ppvObject);
263 HRESULT WINAPI AtlMarshalPtrInProc(IUnknown *pUnk, const IID *iid, IStream **ppStream);
264 void WINAPI AtlModuleAddCreateWndData(_ATL_MODULEW *pM, _AtlCreateWndData *pData, void* pvObject);
265 HRESULT WINAPI AtlWinModuleInit(_ATL_WIN_MODULE*);
266 void WINAPI AtlWinModuleAddCreateWndData(_ATL_WIN_MODULE*,_AtlCreateWndData*,void*);
267 void* WINAPI AtlWinModuleExtractCreateWndData(_ATL_WIN_MODULE*);
268 HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULE *pM, _ATL_TERMFUNC *pFunc, DWORD_PTR dw);
269 void WINAPI AtlCallTermFunc(_ATL_MODULE*);
270 void* WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM);
271 HRESULT WINAPI AtlModuleInit(_ATL_MODULEW* pM, _ATL_OBJMAP_ENTRYW* p, HINSTANCE h);
272 HRESULT WINAPI AtlModuleLoadTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex, BSTR *pbstrPath, ITypeLib **ppTypeLib);
273 HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEW* pM, DWORD dwClsContext, DWORD dwFlags);
274 HRESULT WINAPI AtlModuleRegisterServer(_ATL_MODULEW* pM, BOOL bRegTypeLib, const CLSID* pCLSID);
275 HRESULT WINAPI AtlModuleRegisterTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex);
276 HRESULT WINAPI AtlModuleUnregisterServer(_ATL_MODULEW* pM, const CLSID* pCLSID);
277 HRESULT WINAPI AtlModuleUpdateRegistryFromResourceD(_ATL_MODULEW *pM, LPCOLESTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries, IRegistrar *pReg );
278 HRESULT WINAPI AtlModuleUnregisterServerEx(_ATL_MODULEW* pM, BOOL bUnRegTypeLib, const CLSID* pCLSID);
279 HRESULT WINAPI AtlModuleTerm(_ATL_MODULEW* pM);
280 HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID * iid, DWORD dw);
281 HRESULT WINAPI AtlUnmarshalPtr(IStream *pStream, const IID *iid, IUnknown **ppUnk);
282 HRESULT WINAPI AtlCreateRegistrar(IRegistrar**);
283 HRESULT WINAPI AtlUpdateRegistryFromResourceD(HINSTANCE,LPCOLESTR,BOOL,struct _ATL_REGMAP_ENTRY*,IRegistrar*);
284 HRESULT WINAPI AtlLoadTypeLib(HINSTANCE,LPCOLESTR,BSTR*,ITypeLib**);
285 HRESULT WINAPI AtlRegisterTypeLib(HINSTANCE,LPCOLESTR);
286 HRESULT WINAPI AtlRegisterClassCategoriesHelper(REFCLSID,const struct _ATL_CATMAP_ENTRY*,BOOL);
287 HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE*,REFCLSID,REFIID,void**);
288 HRESULT WINAPI AtlComModuleRegisterClassObjects(_ATL_COM_MODULE*,DWORD,DWORD);
289 HRESULT WINAPI AtlComModuleRevokeClassObjects(_ATL_COM_MODULE*);
290 HRESULT WINAPI AtlComModuleUnregisterServer(_ATL_COM_MODULE*,BOOL,const CLSID*);
291 BOOL WINAPI AtlWaitWithMessageLoop(HANDLE);
292 HRESULT WINAPI AtlGetObjectSourceInterface(IUnknown*,GUID*,IID*,unsigned short*,unsigned short*);
293 HRESULT WINAPI AtlSetPerUserRegistration(unsigned char /*bool*/);
294 HRESULT WINAPI AtlGetPerUserRegistration(unsigned char /*bool*/ *);
296 #endif /* __WINE_ATLBASE_H__ */