Changeset 47294 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- Jul 22, 2013 11:19:20 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 87431
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
r47234 r47294 50 50 *******************************************************************************/ 51 51 /** Structure for storing the looked up user information. */ 52 typedef struct 52 typedef struct VBOXSERVICEVMINFOUSER 53 53 { 54 54 WCHAR wszUser[_MAX_PATH]; … … 65 65 66 66 /** Structure for the file information lookup. */ 67 typedef struct 67 typedef struct VBOXSERVICEVMINFOFILE 68 68 { 69 69 char *pszFilePath; … … 72 72 73 73 /** Structure for process information lookup. */ 74 typedef struct 74 typedef struct VBOXSERVICEVMINFOPROC 75 75 { 76 76 /** The PID. */ … … 92 92 int VBoxServiceVMInfoWinProcessesEnumerate(PVBOXSERVICEVMINFOPROC *ppProc, DWORD *pdwCount); 93 93 void VBoxServiceVMInfoWinProcessesFree(DWORD cProcs, PVBOXSERVICEVMINFOPROC paProcs); 94 int vboxServiceVMInfoWinWriteLastInput(c har *pszUser);94 int vboxServiceVMInfoWinWriteLastInput(const char *pszUser, const char *pszDomain); 95 95 96 96 typedef BOOL WINAPI FNQUERYFULLPROCESSIMAGENAME(HANDLE, DWORD, LPTSTR, PDWORD); … … 808 808 809 809 810 static int vboxServiceVMInfoWinWriteLastInput(c har *pszUser)810 static int vboxServiceVMInfoWinWriteLastInput(const char *pszUser, const char *pszDomain) 811 811 { 812 812 AssertPtrReturn(pszUser, VERR_INVALID_POINTER); … … 833 833 if (RT_SUCCESS(rc)) 834 834 { 835 VBoxGuestUserState userState = ipcRes.uLastInputMs < 5000 /** @todo Make this configurable. */ 836 ? VBoxGuestUserState_InUse 837 : VBoxGuestUserState_Idle; 835 838 if (ipcRes.uLastInputMs) 836 VBoxServiceVerbose(4, "User \"%s\" is idle for %RU32ms\n", 837 pszUser, ipcRes.uLastInputMs); 839 { 840 VBoxServiceVerbose(4, "User \"%s\" (domain \"%s\") is idle for %RU32ms\n", 841 pszUser, pszDomain ? pszDomain : "<None>", ipcRes.uLastInputMs); 842 843 rc = VbglR3GuestUserReportState(pszUser, pszDomain, userState, 844 NULL /* No details */, 0); 845 } 838 846 } 839 847 #ifdef DEBUG 840 VBoxServiceVerbose(4, " Querying last input for user \"%s\" ended with rc=%Rrc\n",848 VBoxServiceVerbose(4, "Getting last input for user \"%s\" ended with rc=%Rrc\n", 841 849 pszUser, rc); 842 850 #endif … … 1060 1068 *pcUsersInList += 1; 1061 1069 1062 char *pszUser; 1063 int rc2 = RTUtf16ToUtf8(pUserInfo[i].wszUser, &pszUser); 1064 if (RT_SUCCESS(rc2)) 1070 char *pszUser = NULL; 1071 char *pszDomain = NULL; 1072 rc = RTUtf16ToUtf8(pUserInfo[i].wszUser, &pszUser); 1073 if ( RT_SUCCESS(rc) 1074 && pUserInfo[i].wszLogonDomain) 1075 rc = RTUtf16ToUtf8(pUserInfo[i].wszLogonDomain, &pszDomain); 1076 if (RT_SUCCESS(rc)) 1065 1077 { 1078 /* Append user to users list. */ 1066 1079 rc = RTStrAAppend(ppszUserList, pszUser); 1080 1081 /* Do idle detection. */ 1067 1082 if (RT_SUCCESS(rc)) 1068 rc = vboxServiceVMInfoWinWriteLastInput(pszUser); 1069 RTMemFree(pszUser); 1083 rc = vboxServiceVMInfoWinWriteLastInput(pszUser, pszDomain); 1070 1084 } 1071 1085 else 1072 1086 rc = RTStrAAppend(ppszUserList, "<string-conversion-error>"); 1087 1088 RTStrFree(pszUser); 1089 RTStrFree(pszDomain); 1090 1073 1091 AssertRCBreakStmt(rc, RTStrFree(*ppszUserList)); 1074 1092 }
Note:
See TracChangeset
for help on using the changeset viewer.