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.

87 lines
3.3 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: APIRequest.h
  3. //
  4. // Copyright (c) 1999-2000, Microsoft Corporation
  5. //
  6. // A class that uses multiple inheritence to allow a CPortMessage to be
  7. // included in a queue as a CQueueElement.
  8. //
  9. // History: 1999-11-07 vtan created
  10. // 2000-08-25 vtan moved from Neptune to Whistler
  11. // 2002-03-24 scotthan propagate DispatchSync to API request instance.
  12. // --------------------------------------------------------------------------
  13. #ifndef _APIRequest_
  14. #define _APIRequest_
  15. #include "APIDispatcher.h"
  16. #include "PortMessage.h"
  17. #include "Queue.h"
  18. // --------------------------------------------------------------------------
  19. // CAPIRequest
  20. //
  21. // Purpose: This class combines CPortMessage and CQueueElement to allow
  22. // the PORT_MESSAGE struct in CPortMessage to be used in a queue.
  23. // This allows the server to queue requests to the thread that
  24. // is handling the client.
  25. //
  26. // History: 1999-11-07 vtan created
  27. // 2000-08-25 vtan moved from Neptune to Whistler
  28. // 2002-02-24 scotthan Propagate DispatchSync arg
  29. // --------------------------------------------------------------------------
  30. class CAPIRequest : public CQueueElement, public CPortMessage
  31. {
  32. private:
  33. CAPIRequest (void);
  34. public:
  35. CAPIRequest (CAPIDispatcher* pAPIDispatcher);
  36. CAPIRequest (CAPIDispatcher* pAPIDispatcher, const CPortMessage& portMessage);
  37. virtual ~CAPIRequest (void);
  38. virtual NTSTATUS Execute (CAPIDispatchSync* pAPIDispatchSync) = 0;
  39. protected:
  40. CAPIDispatcher* _pAPIDispatcher;
  41. };
  42. // --------------------------------------------------------------------------
  43. // _AllocAndMapClientString
  44. //
  45. // Arguments: hProcessClient = client process handle
  46. // pszIn = client's address of string
  47. // cchIn = client's count of characters, including NULL.
  48. // cchMax = maximum allowed characters
  49. // ppszMapped = outbound mapped string. Should be freed with _FreeClientString()
  50. //
  51. // Returns: NTSTATUS
  52. //
  53. // Purpose: Ensures that the length of the string is what the client said it was.
  54. //
  55. // History: 2002-02-26 scotthan created
  56. // --------------------------------------------------------------------------
  57. NTSTATUS _AllocAndMapClientString(
  58. IN HANDLE hProcessClient,
  59. IN LPCWSTR pszIn,
  60. IN UINT cchIn,
  61. IN UINT cchMax,
  62. OUT LPWSTR* ppszMapped );
  63. // --------------------------------------------------------------------------
  64. // _FreeMappedClientString
  65. //
  66. // Arguments: pszMapped = String successfully mapped from the client memory space
  67. // using _AllocAndMapClientString().
  68. //
  69. // Returns: NTSTATUS
  70. //
  71. // Purpose: Releases memory for mapped client string.
  72. //
  73. // History: 2002-02-26 scotthan created
  74. // --------------------------------------------------------------------------
  75. void _FreeMappedClientString(IN LPWSTR pszMapped);
  76. #endif /* _APIRequest_ */