[ros-diffs] [rharabien] 56159: [ATL] - Sync to Wine 1.3.37

rharabien at svn.reactos.org rharabien at svn.reactos.org
Thu Mar 15 20:17:15 UTC 2012


Author: rharabien
Date: Thu Mar 15 20:17:15 2012
New Revision: 56159

URL: http://svn.reactos.org/svn/reactos?rev=56159&view=rev
Log:
[ATL]
- Sync to Wine 1.3.37

Modified:
    trunk/reactos/dll/win32/atl/atl_ax.c
    trunk/reactos/dll/win32/atl/atl_main.c
    trunk/reactos/dll/win32/atl/atl_ros.diff
    trunk/reactos/dll/win32/atl/registrar.c

Modified: trunk/reactos/dll/win32/atl/atl_ax.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atl_ax.c?rev=56159&r1=56158&r2=56159&view=diff
==============================================================================
--- trunk/reactos/dll/win32/atl/atl_ax.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/atl/atl_ax.c [iso-8859-1] Thu Mar 15 20:17:15 2012
@@ -41,11 +41,11 @@
 WINE_DEFAULT_DEBUG_CHANNEL(atl);
 
 typedef struct IOCS {
-    const IOleClientSiteVtbl *lpOleClientSiteVtbl;
-    const IOleContainerVtbl *lpOleContainerVtbl;
-    const IOleInPlaceSiteWindowlessVtbl *lpOleInPlaceSiteWindowlessVtbl;
-    const IOleInPlaceFrameVtbl *lpOleInPlaceFrameVtbl;
-    const IOleControlSiteVtbl *lpOleControlSiteVtbl;
+    IOleClientSite            IOleClientSite_iface;
+    IOleContainer             IOleContainer_iface;
+    IOleInPlaceSiteWindowless IOleInPlaceSiteWindowless_iface;
+    IOleInPlaceFrame          IOleInPlaceFrame_iface;
+    IOleControlSite           IOleControlSite_iface;
 
     LONG ref;
     HWND hWnd;
@@ -126,12 +126,6 @@
     return ref;
 }
 
-#define THIS2IOLECLIENTSITE(This) ((IOleClientSite*)&(This)->lpOleClientSiteVtbl)
-#define THIS2IOLECONTAINER(This)             (&(This)->lpOleContainerVtbl)
-#define THIS2IOLEINPLACESITEWINDOWLESS(This) (&(This)->lpOleInPlaceSiteWindowlessVtbl)
-#define THIS2IOLEINPLACEFRAME(This)          (&(This)->lpOleInPlaceFrameVtbl)
-#define THIS2IOLECONTROLSITE(This)           (&(This)->lpOleControlSiteVtbl)
-
 static HRESULT IOCS_QueryInterface(IOCS *This, REFIID riid, void **ppv)
 {
     *ppv = NULL;
@@ -139,19 +133,19 @@
     if ( IsEqualIID( &IID_IUnknown, riid )
       || IsEqualIID( &IID_IOleClientSite, riid ) )
     {
-        *ppv = THIS2IOLECLIENTSITE(This);
+        *ppv = &This->IOleClientSite_iface;
     } else if ( IsEqualIID( &IID_IOleContainer, riid ) )
     {
-        *ppv = THIS2IOLECONTAINER(This);
+        *ppv = &This->IOleContainer_iface;
     } else if ( IsEqualIID( &IID_IOleInPlaceSite, riid ) || IsEqualIID( &IID_IOleInPlaceSiteEx, riid ) || IsEqualIID( &IID_IOleInPlaceSiteWindowless, riid ) )
     {
-        *ppv = THIS2IOLEINPLACESITEWINDOWLESS(This);
+        *ppv = &This->IOleInPlaceSiteWindowless_iface;
     } else if ( IsEqualIID( &IID_IOleInPlaceFrame, riid ) )
     {
-        *ppv = THIS2IOLEINPLACEFRAME(This);
+        *ppv = &This->IOleInPlaceFrame_iface;
     } else if ( IsEqualIID( &IID_IOleControlSite, riid ) )
     {
-        *ppv = THIS2IOLECONTROLSITE(This);
+        *ppv = &This->IOleControlSite_iface;
     }
 
     if (*ppv)
@@ -181,154 +175,181 @@
     return ref;
 }
 
