HeapFree(GetProcessHeap(), 0, formatted);\r
}\r
}\r
-
+\r
/* Process tab. */\r
if (service->priority) {\r
int priority = priority_constant_to_index(service->priority);\r
}\r
}\r
\r
- if (service->no_console) {
+ if (service->no_console) {\r
SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_SETCHECK, BST_UNCHECKED, 0);\r
- }
-
+ }\r
+\r
/* Shutdown tab. */\r
if (! (service->stop_method & NSSM_STOP_METHOD_CONSOLE)) {\r
SendDlgItemMessage(tablist[NSSM_TAB_SHUTDOWN], IDC_METHOD_CONSOLE, BM_SETCHECK, BST_UNCHECKED, 0);\r
Special case for well-known accounts.\r
Ignore the password if we're editing and the username hasn't changed.\r
*/\r
- const TCHAR *well_known = well_known_username(service->username);
+ const TCHAR *well_known = well_known_username(service->username);\r
if (well_known) {\r
- if (str_equiv(well_known, NSSM_LOCALSYSTEM_ACCOUNT)) {
+ if (str_equiv(well_known, NSSM_LOCALSYSTEM_ACCOUNT)) {\r
HeapFree(GetProcessHeap(), 0, service->username);\r
service->username = 0;\r
service->usernamelen = 0;\r
- }
- else {
- service->usernamelen = _tcslen(well_known) + 1;
- service->username = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, service->usernamelen * sizeof(TCHAR));
- if (! service->username) {
- print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY, _T("canon"), _T("install()"));
- return 6;
- }
- memmove(service->username, well_known, service->usernamelen * sizeof(TCHAR));
- }
+ }\r
+ else {\r
+ service->usernamelen = _tcslen(well_known) + 1;\r
+ service->username = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, service->usernamelen * sizeof(TCHAR));\r
+ if (! service->username) {\r
+ print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY, _T("canon"), _T("install()"));\r
+ return 6;\r
+ }\r
+ memmove(service->username, well_known, service->usernamelen * sizeof(TCHAR));\r
+ }\r
}\r
else {\r
/* Password. */\r
}\r
}\r
\r
- if (SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_GETCHECK, 0, 0) & BST_CHECKED) service->no_console = 0;
- else service->no_console = 1;
-
+ if (SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_GETCHECK, 0, 0) & BST_CHECKED) service->no_console = 0;\r
+ else service->no_console = 1;\r
+\r
/* Get stop method stuff. */\r
check_stop_method(service, NSSM_STOP_METHOD_CONSOLE, IDC_METHOD_CONSOLE);\r
check_stop_method(service, NSSM_STOP_METHOD_WINDOW, IDC_METHOD_WINDOW);\r
/* Get rotation stuff. */\r
if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_ROTATE, BM_GETCHECK, 0, 0) & BST_CHECKED) {\r
service->rotate_files = true;\r
- if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_ONLINE, BM_GETCHECK, 0, 0) & BST_CHECKED) service->rotate_stdout_online = service->rotate_stderr_online = NSSM_ROTATE_ONLINE;
+ if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_ONLINE, BM_GETCHECK, 0, 0) & BST_CHECKED) service->rotate_stdout_online = service->rotate_stderr_online = NSSM_ROTATE_ONLINE;\r
check_number(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_SECONDS, &service->rotate_seconds);\r
check_number(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_BYTES_LOW, &service->rotate_bytes_low);\r
}\r
/* Remainder of the buffer is already zeroed */\r
}\r
ofn.lpstrFile = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, PATH_LENGTH * sizeof(TCHAR));\r
- if (ofn.lpstrFile) {
+ if (ofn.lpstrFile) {\r
if (flags & OFN_NOVALIDATE) {\r
/* Directory hack. */\r
_sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T(":%s:"), message_string(NSSM_GUI_BROWSE_FILTER_DIRECTORIES));\r
ofn.nMaxFile = DIR_LENGTH;\r
}\r
- else {
+ else {\r
_sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T("%s"), current);\r
ofn.nMaxFile = PATH_LENGTH;\r
- }
- }
+ }\r
+ }\r
ofn.lpstrTitle = message_string(NSSM_GUI_BROWSE_TITLE);\r
ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | flags;\r
\r
SendMessage(window, WM_SETTEXT, 0, (LPARAM) ofn.lpstrFile);\r
}\r
if (ofn.lpstrFilter) HeapFree(GetProcessHeap(), 0, (void *) ofn.lpstrFilter);\r
- if (ofn.lpstrFile) HeapFree(GetProcessHeap(), 0, ofn.lpstrFile);
+ if (ofn.lpstrFile) HeapFree(GetProcessHeap(), 0, ofn.lpstrFile);\r
}\r
\r
INT_PTR CALLBACK tab_dlg(HWND tab, UINT message, WPARAM w, LPARAM l) {\r
CheckRadioButton(tablist[NSSM_TAB_LOGON], IDC_LOCALSYSTEM, IDC_ACCOUNT, IDC_LOCALSYSTEM);\r
set_logon_enabled(0);\r
\r
- /* Dependencies tab. */
+ /* Dependencies tab. */\r
tab.pszText = message_string(NSSM_GUI_TAB_DEPENDENCIES);\r
tab.cchTextMax = (int) _tcslen(tab.pszText);\r
SendMessage(tabs, TCM_INSERTITEM, NSSM_TAB_DEPENDENCIES, (LPARAM) &tab);\r
tablist[NSSM_TAB_DEPENDENCIES] = dialog(MAKEINTRESOURCE(IDD_DEPENDENCIES), window, tab_dlg);\r
ShowWindow(tablist[NSSM_TAB_DEPENDENCIES], SW_HIDE);\r
-
+\r
/* Remaining tabs are only for services we manage. */\r
if (service->native) return 1;\r
\r
SendMessage(combo, CB_SETCURSEL, NSSM_NORMAL_PRIORITY, 0);\r
\r
SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_SETCHECK, BST_CHECKED, 0);\r
-
+\r
list = GetDlgItem(tablist[NSSM_TAB_PROCESS], IDC_AFFINITY);\r
n = num_cpus();\r
SendMessage(list, LB_SETCOLUMNWIDTH, 16, 0);\r
Size to fit.\r
The box is high enough for four rows. It is wide enough for eight\r
columns without scrolling. With scrollbars it shrinks to two rows.\r
- Note that the above only holds if we set the column width BEFORE
- adding the strings.
+ Note that the above only holds if we set the column width BEFORE\r
+ adding the strings.\r
*/\r
if (n < 32) {\r
int columns = (n - 1) / 4;\r
RECT rect;\r
GetWindowRect(list, &rect);\r
- int width = rect.right - rect.left;
+ int width = rect.right - rect.left;\r
width -= (7 - columns) * 16;\r
int height = rect.bottom - rect.top;\r
- if (n < 4) height -= (int) SendMessage(list, LB_GETITEMHEIGHT, 0, 0) * (4 - n);
+ if (n < 4) height -= (int) SendMessage(list, LB_GETITEMHEIGHT, 0, 0) * (4 - n);\r
SetWindowPos(list, 0, 0, 0, width, height, SWP_NOMOVE | SWP_NOOWNERZORDER);\r
}\r
SendMessage(list, LB_SELITEMRANGE, 1, MAKELPARAM(0, n));\r