gtk+ r20353 - in trunk: . gdk/win32



Author: tml
Date: Wed Jun 11 16:05:28 2008
New Revision: 20353
URL: http://svn.gnome.org/viewvc/gtk+?rev=20353&view=rev

Log:
2008-06-11  Tor Lillqvist  <tml novell com>

	* gdk/win32/gdkdisplay-win32.c (gdk_display_get_name): As we don't
	support Win9x anyway, we can use ProcessIdToSessionId()
	unconditionally.



Modified:
   trunk/ChangeLog
   trunk/gdk/win32/gdkdisplay-win32.c

Modified: trunk/gdk/win32/gdkdisplay-win32.c
==============================================================================
--- trunk/gdk/win32/gdkdisplay-win32.c	(original)
+++ trunk/gdk/win32/gdkdisplay-win32.c	Wed Jun 11 16:05:28 2008
@@ -184,33 +184,6 @@
 
 }
 
-/*
- * Dynamic version of ProcessIdToSessionId() form Terminal Service.
- * It is only returning something else than 0 when running under
- * Terminal Service, available since NT4 SP4 and not for win9x
- */
-static guint
-get_session_id (void)
-{
-  typedef BOOL (WINAPI *t_ProcessIdToSessionId) (DWORD, DWORD*);
-  static t_ProcessIdToSessionId p_ProcessIdToSessionId = NULL;
-  static HMODULE kernel32 = NULL;
-  DWORD id = 0;
-
-  if (kernel32 == NULL)
-    {
-      kernel32 = GetModuleHandle ("kernel32.dll");
-
-      g_assert (kernel32 != NULL);
-
-      p_ProcessIdToSessionId = (t_ProcessIdToSessionId) GetProcAddress (kernel32, "ProcessIdToSessionId");
-   }
-  if (p_ProcessIdToSessionId)
-      p_ProcessIdToSessionId (GetCurrentProcessId (), &id); /* got it (or not ;) */
-
-  return id;
-}
-
 GdkDisplay *
 gdk_display_open (const gchar *display_name)
 {
@@ -265,6 +238,7 @@
   HWINSTA hwinsta = GetProcessWindowStation ();
   char *window_station_name;
   DWORD n;
+  DWORD session_id;
   char *display_name;
   static const char *display_name_cache = NULL;
 
@@ -301,8 +275,12 @@
 	window_station_name = "WinSta0";
     }
 
-  display_name = g_strdup_printf ("%d\\%s\\%s",
-				  get_session_id (), window_station_name,
+  if (!ProcessIdToSessionId (GetCurrentProcessId (), &session_id))
+    session_id = 0;
+
+  display_name = g_strdup_printf ("%ld\\%s\\%s",
+				  session_id,
+				  window_station_name,
 				  desktop_name);
 
   GDK_NOTE (MISC, g_print ("gdk_display_get_name: %s\n", display_name));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]