daemon: Add support for running as a service on win32

* Minimal implementation of --system on win32.
* Wrap main with a Windows Service on win32 (with a fallback to
  running it directly).
* Update PA_SYSTEM_{RUNTIME,STATE,CONFIG}_PATH and HOME dynamically
  on Windows (overrides the build config, similar to the existing
  config path replacement logic).

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/549>
This commit is contained in:
Patrick Gaskin 2021-05-30 15:28:30 -04:00 committed by PulseAudio Marge Bot
parent 87b4d68978
commit 4f3ca10d9e
4 changed files with 151 additions and 1 deletions

View file

@ -1035,7 +1035,14 @@ int pa_context_connect(
}
/* The system wide instance via PF_LOCAL */
#ifndef OS_IS_WIN32
c->server_list = pa_strlist_prepend(c->server_list, PA_SYSTEM_RUNTIME_PATH PA_PATH_SEP PA_NATIVE_DEFAULT_UNIX_SOCKET);
#else
/* see change_user in src/daemon/main.c */
char *run_path = pa_sprintf_malloc("%s" PA_PATH_SEP "run" PA_PATH_SEP PA_NATIVE_DEFAULT_UNIX_SOCKET, pa_win32_get_system_appdata());
c->server_list = pa_strlist_prepend(c->server_list, run_path);
pa_xfree(run_path);
#endif
/* The user instance via PF_LOCAL */
c->server_list = prepend_per_user(c->server_list);