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.

svn path=/trunk/; revision=11344
This commit is contained in:
Gé van Geldorp 2004-10-20 09:27:43 +00:00
parent b48649a01d
commit bf5400ab2a
30 changed files with 317 additions and 306 deletions

View file

@ -68,11 +68,7 @@ SUBDIRS = tests
@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)

View file

@ -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 @@ ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface)
TRACE("(%p)\n",This);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/******************************************************************************
@ -195,19 +197,16 @@ ULONG WINAPI AntiMonikerImpl_AddRef(IMoniker* iface)
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){
if (ref == 0) AntiMonikerImpl_Destroy(This);
AntiMonikerImpl_Destroy(This);
return 0;
}
return This->ref;
return ref;
}
/******************************************************************************

View file

@ -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 @@ ULONG WINAPI BindCtxImpl_AddRef(IBindCtx* iface)
TRACE("(%p)\n",This);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/******************************************************************************
@ -151,21 +154,19 @@ ULONG WINAPI BindCtxImpl_AddRef(IBindCtx* iface)
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;
}

View file

@ -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 @@ static ULONG WINAPI OLEClipbrd_IDataObject_AddRef(
TRACE("(%p)->(count=%lu)\n",This, This->ref);
This->ref++;
return InterlockedIncrement(&This->ref);
return This->ref;
}
/************************************************************************
@ -1179,23 +1180,24 @@ static ULONG WINAPI OLEClipbrd_IDataObject_Release(
* 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 @@ static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_AddRef(LPENUMFORMATETC iface)
if (This->pUnkDataObj)
IUnknown_AddRef(This->pUnkDataObj);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/************************************************************************
@ -1663,13 +1665,15 @@ static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_Release(LPENUMFORMATETC iface)
{
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 @@ static ULONG WINAPI OLEClipbrd_IEnumFORMATETC_Release(LPENUMFORMATETC iface)
}
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
return ref;
}
/************************************************************************

View file

@ -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 @@ void WINAPI CoUninitialize(void)
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 @@ HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc
dwCapabilities, pReserved3);
return S_OK;
}
/***********************************************************************
* CoSuspendClassObjects [OLE32.@]
*/
HRESULT WINAPI CoSuspendClassObjects(void)
{
FIXME("\n");
return S_OK;
}

View file

@ -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 @@ ULONG WINAPI CompositeMonikerImpl_AddRef(IMoniker* iface)
TRACE("(%p)\n",This);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/******************************************************************************
@ -253,23 +255,22 @@ ULONG WINAPI CompositeMonikerImpl_Release(IMoniker* iface)
{
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 @@ ULONG WINAPI EnumMonikerImpl_AddRef(IEnumMoniker* iface)
TRACE("(%p)\n",This);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
@ -1537,24 +1538,22 @@ ULONG WINAPI EnumMonikerImpl_AddRef(IEnumMoniker* iface)
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;
}
/******************************************************************************

View file

@ -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 @@ typedef struct DataCache DataCache;
/*
* 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 @@ static HRESULT WINAPI DataCache_Draw(
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 @@ static ULONG WINAPI DataCache_NDIUnknown_AddRef(
IUnknown* iface)
{
_ICOM_THIS_From_NDIUnknown(DataCache, iface);
this->ref++;
return this->ref;
return InterlockedIncrement(&this->ref);
}
/************************************************************************
@ -986,23 +985,19 @@ static ULONG WINAPI DataCache_NDIUnknown_Release(
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);
if (ref == 0) DataCache_Destroy(this);
return 0;
}
return this->ref;
return ref;
}
/*********************************************************
@ -1563,7 +1558,7 @@ static HRESULT WINAPI DataCache_Draw(
LPCRECTL lprcBounds,
LPCRECTL lprcWBounds,
BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue),
DWORD dwContinue)
ULONG_PTR dwContinue)
{
PresentationDataHeader presData;
HMETAFILE presMetafile = 0;

View file

@ -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 @@ typedef struct DefaultHandler DefaultHandler;
/*
* 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 @@ static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef(
IUnknown* iface)
{
_ICOM_THIS_From_NDIUnknown(DefaultHandler, iface);
this->ref++;
return this->ref;
return InterlockedIncrement(&this->ref);
}
/************************************************************************
@ -674,23 +673,19 @@ static ULONG WINAPI DefaultHandler_NDIUnknown_Release(
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);
if (ref == 0) DefaultHandler_Destroy(this);
return 0;
}
return this->ref;
return ref;
}
/*********************************************************

View file

@ -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 @@ ULONG WINAPI FileMonikerImpl_AddRef(IMoniker* iface)
TRACE("(%p)\n",iface);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/******************************************************************************
@ -203,19 +205,16 @@ ULONG WINAPI FileMonikerImpl_AddRef(IMoniker* iface)
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){
if (ref == 0) FileMonikerImpl_Destroy(This);
FileMonikerImpl_Destroy(This);
return 0;
}
return This->ref;
return ref;
}
/******************************************************************************

View file

@ -26,6 +26,8 @@
#include <string.h>
#include <assert.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "objbase.h"

View file

@ -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"

View file

@ -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 @@ ULONG WINAPI HGLOBALStreamImpl_AddRef(
IStream* iface)
{
HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface;
This->ref++;
return This->ref;
return InterlockedIncrement(&This->ref);
}
/***
@ -392,12 +391,9 @@ ULONG WINAPI HGLOBALStreamImpl_Release(
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.

View file

@ -26,6 +26,8 @@
#include <string.h>
#include <assert.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"

View file

@ -35,15 +35,20 @@ typedef LPCSTR LPCOLESTR16;
#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 @@ extern LPMALLOC16 IMalloc16_Constructor();
/**********************************************************************/
#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 @@ typedef struct tagSTATSTG16
} 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 @@ DECLARE_INTERFACE_(IStream16,ISequentialStream) { IStream16_METHODS };
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 */

