[ros-diffs] [greatlrd] 38585: rename ddcs to gcsWinWatchLock add global windows watch list call gpWinWatchList it will be use by DciBeginAccess and DciEndAccess. Change behavior in WinWatchOpen so it store the new hww into gpWinWatchList. Change behavior WinWatchClose so it remove the hww entry inside gpWinWatchList.
greatlrd at svn.reactos.org
greatlrd at svn.reactos.org
Mon Jan 5 18:10:22 CET 2009
Author: greatlrd
Date: Mon Jan 5 11:10:21 2009
New Revision: 38585
URL: http://svn.reactos.org/svn/reactos?rev=38585&view=rev
Log:
rename ddcs to gcsWinWatchLock
add global windows watch list call gpWinWatchList it will be use by DciBeginAccess and DciEndAccess.
Change behavior in WinWatchOpen so it store the new hww into gpWinWatchList.
Change behavior WinWatchClose so it remove the hww entry inside gpWinWatchList.
Modified:
branches/reactx/reactos/dll/win32/dciman32/dciman_main.c
Modified: branches/reactx/reactos/dll/win32/dciman32/dciman_main.c
URL: http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/dciman32/dciman_main.c?rev=38585&r1=38584&r2=38585&view=diff
==============================================================================
--- branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] (original)
+++ branches/reactx/reactos/dll/win32/dciman32/dciman_main.c [iso-8859-1] Mon Jan 5 11:10:21 2009
@@ -9,12 +9,13 @@
#include <ddrawgdi.h>
#include <pseh/pseh.h>
-CRITICAL_SECTION ddcs;
+
/* Winwatch internal struct */
typedef struct _WINWATCH_INT
{
+ LPVOID prev;
HWND hWnd;
BOOL WinWatchStatus;
LPRGNDATA lpRgnData;
@@ -41,6 +42,11 @@
} DCISURFACE_INT, *LPDCISURFACE_INT;
+/* Global value */
+LPWINWATCH_INT gpWinWatchList;
+CRITICAL_SECTION gcsWinWatchLock;
+
+/* Function */
BOOL
WINAPI
DllMain( HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID reserved )
@@ -48,11 +54,11 @@
switch(ul_reason_for_call)
{
case DLL_PROCESS_DETACH:
- DeleteCriticalSection( &ddcs );
+ DeleteCriticalSection( &gcsWinWatchLock );
break;
case DLL_PROCESS_ATTACH:
- InitializeCriticalSection( &ddcs );
+ InitializeCriticalSection( &gcsWinWatchLock );
break;
}
return TRUE;
@@ -404,41 +410,115 @@
return retvalue;
}
+/*++
+* @name DWORD WINAPI WinWatchOpen(HWND hwnd)
+* @implemented
+*
+
+* @return
+*
+* @remarks.
+* None
+*/
HWINWATCH WINAPI
WinWatchOpen(HWND hwnd)
{
LPWINWATCH_INT pWinwatch_int;
- EnterCriticalSection(&ddcs);
+ EnterCriticalSection(&gcsWinWatchLock);
if ( (pWinwatch_int = (LPWINWATCH_INT) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINWATCH_INT) )) != NULL )
{
pWinwatch_int->hWnd = hwnd;
- }
- LeaveCriticalSection(&ddcs);
+ pWinwatch_int->prev = (LPVOID) gpWinWatchList;
+
+ gpWinWatchList = pWinwatch_int;
+ }
+ LeaveCriticalSection(&gcsWinWatchLock);
return (HWINWATCH) pWinwatch_int;
}
+/*++
+* @name DWORD WINAPI WinWatchClose(HWND hwnd)
+* @implemented
+*
+
+* @return
+*
+* @remarks.
+* None
+*/
void WINAPI
WinWatchClose(HWINWATCH hWW)
{
- LPWINWATCH_INT pWinwatch_int = (LPWINWATCH_INT)hWW;
-
- EnterCriticalSection(&ddcs);
-
- if (pWinwatch_int != NULL)
- {
- if (pWinwatch_int->lpRgnData != NULL)
- {
- HeapFree(GetProcessHeap(), 0, pWinwatch_int->lpRgnData);
- }
-
- HeapFree(GetProcessHeap(), 0, hWW);
- }
-
- LeaveCriticalSection(&ddcs);
-}
-
+ LPWINWATCH_INT pWinwatch_int = (LPWINWATCH_INT)hWW;
+ LPWINWATCH_INT tmp_gpWinWatchList ;
+ LPWINWATCH_INT delete_gpWinWatchList;
+
+ EnterCriticalSection(&gcsWinWatchLock);
+
+ /* Start search see if our hWW exists in the gpWinWatchList */
+ tmp_gpWinWatchList = gpWinWatchList;
+ delete_gpWinWatchList = gpWinWatchList;
+
+ while (delete_gpWinWatchList != pWinwatch_int )
+ {
+ if ( delete_gpWinWatchList == NULL )
+ {
+ /* Noting to delete */
+ break;
+ }
+
+ /* Have we found our entry ? */
+ if ( tmp_gpWinWatchList->prev == pWinwatch_int )
+ {
+ /* Yes we found our entry */
+
+ /* Now we save it to delete_gpWinWatchList */
+ delete_gpWinWatchList = tmp_gpWinWatchList->prev;
+
+ /* Remove it from the gpWinWatchList list */
+ if ( tmp_gpWinWatchList->prev != NULL )
+ {
+ tmp_gpWinWatchList->prev = ((LPWINWATCH_INT)tmp_gpWinWatchList->prev)->prev ;
+ }
+
+ }
+ else
+ {
+ /* No so we keep looking */
+ tmp_gpWinWatchList = tmp_gpWinWatchList->prev ;
+ }
+ }
+
+ /* now we can delete our entry */
+
+ if ( (delete_gpWinWatchList != NULL) &&
+ (pWinwatch_int == delete_gpWinWatchList) )
+ {
+ /* Check see if we got any region data and free it */
+ if (pWinwatch_int->lpRgnData != NULL)
+ {
+ HeapFree(GetProcessHeap(), 0, delete_gpWinWatchList->lpRgnData);
+ }
+
+ /* Free the delete_gpWinWatchList */
+ HeapFree(GetProcessHeap(), 0, delete_gpWinWatchList);
+ }
+
+ LeaveCriticalSection(&gcsWinWatchLock);
+}
+
+/*++
+* @name WinWatchDidStatusChange(HWINWATCH hWW)
+* @implemented
+*
+
+* @return
+*
+* @remarks.
+* None
+*/
BOOL WINAPI
WinWatchDidStatusChange(HWINWATCH hWW)
{
@@ -446,6 +526,16 @@
return pWinwatch_int->WinWatchStatus;
}
+/*++
+* @name WinWatchGetClipList(HWINWATCH hWW)
+* @implemented
+*
+
+* @return
+*
+* @remarks.
+* None
+*/
UINT WINAPI
WinWatchGetClipList(HWINWATCH hWW,
LPRECT prc,
More information about the Ros-diffs
mailing list