Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

objectsafety.h

00001 /*****************************************************************************
00002  * objectsafety.h: ActiveX control for VLC
00003  *****************************************************************************
00004  * Copyright (C) 2005 the VideoLAN team
00005  *
00006  * Authors: Damien Fouilleul <[email protected]>
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00021  *****************************************************************************/
00022 
00023 #ifndef __OBJECTSAFETY_H__
00024 #define __OBJECTSAFETY_H__
00025 
00026 #if HAVE_OBJSAFE_HEADER
00027 /*
00028 ** at last, a version of mingw that supports this header
00029 */
00030 #include <objsafe.h>
00031 
00032 #else
00033 /*
00034 ** mingw does not yet support objsafe.h, redefine what we need here
00035 */
00036 
00037 // {CB5BDC81-93C1-11cf-8F20-00805F2CD064}
00038 extern "C" const IID IID_IObjectSafety;
00039 
00040 #define INTERFACESAFE_FOR_UNTRUSTED_CALLER 1L
00041 #define INTERFACESAFE_FOR_UNTRUSTED_DATA   2L
00042 
00043 struct IObjectSafety : public IUnknown
00044 {
00045     virtual STDMETHODIMP GetInterfaceSafetyOptions(      
00046         REFIID riid,
00047         DWORD __RPC_FAR *pdwSupportedOptions,
00048         DWORD __RPC_FAR *pdwEnabledOptions
00049     ) = 0;
00050 
00051     virtual STDMETHODIMP SetInterfaceSafetyOptions(      
00052         REFIID riid,
00053         DWORD dwSupportedOptions,
00054         DWORD dwOptionSetMask
00055     ) = 0;
00056 };
00057 
00058 #endif
00059 
00060 class VLCObjectSafety : public IObjectSafety
00061 {
00062 public:
00063 
00064     VLCObjectSafety(VLCPlugin *p_instance) : _p_instance(p_instance) {};
00065     virtual ~VLCObjectSafety() {};
00066 
00067     // IUnknown methods
00068     STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
00069     {
00070         if( (NULL != ppv)
00071          && (IID_IUnknown == riid)
00072          && (IID_IObjectSafety == riid) ) 
00073         {
00074             AddRef();
00075             *ppv = reinterpret_cast<LPVOID>(this);
00076             return NOERROR;
00077         }
00078         return _p_instance->pUnkOuter->QueryInterface(riid, ppv);
00079     };
00080 
00081     STDMETHODIMP_(ULONG) AddRef(void) { return _p_instance->pUnkOuter->AddRef(); };
00082     STDMETHODIMP_(ULONG) Release(void) { return _p_instance->pUnkOuter->Release(); };
00083 
00084     // IUnknown methods
00085     STDMETHODIMP GetInterfaceSafetyOptions(      
00086         REFIID riid,
00087         DWORD *pdwSupportedOptions,
00088         DWORD *pdwEnabledOptions
00089     );
00090 
00091     STDMETHODIMP SetInterfaceSafetyOptions(      
00092         REFIID riid,
00093         DWORD dwOptionSetMask,
00094         DWORD dwEnabledOptions
00095     );
00096 
00097 private: 
00098 
00099     VLCPlugin *_p_instance;
00100 };
00101 
00102 #endif

Generated on Tue Dec 20 10:14:18 2005 for vlc-0.8.4a by  doxygen 1.4.2