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.

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