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.

204 lines
4.9 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: fdtipc.cpp
  6. * Content: Declard the IPC calls for the full duplex test
  7. * History:
  8. * Date By Reason
  9. * ============
  10. * 08/26/99 pnewson created
  11. * 01/21/2000 pnewson modified full duplex start command struct
  12. * 04/18/2000 rodtoll Bug #32649 Voice wizard failing
  13. * Changed secondary format for tests from stereo --> mono
  14. * 04/19/2000 pnewson Error handling cleanup
  15. ***************************************************************************/
  16. #ifndef _FDTIPC_H_
  17. #define _FDTIPC_H_
  18. enum EFDTestCommandCode
  19. {
  20. fdtccExit = 1,
  21. fdtccPriorityStart,
  22. fdtccPriorityStop,
  23. fdtccFullDuplexStart,
  24. fdtccFullDuplexStop,
  25. fdtccEndOfEnum // keep this last thing in enum!
  26. };
  27. // Exit command struct
  28. // This command tells the child processes to exit
  29. struct SFDTestCommandExit
  30. {
  31. };
  32. // PriorityStart command struct
  33. // This command tells the child process to:
  34. // - create a DirectSound interface on the specified render device
  35. // - set it's cooperative level to priority mode
  36. // - create a primary buffer
  37. // - set the format of the primary buffer to the format specified in wfx
  38. // - creates a secondary buffer of the same format as the primary
  39. // = fills the secondary buffer with zeros
  40. // - starts playing the secondary buffer
  41. struct SFDTestCommandPriorityStart
  42. {
  43. GUID guidRenderDevice;
  44. WAVEFORMATEX wfxRenderFormat;
  45. WAVEFORMATEX wfxSecondaryFormat;
  46. HWND hwndWizard;
  47. HWND hwndProgress;
  48. };
  49. // PriorityStop command struct
  50. // This command tells the child process to:
  51. // - stop playing the secondary buffer
  52. // - destroy the secondardy buffer object
  53. // - destroy the primary buffer object
  54. // - destroy the DirectSound object
  55. struct SFDTestCommandPriorityStop
  56. {
  57. };
  58. // FullDuplexStart command struct
  59. // This command tells the child process to start
  60. // a fullduplex loopback test.
  61. struct SFDTestCommandFullDuplexStart
  62. {
  63. GUID guidRenderDevice;
  64. GUID guidCaptureDevice;
  65. DWORD dwFlags;
  66. };
  67. // FullDuplexStop command struct
  68. // This command tells the child process to
  69. // stop the full duplex loopback test.
  70. struct SFDTestCommandFullDuplexStop
  71. {
  72. };
  73. union UFDTestCommandUnion
  74. {
  75. SFDTestCommandExit fdtcExit;
  76. SFDTestCommandPriorityStart fdtcPriorityStart;
  77. SFDTestCommandPriorityStop fdtcPriorityStop;
  78. SFDTestCommandFullDuplexStart fdtcFullDuplexStart;
  79. SFDTestCommandFullDuplexStop fdtcFullDuplexStop;
  80. };
  81. struct SFDTestCommand
  82. {
  83. DWORD dwSize;
  84. EFDTestCommandCode fdtcc;
  85. UFDTestCommandUnion fdtu;
  86. };
  87. enum EFDTestTarget
  88. {
  89. fdttPriority = 1,
  90. fdttFullDuplex
  91. };
  92. // The class used by the Supervisor Process
  93. class CSupervisorIPC
  94. {
  95. private:
  96. //HANDLE m_hMutex;
  97. HANDLE m_hPriorityEvent;
  98. HANDLE m_hFullDuplexEvent;
  99. HANDLE m_hPriorityReplyEvent;
  100. HANDLE m_hFullDuplexReplyEvent;
  101. HANDLE m_hPriorityShMemHandle;
  102. LPVOID m_lpvPriorityShMemPtr;
  103. HANDLE m_hFullDuplexShMemHandle;
  104. LPVOID m_lpvFullDuplexShMemPtr;
  105. HANDLE m_hPriorityMutex;
  106. HANDLE m_hFullDuplexMutex;
  107. PROCESS_INFORMATION m_piPriority;
  108. PROCESS_INFORMATION m_piFullDuplex;
  109. DNCRITICAL_SECTION m_csLock;
  110. BOOL m_fInitComplete;
  111. HRESULT DoSend(
  112. const SFDTestCommand *pfdtc,
  113. HANDLE hProcess,
  114. HANDLE hEvent,
  115. HANDLE hReplyEvent,
  116. LPVOID lpvShMemPtr,
  117. HANDLE hMutex);
  118. // make this private to disallow copy construction
  119. // also not implemented, so linker error if used
  120. CSupervisorIPC(const CSupervisorIPC& rhs);
  121. public:
  122. CSupervisorIPC();
  123. HRESULT Init();
  124. HRESULT Deinit();
  125. HRESULT SendToPriority(const SFDTestCommand *pfdtc);
  126. HRESULT SendToFullDuplex(const SFDTestCommand *pfdtc);
  127. HRESULT StartPriorityProcess();
  128. HRESULT StartFullDuplexProcess();
  129. HRESULT WaitForStartupSignals();
  130. HRESULT WaitOnChildren();
  131. HRESULT TerminateChildProcesses();
  132. };
  133. // The class used by the Priority Process
  134. class CPriorityIPC
  135. {
  136. private:
  137. HANDLE m_hPriorityEvent;
  138. HANDLE m_hPriorityReplyEvent;
  139. HANDLE m_hPriorityShMemHandle;
  140. LPVOID m_lpvPriorityShMemPtr;
  141. HANDLE m_hPriorityMutex;
  142. DNCRITICAL_SECTION m_csLock;
  143. BOOL m_fInitComplete;
  144. // make this private to disallow copy construction
  145. // also not implemented, so linker error if used
  146. CPriorityIPC(const CPriorityIPC& rhs);
  147. public:
  148. CPriorityIPC();
  149. HRESULT Init();
  150. HRESULT Deinit();
  151. HRESULT SignalParentReady();
  152. HRESULT Receive(SFDTestCommand* pfdtc);
  153. HRESULT Reply(HRESULT hr);
  154. };
  155. // The class used by the Full Duplex Process
  156. class CFullDuplexIPC
  157. {
  158. private:
  159. HANDLE m_hFullDuplexEvent;
  160. HANDLE m_hFullDuplexReplyEvent;
  161. HANDLE m_hFullDuplexShMemHandle;
  162. LPVOID m_lpvFullDuplexShMemPtr;
  163. HANDLE m_hFullDuplexMutex;
  164. DNCRITICAL_SECTION m_csLock;
  165. BOOL m_fInitComplete;
  166. // make this private to disallow copy construction
  167. // also not implemented, so linker error if used
  168. CFullDuplexIPC(const CFullDuplexIPC& rhs);
  169. public:
  170. CFullDuplexIPC();
  171. HRESULT Init();
  172. HRESULT Deinit();
  173. HRESULT SignalParentReady();
  174. HRESULT Receive(SFDTestCommand* pfdtc);
  175. HRESULT Reply(HRESULT hr);
  176. };
  177. #endif