提交 d019cb0c 编写于 作者: Z zgu

6871190: Don't terminate JVM if it is running in a non-interactive session

Summary: Don't handle CTRL_LOGOFF_EVENT event when the process is running in a non-interactive session
Reviewed-by: ctornqvi, acorn
上级 c48b626f
...@@ -1874,8 +1874,22 @@ static BOOL WINAPI consoleHandler(DWORD event) { ...@@ -1874,8 +1874,22 @@ static BOOL WINAPI consoleHandler(DWORD event) {
} }
return TRUE; return TRUE;
break; break;
case CTRL_LOGOFF_EVENT: {
// Don't terminate JVM if it is running in a non-interactive session,
// such as a service process.
USEROBJECTFLAGS flags;
HANDLE handle = GetProcessWindowStation();
if (handle != NULL &&
GetUserObjectInformation(handle, UOI_FLAGS, &flags,
sizeof( USEROBJECTFLAGS), NULL)) {
// If it is a non-interactive session, let next handler to deal
// with it.
if ((flags.dwFlags & WSF_VISIBLE) == 0) {
return FALSE;
}
}
}
case CTRL_CLOSE_EVENT: case CTRL_CLOSE_EVENT:
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT: case CTRL_SHUTDOWN_EVENT:
os::signal_raise(SIGTERM); os::signal_raise(SIGTERM);
return TRUE; return TRUE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册