Commit in reactos/lib/ole32 on MAIN
Makefile.in+3-71.5 -> 1.6
antimoniker.c+7-81.6 -> 1.7
bindctx.c+8-71.5 -> 1.6
clipboard.c+12-101.5 -> 1.6
compobj.c+16-21.15 -> 1.16
compositemoniker.c+13-141.6 -> 1.7
datacache.c+16-211.7 -> 1.8
defaulthandler.c+12-171.6 -> 1.7
filemoniker.c+7-81.9 -> 1.10
ftmarshal.c+21.4 -> 1.5
git.c+4-21.4 -> 1.5
hglobalstream.c+4-81.6 -> 1.7
ifs.c+21.11 -> 1.12
ifs.h+70-471.6 -> 1.7
itemmoniker.c+7-81.8 -> 1.9
marshal.c+6-71.7 -> 1.8
memlockbytes.c+7-111.5 -> 1.6
memlockbytes16.c+5-91.3 -> 1.4
moniker.c+7-61.10 -> 1.11
ole2.c+21.16 -> 1.17
ole2impl.c+21.3 -> 1.4
ole32.spec+1-11.2 -> 1.3
oleobj.c+12-191.4 -> 1.5
oleproxy.c+17-191.7 -> 1.8
rpc.c+7-51.5 -> 1.6
stg_bigblockfile.c+21.4 -> 1.5
stg_stream.c+7-101.5 -> 1.6
storage.c+23-201.10 -> 1.11
storage32.c+11-151.8 -> 1.9
winehq2ros.patch+25-251.7 -> 1.8
+317-306
30 modified files
Sync to Wine-20041019:
Alexandre Julliard <julliard@winehq.org>
- Build the .h files from their idl source at compile time, and remove
them from CVS.
- Build idl files as part of the normal build process.
- Avoid depending on the non-standard IUnknown_METHODS macro in Wine
internal headers.
Francois Gouget <fgouget@free.fr>
- Don't define COBJMACROS in objbase.h.
- Update the Wine sources accordingly.
- Assorted spelling fixes.
Joris Huizer <jorishuizer@planet.nl>
- Ref count increment/decrement cleanup.
Robert Shearman <rob@codeweavers.com>
- Improve proxy destruction comment.
Mike McCormack <mike@codeweavers.com>
- CoSuspendClassObjects stub implementation.
Vincent Beron <vberon@mecano.gme.usherb.ca
- Fix some types problems.
Hans Leidekker <hans@it.vu.nl>
- Fix signed/unsigned comparison warnings.

reactos/lib/ole32
Makefile.in 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- Makefile.in	16 Oct 2004 20:27:36 -0000	1.5
+++ Makefile.in	20 Oct 2004 09:27:43 -0000	1.6
@@ -68,11 +68,7 @@
 
 @MAKE_DLL_RULES@
 
-.SUFFIXES: .idl .h
-
-.idl.h:
-	$(WIDL) $(IDLFLAGS) -b -h -H $@ $<
-
-idl: $(IDL_SRCS:.idl=.h)
-
 ### Dependencies:
+
+# note: this will get overwritten by make depend
+$(ALL_OBJS): $(IDL_SRCS:.idl=.h)

reactos/lib/ole32
antimoniker.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- antimoniker.c	19 Sep 2004 10:20:48 -0000	1.6
+++ antimoniker.c	20 Oct 2004 09:27:43 -0000	1.7
@@ -22,8 +22,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"
@@ -186,7 +188,7 @@
 
     TRACE("(%p)\n",This);
 
-    return ++(This->ref);
+    return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -195,19 +197,16 @@
 ULONG WINAPI AntiMonikerImpl_Release(IMoniker* iface)
 {
     AntiMonikerImpl *This = (AntiMonikerImpl *)iface;
+    ULONG ref;
 
     TRACE("(%p)\n",This);
 
-    This->ref--;
+    ref = InterlockedDecrement(&This->ref);
 
     /* destroy the object if there's no more reference on it */
-    if (This->ref==0){
-
-        AntiMonikerImpl_Destroy(This);
+    if (ref == 0) AntiMonikerImpl_Destroy(This);
 
-        return 0;
-    }
-    return This->ref;
+    return ref;
 }
 
 /******************************************************************************

reactos/lib/ole32
bindctx.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- bindctx.c	19 Sep 2004 10:20:48 -0000	1.5
+++ bindctx.c	20 Oct 2004 09:27:43 -0000	1.6
@@ -21,6 +21,9 @@
 #include <stdarg.h>
 #include <string.h>
 #include <assert.h>
+
+#define COBJMACROS
+
 #include "winerror.h"
 #include "windef.h"
 #include "winbase.h"
@@ -142,7 +145,7 @@
 
     TRACE("(%p)\n",This);
 
-    return ++(This->ref);
+    return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -151,21 +154,19 @@
 ULONG WINAPI BindCtxImpl_Release(IBindCtx* iface)
 {
     BindCtxImpl *This = (BindCtxImpl *)iface;
+    ULONG ref;
 
     TRACE("(%p)\n",This);
 
-    This->ref--;
-
-    if (This->ref==0){
+    ref = InterlockedDecrement(&This->ref);
 
+    if (ref == 0){
         /* release all registered objects */
         BindCtxImpl_ReleaseBoundObjects((IBindCtx*)This);
 
         BindCtxImpl_Destroy(This);
-
-        return 0;
     }
-    return This->ref;
+    return ref;
 }
 
 

reactos/lib/ole32
clipboard.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- clipboard.c	19 Sep 2004 10:20:48 -0000	1.5
+++ clipboard.c	20 Oct 2004 09:27:43 -0000	1.6
@@ -62,8 +62,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
@@ -1162,9 +1164,8 @@
 
   TRACE("(%p)->(count=%lu)\n",This, This->ref);
 
-  This->ref++;
+  return InterlockedIncrement(&This->ref);
 
-  return This->ref;
 }
 
 /************************************************************************
@@ -1179,23 +1180,24 @@
    * Declare "This" pointer
    */
   OLEClipbrd *This = (OLEClipbrd *)iface;
+  ULONG ref;
 
   TRACE("(%p)->(count=%lu)\n",This, This->ref);
 
   /*
    * Decrease the reference count on this object.
    */
-  This->ref--;
+  ref = InterlockedDecrement(&This->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.
    */
-  if (This->ref==0)
+  if (ref == 0)
   {
     OLEClipbrd_Destroy(This);
   }
 
-  return This->ref;
+  return ref;
 }
 
 
@@ -1651,7 +1653,7 @@
   if (This->pUnkDataObj)
     IUnknown_AddRef(This->pUnkDataObj);
 
-  return ++(This->ref);
+  return InterlockedIncrement(&This->ref);
 }
 
 /************************************************************************
@@ -1663,13 +1665,15 @@
 {
   IEnumFORMATETCImpl *This = (IEnumFORMATETCImpl *)iface;
   LPMALLOC pIMalloc;
+  ULONG ref;
 
   TRACE("(%p)->(count=%lu)\n",This, This->ref);
 
   if (This->pUnkDataObj)
     IUnknown_Release(This->pUnkDataObj);  /* Release parent data object */
 
