Compile fix + handle case with no xml:base
[vlc.git] / activex / supporterrorinfo.cpp
blob6982558b9a05e91ad4867ef34d0580ee7433ae41
1 /*****************************************************************************
2 * supporterrorinfo.cpp: ActiveX control for VLC
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
6 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 *****************************************************************************/
23 #include "plugin.h"
24 #include "supporterrorinfo.h"
26 #include "utils.h"
27 #include "axvlc_idl.h"
29 using namespace std;
31 STDMETHODIMP VLCSupportErrorInfo::InterfaceSupportsErrorInfo(REFIID riid)
33 if( (riid == IID_IVLCAudio)
34 || (riid == IID_IVLCInput)
35 || (riid == IID_IVLCPlaylist)
36 || (riid == IID_IVLCVideo)
37 || (riid == IID_IVLCControl2) )
39 return S_OK;
41 return S_FALSE;
44 void VLCSupportErrorInfo::setErrorInfo(LPCOLESTR progid, REFIID riid, const char *description)
46 BSTR bstrDescription = BSTRFromCStr(CP_UTF8, description);
47 if( NULL != bstrDescription )
49 ICreateErrorInfo* pcerrinfo;
51 HRESULT hr = CreateErrorInfo(&pcerrinfo);
52 if( SUCCEEDED(hr) )
54 IErrorInfo* perrinfo;
56 pcerrinfo->SetSource((LPOLESTR)progid);
57 pcerrinfo->SetGUID(riid);
58 pcerrinfo->SetDescription((LPOLESTR)bstrDescription);
59 hr = pcerrinfo->QueryInterface(IID_IErrorInfo, (LPVOID*) &perrinfo);
60 if( SUCCEEDED(hr) )
62 ::SetErrorInfo(0, perrinfo);
63 perrinfo->Release();
65 pcerrinfo->Release();
67 SysFreeString(bstrDescription);