Sync with trunk (r48545)
[reactos.git] / dll / win32 / atl / atlbase.h
1 /*
2 * Implementation of the Active Template Library (atl.dll)
3 *
4 * Copyright 2004 Aric Stewart for CodeWeavers
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #ifndef __WINE_ATLBASE_H__
22 #define __WINE_ATLBASE_H__
23
24 #define COBJMACROS
25
26 #include "atliface.h"
27
28 typedef HRESULT (WINAPI _ATL_CREATORFUNC)(void* pv, REFIID riid, LPVOID* ppv);
29 typedef HRESULT (WINAPI _ATL_CREATORARGFUNC)(void* pv, REFIID riid, LPVOID* ppv, DWORD dw);
30 typedef HRESULT (WINAPI _ATL_MODULEFUNC)(DWORD dw);
31 typedef LPCSTR (WINAPI _ATL_DESCRIPTIONFUNCA)(void);
32 typedef LPCWSTR (WINAPI _ATL_DESCRIPTIONFUNCW)(void);
33 typedef const struct _ATL_CATMAP_ENTRY* (_ATL_CATMAPFUNC)(void);
34 typedef void (WINAPI _ATL_TERMFUNC)(DWORD dw);
35
36 typedef struct _ATL_OBJMAP_ENTRYA_V1_TAG
37 {
38 const CLSID* pclsid;
39 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
40 _ATL_CREATORFUNC* pfnGetClassObject;
41 _ATL_CREATORFUNC* pfnCreateInstance;
42 IUnknown* pCF;
43 DWORD dwRegister;
44 _ATL_DESCRIPTIONFUNCA* pfnGetObjectDescription;
45 }_ATL_OBJMAP_ENTRYA_V1;
46
47 typedef struct _ATL_OBJMAP_ENTRYW_V1_TAG
48 {
49 const CLSID* pclsid;
50 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
51 _ATL_CREATORFUNC* pfnGetClassObject;
52 _ATL_CREATORFUNC* pfnCreateInstance;
53 IUnknown* pCF;
54 DWORD dwRegister;
55 _ATL_DESCRIPTIONFUNCW* pfnGetObjectDescription;
56 } _ATL_OBJMAP_ENTRYW_V1;
57
58 typedef struct _ATL_OBJMAP_ENTRYA_TAG
59 {
60 const CLSID* pclsid;
61 HRESULT (WINAPI *pfnUpdateRegistry)(BOOL bRegister);
62 _ATL_CREATORFUNC* pfnGetClassObject;
63 _ATL_CREATORFUNC* pfnCreateInstance;
64 IUnknown* pCF;
65 DWORD dwRegister;
66 _ATL_DESCRIPTIONFUNCA* pfnGetObjectDescription;
67 _ATL_CATMAPFUNC* pfnGetCategoryMap;
68 void (WINAPI *pfnObjectMain)(BOOL bStarting);
69 }_ATL_OBJMAP_ENTRYA;
70
71 typedef struct _ATL_OBJMAP_ENTRYW_TAG
72 {
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_DESCRIPTIONFUNCW* pfnGetObjectDescription;
80 _ATL_CATMAPFUNC* pfnGetCategoryMap;
81 void (WINAPI *pfnObjectMain)(BOOL bStarting);
82 } _ATL_OBJMAP_ENTRYW;
83
84
85 typedef struct _ATL_TERMFUNC_ELEM_TAG
86 {
87 _ATL_TERMFUNC* pFunc;
88 DWORD_PTR dw;
89 struct _ATL_TERMFUNC_ELEM_TAG* pNext;
90 } _ATL_TERMFUNC_ELEM;
91
92 typedef struct _AtlCreateWndData_TAG
93 {
94 void* m_pThis;
95 DWORD m_dwThreadID;
96 struct _AtlCreateWndData_TAG* m_pNext;
97 } _AtlCreateWndData;
98
99 typedef struct _ATL_MODULEA_TAG
100 {
101 UINT cbSize;
102 HINSTANCE m_hInst;
103 HINSTANCE m_hInstResource;
104 HINSTANCE m_hInstTypeLib;
105 _ATL_OBJMAP_ENTRYA* m_pObjMap;
106 LONG m_nLockCnt;
107 HANDLE m_hHeap;
108 union
109 {
110 CRITICAL_SECTION m_csTypeInfoHolder;
111 CRITICAL_SECTION m_csStaticDataInit;
112 } u;
113 CRITICAL_SECTION m_csWindowCreate;
114 CRITICAL_SECTION m_csObjMap;
115
116 DWORD dwAtlBuildVer;
117 _AtlCreateWndData* m_pCreateWndList;
118 BOOL m_bDestroyHeap;
119 GUID* pguidVer;
120 DWORD m_dwHeaps;
121 HANDLE* m_phHeaps;
122 int m_nHeap;
123 _ATL_TERMFUNC_ELEM* m_pTermFuncs;
124 } _ATL_MODULEA;
125
126 typedef struct _ATL_MODULEW_TAG
127 {
128 UINT cbSize;
129 HINSTANCE m_hInst;
130 HINSTANCE m_hInstResource;
131 HINSTANCE m_hInstTypeLib;
132 _ATL_OBJMAP_ENTRYW* m_pObjMap;
133 LONG m_nLockCnt;
134 HANDLE m_hHeap;
135 union
136 {
137 CRITICAL_SECTION m_csTypeInfoHolder;
138 CRITICAL_SECTION m_csStaticDataInit;
139 } u;
140 CRITICAL_SECTION m_csWindowCreate;
141 CRITICAL_SECTION m_csObjMap;
142
143 DWORD dwAtlBuildVer;
144 _AtlCreateWndData* m_pCreateWndList;
145 BOOL m_bDestroyHeap;
146 GUID* pguidVer;
147 DWORD m_dwHeaps;
148 HANDLE* m_phHeaps;
149 int m_nHeap;
150 _ATL_TERMFUNC_ELEM* m_pTermFuncs;
151 } _ATL_MODULEW;
152
153 typedef struct _ATL_INTMAP_ENTRY_TAG
154 {
155 const IID* piid;
156 DWORD dw;
157 _ATL_CREATORARGFUNC* pFunc;
158 } _ATL_INTMAP_ENTRY;
159
160 struct _ATL_REGMAP_ENTRY
161 {
162 LPCOLESTR szKey;
163 LPCOLESTR szData;
164 };
165
166 HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID * iid, LPDWORD dpw);
167 HRESULT WINAPI AtlAxAttachControl(IUnknown*,HWND,IUnknown**);
168 HRESULT WINAPI AtlAxCreateControl(LPCOLESTR,HWND,IStream*,IUnknown**);
169 HRESULT WINAPI AtlAxCreateControlEx(LPCOLESTR,HWND,IStream*,IUnknown**,IUnknown**,REFIID,IUnknown*);
170 HRESULT WINAPI AtlFreeMarshalStream(IStream *pStream);
171 HRESULT WINAPI AtlInternalQueryInterface(void* pThis, const _ATL_INTMAP_ENTRY* pEntries, REFIID iid, void** ppvObject);
172 HRESULT WINAPI AtlMarshalPtrInProc(IUnknown *pUnk, const IID *iid, IStream **ppStream);
173 void WINAPI AtlModuleAddCreateWndData(_ATL_MODULEW *pM, _AtlCreateWndData *pData, void* pvObject);
174 HRESULT WINAPI AtlModuleAddTermFunc(_ATL_MODULEW *pM, _ATL_TERMFUNC *pFunc, DWORD_PTR dw);
175 void* WINAPI AtlModuleExtractCreateWndData(_ATL_MODULEW *pM);
176 HRESULT WINAPI AtlModuleInit(_ATL_MODULEW* pM, _ATL_OBJMAP_ENTRYW* p, HINSTANCE h);
177 HRESULT WINAPI AtlModuleLoadTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex, BSTR *pbstrPath, ITypeLib **ppTypeLib);
178 HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEW* pM, DWORD dwClsContext, DWORD dwFlags);
179 HRESULT WINAPI AtlModuleRegisterServer(_ATL_MODULEW* pM, BOOL bRegTypeLib, const CLSID* pCLSID);
180 HRESULT WINAPI AtlModuleRegisterTypeLib(_ATL_MODULEW *pM, LPCOLESTR lpszIndex);
181 HRESULT WINAPI AtlModuleUnregisterServer(_ATL_MODULEW* pM, const CLSID* pCLSID);
182 HRESULT WINAPI AtlModuleUpdateRegistryFromResourceD(_ATL_MODULEW *pM, LPCOLESTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries, IRegistrar *pReg );
183 HRESULT WINAPI AtlModuleUnregisterServerEx(_ATL_MODULEW* pM, BOOL bUnRegTypeLib, const CLSID* pCLSID);
184 HRESULT WINAPI AtlModuleTerm(_ATL_MODULEW* pM);
185 HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID * iid, DWORD dw);
186 HRESULT WINAPI AtlUnmarshalPtr(IStream *pStream, const IID *iid, IUnknown **ppUnk);
187
188 #endif /* __WINE_ATLBASE_H__ */