-  if (!--(This->ref))
+  ref = InterlockedDecrement(&This->ref);
+  if (!ref)
   {
     TRACE("() - destroying IEnumFORMATETC(%p)\n",This);
     if (SUCCEEDED(CoGetMalloc(MEMCTX_TASK, &pIMalloc)))
@@ -1679,10 +1683,8 @@
     }
 
     HeapFree(GetProcessHeap(),0,This);
-    return 0;
   }
-
-  return This->ref;
+  return ref;
 }
 
 /************************************************************************

reactos/lib/ole32
compobj.c 1.15 -> 1.16
diff -u -r1.15 -r1.16
--- compobj.c	19 Sep 2004 10:20:48 -0000	1.15
+++ compobj.c	20 Oct 2004 09:27:43 -0000	1.16
@@ -31,8 +31,10 @@
 #include <string.h>
 #include <assert.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -513,8 +515,11 @@
     RunningObjectTableImpl_UnInitialize();
 
     /* disconnect proxies to release the corresponding stubs.
-     * FIXME: native version might not do this and we might just be working
-     * around bugs elsewhere. */
+     * It is confirmed in "Essential COM" in the sub-chapter on
+     * "Lifecycle Management and Marshaling" that the native version also
+     * does some kind of proxy cleanup in this function.
+     * FIXME: does it just disconnect or completely destroy the proxies?
+     * FIXME: should this be in the apartment destructor? */
     MARSHAL_Disconnect_Proxies();
 
     /* Release the references to the registered class objects */
@@ -2197,3 +2202,12 @@
         dwCapabilities, pReserved3);
   return S_OK;
 }
+
+/***********************************************************************
+ *           CoSuspendClassObjects [OLE32.@]
+ */
+HRESULT WINAPI CoSuspendClassObjects(void)
+{
+    FIXME("\n");
+    return S_OK;
+}

reactos/lib/ole32
compositemoniker.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- compositemoniker.c	19 Sep 2004 10:20:48 -0000	1.6
+++ compositemoniker.c	20 Oct 2004 09:27:43 -0000	1.7
@@ -22,8 +22,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -243,7 +245,7 @@
 
     TRACE("(%p)\n",This);
 
