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.

120 lines
3.6 KiB

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