-#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
-
 /******      IOleClientSite    *****/
-#undef  IFACE2THIS
-#define IFACE2THIS(iface) DEFINE_THIS(IOCS,OleClientSite, iface)
+static inline IOCS *impl_from_IOleClientSite(IOleClientSite *iface)
+{
+    return CONTAINING_RECORD(iface, IOCS, IOleClientSite_iface);
+}
+
 static HRESULT WINAPI OleClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleClientSite(iface);
     return IOCS_QueryInterface(This, riid, ppv);
 }
+
 static ULONG WINAPI OleClientSite_AddRef(IOleClientSite *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleClientSite(iface);
     return IOCS_AddRef(This);
 }
+
 static ULONG WINAPI OleClientSite_Release(IOleClientSite *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleClientSite(iface);
     return IOCS_Release(This);
 }
+
 static HRESULT WINAPI OleClientSite_SaveObject(IOleClientSite *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleClientSite(iface);
     FIXME( "(%p) - stub\n", This );
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleClientSite(iface);
 
     FIXME( "(%p, 0x%x, 0x%x, %p)\n", This, dwAssign, dwWhichMoniker, ppmk );
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleClientSite(iface);
     TRACE( "(%p, %p)\n", This, ppContainer );
     return OleClientSite_QueryInterface( iface, &IID_IOleContainer, (void**)ppContainer );
 }
+
 static HRESULT WINAPI OleClientSite_ShowObject(IOleClientSite *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleClientSite(iface);
     FIXME( "(%p) - stub\n", This );
     return S_OK;
 }
+
 static HRESULT WINAPI OleClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleClientSite(iface);
     FIXME( "(%p, %s) - stub\n", This, fShow ? "TRUE" : "FALSE" );
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleClientSite_RequestNewObjectLayout(IOleClientSite *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleClientSite(iface);
     FIXME( "(%p) - stub\n", This );
     return E_NOTIMPL;
 }
-#undef IFACE2THIS
 
 
 /******      IOleContainer     *****/
-#define IFACE2THIS(iface) DEFINE_THIS(IOCS, OleContainer, iface)
+static inline IOCS *impl_from_IOleContainer(IOleContainer *iface)
+{
+    return CONTAINING_RECORD(iface, IOCS, IOleContainer_iface);
+}
+
 static HRESULT WINAPI OleContainer_QueryInterface( IOleContainer* iface, REFIID riid, void** ppv)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleContainer(iface);
     return IOCS_QueryInterface( This, riid, ppv );
 }
+
 static ULONG WINAPI OleContainer_AddRef(IOleContainer* iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleContainer(iface);
     return IOCS_AddRef(This);
 }
+
 static ULONG WINAPI OleContainer_Release(IOleContainer* iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleContainer(iface);
     return IOCS_Release(This);
 }
+
 static HRESULT WINAPI OleContainer_ParseDisplayName(IOleContainer* iface, IBindCtx* pbc,
         LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleContainer(iface);
     FIXME( "(%p,%p,%s,%p,%p) - stub\n", This, pbc, debugstr_w(pszDisplayName), pchEaten, ppmkOut );
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleContainer_EnumObjects(IOleContainer* iface, DWORD grfFlags, IEnumUnknown** ppenum)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleContainer(iface);
     FIXME( "(%p, %u, %p) - stub\n", This, grfFlags, ppenum );
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleContainer_LockContainer(IOleContainer* iface, BOOL fLock)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleContainer(iface);
     FIXME( "(%p, %s) - stub\n", This, fLock?"TRUE":"FALSE" );
     return E_NOTIMPL;
 }
-#undef  IFACE2THIS
 
 
 /******    IOleInPlaceSiteWindowless   *******/
-#define IFACE2THIS(iface) DEFINE_THIS(IOCS, OleInPlaceSiteWindowless, iface)
+static inline IOCS *impl_from_IOleInPlaceSiteWindowless(IOleInPlaceSiteWindowless *iface)
+{
+    return CONTAINING_RECORD(iface, IOCS, IOleInPlaceSiteWindowless_iface);
+}
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_QueryInterface(IOleInPlaceSiteWindowless *iface, REFIID riid, void **ppv)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     return IOCS_QueryInterface(This, riid, ppv);
 }
