From 7d3046cd02120c19ddf4fe4eb6f3d46028d53abd Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 14 Dec 2012 11:58:10 +0100 Subject: [PATCH] atl100: Added AtlComModuleGetClassObject implementation (based on AtlModuleGetClassObject). --- dlls/atl100/atl.c | 28 ++++++++++++++++++++++++++++ dlls/atl100/atl100.spec | 2 +- dlls/atl80/atl80.spec | 2 +- include/atlbase.h | 12 +++++++++++- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/dlls/atl100/atl.c b/dlls/atl100/atl.c index d2e49c67e6c..c0bc2ae12e4 100644 --- a/dlls/atl100/atl.c +++ b/dlls/atl100/atl.c @@ -303,6 +303,34 @@ void WINAPI AtlWinModuleAddCreateWndData(_ATL_WIN_MODULE *pM, _AtlCreateWndData LeaveCriticalSection(&pM->m_csWindowCreate); } +/*********************************************************************** + * AtlComModuleGetClassObject [atl100.15] + */ +HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE *pm, REFCLSID rclsid, REFIID riid, void **ppv) +{ + _ATL_OBJMAP_ENTRY **iter; + HRESULT hres; + + TRACE("(%p %s %s %p)\n", pm, debugstr_guid(rclsid), debugstr_guid(riid), ppv); + + if(!pm) + return E_INVALIDARG; + + for(iter = pm->m_ppAutoObjMapFirst; iter < pm->m_ppAutoObjMapLast; iter++) { + if(IsEqualCLSID((*iter)->pclsid, rclsid) && (*iter)->pfnGetClassObject) { + if(!(*iter)->pCF) + hres = (*iter)->pfnGetClassObject((*iter)->pfnCreateInstance, &IID_IUnknown, (void**)&(*iter)->pCF); + if((*iter)->pCF) + hres = IUnknown_QueryInterface((*iter)->pCF, riid, ppv); + TRACE("returning %p (%08x)\n", *ppv, hres); + return hres; + } + } + + WARN("Class %s not found\n", debugstr_guid(rclsid)); + return CLASS_E_CLASSNOTAVAILABLE; +} + /*********************************************************************** * AtlRegisterClassCategoriesHelper [atl100.49] */ diff --git a/dlls/atl100/atl100.spec b/dlls/atl100/atl100.spec index 1c361124bb0..6c959d6c379 100644 --- a/dlls/atl100/atl100.spec +++ b/dlls/atl100/atl100.spec @@ -3,7 +3,7 @@ 12 stdcall AtlFreeMarshalStream(ptr) 13 stdcall AtlMarshalPtrInProc(ptr ptr ptr) 14 stdcall AtlUnmarshalPtr(ptr ptr ptr) -15 stub AtlComModuleGetClassObject +15 stdcall AtlComModuleGetClassObject(ptr ptr ptr ptr) 17 stub AtlComModuleRegisterClassObjects 20 stub AtlComModuleRevokeClassObjects 22 stub AtlComModuleUnregisterServer diff --git a/dlls/atl80/atl80.spec b/dlls/atl80/atl80.spec index 1586e10dabd..1c940dd0a65 100644 --- a/dlls/atl80/atl80.spec +++ b/dlls/atl80/atl80.spec @@ -3,7 +3,7 @@ 12 stdcall AtlFreeMarshalStream(ptr) atl100.AtlFreeMarshalStream 13 stdcall AtlMarshalPtrInProc(ptr ptr ptr) atl100.AtlMarshalPtrInProc 14 stdcall AtlUnmarshalPtr(ptr ptr ptr) atl100.AtlUnmarshalPtr -15 stub AtlComModuleGetClassObject +15 stdcall AtlComModuleGetClassObject(ptr ptr ptr ptr) atl100.AtlComModuleGetClassObject 17 stub AtlComModuleRegisterClassObjects 18 stub AtlComModuleRegisterServer(ptr long ptr) 19 stub AtlRegisterTypeLib(ptr wstr) diff --git a/include/atlbase.h b/include/atlbase.h index 37d60c82beb..6c29ad9207a 100644 --- a/include/atlbase.h +++ b/include/atlbase.h @@ -89,7 +89,7 @@ typedef struct _ATL_OBJMAP_ENTRYW_TAG _ATL_DESCRIPTIONFUNCW* pfnGetObjectDescription; _ATL_CATMAPFUNC* pfnGetCategoryMap; void (WINAPI *pfnObjectMain)(BOOL bStarting); -} _ATL_OBJMAP_ENTRYW; +} _ATL_OBJMAP_ENTRYW, _ATL_OBJMAP_ENTRY30, _ATL_OBJMAP_ENTRY; typedef struct _ATL_TERMFUNC_ELEM_TAG @@ -183,6 +183,15 @@ typedef struct _ATL_WIN_MODULE70 CSimpleArray /* */ m_rgWindowClassAtoms; } _ATL_WIN_MODULE70; +typedef struct _ATL_COM_MODULE70 +{ + UINT cbSize; + HINSTANCE m_hInstTypeLib; + _ATL_OBJMAP_ENTRY **m_ppAutoObjMapFirst; + _ATL_OBJMAP_ENTRY **m_ppAutoObjMapLast; + CComCriticalSection m_csObjMap; +} _ATL_COM_MODULE70, _ATL_COM_MODULE; + #if _ATL_VER >= _ATL_VER_70 typedef _ATL_MODULE70 _ATL_MODULE; typedef _ATL_WIN_MODULE70 _ATL_WIN_MODULE; @@ -231,5 +240,6 @@ HRESULT WINAPI AtlCreateRegistrar(IRegistrar**); HRESULT WINAPI AtlUpdateRegistryFromResourceD(HINSTANCE,LPCOLESTR,BOOL,struct _ATL_REGMAP_ENTRY*,IRegistrar*); HRESULT WINAPI AtlLoadTypeLib(HINSTANCE,LPCOLESTR,BSTR*,ITypeLib**); HRESULT WINAPI AtlRegisterClassCategoriesHelper(REFCLSID,const struct _ATL_CATMAP_ENTRY*,BOOL); +HRESULT WINAPI AtlComModuleGetClassObject(_ATL_COM_MODULE*,REFCLSID,REFIID,void**); #endif /* __WINE_ATLBASE_H__ */