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.

116 lines
2.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1998
  5. //
  6. // File: Scope.hxx
  7. //
  8. // Contents: Used to manage catalog(s) state
  9. //
  10. // History: 27-Nov-1996 KyleP Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #pragma once
  14. #include <ciares.h>
  15. class CScope : public PCIObjectType
  16. {
  17. public:
  18. CScope( CCatalog & cat,
  19. WCHAR const * pwcsPath,
  20. WCHAR const * pwcsAlias,
  21. BOOL fExclude,
  22. BOOL fVirtual,
  23. BOOL fShadowAlias );
  24. ~CScope();
  25. void Modify(WCHAR const * pwcsPath,
  26. WCHAR const * pwcsAlias,
  27. BOOL fExclude);
  28. static void InitHeader( CListViewHeader & Header );
  29. inline void GetDisplayInfo( RESULTDATAITEM * item );
  30. void SetResultHandle( HRESULTITEM id ) { _idResult = id; }
  31. BOOL IsAddedToResult() const { return (0 != _idResult); }
  32. WCHAR const * GetPath() const { return _pwcsPath; }
  33. WCHAR const * GetAlias() const { return _pwcsAlias; }
  34. WCHAR const * GetInclude() const { return _fExclude ? STRINGRESOURCE(srNo) : STRINGRESOURCE(srYes); }
  35. SCODE GetPassword(WCHAR *pwszPassword);
  36. SCODE GetUsername(WCHAR *pwszLogon);
  37. BOOL IsIncluded() { return !_fExclude; }
  38. BOOL IsVirtual() { return _fVirtual; }
  39. BOOL IsShadowAlias() { return _fShadowAlias; }
  40. HRESULTITEM ResultHandle() const { return _idResult; }
  41. //
  42. // Typing
  43. //
  44. PCIObjectType::OType Type() const { return PCIObjectType::Directory; }
  45. //
  46. // Misc.
  47. //
  48. void Rescan( BOOL fFull );
  49. CCatalog & GetCatalog() { return _cat; }
  50. void Zombify() { _fZombie = TRUE; }
  51. BOOL IsZombie() { return _fZombie; }
  52. private:
  53. void Set( WCHAR const * pwcsSrc, WCHAR * & pwcsDst );
  54. void Reset( WCHAR const * pwcsSrc, WCHAR * & pwcsDst );
  55. HRESULTITEM _idResult;
  56. WCHAR * _pwcsPath;
  57. WCHAR * _pwcsAlias;
  58. BOOL _fExclude;
  59. BOOL _fVirtual;
  60. BOOL _fShadowAlias;
  61. BOOL _fZombie;
  62. CCatalog & _cat;
  63. static BOOL _fFirstTime; // Used for one-shot resource init.
  64. };
  65. //
  66. // Scope columns
  67. //
  68. struct SScopeColumn
  69. {
  70. WCHAR const * (CScope::*pfGet)() const;
  71. StringResource srTitle;
  72. };
  73. extern SScopeColumn coldefScope[];
  74. inline void CScope::GetDisplayInfo( RESULTDATAITEM * item )
  75. {
  76. //Win4Assert( item->itemID == ResultHandle() );
  77. item->str = (WCHAR *)(this->*coldefScope[item->nCol].pfGet)();
  78. if ( _fVirtual )
  79. item->nImage = ICON_VIRTUAL_FOLDER;
  80. else if ( _fShadowAlias )
  81. item->nImage = ICON_SHADOW_ALIAS_FOLDER;
  82. else
  83. item->nImage = ICON_FOLDER;
  84. }