reactos/subsystems/win/basesrv/sndsntry.c
Hermès Bélusca-Maïto 3a7f8d36e8 [BASESRV-CONSRV-WINSRV]
Code reorganization only: put public server apis definitions in a dedicated include to be included in the respective init.c files.

svn path=/branches/ros-csrss/; revision=58718
2013-04-07 23:39:39 +00:00

67 lines
1.9 KiB
C

/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS Base API Server DLL
* FILE: subsystems/win/basesrv/sndsntry.c
* PURPOSE: Sound Sentry Notifications
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
*/
/* INCLUDES *******************************************************************/
#include "basesrv.h"
#define NDEBUG
#include <debug.h>
/* GLOBALS ********************************************************************/
typedef BOOL (WINAPI *PUSER_SOUND_SENTRY)(VOID);
BOOL NTAPI FirstSoundSentry(VOID);
static PUSER_SOUND_SENTRY _UserSoundSentry = FirstSoundSentry;
/* PRIVATE FUNCTIONS **********************************************************/
BOOL
NTAPI
FailSoundSentry(VOID)
{
/* In case the function can't be found/is unimplemented */
return FALSE;
}
BOOL
NTAPI
FirstSoundSentry(VOID)
{
UNICODE_STRING DllString = RTL_CONSTANT_STRING(L"winsrv");
STRING FuncString = RTL_CONSTANT_STRING("_UserSoundSentry");
HANDLE DllHandle;
NTSTATUS Status;
PUSER_SOUND_SENTRY NewSoundSentry = FailSoundSentry;
/* Load winsrv manually */
Status = LdrGetDllHandle(NULL, NULL, &DllString, &DllHandle);
if (NT_SUCCESS(Status))
{
/* If it was found, get SoundSentry export */
Status = LdrGetProcedureAddress(DllHandle,
&FuncString,
0,
(PVOID*)&NewSoundSentry);
}
/* Set it as the callback for the future, and call it */
_UserSoundSentry = NewSoundSentry;
return _UserSoundSentry();
}
/* PUBLIC SERVER APIS *********************************************************/
CSR_API(BaseSrvSoundSentryNotification)
{
/* Call the API and see if it succeeds */
return (_UserSoundSentry() ? STATUS_SUCCESS : STATUS_ACCESS_DENIED);
}
/* EOF */