mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
- use correct name when registering.
- use unicode apis exclusively when required. - fix rbuild file svn path=/trunk/; revision=29117
This commit is contained in:
parent
5baee1e5ab
commit
b862010a64
5 changed files with 45 additions and 58 deletions
|
@ -15,19 +15,6 @@
|
||||||
extern SERVICE_STATUS_HANDLE service_status_handle;
|
extern SERVICE_STATUS_HANDLE service_status_handle;
|
||||||
|
|
||||||
|
|
||||||
/* main.c */
|
|
||||||
|
|
||||||
VOID CALLBACK
|
|
||||||
ServiceMain(DWORD argc, char** argv);
|
|
||||||
|
|
||||||
DWORD WINAPI
|
|
||||||
ServiceControlHandler(
|
|
||||||
DWORD dwControl,
|
|
||||||
DWORD dwEventType,
|
|
||||||
LPVOID lpEventData,
|
|
||||||
LPVOID lpContext);
|
|
||||||
|
|
||||||
|
|
||||||
/* List management (pnp_list_manager.c) */
|
/* List management (pnp_list_manager.c) */
|
||||||
|
|
||||||
VOID*
|
VOID*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<module name="audiosrv" type="win32cui" installbase="system32"
|
<?xml version="1.0"?>
|
||||||
installname="audiosrv.exe" allowwarnings="true">
|
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||||
|
<module name="audiosrv" type="win32cui" installbase="system32" installname="audiosrv.exe" unicode="yes" allowwarnings="true">
|
||||||
<include base="audiosrv">.</include>
|
<include base="audiosrv">.</include>
|
||||||
<define name="UNICODE" />
|
|
||||||
<define name="__USE_W32API" />
|
<define name="__USE_W32API" />
|
||||||
<define name="__REACTOS__" />
|
<define name="__REACTOS__" />
|
||||||
<define name="_WIN32_WINNT">0x0501</define>
|
<define name="_WIN32_WINNT">0x0501</define>
|
||||||
|
@ -9,6 +9,7 @@ installname="audiosrv.exe" allowwarnings="true">
|
||||||
<library>kernel32</library>
|
<library>kernel32</library>
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>user32</library>
|
<library>user32</library>
|
||||||
|
<library>ntdll</library>
|
||||||
<library>setupapi</library>
|
<library>setupapi</library>
|
||||||
<file>main.c</file>
|
<file>main.c</file>
|
||||||
<file>pnp_list_manager.c</file>
|
<file>pnp_list_manager.c</file>
|
||||||
|
|
|
@ -11,15 +11,6 @@
|
||||||
#include <audiosrv/audiosrv.h>
|
#include <audiosrv/audiosrv.h>
|
||||||
#include "audiosrv.h"
|
#include "audiosrv.h"
|
||||||
|
|
||||||
|
|
||||||
/* Service table */
|
|
||||||
|
|
||||||
SERVICE_TABLE_ENTRY service_table[2] =
|
|
||||||
{
|
|
||||||
{ L"AudioSrv", (LPSERVICE_MAIN_FUNCTION) ServiceMain },
|
|
||||||
{ NULL, NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
SERVICE_STATUS_HANDLE service_status_handle;
|
SERVICE_STATUS_HANDLE service_status_handle;
|
||||||
SERVICE_STATUS service_status;
|
SERVICE_STATUS service_status;
|
||||||
|
|
||||||
|
@ -88,13 +79,13 @@ ServiceControlHandler(
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID CALLBACK
|
VOID CALLBACK
|
||||||
ServiceMain(DWORD argc, char** argv)
|
ServiceMain(DWORD argc, LPWSTR argv)
|
||||||
{
|
{
|
||||||
logmsg("* Service starting\n");
|
logmsg("* Service starting\n");
|
||||||
logmsg("Registering service control handler...\n");
|
logmsg("Registering service control handler...\n");
|
||||||
service_status_handle = RegisterServiceCtrlHandlerEx(SERVICE_NAME,
|
service_status_handle = RegisterServiceCtrlHandlerExW(SERVICE_NAME,
|
||||||
ServiceControlHandler,
|
ServiceControlHandler,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
logmsg("Service status handle %d\n", service_status_handle);
|
logmsg("Service status handle %d\n", service_status_handle);
|
||||||
if ( ! service_status_handle )
|
if ( ! service_status_handle )
|
||||||
|
@ -165,9 +156,17 @@ ServiceMain(DWORD argc, char** argv)
|
||||||
SetServiceStatus(service_status_handle, &service_status);
|
SetServiceStatus(service_status_handle, &service_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int wmain()
|
||||||
{
|
{
|
||||||
|
SERVICE_TABLE_ENTRYW service_table[] =
|
||||||
|
{
|
||||||
|
{ SERVICE_NAME, (LPSERVICE_MAIN_FUNCTIONW) ServiceMain },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
logmsg("Audio Service main()\n");
|
logmsg("Audio Service main()\n");
|
||||||
StartServiceCtrlDispatcher(service_table);
|
if (!StartServiceCtrlDispatcherW(service_table))
|
||||||
|
logmsg("StartServiceCtrlDispatcher failed\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,20 +30,20 @@ ProcessExistingDevices()
|
||||||
{
|
{
|
||||||
SP_DEVICE_INTERFACE_DATA interface_data;
|
SP_DEVICE_INTERFACE_DATA interface_data;
|
||||||
SP_DEVINFO_DATA device_data;
|
SP_DEVINFO_DATA device_data;
|
||||||
PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data;
|
PSP_DEVICE_INTERFACE_DETAIL_DATA_W detail_data;
|
||||||
HDEVINFO dev_info;
|
HDEVINFO dev_info;
|
||||||
DWORD length;
|
DWORD length;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
const GUID category_guid = {STATIC_KSCATEGORY_AUDIO};
|
const GUID category_guid = {STATIC_KSCATEGORY_AUDIO};
|
||||||
|
|
||||||
dev_info = SetupDiGetClassDevsEx(&category_guid,
|
dev_info = SetupDiGetClassDevsExW(&category_guid,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
DIGCF_PRESENT | DIGCF_DEVICEINTERFACE,
|
DIGCF_PRESENT | DIGCF_DEVICEINTERFACE,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* printf("%s:\n", ClassString); */
|
/* printf("%s:\n", ClassString); */
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ ProcessExistingDevices()
|
||||||
+ (MAX_PATH * sizeof(WCHAR));
|
+ (MAX_PATH * sizeof(WCHAR));
|
||||||
|
|
||||||
detail_data =
|
detail_data =
|
||||||
(PSP_DEVICE_INTERFACE_DETAIL_DATA)HeapAlloc(GetProcessHeap(),
|
(PSP_DEVICE_INTERFACE_DETAIL_DATA_W)HeapAlloc(GetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
length);
|
length);
|
||||||
|
|
||||||
while (
|
while (
|
||||||
SetupDiEnumDeviceInterfaces(dev_info,
|
SetupDiEnumDeviceInterfaces(dev_info,
|
||||||
|
@ -73,15 +73,15 @@ ProcessExistingDevices()
|
||||||
ZeroMemory(detail_data, length);
|
ZeroMemory(detail_data, length);
|
||||||
|
|
||||||
/* NOTE: We don't actually use device_data... */
|
/* NOTE: We don't actually use device_data... */
|
||||||
detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
|
detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W);
|
||||||
device_data.cbSize = sizeof(device_data);
|
device_data.cbSize = sizeof(device_data);
|
||||||
device_data.Reserved = 0;
|
device_data.Reserved = 0;
|
||||||
SetupDiGetDeviceInterfaceDetail(dev_info,
|
SetupDiGetDeviceInterfaceDetailW(dev_info,
|
||||||
&interface_data,
|
&interface_data,
|
||||||
detail_data,
|
detail_data,
|
||||||
length,
|
length,
|
||||||
NULL,
|
NULL,
|
||||||
&device_data);
|
&device_data);
|
||||||
|
|
||||||
list_node = CreateDeviceDescriptor(detail_data->DevicePath, TRUE);
|
list_node = CreateDeviceDescriptor(detail_data->DevicePath, TRUE);
|
||||||
AppendAudioDeviceToList(list_node);
|
AppendAudioDeviceToList(list_node);
|
||||||
|
@ -133,9 +133,9 @@ RegisterForDeviceNotifications()
|
||||||
notification_filter.dbcc_classguid = wdmaud_guid;
|
notification_filter.dbcc_classguid = wdmaud_guid;
|
||||||
|
|
||||||
device_notification_handle =
|
device_notification_handle =
|
||||||
RegisterDeviceNotification((HANDLE) service_status_handle,
|
RegisterDeviceNotificationW((HANDLE) service_status_handle,
|
||||||
¬ification_filter,
|
¬ification_filter,
|
||||||
DEVICE_NOTIFY_SERVICE_HANDLE
|
DEVICE_NOTIFY_SERVICE_HANDLE
|
||||||
/* |
|
/* |
|
||||||
DEVICE_NOTIFY_ALL_INTERFACE_CLASSES*/);
|
DEVICE_NOTIFY_ALL_INTERFACE_CLASSES*/);
|
||||||
|
|
||||||
|
|
|
@ -114,12 +114,12 @@ CreateAudioDeviceList(DWORD max_size)
|
||||||
|
|
||||||
logmsg("Creating file mapping\n");
|
logmsg("Creating file mapping\n");
|
||||||
/* Expose our device list to the world */
|
/* Expose our device list to the world */
|
||||||
device_list_file = CreateFileMapping(INVALID_HANDLE_VALUE,
|
device_list_file = CreateFileMappingW(INVALID_HANDLE_VALUE,
|
||||||
NULL,
|
NULL,
|
||||||
PAGE_READWRITE,
|
PAGE_READWRITE,
|
||||||
0,
|
0,
|
||||||
max_size,
|
max_size,
|
||||||
AUDIO_LIST_NAME);
|
AUDIO_LIST_NAME);
|
||||||
|
|
||||||
if ( ! device_list_file )
|
if ( ! device_list_file )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue