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.

178 lines
5.0 KiB

  1. // fpnw.h: FPNW shares, sessions and open resources
  2. #ifndef __FPNW_H_INCLUDED__
  3. #define __FPNW_H_INCLUDED__
  4. #include "FileSvc.h" // FileServiceProvider
  5. // forward declarations
  6. class CFpnwCookieBlock;
  7. class FpnwFileServiceProvider : public FileServiceProvider
  8. {
  9. public:
  10. FpnwFileServiceProvider( CFileMgmtComponentData* pFileMgmtData );
  11. virtual DWORD DeleteShare(LPCTSTR ptchServerName, LPCTSTR ptchShareName);
  12. virtual DWORD CloseSession(CFileMgmtResultCookie* pcookie);
  13. virtual DWORD CloseResource(CFileMgmtResultCookie* pcookie);
  14. virtual VOID DisplayShareProperties(
  15. LPPROPERTYSHEETCALLBACK pCallBack,
  16. LPDATAOBJECT pDataObject,
  17. LONG_PTR handle);
  18. virtual DWORD ReadShareProperties(
  19. LPCTSTR ptchServerName,
  20. LPCTSTR ptchShareName,
  21. OUT PVOID* ppvPropertyBlock,
  22. OUT CString& strDescription,
  23. OUT CString& strPath,
  24. OUT BOOL* pfEditDescription,
  25. OUT BOOL* pfEditPath,
  26. OUT DWORD* pdwShareType);
  27. virtual DWORD WriteShareProperties(LPCTSTR ptchServerName, LPCTSTR ptchShareName,
  28. PVOID pvPropertyBlock, LPCTSTR ptchDescription, LPCTSTR ptchPath);
  29. virtual VOID FreeShareProperties(PVOID pvPropertyBlock);
  30. virtual VOID FreeData(PVOID pv);
  31. virtual DWORD QueryMaxUsers(PVOID pvPropertyBlock);
  32. virtual VOID SetMaxUsers( PVOID pvPropertyBlock, DWORD dwMaxUsers);
  33. virtual HRESULT PopulateShares(
  34. IResultData* pResultData,
  35. CFileMgmtCookie* pcookie);
  36. // if pResultData is not NULL, add sessions/resources to the listbox
  37. // if pResultData is NULL, delete all sessions/resources
  38. // if pResultData is NULL, return SUCCEEDED(hr) to continue or
  39. // FAILED(hr) to abort
  40. virtual HRESULT EnumerateSessions(
  41. IResultData* pResultData,
  42. CFileMgmtCookie* pcookie,
  43. bool bAddToResultPane);
  44. virtual HRESULT EnumerateResources(
  45. IResultData* pResultData,
  46. CFileMgmtCookie* pcookie);
  47. virtual LPCTSTR QueryTransportString();
  48. HRESULT AddFPNWShareItems(
  49. IResultData* pResultData,
  50. CFileMgmtCookie* pParentCookie,
  51. PVOID pinfo,
  52. DWORD nItems);
  53. HRESULT HandleFPNWSessionItems(
  54. IResultData* pResultData,
  55. CFileMgmtCookie* pParentCookie,
  56. PVOID pinfo,
  57. DWORD nItems,
  58. BOOL bAddToResultPane);
  59. HRESULT HandleFPNWResourceItems(
  60. IResultData* pResultData,
  61. CFileMgmtCookie* pParentCookie,
  62. PVOID pinfo,
  63. DWORD nItems);
  64. private:
  65. CString m_strTransportFPNW;
  66. };
  67. class CFpnwCookie : public CFileMgmtResultCookie
  68. {
  69. public:
  70. CFpnwCookie( FileMgmtObjectType objecttype )
  71. : CFileMgmtResultCookie( objecttype )
  72. {}
  73. virtual HRESULT GetTransport( OUT FILEMGMT_TRANSPORT* pTransport );
  74. virtual void AddRefCookie();
  75. virtual void ReleaseCookie();
  76. // CHasMachineName
  77. CFpnwCookieBlock* m_pCookieBlock;
  78. DECLARE_FORWARDS_MACHINE_NAME(m_pCookieBlock)
  79. };
  80. class CFpnwCookieBlock : public CCookieBlock<CFpnwCookie>, public CStoresMachineName
  81. {
  82. public:
  83. inline CFpnwCookieBlock(
  84. CFpnwCookie* aCookies, // use vector ctor, we use vector dtor
  85. INT cCookies,
  86. LPCTSTR lpcszMachineName,
  87. PVOID pvCookieData)
  88. : CCookieBlock<CFpnwCookie>( aCookies, cCookies ),
  89. CStoresMachineName( lpcszMachineName ),
  90. m_pvCookieData( pvCookieData )
  91. {
  92. for (int i = 0; i < cCookies; i++)
  93. // {
  94. // aCookies[i].ReadMachineNameFrom( (CHasMachineName*)this );
  95. aCookies[i].m_pCookieBlock = this;
  96. // }
  97. }
  98. virtual ~CFpnwCookieBlock();
  99. private:
  100. PVOID m_pvCookieData;
  101. };
  102. class CFpnwShareCookie : public CFpnwCookie
  103. {
  104. public:
  105. CFpnwShareCookie() : CFpnwCookie( FILEMGMT_SHARE ) {}
  106. virtual HRESULT GetShareName( OUT CString& strShareName );
  107. inline virtual DWORD GetNumOfCurrentUses() { return GetShareInfo()->dwCurrentUses; }
  108. virtual BSTR GetColumnText(int nCol);
  109. virtual BSTR QueryResultColumnText( int nCol, CFileMgmtComponentData& refcdata );
  110. inline FPNWVOLUMEINFO* GetShareInfo()
  111. {
  112. ASSERT( NULL != m_pobject );
  113. return (FPNWVOLUMEINFO*)m_pobject;
  114. }
  115. virtual HRESULT GetSharePIDList( OUT LPITEMIDLIST *ppidl );
  116. };
  117. class CFpnwSessionCookie : public CFpnwCookie
  118. {
  119. public:
  120. CFpnwSessionCookie() : CFpnwCookie( FILEMGMT_SESSION ) {}
  121. virtual HRESULT GetSessionID( DWORD* pdwSessionID );
  122. inline virtual DWORD GetNumOfOpenFiles() { return GetSessionInfo()->dwOpens; }
  123. inline virtual DWORD GetConnectedTime() { return GetSessionInfo()->dwLogonTime; }
  124. inline virtual DWORD GetIdleTime() { return 0; }
  125. virtual BSTR GetColumnText(int nCol);
  126. virtual BSTR QueryResultColumnText( int nCol, CFileMgmtComponentData& refcdata );
  127. inline FPNWCONNECTIONINFO* GetSessionInfo()
  128. {
  129. ASSERT( NULL != m_pobject );
  130. return (FPNWCONNECTIONINFO*)m_pobject;
  131. }
  132. };
  133. class CFpnwResourceCookie : public CFpnwCookie
  134. {
  135. public:
  136. CFpnwResourceCookie() : CFpnwCookie( FILEMGMT_RESOURCE ) {}
  137. virtual HRESULT GetFileID( DWORD* pdwFileID );
  138. inline virtual DWORD GetNumOfLocks() { return GetFileInfo()->dwLocks; }
  139. virtual BSTR GetColumnText(int nCol);
  140. virtual BSTR QueryResultColumnText( int nCol, CFileMgmtComponentData& refcdata );
  141. inline FPNWFILEINFO* GetFileInfo()
  142. {
  143. ASSERT( NULL != m_pobject );
  144. return (FPNWFILEINFO*)m_pobject;
  145. }
  146. };
  147. #endif // ~__FPNW_H_INCLUDED__