VirtualBox

Changeset 70472 in vbox


Ignore:
Timestamp:
Jan 5, 2018 4:07:29 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
120080
Message:

Audio/DrvHostDSound.cpp: Implemented OS detection when intending to use the IMMNotificationClient interface (only Vista and up). This might help running on older and/or more exotic/unsupported OSes (like WinXP 64).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostDSound.cpp

    r69119 r70472  
    55
    66/*
    7  * Copyright (C) 2006-2017 Oracle Corporation
     7 * Copyright (C) 2006-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2626
    2727#include <iprt/alloc.h>
     28#include <iprt/system.h>
    2829#include <iprt/uuid.h>
    2930
     
    26412642
    26422643#ifdef VBOX_WITH_AUDIO_MMNOTIFICATION_CLIENT
    2643     try
    2644     {
    2645         pThis->m_pNotificationClient = new VBoxMMNotificationClient();
    2646 
    2647         HRESULT hr = pThis->m_pNotificationClient->Initialize();
    2648         if (FAILED(hr))
    2649             rc = VERR_AUDIO_BACKEND_INIT_FAILED;
    2650     }
    2651     catch (std::bad_alloc &ex)
    2652     {
    2653         NOREF(ex);
    2654         rc = VERR_NO_MEMORY;
    2655     }
     2644    bool fUseNotificationClient = false;
     2645
     2646    char szOSVersion[32];
     2647    rc = RTSystemQueryOSInfo(RTSYSOSINFO_RELEASE, szOSVersion, sizeof(szOSVersion));
     2648    if (RT_SUCCESS(rc))
     2649    {
     2650        /* IMMNotificationClient is available starting at Windows Vista. */
     2651        if (RTStrVersionCompare(szOSVersion, "6.0") >= 0)
     2652            fUseNotificationClient = true;
     2653    }
     2654
     2655    if (fUseNotificationClient)
     2656    {
     2657        try
     2658        {
     2659            pThis->m_pNotificationClient = new VBoxMMNotificationClient();
     2660
     2661            HRESULT hr = pThis->m_pNotificationClient->Initialize();
     2662            if (FAILED(hr))
     2663                rc = VERR_AUDIO_BACKEND_INIT_FAILED;
     2664        }
     2665        catch (std::bad_alloc &ex)
     2666        {
     2667            NOREF(ex);
     2668            rc = VERR_NO_MEMORY;
     2669        }
     2670    }
     2671
     2672    LogRel2(("DSound: Notification client is %s\n", fUseNotificationClient ? "enabled" : "disabled"));
    26562673#endif
    26572674
Note: See TracChangeset for help on using the changeset viewer.

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