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.

200 lines
4.7 KiB

  1. /*++
  2. Copyright (c) 1998-2002 Microsoft Corporation
  3. Module Name:
  4. Precomp.h
  5. Abstract:
  6. Master include file for HTTPAPI.LIB user-mode interface to HTTP.SYS.
  7. Author:
  8. Keith Moore (keithmo) 15-Dec-1998
  9. Revision History:
  10. --*/
  11. #ifndef _PRECOMP_H_
  12. #define _PRECOMP_H_
  13. //
  14. // We are willing to ignore the following warnings, as we need the DDK to
  15. // compile.
  16. //
  17. #pragma warning(disable:4115) // named type definition in parentheses
  18. #pragma warning(disable:4201) // nameless struct/union
  19. #pragma warning(disable:4214) // bit field types other than int
  20. #pragma warning(disable:4306) // conversion from 'type1' to 'type2' of
  21. // greater size
  22. #include <nt.h>
  23. #include <ntrtl.h>
  24. #include <nturtl.h>
  25. #include <windows.h>
  26. #include <tdi.h>
  27. #include <rtutils.h>
  28. #define HTTPAPI_LINKAGE
  29. #include <http.h>
  30. #include <httpp.h>
  31. #include <httpioctl.h>
  32. #include "httpapip.h"
  33. #include <PoolTag.h>
  34. #define HTTPAPI 1
  35. #include <HttpCmn.h>
  36. //
  37. // Private macros.
  38. //
  39. #define ALLOC_MEM(cb) RtlAllocateHeap( RtlProcessHeap(), 0, (cb) )
  40. #define FREE_MEM(ptr) RtlFreeHeap( RtlProcessHeap(), 0, (ptr) )
  41. #define ALIGN_DOWN(length, type) \
  42. ((ULONG)(length) & ~(sizeof(type) - 1))
  43. #define ALIGN_UP(length, type) \
  44. (ALIGN_DOWN(((ULONG)(length) + sizeof(type) - 1), type))
  45. #define OVERLAPPED_TO_IO_STATUS( pOverlapped ) \
  46. ((PIO_STATUS_BLOCK)&(pOverlapped)->Internal)
  47. #define SET_STATUS_OVERLAPPED_TO_IO_STATUS( pOverlapped, ntstatus ) \
  48. do { \
  49. (((PIO_STATUS_BLOCK)&(pOverlapped)->Internal)->Status = (ntstatus)); \
  50. } while (0, 0)
  51. //
  52. // Private types.
  53. //
  54. typedef enum _HTTPAPI_HANDLE_TYPE
  55. {
  56. HttpApiControlChannelHandleType,
  57. HttpApiFilterChannelHandleType,
  58. HttpApiAppPoolHandleType,
  59. HttpApiServerHandleType,
  60. HttpApiMaxHandleType
  61. } HTTPAPI_HANDLE_TYPE;
  62. //
  63. // Private prototypes.
  64. //
  65. BOOL
  66. WINAPI
  67. DllMain(
  68. IN HMODULE DllHandle,
  69. IN DWORD Reason,
  70. IN LPVOID pContext OPTIONAL
  71. );
  72. #define HttpApiNtStatusToWin32Status( Status ) \
  73. ( ( (Status) == STATUS_SUCCESS ) \
  74. ? NO_ERROR \
  75. : RtlNtStatusToDosError( Status ) )
  76. NTSTATUS
  77. HttpApiOpenDriverHelper(
  78. OUT PHANDLE pHandle,
  79. IN PWCHAR Uri,
  80. IN USHORT UriLength,
  81. IN PWCHAR Proxy,
  82. IN USHORT ProxyLength,
  83. IN PTRANSPORT_ADDRESS pTransportAddress,
  84. IN USHORT TransportAddressLength,
  85. IN ACCESS_MASK DesiredAccess,
  86. IN HTTPAPI_HANDLE_TYPE HandleType,
  87. IN PCWSTR pObjectName OPTIONAL,
  88. IN ULONG Options,
  89. IN ULONG CreateDisposition,
  90. IN PSECURITY_ATTRIBUTES pSecurityAttributes OPTIONAL
  91. );
  92. ULONG
  93. HttpApiSynchronousDeviceControl(
  94. IN HANDLE FileHandle,
  95. IN ULONG IoControlCode,
  96. IN PVOID pInputBuffer OPTIONAL,
  97. IN ULONG InputBufferLength,
  98. OUT PVOID pOutputBuffer OPTIONAL,
  99. IN ULONG OutputBufferLength,
  100. OUT PULONG pBytesTransferred OPTIONAL
  101. );
  102. ULONG
  103. HttpApiOverlappedDeviceControl(
  104. IN HANDLE FileHandle,
  105. IN OUT LPOVERLAPPED pOverlapped,
  106. IN ULONG IoControlCode,
  107. IN PVOID pInputBuffer OPTIONAL,
  108. IN ULONG InputBufferLength,
  109. OUT PVOID pOutputBuffer OPTIONAL,
  110. IN ULONG OutputBufferLength,
  111. OUT PULONG pBytesTransferred OPTIONAL
  112. );
  113. BOOLEAN
  114. HttpApiTryToStartDriver(
  115. PWSTR pServiceName
  116. );
  117. __inline
  118. ULONG
  119. HttpApiDeviceControl(
  120. IN HANDLE FileHandle,
  121. IN OUT LPOVERLAPPED pOverlapped,
  122. IN ULONG IoControlCode,
  123. IN PVOID pInputBuffer OPTIONAL,
  124. IN ULONG InputBufferLength,
  125. OUT PVOID pOutputBuffer OPTIONAL,
  126. IN ULONG OutputBufferLength,
  127. OUT PULONG pBytesTransferred OPTIONAL
  128. )
  129. {
  130. if (pOverlapped == NULL)
  131. {
  132. return HttpApiSynchronousDeviceControl(
  133. FileHandle,
  134. IoControlCode,
  135. pInputBuffer,
  136. InputBufferLength,
  137. pOutputBuffer,
  138. OutputBufferLength,
  139. pBytesTransferred
  140. );
  141. }
  142. else
  143. {
  144. return HttpApiOverlappedDeviceControl(
  145. FileHandle,
  146. pOverlapped,
  147. IoControlCode,
  148. pInputBuffer,
  149. InputBufferLength,
  150. pOutputBuffer,
  151. OutputBufferLength,
  152. pBytesTransferred
  153. );
  154. }
  155. }
  156. #endif // _PRECOMP_H_