-    return ++(This->ref);
+    return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -253,23 +255,22 @@
 {
     CompositeMonikerImpl *This = (CompositeMonikerImpl *)iface;
     ULONG i;
+    ULONG ref;
 
     TRACE("(%p)\n",This);
 
-    This->ref--;
+    ref = InterlockedDecrement(&This->ref);
 
     /* destroy the object if there's no more reference on it */
-    if (This->ref==0){
+    if (ref == 0){
 
         /* release all the components before destroying this object */
         for (i=0;i<This->tabLastIndex;i++)
             IMoniker_Release(This->tabMoniker[i]);
 
         CompositeMonikerImpl_Destroy(This);
-
-        return 0;
     }
-    return This->ref;
+    return ref;
 }
 
 /******************************************************************************
@@ -1527,7 +1528,7 @@
 
     TRACE("(%p)\n",This);
 
-    return ++(This->ref);
+    return InterlockedIncrement(&This->ref);
 
 }
 
@@ -1537,24 +1538,22 @@
 ULONG   WINAPI EnumMonikerImpl_Release(IEnumMoniker* iface)
 {
     EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
-    ULONG i
-        ;
+    ULONG i;
+    ULONG ref;
     TRACE("(%p)\n",This);
 
-    This->ref--;
+    ref = InterlockedDecrement(&This->ref);
 
     /* destroy the object if there's no more reference on it */
-    if (This->ref==0){
+    if (ref == 0) {
 
         for(i=0;i<This->tabSize;i++)
             IMoniker_Release(This->tabMoniker[i]);
 
         HeapFree(GetProcessHeap(),0,This->tabMoniker);
         HeapFree(GetProcessHeap(),0,This);
-
-        return 0;
     }
-    return This->ref;
+    return ref;
 }
 
 /******************************************************************************

reactos/lib/ole32
datacache.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- datacache.c	19 Sep 2004 10:20:48 -0000	1.7
+++ datacache.c	20 Oct 2004 09:27:43 -0000	1.8
@@ -47,8 +47,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
@@ -131,15 +133,15 @@
 /*
  * Here, I define utility macros to help with the casting of the
  * "this" parameter.
- * There is a version to accomodate all of the VTables implemented
+ * There is a version to accommodate all of the VTables implemented
  * by this object.
  */
-#define _ICOM_THIS_From_IDataObject(class,name)       class* this = (class*)name;
-#define _ICOM_THIS_From_NDIUnknown(class, name)       class* this = (class*)(((char*)name)-sizeof(void*));
-#define _ICOM_THIS_From_IPersistStorage(class, name)  class* this = (class*)(((char*)name)-2*sizeof(void*));
-#define _ICOM_THIS_From_IViewObject2(class, name)     class* this = (class*)(((char*)name)-3*sizeof(void*));
-#define _ICOM_THIS_From_IOleCache2(class, name)       class* this = (class*)(((char*)name)-4*sizeof(void*));
-#define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*));
+#define _ICOM_THIS_From_IDataObject(class,name)       class* this = (class*)name
+#define _ICOM_THIS_From_NDIUnknown(class, name)       class* this = (class*)(((char*)name)-sizeof(void*))
+#define _ICOM_THIS_From_IPersistStorage(class, name)  class* this = (class*)(((char*)name)-2*sizeof(void*))
+#define _ICOM_THIS_From_IViewObject2(class, name)     class* this = (class*)(((char*)name)-3*sizeof(void*))
+#define _ICOM_THIS_From_IOleCache2(class, name)       class* this = (class*)(((char*)name)-4*sizeof(void*))
+#define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*))
 
 /*
  * Prototypes for the methods of the DataCache class.
@@ -277,7 +279,7 @@
 	    LPCRECTL         lprcBounds,
 	    LPCRECTL         lprcWBounds,
 	    BOOL  (CALLBACK *pfnContinue)(ULONG_PTR dwContinue),
-	    DWORD            dwContinue);
+	    ULONG_PTR        dwContinue);
 static HRESULT WINAPI DataCache_GetColorSet(
             IViewObject2*   iface,
 	    DWORD           dwDrawAspect,
@@ -968,10 +970,7 @@
             IUnknown*      iface)
 {
   _ICOM_THIS_From_NDIUnknown(DataCache, iface);
-
-  this->ref++;
-
-  return this->ref;
+  return InterlockedIncrement(&this->ref);
 }
 
 /************************************************************************
@@ -986,23 +985,19 @@
             IUnknown*      iface)
 {
   _ICOM_THIS_From_NDIUnknown(DataCache, iface);
+  ULONG ref;
 
   /*
    * Decrease the reference count on this object.
    */
-  this->ref--;
+  ref = InterlockedDecrement(&this->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.
    */
-  if (this->ref==0)
-  {
-    DataCache_Destroy(this);
-
-    return 0;
-  }
+  if (ref == 0) DataCache_Destroy(this);
 
-  return this->ref;
+  return ref;
 }
 
 /*********************************************************
@@ -1563,7 +1558,7 @@
 	    LPCRECTL         lprcBounds,
 	    LPCRECTL         lprcWBounds,
 	    BOOL  (CALLBACK *pfnContinue)(ULONG_PTR dwContinue),
-	    DWORD            dwContinue)
+	    ULONG_PTR        dwContinue)
 {
   PresentationDataHeader presData;
   HMETAFILE              presMetafile = 0;

reactos/lib/ole32
defaulthandler.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- defaulthandler.c	19 Sep 2004 10:20:48 -0000	1.6
+++ defaulthandler.c	20 Oct 2004 09:27:43 -0000	1.7
@@ -49,6 +49,8 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -123,13 +125,13 @@
 /*
  * Here, I define utility macros to help with the casting of the
  * "this" parameter.
- * There is a version to accomodate all of the VTables implemented
+ * There is a version to accommodate all of the VTables implemented
  * by this object.
  */
-#define _ICOM_THIS_From_IOleObject(class,name)       class* this = (class*)name;
-#define _ICOM_THIS_From_NDIUnknown(class, name)      class* this = (class*)(((char*)name)-sizeof(void*));
-#define _ICOM_THIS_From_IDataObject(class, name)     class* this = (class*)(((char*)name)-2*sizeof(void*));
-#define _ICOM_THIS_From_IRunnableObject(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*));
+#define _ICOM_THIS_From_IOleObject(class,name)       class* this = (class*)name
+#define _ICOM_THIS_From_NDIUnknown(class, name)      class* this = (class*)(((char*)name)-sizeof(void*))
+#define _ICOM_THIS_From_IDataObject(class, name)     class* this = (class*)(((char*)name)-2*sizeof(void*))
+#define _ICOM_THIS_From_IRunnableObject(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*))
 
 /*
  * Prototypes for the methods of the DefaultHandler class.
@@ -656,10 +658,7 @@
             IUnknown*      iface)
 {
   _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface);
-
-  this->ref++;
-
-  return this->ref;
+  return InterlockedIncrement(&this->ref);
 }
 
 /************************************************************************
@@ -674,23 +673,19 @@
             IUnknown*      iface)
 {
   _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface);
+  ULONG ref;
 
   /*
    * Decrease the reference count on this object.
    */
-  this->ref--;
+  ref = InterlockedDecrement(&this->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.
    */
-  if (this->ref==0)
-  {
-    DefaultHandler_Destroy(this);
-
-    return 0;
-  }
+  if (ref == 0) DefaultHandler_Destroy(this);
 
-  return this->ref;
+  return ref;
 }
 
 /*********************************************************

reactos/lib/ole32
filemoniker.c 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- filemoniker.c	19 Sep 2004 10:20:48 -0000	1.9
+++ filemoniker.c	20 Oct 2004 09:27:43 -0000	1.10
@@ -22,8 +22,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"
@@ -194,7 +196,7 @@
 
     TRACE("(%p)\n",iface);
 
-    return ++(This->ref);
+    return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -203,19 +205,16 @@
 ULONG WINAPI FileMonikerImpl_Release(IMoniker* iface)
 {
     FileMonikerImpl *This = (FileMonikerImpl *)iface;
+    ULONG ref;
 
     TRACE("(%p)\n",iface);
 
-    This->ref--;
+    ref = InterlockedDecrement(&This->ref);
 
     /* destroy the object if there's no more reference on it */
-    if (This->ref==0){
-
-        FileMonikerImpl_Destroy(This);
+    if (ref == 0) FileMonikerImpl_Destroy(This);
 
-        return 0;
-    }
-    return This->ref;
+    return ref;
 }
 
 /******************************************************************************

reactos/lib/ole32
ftmarshal.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- ftmarshal.c	19 Sep 2004 10:20:48 -0000	1.4
+++ ftmarshal.c	20 Oct 2004 09:27:43 -0000	1.5
@@ -26,6 +26,8 @@
 #include <string.h>
 #include <assert.h>
 
+#define COBJMACROS
+
 #include "windef.h"
 #include "winbase.h"
 #include "objbase.h"

reactos/lib/ole32
git.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- git.c	19 Sep 2004 10:20:48 -0000	1.4
+++ git.c	20 Oct 2004 09:27:43 -0000	1.5
@@ -26,14 +26,16 @@
 
 #include "config.h"
 
-#define NONAMELESSUNION
-#define NONAMELESSSTRUCT
 #include <assert.h>
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
 
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"

reactos/lib/ole32
hglobalstream.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- hglobalstream.c	19 Sep 2004 10:20:48 -0000	1.6
+++ hglobalstream.c	20 Oct 2004 09:27:43 -0000	1.7
@@ -29,8 +29,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -378,10 +380,7 @@
 		IStream* iface)
 {
   HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
-
-  This->ref++;
-
-  return This->ref;
+  return InterlockedIncrement(&This->ref);
 }
 
 /***
@@ -392,12 +391,9 @@
 		IStream* iface)
 {
   HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
-
   ULONG newRef;
 
-  This->ref--;
-
-  newRef = This->ref;
+  newRef = InterlockedDecrement(&This->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.

reactos/lib/ole32
ifs.c 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- ifs.c	19 Sep 2004 10:20:48 -0000	1.11
+++ ifs.c	20 Oct 2004 09:27:43 -0000	1.12
@@ -26,6 +26,8 @@
 #include <string.h>
 #include <assert.h>
 
+#define COBJMACROS
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"

reactos/lib/ole32
ifs.h 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- ifs.h	19 Sep 2004 09:11:12 -0000	1.6
+++ ifs.h	20 Oct 2004 09:27:43 -0000	1.7
@@ -35,15 +35,20 @@
 
 #undef INTERFACE
 #define INTERFACE IMalloc16
-#define IMalloc16_METHODS \
-    IUnknown_METHODS \
-    STDMETHOD_(LPVOID,Alloc)(THIS_ DWORD   cb) PURE; \
-    STDMETHOD_(LPVOID,Realloc)(THIS_ LPVOID  pv, DWORD  cb) PURE; \
-    STDMETHOD_(void,Free)(THIS_ LPVOID  pv) PURE; \
-    STDMETHOD_(DWORD,GetSize)(THIS_ LPVOID  pv) PURE; \
-    STDMETHOD_(INT16,DidAlloc)(THIS_ LPVOID  pv) PURE; \
+DECLARE_INTERFACE_(IMalloc16,IUnknown)
+{
+    /*** IUnknown methods ***/
+    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
+    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+    STDMETHOD_(ULONG,Release)(THIS) PURE;
+    /*** IMalloc16 methods ***/
+    STDMETHOD_(LPVOID,Alloc)(THIS_ DWORD   cb) PURE;
+    STDMETHOD_(LPVOID,Realloc)(THIS_ LPVOID  pv, DWORD  cb) PURE;
+    STDMETHOD_(void,Free)(THIS_ LPVOID  pv) PURE;
+    STDMETHOD_(DWORD,GetSize)(THIS_ LPVOID  pv) PURE;
+    STDMETHOD_(INT16,DidAlloc)(THIS_ LPVOID  pv) PURE;
     STDMETHOD_(LPVOID,HeapMinimize)(THIS) PURE;
