2 * Implementation of 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(atl);
41 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
43 TRACE("(0x%p, %ld, %p)\n",hinstDLL,fdwReason,lpvReserved);
45 if (fdwReason == DLL_PROCESS_ATTACH) {
46 DisableThreadLibraryCalls(hinstDLL);
52 HRESULT WINAPI AtlModuleInit(_ATL_MODULEA* pM, _ATL_OBJMAP_ENTRYA* p, HINSTANCE h)
56 FIXME("SEMI-STUB (%p %p %p)\n",pM,p,h);
58 memset(pM,0,sizeof(_ATL_MODULEA));
59 pM->cbSize = sizeof(_ATL_MODULEA);
61 pM->m_hInstResource = h;
62 pM->m_hInstTypeLib = h;
64 pM->m_hHeap = GetProcessHeap();
68 if (pM->m_pObjMap != NULL)
70 while (pM->m_pObjMap[i].pclsid != NULL)
72 TRACE("Initializing object %i %p\n",i,p[i].pfnObjectMain);
73 if (p[i].pfnObjectMain)
74 p[i].pfnObjectMain(TRUE);
82 HRESULT WINAPI AtlModuleTerm(_ATL_MODULEA* pM)
84 HeapFree(GetProcessHeap(), 0, pM);
88 HRESULT WINAPI AtlModuleRegisterClassObjects(_ATL_MODULEA *pM, DWORD dwClsContext,
94 TRACE("(%p %li %li)\n",pM, dwClsContext, dwFlags);
99 while(pM->m_pObjMap[i].pclsid != NULL)
102 _ATL_OBJMAP_ENTRYA *obj = &(pM->m_pObjMap[i]);
105 TRACE("Registering object %i\n",i);
106 if (obj->pfnGetClassObject)
108 rc = obj->pfnGetClassObject(obj->pfnCreateInstance, &IID_IUnknown,
112 CoRegisterClassObject(obj->pclsid, pUnknown, dwClsContext,
113 dwFlags, &obj->dwRegister);
115 IUnknown_Release(pUnknown);
124 HRESULT WINAPI AtlModuleUnregisterServerEx(_ATL_MODULEA* pM, BOOL bUnRegTypeLib, const CLSID* pCLSID)
126 FIXME("(%p, %i, %p) stub\n", pM, bUnRegTypeLib, pCLSID);
130 HRESULT WINAPI AtlInternalQueryInterface(LPVOID this, const _ATL_INTMAP_ENTRY* pEntries, REFIID iid, LPVOID* ppvObject)
133 HRESULT rc = E_NOINTERFACE;
134 TRACE("(%p, %p, %p, %p)\n",this, pEntries, iid, ppvObject);
136 if (IsEqualGUID(iid,&IID_IUnknown))
138 TRACE("Returning IUnknown\n");
140 IUnknown_AddRef((IUnknown*)this);
144 while (pEntries[i].pFunc != 0)
146 TRACE("Trying entry %i (%p %li %p)\n",i,pEntries[i].piid,
147 pEntries[i].dw, pEntries[i].pFunc);
149 if (pEntries[i].piid && IsEqualGUID(iid,pEntries[i].piid))
152 if (pEntries[i].pFunc == (_ATL_CREATORARGFUNC*)1)
155 *ppvObject = ((LPSTR)this+pEntries[i].dw);
156 IUnknown_AddRef((IUnknown*)this);
162 rc = pEntries[i].pFunc(this, iid, ppvObject,0);
168 TRACE("Done returning (0x%lx)\n",rc);
172 /***********************************************************************
173 * AtlModuleRegisterServer [ATL.@]
176 HRESULT WINAPI AtlModuleRegisterServer(_ATL_MODULEW* pM, BOOL bRegTypeLib, const CLSID* clsid)
178 FIXME("%p %d %s\n", pM, bRegTypeLib, debugstr_guid(clsid));
182 /***********************************************************************
185 HRESULT WINAPI AtlAdvise(IUnknown *pUnkCP, IUnknown *pUnk, const IID *iid, LPDWORD pdw)
187 FIXME("%p %p %p %p\n", pUnkCP, pUnk, iid, pdw);
191 /***********************************************************************
192 * AtlUnadvise [ATL.@]
194 HRESULT WINAPI AtlUnadvise(IUnknown *pUnkCP, const IID *iid, DWORD dw)
196 FIXME("%p %p %ld\n", pUnkCP, iid, dw);
200 /***********************************************************************
201 * AtlFreeMarshalStream [ATL.@]
203 HRESULT WINAPI AtlFreeMarshalStream(IStream *stm)
209 /***********************************************************************
210 * AtlMarshalPtrInProc [ATL.@]
212 HRESULT WINAPI AtlMarshalPtrInProc(IUnknown *pUnk, const IID *iid, IStream **pstm)
214 FIXME("%p %p %p\n", pUnk, iid, pstm);
218 /***********************************************************************
219 * AtlUnmarshalPtr [ATL.@]
221 HRESULT WINAPI AtlUnmarshalPtr(IStream *stm, const IID *iid, IUnknown **ppUnk)
223 FIXME("%p %p %p\n", stm, iid, ppUnk);
227 /***********************************************************************
228 * AtlModuleGetClassObject [ATL.@]
230 HRESULT WINAPI AtlModuleGetClassObject(_ATL_MODULEW *pm, REFCLSID rclsid,
231 REFIID riid, LPVOID *ppv)
233 FIXME("%p %p %p %p\n", pm, rclsid, riid, ppv);
237 /***********************************************************************
238 * AtlModuleGetClassObject [ATL.@]
240 HRESULT WINAPI AtlModuleRegisterTypeLib(_ATL_MODULEW *pm, LPCOLESTR lpszIndex)
242 FIXME("%p %s\n", pm, debugstr_w(lpszIndex));
246 /***********************************************************************
247 * AtlModuleRevokeClassObjects [ATL.@]
249 HRESULT WINAPI AtlModuleRevokeClassObjects(_ATL_MODULEW *pm)
255 /***********************************************************************
256 * AtlModuleUnregisterServer [ATL.@]
258 HRESULT WINAPI AtlModuleUnregisterServer(_ATL_MODULEW *pm, const CLSID *clsid)
260 FIXME("%p %s\n", pm, debugstr_guid(clsid));