VirtualBox

Ignore:
Timestamp:
Aug 1, 2016 10:13:35 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
109447
Message:

GAs/common: warnings

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  
    460460#endif
    461461{
    462     DWORD rcRet = NO_ERROR;
    463 
    464462#ifdef TARGET_NT4
    465463    VGSvcVerbose(2, "Control handler: Control=%#x\n", dwControl);
    466464#else
     465    RT_NOREF1(lpContext);
    467466    VGSvcVerbose(2, "Control handler: Control=%#x, EventType=%#x\n", dwControl, dwEventType);
    468467#endif
    469468
     469    DWORD rcRet = NO_ERROR;
    470470    switch (dwControl)
    471471    {
     
    524524static void WINAPI vgsvcWinMain(DWORD argc, LPTSTR *argv)
    525525{
     526    RT_NOREF2(argc, argv);
    526527    VGSvcVerbose(2, "Registering service control handler ...\n");
    527528#ifdef TARGET_NT4
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServicePageSharing.cpp

    r62521 r62851  
    5656#include <iprt/string.h>
    5757#include <iprt/semaphore.h>
     58#include <iprt/string.h>
    5859#include <iprt/system.h>
    5960#include <iprt/thread.h>
     
    186187    unsigned i;
    187188    UINT     cbFileVersion;
    188     char    *lpszFileVersion;
     189    char    *pszFileVersion = NULL; /* Shut up MSC */
    189190    unsigned cTranslationBlocks = cbTranslate/sizeof(struct LANGANDCODEPAGE);
    190191
    191     for(i = 0; i < cTranslationBlocks; i++)
     192    pModule->szFileVersion[0] = '\0';
     193    for (i = 0; i < cTranslationBlocks; i++)
    192194    {
    193195        /* Fetch file version string. */
    194196        char   szFileVersionLocation[256];
    195197
     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
    196201        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);
    198203        if (fRet)
     204        {
     205            RTStrCopy(pModule->szFileVersion, sizeof(pModule->szFileVersion), pszFileVersion);
    199206            break;
     207        }
    200208    }
    201209    if (i == cTranslationBlocks)
     
    204212        goto end;
    205213    }
    206 
    207     _snprintf(pModule->szFileVersion, sizeof(pModule->szFileVersion), "%s", lpszFileVersion);
    208     pModule->szFileVersion[RT_ELEMENTS(pModule->szFileVersion) - 1] = 0;
    209214
    210215    unsigned idxRegion = 0;
     
    361366                VGSvcVerbose(3, "\n     executable     = %s",             ModuleInfo.szExePath );
    362367                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 );
    364369                VGSvcVerbose(3, "\n     base size      = %d",             ModuleInfo.modBaseSize );
    365370
     
    510515                    VGSvcVerbose(3, "\n\n   KERNEL  MODULE NAME:     %s",     pModule->Info.szModule );
    511516                    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 );
    513518                    VGSvcVerbose(3, "\n     flags          = 0x%08X",         pSystemModules->Modules[i].Flags);
    514519                    VGSvcVerbose(3, "\n     base size      = %d",             pModule->Info.modBaseSize );
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServicePropCache.cpp

    r62521 r62851  
    3636                                                               uint32_t fFlags)
    3737{
     38    RT_NOREF1(fFlags);
    3839    AssertPtrReturn(pCache, NULL);
    3940    AssertPtrReturn(pszName, NULL);
     
    317318                               const char *pszPathFormat, ...)
    318319{
     320    RT_NOREF1(fFlags);
    319321    AssertPtrReturn(pCache, VERR_INVALID_POINTER);
    320322    AssertPtrReturn(pszPathFormat, VERR_INVALID_POINTER);
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp

    r62679 r62851  
    141141static DECLCALLBACK(int) vgsvcWinVmInfoInitOnce(void *pvIgnored)
    142142{
     143    RT_NOREF1(pvIgnored);
     144
    143145    /* SECUR32 */
    144146    RTLDRMOD hLdrMod;
     
    349351                VGSvcError("Token class not implemented: %d\n", tkClass);
    350352                rc = VERR_NOT_IMPLEMENTED;
     353                dwTokenInfoSize = 0; /* Shut up MSC. */
    351354                break;
    352355        }
     
    631634 *                              Optional.
    632635 */
     636/** @todo r=bird: The 'Has' indicates a predicate function, which this is
     637 *        not.  Predicate functions always returns bool. */
    633638static uint32_t vgsvcVMInfoWinSessionHasProcesses(PLUID pSession, PVBOXSERVICEVMINFOPROC const paProcs, DWORD cProcs,
    634639                                                  PULONG puTerminalSession)
     
    640645    }
    641646    if (!g_pfnLsaGetLogonSessionData)
    642         return VERR_NOT_SUPPORTED;
     647        return 0;
    643648
    644649    PSECURITY_LOGON_SESSION_DATA pSessionData = NULL;
     
    798803     */
    799804    bool fFoundUser = false;
    800     DWORD dwErr = NO_ERROR;
    801805    if (   IsValidSid(pSessionData->Sid)
    802806        && (   (SECURITY_LOGON_TYPE)pSessionData->LogonType == Interactive
     
    973977            rc = RTLocalIpcSessionWrite(hSession, &ipcHdr, sizeof(ipcHdr));
    974978
    975             VBOXTRAYIPCRES_USERLASTINPUT ipcRes;
    976979            if (RT_SUCCESS(rc))
     980            {
     981                VBOXTRAYIPCRES_USERLASTINPUT ipcRes;
    977982                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 the
    980                  * 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_uVMInfoUserIdleThresholdMS
    984                           ? VBoxGuestUserState_InUse
    985                           : 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 anything
    992                  *       to update. So only report the user's status to host when we really got something
    993                  *       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);
    9981003
    9991004#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);
    10071017#endif
    10081018            }
    10091019#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 
    10131020            VGSvcVerbose(4, "Getting last input for user '%s' ended with rc=%Rrc\n", pszUser, rc);
    10141021#endif
     
    11561163                    /* Retrieve assigned processes of current session. */
    11571164                    uint32_t cCurSessionProcs = vgsvcVMInfoWinSessionHasProcesses(&paSessions[i], paProcs, cProcs,
    1158                                                                                         NULL /* Terminal session ID */);
     1165                                                                                  NULL /* Terminal session ID */);
    11591166                    /* Don't return here when current session does not have assigned processes
    11601167                     * anymore -- in that case we have to search through the unique users list below
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r62761 r62851  
    936936static int vgsvcVMInfoWriteNetwork(void)
    937937{
    938     int         rc = VINF_SUCCESS;
    939938    uint32_t    cIfsReported = 0;
    940939    char        szPropPath[256];
     
    10941093
    10951094    /* Get all available interfaces */
    1096     rc = getifaddrs(&pIfHead);
     1095    int rc = getifaddrs(&pIfHead);
    10971096    if (rc < 0)
    10981097    {
     
    11631162
    11641163#else /* !RT_OS_WINDOWS && !RT_OS_FREEBSD */
     1164    int rc;
    11651165    /*
    11661166     * Use SIOCGIFCONF to get a list of interface/protocol configurations.
     
    11721172    if (sd < 0)
    11731173    {
    1174         rc = RTErrConvertFromErrno(errno);
     1174        int rc = RTErrConvertFromErrno(errno);
    11751175        VGSvcError("VMInfo/Network: Failed to get a socket: Error %Rrc\n", rc);
    11761176        return rc;
     
    11821182    char           *pchBuf;
    11831183    struct ifconf   IfConf;
    1184     rc = VINF_SUCCESS;
     1184    int rc = VINF_SUCCESS;
    11851185    for (;;)
    11861186    {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette