X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=gui.cpp;h=7cc5bc4efc91d8e3a34f5a4bc980cc6b2266298d;hb=7cd249e44eb359ffb121ed09f18b1177dc25c245;hp=e28c0448293b27d4fed9bcfd3ab81225a57d6b8a;hpb=8aa782adfab4d63e4115fead833c864fe43d4cbc;p=nssm.git diff --git a/gui.cpp b/gui.cpp index e28c044..7cc5bc4 100644 --- a/gui.cpp +++ b/gui.cpp @@ -134,6 +134,21 @@ int install(HWND window) { check_io("stdin", service->stdin_path, sizeof(service->stdin_path), IDC_STDIN); check_io("stdout", service->stdout_path, sizeof(service->stdout_path), IDC_STDOUT); check_io("stderr", service->stderr_path, sizeof(service->stderr_path), IDC_STDERR); + /* I/O defaults. */ + service->stdin_sharing = NSSM_STDIN_SHARING; + service->stdin_disposition = NSSM_STDIN_DISPOSITION; + service->stdin_flags = NSSM_STDIN_FLAGS; + service->stdout_sharing = NSSM_STDOUT_SHARING; + service->stdout_disposition = NSSM_STDOUT_DISPOSITION; + service->stdout_flags = NSSM_STDOUT_FLAGS; + service->stderr_sharing = NSSM_STDERR_SHARING; + service->stderr_disposition = NSSM_STDERR_DISPOSITION; + service->stderr_flags = NSSM_STDERR_FLAGS; + /* Override stdout and/or stderr. */ + if (SendDlgItemMessage(tablist[NSSM_TAB_IO], IDC_TRUNCATE, BM_GETCHECK, 0, 0) & BST_CHECKED) { + if (service->stdout_path[0]) service->stdout_disposition = CREATE_ALWAYS; + if (service->stderr_path[0]) service->stderr_disposition = CREATE_ALWAYS; + } /* Get environment. */ unsigned long envlen = (unsigned long) SendMessage(GetDlgItem(tablist[NSSM_TAB_ENVIRONMENT], IDC_ENVIRONMENT), WM_GETTEXTLENGTH, 0, 0); @@ -157,7 +172,7 @@ int install(HWND window) { unsigned long i, j; for (i = 0; i < envlen; i++) if (env[i] != '\r') newlen++; /* Must end with two NULLs. */ - newlen++; + newlen += 2; char *newenv = (char *) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, newlen); if (! newenv) { @@ -435,6 +450,8 @@ INT_PTR CALLBACK install_dlg(HWND window, UINT message, WPARAM w, LPARAM l) { switch (message) { /* Creating the dialogue */ case WM_INITDIALOG: + SetFocus(GetDlgItem(window, IDC_NAME)); + HWND tabs; HWND combo; tabs = GetDlgItem(window, IDC_TAB1);