]> git.sesse.net Git - vlc/blob - activex/objectsafety.cpp
8f333d4d74830d3b46920ec0869e15df5aa25d5b
[vlc] / activex / objectsafety.cpp
1 /*****************************************************************************
2  * objectsafety.cpp: ActiveX control for VLC
3  *****************************************************************************
4  * Copyright (C) 2005 the VideoLAN team
5  *
6  * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
7  *
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.
12  *
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.
17  *
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  *****************************************************************************/
22
23 #include "plugin.h"
24 #include "objectsafety.h"
25
26 #include "axvlc_idl.h"
27
28 #if 0
29 const GUID IID_IObjectSafety = 
30     {0xCB5BDC81,0x93C1,0x11cf,{0x8F,0x20,0x00,0x80,0x5F,0x2C,0xD0,0x64}}; 
31 #endif
32
33 using namespace std;
34
35 STDMETHODIMP VLCObjectSafety::GetInterfaceSafetyOptions(      
36     REFIID riid,
37     DWORD *pdwSupportedOptions,
38     DWORD *pdwEnabledOptions
39 )
40 {
41     if( (NULL == pdwSupportedOptions) || (NULL == pdwEnabledOptions) )
42         return E_POINTER;
43
44     *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACESAFE_FOR_UNTRUSTED_CALLER;
45
46     if( (IID_IDispatch == riid)
47      || (IID_IVLCControl == riid) )
48     {
49         *pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER;
50         return NOERROR;
51     }
52     else if( (IID_IPersist == riid)
53           || (IID_IPersistStreamInit == riid)
54           || (IID_IPersistStorage == riid)
55           || (IID_IPersistPropertyBag == riid) )
56     {
57         *pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA;
58         return NOERROR;
59     }
60     *pdwEnabledOptions = 0;
61     return E_NOINTERFACE;
62 };
63
64 STDMETHODIMP VLCObjectSafety::SetInterfaceSafetyOptions(      
65     REFIID riid,
66     DWORD dwOptionSetMask,
67     DWORD dwEnabledOptions
68 )
69 {
70     if( (IID_IDispatch == riid)
71      || (IID_IVLCControl == riid) )
72     {
73         if( (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwOptionSetMask)
74          && (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwEnabledOptions) )
75         {
76             return NOERROR;
77         }
78         return E_FAIL;
79     }
80     else if( (IID_IPersist == riid)
81           || (IID_IPersistStreamInit == riid)
82           || (IID_IPersistStorage == riid)
83           || (IID_IPersistPropertyBag == riid) )
84     {
85         if( (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwOptionSetMask)
86          && (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwEnabledOptions) )
87         {
88             return NOERROR;
89         }
90         return E_FAIL;
91     }
92     return E_FAIL;
93 };
94