ReactOS 0.4.15-dev-8344-g0574987
main.c File Reference
#include "audiosrv.h"
#include <debug.h>
Include dependency graph for main.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID InitializeFakeDevice (VOID)
 
DWORD WINAPI ServiceControlHandler (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
 
VOID CALLBACK ServiceMain (DWORD argc, LPWSTR argv)
 
int wmain (VOID)
 

Variables

SERVICE_STATUS_HANDLE service_status_handle
 
SERVICE_STATUS service_status
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 10 of file main.c.

Function Documentation

◆ InitializeFakeDevice()

VOID InitializeFakeDevice ( VOID  )

Definition at line 19 of file main.c.

20{
21 PnP_AudioDevice* list_node;
22
23 list_node = CreateDeviceDescriptor(L"ThisDeviceDoesNotReallyExist", TRUE);
24 AppendAudioDeviceToList(list_node);
25 DestroyDeviceDescriptor(list_node);
26}
BOOL AppendAudioDeviceToList(PnP_AudioDevice *device)
#define DestroyDeviceDescriptor(descriptor)
Definition: audiosrv.h:30
VOID * CreateDeviceDescriptor(WCHAR *path, BOOL is_enabled)
#define TRUE
Definition: types.h:120
#define L(x)
Definition: ntvdm.h:50

Referenced by ServiceMain().

◆ ServiceControlHandler()

DWORD WINAPI ServiceControlHandler ( DWORD  dwControl,
DWORD  dwEventType,
LPVOID  lpEventData,
LPVOID  lpContext 
)

Definition at line 29 of file main.c.

34{
35 switch (dwControl)
36 {
38 {
39 DPRINT("* Interrogation\n");
40 return NO_ERROR;
41 }
42
45 {
46 DPRINT("* Service Stop/Shutdown request received\n");
47
48 DPRINT("Unregistering device notifications\n");
50
51 DPRINT("Destroying audio device list\n");
53
56
59
61
62 DPRINT("* Service stopped\n");
63
64 return NO_ERROR;
65 }
66
68 {
69 DPRINT("* Device Event\n");
70 return HandleDeviceEvent(dwEventType, lpEventData);
71 }
72
73 default :
75 };
76
77 /*SetServiceStatus(service_status_handle, &service_status);*/
78}
VOID UnregisterDeviceNotifications(VOID)
Definition: pnp.c:159
VOID DestroyAudioDeviceList(VOID)
DWORD HandleDeviceEvent(DWORD dwEventType, LPVOID lpEventData)
Definition: pnp.c:176
SERVICE_STATUS service_status
Definition: main.c:14
SERVICE_STATUS_HANDLE service_status_handle
Definition: main.c:13
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:997
#define DPRINT
Definition: sndvol32.h:73
DWORD dwWin32ExitCode
Definition: winsvc.h:102
DWORD dwCurrentState
Definition: winsvc.h:100
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_CONTROL_DEVICEEVENT
Definition: winsvc.h:46
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39

Referenced by ServiceMain().

◆ ServiceMain()

VOID CALLBACK ServiceMain ( DWORD  argc,
LPWSTR  argv 
)

Definition at line 81 of file main.c.

82{
83 DPRINT("* Service starting\n");
84 DPRINT("Registering service control handler\n");
87 NULL);
88
89 DPRINT("Service status handle %d\n", service_status_handle);
91 {
92 DPRINT("Failed to register service control handler\n");
93 /* FIXME - we should fail */
94 }
95
96 /* Set these to defaults */
103
104 /* Tell SCM we're starting */
107
108 DPRINT("Creating audio device list\n");
109 /* This creates the audio device list and mutex */
111 {
112 DPRINT("Failed to create audio device list\n");
116 return;
117 }
118
119 DPRINT("Registering for device notifications\n");
120 /* We want to know when devices are added/removed */
122 {
123 /* FIXME: This is not fatal at present as ROS does not support this */
124 DPRINT("Failed to register for device notifications\n");
125/*
126 DestroyAudioDeviceList();
127
128 service_status.dwCurrentState = SERVICE_STOPPED;
129 service_status.dwWin32ExitCode = -1;
130 SetServiceStatus(service_status_handle, &service_status);
131 return;
132*/
133 }
134 /* start system audio services */
136
138
139 DPRINT("Processing existing devices\n");
140 /* Now find any devices that already exist on the system */
142 {
143 DPRINT("Could not process existing devices\n");
146
150 return;
151 }
152
153 DPRINT("* Service started\n");
154 /* Tell SCM we are now running, and we may be stopped */
158}
BOOL RegisterForDeviceNotifications(VOID)
Definition: pnp.c:127
BOOL CreateAudioDeviceList(DWORD max_size)
BOOL StartSystemAudioServices(VOID)
Definition: services.c:72
BOOL ProcessExistingDevices(VOID)
Definition: pnp.c:28
DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: main.c:29
VOID InitializeFakeDevice(VOID)
Definition: main.c:19
#define NULL
Definition: types.h:112
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:812
#define AUDIO_LIST_MAX_SIZE
Definition: audiosrv.h:25
DWORD dwServiceType
Definition: winsvc.h:99
DWORD dwControlsAccepted
Definition: winsvc.h:101
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwCheckPoint
Definition: winsvc.h:104
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_NAME
Definition: wlansvc.c:18
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962

Referenced by ServiceStarter(), and wmain().

◆ wmain()

int wmain ( VOID  )

Definition at line 160 of file main.c.

161{
162 SERVICE_TABLE_ENTRYW service_table[] =
163 {
165 { NULL, NULL }
166 };
167
168 DPRINT("Audio Service main()\n");
169 if (!StartServiceCtrlDispatcherW(service_table))
170 DPRINT("StartServiceCtrlDispatcher failed\n");
171
172 return 0;
173}
VOID CALLBACK ServiceMain(DWORD argc, LPWSTR argv)
Definition: main.c:81
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
Definition: sctrl.c:1134
void(WINAPI * LPSERVICE_MAIN_FUNCTIONW)(DWORD, LPWSTR *)
Definition: winsvc.h:177

Variable Documentation

◆ service_status

SERVICE_STATUS service_status

Definition at line 14 of file main.c.

Referenced by ServiceControlHandler(), and ServiceMain().

◆ service_status_handle

SERVICE_STATUS_HANDLE service_status_handle

Definition at line 13 of file main.c.

Referenced by RegisterForDeviceNotifications(), ServiceControlHandler(), and ServiceMain().