Windows NT 4.0 source code leak
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.

198 lines
4.5 KiB

4 years ago
  1. /*
  2. NTPROXY.C
  3. This file contains proxy and stub functions easing the port of
  4. DSOUND from Windows 95 to Windows NT.
  5. These functions provide alternate implementations of their original
  6. functions. The proxies provide implementations that are appropriate
  7. for NT, replacing the functionality of the original functions. The
  8. stubs are present simply to allow other benign DSOUND code to build
  9. and link. The stubs should _never_ be called.
  10. Created by FrankYe on Jan 3, 1996.
  11. */
  12. #include "dsoundpr.h"
  13. #ifdef DSBLD_NONSHARED
  14. /*
  15. These MemX proxies are provided to take the place of those implemented
  16. by misc\memalloc. These are used in NONSHARED builds of DSOUND. By
  17. providing these proxies, less DSOUND code needs conditional compiles for
  18. NONSHARED. However, these functions manage private memory instead of
  19. shared memory by calling the Win32 GlobalX APIs.
  20. */
  21. BOOL MemInit(void)
  22. {
  23. return TRUE;
  24. }
  25. void MemFini(void)
  26. {
  27. return;
  28. }
  29. //
  30. // MemAlloc must zero-initialize the memory that it allocates.
  31. //
  32. LPVOID __cdecl MemAlloc(UINT cb)
  33. {
  34. LPVOID p;
  35. p = (LPVOID)GlobalAlloc(GPTR, cb);
  36. return p;
  37. }
  38. void MemFree(LPVOID p)
  39. {
  40. GlobalFree((HGLOBAL)p);
  41. }
  42. void MemState(void)
  43. {
  44. return;
  45. }
  46. /*
  47. These HelperX proxies are provided to take the place of those implemented
  48. by misc\w95help.c. These are used in NONSHARED builds of DSOUND. By
  49. providing these stubs, less DSOUND code needs conditional compiles for
  50. NONSHARED. Note that these execute in the context of the calling process
  51. whereas the original functions switch to the DDHELP process before
  52. performing their primary function.
  53. */
  54. HANDLE HelperCreateDSMixerThread( LPTHREAD_START_ROUTINE pfnThreadFunc,
  55. LPVOID pThreadParam, DWORD dwFlags,
  56. LPDWORD pThreadId )
  57. {
  58. DWORD tid;
  59. if (NULL == pThreadId) pThreadId = &tid;
  60. return CreateThread(NULL, 0, pfnThreadFunc, pThreadParam,
  61. dwFlags, pThreadId);
  62. }
  63. HANDLE HelperCreateDSFocusThread( LPTHREAD_START_ROUTINE pfnThreadFunc,
  64. LPVOID pThreadParam, DWORD dwFlags,
  65. LPDWORD pThreadId )
  66. {
  67. DWORD tid;
  68. if (NULL == pThreadId) pThreadId = &tid;
  69. return CreateThread(NULL, 0, pfnThreadFunc, pThreadParam,
  70. dwFlags, pThreadId);
  71. }
  72. typedef void (FAR PASCAL *LPDSCLEANUP)(LPVOID pds);
  73. void HelperCallDSEmulatorCleanup( LPVOID pCleanupFunc, LPVOID pDirectSound )
  74. {
  75. ((LPDSCLEANUP)pCleanupFunc)(pDirectSound);
  76. }
  77. DWORD HelperWaveOpen( LPVOID lphwo, DWORD dwDeviceID, LPVOID pwfx )
  78. {
  79. MMRESULT mmr;
  80. DWORD dw;
  81. mmr = waveOutOpen(lphwo, dwDeviceID, pwfx, 0, 0, 0);
  82. dw = (DWORD)mmr;
  83. // Some mmsystem wave drivers will program their wave mixer
  84. // hardware only while the device is open. By doing the
  85. // following, we can get such drivers to program the hardware
  86. if (MMSYSERR_NOERROR == mmr) {
  87. DWORD dwVolume;
  88. mmr = waveOutGetVolume(*(LPHWAVEOUT)lphwo, &dwVolume);
  89. if (MMSYSERR_NOERROR == mmr) {
  90. waveOutSetVolume(*(LPHWAVEOUT)lphwo, dwVolume);
  91. }
  92. }
  93. return dw;
  94. }
  95. DWORD HelperWaveClose( DWORD hwo )
  96. {
  97. return (DWORD)waveOutClose((HWAVEOUT)hwo);
  98. }
  99. #endif
  100. #ifdef DSBLD_EMULONLY
  101. /*
  102. These VidMemX stubs are provided to take the place of those implemented
  103. by DDRAW. These are used in EMULONLY builds of DSOUND. By providing
  104. these stubs, less DSOUND code needs conditional compiles for EMULONLY.
  105. However, these functions should never be called when DSOUND is compiled
  106. for EMULONLY.
  107. */
  108. FLATPTR WINAPI VidMemAlloc( LPVMEMHEAP pvmh, DWORD width, DWORD height )
  109. {
  110. ASSERT(FALSE);
  111. return (FLATPTR)NULL;
  112. }
  113. void WINAPI VidMemFree( LPVMEMHEAP pvmh, FLATPTR ptr )
  114. {
  115. ASSERT(FALSE);
  116. return;
  117. }
  118. LPVMEMHEAP WINAPI VidMemInit( DWORD flags, FLATPTR start, FLATPTR end_or_width, DWORD height, DWORD pitch )
  119. {
  120. ASSERT(FALSE);
  121. return NULL;
  122. }
  123. void WINAPI VidMemFini( LPVMEMHEAP pvmh )
  124. {
  125. ASSERT(FALSE);
  126. return;
  127. }
  128. DWORD WINAPI VidMemAmountFree( LPVMEMHEAP pvmh )
  129. {
  130. ASSERT(FALSE);
  131. return 0;
  132. }
  133. DWORD WINAPI VidMemLargestFree( LPVMEMHEAP pvmh )
  134. {
  135. ASSERT(FALSE);
  136. return 0;
  137. }
  138. /*
  139. This OpenVxDHandle stub is provided to take the place of the implementation
  140. in Windows 95 KERNEL. This stub is used in EMULONLY builds of DSOUND. By
  141. providing this stub, less DSOUND code needs conditional compiles for
  142. EMULONLY. However, this function should never be called when DSOUND is
  143. compiled for EMULONLY.
  144. */
  145. DWORD WINAPI OpenVxDHandle(HANDLE hSource)
  146. {
  147. ASSERT(FALSE);
  148. return (DWORD)NULL;
  149. }
  150. #endif