Changeset 62851 in vbox for trunk/src/VBox/Additions/common/VBoxService
- Timestamp:
- Aug 1, 2016 10:13:35 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 109447
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxService-win.cpp
r62679 r62851 460 460 #endif 461 461 { 462 DWORD rcRet = NO_ERROR;463 464 462 #ifdef TARGET_NT4 465 463 VGSvcVerbose(2, "Control handler: Control=%#x\n", dwControl); 466 464 #else 465 RT_NOREF1(lpContext); 467 466 VGSvcVerbose(2, "Control handler: Control=%#x, EventType=%#x\n", dwControl, dwEventType); 468 467 #endif 469 468 469 DWORD rcRet = NO_ERROR; 470 470 switch (dwControl) 471 471 { … … 524 524 static void WINAPI vgsvcWinMain(DWORD argc, LPTSTR *argv) 525 525 { 526 RT_NOREF2(argc, argv); 526 527 VGSvcVerbose(2, "Registering service control handler ...\n"); 527 528 #ifdef TARGET_NT4 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp
r62521 r62851 56 56 #include <iprt/string.h> 57 57 #include <iprt/semaphore.h> 58 #include <iprt/string.h> 58 59 #include <iprt/system.h> 59 60 #include <iprt/thread.h> … … 186 187 unsigned i; 187 188 UINT cbFileVersion; 188 char * lpszFileVersion;189 char *pszFileVersion = NULL; /* Shut up MSC */ 189 190 unsigned cTranslationBlocks = cbTranslate/sizeof(struct LANGANDCODEPAGE); 190 191 191 for(i = 0; i < cTranslationBlocks; i++) 192 pModule->szFileVersion[0] = '\0'; 193 for (i = 0; i < cTranslationBlocks; i++) 192 194 { 193 195 /* Fetch file version string. */ 194 196 char szFileVersionLocation[256]; 195 197 198 /** @todo r=bird: Mixing ANSI and TCHAR crap again. This code is a mess. We 199 * always use the wide version of the API and convert to UTF-8/whatever. */ 200 196 201 sprintf(szFileVersionLocation, TEXT("\\StringFileInfo\\%04x%04x\\FileVersion"), lpTranslate[i].wLanguage, lpTranslate[i].wCodePage); 197 fRet = VerQueryValue(pVersionInfo, szFileVersionLocation, (LPVOID *)& lpszFileVersion, &cbFileVersion);202 fRet = VerQueryValue(pVersionInfo, szFileVersionLocation, (LPVOID *)&pszFileVersion, &cbFileVersion); 198 203 if (fRet) 204 { 205 RTStrCopy(pModule->szFileVersion, sizeof(pModule->szFileVersion), pszFileVersion); 199 206 break; 207 } 200 208 } 201 209 if (i == cTranslationBlocks) … … 204 212 goto end; 205 213 } 206 207 _snprintf(pModule->szFileVersion, sizeof(pModule->szFileVersion), "%s", lpszFileVersion);208 pModule->szFileVersion[RT_ELEMENTS(pModule->szFileVersion) - 1] = 0;209 214 210 215 unsigned idxRegion = 0; … … 361 366 VGSvcVerbose(3, "\n executable = %s", ModuleInfo.szExePath ); 362 367 VGSvcVerbose(3, "\n process ID = 0x%08X", ModuleInfo.th32ProcessID ); 363 VGSvcVerbose(3, "\n base address = 0x%08X", (DWORD) ModuleInfo.modBaseAddr );368 VGSvcVerbose(3, "\n base address = %#010p", (uintptr_t) ModuleInfo.modBaseAddr ); 364 369 VGSvcVerbose(3, "\n base size = %d", ModuleInfo.modBaseSize ); 365 370 … … 510 515 VGSvcVerbose(3, "\n\n KERNEL MODULE NAME: %s", pModule->Info.szModule ); 511 516 VGSvcVerbose(3, "\n executable = %s", pModule->Info.szExePath ); 512 VGSvcVerbose(3, "\n base address = 0x%08X", (DWORD)pModule->Info.modBaseAddr );517 VGSvcVerbose(3, "\n base address = %#010p", (uintptr_t)pModule->Info.modBaseAddr ); 513 518 VGSvcVerbose(3, "\n flags = 0x%08X", pSystemModules->Modules[i].Flags); 514 519 VGSvcVerbose(3, "\n base size = %d", pModule->Info.modBaseSize ); -
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.cpp
r62521 r62851 36 36 uint32_t fFlags) 37 37 { 38 RT_NOREF1(fFlags); 38 39 AssertPtrReturn(pCache, NULL); 39 40 AssertPtrReturn(pszName, NULL); … … 317 318 const char *pszPathFormat, ...) 318 319 { 320 RT_NOREF1(fFlags); 319 321 AssertPtrReturn(pCache, VERR_INVALID_POINTER); 320 322 AssertPtrReturn(pszPathFormat, VERR_INVALID_POINTER); -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
r62679 r62851 141 141 static DECLCALLBACK(int) vgsvcWinVmInfoInitOnce(void *pvIgnored) 142 142 { 143 RT_NOREF1(pvIgnored); 144 143 145 /* SECUR32 */ 144 146 RTLDRMOD hLdrMod; … … 349 351 VGSvcError("Token class not implemented: %d\n", tkClass); 350 352 rc = VERR_NOT_IMPLEMENTED; 353 dwTokenInfoSize = 0; /* Shut up MSC. */ 351 354 break; 352 355 } … … 631 634 * Optional. 632 635 */ 636 /** @todo r=bird: The 'Has' indicates a predicate function, which this is 637 * not. Predicate functions always returns bool. */ 633 638 static uint32_t vgsvcVMInfoWinSessionHasProcesses(PLUID pSession, PVBOXSERVICEVMINFOPROC const paProcs, DWORD cProcs, 634 639 PULONG puTerminalSession) … … 640 645 } 641 646 if (!g_pfnLsaGetLogonSessionData) 642 return VERR_NOT_SUPPORTED;647 return 0; 643 648 644 649 PSECURITY_LOGON_SESSION_DATA pSessionData = NULL; … … 798 803 */ 799 804 bool fFoundUser = false; 800 DWORD dwErr = NO_ERROR;801 805 if ( IsValidSid(pSessionData->Sid) 802 806 && ( (SECURITY_LOGON_TYPE)pSessionData->LogonType == Interactive … … 973 977 rc = RTLocalIpcSessionWrite(hSession, &ipcHdr, sizeof(ipcHdr)); 974 978 975 VBOXTRAYIPCRES_USERLASTINPUT ipcRes;976 979 if (RT_SUCCESS(rc)) 980 { 981 VBOXTRAYIPCRES_USERLASTINPUT ipcRes; 977 982 rc = RTLocalIpcSessionRead(hSession, &ipcRes, sizeof(ipcRes), NULL /* Exact read */); 978 if ( RT_SUCCESS(rc)979 /* If uLastInput is set to UINT32_MAX VBoxTray was not able to retrieve the980 * user's last input time. This might happen when running on Windows NT4 or older. */981 && ipcRes.uLastInput != UINT32_MAX)982 {983 userState = (ipcRes.uLastInput * 1000) < g_uVMInfoUserIdleThresholdMS984 ? VBoxGuestUserState_InUse985 : VBoxGuestUserState_Idle;986 987 rc = VGSvcUserUpdateF(pCache, pszUser, pszDomain, "UsageState",988 userState == VBoxGuestUserState_InUse ? "InUse" : "Idle");989 990 /*991 * Note: vboxServiceUserUpdateF can return VINF_NO_CHANGE in case there wasn't anything992 * to update. So only report the user's status to host when we really got something993 * new.994 */995 fReportToHost = rc == VINF_SUCCESS;996 VGSvcVerbose(4, "User '%s' (domain '%s') is idle for %RU32, fReportToHost=%RTbool\n",997 pszUser, pszDomain ? pszDomain : "<None>", ipcRes.uLastInput, fReportToHost);983 if ( RT_SUCCESS(rc) 984 /* If uLastInput is set to UINT32_MAX VBoxTray was not able to retrieve the 985 * user's last input time. This might happen when running on Windows NT4 or older. */ 986 && ipcRes.uLastInput != UINT32_MAX) 987 { 988 userState = (ipcRes.uLastInput * 1000) < g_uVMInfoUserIdleThresholdMS 989 ? VBoxGuestUserState_InUse 990 : VBoxGuestUserState_Idle; 991 992 rc = VGSvcUserUpdateF(pCache, pszUser, pszDomain, "UsageState", 993 userState == VBoxGuestUserState_InUse ? "InUse" : "Idle"); 994 995 /* 996 * Note: vboxServiceUserUpdateF can return VINF_NO_CHANGE in case there wasn't anything 997 * to update. So only report the user's status to host when we really got something 998 * new. 999 */ 1000 fReportToHost = rc == VINF_SUCCESS; 1001 VGSvcVerbose(4, "User '%s' (domain '%s') is idle for %RU32, fReportToHost=%RTbool\n", 1002 pszUser, pszDomain ? pszDomain : "<None>", ipcRes.uLastInput, fReportToHost); 998 1003 999 1004 #if 0 /* Do we want to write the idle time as well? */ 1000 /* Also write the user's current idle time, if there is any. */ 1001 if (userState == VBoxGuestUserState_Idle) 1002 rc = vgsvcUserUpdateF(pCache, pszUser, pszDomain, "IdleTimeMs", "%RU32", ipcRes.uLastInputMs); 1003 else 1004 rc = vgsvcUserUpdateF(pCache, pszUser, pszDomain, "IdleTimeMs", NULL /* Delete property */); 1005 1006 if (RT_SUCCESS(rc)) 1005 /* Also write the user's current idle time, if there is any. */ 1006 if (userState == VBoxGuestUserState_Idle) 1007 rc = vgsvcUserUpdateF(pCache, pszUser, pszDomain, "IdleTimeMs", "%RU32", ipcRes.uLastInputMs); 1008 else 1009 rc = vgsvcUserUpdateF(pCache, pszUser, pszDomain, "IdleTimeMs", NULL /* Delete property */); 1010 1011 if (RT_SUCCESS(rc)) 1012 #endif 1013 } 1014 #ifdef DEBUG 1015 else if (RT_SUCCESS(rc) && ipcRes.uLastInput == UINT32_MAX) 1016 VGSvcVerbose(4, "Last input for user '%s' is not supported, skipping\n", pszUser, rc); 1007 1017 #endif 1008 1018 } 1009 1019 #ifdef DEBUG 1010 else if (ipcRes.uLastInput == UINT32_MAX)1011 VGSvcVerbose(4, "Last input for user '%s' is not supported, skipping\n", pszUser, rc);1012 1013 1020 VGSvcVerbose(4, "Getting last input for user '%s' ended with rc=%Rrc\n", pszUser, rc); 1014 1021 #endif … … 1156 1163 /* Retrieve assigned processes of current session. */ 1157 1164 uint32_t cCurSessionProcs = vgsvcVMInfoWinSessionHasProcesses(&paSessions[i], paProcs, cProcs, 1158 1165 NULL /* Terminal session ID */); 1159 1166 /* Don't return here when current session does not have assigned processes 1160 1167 * anymore -- in that case we have to search through the unique users list below -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp
r62761 r62851 936 936 static int vgsvcVMInfoWriteNetwork(void) 937 937 { 938 int rc = VINF_SUCCESS;939 938 uint32_t cIfsReported = 0; 940 939 char szPropPath[256]; … … 1094 1093 1095 1094 /* Get all available interfaces */ 1096 rc = getifaddrs(&pIfHead);1095 int rc = getifaddrs(&pIfHead); 1097 1096 if (rc < 0) 1098 1097 { … … 1163 1162 1164 1163 #else /* !RT_OS_WINDOWS && !RT_OS_FREEBSD */ 1164 int rc; 1165 1165 /* 1166 1166 * Use SIOCGIFCONF to get a list of interface/protocol configurations. … … 1172 1172 if (sd < 0) 1173 1173 { 1174 rc = RTErrConvertFromErrno(errno);1174 int rc = RTErrConvertFromErrno(errno); 1175 1175 VGSvcError("VMInfo/Network: Failed to get a socket: Error %Rrc\n", rc); 1176 1176 return rc; … … 1182 1182 char *pchBuf; 1183 1183 struct ifconf IfConf; 1184 rc = VINF_SUCCESS;1184 int rc = VINF_SUCCESS; 1185 1185 for (;;) 1186 1186 {
Note:
See TracChangeset
for help on using the changeset viewer.