- Start automatically sysaudio / wdmaud when audiosrv is started

svn path=/trunk/; revision=39775
This commit is contained in:
Johannes Anderwald 2009-02-26 18:29:15 +00:00
parent 61efbfa491
commit 586e8ccb95
4 changed files with 85 additions and 0 deletions

View file

@ -51,6 +51,8 @@ HandleDeviceEvent(
DWORD dwEventType,
LPVOID lpEventData);
BOOL
StartSystemAudioServices();
/* Debugging */

View file

@ -10,6 +10,7 @@
<file>pnp_list_manager.c</file>
<file>pnp_list_lock.c</file>
<file>pnp.c</file>
<file>services.c</file>
<file>debug.c</file>
<file>audiosrv.rc</file>
</module>

View file

@ -132,6 +132,9 @@ ServiceMain(DWORD argc, LPWSTR argv)
return;
*/
}
/* start system audio services */
StartSystemAudioServices();
InitializeFakeDevice();

View file

@ -0,0 +1,79 @@
/*
* 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
*/
#include <windows.h>
#include <winuser.h>
#include <dbt.h>
#include <setupapi.h>
#include <ks.h>
#include <ksmedia.h>
#include <audiosrv/audiosrv.h>
#include "audiosrv.h"
BOOL
StartSystemAudioServices()
{
SC_HANDLE hSCManager, hService;
logmsg("Starting system audio services\n");
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
if (!hSCManager)
{
logmsg("Failed to open service manager\n");
return FALSE;
}
hService = OpenService(hSCManager, L"sysaudio", SERVICE_ALL_ACCESS);
if (hService)
{
if (!StartService(hService, 0, NULL))
{
logmsg("Failed to start sysaudio service\n");
CloseServiceHandle(hService);
CloseServiceHandle(hSCManager);
return FALSE;
}
CloseServiceHandle(hService);
logmsg("Sysaudio service started\n");
// FIXME
// wait untill service is started
}
hService = OpenService(hSCManager, L"wdmaud", SERVICE_ALL_ACCESS);
if (hService)
{
if (!StartService(hService, 0, NULL))
{
logmsg("Failed to start sysaudio service\n");
CloseServiceHandle(hService);
CloseServiceHandle(hSCManager);
return FALSE;
}
CloseServiceHandle(hService);
logmsg("Wdmaud service started\n");
}
CloseServiceHandle(hSCManager);
return TRUE;
}