mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Fix #612: create service with service.conf in present directory and
auto load it. git-svn-id: file:///svn/unbound/trunk@3232 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
829a93b01c
commit
00d9ede510
2 changed files with 20 additions and 2 deletions
|
|
@ -1,3 +1,8 @@
|
||||||
|
29 September 2014: Wouter
|
||||||
|
- Fix #612: create service with service.conf in present directory and
|
||||||
|
auto load it.
|
||||||
|
- Fix for mingw compile openssl ranlib.
|
||||||
|
|
||||||
25 September 2014: Wouter
|
25 September 2014: Wouter
|
||||||
- updated configure and aclocal with newer autoconf 1.13.
|
- updated configure and aclocal with newer autoconf 1.13.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -190,19 +190,32 @@ wsvc_install(FILE* out, const char* rename)
|
||||||
{
|
{
|
||||||
SC_HANDLE scm;
|
SC_HANDLE scm;
|
||||||
SC_HANDLE sv;
|
SC_HANDLE sv;
|
||||||
TCHAR path[MAX_PATH+2+256];
|
TCHAR path[2*MAX_PATH+4+256];
|
||||||
|
TCHAR path_config[2*MAX_PATH+4+256];
|
||||||
if(out) fprintf(out, "installing unbound service\n");
|
if(out) fprintf(out, "installing unbound service\n");
|
||||||
if(!GetModuleFileName(NULL, path+1, MAX_PATH))
|
if(!GetModuleFileName(NULL, path+1, MAX_PATH))
|
||||||
fatal_win(out, "could not GetModuleFileName");
|
fatal_win(out, "could not GetModuleFileName");
|
||||||
/* change 'unbound-service-install' to 'unbound' */
|
/* change 'unbound-service-install' to 'unbound' */
|
||||||
if(rename)
|
if(rename) {
|
||||||
change(out, path+1, sizeof(path)-1, rename, "unbound.exe");
|
change(out, path+1, sizeof(path)-1, rename, "unbound.exe");
|
||||||
|
memmove(path_config+1, path+1, sizeof(path)-1);
|
||||||
|
change(out, path_config+1, sizeof(path_config)-1,
|
||||||
|
"unbound.exe", "service.conf");
|
||||||
|
}
|
||||||
|
|
||||||
event_reg_install(out, path+1);
|
event_reg_install(out, path+1);
|
||||||
|
|
||||||
/* have to quote it because of spaces in directory names */
|
/* have to quote it because of spaces in directory names */
|
||||||
/* could append arguments to be sent to ServiceMain */
|
/* could append arguments to be sent to ServiceMain */
|
||||||
quote_it(out, path, sizeof(path));
|
quote_it(out, path, sizeof(path));
|
||||||
|
|
||||||
|
/* if we started in a different directory, also read config from it. */
|
||||||
|
if(rename) {
|
||||||
|
quote_it(out, path_config, sizeof(path_config));
|
||||||
|
strcat(path, " -c ");
|
||||||
|
strcat(path, path_config);
|
||||||
|
}
|
||||||
|
|
||||||
strcat(path, " -w service");
|
strcat(path, " -w service");
|
||||||
scm = OpenSCManager(NULL, NULL, (int)SC_MANAGER_CREATE_SERVICE);
|
scm = OpenSCManager(NULL, NULL, (int)SC_MANAGER_CREATE_SERVICE);
|
||||||
if(!scm) fatal_win(out, "could not OpenSCManager");
|
if(!scm) fatal_win(out, "could not OpenSCManager");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue