VirtualBox

Changeset 49891 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Dec 12, 2013 8:09:20 PM (11 years ago)
Author:
vboxsync
Message:

Merged private draganddrop branch into trunk.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/VBox

  • trunk/src/VBox/Additions/WINNT/VBoxTray/Makefile.kmk

    r48070 r49891  
    2626endif
    2727VBoxTray_SDKS     = ReorderCompilerIncs $(VBOX_WINDDK_GST)
    28 VBoxTray_DEFS     = VBOX_WITH_HGCM LOG_TO_BACKDOOR
     28VBoxTray_DEFS     = \
     29        VBOX_WITH_HGCM \
     30        VBOX_BUILD_TARGET=\"$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)\"
    2931VBoxTray_INCS     = ../include
    3032VBoxTray_SOURCES  = \
     
    3941        VBoxHelpers.cpp \
    4042        VBoxTray.rc
     43ifdef VBOX_WITH_DRAG_AND_DROP
     44 VBoxTray_DEFS     += \
     45        VBOX_WITH_DRAG_AND_DROP \
     46        $(if $(VBOX_WITH_DRAG_AND_DROP_GH),VBOX_WITH_DRAG_AND_DROP_GH,)
     47 VBoxTray_SOURCES  += \
     48        VBoxDnD.cpp \
     49        VBoxDnDDataObject.cpp \
     50        VBoxDnDEnumFormat.cpp \
     51        VBoxDnDDropSource.cpp
     52endif
    4153ifdef VBOX_WITH_GUEST_PROPS
    42  VBoxTray_DEFS     +=  _WIN32_IE=0x500 VBOX_WITH_GUEST_PROPS
     54 VBoxTray_DEFS     += _WIN32_IE=0x500 VBOX_WITH_GUEST_PROPS
    4355 VBoxTray_SOURCES  += \
    4456        VBoxHostVersion.cpp \
     
    4658endif
    4759ifdef VBOX_WITH_SHARED_FOLDERS
    48  VBoxTray_DEFS     +=  VBOX_WITH_SHARED_FOLDERS
     60 VBoxTray_DEFS     += VBOX_WITH_SHARED_FOLDERS
    4961 VBoxTray_SOURCES  += \
    5062        VBoxSharedFolders.cpp
     
    5769        VBoxMMR.cpp
    5870endif
    59 
    6071ifdef VBOX_WITH_WDDM
    6172 VBoxTray_DEFS   += VBOX_WITH_WDDM
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxClipboard.cpp

    r44528 r49891  
    525525    }
    526526
     527#ifndef DEBUG_andy
    527528    Log(("VBoxTray: vboxClipboardProcessMsg returned with rc = %ld\n", rc));
     529#endif
    528530    return rc;
    529531}
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxDisplay.cpp

    r48979 r49891  
    964964        else
    965965        {
     966#ifndef DEBUG_andy /* Too noisy for me. */
    966967            Log(("VBoxTray: VBoxDisplayThread: error 0 from DeviceIoControl VBOXGUEST_IOCTL_WAITEVENT\n"));
     968#endif
    967969            /* sleep a bit to not eat too much CPU in case the above call always fails */
    968970            if (WaitForSingleObject(pCtx->pEnv->hStopEvent, 10) == WAIT_OBJECT_0)
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxTray.cpp

    r48070 r49891  
    2020*   Header Files                                                               *
    2121*******************************************************************************/
     22#ifdef DEBUG
     23# define LOG_ENABLED
     24# define LOG_GROUP LOG_GROUP_DEFAULT
     25#endif
     26
     27#include <package-generated.h>
     28#include "product-generated.h"
     29
    2230#include "VBoxTray.h"
    2331#include "VBoxTrayMsg.h"
     
    3038#include "VBoxHostVersion.h"
    3139#include "VBoxSharedFolders.h"
     40#ifdef VBOX_WITH_DRAG_AND_DROP
     41# include "VBoxDnD.h"
     42#endif
    3243#include "VBoxIPC.h"
    3344#include "VBoxLA.h"
     
    4253#include <iprt/buildconfig.h>
    4354#include <iprt/ldr.h>
     55#include <iprt/process.h>
     56#include <iprt/system.h>
     57#include <iprt/time.h>
     58#include <VBox/log.h>
    4459
    4560/* Default desktop state tracking */
     
    133148DWORD                 gMajorVersion;
    134149
     150static PRTLOGGER      g_pLoggerRelease = NULL;
     151static uint32_t       g_cHistory = 10;                   /* Enable log rotation, 10 files. */
     152static uint32_t       g_uHistoryFileTime = RT_SEC_1DAY;  /* Max 1 day per file. */
     153static uint64_t       g_uHistoryFileSize = 100 * _1M;    /* Max 100MB per file. */
    135154
    136155/* The service table. */
     
    195214        NULL /* pfnStop */,
    196215        VBoxMMRDestroy
     216    },
     217#endif
     218#ifdef VBOX_WITH_DRAG_AND_DROP
     219    {
     220        "Drag and Drop",
     221        VBoxDnDInit,
     222        VBoxDnDThread,
     223        VBoxDnDStop,
     224        VBoxDnDDestroy
    197225    },
    198226#endif
     
    475503        ghVBoxDriver = NULL;
    476504    }
     505}
     506
     507/**
     508 * Release logger callback.
     509 *
     510 * @return  IPRT status code.
     511 * @param   pLoggerRelease
     512 * @param   enmPhase
     513 * @param   pfnLog
     514 */
     515static void vboxTrayLogHeaderFooter(PRTLOGGER pLoggerRelease, RTLOGPHASE enmPhase, PFNRTLOGPHASEMSG pfnLog)
     516{
     517    /* Some introductory information. */
     518    static RTTIMESPEC s_TimeSpec;
     519    char szTmp[256];
     520    if (enmPhase == RTLOGPHASE_BEGIN)
     521        RTTimeNow(&s_TimeSpec);
     522    RTTimeSpecToString(&s_TimeSpec, szTmp, sizeof(szTmp));
     523
     524    switch (enmPhase)
     525    {
     526        case RTLOGPHASE_BEGIN:
     527        {
     528            pfnLog(pLoggerRelease,
     529                   "VBoxTray %s r%s %s (%s %s) release log\n"
     530                   "Log opened %s\n",
     531                   RTBldCfgVersion(), RTBldCfgRevisionStr(), VBOX_BUILD_TARGET,
     532                   __DATE__, __TIME__, szTmp);
     533
     534            int vrc = RTSystemQueryOSInfo(RTSYSOSINFO_PRODUCT, szTmp, sizeof(szTmp));
     535            if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
     536                pfnLog(pLoggerRelease, "OS Product: %s\n", szTmp);
     537            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szTmp, sizeof(szTmp));
     538            if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
     539                pfnLog(pLoggerRelease, "OS Release: %s\n", szTmp);
     540            vrc = RTSystemQueryOSInfo(RTSYSOSINFO_VERSION, szTmp, sizeof(szTmp));
     541            if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
     542                pfnLog(pLoggerRelease, "OS Version: %s\n", szTmp);
     543            if (RT_SUCCESS(vrc) || vrc == VERR_BUFFER_OVERFLOW)
     544                pfnLog(pLoggerRelease, "OS Service Pack: %s\n", szTmp);
     545
     546            /* the package type is interesting for Linux distributions */
     547            char szExecName[RTPATH_MAX];
     548            char *pszExecName = RTProcGetExecutablePath(szExecName, sizeof(szExecName));
     549            pfnLog(pLoggerRelease,
     550                   "Executable: %s\n"
     551                   "Process ID: %u\n"
     552                   "Package type: %s"
     553#ifdef VBOX_OSE
     554                   " (OSE)"
     555#endif
     556                   "\n",
     557                   pszExecName ? pszExecName : "unknown",
     558                   RTProcSelf(),
     559                   VBOX_PACKAGE_STRING);
     560            break;
     561        }
     562
     563        case RTLOGPHASE_PREROTATE:
     564            pfnLog(pLoggerRelease, "Log rotated - Log started %s\n", szTmp);
     565            break;
     566
     567        case RTLOGPHASE_POSTROTATE:
     568            pfnLog(pLoggerRelease, "Log continuation - Log started %s\n", szTmp);
     569            break;
     570
     571        case RTLOGPHASE_END:
     572            pfnLog(pLoggerRelease, "End of log file - Log started %s\n", szTmp);
     573            break;
     574
     575        default:
     576            /* nothing */;
     577    }
     578}
     579
     580/**
     581 * Creates the default release logger outputting to the specified file.
     582 * Pass NULL for disabled logging.
     583 *
     584 * @return  IPRT status code.
     585 * @param   pszLogFile              Filename for log output.  Optional.
     586 */
     587static int vboxTrayLogCreate(const char *pszLogFile)
     588{
     589    /* Create release logger (stdout + file). */
     590    static const char * const s_apszGroups[] = VBOX_LOGGROUP_NAMES;
     591    RTUINT fFlags = RTLOGFLAGS_PREFIX_THREAD | RTLOGFLAGS_PREFIX_TIME_PROG;
     592#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
     593    fFlags |= RTLOGFLAGS_USECRLF;
     594#endif
     595    char szError[RTPATH_MAX + 128] = "";
     596    int rc = RTLogCreateEx(&g_pLoggerRelease, fFlags,
     597#ifdef DEBUG
     598                           "all.e.l.f",
     599                           "VBOXTRAY_LOG",
     600#else
     601                           "all",
     602                           "VBOXTRAY_RELEASE_LOG",
     603#endif
     604                           RT_ELEMENTS(s_apszGroups), s_apszGroups, RTLOGDEST_STDOUT,
     605                           vboxTrayLogHeaderFooter, g_cHistory, g_uHistoryFileSize, g_uHistoryFileTime,
     606                           szError, sizeof(szError), pszLogFile);
     607    if (RT_SUCCESS(rc))
     608    {
     609#ifdef DEBUG
     610        RTLogSetDefaultInstance(g_pLoggerRelease);
     611#else
     612        /* Register this logger as the release logger. */
     613        RTLogRelSetDefaultInstance(g_pLoggerRelease);
     614#endif
     615        /* Explicitly flush the log in case of VBOXTRAY_RELEASE_LOG=buffered. */
     616        RTLogFlush(g_pLoggerRelease);
     617    }
     618    else
     619        MessageBox(GetDesktopWindow(),
     620                   szError, "VBoxTray - Logging Error", MB_OK | MB_ICONERROR);
     621
     622    return rc;
     623}
     624
     625static void vboxTrayLogDestroy(void)
     626{
     627    RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
    477628}
    478629
     
    802953                            while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
    803954                            {
     955#ifndef DEBUG_andy
    804956                                Log(("VBoxTray: msg %p\n", msg.message));
     957#endif
    805958                                if (msg.message == WM_QUIT)
    806959                                {
     
    833986int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
    834987{
    835     /* Do not use a global namespace ("Global\\") for mutex name here, will blow up NT4 compatibility! */
     988    /* Note: Do not use a global namespace ("Global\\") for mutex name here,
     989     * will blow up NT4 compatibility! */
    836990    HANDLE hMutexAppRunning = CreateMutex(NULL, FALSE, "VBoxTray");
    837991    if (   hMutexAppRunning != NULL
    838992        && GetLastError() == ERROR_ALREADY_EXISTS)
    839993    {
    840         /* Close the mutex for this application instance. */
     994        /* VBoxTray already running? Bail out. */
    841995        CloseHandle (hMutexAppRunning);
    842996        hMutexAppRunning = NULL;
     
    8471001
    8481002    int rc = RTR3InitExeNoArguments(0);
     1003    if (RT_SUCCESS(rc))
     1004        rc = vboxTrayLogCreate(NULL /* pszLogFile */);
     1005
    8491006    if (RT_SUCCESS(rc))
    8501007    {
     
    9311088
    9321089    VbglR3Term();
     1090
     1091    vboxTrayLogDestroy();
     1092
    9331093    return RT_SUCCESS(rc) ? 0 : 1;
    9341094}
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxVRDP.cpp

    r46593 r49891  
    409409                else
    410410                {
     411#ifndef DEBUG_andy /* Too noisy for me. */
    411412                    Log(("VBoxTray: VBoxVRDPThread: Error from DeviceIoControl VBOXGUEST_IOCTL_VMMREQUEST\n"));
    412 
     413#endif
    413414                    /* sleep a bit to not eat too much CPU in case the above call always fails */
    414415                    if (WaitForSingleObject(pCtx->pEnv->hStopEvent, 10) == WAIT_OBJECT_0)
     
    422423        else
    423424        {
     425#ifndef DEBUG_andy
    424426            Log(("VBoxTray: VBoxVRDPThread: Error from DeviceIoControl VBOXGUEST_IOCTL_WAITEVENT\n"));
    425 
     427#endif
    426428            /* sleep a bit to not eat too much CPU in case the above call always fails */
    427429            if (WaitForSingleObject(pCtx->pEnv->hStopEvent, 10) == WAIT_OBJECT_0)
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