Changeset 47977 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- Aug 21, 2013 4:37:27 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
r47973 r47977 814 814 AssertPtrReturn(pCache, VERR_INVALID_POINTER); 815 815 AssertPtrReturn(pszUser, VERR_INVALID_POINTER); 816 /* pszDomain is optional. */ 816 817 817 818 int rc = VINF_SUCCESS; … … 821 822 VBOXTRAY_IPC_PIPE_PREFIX, pszUser)) 822 823 { 824 bool fReportToHost = false; 825 VBoxGuestUserState userState = VBoxGuestUserState_Unknown; 826 823 827 RTLOCALIPCSESSION hSession; 824 828 rc = RTLocalIpcSessionConnect(&hSession, szPipeName, 0 /* Flags */); … … 839 843 && ipcRes.uLastInput != UINT32_MAX) 840 844 { 841 VBoxGuestUserStateuserState = (ipcRes.uLastInput * 1000) < g_uVMInfoUserIdleThresholdMS842 843 845 userState = (ipcRes.uLastInput * 1000) < g_uVMInfoUserIdleThresholdMS 846 ? VBoxGuestUserState_InUse 847 : VBoxGuestUserState_Idle; 844 848 845 849 rc = vboxServiceUserUpdateF(pCache, pszUser, pszDomain, "UsageState", … … 852 856 * new. 853 857 */ 854 if (rc == VINF_SUCCESS) 855 { 856 VBoxServiceVerbose(4, "User \"%s\" (domain \"%s\") is idle for %RU32s\n", 857 pszUser, pszDomain ? pszDomain : "<None>", ipcRes.uLastInput); 858 fReportToHost = rc == VINF_SUCCESS; 859 VBoxServiceVerbose(4, "User \"%s\" (domain \"%s\") is idle for %RU32, fReportToHost=%RTbool\n", 860 pszUser, pszDomain ? pszDomain : "<None>", ipcRes.uLastInput, fReportToHost); 858 861 859 862 #if 0 /* Do we want to write the idle time as well? */ … … 868 871 if (RT_SUCCESS(rc)) 869 872 #endif 870 rc = VbglR3GuestUserReportState(pszUser, pszDomain, userState,871 NULL /* No details */, 0);872 }873 873 } 874 874 #ifdef DEBUG 875 875 else if (ipcRes.uLastInput == UINT32_MAX) 876 VBoxServiceVerbose(4, "Last input for user \"%s\" is not available, skipping\n",876 VBoxServiceVerbose(4, "Last input for user \"%s\" is not supported, skipping\n", 877 877 pszUser, rc); 878 878 … … 889 889 { 890 890 case VERR_FILE_NOT_FOUND: 891 { 891 892 /* No VBoxTray (or too old version which does not support IPC) running 892 893 for the given user. Not much we can do then. */ 893 VBoxServiceVerbose(4, " User \"%s\" not logged in, no last input available\n",894 VBoxServiceVerbose(4, "VBoxTray for user \"%s\" not running (anymore), no last input available\n", 894 895 pszUser); 896 897 /* Overwrite rc from above. */ 898 rc = vboxServiceUserUpdateF(pCache, pszUser, pszDomain, 899 "UsageState", "Idle"); 900 901 fReportToHost = rc == VINF_SUCCESS; 902 if (fReportToHost) 903 userState = VBoxGuestUserState_Idle; 895 904 break; 905 } 896 906 897 907 default: 898 VBoxService Verbose(4,"Error querying last input for user \"%s\", rc=%Rrc\n",899 908 VBoxServiceError("Error querying last input for user \"%s\", rc=%Rrc\n", 909 pszUser, rc); 900 910 break; 901 911 } 902 903 rc = VINF_SUCCESS; 912 } 913 914 if (fReportToHost) 915 { 916 Assert(userState != VBoxGuestUserState_Unknown); 917 int rc2 = VbglR3GuestUserReportState(pszUser, pszDomain, userState, 918 NULL /* No details */, 0); 919 if (RT_FAILURE(rc2)) 920 VBoxServiceError("Error reporting usage state %ld for user \"%s\" to host, rc=%Rrc\n", 921 userState, pszUser, rc2); 922 923 if (RT_SUCCESS(rc)) 924 rc = rc2; 904 925 } 905 926 }
Note:
See TracChangeset
for help on using the changeset viewer.