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.

210 lines
5.3 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. * 03/01/2002 simonpow Bug #550054. Fixed CreateProcess calls to specifiy
  16. * both app name and command line
  17. ***************************************************************************/
  18. #ifndef _FDTIPC_H_
  19. #define _FDTIPC_H_
  20. enum EFDTestCommandCode
  21. {
  22. fdtccExit = 1,
  23. fdtccPriorityStart,
  24. fdtccPriorityStop,
  25. fdtccFullDuplexStart,
  26. fdtccFullDuplexStop,
  27. fdtccEndOfEnum // keep this last thing in enum!
  28. };
  29. // Exit command struct
  30. // This command tells the child processes to exit
  31. struct SFDTestCommandExit
  32. {
  33. };
  34. // PriorityStart command struct
  35. // This command tells the child process to:
  36. // - create a DirectSound interface on the specified render device
  37. // - set it's cooperative level to priority mode
  38. // - create a primary buffer
  39. // - set the format of the primary buffer to the format specified in wfx
  40. // - creates a secondary buffer of the same format as the primary
  41. // = fills the secondary buffer with zeros
  42. // - starts playing the secondary buffer
  43. struct SFDTestCommandPriorityStart
  44. {
  45. GUID guidRenderDevice;
  46. WAVEFORMATEX wfxRenderFormat;
  47. WAVEFORMATEX wfxSecondaryFormat;
  48. HWND hwndWizard;
  49. HWND hwndProgress;
  50. };
  51. // PriorityStop command struct
  52. // This command tells the child process to:
  53. // - stop playing the secondary buffer
  54. // - destroy the secondardy buffer object
  55. // - destroy the primary buffer object
  56. // - destroy the DirectSound object
  57. struct SFDTestCommandPriorityStop
  58. {
  59. };
  60. // FullDuplexStart command struct
  61. // This command tells the child process to start
  62. // a fullduplex loopback test.
  63. struct SFDTestCommandFullDuplexStart
  64. {
  65. GUID guidRenderDevice;
  66. GUID guidCaptureDevice;
  67. DWORD dwFlags;
  68. };
  69. // FullDuplexStop command struct
  70. // This command tells the child process to
  71. // stop the full duplex loopback test.
  72. struct SFDTestCommandFullDuplexStop
  73. {
  74. };
  75. union UFDTestCommandUnion
  76. {
  77. SFDTestCommandExit fdtcExit;
  78. SFDTestCommandPriorityStart fdtcPriorityStart;
  79. SFDTestCommandPriorityStop fdtcPriorityStop;
  80. SFDTestCommandFullDuplexStart fdtcFullDuplexStart;
  81. SFDTestCommandFullDuplexStop fdtcFullDuplexStop;
  82. };
  83. struct SFDTestCommand
  84. {
  85. DWORD dwSize;
  86. EFDTestCommandCode fdtcc;
  87. UFDTestCommandUnion fdtu;
  88. };
  89. enum EFDTestTarget
  90. {
  91. fdttPriority = 1,
  92. fdttFullDuplex
  93. };
  94. // The class used by the Supervisor Process
  95. class CSupervisorIPC
  96. {
  97. private:
  98. //HANDLE m_hMutex;
  99. HANDLE m_hPriorityEvent;
  100. HANDLE m_hFullDuplexEvent;
  101. HANDLE m_hPriorityReplyEvent;
  102. HANDLE m_hFullDuplexReplyEvent;
  103. HANDLE m_hPriorityShMemHandle;
  104. LPVOID m_lpvPriorityShMemPtr;
  105. HANDLE m_hFullDuplexShMemHandle;
  106. LPVOID m_lpvFullDuplexShMemPtr;
  107. HANDLE m_hPriorityMutex;
  108. HANDLE m_hFullDuplexMutex;
  109. PROCESS_INFORMATION m_piPriority;
  110. PROCESS_INFORMATION m_piFullDuplex;
  111. DNCRITICAL_SECTION m_csLock;
  112. BOOL m_fInitComplete;
  113. static HRESULT DoSend(
  114. const SFDTestCommand *pfdtc,
  115. HANDLE hProcess,
  116. HANDLE hEvent,
  117. HANDLE hReplyEvent,
  118. LPVOID lpvShMemPtr,
  119. HANDLE hMutex);
  120. // make this private to disallow copy construction
  121. // also not implemented, so linker error if used
  122. CSupervisorIPC(const CSupervisorIPC& rhs);
  123. //utility function. Builds full path to exe we need
  124. //to launch
  125. static void BuildLaunchAppName(TCHAR * szAppName);
  126. public:
  127. CSupervisorIPC();
  128. HRESULT Init();
  129. HRESULT Deinit();
  130. HRESULT SendToPriority(const SFDTestCommand *pfdtc);
  131. HRESULT SendToFullDuplex(const SFDTestCommand *pfdtc);
  132. HRESULT StartPriorityProcess();
  133. HRESULT StartFullDuplexProcess();
  134. HRESULT WaitForStartupSignals();
  135. HRESULT WaitOnChildren();
  136. HRESULT TerminateChildProcesses();
  137. };
  138. // The class used by the Priority Process
  139. class CPriorityIPC
  140. {
  141. private:
  142. HANDLE m_hPriorityEvent;
  143. HANDLE m_hPriorityReplyEvent;
  144. HANDLE m_hPriorityShMemHandle;
  145. LPVOID m_lpvPriorityShMemPtr;
  146. HANDLE m_hPriorityMutex;
  147. DNCRITICAL_SECTION m_csLock;
  148. BOOL m_fInitComplete;
  149. // make this private to disallow copy construction
  150. // also not implemented, so linker error if used
  151. CPriorityIPC(const CPriorityIPC& rhs);
  152. public:
  153. CPriorityIPC();
  154. HRESULT Init();
  155. HRESULT Deinit();
  156. HRESULT SignalParentReady();
  157. HRESULT Receive(SFDTestCommand* pfdtc);
  158. HRESULT Reply(HRESULT hr);
  159. };
  160. // The class used by the Full Duplex Process
  161. class CFullDuplexIPC
  162. {
  163. private:
  164. HANDLE m_hFullDuplexEvent;
  165. HANDLE m_hFullDuplexReplyEvent;
  166. HANDLE m_hFullDuplexShMemHandle;
  167. LPVOID m_lpvFullDuplexShMemPtr;
  168. HANDLE m_hFullDuplexMutex;
  169. DNCRITICAL_SECTION m_csLock;
  170. BOOL m_fInitComplete;
  171. // make this private to disallow copy construction
  172. // also not implemented, so linker error if used
  173. CFullDuplexIPC(const CFullDuplexIPC& rhs);
  174. public:
  175. CFullDuplexIPC();
  176. HRESULT Init();
  177. HRESULT Deinit();
  178. HRESULT SignalParentReady();
  179. HRESULT Receive(SFDTestCommand* pfdtc);
  180. HRESULT Reply(HRESULT hr);
  181. };
  182. #endif