+
 static ULONG WINAPI OleInPlaceSiteWindowless_AddRef(IOleInPlaceSiteWindowless *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     return IOCS_AddRef(This);
 }
+
 static ULONG WINAPI OleInPlaceSiteWindowless_Release(IOleInPlaceSiteWindowless *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     return IOCS_Release(This);
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_GetWindow(IOleInPlaceSiteWindowless* iface, HWND* phwnd)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
 
     TRACE("(%p,%p)\n", This, phwnd);
     *phwnd = This->hWnd;
     return S_OK;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_ContextSensitiveHelp(IOleInPlaceSiteWindowless* iface, BOOL fEnterMode)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     FIXME("(%p,%d) - stub\n", This, fEnterMode);
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_CanInPlaceActivate(IOleInPlaceSiteWindowless *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     TRACE("(%p)\n", This);
     return S_OK;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_OnInPlaceActivate(IOleInPlaceSiteWindowless *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
 
     TRACE("(%p)\n", This);
 
     This->fInPlace = TRUE;
     return S_OK;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_OnUIActivate(IOleInPlaceSiteWindowless *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
 
     TRACE("(%p)\n", This);
 
@@ -338,7 +359,7 @@
         IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
         LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
 
     TRACE("(%p,%p,%p,%p,%p,%p)\n", This, ppFrame, ppDoc, lprcPosRect, lprcClipRect, lpFrameInfo);
 
@@ -365,48 +386,55 @@
 
     return S_OK;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_Scroll(IOleInPlaceSiteWindowless *iface, SIZE scrollExtent)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     FIXME("(%p) - stub\n", This);
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_OnUIDeactivate(IOleInPlaceSiteWindowless *iface, BOOL fUndoable)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     FIXME("(%p,%d) - stub\n", This, fUndoable);
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_OnInPlaceDeactivate(IOleInPlaceSiteWindowless *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
 
     TRACE("(%p)\n", This);
 
     This->fInPlace = This->fWindowless = FALSE;
     return S_OK;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_DiscardUndoState(IOleInPlaceSiteWindowless *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     FIXME("(%p) - stub\n", This);
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_DeactivateAndUndo(IOleInPlaceSiteWindowless *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     FIXME("(%p) - stub\n", This);
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_OnPosRectChange(IOleInPlaceSiteWindowless *iface, LPCRECT lprcPosRect)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
     FIXME("(%p,%p) - stub\n", This, lprcPosRect);
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_OnInPlaceActivateEx( IOleInPlaceSiteWindowless *iface, BOOL* pfNoRedraw, DWORD dwFlags)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
 
     TRACE("\n");
 
@@ -415,9 +443,10 @@
         This->fWindowless = TRUE;
     return S_OK;
 }
+
 static HRESULT WINAPI OleInPlaceSiteWindowless_OnInPlaceDeactivateEx( IOleInPlaceSiteWindowless *iface, BOOL fNoRedraw)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceSiteWindowless(iface);
 
     TRACE("\n");
 
@@ -489,29 +518,35 @@
     FIXME("\n");
     return E_NOTIMPL;
 }
-#undef IFACE2THIS
 
 
 /******    IOleInPlaceFrame   *******/
-#define IFACE2THIS(iface) DEFINE_THIS(IOCS, OleInPlaceFrame, iface)
+static inline IOCS *impl_from_IOleInPlaceFrame(IOleInPlaceFrame *iface)
+{
+    return CONTAINING_RECORD(iface, IOCS, IOleInPlaceFrame_iface);
+}
+
 static HRESULT WINAPI OleInPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
     return IOCS_QueryInterface(This, riid, ppv);
 }
+
 static ULONG WINAPI OleInPlaceFrame_AddRef(IOleInPlaceFrame *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
     return IOCS_AddRef(This);
 }
+
 static ULONG WINAPI OleInPlaceFrame_Release(IOleInPlaceFrame *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
     return IOCS_Release(This);
 }
+
 static HRESULT WINAPI OleInPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phWnd)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     TRACE( "(%p,%p)\n", This, phWnd );
 
@@ -521,7 +556,7 @@
 
 static HRESULT WINAPI OleInPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p,%d) - stub\n", This, fEnterMode );
     return E_NOTIMPL;
@@ -529,7 +564,7 @@
 
 static HRESULT WINAPI OleInPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p,%p) - stub\n", This, lprectBorder );
     return E_NOTIMPL;
@@ -537,7 +572,7 @@
 
 static HRESULT WINAPI OleInPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p,%p) - stub\n", This, pborderwidths );
     return E_NOTIMPL;
