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.

156 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1995-1997 Microsoft Corporation
  3. Module Name :
  4. WamW3.hxx
  5. Abstract:
  6. Structures which must be shared between wam and w3svc
  7. Author:
  8. David Kaplan ( DaveK ) 21-Mar-1997
  9. Environment:
  10. User Mode - Win32
  11. Projects:
  12. W3svc DLL, Wam DLL
  13. Revision History:
  14. --*/
  15. # ifndef _WAMW3_HXX_
  16. # define _WAMW3_HXX_
  17. /************************************************************
  18. * Include Headers
  19. ************************************************************/
  20. # include "iisextp.h"
  21. //
  22. // These are private request types HTTP Extensions can call for retrieving
  23. // special data values, such as the server's tsvcinfo cache object and
  24. // this particular request's pointer.
  25. //
  26. #define HSE_PRIV_REQ_TSVCINFO 0x0000f001
  27. #define HSE_PRIV_REQ_HTTP_REQUEST (HSE_PRIV_REQ_TSVCINFO+1)
  28. #define HSE_PRIV_REQ_VROOT_TABLE (HSE_PRIV_REQ_TSVCINFO+2)
  29. #define HSE_PRIV_REQ_TSVC_CACHE (HSE_PRIV_REQ_TSVCINFO+3)
  30. //
  31. // Flags in the _dwFlags field of the WAM_EXEC_INFO extension context
  32. //
  33. # define SE_PRIV_FLAG_IN_CALLBACK 0x00000002
  34. # define KEEPCONN_FALSE 0
  35. # define KEEPCONN_TRUE 1
  36. # define KEEPCONN_OLD_ISAPI 2
  37. # define KEEPCONN_DONT_CHANGE 3
  38. //
  39. // These macros propogate a Win32 error cross-process as an HRESULT,
  40. // then set the original Win32 error in the receiving process.
  41. //
  42. #if 0
  43. #define HRESULT_FROM_BOOL(f) (f == TRUE ) \
  44. ? NOERROR \
  45. : HRESULT_FROM_WIN32( GetLastError() )
  46. #else
  47. inline HRESULT
  48. HresultFromBool(
  49. IN BOOL fBool
  50. )
  51. {
  52. if ( fBool ) {
  53. return(NO_ERROR);
  54. } else {
  55. DWORD err = GetLastError();
  56. if ( err != ERROR_SUCCESS ) {
  57. return HRESULT_FROM_WIN32(err);
  58. } else {
  59. DBGPRINTF((DBG_CONTEXT,
  60. "GetLastError returns SUCCESS on failure\n"));
  61. return(E_FAIL);
  62. }
  63. }
  64. }
  65. #endif
  66. //
  67. // NOTE since WIN32 errors are assumed to fall in the range -32k to 32k
  68. // (see comment in winerror.h near HRESULT_FROM_WIN32 definition), we can
  69. // re-create original Win32 error from low-order 16 bits of HRESULT.
  70. //
  71. #define WIN32_FROM_HRESULT(x) \
  72. ( (HRESULT_FACILITY(x) == FACILITY_WIN32) ? ((DWORD)((x) & 0x0000FFFF)) : (x) )
  73. inline BOOL
  74. BoolFromHresult(HRESULT hr)
  75. {
  76. if( hr == NOERROR )
  77. { return TRUE; }
  78. else
  79. { SetLastError( WIN32_FROM_HRESULT(hr) ); return FALSE; }
  80. }
  81. //
  82. // Generates an HRESULT from GetLastError, or E_FAIL if no last error.
  83. //
  84. inline HRESULT
  85. HresultFromGetLastError( )
  86. {
  87. DWORD dwErr = GetLastError();
  88. return ( dwErr != ERROR_SUCCESS )
  89. ? HRESULT_FROM_WIN32( dwErr )
  90. : E_FAIL;
  91. }
  92. /* struct ASYNC_IO_INFO
  93. Info for processing an ISA's async i/o operation.
  94. */
  95. struct ASYNC_IO_INFO
  96. {
  97. // do we have outstanding async i/o pending?
  98. // Also save the type of the request, read 0x1 write 0x2.
  99. DWORD _dwOutstandingIO;
  100. //
  101. // This contains the buffer size of the last async WriteClient()
  102. // - we return this value on successful completions
  103. // so filter buffer modifications don't confuse the application
  104. //
  105. DWORD _cbLastAsyncIO;
  106. // following members are used by the Async IO operations.
  107. PFN_HSE_IO_COMPLETION _pfnHseIO;
  108. PVOID _pvHseIOContext;
  109. // for out of process we keep a copy of the client's buffer
  110. PVOID _pvAsyncReadBuffer;
  111. };
  112. #define ASYNC_IO_TYPE_NONE 0x0
  113. #define ASYNC_IO_TYPE_WRITE 0x1
  114. #define ASYNC_IO_TYPE_READ 0x2
  115. # endif // _WAMW3_HXX_
  116. /************************ End of File ***********************/