mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[0.4.7][AUDIOSRV] Update to master state 2023-02-18
by porting back: 0.4.15-dev-5710-g9672dc5047
CORE-16912 [AUDIOSRV] Overhaul logging interfaces (#5067) 0.4.15-dev-445-g353b544047
CORE-16814 [AUDIOSRV] Disable Logging to file (#2599) 0.4.13-dev-894-g5f7575909f
CORE-16307 [AUDIOSRV][BOOTDATA][INCLUDE][MMSYS] Rename RosAudioSrv to AudioSrv (#1826) 0.4.13-dev-715-g353e05a4f3
[AUDIOSRV] Fix the coding style. No code changes!
This commit is contained in:
parent
88908edc19
commit
3aea497ef5
12 changed files with 136 additions and 194 deletions
|
@ -5,11 +5,10 @@ list(APPEND SOURCE
|
|||
pnp_list_lock.c
|
||||
pnp.c
|
||||
services.c
|
||||
debug.c
|
||||
audiosrv.h)
|
||||
|
||||
add_executable(audiosrv ${SOURCE} audiosrv.rc)
|
||||
set_module_type(audiosrv win32cui UNICODE)
|
||||
add_importlibs(audiosrv advapi32 user32 setupapi msvcrt kernel32)
|
||||
add_importlibs(audiosrv advapi32 user32 setupapi msvcrt kernel32 ntdll)
|
||||
add_pch(audiosrv audiosrv.h SOURCE)
|
||||
add_cd_file(TARGET audiosrv DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
/*
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/services/audiosrv/audiosrv.h
|
||||
* PURPOSE: Audio Service (private header)
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Audio Service (private header)
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
*/
|
||||
|
||||
#ifndef _AUDIOSRV_PCH_
|
||||
|
@ -62,10 +61,6 @@ HandleDeviceEvent(
|
|||
BOOL
|
||||
StartSystemAudioServices(VOID);
|
||||
|
||||
/* Debugging */
|
||||
|
||||
void logmsg(char* string, ...);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _AUDIOSRV_PCH_ */
|
||||
|
|
|
@ -16,23 +16,23 @@ Global\AudioDeviceList
|
|||
This file appears to contain a list of devices that WinMM accesses and
|
||||
subsequently passes to wdmaud.drv
|
||||
|
||||
It is not necessary to duplicate the exact structure of this mapped
|
||||
It is not necessary to duplicate the exact structure of this mapped
|
||||
file, since it appears to only be used internally by Windows components.
|
||||
|
||||
The ROS Audio Service (RosAudioSrv) is intended to be able to run
|
||||
alongside the Windows Audio Service on XP/Vista, so it should be
|
||||
The ROS Audio Service (AudioSrv) is intended to be able to run
|
||||
alongside the Windows Audio Service on XP/Vista, so it should be
|
||||
possible to test in a "known working environment" ;)
|
||||
|
||||
It will create a mutex, to:
|
||||
1) Allow synchronization when accessing the device list
|
||||
2) Provide a simple method of identifying if RosAudioSrv is running
|
||||
2) Provide a simple method of identifying if AudioSrv is running
|
||||
|
||||
(It might be worth using an event to notify WinMM when things are
|
||||
(It might be worth using an event to notify WinMM when things are
|
||||
happening?)
|
||||
|
||||
The intention is to make RosAudioSrv receive PnP notifications for
|
||||
relevant audio devices, and also let AudioSrv in Windows do this. Then
|
||||
it should be possible to create a small application that imitates
|
||||
The intention is to make AudioSrv receive PnP notifications for
|
||||
relevant audio devices, and also let AudioSrv in Windows do this. Then
|
||||
it should be possible to create a small application that imitates
|
||||
WinMM's actions :)
|
||||
|
||||
|
||||
|
@ -54,12 +54,12 @@ Testing the Service
|
|||
===================
|
||||
|
||||
The service can be installed on Windows XP (possibly also Vista) like so:
|
||||
sc create RosAudioSrv <path to audiosrv.exe>
|
||||
net start RosAudioSrv
|
||||
sc create AudioSrv <path to audiosrv.exe>
|
||||
net start AudioSrv
|
||||
|
||||
...and can be removed like so:
|
||||
net stop RosAudioSrv
|
||||
sc delete RosAudioSrv
|
||||
net stop AudioSrv
|
||||
sc delete AudioSrv
|
||||
|
||||
You can view a list of the currently available devices (device list is
|
||||
identical to the one offered by Windows' own AudioSrv) by running
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/* Service debugging (simply logs to a file) */
|
||||
|
||||
#include "audiosrv.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void logmsg(char* string, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
FILE* debug_file = fopen("c:\\audiosrv-debug.txt", "a");
|
||||
|
||||
if (debug_file)
|
||||
{
|
||||
va_start(args, string);
|
||||
vfprintf(debug_file, string, args);
|
||||
va_end(args);
|
||||
fclose(debug_file);
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[256];
|
||||
va_start(args, string);
|
||||
vsprintf(buf, string, args);
|
||||
OutputDebugStringA(buf);
|
||||
va_end(args);
|
||||
}
|
||||
}
|
|
@ -1,20 +1,22 @@
|
|||
/*
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/services/audiosrv/main.c
|
||||
* PURPOSE: Audio Service
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Audio Service
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
*/
|
||||
|
||||
#include "audiosrv.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
SERVICE_STATUS_HANDLE service_status_handle;
|
||||
SERVICE_STATUS service_status;
|
||||
|
||||
|
||||
/* This is for testing only! */
|
||||
VOID
|
||||
InitializeFakeDevice()
|
||||
InitializeFakeDevice(VOID)
|
||||
{
|
||||
PnP_AudioDevice* list_node;
|
||||
|
||||
|
@ -30,23 +32,23 @@ ServiceControlHandler(
|
|||
LPVOID lpEventData,
|
||||
LPVOID lpContext)
|
||||
{
|
||||
switch ( dwControl )
|
||||
switch (dwControl)
|
||||
{
|
||||
case SERVICE_CONTROL_INTERROGATE :
|
||||
{
|
||||
logmsg("* Interrogation\n");
|
||||
DPRINT("* Interrogation\n");
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
case SERVICE_CONTROL_STOP :
|
||||
case SERVICE_CONTROL_SHUTDOWN :
|
||||
{
|
||||
logmsg("* Service Stop/Shutdown request received\n");
|
||||
DPRINT("* Service Stop/Shutdown request received\n");
|
||||
|
||||
logmsg("Unregistering device notifications\n");
|
||||
DPRINT("Unregistering device notifications\n");
|
||||
UnregisterDeviceNotifications();
|
||||
|
||||
logmsg("Destroying audio device list\n");
|
||||
DPRINT("Destroying audio device list\n");
|
||||
DestroyAudioDeviceList();
|
||||
|
||||
service_status.dwCurrentState = SERVICE_STOP_PENDING;
|
||||
|
@ -57,14 +59,14 @@ ServiceControlHandler(
|
|||
|
||||
SetServiceStatus(service_status_handle, &service_status);
|
||||
|
||||
logmsg("* Service stopped\n");
|
||||
DPRINT("* Service stopped\n");
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
case SERVICE_CONTROL_DEVICEEVENT :
|
||||
{
|
||||
logmsg("* Device Event\n");
|
||||
DPRINT("* Device Event\n");
|
||||
return HandleDeviceEvent(dwEventType, lpEventData);
|
||||
}
|
||||
|
||||
|
@ -78,16 +80,16 @@ ServiceControlHandler(
|
|||
VOID CALLBACK
|
||||
ServiceMain(DWORD argc, LPWSTR argv)
|
||||
{
|
||||
logmsg("* Service starting\n");
|
||||
logmsg("Registering service control handler...\n");
|
||||
DPRINT("* Service starting\n");
|
||||
DPRINT("Registering service control handler\n");
|
||||
service_status_handle = RegisterServiceCtrlHandlerExW(SERVICE_NAME,
|
||||
ServiceControlHandler,
|
||||
NULL);
|
||||
|
||||
logmsg("Service status handle %d\n", service_status_handle);
|
||||
if ( ! service_status_handle )
|
||||
DPRINT("Service status handle %d\n", service_status_handle);
|
||||
if (!service_status_handle)
|
||||
{
|
||||
logmsg("Failed to register service control handler\n");
|
||||
DPRINT("Failed to register service control handler\n");
|
||||
/* FIXME - we should fail */
|
||||
}
|
||||
|
||||
|
@ -103,23 +105,23 @@ ServiceMain(DWORD argc, LPWSTR argv)
|
|||
service_status.dwCurrentState = SERVICE_START_PENDING;
|
||||
SetServiceStatus(service_status_handle, &service_status);
|
||||
|
||||
logmsg("Creating audio device list\n");
|
||||
DPRINT("Creating audio device list\n");
|
||||
/* This creates the audio device list and mutex */
|
||||
if ( ! CreateAudioDeviceList(AUDIO_LIST_MAX_SIZE) )
|
||||
if (!CreateAudioDeviceList(AUDIO_LIST_MAX_SIZE))
|
||||
{
|
||||
logmsg("Failed to create audio device list\n");
|
||||
DPRINT("Failed to create audio device list\n");
|
||||
service_status.dwCurrentState = SERVICE_STOPPED;
|
||||
service_status.dwWin32ExitCode = -1;
|
||||
SetServiceStatus(service_status_handle, &service_status);
|
||||
return;
|
||||
}
|
||||
|
||||
logmsg("Registering for device notifications\n");
|
||||
DPRINT("Registering for device notifications\n");
|
||||
/* We want to know when devices are added/removed */
|
||||
if ( ! RegisterForDeviceNotifications() )
|
||||
if (!RegisterForDeviceNotifications())
|
||||
{
|
||||
/* FIXME: This is not fatal at present as ROS does not support this */
|
||||
logmsg("Failed to register for device notifications\n");
|
||||
DPRINT("Failed to register for device notifications\n");
|
||||
/*
|
||||
DestroyAudioDeviceList();
|
||||
|
||||
|
@ -132,14 +134,13 @@ ServiceMain(DWORD argc, LPWSTR argv)
|
|||
/* start system audio services */
|
||||
StartSystemAudioServices();
|
||||
|
||||
|
||||
InitializeFakeDevice();
|
||||
|
||||
logmsg("Processing existing devices\n");
|
||||
DPRINT("Processing existing devices\n");
|
||||
/* Now find any devices that already exist on the system */
|
||||
if ( ! ProcessExistingDevices() )
|
||||
if (!ProcessExistingDevices())
|
||||
{
|
||||
logmsg("Could not process existing devices\n");
|
||||
DPRINT("Could not process existing devices\n");
|
||||
UnregisterDeviceNotifications();
|
||||
DestroyAudioDeviceList();
|
||||
|
||||
|
@ -149,14 +150,14 @@ ServiceMain(DWORD argc, LPWSTR argv)
|
|||
return;
|
||||
}
|
||||
|
||||
logmsg("* Service started\n");
|
||||
DPRINT("* Service started\n");
|
||||
/* Tell SCM we are now running, and we may be stopped */
|
||||
service_status.dwCurrentState = SERVICE_RUNNING;
|
||||
service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;
|
||||
SetServiceStatus(service_status_handle, &service_status);
|
||||
}
|
||||
|
||||
int wmain()
|
||||
int wmain(VOID)
|
||||
{
|
||||
SERVICE_TABLE_ENTRYW service_table[] =
|
||||
{
|
||||
|
@ -164,9 +165,9 @@ int wmain()
|
|||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
logmsg("Audio Service main()\n");
|
||||
DPRINT("Audio Service main()\n");
|
||||
if (!StartServiceCtrlDispatcherW(service_table))
|
||||
logmsg("StartServiceCtrlDispatcher failed\n");
|
||||
DPRINT("StartServiceCtrlDispatcher failed\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
/*
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/services/audiosrv/pnp.c
|
||||
* PURPOSE: Audio Service Plug and Play
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Audio Service Plug and Play
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
*/
|
||||
|
||||
#include "audiosrv.h"
|
||||
|
@ -15,6 +14,9 @@
|
|||
#include <ks.h>
|
||||
#include <ksmedia.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
static HDEVNOTIFY device_notification_handle = NULL;
|
||||
|
||||
/*
|
||||
|
@ -23,7 +25,7 @@ static HDEVNOTIFY device_notification_handle = NULL;
|
|||
*/
|
||||
|
||||
BOOL
|
||||
ProcessExistingDevices()
|
||||
ProcessExistingDevices(VOID)
|
||||
{
|
||||
SP_DEVICE_INTERFACE_DATA interface_data;
|
||||
SP_DEVINFO_DATA device_data;
|
||||
|
@ -42,8 +44,6 @@ ProcessExistingDevices()
|
|||
NULL,
|
||||
NULL);
|
||||
|
||||
/* printf("%s:\n", ClassString); */
|
||||
|
||||
interface_data.cbSize = sizeof(interface_data);
|
||||
interface_data.Reserved = 0;
|
||||
|
||||
|
@ -60,7 +60,7 @@ ProcessExistingDevices()
|
|||
|
||||
if ( ! detail_data )
|
||||
{
|
||||
logmsg("ProcessExistingDevices() failed to allocate detail_data\n");
|
||||
DPRINT("failed to allocate detail_data\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ ProcessDeviceArrival(DEV_BROADCAST_DEVICEINTERFACE* device)
|
|||
*/
|
||||
|
||||
BOOL
|
||||
RegisterForDeviceNotifications()
|
||||
RegisterForDeviceNotifications(VOID)
|
||||
{
|
||||
DEV_BROADCAST_DEVICEINTERFACE notification_filter;
|
||||
|
||||
|
@ -141,10 +141,9 @@ RegisterForDeviceNotifications()
|
|||
DEVICE_NOTIFY_SERVICE_HANDLE
|
||||
/* |
|
||||
DEVICE_NOTIFY_ALL_INTERFACE_CLASSES*/);
|
||||
|
||||
if ( ! device_notification_handle )
|
||||
if (!device_notification_handle)
|
||||
{
|
||||
logmsg("RegisterDeviceNotification() failed with error %d\n", GetLastError());
|
||||
DPRINT("failed with error %d\n", GetLastError());
|
||||
}
|
||||
|
||||
return ( device_notification_handle != NULL );
|
||||
|
@ -156,11 +155,12 @@ RegisterForDeviceNotifications()
|
|||
called.
|
||||
*/
|
||||
|
||||
VOID UnregisterDeviceNotifications()
|
||||
VOID
|
||||
UnregisterDeviceNotifications(VOID)
|
||||
{
|
||||
/* TODO -- NOT IMPLEMENTED! */
|
||||
|
||||
if ( device_notification_handle )
|
||||
if (device_notification_handle)
|
||||
{
|
||||
/* TODO */
|
||||
device_notification_handle = NULL;
|
||||
|
@ -177,12 +177,12 @@ HandleDeviceEvent(
|
|||
DWORD dwEventType,
|
||||
LPVOID lpEventData)
|
||||
{
|
||||
switch ( dwEventType )
|
||||
switch (dwEventType)
|
||||
{
|
||||
case DBT_DEVICEARRIVAL :
|
||||
case DBT_DEVICEARRIVAL:
|
||||
{
|
||||
DEV_BROADCAST_DEVICEINTERFACE* incoming_device =
|
||||
(DEV_BROADCAST_DEVICEINTERFACE*) lpEventData;
|
||||
(DEV_BROADCAST_DEVICEINTERFACE*)lpEventData;
|
||||
|
||||
return ProcessDeviceArrival(incoming_device);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
/*
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/services/audiosrv/pnp_list_lock.c
|
||||
* PURPOSE: Audio Service Plug and Play list locking mechanism
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Audio Service Plug and Play list locking mechanism
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
*/
|
||||
|
||||
#include "audiosrv.h"
|
||||
|
@ -13,7 +12,7 @@
|
|||
static HANDLE audio_device_list_lock = NULL;
|
||||
|
||||
BOOL
|
||||
InitializeAudioDeviceListLock()
|
||||
InitializeAudioDeviceListLock(VOID)
|
||||
{
|
||||
/* The security stuff is to make sure the mutex can be grabbed by
|
||||
other processes - is this the best idea though ??? */
|
||||
|
@ -32,27 +31,26 @@ InitializeAudioDeviceListLock()
|
|||
FALSE,
|
||||
AUDIO_LIST_LOCK_NAME);
|
||||
|
||||
return ( audio_device_list_lock != NULL );
|
||||
return (audio_device_list_lock != NULL);
|
||||
}
|
||||
|
||||
VOID
|
||||
KillAudioDeviceListLock()
|
||||
KillAudioDeviceListLock(VOID)
|
||||
{
|
||||
CloseHandle(audio_device_list_lock);
|
||||
audio_device_list_lock = NULL;
|
||||
}
|
||||
|
||||
VOID
|
||||
LockAudioDeviceList()
|
||||
LockAudioDeviceList(VOID)
|
||||
{
|
||||
assert( audio_device_list_lock != NULL );
|
||||
assert(audio_device_list_lock != NULL);
|
||||
WaitForSingleObject(audio_device_list_lock, INFINITE);
|
||||
}
|
||||
|
||||
VOID
|
||||
UnlockAudioDeviceList()
|
||||
UnlockAudioDeviceList(VOID)
|
||||
{
|
||||
assert( audio_device_list_lock != NULL );
|
||||
assert(audio_device_list_lock != NULL);
|
||||
ReleaseMutex(audio_device_list_lock);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
/*
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/services/audiosrv/pnp_list_manager.c
|
||||
* PURPOSE: Audio Service List Manager
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Audio Service List Manager
|
||||
* COPYRIGHT: Copyright 2007 Andrew Greenwood
|
||||
*/
|
||||
|
||||
#include "audiosrv.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/*
|
||||
Device descriptor
|
||||
*/
|
||||
|
@ -20,13 +22,10 @@ CreateDeviceDescriptor(WCHAR* path, BOOL is_enabled)
|
|||
int path_length = WideStringSize(path);
|
||||
int size = sizeof(PnP_AudioDevice) + path_length;
|
||||
|
||||
/* printf("path_length %d, total %d\n", path_length, size);*/
|
||||
|
||||
device = malloc(size);
|
||||
|
||||
if ( ! device )
|
||||
if (! device)
|
||||
{
|
||||
logmsg("Failed to create a device descriptor (malloc fail)\n");
|
||||
DPRINT("Failed to malloc device descriptor\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -65,18 +64,13 @@ AppendAudioDeviceToList(PnP_AudioDevice* device)
|
|||
|
||||
LockAudioDeviceList();
|
||||
|
||||
/*
|
||||
printf("list size is %d\n", audio_device_list->size);
|
||||
printf("device info size is %d bytes\n", device_info_size);
|
||||
*/
|
||||
|
||||
/* We DON'T want to overshoot the end of the buffer! */
|
||||
if ( audio_device_list->size + device_info_size > audio_device_list->max_size )
|
||||
if (audio_device_list->size + device_info_size > audio_device_list->max_size)
|
||||
{
|
||||
/*printf("max_size would be exceeded! Failing...\n");*/
|
||||
|
||||
/*DPRINT("failed, max_size would be exceeded\n");*/
|
||||
|
||||
UnlockAudioDeviceList();
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -91,7 +85,7 @@ AppendAudioDeviceToList(PnP_AudioDevice* device)
|
|||
|
||||
UnlockAudioDeviceList();
|
||||
|
||||
logmsg("Device added to list\n");
|
||||
DPRINT("Device added to list\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -99,11 +93,9 @@ AppendAudioDeviceToList(PnP_AudioDevice* device)
|
|||
BOOL
|
||||
CreateAudioDeviceList(DWORD max_size)
|
||||
{
|
||||
/* printf("Initializing memory device list lock\n");*/
|
||||
|
||||
if ( ! InitializeAudioDeviceListLock() )
|
||||
if (!InitializeAudioDeviceListLock())
|
||||
{
|
||||
/*printf("Failed!\n");*/
|
||||
/*DPRINT("Failed\n");*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -112,7 +104,7 @@ CreateAudioDeviceList(DWORD max_size)
|
|||
turning up before we're ready... */
|
||||
LockAudioDeviceList();
|
||||
|
||||
logmsg("Creating file mapping\n");
|
||||
DPRINT("Creating file mapping\n");
|
||||
/* Expose our device list to the world */
|
||||
device_list_file = CreateFileMappingW(INVALID_HANDLE_VALUE,
|
||||
NULL,
|
||||
|
@ -120,10 +112,9 @@ CreateAudioDeviceList(DWORD max_size)
|
|||
0,
|
||||
max_size,
|
||||
AUDIO_LIST_NAME);
|
||||
|
||||
if ( ! device_list_file )
|
||||
if (!device_list_file)
|
||||
{
|
||||
logmsg("Creation of audio device list failed (err %d)\n", GetLastError());
|
||||
DPRINT("Creation of audio device list failed (err %d)\n", GetLastError());
|
||||
|
||||
UnlockAudioDeviceList();
|
||||
KillAudioDeviceListLock();
|
||||
|
@ -131,17 +122,16 @@ CreateAudioDeviceList(DWORD max_size)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
logmsg("Mapping view of file\n");
|
||||
DPRINT("Mapping view of file\n");
|
||||
/* Of course, we'll need to access the list ourselves */
|
||||
audio_device_list = MapViewOfFile(device_list_file,
|
||||
FILE_MAP_WRITE,
|
||||
0,
|
||||
0,
|
||||
max_size);
|
||||
|
||||
if ( ! audio_device_list )
|
||||
if (!audio_device_list)
|
||||
{
|
||||
logmsg("MapViewOfFile FAILED (err %d)\n", GetLastError());
|
||||
DPRINT("MapViewOfFile FAILED (err %d)\n", GetLastError());
|
||||
|
||||
CloseHandle(device_list_file);
|
||||
device_list_file = NULL;
|
||||
|
@ -162,28 +152,28 @@ CreateAudioDeviceList(DWORD max_size)
|
|||
|
||||
UnlockAudioDeviceList();
|
||||
|
||||
logmsg("Device list created\n");
|
||||
DPRINT("Device list created\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID
|
||||
DestroyAudioDeviceList()
|
||||
DestroyAudioDeviceList(VOID)
|
||||
{
|
||||
logmsg("Destroying device list\n");
|
||||
DPRINT("Destroying device list\n");
|
||||
|
||||
LockAudioDeviceList();
|
||||
|
||||
/*printf("Unmapping view\n");*/
|
||||
/*DPRINT("Unmapping view\n");*/
|
||||
UnmapViewOfFile(audio_device_list);
|
||||
audio_device_list = NULL;
|
||||
|
||||
/*printf("Closing memory mapped file\n");*/
|
||||
/*DPRINT("Closing memory mapped file\n");*/
|
||||
CloseHandle(device_list_file);
|
||||
device_list_file = NULL;
|
||||
|
||||
UnlockAudioDeviceList();
|
||||
|
||||
/*printf("Killing devlist lock\n");*/
|
||||
/*DPRINT("Killing devlist lock\n");*/
|
||||
KillAudioDeviceListLock();
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
/*
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/services/audiosrv/services.c
|
||||
* PURPOSE: Audio Service Plug and Play
|
||||
* COPYRIGHT: Copyright 2009 Johannes Anderwald
|
||||
* PROJECT: ReactOS
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* PURPOSE: Audio Service Plug and Play
|
||||
* COPYRIGHT: Copyright 2009 Johannes Anderwald
|
||||
*/
|
||||
|
||||
#include "audiosrv.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
BOOL
|
||||
WaitForService(
|
||||
SC_HANDLE hService,
|
||||
|
@ -21,7 +23,7 @@ WaitForService(
|
|||
{
|
||||
if (!QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)&Info, sizeof(SERVICE_STATUS_PROCESS), &dwSize))
|
||||
{
|
||||
logmsg("QueryServiceStatusEx failed %x\n", GetLastError());
|
||||
DPRINT("QueryServiceStatusEx failed %x\n", GetLastError());
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -30,9 +32,9 @@ WaitForService(
|
|||
|
||||
Sleep(1000);
|
||||
|
||||
}while(Index++ < RetryCount);
|
||||
} while (Index++ < RetryCount);
|
||||
|
||||
logmsg("Timeout while waiting for service to become ready %p\n", hService);
|
||||
DPRINT("Timeout while waiting for service to become ready %p\n", hService);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -47,16 +49,15 @@ StartAudioService(
|
|||
BOOL ret;
|
||||
|
||||
hService = OpenService(hSCManager, ServiceName, SERVICE_ALL_ACCESS);
|
||||
|
||||
if (!hService)
|
||||
{
|
||||
logmsg("Failed to open service %S %x\n", ServiceName, GetLastError());
|
||||
DPRINT("Failed to open service %S %x\n", ServiceName, GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!StartService(hService, 0, NULL))
|
||||
{
|
||||
logmsg("Failed to start service %S %x\n", ServiceName, GetLastError());
|
||||
DPRINT("Failed to start service %S %x\n", ServiceName, GetLastError());
|
||||
CloseServiceHandle(hService);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -67,39 +68,25 @@ StartAudioService(
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
BOOL
|
||||
StartSystemAudioServices()
|
||||
StartSystemAudioServices(VOID)
|
||||
{
|
||||
SC_HANDLE hSCManager;
|
||||
|
||||
logmsg("Starting system audio services\n");
|
||||
DPRINT("Starting system audio services\n");
|
||||
|
||||
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
|
||||
if (!hSCManager)
|
||||
{
|
||||
logmsg("Failed to open service manager %x\n", GetLastError());
|
||||
DPRINT("Failed to open service manager %x\n", GetLastError());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
logmsg("Starting sysaudio service\n");
|
||||
DPRINT("Starting sysaudio service\n");
|
||||
StartAudioService(hSCManager, L"sysaudio", 20);
|
||||
logmsg("Starting wdmaud service\n");
|
||||
DPRINT("Starting wdmaud service\n");
|
||||
StartAudioService(hSCManager, L"wdmaud", 20);
|
||||
|
||||
CloseServiceHandle(hSCManager);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1477,14 +1477,14 @@ HKLM,"SYSTEM\CurrentControlSet\Services\swenum","Start",0x00010001,0x00000000
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\swenum","Type",0x00010001,0x00000001
|
||||
|
||||
; Audio Service
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","DisplayName",0x00000000,%AUDIO_SERVICE%
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Description",0x00000000,%AUDIO_SERVICE_DESCRIPTION%
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Group",0x00000000,"Audio"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ImagePath",0x00020000,"%SystemRoot%\system32\audiosrv.exe"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","ObjectName",0x00000000,"LocalSystem"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Start",0x00010001,0x00000003
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\RosAudioSrv","Type",0x00010001,0x00000010
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\AudioSrv","DisplayName",0x00000000,%AUDIO_SERVICE%
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\AudioSrv","Description",0x00000000,%AUDIO_SERVICE_DESCRIPTION%
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\AudioSrv","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\AudioSrv","Group",0x00000000,"Audio"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\AudioSrv","ImagePath",0x00020000,"%SystemRoot%\system32\audiosrv.exe"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\AudioSrv","ObjectName",0x00000000,"LocalSystem"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\AudioSrv","Start",0x00010001,0x00000003
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\AudioSrv","Type",0x00010001,0x00000010
|
||||
|
||||
; Background Intelligent Transfer Service (BITS)
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\BITS","DisplayName",0x00000000,%BITS_SERVICE%
|
||||
|
|
|
@ -553,10 +553,10 @@ MMSYS_InstallDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
|
|||
return ERROR_DI_DO_DEFAULT;
|
||||
}
|
||||
|
||||
hService = OpenService(hSCManager, L"RosAudioSrv", SERVICE_ALL_ACCESS);
|
||||
hService = OpenService(hSCManager, L"AudioSrv", SERVICE_ALL_ACCESS);
|
||||
if (hService)
|
||||
{
|
||||
/* Make RosAudioSrv start automatically */
|
||||
/* Make AudioSrv start automatically */
|
||||
ChangeServiceConfig(hService, SERVICE_NO_CHANGE, SERVICE_AUTO_START, SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
StartService(hService, 0, NULL);
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
#ifndef AUDIOSRV_H
|
||||
#define AUDIOSRV_H
|
||||
|
||||
/* This is currently set to avoid conflicting service names in Windows! */
|
||||
#define SERVICE_NAME L"RosAudioSrv"
|
||||
/* The service name */
|
||||
#define SERVICE_NAME L"AudioSrv"
|
||||
|
||||
/* A named mutex is used for synchronizing access to the device list.
|
||||
If this mutex doesn't exist, it means the audio service isn't running. */
|
||||
|
|
Loading…
Reference in a new issue