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.

107 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. WS2IFSLP.H
  5. Abstract:
  6. This module defines private constants and data structures
  7. for Winsock2 IFS transport layer driver.
  8. Author:
  9. Vadim Eydelman (VadimE) Dec-1996
  10. Revision History:
  11. Vadim Eydelman (VadimE) Oct-1997, rewrite to properly handle IRP
  12. cancellation
  13. --*/
  14. // Pool tags
  15. #define PROCESS_FILE_CONTEXT_TAG 'P2sW'
  16. #define SOCKET_FILE_CONTEXT_TAG 'S2sW'
  17. #define CANCEL_CTX_TAG 'C2sW'
  18. // File EAName tags
  19. #define SOCKET_FILE_EANAME_TAG 'kcoS'
  20. #define PROCESS_FILE_EANAME_TAG 'corP'
  21. // Macro to get the code back from IOCTL
  22. #define WS2IFSL_IOCTL_FUNCTION(File,Ioctl) \
  23. (IoGetFunctionCodeFromCtlCode(Ioctl) \
  24. - WS2IFSL_IOCTL_##File##_BASE)
  25. typedef struct _IFSL_CANCEL_CTX {
  26. LIST_ENTRY ListEntry;
  27. PFILE_OBJECT SocketFile;
  28. ULONG UniqueId;
  29. } IFSL_CANCEL_CTX, *PIFSL_CANCEL_CTX;
  30. typedef struct _IFSL_QUEUE {
  31. LIST_ENTRY ListHead;
  32. BOOLEAN Busy;
  33. KSPIN_LOCK Lock;
  34. KAPC Apc;
  35. } IFSL_QUEUE, *PIFSL_QUEUE;
  36. // Context (FsContext field of the NT file object) associated with the
  37. // file opened by WS2IFSL DLL on per process basis.
  38. typedef struct _IFSL_PROCESS_CTX {
  39. ULONG EANameTag; // 'Proc' - first four bytes of
  40. // extended attribute name for this
  41. // type of file
  42. HANDLE UniqueId; // unique identifier of the process
  43. // (read from UniqueProcessID field of
  44. // the EPROCESS structure)
  45. IFSL_QUEUE RequestQueue;// queue of requests
  46. IFSL_QUEUE CancelQueue;// queue of cancel requests
  47. ULONG CancelId; // Used to generate IDs for
  48. // each cancel request in the process.
  49. // Combined with cancel request pointer
  50. // itself allows to match requests completed by
  51. // user mode DLL with pending ones
  52. #if DBG
  53. ULONG DbgLevel;
  54. #endif
  55. } IFSL_PROCESS_CTX, *PIFSL_PROCESS_CTX;
  56. // Context (FsContext field of the NT file object) associated with
  57. // file opened by WS2IFSL DLL for each socket.
  58. typedef struct _IFSL_SOCKET_CTX {
  59. ULONG EANameTag; // 'Sock' - first four bytes of
  60. // extended attribute name for this
  61. // type of file
  62. PVOID DllContext; // Context maintained for WS2IFSL DLL
  63. PFILE_OBJECT ProcessRef; // Pointer to process file object
  64. LONG IrpId; // Used to generate IDs for
  65. // each IRP on the socket. Combined
  66. // with IRP pointer itself allows
  67. // to match requests completed by
  68. // user mode DLL with pending IRPs
  69. LIST_ENTRY ProcessedIrps; // List of request being processed by
  70. // WS2IFSL DLL in APC thread
  71. KSPIN_LOCK SpinLock; // Protects requests in the list
  72. // above as well as process reference
  73. PIFSL_CANCEL_CTX CancelCtx; // Context to pass cancel request
  74. // to user mode DLL
  75. } IFSL_SOCKET_CTX, *PIFSL_SOCKET_CTX;
  76. #define GET_SOCKET_PROCESSID(ctx) \
  77. (((PIFSL_PROCESS_CTX)((ctx)->ProcessRef->FsContext))->UniqueId)
  78. //
  79. // Driver context field usage macros
  80. //
  81. #define IfslRequestId DriverContext[0] // Request's unique id
  82. #define IfslRequestQueue DriverContext[1] // Queue if inserted, NULL othw
  83. #define IfslRequestFlags DriverContext[2] // Request specific flags
  84. #define IfslAddressLenPtr DriverContext[3] // Address length pointer
  85. // Irp stack location fields usage macros
  86. #define IfslAddressBuffer Type3InputBuffer // Source address
  87. #define IfslAddressLength InputBufferLength // Source address length