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.

322 lines
12 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1995-2001 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dsvxdi.h
  6. * Content: dsound.vxd private include file
  7. *
  8. **************************************************************************/
  9. #ifndef __DSVXDI_INCLUDED__
  10. #define __DSVXDI_INCLUDED__
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. extern VMMLIST gvmmlistDrivers;
  15. //
  16. //
  17. //
  18. typedef const GUID* LPCGUID;
  19. typedef HRESULT DSVAL;
  20. #ifdef __cplusplus
  21. //
  22. //
  23. //
  24. class CBuf_IDsDriverPropertySet : public IDsDriverPropertySet
  25. {
  26. private:
  27. int m_cRef;
  28. class CBuf *m_pBuf;
  29. public:
  30. // constructor
  31. CBuf_IDsDriverPropertySet(class CBuf* pBuf);
  32. // IUnknown members
  33. STDMETHODIMP QueryInterface(REFIID, PVOID*);
  34. STDMETHODIMP_(ULONG) AddRef(void);
  35. STDMETHODIMP_(ULONG) Release(void);
  36. // IDsDriverPropertySet members
  37. STDMETHODIMP Get(PDSPROPERTY pDsProperty,
  38. PVOID pPropertyParams, ULONG cbPropertyParams,
  39. PVOID pPropertyData, ULONG cbPropertyData,
  40. PULONG pcbReturnedData);
  41. STDMETHODIMP Set(PDSPROPERTY pDsProperty,
  42. PVOID pPropertyParams, ULONG cbPropertyParams,
  43. PVOID pPropertyData, ULONG cbPropertyData);
  44. STDMETHODIMP QuerySupport(REFGUID PropertySetId, ULONG PropertyId,
  45. PULONG pSupport);
  46. };
  47. //
  48. //
  49. //
  50. class CBuf : public IDsDriverBuffer
  51. {
  52. private:
  53. int m_cRef;
  54. class CDrv *m_pDrv;
  55. BOOL m_fDeregistered;
  56. IDsDriverBuffer *m_pIDsDriverBuffer_Real;
  57. IDsDriverPropertySet *m_pIDsDriverPropertySet_Real;
  58. // contained interface implementations
  59. CBuf_IDsDriverPropertySet m_IDsDriverPropertySet;
  60. friend CBuf_IDsDriverPropertySet;
  61. public:
  62. // new/delete operators
  63. void* operator new(size_t size, VMMLIST list);
  64. void operator delete(void * pv, size_t size);
  65. // constructor
  66. CBuf(void);
  67. // class methods
  68. static VMMLIST CreateList(void);
  69. static void DestroyList(VMMLIST list);
  70. static HRESULT CreateBuf(CDrv *pDrv, VMMLIST list, IDsDriverBuffer *pIDsDriverBuffer_Real, IDsDriverBuffer **ppIDsDriverBuffer);
  71. static void DeregisterBuffers(VMMLIST list);
  72. // IUnknown members
  73. STDMETHODIMP QueryInterface(REFIID, PVOID*);
  74. STDMETHODIMP_(ULONG) AddRef(void);
  75. STDMETHODIMP_(ULONG) Release(void);
  76. // IDsDriverBuffer members
  77. STDMETHODIMP Lock(LPVOID *, LPDWORD, LPVOID *, LPDWORD, DWORD, DWORD, DWORD);
  78. STDMETHODIMP Unlock(LPVOID, DWORD, LPVOID, DWORD);
  79. STDMETHODIMP SetFormat(LPWAVEFORMATEX);
  80. STDMETHODIMP SetFrequency(DWORD);
  81. STDMETHODIMP SetVolumePan(PDSVOLUMEPAN);
  82. STDMETHODIMP SetPosition(DWORD);
  83. STDMETHODIMP GetPosition(LPDWORD, LPDWORD);
  84. STDMETHODIMP Play(DWORD, DWORD, DWORD);
  85. STDMETHODIMP Stop(void);
  86. // Other members
  87. STDMETHODIMP_(BOOL) IsDeregistered(void);
  88. STDMETHODIMP_(IDsDriverBuffer*) GetRealDsDriverBuffer(void);
  89. };
  90. //
  91. //
  92. //
  93. class CDrv : public IDsDriver
  94. {
  95. private:
  96. int m_cRef;
  97. int m_cOpen;
  98. BOOL m_fDeregistered;
  99. IDsDriver *m_pIDsDriver_Real;
  100. GUID m_guidDriver;
  101. VMMLIST m_listBuffers;
  102. static CDrv* FindFromIDsDriver(IDsDriver *pIDsDriver);
  103. static CDrv* FindFromGuid(REFGUID riid);
  104. public:
  105. // Class methods
  106. static HRESULT CreateAndRegisterDriver(IDsDriver *pIDsDriver);
  107. static HRESULT DeregisterDriver(IDsDriver *pIDsDriver);
  108. static HRESULT GetDescFromGuid(REFGUID rguidDriver, PDSDRIVERDESC pDrvDesc);
  109. static HRESULT GetNextDescFromGuid(LPCGUID pguidLast, LPGUID pGuid, PDSDRIVERDESC pDrvDesc);
  110. static HRESULT OpenFromGuid(REFGUID rguidDriver, IDsDriver **ppIDsDriver);
  111. // new/delete operators
  112. void* operator new(size_t size);
  113. void operator delete(void * pv);
  114. // IUnknown members
  115. STDMETHODIMP QueryInterface(REFIID, PVOID*);
  116. STDMETHODIMP_(ULONG) AddRef(void);
  117. STDMETHODIMP_(ULONG) Release(void);
  118. // IDsDriver members
  119. STDMETHODIMP GetDriverDesc(PDSDRIVERDESC);
  120. STDMETHODIMP Open(void);
  121. STDMETHODIMP Close(void);
  122. STDMETHODIMP GetCaps(PDSDRIVERCAPS);
  123. STDMETHODIMP CreateSoundBuffer(LPWAVEFORMATEX, DWORD, DWORD, LPDWORD, LPBYTE *, LPVOID *);
  124. STDMETHODIMP DuplicateSoundBuffer(PIDSDRIVERBUFFER, LPVOID *);
  125. };
  126. #endif
  127. //
  128. //
  129. //
  130. int ctrlDrvInit();
  131. int ctrlDrvExit();
  132. int eventScheduleWin32Event(DWORD vxdh, DWORD dwDelay);
  133. int ioctlDsvxd_GetMixerMutexPtr(PDIOCPARAMETERS pdiocp);
  134. int ioctlMixer_Run(PDIOCPARAMETERS pdiocp);
  135. int ioctlMixer_Stop(PDIOCPARAMETERS pdiocp);
  136. int ioctlMixer_PlayWhenIdle(PDIOCPARAMETERS pdiocp);
  137. int ioctlMixer_StopWhenIdle(PDIOCPARAMETERS pdiocp);
  138. int ioctlMixer_MixListAdd(PDIOCPARAMETERS pdiocp);
  139. int ioctlMixer_MixListRemove(PDIOCPARAMETERS pdiocp);
  140. int ioctlMixer_FilterOn(PDIOCPARAMETERS pdiocp);
  141. int ioctlMixer_FilterOff(PDIOCPARAMETERS pdiocp);
  142. int ioctlMixer_GetBytePosition(PDIOCPARAMETERS pdiocp);
  143. int ioctlMixer_SignalRemix(PDIOCPARAMETERS pdiocp);
  144. int ioctlKeDest_New(PDIOCPARAMETERS pdiocp);
  145. int ioctlMixDest_Delete(PDIOCPARAMETERS pdiocp);
  146. int ioctlMixDest_Initialize(PDIOCPARAMETERS pdiocp);
  147. int ioctlMixDest_Terminate(PDIOCPARAMETERS pdiocp);
  148. int ioctlMixDest_SetFormat(PDIOCPARAMETERS pdiocp);
  149. int ioctlMixDest_SetFormatInfo(PDIOCPARAMETERS pdiocp);
  150. int ioctlMixDest_AllocMixer(PDIOCPARAMETERS pdiocp);
  151. int ioctlMixDest_FreeMixer(PDIOCPARAMETERS pdiocp);
  152. int ioctlMixDest_Play(PDIOCPARAMETERS pdiocp);
  153. int ioctlMixDest_Stop(PDIOCPARAMETERS pdiocp);
  154. int ioctlMixDest_GetFrequency(PDIOCPARAMETERS pdiocp);
  155. int ioctlMixDest_Lock(PDIOCPARAMETERS pdiocp);
  156. int ioctlMixDest_Unlock(PDIOCPARAMETERS pdiocp);
  157. VOID _ZeroMemory(PVOID pDestination, DWORD cbLength);
  158. int VXDINLINE VMM_lstrcmpi(char *pString1, char *pString2);
  159. LPVOID VXDINLINE VMM_GetCurrentContext();
  160. BOOL VXDINLINE VMM_PageAttach(ULONG pagesrc, LPVOID hcontextsrc, ULONG pagedst, ULONG cpages);
  161. BOOL VXDINLINE VMM_PageFree(PVOID pPage, ULONG flags);
  162. void VXDINLINE VMM_EnterMustComplete();
  163. void VXDINLINE VMM_LeaveMustComplete();
  164. BOOL VXDINLINE VWIN32_CloseVxDHandle(DWORD vxdh);
  165. int ctrlDynamicDeviceInit(void);
  166. int ctrlDynamicDeviceExit(void);
  167. int ioctlDsvxdInitialize(PDIOCPARAMETERS pdiocp);
  168. int ioctlDsvxdShutdown(PDIOCPARAMETERS pdiocp);
  169. int ioctlDsvxd_PageFile_Get_Version(PDIOCPARAMETERS pdiocp);
  170. int ioctlDsvxd_VMM_Test_Debug_Installed(PDIOCPARAMETERS pdiocp);
  171. int ioctlDsvxd_VMCPD_Get_Version(PDIOCPARAMETERS pdiocp);
  172. int ioctlDrvGetNextDescFromGuid(PDIOCPARAMETERS pdiocp);
  173. int ioctlDrvGetDescFromGuid(PDIOCPARAMETERS pdiocp);
  174. int ioctlDrvOpenFromGuid(PDIOCPARAMETERS pdiocp);
  175. int ioctlIUnknown_QueryInterface(PDIOCPARAMETERS pdiocp);
  176. int ioctlIUnknown_AddRef(PDIOCPARAMETERS pdiocp);
  177. int ioctlIUnknown_Release(PDIOCPARAMETERS pdiocp);
  178. int ioctlIDsDriver_QueryInterface(PDIOCPARAMETERS pdiocp);
  179. int ioctlIDsDriver_Close(PDIOCPARAMETERS pdiocp);
  180. int ioctlIDsDriver_GetCaps(PDIOCPARAMETERS pdiocp);
  181. int ioctlIDsDriver_CreateSoundBuffer(PDIOCPARAMETERS pdiocp);
  182. int ioctlIDsDriver_DuplicateSoundBuffer(PDIOCPARAMETERS pdiocp);
  183. int ioctlBufferRelease(PDIOCPARAMETERS pdiocp);
  184. int ioctlBufferLock(PDIOCPARAMETERS pdiocp);
  185. int ioctlBufferUnlock(PDIOCPARAMETERS pdiocp);
  186. int ioctlBufferSetFormat(PDIOCPARAMETERS pdiocp);
  187. int ioctlBufferSetFrequency(PDIOCPARAMETERS pdiocp);
  188. int ioctlBufferSetVolumePan(PDIOCPARAMETERS pdiocp);
  189. int ioctlBufferSetPosition(PDIOCPARAMETERS pdiocp);
  190. int ioctlBufferGetPosition(PDIOCPARAMETERS pdiocp);
  191. int ioctlBufferPlay(PDIOCPARAMETERS pdiocp);
  192. int ioctlBufferStop(PDIOCPARAMETERS pdiocp);
  193. int ioctlIDirectSoundPropertySet_GetProperty(PDIOCPARAMETERS pdiocp);
  194. int ioctlIDirectSoundPropertySet_SetProperty(PDIOCPARAMETERS pdiocp);
  195. int ioctlIDirectSoundPropertySet_QuerySupport(PDIOCPARAMETERS pdiocp);
  196. int ioctlEventScheduleWin32Event(PDIOCPARAMETERS pdiocp);
  197. int ioctlEventCloseVxDHandle(PDIOCPARAMETERS pdiocp);
  198. int ioctlMemReserveAlias(PDIOCPARAMETERS pdiocp);
  199. int ioctlMemCommitAlias(PDIOCPARAMETERS pdiocp);
  200. int ioctlMemDecommitAlias(PDIOCPARAMETERS pdiocp);
  201. int ioctlMemRedirectAlias(PDIOCPARAMETERS pdiocp);
  202. int ioctlMemFreeAlias(PDIOCPARAMETERS pdiocp);
  203. int ioctlMemPageLock(PDIOCPARAMETERS pdiocp);
  204. int ioctlMemPageUnlock(PDIOCPARAMETERS pdiocp);
  205. int ioctlMemCommitPhysAlias(PDIOCPARAMETERS pdiocp);
  206. int ioctlMemRedirectPhysAlias(PDIOCPARAMETERS pdiocp);
  207. int ioctlGetInternalVersionNumber(PDIOCPARAMETERS pdiocp);
  208. void Dsvxd_PageFile_Get_Version(PDWORD pVersion, PDWORD pMaxSize, PDWORD pPagerType);
  209. BOOL Dsvxd_VMM_Test_Debug_Installed(void);
  210. void Dsvxd_VMCPD_Get_Version(PLONG pMajorVersion, PLONG pMinorVersion, PLONG pCoprocessorLevel);
  211. HRESULT SERVICE DSOUND_RegisterDeviceDriver(PIDSDRIVER pIDsDriver, DWORD dwFlags);
  212. HRESULT SERVICE DSOUND_DeregisterDeviceDriver(PIDSDRIVER pIDsDriver, DWORD dwFlags);
  213. //--------------------------------------------------------------------------;
  214. //
  215. // Some useful IOCTL macros
  216. //
  217. //--------------------------------------------------------------------------;
  218. // the ASSERT in IOSTART confirms that the count of
  219. // input bytes is what we expect
  220. #define IOSTART(cbInExpected) LPDWORD pdiocIn = (LPDWORD)pdiocp->lpvInBuffer; \
  221. LPDWORD pdiocOut = (LPDWORD)pdiocp->lpvOutBuffer; \
  222. ASSERT( pdiocp->cbInBuffer == (cbInExpected) );
  223. #define IOINPUT(x, t) x = ( *(t*)(pdiocIn++) );
  224. #define IOOUTPUT(x, t) ( *(t*)((pdiocOut++)) ) = x;
  225. // the ASSERT in IORETURN confirms that we read all
  226. // of the bytes out of the input buffer
  227. #define IORETURN (*(DWORD*)pdiocp->lpcbBytesReturned) = ((LPBYTE)pdiocOut) - ((LPBYTE)pdiocp->lpvOutBuffer); \
  228. ASSERT( (DWORD)(((LPBYTE)pdiocIn) - ((LPBYTE)pdiocp->lpvInBuffer)) == pdiocp->cbInBuffer );
  229. #ifdef DEBUG
  230. #ifndef USEASSERT
  231. #define USEASSERT
  232. #endif
  233. #endif
  234. // ASSERT macro
  235. #undef HOLYCOW
  236. #undef CRLF
  237. #undef ASSERT
  238. #define HOLYCOW "******************************************************************************"
  239. #define CRLF "\n"
  240. #ifdef USEASSERT
  241. #define ASSERT(exp) if(!(exp)) _Trace_Out_Service("DSVXD: "), _Debug_Printf_Service(CRLF HOLYCOW CRLF "Assertion failed in %s, line %u: %s" CRLF HOLYCOW CRLF, __FILE__, __LINE__, #exp), _Debug_Out_Service("")
  242. #else
  243. // Disable empty controlled statement warning for ASSERT macro
  244. #pragma warning(disable:4390)
  245. #define ASSERT(exp)
  246. #endif
  247. // BREAK and DPF macros
  248. #undef DPF
  249. #undef BREAK
  250. #define DPF_GUID_STRING "{%8.8lX-%4.4X-%4.4X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X}"
  251. #define DPF_GUID_VAL(guid) (guid).Data1, (guid).Data2, (guid).Data3, (guid).Data4[0], (guid).Data4[1], (guid).Data4[2], (guid).Data4[3], (guid).Data4[4], (guid).Data4[5], (guid).Data4[6], (guid).Data4[7]
  252. // #define DEBUG_VXDDRIVERCALLS
  253. #ifdef DEBUG_VXDDRIVERCALLS
  254. #define DRVCALL(arg) _Trace_Out_Service("DSVXD: "), _Debug_Printf_Service##arg, _Trace_Out_Service(CRLF)
  255. #else
  256. #define DRVCALL(arg)
  257. #endif
  258. #ifdef DEBUG
  259. #define DPF(arg) _Trace_Out_Service("DSVXD: "), _Debug_Printf_Service##arg, _Trace_Out_Service(CRLF)
  260. #define BREAK(arg) DPF(arg), _Debug_Out_Service("")
  261. #else
  262. #define DPF(arg)
  263. #define BREAK(arg)
  264. #endif
  265. #ifdef __cplusplus
  266. };
  267. #endif
  268. #endif // __DSVXDI_INCLUDED__