winex11: Implement a separate entry point for PatBlt and simplify the StretchBlt...
[wine] / dlls / dplayx / dpclassfactory.c
index d233e95..d14169d 100644 (file)
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <stdarg.h>
 
 #include "windef.h"
 #include "winbase.h"
+#include "winuser.h"
 #include "objbase.h"
 #include "winerror.h"
 #include "wine/debug.h"
+#include "dplay.h"
+#include "dplobby.h"
+#include "initguid.h"
 #include "dpinit.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(dplay);
@@ -39,13 +43,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(dplay);
 typedef struct
 {
     /* IUnknown fields */
-    const IClassFactoryVtbl    *lpVtbl;
-    DWORD                       ref;
+    IClassFactory IClassFactory_iface;
+    LONG          ref;
 } IClassFactoryImpl;
 
+static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
+{
+    return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
+}
+
 static HRESULT WINAPI
 DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
-        IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+        IClassFactoryImpl *This = impl_from_IClassFactory(iface);
 
         FIXME("(%p)->(%s,%p),stub!\n",This,debugstr_guid(riid),ppobj);
 
@@ -54,12 +63,12 @@ DP_and_DPL_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) {
 
 static ULONG WINAPI
 DP_and_DPL_AddRef(LPCLASSFACTORY iface) {
-        IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+        IClassFactoryImpl *This = impl_from_IClassFactory(iface);
         return InterlockedIncrement(&This->ref);
 }
 
 static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) {
-        IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+        IClassFactoryImpl *This = impl_from_IClassFactory(iface);
         /* static class (reference starts @ 1), won't ever be freed */
         return InterlockedDecrement(&This->ref);
 }
@@ -67,7 +76,7 @@ static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) {
 static HRESULT WINAPI DP_and_DPL_CreateInstance(
         LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj
 ) {
-        IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+        IClassFactoryImpl *This = impl_from_IClassFactory(iface);
 
         TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
 
@@ -84,7 +93,7 @@ static HRESULT WINAPI DP_and_DPL_CreateInstance(
 }
 
 static HRESULT WINAPI DP_and_DPL_LockServer(LPCLASSFACTORY iface,BOOL dolock) {
-        IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
+        IClassFactoryImpl *This = impl_from_IClassFactory(iface);
         FIXME("(%p)->(%d),stub!\n",This,dolock);
         return S_OK;
 }
@@ -97,11 +106,11 @@ static const IClassFactoryVtbl DP_and_DPL_Vtbl = {
         DP_and_DPL_LockServer
 };
 
-static IClassFactoryImpl DP_and_DPL_CF = {&DP_and_DPL_Vtbl, 1 };
+static IClassFactoryImpl DP_and_DPL_CF = {{&DP_and_DPL_Vtbl}, 1 };
 
 
 /*******************************************************************************
- * DllGetClassObject [DPLAYX.11]
+ * DllGetClassObject [DPLAYX.@]
  * Retrieves DP or DPL class object from a DLL object
  *
  * NOTES
@@ -117,13 +126,13 @@ static IClassFactoryImpl DP_and_DPL_CF = {&DP_and_DPL_Vtbl, 1 };
  *    Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
  *             E_UNEXPECTED
  */
-DWORD WINAPI DPLAYX_DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID *ppv)
+HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 {
     TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
 
     if ( IsEqualCLSID( riid, &IID_IClassFactory ) )
     {
-        *ppv = (LPVOID)&DP_and_DPL_CF;
+        *ppv = &DP_and_DPL_CF;
         IClassFactory_AddRef( (IClassFactory*)*ppv );
 
         return S_OK;