gdi32: Add a check for overflow in DIB dimensions.
[wine.git] / include / atlbase.h
blob660fbf54cd52fd825bd2805f7832c707921ed334
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_100 0x0a00
32 #define _ATL_VER_110 0x0b00
34 #ifndef _ATL_VER
35 #define _ATL_VER _ATL_VER_100
36 #endif
38 typedef HRESULT (WINAPI _ATL_CREATORFUNC)(void* pv, REFIID riid, LPVOID* ppv);
39 typedef HRESULT (WINAPI _ATL_CREATORARGFUNC)(void* pv, REFIID riid, LPVOID* ppv, DWORD dw);
40 typedef HRESULT (WINAPI _ATL_MODULEFUNC)(DWORD dw);
41 typedef LPCSTR (WINAPI _ATL_DESCRIPTIONFUNCA)(void);
42 typedef LPCWSTR (WINAPI _ATL_DESCRIPTIONFUNCW)(void);
43 typedef const struct _ATL_CATMAP_ENTRY* (_ATL_CATMAPFUNC)(void);
44 typedef void (WINAPI _ATL_TERMFUNC)(DWORD dw);
46 typedef CRITICAL_SECTION CComCriticalSection;
48 typedef struct _ATL_OBJMAP_ENTRYA_V1_TAG
50 const CLSID* pclsid;
51 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
52 _ATL_CREATORFUNC* pfnGetClassObject;
53 _ATL_CREATORFUNC* pfnCreateInstance;
54 IUnknown* pCF;
55 DWORD dwRegister;
56 _ATL_DESCRIPTIONFUNCA* pfnGetObjectDescription;
57 }_ATL_OBJMAP_ENTRYA_V1;
59 typedef struct _ATL_OBJMAP_ENTRYW_V1_TAG
61 const CLSID* pclsid;
62 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
63 _ATL_CREATORFUNC* pfnGetClassObject;
64 _ATL_CREATORFUNC* pfnCreateInstance;
65 IUnknown* pCF;
66 DWORD dwRegister;
67 _ATL_DESCRIPTIONFUNCW* pfnGetObjectDescription;
68 } _ATL_OBJMAP_ENTRYW_V1;
70 typedef struct _ATL_OBJMAP_ENTRYA_TAG
72 const CLSID* pclsid;
73 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
74 _ATL_CREATORFUNC* pfnGetClassObject;
75 _ATL_CREATORFUNC* pfnCreateInstance;
76 IUnknown* pCF;
77 DWORD dwRegister;
78 _ATL_DESCRIPTIONFUNCA* pfnGetObjectDescription;
79 _ATL_CATMAPFUNC* pfnGetCategoryMap;
80 void (WINAPI *pfnObjectMain)(BOOL bStarting);
81 }_ATL_OBJMAP_ENTRYA;
83 typedef struct _ATL_OBJMAP_ENTRYW_TAG
85 const CLSID* pclsid;
86 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
87 _ATL_CREATORFUNC* pfnGetClassObject;
88 _ATL_CREATORFUNC* pfnCreateInstance;
89 IUnknown* pCF;
90 DWORD dwRegister;
91 _ATL_DESCRIPTIONFUNCW* pfnGetObjectDescription;
92 _ATL_CATMAPFUNC* pfnGetCategoryMap;
93 void (WINAPI *pfnObjectMain)(BOOL bStarting);
94 } _ATL_OBJMAP_ENTRYW, _ATL_OBJMAP_ENTRY30, _ATL_OBJMAP_ENTRY;
97 typedef struct _ATL_TERMFUNC_ELEM_TAG
99 _ATL_TERMFUNC* pFunc;
100 DWORD_PTR dw;
101 struct _ATL_TERMFUNC_ELEM_TAG* pNext;
102 } _ATL_TERMFUNC_ELEM;
104 typedef struct _AtlCreateWndData_TAG
106 void* m_pThis;
107 DWORD m_dwThreadID;
108 struct _AtlCreateWndData_TAG* m_pNext;
109 } _AtlCreateWndData;
111 typedef struct _ATL_MODULEA_TAG
113 UINT cbSize;
114 HINSTANCE m_hInst;
115 HINSTANCE m_hInstResource;
116 HINSTANCE m_hInstTypeLib;
117 _ATL_OBJMAP_ENTRYA* m_pObjMap;
118 LONG m_nLockCnt;
119 HANDLE m_hHeap;
120 union
122 CRITICAL_SECTION m_csTypeInfoHolder;
123 CRITICAL_SECTION m_csStaticDataInit;
124 } u;
125 CRITICAL_SECTION m_csWindowCreate;
126 CRITICAL_SECTION m_csObjMap;
128 DWORD dwAtlBuildVer;
129 _AtlCreateWndData* m_pCreateWndList;
130 BOOL m_bDestroyHeap;
131 GUID* pguidVer;
132 DWORD m_dwHeaps;
133 HANDLE* m_phHeaps;
134 int m_nHeap;
135 _ATL_TERMFUNC_ELEM* m_pTermFuncs;
136 } _ATL_MODULEA;
138 typedef struct _ATL_MODULEW_TAG
140 UINT cbSize;
141 HINSTANCE m_hInst;
142 HINSTANCE m_hInstResource;
143 HINSTANCE m_hInstTypeLib;
144 _ATL_OBJMAP_ENTRYW* m_pObjMap;
145 LONG m_nLockCnt;
146 HANDLE m_hHeap;
147 union
149 CRITICAL_SECTION m_csTypeInfoHolder;
150 CRITICAL_SECTION m_csStaticDataInit;
151 } u;
152 CRITICAL_SECTION m_csWindowCreate;
153 CRITICAL_SECTION m_csObjMap;
155 DWORD dwAtlBuildVer;
156 _AtlCreateWndData* m_pCreateWndList;
157 BOOL m_bDestroyHeap;
158 GUID* pguidVer;
159 DWORD m_dwHeaps;
160 HANDLE* m_phHeaps;
161 int m_nHeap;
162 _ATL_TERMFUNC_ELEM* m_pTermFuncs;
163 } _ATL_MODULEW;
165 typedef struct
167 void *m_aT;
168 int m_nSize;
169 int m_nAllocSize;
170 } CSimpleArray;
172 typedef struct _ATL_MODULE70
174 UINT cbSize;
175 LONG m_nLockCnt;
176 _ATL_TERMFUNC_ELEM *m_pTermFuncs;
177 CComCriticalSection m_csStaticDataInitAndTypeInfo;
178 } _ATL_MODULE70;
180 typedef struct _ATL_WIN_MODULE70
182 UINT cbSize;
183 CComCriticalSection m_csWindowCreate;
184 _AtlCreateWndData *m_pCreateWndList;
185 CSimpleArray /* <ATOM> */ m_rgWindowClassAtoms;
186 } _ATL_WIN_MODULE70;
188 typedef struct _ATL_COM_MODULE70
190 UINT cbSize;
191 HINSTANCE m_hInstTypeLib;
192 _ATL_OBJMAP_ENTRY **m_ppAutoObjMapFirst;
193 _ATL_OBJMAP_ENTRY **m_ppAutoObjMapLast;
194 CComCriticalSection m_csObjMap;
195 } _ATL_COM_MODULE70, _ATL_COM_MODULE;
197 #if _ATL_VER >= _ATL_VER_70
198 typedef _ATL_MODULE70 _ATL_MODULE;
199 typedef _ATL_WIN_MODULE70 _ATL_WIN_MODULE;
200 #else
201 typedef _ATL_MODULEW _ATL_MODULE;
202 typedef _ATL_MODULEW _ATL_WIN_MODULE;
203 #endif
205 typedef struct _ATL_INTMAP_ENTRY_TAG
207 const IID* piid;
208 DWORD dw;
209 _ATL_CREATORARGFUNC* pFunc;
210 } _ATL_INTMAP_ENTRY;
212 struct _ATL_REGMAP_ENTRY
214 LPCOLESTR szKey;
215 LPCOLESTR szData;
218 struct _ATL_CATMAP_ENTRY
220 int iType;
221 const CATID *pcatid;
224 #define _ATL_CATMAP_ENTRY_END 0
225 #define _ATL_CATMAP_ENTRY_IMPLEMENTED 1
226 #define _ATL_CATMAP_ENTRY_REQUIRED 2
228 HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID * iid, LPDWORD dpw);
229 HRESULT WINAPI AtlAxAttachControl(IUnknown*,HWND,IUnknown**);
230 HRESULT WINAPI AtlAxCreateControl(LPCOLESTR,HWND,IStream*,IUnknown**);
231 HRESULT WINAPI AtlAxCreateControlEx(LPCOLESTR,HWND,IStream*,IUnknown**,IUnknown**,REFIID,IUnknown*);
232 HRESULT WINAPI AtlFreeMarshalStream(IStream *pStream);
233 HRESULT WINAPI AtlInternalQueryInterface(void* pThis, const _ATL_INTMAP_ENTRY* pEntries, REFIID iid, void** ppvObject);
234 HRESULT WINAPI AtlMarshalPtrInProc(IUnknown *pUnk, const IID *iid, IStream **ppStream);
235 void WINAPI AtlModuleAddCreateWndData(_ATL_MODULEW *pM, _AtlCreateWndData *pData, void* pvObject);
236 HRESULT WINAPI AtlWinModuleInit(_ATL_WIN_MODULE*);
237 void WINAPI AtlWinModuleAddCreateWndData(_ATL_WIN_MODULE*,_AtlCreateWndData*,void*);
238 void* WINAPI AtlWinModuleExtractCreateWndData(_ATL_WIN_MODULE*);
239 HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULE *pM, _ATL_TERMFUNC *pFunc, DWORD_PTR dw);
240 void WINAPI AtlCallTermFunc(_ATL_MODULE*);
241 void* WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM);
242 HRESULT WINAPI AtlModuleInit(_ATL_MODULEW* pM, _ATL_OBJMAP_ENTRYW* p, HINSTANCE h);
243 HRESULT WINAPI AtlModuleLoadTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex, BSTR *pbstrPath, ITypeLib **ppTypeLib);
244 HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEW* pM, DWORD dwClsContext, DWORD dwFlags);
245 HRESULT WINAPI AtlModuleRegisterServer(_ATL_MODULEW* pM, BOOL bRegTypeLib, const CLSID* pCLSID);
246 HRESULT WINAPI AtlModuleRegisterTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex);
247 HRESULT WINAPI AtlModuleUnregisterServer(_ATL_MODULEW* pM, const CLSID* pCLSID);
248 HRESULT WINAPI AtlModuleUpdateRegistryFromResourceD(_ATL_MODULEW *pM, LPCOLESTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries, IRegistrar *pReg );
249 HRESULT WINAPI AtlModuleUnregisterServerEx(_ATL_MODULEW* pM, BOOL bUnRegTypeLib, const CLSID* pCLSID);
250 HRESULT WINAPI AtlModuleTerm(_ATL_MODULEW* pM);
251 HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID * iid, DWORD dw);
252 HRESULT WINAPI AtlUnmarshalPtr(IStream *pStream, const IID *iid, IUnknown **ppUnk);
253 HRESULT WINAPI AtlCreateRegistrar(IRegistrar**);
254 HRESULT WINAPI AtlUpdateRegistryFromResourceD(HINSTANCE,LPCOLESTR,BOOL,struct _ATL_REGMAP_ENTRY*,IRegistrar*);
255 HRESULT WINAPI AtlLoadTypeLib(HINSTANCE,LPCOLESTR,BSTR*,ITypeLib**);
256 HRESULT WINAPI AtlRegisterTypeLib(HINSTANCE,LPCOLESTR);
257 HRESULT WINAPI AtlRegisterClassCategoriesHelper(REFCLSID,const struct _ATL_CATMAP_ENTRY*,BOOL);
258 HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE*,REFCLSID,REFIID,void**);
259 HRESULT WINAPI AtlComModuleRegisterClassObjects(_ATL_COM_MODULE*,DWORD,DWORD);
260 HRESULT WINAPI AtlComModuleUnregisterServer(_ATL_COM_MODULE*,BOOL,const CLSID*);
261 BOOL WINAPI AtlWaitWithMessageLoop(HANDLE);
262 HRESULT WINAPI AtlGetObjectSourceInterface(IUnknown*,GUID*,IID*,unsigned short*,unsigned short*);
263 HRESULT WINAPI AtlSetPerUserRegistration(unsigned char /*bool*/);
264 HRESULT WINAPI AtlGetPerUserRegistration(unsigned char /*bool*/ *);
266 #endif /* __WINE_ATLBASE_H__ */