Win-specific: Fix crash if TTS interface is not presented in system

This commit is contained in:
Abs62 2014-01-18 19:11:17 +04:00
parent 3bd078debb
commit b100fad8d3
2 changed files with 8 additions and 8 deletions

View file

@ -81,7 +81,7 @@ bool speechAvailable(SpeechHelper sp)
void speechEnumerateAvailableEngines(EnumerateCallback callback, void *userData)
{
HRESULT hr;
IEnumSpObjectTokens * enumSpTokens;
IEnumSpObjectTokens * enumSpTokens = NULL;
ULONG count = 0;
bool next = true;
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);

View file

@ -20,7 +20,7 @@
#ifdef _SAPI_VER
#undef _SAPI_VER
#endif
#define _SAPI_VER 0503
#define _SAPI_VER 0x053
inline void SpHexFromUlong(WCHAR * psz, ULONG ul)
{
@ -110,6 +110,12 @@ inline HRESULT SpGetDescription(ISpObjectToken * pObjToken, WCHAR ** ppszDescrip
WCHAR szLangId[10];
HRESULT hr = S_OK;
if (ppszDescription == NULL)
{
return E_POINTER;
}
*ppszDescription = NULL;
#if _SAPI_VER >= 0x053
WCHAR* pRegKeyPath = 0;
WCHAR* pszTemp = 0;
@ -120,12 +126,6 @@ inline HRESULT SpGetDescription(ISpObjectToken * pObjToken, WCHAR ** ppszDescrip
OSVERSIONINFO ver;
ver.dwOSVersionInfoSize = sizeof( ver );
if (ppszDescription == NULL)
{
return E_POINTER;
}
*ppszDescription = NULL;
if( ( ::GetVersionEx( &ver ) == TRUE ) && ( ver.dwMajorVersion >= 6 ) )
{
// If we reach this code we are running under Windows Vista