static ULONG WINAPI IStream_fnAddRef(IStream *iface)\r
{\r
ISHRegStream *This = (ISHRegStream *)iface;\r
+ ULONG refCount = InterlockedIncrement(&This->ref);\r
+ \r
+ TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);\r
\r
- TRACE("(%p)->(count=%lu)\n",This, This->ref);\r
-\r
- return InterlockedIncrement(&This->ref);\r
+ return refCount;\r
}\r
\r
/**************************************************************************\r
static ULONG WINAPI IStream_fnRelease(IStream *iface)\r
{\r
ISHRegStream *This = (ISHRegStream *)iface;\r
+ ULONG refCount = InterlockedDecrement(&This->ref);\r
\r
- TRACE("(%p)->()\n",This);\r
+ TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);\r
\r
- if (!InterlockedDecrement(&This->ref))\r
+ if (!refCount)\r
{\r
TRACE(" destroying SHReg IStream (%p)\n",This);\r
\r
HeapFree(GetProcessHeap(),0,This);\r
return 0;\r
}\r
- return This->ref;\r
+\r
+ return refCount;\r
}\r
\r
/**************************************************************************\r