-DECLARE_INTERFACE_(IMalloc16,IUnknown) { IMalloc16_METHODS };
+};
 #undef INTERFACE
 
 typedef struct IMalloc16 *LPMALLOC16;
@@ -54,17 +59,22 @@
 
 /**********************************************************************/
 
-#define INTERFACE ILockBytes
-#define ILockBytes16_METHODS \
-	IUnknown_METHODS \
-	STDMETHOD(ReadAt)(THIS_ ULARGE_INTEGER ulOffset, void *pv, ULONG  cb, ULONG *pcbRead) PURE; \
-	STDMETHOD(WriteAt)(THIS_ ULARGE_INTEGER ulOffset, const void *pv, ULONG cb, ULONG *pcbWritten) PURE; \
-	STDMETHOD(Flush)(THIS) PURE; \
-	STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER cb) PURE; \
-	STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER  cb, DWORD dwLockType) PURE; \
-	STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER  cb, DWORD dwLockType) PURE; \
-	STDMETHOD(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag) PURE;
-DECLARE_INTERFACE_(ILockBytes16,IUnknown) { ILockBytes16_METHODS };
+#define INTERFACE ILockBytes16
+DECLARE_INTERFACE_(ILockBytes16,IUnknown)
+{
+    /*** IUnknown methods ***/
+    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
+    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+    STDMETHOD_(ULONG,Release)(THIS) PURE;
+    /*** ILockBytes16 methods ***/
+    STDMETHOD(ReadAt)(THIS_ ULARGE_INTEGER ulOffset, void *pv, ULONG  cb, ULONG *pcbRead) PURE;
+    STDMETHOD(WriteAt)(THIS_ ULARGE_INTEGER ulOffset, const void *pv, ULONG cb, ULONG *pcbWritten) PURE;
+    STDMETHOD(Flush)(THIS) PURE;
+    STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER cb) PURE;
+    STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER  cb, DWORD dwLockType) PURE;
+    STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER  cb, DWORD dwLockType) PURE;
+    STDMETHOD(Stat)(THIS_ STATSTG *pstatstg, DWORD grfStatFlag) PURE;
+};
 #undef INTERFACE
 
 /**********************************************************************/
@@ -85,18 +95,26 @@
 } STATSTG16;
 
 #define INTERFACE IStream16
-#define IStream16_METHODS \
-    ISequentialStream_METHODS \
-    STDMETHOD(Seek)(THIS_ LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) PURE; \
-    STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER libNewSize) PURE; \
-    STDMETHOD(CopyTo)(THIS_ IStream16* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) PURE; \
-    STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags) PURE; \
-    STDMETHOD(Revert)(THIS) PURE; \
-    STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE; \
-    STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE; \
-    STDMETHOD(Stat)(THIS_ STATSTG* pstatstg, DWORD grfStatFlag) PURE; \
+DECLARE_INTERFACE_(IStream16,ISequentialStream)
+{
+    /*** IUnknown methods ***/
+    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
+    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+    STDMETHOD_(ULONG,Release)(THIS) PURE;
+    /*** ISequentialStream methods ***/
+    STDMETHOD_(HRESULT,Read)(THIS_ void* pv, ULONG cb, ULONG* pcbRead) PURE;
+    STDMETHOD_(HRESULT,Write)(THIS_ const void* pv, ULONG cb, ULONG* pcbWritten) PURE;
+    /*** IStream16 methods ***/
+    STDMETHOD(Seek)(THIS_ LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) PURE;
+    STDMETHOD(SetSize)(THIS_ ULARGE_INTEGER libNewSize) PURE;
+    STDMETHOD(CopyTo)(THIS_ IStream16* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) PURE;
+    STDMETHOD(Commit)(THIS_ DWORD grfCommitFlags) PURE;
+    STDMETHOD(Revert)(THIS) PURE;
+    STDMETHOD(LockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE;
+    STDMETHOD(UnlockRegion)(THIS_ ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) PURE;
+    STDMETHOD(Stat)(THIS_ STATSTG* pstatstg, DWORD grfStatFlag) PURE;
     STDMETHOD(Clone)(THIS_ IStream16** ppstm) PURE;
-DECLARE_INTERFACE_(IStream16,ISequentialStream) { IStream16_METHODS };
+};
 #undef INTERFACE
 
 /**********************************************************************/
@@ -104,24 +122,29 @@
 typedef OLECHAR16 **SNB16;
 
 #define INTERFACE IStorage16
-#define IStorage16_METHODS \
-    IUnknown_METHODS \
-    STDMETHOD_(HRESULT,CreateStream)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream16** ppstm) PURE; \
-    STDMETHOD_(HRESULT,OpenStream)(THIS_ LPCOLESTR16 pwcsName, void* reserved1, DWORD grfMode, DWORD reserved2, IStream16** ppstm) PURE; \
-    STDMETHOD_(HRESULT,CreateStorage)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage16** ppstg) PURE; \
-    STDMETHOD_(HRESULT,OpenStorage)(THIS_ LPCOLESTR16 pwcsName, IStorage16* pstgPriority, DWORD grfMode, SNB16 snbExclude, DWORD reserved, IStorage16** ppstg) PURE; \
-    STDMETHOD_(HRESULT,CopyTo)(THIS_ DWORD ciidExclude, const IID* rgiidExclude, SNB16 snbExclude, IStorage16* pstgDest) PURE; \
-    STDMETHOD_(HRESULT,MoveElementTo)(THIS_ LPCOLESTR16 pwcsName, IStorage16* pstgDest, LPCOLESTR16 pwcsNewName, DWORD grfFlags) PURE; \
-    STDMETHOD_(HRESULT,Commit)(THIS_ DWORD grfCommitFlags) PURE; \
-    STDMETHOD_(HRESULT,Revert)(THIS) PURE; \
-    STDMETHOD_(HRESULT,EnumElements)(THIS_ DWORD reserved1, void* reserved2, DWORD reserved3, IEnumSTATSTG** ppenum) PURE; \
-    STDMETHOD_(HRESULT,DestroyElement)(THIS_ LPCOLESTR16 pwcsName) PURE; \
-    STDMETHOD_(HRESULT,RenameElement)(THIS_ LPCOLESTR16 pwcsOldName, LPCOLESTR16 pwcsNewName) PURE; \
-    STDMETHOD_(HRESULT,SetElementTimes)(THIS_ LPCOLESTR16 pwcsName, const FILETIME* pctime, const FILETIME* patime, const FILETIME* pmtime) PURE; \
-    STDMETHOD_(HRESULT,SetClass)(THIS_ REFCLSID clsid) PURE; \
-    STDMETHOD_(HRESULT,SetStateBits)(THIS_ DWORD grfStateBits, DWORD grfMask) PURE; \
+DECLARE_INTERFACE_(IStorage16,IUnknown)
+{
+    /*** IUnknown methods ***/
+    STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
+    STDMETHOD_(ULONG,AddRef)(THIS) PURE;
+    STDMETHOD_(ULONG,Release)(THIS) PURE;
+    /*** IStorage16 methods ***/
+    STDMETHOD_(HRESULT,CreateStream)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream16** ppstm) PURE;
+    STDMETHOD_(HRESULT,OpenStream)(THIS_ LPCOLESTR16 pwcsName, void* reserved1, DWORD grfMode, DWORD reserved2, IStream16** ppstm) PURE;
+    STDMETHOD_(HRESULT,CreateStorage)(THIS_ LPCOLESTR16 pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage16** ppstg) PURE;
+    STDMETHOD_(HRESULT,OpenStorage)(THIS_ LPCOLESTR16 pwcsName, IStorage16* pstgPriority, DWORD grfMode, SNB16 snbExclude, DWORD reserved, IStorage16** ppstg) PURE;
+    STDMETHOD_(HRESULT,CopyTo)(THIS_ DWORD ciidExclude, const IID* rgiidExclude, SNB16 snbExclude, IStorage16* pstgDest) PURE;
+    STDMETHOD_(HRESULT,MoveElementTo)(THIS_ LPCOLESTR16 pwcsName, IStorage16* pstgDest, LPCOLESTR16 pwcsNewName, DWORD grfFlags) PURE;
+    STDMETHOD_(HRESULT,Commit)(THIS_ DWORD grfCommitFlags) PURE;
+    STDMETHOD_(HRESULT,Revert)(THIS) PURE;
+    STDMETHOD_(HRESULT,EnumElements)(THIS_ DWORD reserved1, void* reserved2, DWORD reserved3, IEnumSTATSTG** ppenum) PURE;
+    STDMETHOD_(HRESULT,DestroyElement)(THIS_ LPCOLESTR16 pwcsName) PURE;
+    STDMETHOD_(HRESULT,RenameElement)(THIS_ LPCOLESTR16 pwcsOldName, LPCOLESTR16 pwcsNewName) PURE;
+    STDMETHOD_(HRESULT,SetElementTimes)(THIS_ LPCOLESTR16 pwcsName, const FILETIME* pctime, const FILETIME* patime, const FILETIME* pmtime) PURE;
+    STDMETHOD_(HRESULT,SetClass)(THIS_ REFCLSID clsid) PURE;
+    STDMETHOD_(HRESULT,SetStateBits)(THIS_ DWORD grfStateBits, DWORD grfMask) PURE;
     STDMETHOD_(HRESULT,Stat)(THIS_ STATSTG* pstatstg, DWORD grfStatFlag) PURE;
