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.

124 lines
3.6 KiB

  1. // --------------------------------------------------------------------------
  2. // Module Name: BadApplicationDispatcher.cpp
  3. //
  4. // Copyright (c) 2000, Microsoft Corporation
  5. //
  6. // This file contains a class to implement bad application manager API
  7. // request dispatch handling.
  8. //
  9. // History: 2000-08-25 vtan created
  10. // 2000-12-04 vtan moved to separate file
  11. // --------------------------------------------------------------------------
  12. #ifdef _X86_
  13. #include "StandardHeader.h"
  14. #include "BadApplicationDispatcher.h"
  15. #include "BadApplicationAPIRequest.h"
  16. // --------------------------------------------------------------------------
  17. // CBadApplicationDispatcher::CBadApplicationDispatcher
  18. //
  19. // Arguments: hClientProcess = HANDLE to the client process.
  20. //
  21. // Returns: <none>
  22. //
  23. // Purpose: Constructor for the CBadApplicationDispatcher class. This
  24. // stores the client handle. It does not duplicate it.
  25. //
  26. // History: 2000-08-25 vtan created
  27. // --------------------------------------------------------------------------
  28. CBadApplicationDispatcher::CBadApplicationDispatcher (HANDLE hClientProcess) :
  29. CAPIDispatcher(hClientProcess)
  30. {
  31. }
  32. // --------------------------------------------------------------------------
  33. // CBadApplicationDispatcher::~CBadApplicationDispatcher
  34. //
  35. // Arguments: <none>
  36. //
  37. // Returns: <none>
  38. //
  39. // Purpose: Destructor for the CBadApplicationDispatcher class.
  40. //
  41. // History: 2000-08-25 vtan created
  42. // --------------------------------------------------------------------------
  43. CBadApplicationDispatcher::~CBadApplicationDispatcher (void)
  44. {
  45. }
  46. // --------------------------------------------------------------------------
  47. // CBadApplicationDispatcher::CreateAndQueueRequest
  48. //
  49. // Arguments: portMessage = PORT_MESSAGE request to queue to handler.
  50. //
  51. // Returns: NTSTATUS
  52. //
  53. // Purpose: Queues the client request to the dispatcher. Tells the
  54. // handler thread that there is input waiting. This function
  55. // knows what kind of CAPIRequest to create so that
  56. // CAPIRequest::Execute will work correctly.
  57. //
  58. // History: 2000-08-25 vtan created
  59. // --------------------------------------------------------------------------
  60. NTSTATUS CBadApplicationDispatcher::CreateAndQueueRequest(const CPortMessage& portMessage)
  61. {
  62. NTSTATUS status;
  63. CQueueElement *pQueueElement;
  64. pQueueElement = new CBadApplicationAPIRequest(this, portMessage);
  65. if (pQueueElement != NULL)
  66. {
  67. _queue.Add(pQueueElement);
  68. status = SignalRequestPending();
  69. }
  70. else
  71. {
  72. status = STATUS_NO_MEMORY;
  73. }
  74. return(status);
  75. }
  76. // --------------------------------------------------------------------------
  77. // CBadApplicationDispatcher::CreateAndExecuteRequest
  78. //
  79. // Arguments: <none>
  80. //
  81. // Returns: NTSTATUS
  82. //
  83. // Purpose: Executes the given request immediately and returns the result
  84. // back to the caller. The API request is done on the server
  85. // listen thread.
  86. //
  87. // History: 2000-10-19 vtan created
  88. // --------------------------------------------------------------------------
  89. NTSTATUS CBadApplicationDispatcher::CreateAndExecuteRequest (const CPortMessage& portMessage)
  90. {
  91. NTSTATUS status;
  92. CAPIRequest *pAPIRequest;
  93. pAPIRequest = new CBadApplicationAPIRequest(this, portMessage);
  94. if (pAPIRequest != NULL)
  95. {
  96. status = Execute(pAPIRequest);
  97. delete pAPIRequest;
  98. }
  99. else
  100. {
  101. status = STATUS_NO_MEMORY;
  102. }
  103. return(status);
  104. }
  105. #endif /* _X86_ */