@@ -545,7 +580,7 @@
 
 static HRESULT WINAPI OleInPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p,%p) - stub\n", This, pborderwidths );
     return E_NOTIMPL;
@@ -553,7 +588,7 @@
 
 static HRESULT WINAPI OleInPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p,%p,%s) - stub\n", This, pActiveObject, debugstr_w(pszObjName) );
     return S_OK;
@@ -561,7 +596,7 @@
 
 static HRESULT WINAPI OleInPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p,%p,%p) - stub\n", This, hmenuShared, lpMenuWidths );
     return E_NOTIMPL;
@@ -569,14 +604,15 @@
 
 static HRESULT WINAPI OleInPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p,%p,%p,%p) - stub\n", This, hmenuShared, holemenu, hwndActiveObject );
     return E_NOTIMPL;
 }
+
 static HRESULT WINAPI OleInPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p, %p) - stub\n", This, hmenuShared );
     return E_NOTIMPL;
@@ -584,7 +620,7 @@
 
 static HRESULT WINAPI OleInPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p, %s) - stub\n", This, debugstr_w( pszStatusText ) );
     return E_NOTIMPL;
@@ -592,7 +628,7 @@
 
 static HRESULT WINAPI OleInPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p, %d) - stub\n", This, fEnable );
     return E_NOTIMPL;
@@ -600,31 +636,37 @@
 
 static HRESULT WINAPI OleInPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleInPlaceFrame(iface);
 
     FIXME( "(%p, %p, %x) - stub\n", This, lpmsg, wID );
     return E_NOTIMPL;
 }
-#undef IFACE2THIS
 
 
 /******    IOleControlSite    *******/
-#define IFACE2THIS(iface) DEFINE_THIS(IOCS, OleControlSite, iface)
+static inline IOCS *impl_from_IOleControlSite(IOleControlSite *iface)
+{
+    return CONTAINING_RECORD(iface, IOCS, IOleControlSite_iface);
+}
+
 static HRESULT WINAPI OleControlSite_QueryInterface(IOleControlSite *iface, REFIID riid, void **ppv)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleControlSite(iface);
     return IOCS_QueryInterface(This, riid, ppv);
 }
+
 static ULONG WINAPI OleControlSite_AddRef(IOleControlSite *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleControlSite(iface);
     return IOCS_AddRef(This);
 }
+
 static ULONG WINAPI OleControlSite_Release(IOleControlSite *iface)
 {
-    IOCS *This = IFACE2THIS(iface);
+    IOCS *This = impl_from_IOleControlSite(iface);
     return IOCS_Release(This);
 }
+
 static HRESULT WINAPI OleControlSite_OnControlInfoChanged( IOleControlSite* This)
 {
     FIXME( "\n" );
@@ -660,8 +702,6 @@
     FIXME( "\n" );
     return E_NOTIMPL;
 }