-DECLARE_INTERFACE_(IStorage16,IUnknown) { IStorage16_METHODS };
+};
 #undef INTERFACE
 
 #endif /* __WINE_OLE_IFS_H */

reactos/lib/ole32
itemmoniker.c 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- itemmoniker.c	19 Sep 2004 10:20:48 -0000	1.8
+++ itemmoniker.c	20 Oct 2004 09:27:43 -0000	1.9
@@ -22,8 +22,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "winerror.h"
 #include "windef.h"
 #include "winbase.h"
@@ -193,7 +195,7 @@
 
     TRACE("(%p)\n",This);
 
-    return ++(This->ref);
+    return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -202,19 +204,16 @@
 ULONG WINAPI ItemMonikerImpl_Release(IMoniker* iface)
 {
     ItemMonikerImpl *This = (ItemMonikerImpl *)iface;
+    ULONG ref;
 
     TRACE("(%p)\n",This);
 
-    This->ref--;
+    ref = InterlockedDecrement(&This->ref);
 
     /* destroy the object if there's no more reference on it */
-    if (This->ref==0){
-
-        ItemMonikerImpl_Destroy(This);
+    if (ref == 0) ItemMonikerImpl_Destroy(This);
 
-        return 0;
-    }
-    return This->ref;
+    return ref;
 }
 
 /******************************************************************************

reactos/lib/ole32
marshal.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- marshal.c	19 Sep 2004 10:20:48 -0000	1.7
+++ marshal.c	20 Oct 2004 09:27:43 -0000	1.8
@@ -26,6 +26,8 @@
 #include <string.h>
 #include <assert.h>
 
+#define COBJMACROS
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -217,19 +219,16 @@
 static ULONG WINAPI
 StdMarshalImpl_AddRef(LPMARSHAL iface) {
   StdMarshalImpl *This = (StdMarshalImpl *)iface;
-  This->ref++;
-  return This->ref;
+  return InterlockedIncrement(&This->ref);
 }
 
 static ULONG WINAPI
 StdMarshalImpl_Release(LPMARSHAL iface) {
   StdMarshalImpl *This = (StdMarshalImpl *)iface;
-  This->ref--;
+  ULONG ref = InterlockedDecrement(&This->ref);
 
-  if (This->ref)
-    return This->ref;
-  HeapFree(GetProcessHeap(),0,This);
-  return 0;
+  if (!ref) HeapFree(GetProcessHeap(),0,This);
+  return ref;
 }
 
 static HRESULT WINAPI

reactos/lib/ole32
memlockbytes.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- memlockbytes.c	19 Sep 2004 10:20:48 -0000	1.5
+++ memlockbytes.c	20 Oct 2004 09:27:43 -0000	1.6
@@ -25,8 +25,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -351,10 +353,7 @@
 ULONG WINAPI HGLOBALLockBytesImpl_AddRef(ILockBytes* iface)
 {
   HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;
-
-  This->ref++;
-
-  return This->ref;
+  return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -364,22 +363,19 @@
 ULONG WINAPI HGLOBALLockBytesImpl_Release(ILockBytes* iface)
 {
   HGLOBALLockBytesImpl* const This=(HGLOBALLockBytesImpl*)iface;
+  ULONG ref;
 
-  ULONG newRef;
-
-  This->ref--;
-
-  newRef = This->ref;
+  ref = InterlockedDecrement(&This->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.
    */
-  if (newRef==0)
+  if (ref==0)
   {
     HGLOBALLockBytesImpl_Destroy(This);
   }
 
-  return newRef;
+  return ref;
 }
 
 /******************************************************************************

reactos/lib/ole32
memlockbytes16.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- memlockbytes16.c	14 Aug 2004 20:00:59 -0000	1.3
+++ memlockbytes16.c	20 Oct 2004 09:27:43 -0000	1.4
@@ -280,9 +280,7 @@
 
   TRACE("(%p)\n",This);
 
-  This->ref++;
-
-  return This->ref;
+  return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -292,20 +290,18 @@
 ULONG WINAPI HGLOBALLockBytesImpl16_Release(ILockBytes16* iface)
 {
   HGLOBALLockBytesImpl16* const This=(HGLOBALLockBytesImpl16*)iface;
+  ULONG ref;
 
-  ULONG newRef;
   TRACE("(%p)\n",This);
 
-  This->ref--;
-
-  newRef = This->ref;
+  ref = InterlockedDecrement(&This->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.
    */
-  if (newRef==0)
+  if (ref==0)
     HGLOBALLockBytesImpl16_Destroy(This);
