* exceptions.cc (ctrl_c_handler): Don't send SIGHUP on
CTRL_LOGOFF_EVENT to processes running in invisible Windows Stations. * window.cc (has_visible_window_station): New function. * winsup.h: Add declaration for has_visible_window_station.
This commit is contained in:
		
							parent
							
								
									2286046e47
								
							
						
					
					
						commit
						db3137ccb5
					
				|  | @ -1,3 +1,10 @@ | ||||||
|  | 2003-10-14  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  | 
 | ||||||
|  | 	* exceptions.cc (ctrl_c_handler): Don't send SIGHUP on | ||||||
|  | 	CTRL_LOGOFF_EVENT to processes running in invisible Windows Stations. | ||||||
|  | 	* window.cc (has_visible_window_station): New function. | ||||||
|  | 	* winsup.h: Add declaration for has_visible_window_station. | ||||||
|  | 
 | ||||||
| 2003-10-10  Christopher Faylor  <cgf@redhat.com> | 2003-10-10  Christopher Faylor  <cgf@redhat.com> | ||||||
| 
 | 
 | ||||||
| 	* fhandler_tty.cc (fhandler_tty_slave::open): Don't create a new window | 	* fhandler_tty.cc (fhandler_tty_slave::open): Don't create a new window | ||||||
|  |  | ||||||
|  | @ -12,6 +12,8 @@ details. */ | ||||||
| #include <imagehlp.h> | #include <imagehlp.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <setjmp.h> | #include <setjmp.h> | ||||||
|  | #include <wingdi.h> | ||||||
|  | #include <winuser.h> | ||||||
| 
 | 
 | ||||||
| #include "exceptions.h" | #include "exceptions.h" | ||||||
| #include "sync.h" | #include "sync.h" | ||||||
|  | @ -919,13 +921,23 @@ ctrl_c_handler (DWORD type) | ||||||
|       return FALSE; |       return FALSE; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|   if (myself->ctty != -1 |   if (myself->ctty != -1) | ||||||
|       && (type == CTRL_CLOSE_EVENT || (!saw_close && type == CTRL_LOGOFF_EVENT))) |  | ||||||
|     { |     { | ||||||
|       if (type == CTRL_CLOSE_EVENT) |       if (type == CTRL_CLOSE_EVENT) | ||||||
| 	saw_close = true; |         { | ||||||
|       sig_send (NULL, SIGHUP); | 	  saw_close = true; | ||||||
|       return FALSE; | 	  sig_send (NULL, SIGHUP); | ||||||
|  | 	  return FALSE; | ||||||
|  | 	} | ||||||
|  |       if (!saw_close && type == CTRL_LOGOFF_EVENT) | ||||||
|  |         { | ||||||
|  | 	  /* Check if the process is actually associated with a visible
 | ||||||
|  | 	     window station, one which actually represents a visible desktop. | ||||||
|  | 	     If not, the CTRL_LOGOFF_EVENT doesn't concern this process. */ | ||||||
|  | 	  if (has_visible_window_station ()) | ||||||
|  | 	    sig_send (NULL, SIGHUP); | ||||||
|  | 	  return FALSE; | ||||||
|  | 	} | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|   /* If we are a stub and the new process has a pinfo structure, let it
 |   /* If we are a stub and the new process has a pinfo structure, let it
 | ||||||
|  |  | ||||||
|  | @ -247,3 +247,23 @@ ualarm (useconds_t value, useconds_t interval) | ||||||
|   return (otimer.it_value.tv_sec * 1000000) + otimer.it_value.tv_usec; |   return (otimer.it_value.tv_sec * 1000000) + otimer.it_value.tv_usec; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool | ||||||
|  | has_visible_window_station (void) | ||||||
|  | { | ||||||
|  |   HWINSTA station_hdl; | ||||||
|  |   USEROBJECTFLAGS uof; | ||||||
|  |   DWORD len; | ||||||
|  | 
 | ||||||
|  |   /* Check if the process is associated with a visible window station.
 | ||||||
|  |      These are processes running on the local desktop as well as processes | ||||||
|  |      running in terminal server sessions. | ||||||
|  |      Processes running in a service session not explicitely associated | ||||||
|  |      with the desktop (using the "Allow service to interact with desktop" | ||||||
|  |      property) are running in an invisible window station. */ | ||||||
|  |   if ((station_hdl = GetProcessWindowStation ()) | ||||||
|  |       && GetUserObjectInformationA (station_hdl, UOI_FLAGS, &uof, | ||||||
|  | 				    sizeof uof, &len) | ||||||
|  |       && (uof.dwFlags & WSF_VISIBLE)) | ||||||
|  |     return true; | ||||||
|  |   return false; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -200,6 +200,8 @@ void __stdcall close_all_files (void); | ||||||
| 
 | 
 | ||||||
| /* Invisible window initialization/termination. */ | /* Invisible window initialization/termination. */ | ||||||
| HWND __stdcall gethwnd (void); | HWND __stdcall gethwnd (void); | ||||||
|  | /* Check if running in a visible window station. */ | ||||||
|  | extern bool has_visible_window_station (void); | ||||||
| 
 | 
 | ||||||
| /* Globals that handle initialization of winsock in a child process. */ | /* Globals that handle initialization of winsock in a child process. */ | ||||||
| extern HANDLE wsock32_handle; | extern HANDLE wsock32_handle; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue