objectsafety.cpp 2.97 KB
Newer Older
1 2 3
/*****************************************************************************
 * objectsafety.cpp: ActiveX control for VLC
 *****************************************************************************
4
 * Copyright (C) 2005-2010 the VideoLAN team
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
 *
 * This program 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 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program; if not, write to the Free Software
Antoine Cellerier's avatar
Antoine Cellerier committed
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21 22 23 24 25 26 27 28
 *****************************************************************************/

#include "plugin.h"
#include "objectsafety.h"

#include "axvlc_idl.h"

#if 0
29 30
const GUID IID_IObjectSafety =
    {0xCB5BDC81,0x93C1,0x11cf,{0x8F,0x20,0x00,0x80,0x5F,0x2C,0xD0,0x64}};
31 32
#endif

33
STDMETHODIMP VLCObjectSafety::GetInterfaceSafetyOptions(
34 35 36 37 38 39 40 41 42 43 44
    REFIID riid,
    DWORD *pdwSupportedOptions,
    DWORD *pdwEnabledOptions
)
{
    if( (NULL == pdwSupportedOptions) || (NULL == pdwEnabledOptions) )
        return E_POINTER;

    *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACESAFE_FOR_UNTRUSTED_CALLER;

    if( (IID_IDispatch == riid)
45 46
     || (IID_IVLCControl == riid)
     || (IID_IVLCControl2 == riid) )
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
    {
        *pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER;
        return NOERROR;
    }
    else if( (IID_IPersist == riid)
          || (IID_IPersistStreamInit == riid)
          || (IID_IPersistStorage == riid)
          || (IID_IPersistPropertyBag == riid) )
    {
        *pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA;
        return NOERROR;
    }
    *pdwEnabledOptions = 0;
    return E_NOINTERFACE;
};

63
STDMETHODIMP VLCObjectSafety::SetInterfaceSafetyOptions(
64 65 66 67 68 69
    REFIID riid,
    DWORD dwOptionSetMask,
    DWORD dwEnabledOptions
)
{
    if( (IID_IDispatch == riid)
70 71
     || (IID_IVLCControl == riid)
     || (IID_IVLCControl2 == riid) )
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
    {
        if( (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwOptionSetMask)
         && (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwEnabledOptions) )
        {
            return NOERROR;
        }
        return E_FAIL;
    }
    else if( (IID_IPersist == riid)
          || (IID_IPersistStreamInit == riid)
          || (IID_IPersistStorage == riid)
          || (IID_IPersistPropertyBag == riid) )
    {
        if( (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwOptionSetMask)
         && (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwEnabledOptions) )
        {
            return NOERROR;
        }
        return E_FAIL;
    }
    return E_FAIL;
};