Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.3 KiB

  1. // EmFile.h : Declaration of the CEmFile
  2. #ifndef __EMFILE_H_
  3. #define __EMFILE_H_
  4. #include "resource.h" // main symbols
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CEmFile
  7. class ATL_NO_VTABLE CEmFile :
  8. public IStream,
  9. public CComObjectRootEx<CComSingleThreadModel>,
  10. public CComCoClass<CEmFile, &CLSID_EmFile>,
  11. public ISupportErrorInfo,
  12. public IDispatchImpl<IEmFile, &IID_IEmFile, &LIBID_EMSVCLib>
  13. {
  14. private:
  15. HANDLE m_hEmFile;
  16. BSTR m_bstrFileName;
  17. private:
  18. HRESULT
  19. CreateEmFile
  20. (
  21. IN DWORD dwDesiredAccess = GENERIC_READ,
  22. IN DWORD dwShareMode = FILE_SHARE_READ,
  23. IN LPSECURITY_ATTRIBUTES lpSecurityAttributes = NULL,
  24. IN DWORD dwCreationDisposition = OPEN_EXISTING,
  25. IN DWORD dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL,
  26. IN HANDLE hTemplateFile = NULL
  27. );
  28. public:
  29. CEmFile();
  30. ~CEmFile();
  31. DECLARE_REGISTRY_RESOURCEID(IDR_EMFILE)
  32. DECLARE_NOT_AGGREGATABLE(CEmFile)
  33. DECLARE_PROTECT_FINAL_CONSTRUCT()
  34. BEGIN_COM_MAP(CEmFile)
  35. COM_INTERFACE_ENTRY(IEmFile)
  36. COM_INTERFACE_ENTRY(IDispatch)
  37. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  38. COM_INTERFACE_ENTRY(IStream)
  39. END_COM_MAP()
  40. // ISupportsErrorInfo
  41. STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
  42. // IEmFile
  43. public:
  44. STDMETHOD(InitFile)(BSTR bstrFileName);
  45. STDMETHOD(Clone)(/*[out]*/ IStream **ppstm);
  46. STDMETHOD(Stat)(/*[out]*/ STATSTG *pstatstg, DWORD grfStatFlag);
  47. STDMETHOD(UnlockRegion)(/*[in]*/ ULARGE_INTEGER libOffset, /*[in]*/ ULARGE_INTEGER cb, /*[in]*/ DWORD dwLockType);
  48. STDMETHOD(LockRegion)(/*[in]*/ ULARGE_INTEGER libOffset, /*[in]*/ ULARGE_INTEGER cb, /*[in]*/ DWORD dwLockType);
  49. STDMETHOD(Revert)(void);
  50. STDMETHOD(Commit)(/*[in]*/ DWORD grfCommitFlags);
  51. STDMETHOD(CopyTo)(/*[in]*/ IStream *pstm, /*[in]*/ ULARGE_INTEGER cb, /*[out]*/ ULARGE_INTEGER *pcbRead, /*[out]*/ ULARGE_INTEGER *pcbWritten);
  52. STDMETHOD(SetSize)(/*[in]*/ ULARGE_INTEGER libNewSize);
  53. STDMETHOD(Seek)(/*[in]*/ LARGE_INTEGER dlibMove, /*[in]*/ ULONG dwOrigin, /*[out]*/ ULARGE_INTEGER *plibNewPosition);
  54. STDMETHOD(Write)(/*[in]*/ void const *pv, /*[in]*/ ULONG cb, /*[out]*/ ULONG *pcbWritten);
  55. STDMETHOD(Read)(/*[out]*/ void *pv, /*[in]*/ ULONG cb, /*[out]*/ ULONG *pcbRead);
  56. };
  57. #endif //__EMFILE_H_