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.

182 lines
4.4 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1998.
  5. //
  6. // File: opendoc.hxx
  7. //
  8. // Contents: CiCOpenedDoc object that is part of CiCFilterObject
  9. //
  10. // History: 12-3-96 markz Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #pragma once
  14. #include <ciintf.h>
  15. #include <cioplock.hxx>
  16. #include <docname.hxx>
  17. class CClientDaemonWorker;
  18. class CImpersonateRemoteAccess;
  19. class CStorageFilterObject;
  20. //+---------------------------------------------------------------------------
  21. //
  22. // Class: CCiOpenedDoc
  23. //
  24. // Purpose: CiCFilterObject's notion of an open file, provider of
  25. // properties and IFilter interfaces
  26. //
  27. // History: 12-3-96 MarkZ Created
  28. //
  29. // Notes: This class is NOT multi-thread safe. The user must make sure
  30. // that only one thread is using it at a time.
  31. //
  32. //----------------------------------------------------------------------------
  33. class CCiCOpenedDoc : public ICiCOpenedDoc
  34. {
  35. public:
  36. //
  37. // Constructor and Destructor
  38. //
  39. CCiCOpenedDoc( CStorageFilterObject * pFilterObject = 0,
  40. CClientDaemonWorker * pWorker = 0,
  41. BOOL fTakeOpLock = TRUE,
  42. BOOL fFailIfNotContentIndexed = TRUE );
  43. //
  44. // IUnknown methods.
  45. //
  46. STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppiuk );
  47. STDMETHOD_(ULONG, AddRef) (THIS);
  48. STDMETHOD_(ULONG, Release) (THIS);
  49. //
  50. // ICiCOpenedDoc methods.
  51. //
  52. STDMETHOD(Open) ( BYTE const * pbDocName, ULONG cbDocName );
  53. STDMETHOD(Close) ( void );
  54. STDMETHOD(GetDocumentName) ( ICiCDocName ** ppIDocName );
  55. STDMETHOD(GetStatPropertyEnum) ( IPropertyStorage ** ppIStatPropEnum );
  56. STDMETHOD(GetPropertySetEnum) ( IPropertySetStorage ** ppIPropSetEnum );
  57. STDMETHOD(GetPropertyEnum) ( REFFMTID refGuidPropSet,
  58. IPropertyStorage **ppIPropEnum ) ;
  59. STDMETHOD(GetIFilter) ( IFilter ** ppIFilter );
  60. STDMETHOD(GetSecurity) ( BYTE * pbData, ULONG *pcbData );
  61. STDMETHOD(IsInUseByAnotherProcess) ( BOOL *pfInUse );
  62. //
  63. // Additional methods.
  64. //
  65. BOOL IsOpen( void )
  66. { return !_SafeOplock.IsNull( ); }
  67. protected:
  68. //
  69. // Hidden destructor so that only we can delete the instance
  70. // based on IUnknown control
  71. //
  72. virtual ~CCiCOpenedDoc();
  73. IPropertySetStorage * GetPropertySetStorage();
  74. private:
  75. inline BOOL _TooBigForDefault( LONGLONG const ll );
  76. LONGLONG _GetFileSize();
  77. inline BOOL IsSharingViolation() const
  78. {
  79. return _fSharingViolation;
  80. }
  81. //
  82. // IUnknown reference count.
  83. //
  84. LONG _RefCount;
  85. //
  86. // Name of the current file. This is an Ole interface that is
  87. // released.
  88. //
  89. XInterface<CCiCDocName> _FileName;
  90. //
  91. // Safe oplock
  92. //
  93. BOOL _fTakeOpLock;
  94. XPtr<CFilterOplock> _SafeOplock;
  95. BOOL _fFailIfNotContentIndexed;
  96. //
  97. // Knowledge of what type of storage is in document
  98. //
  99. enum FILESTATE {
  100. eUnknown, // Unknown; we haven't opened it yet
  101. eDocfile, // Docfile and we have the storage
  102. eOther, // Other
  103. };
  104. FILESTATE _TypeOfStorage;
  105. //
  106. // Root storage of the document if it is a Docfile. This is NULL otherwise.
  107. //
  108. XInterface<IPropertySetStorage> _Storage;
  109. LONGLONG _llFileSize; // Size of the file
  110. //
  111. // Has access to system resources like impersonation cache, registry,
  112. // perfmon, etc.
  113. //
  114. CClientDaemonWorker * _pWorker;
  115. CStorageFilterObject * _pFilterObject;
  116. //
  117. // Remote impersonation context (if impersonated).
  118. //
  119. CImpersonateRemoteAccess * _pRemoteImpersonation;
  120. //
  121. // Is set to TRUE, if the file that we tried to open
  122. // had a sharing violation.
  123. //
  124. BOOL _fSharingViolation;
  125. //
  126. // Name of current file as funnyPath
  127. //
  128. CFunnyPath _funnyFileName;
  129. // second copy of the path that isn't funny for shell open
  130. // It must stay around in non-funny form for a long time
  131. LONGLONG _llAlign;
  132. WCHAR _awcPath[MAX_PATH + 1];
  133. };