Leaked source code of windows server 2003
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.

161 lines
4.4 KiB

  1. #ifndef _TRKCOM_HXX_
  2. #define _TRKCOM_HXX_
  3. #include <trklib.hxx>
  4. #include <trkwks.h>
  5. #include <trksvr.h>
  6. #include <trkcom.h>
  7. #include <ole2.h>
  8. #include <ocidl.h>
  9. #include <olechar.h>
  10. class CClassFactory: public IClassFactory
  11. {
  12. public:
  13. CClassFactory( )
  14. {
  15. _cRefs = 1;
  16. }
  17. ~CClassFactory()
  18. {
  19. }
  20. public:
  21. STDMETHODIMP QueryInterface( REFIID riid, void **ppvObj );
  22. STDMETHODIMP_(ULONG) AddRef(void);
  23. STDMETHODIMP_(ULONG) Release(void);
  24. public:
  25. STDMETHODIMP CreateInstance( IUnknown *pUnkOuter,
  26. REFIID riid,
  27. void **ppvObject );
  28. STDMETHODIMP LockServer( BOOL fLock );
  29. private:
  30. long _cRefs;
  31. };
  32. typedef struct tagLinkTrackPersistentState
  33. {
  34. DWORD cbSize;
  35. CLSID clsid;
  36. CDomainRelativeObjId droidCurrent;
  37. CDomainRelativeObjId droidBirth;
  38. } LinkTrackPersistentState;
  39. class CTrackFile : public ITrackFile,
  40. public ITrackFileRestricted,
  41. public IPersistMemory,
  42. public IPersistStreamInit
  43. {
  44. // ------------
  45. // Construction
  46. // ------------
  47. public:
  48. CTrackFile();
  49. private:
  50. ~CTrackFile();
  51. // ----------------
  52. // IUnknown Methods
  53. // ----------------
  54. public:
  55. STDMETHODIMP_(ULONG) AddRef();
  56. STDMETHODIMP_(ULONG) Release();
  57. STDMETHODIMP QueryInterface( REFIID iid, void ** ppvObject );
  58. // ------------------
  59. // ------------------
  60. public:
  61. STDMETHODIMP CreateFromPath( /*in*/ const OLECHAR * poszPath );
  62. STDMETHODIMP Resolve( /*in/out*/ DWORD *pcbPath,
  63. /*out*/ OLECHAR * poszPath,
  64. /*in*/ DWORD dwMillisecondTimeout );
  65. STDMETHODIMP Resolve( /*in/out*/ DWORD *pcbPath,
  66. /*out*/ OLECHAR * poszPath,
  67. /*in*/ DWORD dwMillisecondTimeout,
  68. /*in*/ DWORD Restrictions );
  69. STDMETHODIMP Open( /*in, out*/ DWORD * pcbPathHint,
  70. /*in, out, size_is(*pcbPathHint), string*/ OLECHAR * poszPathHint,
  71. /*in*/ DWORD dwMillisecondTimeout,
  72. /*in*/ DWORD dwDesiredAccess, // access (read-write) mode
  73. /*in*/ DWORD dwShareMode, // share mode
  74. /*in*/ DWORD dwFlags,
  75. /*out*/ HANDLE * phFile );
  76. STDMETHODIMP OpenStorageEx( /*in, out*/ DWORD * pcbPathHint,
  77. /*in, out, size_is(*pcbPathHint), string*/ OLECHAR * poszPathHint,
  78. /*in*/ DWORD dwMillisecondTimeout,
  79. /*in*/ DWORD grfMode,
  80. /*in*/ DWORD stgfmt, // enum
  81. /*in*/ DWORD grfAttrs, // reserved
  82. /*in*/ REFIID riid,
  83. /*out, iid_is(riid)*/ void ** ppObjectOpen );
  84. // -------------------------------
  85. // IPersistMemory & IPersistStream
  86. // -------------------------------
  87. public:
  88. // GetClassId, IsDirty, InitNew, and GetSizeMax are shared by
  89. // IPersistMemory and IPersistStream
  90. STDMETHODIMP GetClassID( CLSID *pClassID );
  91. STDMETHODIMP IsDirty();
  92. STDMETHODIMP InitNew();
  93. // IPersistMemory unique
  94. STDMETHODIMP GetSizeMax( ULONG *pcbSize );
  95. STDMETHODIMP Load( void * pvMem, ULONG cbSize );
  96. STDMETHODIMP Save( void * pvMem, BOOL fClearDirty, ULONG cbSize );
  97. // IPersistStream unique
  98. STDMETHODIMP GetSizeMax( ULARGE_INTEGER* pcbSize );
  99. STDMETHODIMP Load( IStream* pStm );
  100. STDMETHODIMP Save( IStream* pStm, BOOL fClearDirty );
  101. // ----------------
  102. // Friend functions
  103. // ----------------
  104. public:
  105. friend void ExtractPersistentState(CTrackFile*, LinkTrackPersistentState*);
  106. friend BOOL CmpPersistentState(CTrackFile*, LinkTrackPersistentState*);
  107. friend void FakeCreateFromPath(CTrackFile*);
  108. // --------------
  109. // Internal State
  110. // --------------
  111. private:
  112. long _cRefs;
  113. BOOL _fDirty; // We have new data
  114. BOOL _fLoaded; // InitNew, Load, or CreateFromPath has been called
  115. LinkTrackPersistentState _PersistentState;
  116. };
  117. #endif // #ifndef _TRKCOM_HXX_