[PATCH 1/2] Add thread data management and initial debugging facilities to the quartzdrv.

Pierre d'Herbemont pdherbemont at free.fr
Mon Oct 30 08:04:47 CST 2006


---
  dlls/winequartz.drv/quartzdrv.h      |   44 +++++++++++++++++++++++++
  dlls/winequartz.drv/quartzdrv_main.c |   59 
++++++++++++++++++++++++++++++++-
  2 files changed, 101 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/dlls/winequartz.drv/quartzdrv.h b/dlls/winequartz.drv/quartzdrv.h
new file mode 100644
index 0000000..8dbd628
--- /dev/null
+++ b/dlls/winequartz.drv/quartzdrv.h
@@ -0,0 +1,44 @@
+/*
+ * Quartz driver definitions
+ *
+ * Copyright 1996 Alexandre Julliard
+ * Copyright 1999 Patrik Stridvall
+ * Copyright 2006 Emmanuel Maillard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#ifndef __WINE_QUARTZDRV_H
+#define __WINE_QUARTZDRV_H
+
+/* ---------------------------------------------------------------------
+   per-Thread data management
+*/
+struct quartzdrv_thread_data
+{
+	int		process_event_count;  /* recursion count for event processing */
+};
+
+extern struct quartzdrv_thread_data *quartzdrv_init_thread_data(void);
+extern DWORD thread_data_tls_index;
+
+inline static struct quartzdrv_thread_data *quartzdrv_thread_data(void)
+{
+    struct quartzdrv_thread_data *data = TlsGetValue( thread_data_tls_index );
+    if (!data) data = quartzdrv_init_thread_data();
+    return data;
+}
+
+#endif  /* __WINE_QUARTZDRV_H */
diff --git a/dlls/winequartz.drv/quartzdrv_main.c b/dlls/winequartz.drv/quartzdrv_main.c
index 88bc6ac..4d7a9af 100644
--- a/dlls/winequartz.drv/quartzdrv_main.c
+++ b/dlls/winequartz.drv/quartzdrv_main.c
@@ -26,8 +26,63 @@
 #include "winbase.h"
 #include "winreg.h"
 
+#include "wine/debug.h"
+
+#include "quartzdrv.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(quartzdrv);
+
+DWORD thread_data_tls_index = TLS_OUT_OF_INDEXES;
+
+/***********************************************************************
+ *           QDRV thread initialisation routine
+ */
+struct quartzdrv_thread_data *quartzdrv_init_thread_data(void)
+{
+    struct quartzdrv_thread_data *data;
+    
+    if (!(data = HeapAlloc( GetProcessHeap(), 0, sizeof(*data) )))
+    {
+        ERR( "could not create data\n" );
+        ExitProcess(1);
+    }
+    
+    data->process_event_count = 0;
+
+    TlsSetValue( thread_data_tls_index, data );
+
+    return data;
+}
+
 /***********************************************************************
- *           QUARTZDRV initialisation routine
+ *           process initialisation routine
+ */
+static BOOL process_attach(void)
+{
+    TRACE("\n");
+    return TRUE;
+}
+
+
+/***********************************************************************
+ *           thread termination routine
+ */
+static void thread_detach(void)
+{
+    TRACE("\n");
+}
+
+
+/***********************************************************************
+ *           process termination routine
+ */
+static void process_detach(void)
+{
+    TRACE("\n");
+}
+
+/***********************************************************************
+ *           Dll entry point
  */
 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
 {
@@ -46,4 +101,4 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DW
         break;
     }
     return ret;
-}
+}
\ No newline at end of file


More information about the wine-patches mailing list