]> git.sesse.net Git - vlc/blob - activex/objectsafety.cpp
0cfc678b6645537fcd700c408c772af90cc3412e
[vlc] / activex / objectsafety.cpp
1 /*****************************************************************************\r
2  * objectsafety.cpp: ActiveX control for VLC\r
3  *****************************************************************************\r
4  * Copyright (C) 2005 VideoLAN\r
5  *\r
6  * Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>\r
7  *\r
8  * This program is free software; you can redistribute it and/or modify\r
9  * it under the terms of the GNU General Public License as published by\r
10  * the Free Software Foundation; either version 2 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU General Public License\r
19  * along with this program; if not, write to the Free Software\r
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.\r
21  *****************************************************************************/\r
22 \r
23 #include "plugin.h"\r
24 #include "objectsafety.h"\r
25 \r
26 #include "axvlc_idl.h"\r
27 \r
28 #if 0\r
29 const GUID IID_IObjectSafety = \r
30     {0xCB5BDC81,0x93C1,0x11cf,{0x8F,0x20,0x00,0x80,0x5F,0x2C,0xD0,0x64}}; \r
31 #endif\r
32 \r
33 STDMETHODIMP VLCObjectSafety::GetInterfaceSafetyOptions(      \r
34     REFIID riid,\r
35     DWORD *pdwSupportedOptions,\r
36     DWORD *pdwEnabledOptions\r
37 )\r
38 {\r
39     if( (NULL == pdwSupportedOptions) || (NULL == pdwEnabledOptions) )\r
40         return E_POINTER;\r
41 \r
42     *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACESAFE_FOR_UNTRUSTED_CALLER;\r
43 \r
44     if( (IID_IDispatch == riid)\r
45      || (IID_IVLCControl == riid) )\r
46     {\r
47         *pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_CALLER;\r
48         return NOERROR;\r
49     }\r
50     else if( (IID_IPersist == riid)\r
51           || (IID_IPersistStreamInit == riid)\r
52           || (IID_IPersistStorage == riid)\r
53           || (IID_IPersistPropertyBag == riid) )\r
54     {\r
55         *pdwEnabledOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA;\r
56         return NOERROR;\r
57     }\r
58     *pdwEnabledOptions = 0;\r
59     return E_NOINTERFACE;\r
60 };\r
61 \r
62 STDMETHODIMP VLCObjectSafety::SetInterfaceSafetyOptions(      \r
63     REFIID riid,\r
64     DWORD dwOptionSetMask,\r
65     DWORD dwEnabledOptions\r
66 )\r
67 {\r
68     if( (IID_IDispatch == riid)\r
69      || (IID_IVLCControl == riid) )\r
70     {\r
71         if( (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwOptionSetMask)\r
72          && (INTERFACESAFE_FOR_UNTRUSTED_CALLER == dwEnabledOptions) )\r
73         {\r
74             return NOERROR;\r
75         }\r
76         return E_FAIL;\r
77     }\r
78     else if( (IID_IPersist == riid)\r
79           || (IID_IPersistStreamInit == riid)\r
80           || (IID_IPersistStorage == riid)\r
81           || (IID_IPersistPropertyBag == riid) )\r
82     {\r
83         if( (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwOptionSetMask)\r
84          && (INTERFACESAFE_FOR_UNTRUSTED_DATA == dwEnabledOptions) )\r
85         {\r
86             return NOERROR;\r
87         }\r
88         return E_FAIL;\r
89     }\r
90     return E_FAIL;\r
91 };\r
92 \r