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.

123 lines
3.2 KiB

  1. //=================================================================
  2. //
  3. // WinmmApi.cpp
  4. //
  5. // Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved
  6. //
  7. //=================================================================
  8. #include <nt.h>
  9. #include <ntrtl.h>
  10. #include <nturtl.h>
  11. #include <ntobapi.h>
  12. #define _WINNT_ // have what is needed from above
  13. #include "precomp.h"
  14. #include <cominit.h>
  15. #include <lmuse.h>
  16. #include "DllWrapperBase.h"
  17. #include <mmreg.h>
  18. #include <mmsystem.h>
  19. #include <msacm.h>
  20. #include "WinmmApi.h"
  21. #include "DllWrapperCreatorReg.h"
  22. // {F54DB7BF-0FB4-11d3-910C-00105AA630BE}
  23. static const GUID g_guidWinmmApi =
  24. { 0xf54db7bf, 0xfb4, 0x11d3, { 0x91, 0xc, 0x0, 0x10, 0x5a, 0xa6, 0x30, 0xbe } };
  25. static const TCHAR g_tstrWinmm [] = _T("Winmm.Dll");
  26. /******************************************************************************
  27. * Register this class with the CResourceManager.
  28. *****************************************************************************/
  29. CDllApiWraprCreatrReg<CWinmmApi, &g_guidWinmmApi, g_tstrWinmm> MyRegisteredWinmmWrapper;
  30. /******************************************************************************
  31. * Constructor
  32. *****************************************************************************/
  33. CWinmmApi::CWinmmApi(LPCTSTR a_tstrWrappedDllName)
  34. : CDllWrapperBase(a_tstrWrappedDllName),
  35. m_pfnwaveOutGetNumDevs (NULL),
  36. m_pfnwaveOutGetDevCaps(NULL)
  37. {
  38. }
  39. /******************************************************************************
  40. * Destructor
  41. *****************************************************************************/
  42. CWinmmApi::~CWinmmApi()
  43. {
  44. }
  45. /******************************************************************************
  46. * Initialization function to check that we obtained function addresses.
  47. ******************************************************************************/
  48. bool CWinmmApi::Init()
  49. {
  50. bool fRet = LoadLibrary();
  51. if(fRet)
  52. {
  53. m_pfnwaveOutGetNumDevs = ( PFN_Winmm_waveOutGetNumDevs ) GetProcAddress ( "waveOutGetNumDevs" ) ;
  54. #ifdef UNICODE
  55. m_pfnwaveOutGetDevCaps = ( PFN_Winmm_waveOutGetDevCaps ) GetProcAddress ( "waveOutGetDevCapsW" ) ;
  56. #else
  57. m_pfnwaveOutGetDevCaps = ( PFN_Winmm_waveOutGetDevCaps ) GetProcAddress ( "waveOutGetDevCapsA" ) ;
  58. #endif
  59. }
  60. // We require these function for all versions of this dll.
  61. if ( m_pfnwaveOutGetNumDevs == NULL ||
  62. m_pfnwaveOutGetDevCaps == NULL )
  63. {
  64. fRet = false;
  65. LogErrorMessage(L"Failed find entrypoint in winmmapi");
  66. }
  67. return fRet;
  68. }
  69. /******************************************************************************
  70. * Member functions wrapping Tapi api functions. Add new functions here
  71. * as required.
  72. *****************************************************************************/
  73. UINT CWinmmApi :: WinMMwaveOutGetNumDevs (
  74. void
  75. )
  76. {
  77. return m_pfnwaveOutGetNumDevs () ;
  78. }
  79. #ifdef UNICODE
  80. MMRESULT CWinmmApi :: WinmmwaveOutGetDevCaps (
  81. UINT_PTR uDeviceID,
  82. LPWAVEOUTCAPSW pwoc,
  83. UINT cbwoc
  84. )
  85. #else
  86. MMRESULT CWinmmApi :: WinmmwaveOutGetDevCaps (
  87. UINT_PTR uDeviceID,
  88. LPWAVEOUTCAPSA pwoc,
  89. UINT cbwoc
  90. )
  91. #endif
  92. {
  93. return m_pfnwaveOutGetDevCaps (
  94. uDeviceID,
  95. pwoc,
  96. cbwoc
  97. ) ;
  98. }