-#undef IFACE2THIS
-
 
 
 static const IOleClientSiteVtbl OleClientSite_vtbl = {
@@ -860,7 +900,7 @@
 {
     This->hWnd = hWnd;
     IUnknown_QueryInterface( pUnkControl, &IID_IOleObject, (void**)&This->control );
-    IOleObject_SetClientSite( This->control, THIS2IOLECLIENTSITE( This ) );
+    IOleObject_SetClientSite( This->control, &This->IOleClientSite_iface );
     SetWindowLongPtrW( hWnd, GWLP_USERDATA, (ULONG_PTR) This );
     This->OrigWndProc = (WNDPROC)SetWindowLongPtrW( hWnd, GWLP_WNDPROC, (ULONG_PTR) AtlHost_wndproc );
 
@@ -876,7 +916,8 @@
 
     GetClientRect( This->hWnd, &rect );
     IOCS_OnSize( This, &rect );
-    IOleObject_DoVerb( This->control, OLEIVERB_INPLACEACTIVATE, NULL, THIS2IOLECLIENTSITE( This ), 0, This->hWnd, &rect );
+    IOleObject_DoVerb( This->control, OLEIVERB_INPLACEACTIVATE, NULL, &This->IOleClientSite_iface,
+                       0, This->hWnd, &rect );
 
     return S_OK;
 }
@@ -895,11 +936,11 @@
     if (!This)
         return E_OUTOFMEMORY;
 
-    This->lpOleClientSiteVtbl = &OleClientSite_vtbl;
-    This->lpOleContainerVtbl = &OleContainer_vtbl;
-    This->lpOleInPlaceSiteWindowlessVtbl = &OleInPlaceSiteWindowless_vtbl;
-    This->lpOleInPlaceFrameVtbl = &OleInPlaceFrame_vtbl;
-    This->lpOleControlSiteVtbl = &OleControlSite_vtbl;
+    This->IOleClientSite_iface.lpVtbl = &OleClientSite_vtbl;
+    This->IOleContainer_iface.lpVtbl = &OleContainer_vtbl;
+    This->IOleInPlaceSiteWindowless_iface.lpVtbl = &OleInPlaceSiteWindowless_vtbl;
+    This->IOleInPlaceFrame_iface.lpVtbl = &OleInPlaceFrame_vtbl;
+    This->IOleControlSite_iface.lpVtbl = &OleControlSite_vtbl;
     This->ref = 1;
 
     This->OrigWndProc = NULL;
@@ -1170,7 +1211,7 @@
         src += strlenW(src) + 1; /* title */
         if ( GET_WORD(tmp) == '{' ) /* all this mess created because of this line */
         {
-            static const WCHAR AtlAxWin[9]={'A','t','l','A','x','W','i','n',0};
+            static const WCHAR AtlAxWin[] = {'A','t','l','A','x','W','i','n', 0};
             PUT_BLOCK(AtlAxWin, sizeof(AtlAxWin)/sizeof(WCHAR));
             PUT_BLOCK(tmp, strlenW(tmp)+1);
         } else

Modified: trunk/reactos/dll/win32/atl/atl_main.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atl_main.c?rev=56159&r1=56158&r2=56159&view=diff
==============================================================================
--- trunk/reactos/dll/win32/atl/atl_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/atl/atl_main.c [iso-8859-1] Thu Mar 15 20:17:15 2012
@@ -40,7 +40,7 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(atl);
 
-HINSTANCE hInst;
+DECLSPEC_HIDDEN HINSTANCE hInst;
 
 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 {
@@ -464,21 +464,29 @@
 
         TRACE("wci->m_wc.lpszClassName = %s\n", wci->m_wc.lpszClassName);
 
+        if (wci->m_lpszOrigName)
+            FIXME( "subclassing %s not implemented\n", debugstr_a(wci->m_lpszOrigName));
+
         if (!wci->m_wc.lpszClassName)
         {
-            sprintf(wci->m_szAutoName, "ATL%08lx", (UINT_PTR)wci);
+            snprintf(wci->m_szAutoName, sizeof(wci->m_szAutoName), "ATL%08lx", (UINT_PTR)wci);
             TRACE("auto-generated class name %s\n", wci->m_szAutoName);
             wci->m_wc.lpszClassName = wci->m_szAutoName;
         }
 
         atom = GetClassInfoExA(pm->m_hInst, wci->m_wc.lpszClassName, &wc);
         if (!atom)
+        {
+            wci->m_wc.hInstance = pm->m_hInst;
+            wci->m_wc.hCursor   = LoadCursorA( wci->m_bSystemCursor ? NULL : pm->m_hInst,
+                                               wci->m_lpszCursorID );
             atom = RegisterClassExA(&wci->m_wc);
-
+        }
         wci->pWndProc = wci->m_wc.lpfnWndProc;
         wci->m_atom = atom;
     }
-    *pProc = wci->pWndProc;
+
+    if (wci->m_lpszOrigName) *pProc = wci->pWndProc;
 
     TRACE("returning 0x%04x\n", atom);
     return atom;
@@ -515,22 +523,30 @@
 
         TRACE("wci->m_wc.lpszClassName = %s\n", debugstr_w(wci->m_wc.lpszClassName));
 
+        if (wci->m_lpszOrigName)
+            FIXME( "subclassing %s not implemented\n", debugstr_w(wci->m_lpszOrigName));
+
         if (!wci->m_wc.lpszClassName)
         {
             static const WCHAR szFormat[] = {'A','T','L','%','0','8','l','x',0};
-            sprintfW(wci->m_szAutoName, szFormat, (UINT_PTR)wci);
+            snprintfW(wci->m_szAutoName, sizeof(wci->m_szAutoName)/sizeof(WCHAR), szFormat, (UINT_PTR)wci);
             TRACE("auto-generated class name %s\n", debugstr_w(wci->m_szAutoName));
             wci->m_wc.lpszClassName = wci->m_szAutoName;
         }
 
         atom = GetClassInfoExW(pm->m_hInst, wci->m_wc.lpszClassName, &wc);
         if (!atom)
+        {
+            wci->m_wc.hInstance = pm->m_hInst;
+            wci->m_wc.hCursor   = LoadCursorW( wci->m_bSystemCursor ? NULL : pm->m_hInst,
+                                               wci->m_lpszCursorID );
             atom = RegisterClassExW(&wci->m_wc);
-
+        }
         wci->pWndProc = wci->m_wc.lpfnWndProc;
         wci->m_atom = atom;
     }
