- Change service type of RosAudioSrv to automatically start when an audio adapter is installed

- Also start RosAudioSrv

svn path=/trunk/; revision=39776
This commit is contained in:
Johannes Anderwald 2009-02-26 19:15:35 +00:00
parent 586e8ccb95
commit be75d0f7aa

View file

@ -165,6 +165,7 @@ MMSYS_InstallDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
HINF hInf;
PVOID Context;
BOOL Result;
SC_HANDLE hSCManager, hService;
if (!IsEqualIID(&pspDevInfoData->ClassGuid, &GUID_DEVCLASS_SOUND) &&
!IsEqualIID(&pspDevInfoData->ClassGuid, &GUID_DEVCLASS_MEDIA))
@ -223,6 +224,25 @@ MMSYS_InstallDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
SetupTermDefaultQueueCallback(Context);
SetupCloseInfFile(hInf);
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT);
if (!hSCManager)
{
return ERROR_DI_DO_DEFAULT;
}
hService = OpenService(hSCManager, L"RosAudioSrv", SERVICE_ALL_ACCESS);
if (hService)
{
/* make RosAudioSrv start automatically */
ChangeServiceConfig(hService, SERVICE_NO_CHANGE, SERVICE_AUTO_START, SERVICE_NO_CHANGE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
StartService(hService, 0, NULL);
CloseServiceHandle(hService);
}
CloseServiceHandle(hSCManager);
return ERROR_DI_DO_DEFAULT;
}