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.

86 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. IgnoreMCIStop.cpp
  5. Abstract:
  6. The shim hooks mciSendCommand and ignores MCI_STOP which takes 2-3 seconds
  7. on my P2-400.
  8. Sent to the audio team for fixing, but I'm not optimistic - bug number
  9. 246407.
  10. Notes:
  11. This cannot be put in the layer, but can apply to more than one app.
  12. History:
  13. 08/04/2000 a-brienw Created
  14. 11/30/2000 linstev Generalized
  15. --*/
  16. #include "precomp.h"
  17. #include <mmsystem.h>
  18. IMPLEMENT_SHIM_BEGIN(IgnoreMCIStop)
  19. #include "ShimHookMacro.h"
  20. APIHOOK_ENUM_BEGIN
  21. APIHOOK_ENUM_ENTRY(mciSendCommandA)
  22. APIHOOK_ENUM_END
  23. /*++
  24. Hook mciSendCommand and perform the shims duties.
  25. --*/
  26. MCIERROR
  27. APIHOOK(mciSendCommandA)(
  28. MCIDEVICEID IDDevice,
  29. UINT uMsg,
  30. DWORD fdwCommand,
  31. DWORD dwParam
  32. )
  33. {
  34. if (uMsg == MCI_STOP)
  35. {
  36. DPFN( eDbgLevelWarning, "Ignoring MCI_STOP");
  37. return 0;
  38. }
  39. if (uMsg == MCI_CLOSE)
  40. {
  41. DPFN( eDbgLevelWarning, "MCI_CLOSE called: issuing MCI_STOP");
  42. mciSendCommandA(IDDevice, MCI_STOP, 0, 0);
  43. }
  44. MCIERROR mErr = ORIGINAL_API(mciSendCommandA)(
  45. IDDevice,
  46. uMsg,
  47. fdwCommand,
  48. dwParam);
  49. return mErr;
  50. }
  51. /*++
  52. Register hooked functions
  53. --*/
  54. HOOK_BEGIN
  55. APIHOOK_ENTRY(WINMM.DLL, mciSendCommandA)
  56. HOOK_END
  57. IMPLEMENT_SHIM_END