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.

139 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name :
  4. dav_handler.cxx
  5. Abstract:
  6. Handle DAV requests
  7. Author:
  8. Taylor Weiss (TaylorW) 27-Jan-2000
  9. Environment:
  10. Win32 - User Mode
  11. Project:
  12. ULW3.DLL
  13. --*/
  14. #include "precomp.hxx"
  15. #include "dav_handler.h"
  16. WCHAR g_szDavImage[MAX_PATH+1] = DAV_MODULE_NAME;
  17. // static
  18. HRESULT
  19. W3_DAV_HANDLER::Initialize(
  20. VOID
  21. )
  22. {
  23. WCHAR szTemp[MAX_PATH+1];
  24. WCHAR * szPtr = NULL;
  25. DBG_ASSERT( W3_ISAPI_HANDLER::QueryIsInitialized() );
  26. //
  27. // Get a full path to the DAV extension
  28. //
  29. if ( GetModuleFileName( GetModuleHandle( NULL ), szTemp, MAX_PATH ) )
  30. {
  31. szTemp[MAX_PATH] = L'\0';
  32. szPtr = wcsrchr( szTemp, L'\\' );
  33. if ( szPtr )
  34. {
  35. wcsncpy( szPtr+1, DAV_MODULE_NAME, MAX_PATH-(szPtr-szTemp+1) );
  36. szTemp[MAX_PATH] = L'\0';
  37. }
  38. }
  39. if ( szPtr )
  40. {
  41. wcsncpy( g_szDavImage, szTemp, MAX_PATH );
  42. g_szDavImage[MAX_PATH] = '\0';
  43. }
  44. return NO_ERROR;
  45. }
  46. CONTEXT_STATUS
  47. W3_DAV_HANDLER::DoWork(
  48. VOID
  49. )
  50. {
  51. W3_CONTEXT *pW3Context = QueryW3Context();
  52. DBG_ASSERT( pW3Context != NULL );
  53. HRESULT hr = NO_ERROR;
  54. DBG_ASSERT( W3_ISAPI_HANDLER::QueryIsInitialized() );
  55. //
  56. // Set the DAV ISAPI for this request
  57. //
  58. hr = W3_ISAPI_HANDLER::SetDavRequest( g_szDavImage );
  59. if ( FAILED( hr ) )
  60. {
  61. goto Failed;
  62. }
  63. return W3_ISAPI_HANDLER::DoWork();
  64. Failed:
  65. //
  66. // BUGBUG - This code won't return an entity body
  67. // to the client...but if we can't allocate a
  68. // W3_ISAPI_HANDLER, we probably can't allocate
  69. // an entity body either.
  70. //
  71. // Actually, the whole thing is probably destined
  72. // to fail if we're really that low on memory, and
  73. // we could probably just fire off a debugger
  74. // message and return STATUS_CONTINUE...
  75. //
  76. W3_RESPONSE * pResponse = pW3Context->QueryResponse();
  77. DBG_ASSERT( pResponse );
  78. pResponse->Clear();
  79. pW3Context->SetErrorStatus( hr );
  80. pResponse->SetStatus( HttpStatusServerError );
  81. pW3Context->SendResponse( W3_FLAG_SYNC );
  82. return CONTEXT_STATUS_CONTINUE;
  83. }
  84. CONTEXT_STATUS
  85. W3_DAV_HANDLER::OnCompletion(
  86. DWORD cbCompletion,
  87. DWORD dwCompletionStatus
  88. )
  89. {
  90. DBG_ASSERT( W3_ISAPI_HANDLER::QueryIsInitialized() );
  91. //
  92. // Hand off the completion to the ISAPI handler
  93. //
  94. return W3_ISAPI_HANDLER::OnCompletion(
  95. cbCompletion,
  96. dwCompletionStatus
  97. );
  98. }
  99. LPCWSTR
  100. W3_DAV_HANDLER::QueryDavImage(
  101. VOID
  102. )
  103. {
  104. return g_szDavImage;
  105. }