diff options
Diffstat (limited to 'plugins/pluginWASAPI/plugin_wasapi_utils.cxx')
-rwxr-xr-x | plugins/pluginWASAPI/plugin_wasapi_utils.cxx | 76 |
1 files changed, 37 insertions, 39 deletions
diff --git a/plugins/pluginWASAPI/plugin_wasapi_utils.cxx b/plugins/pluginWASAPI/plugin_wasapi_utils.cxx index bc2d45e..e967cff 100755 --- a/plugins/pluginWASAPI/plugin_wasapi_utils.cxx +++ b/plugins/pluginWASAPI/plugin_wasapi_utils.cxx @@ -1,18 +1,18 @@ /* Copyright (C) 2013 Mamadou DIOP * Copyright (C) 2013 Doubango Telecom <http://www.doubango.org> -* +* * This file is part of Open Source Doubango Framework. * * DOUBANGO is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. -* +* * DOUBANGO is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. -* +* * You should have received a copy of the GNU General Public License * along with DOUBANGO. */ @@ -24,58 +24,56 @@ bool WASAPIUtils::g_bStarted = false; HRESULT WASAPIUtils::Startup() { - if(!g_bStarted) - { - HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); - if(SUCCEEDED(hr) || hr == 0x80010106) // 0x80010106 when called from managed code (e.g. Boghe) - More info: http://support.microsoft.com/kb/824480 - { - hr = S_OK; - } - g_bStarted = SUCCEEDED(hr); - return hr; - } - return S_OK; + if(!g_bStarted) { + HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); + if(SUCCEEDED(hr) || hr == 0x80010106) { // 0x80010106 when called from managed code (e.g. Boghe) - More info: http://support.microsoft.com/kb/824480 + hr = S_OK; + } + g_bStarted = SUCCEEDED(hr); + return hr; + } + return S_OK; } HRESULT WASAPIUtils::Shutdown() { - return S_OK; + return S_OK; } void WASAPIUtils::PrintError(const char* pcFileName, const char* pcFuncName, unsigned nLineNumber, HRESULT hr) { - CHAR message[1024] = {0}; + CHAR message[1024] = {0}; #if PLUGIN_WASAPI_UNDER_WINDOWS_RT - // FormatMessageA not allowed on the Store - static WCHAR wBuff[1024] = {0}; - FormatMessageW( - FORMAT_MESSAGE_FROM_SYSTEM, - tsk_null, - hr, - 0, - wBuff, - sizeof(wBuff)-1, - tsk_null); - WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, wBuff, wcslen(wBuff), message, sizeof(message) - 1, NULL, NULL); + // FormatMessageA not allowed on the Store + static WCHAR wBuff[1024] = {0}; + FormatMessageW( + FORMAT_MESSAGE_FROM_SYSTEM, + tsk_null, + hr, + 0, + wBuff, + sizeof(wBuff)-1, + tsk_null); + WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, wBuff, wcslen(wBuff), message, sizeof(message) - 1, NULL, NULL); #else #ifdef _WIN32_WCE - FormatMessage + FormatMessage #else - FormatMessageA + FormatMessageA #endif - ( + ( #if !PLUGIN_WASAPI_UNDER_WINDOWS_RT - FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_ALLOCATE_BUFFER | #endif - FORMAT_MESSAGE_FROM_SYSTEM, - tsk_null, - hr, - 0, - message, - sizeof(message) - 1, - tsk_null); + FORMAT_MESSAGE_FROM_SYSTEM, + tsk_null, + hr, + 0, + message, + sizeof(message) - 1, + tsk_null); #endif - TSK_DEBUG_ERROR("[WASAPI] File:%s\n Function=%s\n Line:%u\n Message:%s", pcFileName, pcFuncName, nLineNumber, message); + TSK_DEBUG_ERROR("[WASAPI] File:%s\n Function=%s\n Line:%u\n Message:%s", pcFileName, pcFuncName, nLineNumber, message); }
\ No newline at end of file |