From: rbencina Date: Wed, 21 Jan 2015 06:24:32 +0000 (+0000) Subject: disabled deprecated API warning for GetVersionEx in dsound, wmme and wdmks host APIs. X-Git-Tag: pa_stable_v190600_20161030~44 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=b3216e814b667915418098f124ea9a841304fc7b;p=portaudio disabled deprecated API warning for GetVersionEx in dsound, wmme and wdmks host APIs. --- diff --git a/src/hostapi/dsound/pa_win_ds.c b/src/hostapi/dsound/pa_win_ds.c index d06fcc2..35fac5f 100644 --- a/src/hostapi/dsound/pa_win_ds.c +++ b/src/hostapi/dsound/pa_win_ds.c @@ -318,10 +318,21 @@ typedef struct PaWinDsStream */ static double PaWinDS_GetMinSystemLatencySeconds( void ) { +/* +NOTE: GetVersionEx() is deprecated as of Windows 8.1 and can not be used to reliably detect +versions of Windows higher than Windows 8 (due to manifest requirements for reporting higher versions). +Microsoft recommends switching to VerifyVersionInfo (available on Win 2k and later), however GetVersionEx +is is faster, for now we just disable the deprecation warning. +See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx +See: http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe +*/ +#pragma warning (disable : 4996) /* use of GetVersionEx */ + double minLatencySeconds; /* Set minimal latency based on whether NT or other OS. * NT has higher latency. */ + OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof( osvi ); GetVersionEx( &osvi ); @@ -342,6 +353,8 @@ static double PaWinDS_GetMinSystemLatencySeconds( void ) minLatencySeconds = PA_DS_WIN_9X_DEFAULT_LATENCY_; } return minLatencySeconds; + +#pragma warning (default : 4996) } diff --git a/src/hostapi/wdmks/pa_win_wdmks.c b/src/hostapi/wdmks/pa_win_wdmks.c index 6d37bd1..129b9e2 100644 --- a/src/hostapi/wdmks/pa_win_wdmks.c +++ b/src/hostapi/wdmks/pa_win_wdmks.c @@ -641,6 +641,16 @@ static BOOL IsDeviceTheSame(const PaWinWdmDeviceInfo* pDev1, static BOOL IsEarlierThanVista() { +/* +NOTE: GetVersionEx() is deprecated as of Windows 8.1 and can not be used to reliably detect +versions of Windows higher than Windows 8 (due to manifest requirements for reporting higher versions). +Microsoft recommends switching to VerifyVersionInfo (available on Win 2k and later), however GetVersionEx +is is faster, for now we just disable the deprecation warning. +See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx +See: http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe +*/ +#pragma warning (disable : 4996) /* use of GetVersionEx */ + OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof(osvi); if (GetVersionEx(&osvi) && osvi.dwMajorVersion<6) @@ -648,6 +658,8 @@ static BOOL IsEarlierThanVista() return TRUE; } return FALSE; + +#pragma warning (default : 4996) } diff --git a/src/hostapi/wmme/pa_win_wmme.c b/src/hostapi/wmme/pa_win_wmme.c index 25fe0cc..2fb2d49 100644 --- a/src/hostapi/wmme/pa_win_wmme.c +++ b/src/hostapi/wmme/pa_win_wmme.c @@ -917,6 +917,16 @@ error: static void GetDefaultLatencies( PaTime *defaultLowLatency, PaTime *defaultHighLatency ) { +/* +NOTE: GetVersionEx() is deprecated as of Windows 8.1 and can not be used to reliably detect +versions of Windows higher than Windows 8 (due to manifest requirements for reporting higher versions). +Microsoft recommends switching to VerifyVersionInfo (available on Win 2k and later), however GetVersionEx +is is faster, for now we just disable the deprecation warning. +See: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451(v=vs.85).aspx +See: http://www.codeproject.com/Articles/678606/Part-Overcoming-Windows-s-deprecation-of-GetVe +*/ +#pragma warning (disable : 4996) /* use of GetVersionEx */ + OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize = sizeof( osvi ); GetVersionEx( &osvi ); @@ -936,6 +946,8 @@ static void GetDefaultLatencies( PaTime *defaultLowLatency, PaTime *defaultHighL } *defaultHighLatency = *defaultLowLatency * 2; + +#pragma warning (default : 4996) }