View file

@ -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 @@ ULONG WINAPI ItemMonikerImpl_AddRef(IMoniker* iface)
TRACE("(%p)\n",This);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/******************************************************************************
@ -202,19 +204,16 @@ ULONG WINAPI ItemMonikerImpl_AddRef(IMoniker* iface)
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){
if (ref == 0) ItemMonikerImpl_Destroy(This);
ItemMonikerImpl_Destroy(This);
return 0;
}
return This->ref;
return ref;
}
/******************************************************************************

View file

@ -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 @@ StdMarshalImpl_QueryInterface(LPMARSHAL iface,REFIID riid,LPVOID *ppv) {
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

View file

@ -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 @@ HRESULT WINAPI HGLOBALLockBytesImpl_QueryInterface(
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_AddRef(ILockBytes* iface)
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;
}
/******************************************************************************

View file

@ -280,9 +280,7 @@ ULONG WINAPI HGLOBALLockBytesImpl16_AddRef(ILockBytes16* iface)
TRACE("(%p)\n",This);
This->ref++;
return This->ref;
return InterlockedIncrement(&This->ref);
}
/******************************************************************************
@ -292,20 +290,18 @@ ULONG WINAPI HGLOBALLockBytesImpl16_AddRef(ILockBytes16* iface)
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;
}
/******************************************************************************

View file

@ -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 @@ ULONG WINAPI RunningObjectTableImpl_AddRef(IRunningObjectTable* iface)
TRACE("(%p)\n",This);
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/***********************************************************************
@ -174,13 +176,14 @@ ULONG WINAPI RunningObjectTableImpl_Release(IRunningObjectTable* iface)
{
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 @@ ULONG WINAPI RunningObjectTableImpl_Release(IRunningObjectTable* iface)
/* there's no more elements in the table */
This->runObjTabRegister=0;
This->runObjTabLastIndx=0;
return 0;
}
return This->ref;
return ref;
}
/***********************************************************************

View file

@ -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"

View file

@ -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"

View file

@ -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)

View file

@ -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 @@ static ULONG WINAPI OleAdviseHolderImpl_Release(
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);
if (ref == 0) OleAdviseHolderImpl_Destructor(This);
return 0;
}
return This->ref;
return ref;
}
/******************************************************************************
@ -524,9 +523,7 @@ static ULONG WINAPI DataAdviseHolder_AddRef(
{
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 @@ static ULONG WINAPI DataAdviseHolder_Release(
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);
if (ref==0) DataAdviseHolder_Destructor(This);
return 0;
}
return This->ref;
return ref;
}
/************************************************************************

View file

@ -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 @@ CFStub_QueryInterface(LPRPCSTUBBUFFER iface, REFIID riid, LPVOID *ppv) {
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 HRESULT WINAPI IRpcProxyBufferImpl_QueryInterface(LPRPCPROXYBUFFER iface,
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 @@ CFProxy_QueryInterface(LPCLASSFACTORY iface,REFIID riid, LPVOID *ppv) {
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(

View file

@ -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 @@ PipeBuf_QueryInterface(
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");

View file

@ -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"

View file

@ -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 @@ ULONG WINAPI StgStreamImpl_AddRef(
IStream* iface)
{
StgStreamImpl* const This=(StgStreamImpl*)iface;
This->ref++;
return This->ref;
return InterlockedIncrement(&This->ref);
}
/***
@ -236,21 +235,19 @@ ULONG WINAPI StgStreamImpl_Release(
{
StgStreamImpl* const This=(StgStreamImpl*)iface;
ULONG newRef;
ULONG ref;
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)
{
StgStreamImpl_Destroy(This);
}
return newRef;
return ref;
}
/***

View file

@ -766,7 +766,8 @@ static int
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 @@ HRESULT WINAPI IStream16_fnQueryInterface(
*/
ULONG WINAPI IStream16_fnAddRef(IStream16* iface) {
IStream16Impl *This = (IStream16Impl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/******************************************************************************
@ -993,15 +994,15 @@ ULONG WINAPI IStream16_fnAddRef(IStream16* iface) {
*/
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 @@ HRESULT WINAPI IStream16_fnRead(
/* 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 @@ HRESULT WINAPI IStream16_fnRead(
/* 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 @@ HRESULT WINAPI IStream_fnQueryInterface(
*/
ULONG WINAPI IStream_fnAddRef(IStream* iface) {
IStream32Impl *This = (IStream32Impl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/******************************************************************************
@ -1487,14 +1488,14 @@ ULONG WINAPI IStream_fnAddRef(IStream* iface) {
*/
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 @@ HRESULT WINAPI IStorage16_fnQueryInterface(
*/
ULONG WINAPI IStorage16_fnAddRef(IStorage16* iface) {
IStorage16Impl *This = (IStorage16Impl *)iface;
return ++(This->ref);
return InterlockedIncrement(&This->ref);
}
/******************************************************************************
@ -1541,12 +1542,14 @@ ULONG WINAPI IStorage16_fnAddRef(IStorage16* iface) {
*/
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;
}
/******************************************************************************

View file

@ -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 @@ ULONG WINAPI StorageBaseImpl_AddRef(
IStorage* iface)
{
StorageBaseImpl *This = (StorageBaseImpl *)iface;
This->ref++;
return This->ref;
return InterlockedIncrement(&This->ref);
}
/************************************************************************
@ -311,12 +311,12 @@ ULONG WINAPI StorageBaseImpl_Release(
/*
* 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 @@ ULONG WINAPI StorageBaseImpl_Release(
* using virtual functions to implement the destructor.
*/
This->v_destructor(This);
return 0;
}
return This->ref;
return ref;
}
/************************************************************************
@ -2677,7 +2675,7 @@ ULONG Storage32Impl_AddExtBlockDepot(StorageImpl* This)
}
else
{
int i;
unsigned int i;
/*
* Follow the chain to the last one.
*/
@ -3637,9 +3635,7 @@ ULONG WINAPI IEnumSTATSTGImpl_AddRef(
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 WINAPI IEnumSTATSTGImpl_Release(
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 @@ static HRESULT STORAGE_WriteCompObj( LPSTORAGE pstg, CLSID *clsid,
/* 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;

View file

@ -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 @@ diff -u -r1.37 Makefile.in
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 @@ diff -u -r1.12 ifs.h
-
+#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 @@ diff -u -r1.12 ifs.h
-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 @@ diff -u -r1.12 ifs.h
-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 @@ diff -u -r1.5 ole32res.rc
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>