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.

178 lines
3.7 KiB

  1. /*++
  2. Copyright (c) 1998-1999 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. #include <nt.h>
  14. #include <ntrtl.h>
  15. #include <nturtl.h>
  16. #include <windows.h>
  17. #define HTTPAPI_LINKAGE
  18. #include <http.h>
  19. #include <httpapi.h>
  20. //
  21. // Private macros.
  22. //
  23. #define ALLOC_MEM(cb) RtlAllocateHeap( RtlProcessHeap(), 0, (cb) )
  24. #define FREE_MEM(ptr) RtlFreeHeap( RtlProcessHeap(), 0, (ptr) )
  25. #define ALIGN_DOWN(length, type) \
  26. ((ULONG)(length) & ~(sizeof(type) - 1))
  27. #define ALIGN_UP(length, type) \
  28. (ALIGN_DOWN(((ULONG)(length) + sizeof(type) - 1), type))
  29. #define OVERLAPPED_TO_IO_STATUS( pOverlapped ) \
  30. ((PIO_STATUS_BLOCK)&(pOverlapped)->Internal)
  31. #define DIMENSION( array ) \
  32. ( sizeof(array) / sizeof((array)[0]) )
  33. //
  34. // Private types.
  35. //
  36. typedef enum _HTTPAPI_HANDLE_TYPE
  37. {
  38. HttpApiControlChannelHandleType,
  39. HttpApiFilterChannelHandleType,
  40. HttpApiAppPoolHandleType,
  41. HttpApiMaxHandleType
  42. } HTTPAPI_HANDLE_TYPE;
  43. //
  44. // Private prototypes.
  45. //
  46. BOOL
  47. WINAPI
  48. DllMain(
  49. IN HMODULE DllHandle,
  50. IN DWORD Reason,
  51. IN LPVOID pContext OPTIONAL
  52. );
  53. #define HttpApiNtStatusToWin32Status( Status ) \
  54. ( ( (Status) == STATUS_SUCCESS ) \
  55. ? NO_ERROR \
  56. : RtlNtStatusToDosError( Status ) )
  57. NTSTATUS
  58. HttpApiOpenDriverHelper(
  59. OUT PHANDLE pHandle,
  60. IN ACCESS_MASK DesiredAccess,
  61. IN HTTPAPI_HANDLE_TYPE HandleType,
  62. IN PCWSTR pObjectName OPTIONAL,
  63. IN ULONG Options,
  64. IN ULONG CreateDisposition,
  65. IN PSECURITY_ATTRIBUTES pSecurityAttributes OPTIONAL
  66. );
  67. NTSTATUS
  68. HttpApiSynchronousDeviceControl(
  69. IN HANDLE FileHandle,
  70. IN ULONG IoControlCode,
  71. IN PVOID pInputBuffer OPTIONAL,
  72. IN ULONG InputBufferLength,
  73. OUT PVOID pOutputBuffer OPTIONAL,
  74. IN ULONG OutputBufferLength,
  75. OUT PULONG pBytesTransferred OPTIONAL
  76. );
  77. NTSTATUS
  78. HttpApiOverlappedDeviceControl(
  79. IN HANDLE FileHandle,
  80. IN OUT LPOVERLAPPED pOverlapped,
  81. IN ULONG IoControlCode,
  82. IN PVOID pInputBuffer OPTIONAL,
  83. IN ULONG InputBufferLength,
  84. OUT PVOID pOutputBuffer OPTIONAL,
  85. IN ULONG OutputBufferLength,
  86. OUT PULONG pBytesTransferred OPTIONAL
  87. );
  88. ULONG
  89. HttpApiInitializeEventCache(
  90. VOID
  91. );
  92. ULONG
  93. HttpApiTerminateEventCache(
  94. VOID
  95. );
  96. BOOLEAN
  97. HttpApiTryToStartDriver(
  98. VOID
  99. );
  100. __inline
  101. NTSTATUS
  102. HttpApiDeviceControl(
  103. IN HANDLE FileHandle,
  104. IN OUT LPOVERLAPPED pOverlapped,
  105. IN ULONG IoControlCode,
  106. IN PVOID pInputBuffer OPTIONAL,
  107. IN ULONG InputBufferLength,
  108. OUT PVOID pOutputBuffer OPTIONAL,
  109. IN ULONG OutputBufferLength,
  110. OUT PULONG pBytesTransferred OPTIONAL
  111. )
  112. {
  113. if (pOverlapped == NULL)
  114. {
  115. return HttpApiSynchronousDeviceControl(
  116. FileHandle,
  117. IoControlCode,
  118. pInputBuffer,
  119. InputBufferLength,
  120. pOutputBuffer,
  121. OutputBufferLength,
  122. pBytesTransferred
  123. );
  124. }
  125. else
  126. {
  127. return HttpApiOverlappedDeviceControl(
  128. FileHandle,
  129. pOverlapped,
  130. IoControlCode,
  131. pInputBuffer,
  132. InputBufferLength,
  133. pOutputBuffer,
  134. OutputBufferLength,
  135. pBytesTransferred
  136. );
  137. }
  138. }
  139. #endif // _PRECOMP_H_