[ros-diffs] [greatlrd] 21768: implement add and release ref

greatlrd at svn.reactos.org greatlrd at svn.reactos.org
Tue May 2 10:09:47 CEST 2006


Author: greatlrd
Date: Tue May  2 12:09:47 2006
New Revision: 21768

URL: http://svn.reactos.ru/svn/reactos?rev=21768&view=rev
Log:
implement add and release ref

Modified:
    trunk/reactos/dll/directx/ddraw/main/color_main.c

Modified: trunk/reactos/dll/directx/ddraw/main/color_main.c
URL: http://svn.reactos.ru/svn/reactos/trunk/reactos/dll/directx/ddraw/main/color_main.c?rev=21768&r1=21767&r2=21768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/main/color_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/main/color_main.c Tue May  2 12:09:47 2006
@@ -11,41 +11,78 @@
 #include "rosdraw.h"
 
 ULONG WINAPI
-Main_DirectDrawColorControl_AddRef(LPDIRECTDRAWCOLORCONTROL iface)
+DirectDrawColorControl_AddRef( LPDIRECTDRAWCOLORCONTROL iface)
 {   
-   	return 1;
+   DX_WINDBG_trace();
+      
+   IDirectDrawColorImpl * This = (IDirectDrawColorImpl*)iface;
+   
+   ULONG ref=0;
+    
+   if (iface!=NULL)
+   {
+       ref = InterlockedIncrement( (PLONG) &This->ref);       
+   }    
+   return ref; 
 }
 
 ULONG WINAPI
-Main_DirectDrawColorControl_Release(LPDIRECTDRAWCOLORCONTROL iface)
+DirectDrawColorControl_Release( LPDIRECTDRAWCOLORCONTROL iface)
 {
-    return 0;
+    DX_WINDBG_trace();
+
+    IDirectDrawColorImpl* This = (IDirectDrawColorImpl*)iface;
+	ULONG ref=0;
+
+	if (iface!=NULL)
+	{	  	
+		ref = InterlockedDecrement( (PLONG) &This->ref);
+            
+		if (ref == 0)
+		{		
+		    /* Add here if we need releae some memory pointer before 
+             * exists
+             */   
+		      			
+            if (This!=NULL)
+            {              
+			    HeapFree(GetProcessHeap(), 0, This);
+            }
+		}
+    }
+    return ref;
 }
 
 HRESULT WINAPI
-Main_DirectDrawColorControl_QueryInterface(LPDIRECTDRAWCOLORCONTROL iface, 
-										   REFIID riid, LPVOID* ppvObj) 
+DirectDrawColorControl_QueryInterface( LPDIRECTDRAWCOLORCONTROL iface, 
+									   REFIID riid, 
+                                       LPVOID* ppvObj) 
 {
-	return E_NOINTERFACE;
+   DX_WINDBG_trace();
+   DX_STUB;  
 }
 
 HRESULT WINAPI
-Main_DirectDrawColorControl_GetColorControls(LPDIRECTDRAWCOLORCONTROL iface, LPDDCOLORCONTROL lpColorControl)
+DirectDrawColorControl_GetColorControls( LPDIRECTDRAWCOLORCONTROL iface, 
+                                         LPDDCOLORCONTROL lpColorControl)
 {
-   	DX_STUB;
+   DX_WINDBG_trace();
+   DX_STUB;  
 }
 
 HRESULT WINAPI
-Main_DirectDrawColorControl_SetColorControls(LPDIRECTDRAWCOLORCONTROL iface, LPDDCOLORCONTROL lpColorControl)
+DirectDrawColorControl_SetColorControls( LPDIRECTDRAWCOLORCONTROL iface,
+                                         LPDDCOLORCONTROL lpColorControl)
 {
-   	DX_STUB;
+   DX_WINDBG_trace();
+   DX_STUB;  
 }
 
 IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable =
 {
-    Main_DirectDrawColorControl_QueryInterface,
-    Main_DirectDrawColorControl_AddRef,
-    Main_DirectDrawColorControl_Release,
-    Main_DirectDrawColorControl_GetColorControls,
-    Main_DirectDrawColorControl_SetColorControls
+    DirectDrawColorControl_QueryInterface,
+    DirectDrawColorControl_AddRef,
+    DirectDrawColorControl_Release,
+    DirectDrawColorControl_GetColorControls,
+    DirectDrawColorControl_SetColorControls
 };




More information about the Ros-diffs mailing list