00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #pragma once
00023
00024 class CBuffer;
00025 class CIEProtocolRequest;
00026
00027 class CZIPFile;
00028
00029
00030 class CIEProtocol : public CCmdTarget
00031 {
00032
00033 public:
00034 CIEProtocol();
00035 virtual ~CIEProtocol();
00036
00037 DECLARE_DYNAMIC(CIEProtocol)
00038
00039
00040 public:
00041 BOOL Create();
00042 void Close();
00043 BOOL SetCollection(SHA1* pSHA1, LPCTSTR pszPath, CString* psIndex = NULL);
00044
00045
00046 protected:
00047 CCriticalSection m_pSection;
00048 CComPtr<IInternetSession> m_pSession;
00049 CEvent* m_pShutdown;
00050 LONG m_nRequests;
00051 protected:
00052 SHA1 m_pCollSHA1;
00053 CZIPFile* m_pCollZIP;
00054 public:
00055 static CLSID clsidProtocol;
00056 static LPCWSTR pszProtocols[];
00057
00058
00059 protected:
00060 CIEProtocolRequest* CreateRequest();
00061 void OnRequestConstruct(CIEProtocolRequest* pRequest);
00062 void OnRequestDestruct(CIEProtocolRequest* pRequest);
00063 HRESULT OnRequest(LPCTSTR pszURL, CBuffer* pBuffer, CString* psMimeType, BOOL bParseOnly);
00064 HRESULT OnRequestRAZACOL(LPCTSTR pszURL, CBuffer* pBuffer, CString* psMimeType, BOOL bParseOnly);
00065
00066
00067 protected:
00068 BEGIN_INTERFACE_PART(ClassFactory, IClassFactory)
00069 STDMETHOD(CreateInstance)(IUnknown* pUnkOuter, REFIID riid, void** ppvObject);
00070 STDMETHOD(LockServer)(BOOL fLock);
00071 END_INTERFACE_PART(ClassFactory)
00072
00073 DECLARE_INTERFACE_MAP()
00074
00075 friend class CIEProtocolRequest;
00076 };
00077
00078
00079 class CIEProtocolRequest : public CCmdTarget
00080 {
00081
00082 protected:
00083 CIEProtocolRequest(CIEProtocol* pProtocol);
00084 virtual ~CIEProtocolRequest();
00085
00086 DECLARE_DYNAMIC(CIEProtocolRequest)
00087
00088
00089 protected:
00090 CCriticalSection m_pSection;
00091 CIEProtocol* m_pProtocol;
00092 CComPtr<IInternetProtocolSink> m_pSink;
00093 CBuffer* m_pBuffer;
00094
00095
00096 protected:
00097 HRESULT OnStart(LPCTSTR pszURL, IInternetProtocolSink* pSink, IInternetBindInfo* pBindInfo, DWORD dwFlags);
00098 HRESULT OnRead(void* pv, ULONG cb, ULONG* pcbRead);
00099 HRESULT OnTerminate();
00100
00101
00102 protected:
00103 BEGIN_INTERFACE_PART(InternetProtocol, IInternetProtocol)
00104 STDMETHOD(Abort)(HRESULT hrReason, DWORD dwOptions);
00105 STDMETHOD(Continue)(PROTOCOLDATA *pProtocolData);
00106 STDMETHOD(Resume)();
00107 STDMETHOD(Start)(LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved);
00108 STDMETHOD(Suspend)();
00109 STDMETHOD(Terminate)(DWORD dwOptions);
00110 STDMETHOD(LockRequest)(DWORD dwOptions);
00111 STDMETHOD(Read)(void *pv, ULONG cb, ULONG *pcbRead);
00112 STDMETHOD(Seek)(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
00113 STDMETHOD(UnlockRequest)();
00114 END_INTERFACE_PART(InternetProtocol)
00115
00116 BEGIN_INTERFACE_PART(InternetProtocolInfo , IInternetProtocolInfo )
00117 STDMETHOD(CombineUrl)(LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved);
00118 STDMETHOD(CompareUrl)(LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags);
00119 STDMETHOD(ParseUrl)(LPCWSTR pwzUrl, PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved);
00120 STDMETHOD(QueryInfo)(LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer, DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved);
00121 END_INTERFACE_PART(InternetProtocolInfo )
00122
00123 DECLARE_INTERFACE_MAP()
00124
00125 friend class CIEProtocol;
00126 };
00127
00128 extern CIEProtocol IEProtocol;