1 /* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS Base API Server DLL 4 * FILE: subsystems/win/basesrv/sndsntry.c 5 * PURPOSE: Sound Sentry Notifications 6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) 7 */ 8 9 /* INCLUDES *******************************************************************/ 10 11 #include "basesrv.h" 12 13 #define NDEBUG 14 #include <debug.h> 15 16 /* GLOBALS ********************************************************************/ 17 18 typedef BOOL (NTAPI *PUSER_SOUND_SENTRY)(VOID); 19 BOOL NTAPI FirstSoundSentry(VOID); 20 21 static PUSER_SOUND_SENTRY _UserSoundSentry = FirstSoundSentry; 22 23 /* PRIVATE FUNCTIONS **********************************************************/ 24 25 BOOL 26 NTAPI FailSoundSentry(VOID)27FailSoundSentry(VOID) 28 { 29 /* In case the function can't be found/is unimplemented */ 30 return FALSE; 31 } 32 33 BOOL 34 NTAPI FirstSoundSentry(VOID)35FirstSoundSentry(VOID) 36 { 37 UNICODE_STRING DllString = RTL_CONSTANT_STRING(L"winsrv"); 38 STRING FuncString = RTL_CONSTANT_STRING("_UserSoundSentry"); 39 HANDLE DllHandle; 40 NTSTATUS Status; 41 PUSER_SOUND_SENTRY NewSoundSentry = FailSoundSentry; 42 43 /* Load winsrv manually */ 44 Status = LdrGetDllHandle(NULL, NULL, &DllString, &DllHandle); 45 if (NT_SUCCESS(Status)) 46 { 47 /* If it was found, get SoundSentry export */ 48 Status = LdrGetProcedureAddress(DllHandle, 49 &FuncString, 50 0, 51 (PVOID*)&NewSoundSentry); 52 } 53 54 /* Set it as the callback for the future, and call it */ 55 _UserSoundSentry = NewSoundSentry; 56 return _UserSoundSentry(); 57 } 58 59 /* PUBLIC SERVER APIS *********************************************************/ 60 CSR_API(BaseSrvSoundSentryNotification)61CSR_API(BaseSrvSoundSentryNotification) 62 { 63 /* Call the API and see if it succeeds */ 64 return (_UserSoundSentry() ? STATUS_SUCCESS : STATUS_ACCESS_DENIED); 65 } 66 67 /* EOF */ 68