2025-04-27 07:49:33 -04:00

132 lines
5.6 KiB
C++

#ifndef __FTPSTORE_H
#define __FTPSTORE_H
#include <objbase.h>
#include "unk.h"
#include "idavstore.h"
interface IDavTransport;
class CFtpStorageImpl : public CCOMBase, public IDavStorage
{
private:
public:
CFtpStorageImpl ();
~CFtpStorageImpl ();
///////////////////////////////////////////////////////////
// IDavStorage
STDMETHODIMP Init(LPWSTR pwszURL,
IDavTransport* pDavTransport);
STDMETHODIMP SetAuth(LPWSTR pwszUserName,
LPWSTR pwszPassword);
///////////////////////////////////////////////////////////
// IStorage
STDMETHODIMP CreateStream(
const WCHAR * pwcsName, //Points to the name of the new stream
DWORD grfMode, //Access mode for the new stream
DWORD reserved1, //Reserved; must be zero
DWORD reserved2, //Reserved; must be zero
IStream ** ppstm); //Points to new stream object
STDMETHODIMP OpenStream(
const WCHAR * pwcsName, //Points to name of stream to open
void * reserved1, //Reserved; must be NULL
DWORD grfMode, //Access mode for the new stream
DWORD reserved2, //Reserved; must be zero
IStream ** ppstm); //Address of output variable
// that receives the IStream interface pointer
STDMETHODIMP CreateStorage(
const WCHAR * pwcsName, //Points to the name of the new storage object
DWORD grfMode, //Access mode for the new storage object
DWORD reserved1, //Reserved; must be zero
DWORD reserved2, //Reserved; must be zero
IStorage ** ppstg); //Points to new storage object
STDMETHODIMP OpenStorage(
const WCHAR * pwcsName, //Points to the name of the
// storage object to open
IStorage * pstgPriority, //Must be NULL.
DWORD grfMode, //Access mode for the new storage object
SNB snbExclude, //Must be NULL.
DWORD reserved, //Reserved; must be zero
IStorage ** ppstg); //Points to opened storage object
STDMETHODIMP CopyTo(
DWORD ciidExclude, //Number of elements in rgiidExclude
IID const * rgiidExclude, //Array of interface identifiers (IIDs)
SNB snbExclude, //Points to a block of stream
// names in the storage object
IStorage * pstgDest); //Points to destination storage object
STDMETHODIMP MoveElementTo(
const WCHAR * pwcsName, //Name of the element to be moved
IStorage * pstgDest, //Points to destination storage object IStorage
const WCHAR * pwcsNewName, //Points to new name of element in destination
DWORD grfFlags); //Specifies a copy or a move
STDMETHODIMP Commit(DWORD grfCommitFlags); //Specifies how changes are to be committed
STDMETHODIMP Revert(void);
STDMETHODIMP EnumElements(
DWORD reserved1, //Reserved; must be zero
void * reserved2, //Reserved; must be NULL
DWORD reserved3, //Reserved; must be zero
IEnumSTATSTG ** ppenum);//Address of output variable that
// receives the IEnumSTATSTG interface pointer
STDMETHODIMP DestroyElement(const WCHAR* pwcsName); //Points to the name of the element to be removed
STDMETHODIMP RenameElement(
const WCHAR * pwcsOldName, //Points to the name of the
// element to be changed
const WCHAR * pwcsNewName); //Points to the new name for
// the specified element
STDMETHODIMP SetElementTimes(
const WCHAR * pwcsName, //Points to name of element to be changed
FILETIME const * pctime, //New creation time for element, or NULL
FILETIME const * patime, //New access time for element, or NULL
FILETIME const * pmtime); //New modification time for element, or NULL
STDMETHODIMP SetClass(REFCLSID clsid); //Class identifier to be assigned to the storage object
STDMETHODIMP SetStateBits(
DWORD grfStateBits, //Specifies new values of bits
DWORD grfMask); //Specifies mask that indicates which
// bits are significant
STDMETHODIMP Stat(
STATSTG * pstatstg, //Location for STATSTG structure
DWORD grfStatFlag); //Values taken from the STATFLAG enumeration
private:
// internal utility functions
LPWSTR __stdcall _ResolveURL(LPWSTR pwszRootURL, LPWSTR pwszRelativeURL);
STDMETHODIMP _GetStream(const WCHAR * pwcsName, //Points to the name of the new stream
DWORD grfMode, //Access mode for the new stream
IStream ** ppstm, //Points to new stream object
BOOL fCreate);
STDMETHODIMP _OpenStorage(LPWSTR pwszURL, //Points to the URL of the new storage object
IStorage ** ppstg); //Points to new storage object
private:
// member variables
IDavTransport* _pDavTransport;
LPWSTR _pwszURL;
LPWSTR _pwszUserName;
LPWSTR _pwszPassword;
BOOL _fInit;
DWORD _grfStateBits;
};
typedef CUnkTmpl<CFtpStorageImpl> CFtpStorage;
#endif // __FTPSTORE_H