-  return newRef;
+  return ref;
 }
 
 /******************************************************************************

reactos/lib/ole32
moniker.c 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- moniker.c	19 Sep 2004 10:20:48 -0000	1.10
+++ moniker.c	20 Oct 2004 09:27:43 -0000	1.11
@@ -31,6 +31,8 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
+
 #include "winerror.h"
 #include "windef.h"
 #include "winbase.h"
@@ -145,7 +147,7 @@
 
     TRACE("(%p)\n",This);
 
-    return ++(This->ref);
+    return InterlockedIncrement(&This->ref);
 }
 
 /***********************************************************************
@@ -174,13 +176,14 @@
 {
     DWORD i;
     RunningObjectTableImpl *This = (RunningObjectTableImpl *)iface;
+    ULONG ref;
 
     TRACE("(%p)\n",This);
 
-    This->ref--;
+    ref = InterlockedDecrement(&This->ref);
 
     /* unitialize ROT structure if there's no more reference to it*/
-    if (This->ref==0){
+    if (ref == 0) {
 
         /* release all registered objects */
         for(i=0;i<This->runObjTabLastIndx;i++)
@@ -197,11 +200,9 @@
         /* there's no more elements in the table */
         This->runObjTabRegister=0;
         This->runObjTabLastIndx=0;
-
-        return 0;
     }
 
-    return This->ref;
+    return ref;
 }
 
 /***********************************************************************

reactos/lib/ole32
ole2.c 1.16 -> 1.17
diff -u -r1.16 -r1.17
--- ole2.c	19 Sep 2004 10:20:48 -0000	1.16
+++ ole2.c	20 Oct 2004 09:27:43 -0000	1.17
@@ -28,8 +28,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"

reactos/lib/ole32
ole2impl.c 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- ole2impl.c	16 Jun 2004 07:06:50 -0000	1.3
+++ ole2impl.c	20 Oct 2004 09:27:43 -0000	1.4
@@ -21,8 +21,10 @@
 #include <stdarg.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"

reactos/lib/ole32
ole32.spec 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- ole32.spec	8 May 2004 13:32:51 -0000	1.2
+++ ole32.spec	20 Oct 2004 09:27:43 -0000	1.3
@@ -66,7 +66,7 @@
 @ stub CoSetProxyBlanket          #@ stdcall (ptr long long wstr long long ptr long) return 0,ERR_NOTIMPLEMENTED
 @ stdcall CoSetState(ptr)
 @ stub CoSwitchCallContext
-@ stub CoSuspendClassObjects      #@ stdcall () return 0,ERR_NOTIMPLEMENTED
+@ stdcall CoSuspendClassObjects()
 @ stdcall CoTaskMemAlloc(long)
 @ stdcall CoTaskMemFree(ptr)
 @ stdcall CoTaskMemRealloc(ptr long)

reactos/lib/ole32
oleobj.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- oleobj.c	19 Sep 2004 10:20:48 -0000	1.4
+++ oleobj.c	20 Oct 2004 09:27:43 -0000	1.5
@@ -22,6 +22,9 @@
 
 #include <stdarg.h>
 #include <string.h>
+
+#define COBJMACROS
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -189,17 +192,13 @@
   LPOLEADVISEHOLDER iface)
 {
   OleAdviseHolderImpl *This = (OleAdviseHolderImpl *)iface;
+  ULONG ref;
   TRACE("(%p)->(ref=%ld)\n", This, This->ref);
-  This->ref--;
+  ref = InterlockedDecrement(&This->ref);
 
-  if (This->ref == 0)
-  {
-    OleAdviseHolderImpl_Destructor(This);
-
-    return 0;
-  }
+  if (ref == 0) OleAdviseHolderImpl_Destructor(This);
 
-  return This->ref;
+  return ref;
 }
 
 /******************************************************************************
@@ -524,9 +523,7 @@
 {
   DataAdviseHolder *This = (DataAdviseHolder *)iface;
   TRACE("(%p) (ref=%ld)\n", This, This->ref);
-  This->ref++;
-
-  return This->ref;
+  return InterlockedIncrement(&This->ref);
 }
 
 /************************************************************************
@@ -538,24 +535,20 @@
   IDataAdviseHolder*      iface)
 {
   DataAdviseHolder *This = (DataAdviseHolder *)iface;
+  ULONG ref;
   TRACE("(%p) (ref=%ld)\n", This, This->ref);
 
   /*
    * Decrease the reference count on this object.
    */
-  This->ref--;
+  ref = InterlockedDecrement(&This->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.
    */
-  if (This->ref==0)
-  {
-    DataAdviseHolder_Destructor(This);
-
-    return 0;
-  }
+  if (ref==0) DataAdviseHolder_Destructor(This);
 
-  return This->ref;
+  return ref;
 }
 
 /************************************************************************

reactos/lib/ole32
oleproxy.c 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- oleproxy.c	19 Sep 2004 10:20:48 -0000	1.7
+++ oleproxy.c	20 Oct 2004 09:27:43 -0000	1.8
@@ -42,8 +42,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -104,20 +106,17 @@
 static ULONG WINAPI
 CFStub_AddRef(LPRPCSTUBBUFFER iface) {
     CFStub *This = (CFStub *)iface;
-
-    This->ref++;
-    return This->ref;
+    return InterlockedIncrement(&This->ref);
 }
 
 static ULONG WINAPI
 CFStub_Release(LPRPCSTUBBUFFER iface) {
     CFStub *This = (CFStub *)iface;
+    ULONG ref;
 
-    This->ref--;
-    if (This->ref)
-	return This->ref;
-    HeapFree(GetProcessHeap(),0,This);
-    return 0;
+    ref = InterlockedDecrement(&This->ref);
+    if (!ref) HeapFree(GetProcessHeap(),0,This);
+    return ref;
 }
 
 static HRESULT WINAPI
@@ -287,18 +286,18 @@
 
 static ULONG WINAPI IRpcProxyBufferImpl_AddRef(LPRPCPROXYBUFFER iface) {
     ICOM_THIS_MULTI(CFProxy,lpvtbl_proxy,iface);
-    return ++(This->ref);
+    return InterlockedIncrement(&This->ref);
 }
 
 static ULONG WINAPI IRpcProxyBufferImpl_Release(LPRPCPROXYBUFFER iface) {
     ICOM_THIS_MULTI(CFProxy,lpvtbl_proxy,iface);
+    ULONG ref = InterlockedDecrement(&This->ref);
 
-    if (!--(This->ref)) {
+    if (!ref) {
 	IRpcChannelBuffer_Release(This->chanbuf);This->chanbuf = NULL;
 	HeapFree(GetProcessHeap(),0,This);
-	return 0;
     }
-    return This->ref;
+    return ref;
 }
 
 static HRESULT WINAPI IRpcProxyBufferImpl_Connect(LPRPCPROXYBUFFER iface,IRpcChannelBuffer* pRpcChannelBuffer) {
@@ -332,17 +331,16 @@
 
 static ULONG   WINAPI CFProxy_AddRef(LPCLASSFACTORY iface) {
     ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface);
-    This->ref++;
-    return This->ref;
+    return InterlockedIncrement(&This->ref);
 }
 
 static ULONG   WINAPI CFProxy_Release(LPCLASSFACTORY iface) {
+    ULONG ref;
     ICOM_THIS_MULTI(CFProxy,lpvtbl_cf,iface);
-    This->ref--;
-    if (This->ref)
-	return This->ref;
-    HeapFree(GetProcessHeap(),0,This);
-    return 0;
+    
+    ref = InterlockedDecrement(&This->ref);
+    if (!ref) HeapFree(GetProcessHeap(),0,This);
+    return ref;
 }
 
 static HRESULT WINAPI CFProxy_CreateInstance(

reactos/lib/ole32
rpc.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- rpc.c	19 Sep 2004 10:20:48 -0000	1.5
+++ rpc.c	20 Oct 2004 09:27:43 -0000	1.6
@@ -26,8 +26,10 @@
 #include <string.h>
 #include <assert.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"
@@ -286,20 +288,20 @@
 static ULONG WINAPI
 PipeBuf_AddRef(LPRPCCHANNELBUFFER iface) {
     PipeBuf *This = (PipeBuf *)iface;
-    This->ref++;
-    return This->ref;
+    return InterlockedIncrement(&This->ref);
 }
 
 static ULONG WINAPI
 PipeBuf_Release(LPRPCCHANNELBUFFER iface) {
     PipeBuf *This = (PipeBuf *)iface;
+    ULONG ref;
     wine_rpc_disconnect_header header;
     HANDLE pipe;
     DWORD reqtype = REQTYPE_DISCONNECT;
 
-    This->ref--;
-    if (This->ref)
-	return This->ref;
+    ref = InterlockedDecrement(&This->ref);
+    if (ref)
+	return ref;
 
     FIXME("Free all stuff\n");
 

reactos/lib/ole32
stg_bigblockfile.c 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- stg_bigblockfile.c	22 Jan 2004 20:12:04 -0000	1.4
+++ stg_bigblockfile.c	20 Oct 2004 09:27:43 -0000	1.5
@@ -38,8 +38,10 @@
 #include <string.h>
 #include <limits.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winuser.h"

reactos/lib/ole32
stg_stream.c 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- stg_stream.c	19 Sep 2004 10:20:48 -0000	1.5
+++ stg_stream.c	20 Oct 2004 09:27:43 -0000	1.6
@@ -29,8 +29,10 @@
 #include <stdio.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winerror.h"
@@ -221,10 +223,7 @@
 		IStream* iface)
 {
   StgStreamImpl* const This=(StgStreamImpl*)iface;
-
-  This->ref++;
-
-  return This->ref;
+  return InterlockedIncrement(&This->ref);
 }
 
 /***
@@ -236,21 +235,19 @@
 {
   StgStreamImpl* const This=(StgStreamImpl*)iface;
 
-  ULONG newRef;
-
-  This->ref--;
+  ULONG ref;
 
-  newRef = This->ref;
+  ref = InterlockedDecrement(&This->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.
    */
