ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
windows_service.c File Reference

Go to the source code of this file.

Functions

bool windows_service_is_active (void)
void windows_service_ready (void)
int windows_service_dispatch (int argc, char **argv, int(*run)(int, char **), void(*stop)(void))

Function Documentation

◆ windows_service_dispatch()

int windows_service_dispatch ( int argc,
char ** argv,
int(* run )(int, char **),
void(* stop )(void) )

Definition at line 107 of file windows_service.c.

108 {
109 service_argc = argc;
110 service_argv = argv;
111 service_run = run;
112 service_stop = stop;
113 wchar_t service_name[] =
114 L""; // The SCM ignores this table name for own-process services.
115 const SERVICE_TABLE_ENTRYW table[] = {{service_name, service_main},
116 {NULL, NULL}};
117 if (!StartServiceCtrlDispatcherW(table)) {
118 DWORD error = GetLastError();
119 log_error("Cannot connect to the Windows Service Control Manager (Windows "
120 "error %lu)",
121 (unsigned long)error);
122 }
123 return service_exit_code;
124}
#define log_error(...)
Log an ERROR message.
Definition log/log.h:604

References log_error.

Referenced by main().

◆ windows_service_is_active()

bool windows_service_is_active ( void )

Definition at line 55 of file windows_service.c.

55{ return service_handle != NULL; }

Referenced by mcp_server_main(), and windows_service_ready().

◆ windows_service_ready()

void windows_service_ready ( void )

Definition at line 57 of file windows_service.c.

57 {
59 return;
60 AcquireSRWLockExclusive(&service_lock);
61 if (service_status.dwCurrentState == SERVICE_START_PENDING)
62 service_report(SERVICE_RUNNING, 0);
63 ReleaseSRWLockExclusive(&service_lock);
64}
bool windows_service_is_active(void)

References windows_service_is_active().

Referenced by api_server_main(), and mcp_http_run().