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.

129 lines
3.4 KiB

  1. //=================================================================
  2. //
  3. // MsAcm32API.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 <mmsystem.h>
  16. #include <mmreg.h>
  17. #include <msacm.h>
  18. #include "DllWrapperBase.h"
  19. #include "MsAcm32Api.h"
  20. #include "DllWrapperCreatorReg.h"
  21. // {7D65D31E-0FB5-11d3-910C-00105AA630BE}
  22. static const GUID g_guidMsAcm32Api =
  23. { 0x7d65d31e, 0xfb5, 0x11d3, { 0x91, 0xc, 0x0, 0x10, 0x5a, 0xa6, 0x30, 0xbe } };
  24. static const TCHAR g_tstrMsAcm32 [] = _T("MsAcm32.Dll");
  25. /******************************************************************************
  26. * Register this class with the CResourceManager.
  27. *****************************************************************************/
  28. CDllApiWraprCreatrReg<CMsAcm32Api, &g_guidMsAcm32Api, g_tstrMsAcm32> MyRegisteredMsAcm32Wrapper;
  29. /******************************************************************************
  30. * Constructor
  31. *****************************************************************************/
  32. CMsAcm32Api::CMsAcm32Api(LPCTSTR a_tstrWrappedDllName)
  33. : CDllWrapperBase(a_tstrWrappedDllName),
  34. m_pfnacmDriverDetails (NULL),
  35. m_pfnacmDriverEnum (NULL)
  36. {
  37. }
  38. /******************************************************************************
  39. * Destructor
  40. *****************************************************************************/
  41. CMsAcm32Api::~CMsAcm32Api()
  42. {
  43. }
  44. /******************************************************************************
  45. * Initialization function to check that we obtained function addresses.
  46. ******************************************************************************/
  47. bool CMsAcm32Api::Init()
  48. {
  49. bool fRet = LoadLibrary();
  50. if(fRet)
  51. {
  52. #ifdef UNICODE
  53. m_pfnacmDriverDetails = ( PFN_MsAcm32_acmDriverDetails ) GetProcAddress ( "acmDriverDetailsW" ) ;
  54. #else
  55. m_pfnacmDriverDetails = ( PFN_MsAcm32_acmDriverDetails ) GetProcAddress ( "acmDriverDetailsA" ) ;
  56. #endif
  57. m_pfnacmDriverEnum = ( PFN_MsAcm32_acmDriverEnum ) GetProcAddress ( "acmDriverEnum" ) ;
  58. }
  59. // We require these function for all versions of this dll.
  60. if ( m_pfnacmDriverDetails == NULL ||
  61. m_pfnacmDriverEnum == NULL )
  62. {
  63. fRet = false;
  64. LogErrorMessage(L"Failed find entrypoint in msacm32api");
  65. }
  66. return fRet;
  67. }
  68. /******************************************************************************
  69. * Member functions wrapping Tapi api functions. Add new functions here
  70. * as required.
  71. *****************************************************************************/
  72. #ifdef UNICODE
  73. MMRESULT CMsAcm32Api :: MsAcm32acmDriverDetails (
  74. HACMDRIVERID hadid,
  75. LPACMDRIVERDETAILSW padd,
  76. DWORD fdwDetails
  77. )
  78. #else
  79. MMRESULT CMsAcm32Api :: MsAcm32acmDriverDetails (
  80. HACMDRIVERID hadid,
  81. LPACMDRIVERDETAILSA padd,
  82. DWORD fdwDetails
  83. )
  84. #endif
  85. {
  86. return m_pfnacmDriverDetails (
  87. hadid,
  88. padd,
  89. fdwDetails
  90. ) ;
  91. }
  92. MMRESULT CMsAcm32Api :: MsAcm32acmDriverEnum (
  93. ACMDRIVERENUMCB fnCallback,
  94. DWORD_PTR dwInstance,
  95. DWORD fdwEnum
  96. )
  97. {
  98. return m_pfnacmDriverEnum (
  99. fnCallback,
  100. dwInstance,
  101. fdwEnum
  102. ) ;
  103. }