X-Git-Url: http://git.iain.cx/?p=nssm.git;a=blobdiff_plain;f=gui.cpp;h=5aaa9322d5a14607792e92fc7ff6bce657d4b977;hp=628b136ff446d26baba8f88d5d145901a9d31f6c;hb=HEAD;hpb=b76766ed76f1bf26c31e0c73b154e2f6a95b278d diff --git a/gui.cpp b/gui.cpp index 628b136..5aaa932 100644 --- a/gui.cpp +++ b/gui.cpp @@ -180,6 +180,7 @@ int nssm_gui(int resource, nssm_service_t *service) { SetDlgItemText(tablist[NSSM_TAB_IO], IDC_STDIN, service->stdin_path); SetDlgItemText(tablist[NSSM_TAB_IO], IDC_STDOUT, service->stdout_path); SetDlgItemText(tablist[NSSM_TAB_IO], IDC_STDERR, service->stderr_path); + if (service->timestamp_log) SendDlgItemMessage(tablist[NSSM_TAB_IO], IDC_TIMESTAMP, BM_SETCHECK, BST_CHECKED, 0); /* Rotation tab. */ if (service->stdout_disposition == CREATE_ALWAYS) SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_TRUNCATE, BM_SETCHECK, BST_CHECKED, 0); @@ -354,7 +355,7 @@ static inline void set_hook_tab(int event_index, int action_index, bool changed) SetEnvironmentVariable(hook_name, cmd); } else { - GetEnvironmentVariable(hook_name, cmd, _countof(cmd)); + if (! GetEnvironmentVariable(hook_name, cmd, _countof(cmd))) cmd[0] = _T('\0'); SetDlgItemText(tablist[NSSM_TAB_HOOKS], IDC_HOOK, cmd); } } @@ -676,6 +677,8 @@ int configure(HWND window, nssm_service_t *service, nssm_service_t *orig_service check_io(window, _T("stdin"), service->stdin_path, _countof(service->stdin_path), IDC_STDIN); check_io(window, _T("stdout"), service->stdout_path, _countof(service->stdout_path), IDC_STDOUT); check_io(window, _T("stderr"), service->stderr_path, _countof(service->stderr_path), IDC_STDERR); + if (SendDlgItemMessage(tablist[NSSM_TAB_IO], IDC_TIMESTAMP, BM_GETCHECK, 0, 0) & BST_CHECKED) service->timestamp_log = true; + else service->timestamp_log = false; /* Override stdout and/or stderr. */ if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_TRUNCATE, BM_GETCHECK, 0, 0) & BST_CHECKED) { @@ -921,7 +924,7 @@ void browse(HWND window, TCHAR *current, unsigned long flags, ...) { va_start(arg, flags); while (i = va_arg(arg, int)) { TCHAR *localised = message_string(i); - _sntprintf_s((TCHAR *) ofn.lpstrFilter + len, bufsize, _TRUNCATE, localised); + _sntprintf_s((TCHAR *) ofn.lpstrFilter + len, bufsize - len, _TRUNCATE, localised); len += _tcslen(localised) + 1; LocalFree(localised); TCHAR *filter = browse_filter(i); @@ -1248,6 +1251,9 @@ INT_PTR CALLBACK nssm_dlg(HWND window, UINT message, WPARAM w, LPARAM l) { tablist[NSSM_TAB_IO] = dialog(MAKEINTRESOURCE(IDD_IO), window, tab_dlg); ShowWindow(tablist[NSSM_TAB_IO], SW_HIDE); + /* Set defaults. */ + SendDlgItemMessage(tablist[NSSM_TAB_IO], IDC_TIMESTAMP, BM_SETCHECK, BST_UNCHECKED, 0); + /* Rotation tab. */ tab.pszText = message_string(NSSM_GUI_TAB_ROTATION); tab.cchTextMax = (int) _tcslen(tab.pszText) + 1;