-  if (newRef==0)
+  if (ref==0)
   {
     StgStreamImpl_Destroy(This);
   }
 
-  return newRef;
+  return ref;
 }
 
 /***

reactos/lib/ole32
storage.c 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- storage.c	19 Sep 2004 10:20:48 -0000	1.10
+++ storage.c	20 Oct 2004 09:27:43 -0000	1.11
@@ -766,7 +766,8 @@
 STORAGE_get_free_big_blocknr(HANDLE hf) {
 	BYTE	block[BIGSIZE];
 	LPINT	sbd = (LPINT)block;
-	int	lastbigblocknr,i,curblock,bigblocknr;
+	int	lastbigblocknr,i,bigblocknr;
+	unsigned int curblock;
 	struct storage_header sth;
 	BOOL ret;
 
@@ -985,7 +986,7 @@
  */
 ULONG WINAPI IStream16_fnAddRef(IStream16* iface) {
 	IStream16Impl *This = (IStream16Impl *)iface;
-	return ++(This->ref);
+	return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -993,15 +994,15 @@
  */
 ULONG WINAPI IStream16_fnRelease(IStream16* iface) {
 	IStream16Impl *This = (IStream16Impl *)iface;
+        ULONG ref;
 	FlushFileBuffers(This->hf);
-	This->ref--;
-	if (!This->ref) {
+        ref = InterlockedDecrement(&This->ref);
+	if (!ref) {
 		CloseHandle(This->hf);
                 UnMapLS( This->thisptr );
 		HeapFree( GetProcessHeap(), 0, This );
-		return 0;
 	}
-	return This->ref;
+	return ref;
 }
 
 /******************************************************************************
@@ -1073,7 +1074,7 @@
 		/* use small block reader */
 		blocknr = STORAGE_get_nth_next_small_blocknr(This->hf,This->stde.pps_sb,This->offset.u.LowPart/SMALLSIZE);
 		while (cb) {
-			int	cc;
+			unsigned int cc;
 
 			if (!STORAGE_get_small_block(This->hf,blocknr,block)) {
 			   WARN("small block read failed!!!\n");
@@ -1093,7 +1094,7 @@
 		/* use big block reader */
 		blocknr = STORAGE_get_nth_next_big_blocknr(This->hf,This->stde.pps_sb,This->offset.u.LowPart/BIGSIZE);
 		while (cb) {
-			int	cc;
+			unsigned int cc;
 
 			if (!STORAGE_get_big_block(This->hf,blocknr,block)) {
 				WARN("big block read failed!!!\n");
@@ -1479,7 +1480,7 @@
  */
 ULONG WINAPI IStream_fnAddRef(IStream* iface) {
 	IStream32Impl *This = (IStream32Impl *)iface;
-	return ++(This->ref);
+	return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -1487,14 +1488,14 @@
  */
 ULONG WINAPI IStream_fnRelease(IStream* iface) {
 	IStream32Impl *This = (IStream32Impl *)iface;
+        ULONG ref;
 	FlushFileBuffers(This->hf);
-	This->ref--;
-	if (!This->ref) {
+        ref = InterlockedDecrement(&This->ref);
+	if (!ref) {
 		CloseHandle(This->hf);
 		HeapFree( GetProcessHeap(), 0, This );
-		return 0;
 	}
-	return This->ref;
+	return ref;
 }
 
 /* --- IStorage16 implementation */
@@ -1533,7 +1534,7 @@
  */
 ULONG WINAPI IStorage16_fnAddRef(IStorage16* iface) {
 	IStorage16Impl *This = (IStorage16Impl *)iface;
-	return ++(This->ref);
+	return InterlockedIncrement(&This->ref);
 }
 
 /******************************************************************************
@@ -1541,12 +1542,14 @@
  */
 ULONG WINAPI IStorage16_fnRelease(IStorage16* iface) {
 	IStorage16Impl *This = (IStorage16Impl *)iface;
-	This->ref--;
-	if (This->ref)
-		return This->ref;
-        UnMapLS( This->thisptr );
-        HeapFree( GetProcessHeap(), 0, This );
-	return 0;
+        ULONG ref;
+        ref = InterlockedDecrement(&This->ref);
+        if (!ref)
+        {
+            UnMapLS( This->thisptr );
+            HeapFree( GetProcessHeap(), 0, This );
+        }
+        return ref;
 }
 
 /******************************************************************************

reactos/lib/ole32
storage32.c 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- storage32.c	19 Sep 2004 10:20:48 -0000	1.8
+++ storage32.c	20 Oct 2004 09:27:43 -0000	1.9
@@ -30,8 +30,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#define COBJMACROS
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+
 #include "windef.h"
 #include "winbase.h"
 #include "winnls.h"
@@ -291,9 +293,7 @@
             IStorage* iface)
 {
   StorageBaseImpl *This = (StorageBaseImpl *)iface;
-  This->ref++;
-
-  return This->ref;
+  return InterlockedIncrement(&This->ref);
 }
 
 /************************************************************************
@@ -311,12 +311,12 @@
   /*
    * Decrease the reference count on this object.
    */
-  This->ref--;
+  ULONG ref = InterlockedDecrement(&This->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.
    */
-  if (This->ref==0)
+  if (ref == 0)
   {
     /*
      * Since we are using a system of base-classes, we want to call the
@@ -324,11 +324,9 @@
      * using virtual functions to implement the destructor.
      */
     This->v_destructor(This);
-
-    return 0;
   }
 
-  return This->ref;
+  return ref;
 }
 
 /************************************************************************
@@ -2677,7 +2675,7 @@
   }
   else
   {
-    int i;
+    unsigned int i;
     /*
      * Follow the chain to the last one.
      */
@@ -3637,9 +3635,7 @@
   IEnumSTATSTG* iface)
 {
   IEnumSTATSTGImpl* const This=(IEnumSTATSTGImpl*)iface;
-
-  This->ref++;
-  return This->ref;
+  return InterlockedIncrement(&This->ref);
 }
 
 ULONG   WINAPI IEnumSTATSTGImpl_Release(
@@ -3649,8 +3645,7 @@
 
   ULONG newRef;
 
-  This->ref--;
-  newRef = This->ref;
+  newRef = InterlockedDecrement(&This->ref);
 
   /*
    * If the reference count goes down to 0, perform suicide.
@@ -6667,7 +6662,8 @@
 /* enumerate HKEY_CLASSES_ROOT\\CLSID looking for a CLSID whose name matches */
 static HRESULT CLSIDFromUserType(LPCWSTR lpszUserType, CLSID *clsid)
 {
-    LONG r, count, i, len;
+    LONG r, i, len;
+    ULONG count;
     WCHAR szKey[0x40];
     HKEY hkey, hkeyclsid;
     LPWSTR buffer = NULL;

reactos/lib/ole32
winehq2ros.patch 1.7 -> 1.8
diff -u -r1.7 -r1.8
--- winehq2ros.patch	16 Oct 2004 20:27:36 -0000	1.7
+++ winehq2ros.patch	20 Oct 2004 09:27:43 -0000	1.8
@@ -1,10 +1,10 @@
 Index: Makefile.in
 ===================================================================
 RCS file: /home/wine/wine/dlls/ole32/Makefile.in,v
-retrieving revision 1.37
-diff -u -r1.37 Makefile.in
---- Makefile.in	22 Aug 2004 22:33:57 -0000	1.37
-+++ Makefile.in	16 Oct 2004 17:16:49 -0000
+retrieving revision 1.39
+diff -u -r1.39 Makefile.in
+--- Makefile.in	21 Sep 2004 00:35:03 -0000	1.39
++++ Makefile.in	20 Oct 2004 09:21:24 -0000
 @@ -53,7 +53,7 @@
  	ole2thk.spec \
  	storage.spec
@@ -17,10 +17,10 @@
 Index: ifs.h
 ===================================================================
 RCS file: /home/wine/wine/dlls/ole32/ifs.h,v
-retrieving revision 1.12
-diff -u -r1.12 ifs.h
---- ifs.h	12 Aug 2004 03:33:30 -0000	1.12
-+++ ifs.h	16 Oct 2004 17:16:49 -0000
+retrieving revision 1.13
+diff -u -r1.13 ifs.h
+--- ifs.h	5 Oct 2004 04:16:21 -0000	1.13
++++ ifs.h	20 Oct 2004 09:21:25 -0000
 @@ -33,8 +33,7 @@
   * IMalloc16 interface
   */
@@ -29,10 +29,10 @@
 -
 +#undef INTERFACE
  #define INTERFACE IMalloc16
- #define IMalloc16_METHODS \
-     IUnknown_METHODS \
-@@ -47,14 +46,14 @@
- DECLARE_INTERFACE_(IMalloc16,IUnknown) { IMalloc16_METHODS };
+ DECLARE_INTERFACE_(IMalloc16,IUnknown)
+ {
+@@ -52,14 +51,14 @@
+ };
  #undef INTERFACE
  
 +typedef struct IMalloc16 *LPMALLOC16;
@@ -45,19 +45,19 @@
  
 -typedef struct ILockBytes16 *LPLOCKBYTES16, ILockBytes16;
 -
- #define INTERFACE ILockBytes
- #define ILockBytes16_METHODS \
- 	IUnknown_METHODS \
-@@ -85,8 +84,6 @@
+ #define INTERFACE ILockBytes16
+ DECLARE_INTERFACE_(ILockBytes16,IUnknown)
+ {
+@@ -95,8 +94,6 @@
      DWORD reserved;
  } STATSTG16;
  
 -typedef struct IStream16 IStream16, *LPSTREAM16;
 -
  #define INTERFACE IStream16
- #define IStream16_METHODS \
-     ISequentialStream_METHODS \
-@@ -105,8 +102,6 @@
+ DECLARE_INTERFACE_(IStream16,ISequentialStream)
+ {
+@@ -123,8 +120,6 @@
  /**********************************************************************/
  
  typedef OLECHAR16 **SNB16;
@@ -65,14 +65,14 @@
 -typedef struct IStorage16 IStorage16, *LPSTORAGE16;
  
  #define INTERFACE IStorage16
- #define IStorage16_METHODS \
+ DECLARE_INTERFACE_(IStorage16,IUnknown)
 Index: ole32res.rc
 ===================================================================
 RCS file: /home/wine/wine/dlls/ole32/ole32res.rc,v
 retrieving revision 1.5
 diff -u -r1.5 ole32res.rc
 --- ole32res.rc	3 Oct 2003 05:01:34 -0000	1.5
-+++ ole32res.rc	16 Oct 2004 17:16:49 -0000
++++ ole32res.rc	20 Oct 2004 09:21:25 -0000
 @@ -23,6 +23,8 @@
  #include "winuser.h"
  #include "winnls.h"
@@ -85,10 +85,10 @@
 Index: oleproxy.c
 ===================================================================
 RCS file: /home/wine/wine/dlls/ole32/oleproxy.c,v
-retrieving revision 1.21
-diff -u -r1.21 oleproxy.c
---- oleproxy.c	9 Sep 2004 21:03:58 -0000	1.21
-+++ oleproxy.c	16 Oct 2004 17:16:50 -0000
+retrieving revision 1.23
+diff -u -r1.23 oleproxy.c
+--- oleproxy.c	7 Oct 2004 03:06:49 -0000	1.23
++++ oleproxy.c	20 Oct 2004 09:21:25 -0000
 @@ -38,6 +38,7 @@
  
  #include <stdlib.h>
CVSspam 0.2.8