Changeset 45837 in vbox
- Timestamp:
- Apr 30, 2013 12:42:28 PM (12 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxTray
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.cpp
r45803 r45837 67 67 static BOOL vboxStHandleEvent(WPARAM EventID, LPARAM SessionID); 68 68 static BOOL vboxStIsActiveConsole(); 69 static BOOL vboxStCheckTimer(WPARAM wEvent); 69 70 70 71 /* … … 915 916 if (VBoxCapsCheckTimer(wParam)) 916 917 return 0; 917 if(vboxDtCheckTimer(wParam)) 918 if (vboxDtCheckTimer(wParam)) 919 return 0; 920 if (vboxStCheckTimer(wParam)) 918 921 return 0; 919 922 … … 1007 1010 BOOL fIsConsole; 1008 1011 WTS_CONNECTSTATE_CLASS enmConnectState; 1012 UINT_PTR idDelayedInitTimer; 1009 1013 BOOL (WINAPI * pfnWTSRegisterSessionNotification)(HWND hWnd, DWORD dwFlags); 1010 1014 BOOL (WINAPI * pfnWTSUnRegisterSessionNotification)(HWND hWnd); … … 1026 1030 gVBoxSt.fIsConsole = (*pProtocolType == 0); 1027 1031 gVBoxSt.enmConnectState = *penmConnectState; 1032 return VINF_SUCCESS; 1028 1033 } 1029 1034 else … … 1040 1045 rc = RTErrConvertFromWin32(dwErr); 1041 1046 } 1047 1048 /* failure branch, set to "console-active" state */ 1049 gVBoxSt.fIsConsole = TRUE; 1050 gVBoxSt.enmConnectState = WTSActive; 1051 1042 1052 return rc; 1043 1053 } … … 1083 1093 DWORD dwErr = GetLastError(); 1084 1094 WARN(("VBoxTray: WTSRegisterSessionNotification failed, error = %08X\n", dwErr)); 1095 if (dwErr == RPC_S_INVALID_BINDING) 1096 { 1097 gVBoxSt.idDelayedInitTimer = SetTimer(gVBoxSt.hWTSAPIWnd, TIMERID_VBOXTRAY_ST_DELAYED_INIT_TIMER, 500, (TIMERPROC)NULL); 1098 } 1085 1099 rc = RTErrConvertFromWin32(dwErr); 1086 1100 } … … 1110 1124 } 1111 1125 1112 if (!gVBoxSt.pfnWTSUnRegisterSessionNotification(gVBoxSt.hWTSAPIWnd)) 1113 { 1114 DWORD dwErr = GetLastError(); 1115 WARN(("VBoxTray: WTSAPI32 load failed, error = %08X\n", dwErr)); 1126 if (gVBoxSt.idDelayedInitTimer) 1127 { 1128 /* notification is not registered, just kill timer */ 1129 KillTimer(gVBoxSt.hWTSAPIWnd, gVBoxSt.idDelayedInitTimer); 1130 gVBoxSt.idDelayedInitTimer = 0; 1131 } 1132 else 1133 { 1134 if (!gVBoxSt.pfnWTSUnRegisterSessionNotification(gVBoxSt.hWTSAPIWnd)) 1135 { 1136 DWORD dwErr = GetLastError(); 1137 WARN(("VBoxTray: WTSAPI32 load failed, error = %08X\n", dwErr)); 1138 } 1116 1139 } 1117 1140 … … 1140 1163 } 1141 1164 } 1165 1166 static BOOL vboxStCheckTimer(WPARAM wEvent) 1167 { 1168 if (wEvent != gVBoxSt.idDelayedInitTimer) 1169 return FALSE; 1170 1171 if (gVBoxSt.pfnWTSRegisterSessionNotification(gVBoxSt.hWTSAPIWnd, NOTIFY_FOR_THIS_SESSION)) 1172 { 1173 KillTimer(gVBoxSt.hWTSAPIWnd, gVBoxSt.idDelayedInitTimer); 1174 gVBoxSt.idDelayedInitTimer = 0; 1175 } 1176 else 1177 { 1178 DWORD dwErr = GetLastError(); 1179 WARN(("VBoxTray: timer WTSRegisterSessionNotification failed, error = %08X\n", dwErr)); 1180 } 1181 1182 vboxStCheckState(); 1183 } 1184 1142 1185 1143 1186 static BOOL vboxStHandleEvent(WPARAM wEvent, LPARAM SessionID) -
trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.h
r45802 r45837 83 83 #define TIMERID_VBOXTRAY_CAPS_TIMER 1001 84 84 #define TIMERID_VBOXTRAY_DT_TIMER 1002 85 #define TIMERID_VBOXTRAY_ST_DELAYED_INIT_TIMER 1003 85 86 86 87 /* The environment information for services. */
Note:
See TracChangeset
for help on using the changeset viewer.