-    *pProc = wci->pWndProc;
+
+    if (wci->m_lpszOrigName) *pProc = wci->pWndProc;
 
     TRACE("returning 0x%04x\n", atom);
     return atom;

Modified: trunk/reactos/dll/win32/atl/atl_ros.diff
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/atl_ros.diff?rev=56159&r1=56158&r2=56159&view=diff
==============================================================================
--- trunk/reactos/dll/win32/atl/atl_ros.diff [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/atl/atl_ros.diff [iso-8859-1] Thu Mar 15 20:17:15 2012
@@ -11,3 +11,46 @@
  
      size = pM->cbSize;
      switch (size)
+Index: registrar.c
+===================================================================
+--- registrar.c	(revision 48273)
++++ registrar.c	(revision 48273)
+@@ -819,6 +819,19 @@
+     return hres;
+ }
+ 
++static HRESULT do_register_server(BOOL do_register)
++{
++    static const WCHAR CLSID_RegistrarW[] =
++            {'C','L','S','I','D','_','R','e','g','i','s','t','r','a','r',0};
++    static const WCHAR atl_dllW[] = {'a','t','l','.','d','l','l',0};
++
++    WCHAR clsid_str[40];
++    const struct _ATL_REGMAP_ENTRY reg_map[] = {{CLSID_RegistrarW, clsid_str}, {NULL,NULL}};
++
++    StringFromGUID2(&CLSID_Registrar, clsid_str, sizeof(clsid_str)/sizeof(WCHAR));
++    return do_register_dll_server(NULL, atl_dllW, MAKEINTRESOURCEW(101), do_register, reg_map);
++}
++
+ /***********************************************************************
+  *           AtlModuleUpdateRegistryFromResourceD         [ATL.@]
+  *
+@@ -849,7 +862,8 @@
+  */
+ HRESULT WINAPI DllRegisterServer(void)
+ {
+-    return __wine_register_resources( hInst );
++    /* Note: we can't use __wine_register_server here because it uses CLSID_Registrar which isn't registred yet */
++    return do_register_server(TRUE);
+ }
+ 
+ /***********************************************************************
+@@ -857,7 +871,7 @@
+  */
+ HRESULT WINAPI DllUnregisterServer(void)
+ {
+-    return __wine_unregister_resources( hInst );
++    return do_register_server(FALSE);
+ }
+ 
+ /***********************************************************************

Modified: trunk/reactos/dll/win32/atl/registrar.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/atl/registrar.c?rev=56159&r1=56158&r2=56159&view=diff
==============================================================================
--- trunk/reactos/dll/win32/atl/registrar.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/atl/registrar.c [iso-8859-1] Thu Mar 15 20:17:15 2012
@@ -27,8 +27,7 @@
 #include "winreg.h"
 #include "objbase.h"
 #include "oaidl.h"
-
-#define ATL_INITGUID
+#include "rpcproxy.h"
 #include "atliface.h"
 #include "atlbase.h"
 
@@ -78,7 +77,7 @@
 } rep_list;
 
 typedef struct {
-    const IRegistrarVtbl *lpVtbl;
+    IRegistrar IRegistrar_iface;
     LONG ref;
     rep_list *rep;
 } Registrar;
@@ -88,6 +87,11 @@
     DWORD alloc;
     DWORD len;
 } strbuf;
+
+static inline Registrar *impl_from_IRegistrar(IRegistrar *iface)
+{
+    return CONTAINING_RECORD(iface, Registrar, IRegistrar_iface);
+}
 
 static void strbuf_init(strbuf *buf)
 {
@@ -285,15 +289,11 @@
                     }
                     break;
                 case 'd': {
-                    WCHAR *end;
                     DWORD dw;
-                    if(*iter == '0' && iter[1] == 'x') {
-                        iter += 2;
-                        dw = strtolW(iter, &end, 16);
-                    }else {
-                        dw = strtolW(iter, &end, 10);
-                    }
-                    iter = end;
+                    hres = get_word(&iter, buf);
+                    if(FAILED(hres))
+                        break;
+                    dw = atoiW(buf->str);
                     lres = RegSetValueExW(hkey, name.len ? name.str :  NULL, 0, REG_DWORD,
                             (PBYTE)&dw, sizeof(dw));
                     if(lres != ERROR_SUCCESS) {
@@ -301,6 +301,41 @@
                         hres = HRESULT_FROM_WIN32(lres);
                         break;
                     }
+                    break;
+                }
+                case 'b': {
+                    BYTE *bytes;
+                    DWORD count;
+                    DWORD i;
+                    hres = get_word(&iter, buf);
+                    if(FAILED(hres))
+                        break;
+                    count = (lstrlenW(buf->str) + 1) / 2;
+                    bytes = HeapAlloc(GetProcessHeap(), 0, count);
+                    if(bytes == NULL) {
+                        hres = E_OUTOFMEMORY;
+                        break;
+                    }
+                    for(i = 0; i < count && buf->str[2*i]; i++) {
+                        WCHAR digits[3];
+                        if(!isxdigitW(buf->str[2*i]) || !isxdigitW(buf->str[2*i + 1])) {
+                            hres = E_FAIL;
+                            break;
+                        }
+                        digits[0] = buf->str[2*i];
+                        digits[1] = buf->str[2*i + 1];
+                        digits[2] = 0;
+                        bytes[i] = (BYTE) strtoulW(digits, NULL, 16);
+                    }
+                    if(SUCCEEDED(hres)) {
+                        lres = RegSetValueExW(hkey, name.len ? name.str :  NULL, 0, REG_BINARY,
+                            bytes, count);
+                        if(lres != ERROR_SUCCESS) {
+                            WARN("Could not set value of key: 0x%08x\n", lres);
+                            hres = HRESULT_FROM_WIN32(lres);
+                        }
+                    }
+                    HeapFree(GetProcessHeap(), 0, bytes);
                     break;
                 }
                 default:
@@ -518,7 +553,7 @@
 
 static ULONG WINAPI Registrar_AddRef(IRegistrar *iface)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     ULONG ref = InterlockedIncrement(&This->ref);
     TRACE("(%p) ->%d\n", This, ref);
     return ref;
@@ -526,7 +561,7 @@
 
 static ULONG WINAPI Registrar_Release(IRegistrar *iface)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     ULONG ref = InterlockedDecrement(&This->ref);
 
     TRACE("(%p) ->%d\n", This, ref);
@@ -540,7 +575,7 @@
 
 static HRESULT WINAPI Registrar_AddReplacement(IRegistrar *iface, LPCOLESTR Key, LPCOLESTR item)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     int len;
     rep_list *new_rep;
 
@@ -564,7 +599,7 @@
 
 static HRESULT WINAPI Registrar_ClearReplacements(IRegistrar *iface)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     rep_list *iter, *iter2;
 
     TRACE("(%p)\n", This);
@@ -588,7 +623,7 @@
 static HRESULT WINAPI Registrar_ResourceRegisterSz(IRegistrar* iface, LPCOLESTR resFileName,
                 LPCOLESTR szID, LPCOLESTR szType)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType));
     return resource_register(This, resFileName, szID, szType, TRUE);
 }
@@ -596,35 +631,35 @@
 static HRESULT WINAPI Registrar_ResourceUnregisterSz(IRegistrar* iface, LPCOLESTR resFileName,
                 LPCOLESTR szID, LPCOLESTR szType)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     TRACE("(%p)->(%s %s %s)\n", This, debugstr_w(resFileName), debugstr_w(szID), debugstr_w(szType));
     return resource_register(This, resFileName, szID, szType, FALSE);
 }
 
 static HRESULT WINAPI Registrar_FileRegister(IRegistrar* iface, LPCOLESTR fileName)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     TRACE("(%p)->(%s)\n", This, debugstr_w(fileName));
     return file_register(This, fileName, TRUE);
 }
 
 static HRESULT WINAPI Registrar_FileUnregister(IRegistrar* iface, LPCOLESTR fileName)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     FIXME("(%p)->(%s)\n", This, debugstr_w(fileName));
     return file_register(This, fileName, FALSE);
 }
 
 static HRESULT WINAPI Registrar_StringRegister(IRegistrar* iface, LPCOLESTR data)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     TRACE("(%p)->(%s)\n", This, debugstr_w(data));
     return string_register(This, data, TRUE);
 }
 
 static HRESULT WINAPI Registrar_StringUnregister(IRegistrar* iface, LPCOLESTR data)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     TRACE("(%p)->(%s)\n", This, debugstr_w(data));
     return string_register(This, data, FALSE);
 }
@@ -632,7 +667,7 @@
 static HRESULT WINAPI Registrar_ResourceRegister(IRegistrar* iface, LPCOLESTR resFileName,
                 UINT nID, LPCOLESTR szType)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     TRACE("(%p)->(%s %d %s)\n", iface, debugstr_w(resFileName), nID, debugstr_w(szType));
     return resource_register(This, resFileName, MAKEINTRESOURCEW(nID), szType, TRUE);
 }
@@ -640,7 +675,7 @@
 static HRESULT WINAPI Registrar_ResourceUnregister(IRegistrar* iface, LPCOLESTR resFileName,
                 UINT nID, LPCOLESTR szType)
 {
-    Registrar *This = (Registrar*)iface;
+    Registrar *This = impl_from_IRegistrar(iface);
     TRACE("(%p)->(%s %d %s)\n", This, debugstr_w(resFileName), nID, debugstr_w(szType));
     return resource_register(This, resFileName, MAKEINTRESOURCEW(nID), szType, FALSE);
 }
@@ -669,7 +704,7 @@
         return E_NOINTERFACE;
 
     ret = HeapAlloc(GetProcessHeap(), 0, sizeof(Registrar));
-    ret->lpVtbl = &RegistrarVtbl;
+    ret->IRegistrar_iface.lpVtbl = &RegistrarVtbl;
     ret->ref = 1;
     ret->rep = NULL;
     *ppvObject = ret;
@@ -827,16 +862,15 @@
  */
 HRESULT WINAPI DllRegisterServer(void)
 {
-    TRACE("\n");
+    /* Note: we can't use __wine_register_server here because it uses CLSID_Registrar which isn't registred yet */
     return do_register_server(TRUE);
 }
 
 /***********************************************************************
- *              DllRegisterServer (ATL.@)
+ *              DllUnRegisterServer (ATL.@)
  */
 HRESULT WINAPI DllUnregisterServer(void)
 {
-    TRACE("\n");
     return do_register_server(FALSE);
 }
 




More information about the Ros-diffs mailing list