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.

125 lines
2.4 KiB

  1. #ifndef _URLCONTEXT_HXX_
  2. #define _URLCONTEXT_HXX_
  3. class URL_CONTEXT
  4. {
  5. private:
  6. W3_METADATA * _pMetaData;
  7. W3_URL_INFO * _pUrlInfo;
  8. //
  9. // Physical path stored here in case of a SF_NOTIFY_URL_MAP filter
  10. //
  11. STRU _strPhysicalPath;
  12. static ALLOC_CACHE_HANDLER * sm_pachUrlContexts;
  13. public:
  14. URL_CONTEXT(
  15. W3_METADATA * pMetaData,
  16. W3_URL_INFO * pUrlInfo
  17. )
  18. {
  19. _pMetaData = pMetaData;
  20. _pUrlInfo = pUrlInfo;
  21. }
  22. ~URL_CONTEXT()
  23. {
  24. if( _pUrlInfo )
  25. {
  26. _pUrlInfo->DereferenceCacheEntry();
  27. _pUrlInfo = NULL;
  28. }
  29. }
  30. VOID *
  31. operator new(
  32. size_t size
  33. )
  34. {
  35. DBG_ASSERT( size == sizeof( URL_CONTEXT ) );
  36. DBG_ASSERT( sm_pachUrlContexts != NULL );
  37. return sm_pachUrlContexts->Alloc();
  38. }
  39. VOID
  40. operator delete(
  41. VOID * pUrlContext
  42. )
  43. {
  44. DBG_ASSERT( pUrlContext != NULL );
  45. DBG_ASSERT( sm_pachUrlContexts != NULL );
  46. DBG_REQUIRE( sm_pachUrlContexts->Free( pUrlContext ) );
  47. }
  48. W3_METADATA *
  49. QueryMetaData(
  50. VOID
  51. ) const
  52. {
  53. return _pMetaData;
  54. }
  55. W3_URL_INFO *
  56. QueryUrlInfo(
  57. VOID
  58. ) const
  59. {
  60. return _pUrlInfo;
  61. }
  62. STRU*
  63. QueryPhysicalPath(
  64. VOID
  65. )
  66. {
  67. if ( _strPhysicalPath.QueryCCH() )
  68. {
  69. // From SF_NOTIFY_URL_MAP filter
  70. return &_strPhysicalPath;
  71. }
  72. else
  73. {
  74. // If no filter
  75. DBG_ASSERT( _pUrlInfo != NULL );
  76. return _pUrlInfo->QueryPhysicalPath();
  77. }
  78. }
  79. HRESULT
  80. OpenFile(
  81. FILE_CACHE_USER * pOpeningUser,
  82. W3_FILE_INFO ** ppOpenFile
  83. );
  84. HRESULT
  85. SetPhysicalPath(
  86. STRU &strPath
  87. )
  88. {
  89. return _strPhysicalPath.Copy( strPath );
  90. }
  91. static
  92. HRESULT
  93. RetrieveUrlContext(
  94. W3_CONTEXT * pContext,
  95. W3_REQUEST * pRequest,
  96. OUT URL_CONTEXT ** ppUrlContext,
  97. BOOL * pfFinished
  98. );
  99. static
  100. HRESULT
  101. Initialize(
  102. VOID
  103. );
  104. static
  105. VOID
  106. Terminate(
  107. VOID
  108. );
  109. };
  110. #endif