1 /*****************************************************************************
2 * persiststorage.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 *****************************************************************************/
24 #include "persiststorage.h"
28 STDMETHODIMP
VLCPersistStorage::GetClassID(LPCLSID pClsID
)
33 *pClsID
= _p_instance
->getClassID();
38 STDMETHODIMP
VLCPersistStorage::IsDirty(void)
40 return _p_instance
->isDirty() ? S_OK
: S_FALSE
;
43 STDMETHODIMP
VLCPersistStorage::InitNew(LPSTORAGE pStg
)
45 return _p_instance
->onInit();
48 STDMETHODIMP
VLCPersistStorage::Load(LPSTORAGE pStg
)
54 HRESULT result
= pStg
->OpenStream(L
"VideoLAN ActiveX Plugin Data", NULL
,
55 STGM_READ
|STGM_SHARE_EXCLUSIVE
, 0, &pStm
);
60 LPPERSISTSTREAMINIT pPersistStreamInit
;
61 if( SUCCEEDED(QueryInterface(IID_IPersistStreamInit
, (void **)&pPersistStreamInit
)) )
63 result
= pPersistStreamInit
->Load(pStm
);
64 pPersistStreamInit
->Release();
72 STDMETHODIMP
VLCPersistStorage::Save(LPSTORAGE pStg
, BOOL fSameAsLoad
)
77 if( fSameAsLoad
&& (S_FALSE
== IsDirty()) )
81 HRESULT result
= pStg
->CreateStream(L
"VideoLAN ActiveX Plugin Data",
82 STGM_CREATE
|STGM_READWRITE
|STGM_SHARE_EXCLUSIVE
, 0, 0, &pStm
);
87 LPPERSISTSTREAMINIT pPersistStreamInit
;
88 if( SUCCEEDED(QueryInterface(IID_IPersistStreamInit
, (void **)&pPersistStreamInit
)) )
90 result
= pPersistStreamInit
->Save(pStm
, fSameAsLoad
);
91 pPersistStreamInit
->Release();
99 STDMETHODIMP
VLCPersistStorage::SaveCompleted(IStorage
*pStg
)
104 STDMETHODIMP
VLCPersistStorage::HandsOffStorage(void)