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.

126 lines
3.1 KiB

  1. /****************************** Module Header ******************************\
  2. * Module Name: msgbeep.c
  3. *
  4. * Copyright (c) 1985 - 1999, Microsoft Corporation
  5. *
  6. * This module contains the xxxMessageBox API and related functions.
  7. *
  8. * History:
  9. * 6-26-91 NigelT Created it with some wood and a few nails
  10. * 7 May 92 SteveDav Getting closer to the real thing
  11. \***************************************************************************/
  12. #include "precomp.h"
  13. #pragma hdrstop
  14. #include <ntddbeep.h>
  15. #include <mmsystem.h>
  16. /***************************************************************************\
  17. * xxxOldMessageBeep (API)
  18. *
  19. * Send a beep to the beep device
  20. *
  21. * History:
  22. * 09-25-91 JimA Created.
  23. \***************************************************************************/
  24. BOOL xxxOldMessageBeep()
  25. {
  26. BOOL b;
  27. if (TEST_PUDF(PUDF_BEEP)) {
  28. LeaveCrit();
  29. b = UserBeep(440, 125);
  30. EnterCrit();
  31. return b;
  32. } else {
  33. _UserSoundSentryWorker();
  34. }
  35. return TRUE;
  36. }
  37. /***************************************************************************\
  38. * xxxMessageBeep (API)
  39. *
  40. *
  41. * History:
  42. * 6-26-91 NigelT Wrote it.
  43. * 24-Mar-92 SteveDav Changed interface - no passing of strings
  44. * If WINMM cannot be found or loaded, then use speaker
  45. \***************************************************************************/
  46. BOOL xxxMessageBeep(
  47. UINT dwType)
  48. {
  49. UINT sndid;
  50. PTHREADINFO pti = PtiCurrent();
  51. if (pti->TIF_flags & TIF_SYSTEMTHREAD) {
  52. xxxOldMessageBeep();
  53. return TRUE;
  54. }
  55. if (!TEST_PUDF(PUDF_BEEP)) {
  56. _UserSoundSentryWorker();
  57. return TRUE;
  58. }
  59. switch(dwType & MB_ICONMASK) {
  60. case MB_ICONHAND:
  61. sndid = USER_SOUND_SYSTEMHAND;
  62. break;
  63. case MB_ICONQUESTION:
  64. sndid = USER_SOUND_SYSTEMQUESTION;
  65. break;
  66. case MB_ICONEXCLAMATION:
  67. sndid = USER_SOUND_SYSTEMEXCLAMATION;
  68. break;
  69. case MB_ICONASTERISK:
  70. sndid = USER_SOUND_SYSTEMASTERISK;
  71. break;
  72. default:
  73. sndid = USER_SOUND_DEFAULT;
  74. break;
  75. }
  76. if (gspwndLogonNotify) {
  77. _PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, LOGON_PLAYEVENTSOUND, sndid);
  78. }
  79. _UserSoundSentryWorker();
  80. return TRUE;
  81. }
  82. /***************************************************************************\
  83. * xxxPlayEventSound
  84. *
  85. * Play a sound
  86. *
  87. * History:
  88. * 09-25-91 JimA Created.
  89. \***************************************************************************/
  90. VOID PlayEventSound(UINT idSound)
  91. {
  92. PTHREADINFO pti = PtiCurrent();
  93. if (!TEST_PUDF(PUDF_EXTENDEDSOUNDS))
  94. return;
  95. if (pti->TIF_flags & TIF_SYSTEMTHREAD)
  96. return;
  97. if (gspwndLogonNotify) {
  98. _PostMessage(gspwndLogonNotify, WM_LOGONNOTIFY, LOGON_PLAYEVENTSOUND, idSound);
  99. }
  100. // NOTE -- we should only flash SoundSentry if a sound is played. With the
  101. // new technique of posting to WinLogon, we can't determine this here.
  102. // _UserSoundSentryWorker();
  103. }