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.

144 lines
3.3 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. srvacces.c
  5. Abstract:
  6. This file contains the Access Pack support routines
  7. Author:
  8. Gregory Wilson (gregoryw) 28-Jul-1993
  9. Revision History:
  10. --*/
  11. #include "basesrv.h"
  12. BOOL
  13. FirstSoundSentry(
  14. UINT uVideoMode
  15. );
  16. BOOL (*_UserSoundSentry)(
  17. UINT uVideoMode
  18. ) = FirstSoundSentry;
  19. BOOL
  20. FailSoundSentry(
  21. UINT uVideoMode
  22. )
  23. {
  24. //
  25. // If the real user soundsentry routine cannot be found, deny access
  26. //
  27. return( FALSE );
  28. }
  29. BOOL
  30. FirstSoundSentry(
  31. UINT uVideoMode
  32. )
  33. {
  34. UNICODE_STRING WinSrvString = RTL_CONSTANT_STRING(L"winsrv");
  35. STRING UserSoundSentryString = RTL_CONSTANT_STRING("_UserSoundSentry");
  36. HANDLE UserServerModuleHandle;
  37. NTSTATUS Status;
  38. BOOL (*pfnSoundSentryProc)(UINT) = FailSoundSentry; // default to failure
  39. Status = LdrGetDllHandle(
  40. NULL,
  41. NULL,
  42. &WinSrvString,
  43. &UserServerModuleHandle
  44. );
  45. if ( NT_SUCCESS(Status) ) {
  46. Status = LdrGetProcedureAddress(
  47. UserServerModuleHandle,
  48. &UserSoundSentryString,
  49. 0L,
  50. (PVOID *)&pfnSoundSentryProc
  51. );
  52. }
  53. _UserSoundSentry = pfnSoundSentryProc;
  54. return( _UserSoundSentry( uVideoMode ) );
  55. }
  56. //
  57. // There are no uses of this, so remove it regardless of the ifdef.
  58. //
  59. #if 0 // defined(CONSOLESOUNDSENTRY)
  60. CONST STRING ConsoleSoundSentryString = RTL_CONSTANT_STRING("_ConsoleSoundSentry");
  61. BOOL
  62. FirstConsoleSoundSentry(
  63. UINT uVideoMode
  64. );
  65. BOOL (*_ConsoleSoundSentry)(
  66. UINT uVideoMode
  67. ) = FirstConsoleSoundSentry;
  68. BOOL
  69. FirstConsoleSoundSentry(
  70. UINT uVideoMode
  71. )
  72. {
  73. HANDLE ConsoleServerModuleHandle;
  74. NTSTATUS Status;
  75. BOOL (*pfnSoundSentryProc)(UINT) = FailSoundSentry; // default to failure
  76. Status = LdrGetDllHandle(
  77. NULL,
  78. NULL,
  79. &WinSrvString,
  80. (PVOID *)&ConsoleServerModuleHandle
  81. );
  82. if ( NT_SUCCESS(Status) ) {
  83. Status = LdrGetProcedureAddress(
  84. ConsoleServerModuleHandle,
  85. &ConsoleSoundSentryString,
  86. 0L,
  87. (PVOID *)&pfnSoundSentryProc
  88. );
  89. }
  90. _ConsoleSoundSentry = pfnSoundSentryProc;
  91. return( _ConsoleSoundSentry( uVideoMode ) );
  92. }
  93. #endif
  94. ULONG
  95. BaseSrvSoundSentryNotification(
  96. IN OUT PCSR_API_MSG m,
  97. IN OUT PCSR_REPLY_STATUS ReplyStatus
  98. )
  99. {
  100. PBASE_SOUNDSENTRY_NOTIFICATION_MSG a =
  101. (PBASE_SOUNDSENTRY_NOTIFICATION_MSG)&m->u.ApiMessageData;
  102. BOOL SoundSentryStatus;
  103. //
  104. // The possible values for a->VideoMode are:
  105. // 0 : windows mode
  106. // 1 : full screen mode
  107. // 2 : full screen graphics mode
  108. //
  109. SoundSentryStatus = _UserSoundSentry( a->VideoMode );
  110. if (SoundSentryStatus) {
  111. return( (ULONG)STATUS_SUCCESS );
  112. } else {
  113. return( (ULONG)STATUS_ACCESS_DENIED );
  114. }
  115. ReplyStatus; // get rid of unreferenced parameter warning message
  116. }