- Add basic support for creating services - Start to put in functionality for exporting all services to a file - Don't open the progress dialog if the action fails Modified: trunk/reactos/base/system/servman/En.rc Modified: trunk/reactos/base/system/servman/about.c Modified: trunk/reactos/base/system/servman/control.c Added: trunk/reactos/base/system/servman/create.c Added: trunk/reactos/base/system/servman/export.c Modified: trunk/reactos/base/system/servman/geterror.c Modified: trunk/reactos/base/system/servman/propsheet.c Modified: trunk/reactos/base/system/servman/query.c Modified: trunk/reactos/base/system/servman/resource.h Modified: trunk/reactos/base/system/servman/servman.c Modified: trunk/reactos/base/system/servman/servman.h Modified: trunk/reactos/base/system/servman/start.c _____
Modified: trunk/reactos/base/system/servman/En.rc --- trunk/reactos/base/system/servman/En.rc 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/En.rc 2006-01-30 18:48:10 UTC (rev 45) @@ -80,13 +80,13 @@
PUSHBUTTON "Resume", IDC_RESUME, 192, 155, 54, 15 LTEXT "Service name:", IDC_STATIC, 4, 11, 53, 11 LTEXT "Display name:", IDC_STATIC, 4, 29, 53, 11 - LTEXT "Description", IDC_STATIC, 4, 51, 53, 11 + LTEXT "Description:", IDC_STATIC, 4, 51, 53, 11 LTEXT "Path to executable:", IDC_STATIC, 6, 73, 82, 9 LTEXT "Startup type:", IDC_STATIC, 6, 108, 53, 11 LTEXT "Service status:", IDC_STATIC, 4, 138, 53, 11 CONTROL "",IDC_SERV_STATUS,"Static",0x50000000,70,138,176,11 LTEXT "You can specify the start parameters that apply when you start the service from here.",IDC_STATIC, 6,177,240,15 - LTEXT "Start parameters", IDC_STATIC, 6, 199, 53, 11 + LTEXT "Start parameters:", IDC_STATIC, 6, 200, 58, 11 EDITTEXT IDC_START_PARAM, 68, 199, 178, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP END
@@ -97,9 +97,9 @@ BEGIN CONTROL "",IDC_DEPEND_TREE1,"SysTreeView32",0x50010007,8,70,236,68,0x00000200 CONTROL "",IDC_DEPEND_TREE2,"SysTreeView32",0x50010007,8,151,234,67,0x00000200 - CONTROL "Some services depend on other services, system drivers and load order groups. If a system component is stopped or it is not running properly, dependant services can be affected.",IDC_STATIC,"Static",0x50000000,8,7,238,26 - CONTROL "This service depends on the following components",IDC_STATIC,"Static",0x50000000,8,57,236,9 - CONTROL "",IDC_DEPEND_SERVICE,"Static",0x50000000,8,38,236,13 + LTEXT "Some services depend on other services, system drivers and load order groups. If a system component is stopped or it is not running properly, dependant services can be affected.", IDC_STATIC,8, 7, 238, 26 + LTEXT "This service depends on the following components", IDC_STATIC, 8, 57, 236, 9 + LTEXT "", IDC_DEPEND_SERVICE, 8, 38, 236, 13 END
IDD_DLG_CREATE DIALOGEX 6,6,225,209 @@ -122,6 +122,15 @@ CONTROL "Help",ID_CREATE_HELP,"Button",0x50010000,6,192,44,13 END
+IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150 +CAPTION "Options" +FONT 8,"MS Sans Serif",0,0 +STYLE 0x10CF0000 +BEGIN + LTEXT "", IDC_CREATE_HELP, 6, 5, 200, 150 + PUSHBUTTON "Ok", IDOK, 75, 130, 44, 13 +END + IDD_DLG_PROGRESS DIALOGEX 6,6,255,89 CAPTION "Service Control" FONT 8,"MS Sans Serif",0,0 @@ -131,7 +140,7 @@ CONTROL "",IDC_SERVCON_PROGRESS,"msctls_progress32",0x50000000,8,46,238,13 CONTROL "",IDC_SERVCON_INFO,"Static",0x50000000,8,5,236,11 CONTROL "",IDC_SERVCON_NAME,"Static",0x50000000,8,25,66,11 - CONTROL "&Close",IDOK,"Button",0x50010000,100,70,54,13 + PUSHBUTTON "&Close", IDOK, 100, 70, 54, 13 END
@@ -159,7 +168,7 @@ STRINGTABLE DISCARDABLE BEGIN IDS_NUM_SERVICES "Num Services: %d" - IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA" + IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA." END
STRINGTABLE DISCARDABLE @@ -178,5 +187,11 @@
STRINGTABLE DISCARDABLE BEGIN - IDS_PROGRESS_INFO "ReactOS is attempting to %s the following service" + IDS_PROGRESS_INFO_START "ReactOS is attempting to start the following service" + IDS_PROGRESS_INFO_STOP "ReactOS is attempting to stop the following service" END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_HELP_OPTIONS "CREATE OPTIONS:\r\nNOTE: The option name includes the equal sign.\r\n type= <own|share|interact|kernel|filesys|rec>\r\n (default = own)\r\n start= <boot|system|auto|demand|disabled>\r\n (default = demand) \r\n error= <normal|severe|critical|ignore>\r\n (default = normal)\r\n group= <LoadOrderGroup>\r\n tag= <yes|no>\r\n depend= <Dependencies(separated by / (forward slash))>\r\n obj= <AccountName|ObjectName>\r\n (default = LocalSystem)\r\n password= <password>\r\n" +END _____
Modified: trunk/reactos/base/system/servman/about.c --- trunk/reactos/base/system/servman/about.c 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/about.c 2006-01-30 18:48:10 UTC (rev 45) @@ -21,7 +21,7 @@
{ HWND hLicenseEditWnd; HICON hIcon = NULL; - TCHAR strLicense[0x1000]; + TCHAR strLicense[700];
switch (message) { @@ -32,7 +32,7 @@
hLicenseEditWnd = GetDlgItem(hDlg, IDC_LICENSE_EDIT);
- LoadString(hInstance, IDS_LICENSE, strLicense, 0x1000); + LoadString(hInstance, IDS_LICENSE, strLicense, 700);
SetWindowText(hLicenseEditWnd, strLicense);
_____
Modified: trunk/reactos/base/system/servman/control.c --- trunk/reactos/base/system/servman/control.c 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/control.c 2006-01-30 18:48:10 UTC (rev 45) @@ -106,7 +106,7 @@
GetError(0); return FALSE; } - + if (ServiceStatus.dwCheckPoint > dwOldCheckPoint) { /* The service is making progress. increment the progress bar */ _____
Added: trunk/reactos/base/system/servman/create.c --- trunk/reactos/base/system/servman/create.c 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/create.c 2006-01-30 18:48:10 UTC (rev 45) @@ -0,0 +1,219 @@
+/* + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/servman/create.c + * PURPOSE: Create a new service + * COPYRIGHT: Copyright 2005 Ged Murphy gedmurphy@gmail.com + * + */ + +#include "servman.h" + +extern HINSTANCE hInstance; + + +BOOL Create(LPTSTR ServiceName, + LPTSTR DisplayName, + LPTSTR BinPath, + LPTSTR Description, + LPTSTR Options) +{ + SC_HANDLE hSCManager; + SC_HANDLE hSc; + + /* open handle to the SCM */ + hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS); + if (hSCManager == NULL) + { + GetError(0); + return FALSE; + } + + hSc = CreateService(hSCManager, + ServiceName, + DisplayName, + SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS, + SERVICE_DEMAND_START, + SERVICE_ERROR_NORMAL, + BinPath, + NULL, + NULL, + NULL, + NULL, + NULL); + + if (hSc == NULL) + { + GetError(0); + return FALSE; + } + + DisplayString(_T("Service Succesfully Created")); + CloseServiceHandle(hSCManager); + CloseServiceHandle(hSc); + return TRUE; +} + + +#ifdef _MSC_VER +#pragma warning(disable : 4100) +#endif +BOOL CALLBACK +CreateHelpDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HWND hHelp; + HICON hIcon = NULL; + TCHAR Buf[1000]; + + switch (message) + { + case WM_INITDIALOG: + hIcon = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON), IMAGE_ICON, 16, 16, 0); + SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); + + hHelp = GetDlgItem(hDlg, IDC_CREATE_HELP); + + LoadString(hInstance, IDS_HELP_OPTIONS, Buf, 1000); + + SetWindowText(hHelp, Buf); + + return TRUE; + + case WM_COMMAND: + if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL)) + { + DestroyIcon(hIcon); + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + break; + } + + return FALSE; +} + + +BOOL CALLBACK +CreateDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + HICON hIcon = NULL; + + switch (message) + { + case WM_INITDIALOG: + hIcon = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON), IMAGE_ICON, 16, 16, 0); + SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: + { + LPTSTR ServiceName = NULL; + LPTSTR DisplayName = NULL; + LPTSTR BinPath = NULL; + LPTSTR Description = NULL; + LPTSTR Options = NULL; + HWND hwnd; + INT iLen = 0; + + /* get service name */ + hwnd = GetDlgItem(hDlg, IDC_CREATE_SERVNAME); + iLen = GetWindowTextLength(hwnd); + if (iLen != 0) + { + ServiceName = HeapAlloc(GetProcessHeap(), 0, iLen+1); + if (ServiceName != NULL) + { + GetWindowText(hwnd, ServiceName, iLen+1); + DisplayString(ServiceName); + } + + } + + /* get display name */ + iLen = 0; + hwnd = GetDlgItem(hDlg, IDC_CREATE_DISPNAME); + iLen = GetWindowTextLength(hwnd); + if (iLen != 0) + { + DisplayName = HeapAlloc(GetProcessHeap(), 0, iLen+1); + if (DisplayName != NULL) + GetWindowText(hwnd, DisplayName, iLen+1); + + } + + /* get binary path */ + iLen = 0; + hwnd = GetDlgItem(hDlg, IDC_CREATE_PATH); + iLen = GetWindowTextLength(hwnd); + if (iLen != 0) + { + BinPath = HeapAlloc(GetProcessHeap(), 0, iLen+1); + if (BinPath != NULL) + GetWindowText(hwnd, BinPath, iLen+1); + + } + + /* get description */ + iLen = 0; + hwnd = GetDlgItem(hDlg, IDC_CREATE_PATH); + iLen = GetWindowTextLength(hwnd); + if (iLen != 0) + { + Description = HeapAlloc(GetProcessHeap(), 0, iLen+1); + if (Description != NULL) + GetWindowText(hwnd, Description, iLen+1); + + } + + /* get options */ + iLen = 0; + hwnd = GetDlgItem(hDlg, IDC_CREATE_PATH); + iLen = GetWindowTextLength(hwnd); + if (iLen != 0) + { + Options = HeapAlloc(GetProcessHeap(), 0, iLen+1); + if (Options != NULL) + GetWindowText(hwnd, Options, iLen+1); + + } + + Create(ServiceName, DisplayName, BinPath, Description, Options); + + if (ServiceName != NULL) + HeapFree(GetProcessHeap(), 0, ServiceName); + if (DisplayName != NULL) + HeapFree(GetProcessHeap(), 0, DisplayName); + if (BinPath != NULL) + HeapFree(GetProcessHeap(), 0, BinPath); + if (Description != NULL) + HeapFree(GetProcessHeap(), 0, Description); + if (Options != NULL) + HeapFree(GetProcessHeap(), 0, Options); + + + DestroyIcon(hIcon); + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + } + + case IDCANCEL: + DestroyIcon(hIcon); + EndDialog(hDlg, LOWORD(wParam)); + return TRUE; + + case ID_CREATE_HELP: + DialogBox(hInstance, + MAKEINTRESOURCE(IDD_DLG_HELP_OPTIONS), + hDlg, + (DLGPROC)CreateHelpDialogProc); + break; + } + + } + + return FALSE; +} _____
Added: trunk/reactos/base/system/servman/export.c --- trunk/reactos/base/system/servman/export.c 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/export.c 2006-01-30 18:48:10 UTC (rev 45) @@ -0,0 +1,51 @@
+/* + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/servman/export.c + * PURPOSE: Save services to a file + * COPYRIGHT: Copyright 2005 Ged Murphy gedmurphy@gmail.com + * + */ + +#include "servman.h" + + +BOOL SaveServicesToFile(HWND hListView, LPCTSTR pszFileName) +{ + HANDLE hFile; + BOOL bSuccess = FALSE; + + hFile = CreateFile(pszFileName, GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if(hFile != INVALID_HANDLE_VALUE) + { + + CloseHandle(hFile); + } + return bSuccess; +} + + +VOID ExportFile(HWND hwnd) +{ + OPENFILENAME ofn; + TCHAR szFileName[MAX_PATH] = _T(""); + + ZeroMemory(&ofn, sizeof(ofn)); + + ofn.lStructSize = sizeof(OPENFILENAME); + ofn.hwndOwner = hwnd; + ofn.lpstrFilter = _T("Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"); + ofn.lpstrFile = szFileName; + ofn.nMaxFile = MAX_PATH; + ofn.lpstrDefExt = _T("txt"); + ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; + + if(GetSaveFileName(&ofn)) + { + SaveServicesToFile(hwnd, szFileName); + } +} + + + _____
Modified: trunk/reactos/base/system/servman/geterror.c --- trunk/reactos/base/system/servman/geterror.c 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/geterror.c 2006-01-30 18:48:10 UTC (rev 45) @@ -1,7 +1,15 @@
-//#include <stdarg> +/* + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/servman/geterror.c + * PURPOSE: displays error messages + * COPYRIGHT: Copyright 2005 Ged Murphy gedmurphy@gmail.com + * + */ + #include "servman.h" -/* temp file for debugging */
+ VOID GetError(DWORD err) { LPVOID lpMsgBuf; @@ -28,6 +36,6 @@ VOID DisplayString(PTCHAR Msg) {
- MessageBox(NULL, Msg, _T("Error!"), MB_OK | MB_ICONERROR); + MessageBox(NULL, Msg, _T("..."), MB_OK);
} _____
Modified: trunk/reactos/base/system/servman/propsheet.c --- trunk/reactos/base/system/servman/propsheet.c 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/propsheet.c 2006-01-30 18:48:10 UTC (rev 45) @@ -9,6 +9,7 @@
#include "servman.h"
+HWND hwndGenDlg; extern ENUM_SERVICE_STATUS_PROCESS *pServiceStatus; extern HINSTANCE hInstance; extern HWND hListView; @@ -27,18 +28,19 @@ } PROP_DLG_INFO, *PPROP_DLG_INFO;
+ /* * Fills the 'startup type' combo box with possible * values and sets it to value of the selected item */ -VOID SetStartupType(HKEY hKey, HWND hwndDlg) +VOID SetStartupType(HKEY hKey) { HWND hList; TCHAR buf[25]; DWORD dwValueSize = 0; DWORD StartUp = 0;
- hList = GetDlgItem(hwndDlg, IDC_START_TYPE); + hList = GetDlgItem(hwndGenDlg, IDC_START_TYPE);
LoadString(hInstance, IDS_SERVICES_AUTO, buf, sizeof(buf) / sizeof(TCHAR)); SendMessage(hList, CB_ADDSTRING, 0, (LPARAM)buf); @@ -73,7 +75,7 @@ * Populates the General Properties dialog with * the relevant service information */ -VOID GetDlgInfo(HWND hwndDlg) +VOID GetDlgInfo() { HKEY hKey; ENUM_SERVICE_STATUS_PROCESS *Service = NULL; @@ -94,29 +96,29 @@
/* set the service name */ DlgInfo.lpServiceName = Service->lpServiceName; - SendDlgItemMessage(hwndDlg, IDC_SERV_NAME, WM_SETTEXT, 0, ( + SendDlgItemMessage(hwndGenDlg, IDC_SERV_NAME, WM_SETTEXT, 0, ( LPARAM)DlgInfo.lpServiceName);
/* set the display name */ DlgInfo.lpDisplayName = Service->lpDisplayName; - SendDlgItemMessage(hwndDlg, IDC_DISP_NAME, WM_SETTEXT, 0, + SendDlgItemMessage(hwndGenDlg, IDC_DISP_NAME, WM_SETTEXT, 0, (LPARAM)DlgInfo.lpDisplayName);
/* set the description */ if (GetDescription(hKey, &DlgInfo.lpDescription)) - SendDlgItemMessage(hwndDlg, IDC_DESCRIPTION, WM_SETTEXT, 0, + SendDlgItemMessage(hwndGenDlg, IDC_DESCRIPTION, WM_SETTEXT, 0, (LPARAM)DlgInfo.lpDescription);
/* set the executable path */ if (GetExecutablePath(&DlgInfo.lpPathToExe)) - SendDlgItemMessage(hwndDlg, IDC_EXEPATH, WM_SETTEXT, 0, (LPARAM)DlgInfo.lpPathToExe); + SendDlgItemMessage(hwndGenDlg, IDC_EXEPATH, WM_SETTEXT, 0, (LPARAM)DlgInfo.lpPathToExe);
/* set startup type */ - SetStartupType(hKey, hwndDlg); + SetStartupType(hKey);
@@ -125,18 +127,19 @@ { LoadString(hInstance, IDS_SERVICES_STARTED, DlgInfo.szServiceStatus, sizeof(DlgInfo.szServiceStatus) / sizeof(TCHAR)); - SendDlgItemMessageW(hwndDlg, IDC_SERV_STATUS, WM_SETTEXT, 0, (LPARAM)DlgInfo.szServiceStatus); + SendDlgItemMessageW(hwndGenDlg, IDC_SERV_STATUS, WM_SETTEXT, 0, (LPARAM)DlgInfo.szServiceStatus); } else { LoadString(hInstance, IDS_SERVICES_STOPPED, DlgInfo.szServiceStatus, sizeof(DlgInfo.szServiceStatus) / sizeof(TCHAR)); - SendDlgItemMessageW(hwndDlg, IDC_SERV_STATUS, WM_SETTEXT, 0, (LPARAM)DlgInfo.szServiceStatus); + SendDlgItemMessageW(hwndGenDlg, IDC_SERV_STATUS, WM_SETTEXT, 0, (LPARAM)DlgInfo.szServiceStatus); }
+ }
@@ -148,18 +151,19 @@ * General Property dialog callback. * Controls messages to the General dialog */ -/* FIXME: this may be better as a modeless dialog */ INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { + hwndGenDlg = hwndDlg;
switch (uMsg) { case WM_INITDIALOG: - GetDlgInfo(hwndDlg); + GetDlgInfo(); + break;
case WM_COMMAND: @@ -207,12 +211,11 @@ * Dependancies Property dialog callback. * Controls messages to the Dependancies dialog */ -/* FIXME: this may be better as a modeless dialog */ INT_PTR CALLBACK DependanciesPageProc(HWND hwndDlg, - UINT uMsg, - WPARAM wParam, - LPARAM lParam) + UINT uMsg, + WPARAM wParam, + LPARAM lParam) {
switch (uMsg) _____
Modified: trunk/reactos/base/system/servman/query.c --- trunk/reactos/base/system/servman/query.c 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/query.c 2006-01-30 18:48:10 UTC (rev 45) @@ -25,7 +25,7 @@
-ENUM_SERVICE_STATUS_PROCESS* +ENUM_SERVICE_STATUS_PROCESS* GetSelectedService(VOID) { ENUM_SERVICE_STATUS_PROCESS *pSelectedService = NULL; _____
Modified: trunk/reactos/base/system/servman/resource.h --- trunk/reactos/base/system/servman/resource.h 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/resource.h 2006-01-30 18:48:10 UTC (rev 45) @@ -96,10 +96,16 @@
#define IDC_CREATE_DESC 8004 #define IDC_CREATE_OPTIONS 8005 #define ID_CREATE_HELP 8006 +#define IDD_DLG_HELP_OPTIONS 8020 +#define IDC_CREATE_HELP 8021 +#define IDS_HELP_OPTIONS 8022
/* progress bar */ #define IDD_DLG_PROGRESS 7000 #define IDC_SERVCON_PROGRESS 7001 #define IDC_SERVCON_INFO 7002 #define IDC_SERVCON_NAME 7003 -#define IDS_PROGRESS_INFO 7004 +#define IDS_PROGRESS_INFO_START 7004 +#define IDS_PROGRESS_INFO_STOP 7005 + + _____
Modified: trunk/reactos/base/system/servman/servman.c --- trunk/reactos/base/system/servman/servman.c 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/servman.c 2006-01-30 18:48:10 UTC (rev 45) @@ -20,7 +20,9 @@
HMENU hShortcutMenu; INT SelectedItem;
+extern HWND hwndGenDlg;
+ INT GetSelectedItem(VOID) { return SelectedItem; @@ -122,7 +124,7 @@ MessageBox(hwnd, _T("Could not create List View."), _T("Error"), MB_OK | MB_ICONERROR);
ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT | - LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP); + /*LVS_EX_GRIDLINES |*/ LVS_EX_HEADERDRAGDROP);
lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH | LVCF_FMT; lvc.fmt = LVCFMT_LEFT; @@ -277,6 +279,10 @@ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXPORT); break;
+ case ID_NEW: + lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_NEW); + break; + case ID_START: lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_START); break; @@ -293,10 +299,6 @@ lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_RESTART); break;
- case ID_NEW: - lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_NEW); - break; - case ID_HELP: lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_HELP); break; @@ -341,40 +343,49 @@ break;
case ID_EXPORT: + ExportFile(hListView); break;
+ case ID_NEW: + DialogBox(hInstance, + MAKEINTRESOURCE(IDD_DLG_CREATE), + hMainWnd, + (DLGPROC)CreateDialogProc); + + break; + case ID_START: { - ENUM_SERVICE_STATUS_PROCESS *Service = NULL; - TCHAR buf1[100]; - TCHAR buf2[100]; - /* open the progress dialog */ - hProgDlg = CreateDialog(GetModuleHandle(NULL), - MAKEINTRESOURCE(IDD_DLG_PROGRESS), - hMainWnd, - (DLGPROC)ProgressDialogProc); - if (hProgDlg != NULL) + if ( DoStartService(hProgDlg) ) { - ShowWindow(hProgDlg, SW_SHOW); + ENUM_SERVICE_STATUS_PROCESS *Service = NULL; + LVITEM item; + TCHAR szStatus[64]; + TCHAR buf[25]; + TCHAR ProgDlgBuf[100];
- /* write the info to the progress dialog */ - LoadString(hInstance, IDS_PROGRESS_INFO, buf1, - sizeof(buf1) / sizeof(TCHAR)); - _sntprintf(buf2, 100, buf1, _T("start")); - SendDlgItemMessage(hProgDlg, IDC_SERVCON_INFO, WM_SETTEXT, 0, (LPARAM)buf2); + /* open the progress dialog */ + hProgDlg = CreateDialog(GetModuleHandle(NULL), + MAKEINTRESOURCE(IDD_DLG_PROGRESS), + hMainWnd, + (DLGPROC)ProgressDialogProc); + if (hProgDlg != NULL) + { + ShowWindow(hProgDlg, SW_SHOW);
- /* get pointer to selected service */ - Service = GetSelectedService(); + /* write the info to the progress dialog */ + LoadString(hInstance, IDS_PROGRESS_INFO_START, ProgDlgBuf, + sizeof(ProgDlgBuf) / sizeof(TCHAR)); + SendDlgItemMessage(hProgDlg, IDC_SERVCON_INFO, WM_SETTEXT, + 0, (LPARAM)ProgDlgBuf);
- /* write the service name to the progress dialog */ - SendDlgItemMessage(hProgDlg, IDC_SERVCON_NAME, WM_SETTEXT, 0, - (LPARAM)Service->lpServiceName); - } + /* get pointer to selected service */ + Service = GetSelectedService();
- if ( DoStartService(hProgDlg) ) - { - LVITEM item; - TCHAR szStatus[64]; + /* write the service name to the progress dialog */ + SendDlgItemMessage(hProgDlg, IDC_SERVCON_NAME, WM_SETTEXT, 0, + (LPARAM)Service->lpServiceName); + }
LoadString(hInstance, IDS_SERVICES_STARTED, szStatus, sizeof(szStatus) / sizeof(TCHAR)); @@ -382,51 +393,72 @@ item.iItem = GetSelectedItem(); item.iSubItem = 2; SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); + + /* change dialog status */ + if (hwndGenDlg) + { + LoadString(hInstance, IDS_SERVICES_STARTED, buf, + sizeof(buf) / sizeof(TCHAR)); + SendDlgItemMessageW(hwndGenDlg, IDC_SERV_STATUS, WM_SETTEXT, + 0, (LPARAM)buf); + } }
SendMessage(hProgDlg, WM_DESTROY, 0, 0); + } break;
case ID_STOP: { - ENUM_SERVICE_STATUS_PROCESS *Service = NULL; - TCHAR buf1[100]; - TCHAR buf2[100]; - /* open the progress dialog */ - hProgDlg = CreateDialog(GetModuleHandle(NULL), - MAKEINTRESOURCE(IDD_DLG_PROGRESS), - hMainWnd, - (DLGPROC)ProgressDialogProc); - if (hProgDlg != NULL) + if( Control(hProgDlg, SERVICE_CONTROL_STOP) ) { - ShowWindow(hProgDlg, SW_SHOW); + ENUM_SERVICE_STATUS_PROCESS *Service = NULL; + LVITEM item; + TCHAR buf[25]; + TCHAR ProgDlgBuf[100];
- /* write the info to the progress dialog */ - LoadString(hInstance, IDS_PROGRESS_INFO, buf1, - sizeof(buf1) / sizeof(TCHAR)); - _sntprintf(buf2, 100, buf1, _T("stop")); - SendDlgItemMessage(hProgDlg, IDC_SERVCON_INFO, WM_SETTEXT, 0, (LPARAM)buf2); + /* open the progress dialog */ + hProgDlg = CreateDialog(GetModuleHandle(NULL), + MAKEINTRESOURCE(IDD_DLG_PROGRESS), + hMainWnd, + (DLGPROC)ProgressDialogProc); + if (hProgDlg != NULL) + { + ShowWindow(hProgDlg, SW_SHOW);
- /* get pointer to selected service */ - Service = GetSelectedService(); + /* write the info to the progress dialog */ + LoadString(hInstance, IDS_PROGRESS_INFO_STOP, ProgDlgBuf, + sizeof(ProgDlgBuf) / sizeof(TCHAR)); + SendDlgItemMessage(hProgDlg, IDC_SERVCON_INFO, + WM_SETTEXT, 0, (LPARAM)ProgDlgBuf);
- /* write the service name to the progress dialog */ - SendDlgItemMessage(hProgDlg, IDC_SERVCON_NAME, WM_SETTEXT, 0, - (LPARAM)Service->lpServiceName); - } + /* get pointer to selected service */ + Service = GetSelectedService();
- if( Control(hProgDlg, SERVICE_CONTROL_STOP) ) - { - LVITEM item; + /* write the service name to the progress dialog */ + SendDlgItemMessage(hProgDlg, IDC_SERVCON_NAME, WM_SETTEXT, 0, + (LPARAM)Service->lpServiceName); + }
+ item.pszText = '\0'; item.iItem = GetSelectedItem(); item.iSubItem = 2; SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); + + /* change dialog status */ + if (hwndGenDlg) + { + LoadString(hInstance, IDS_SERVICES_STOPPED, buf, + sizeof(buf) / sizeof(TCHAR)); + SendDlgItemMessageW(hwndGenDlg, IDC_SERV_STATUS, WM_SETTEXT, + 0, (LPARAM)buf); + } }
SendMessage(hProgDlg, WM_DESTROY, 0, 0); + } break;
@@ -443,9 +475,6 @@ SendMessage(hMainWnd, WM_COMMAND, 0, ID_START); break;
- case ID_NEW: - break; - case ID_HELP: MessageBox(NULL, _T("Help is not yet implemented\n"), _T("Note!"), MB_OK | MB_ICONINFORMATION); _____
Modified: trunk/reactos/base/system/servman/servman.h --- trunk/reactos/base/system/servman/servman.h 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/servman.h 2006-01-30 18:48:10 UTC (rev 45) @@ -1,7 +1,7 @@
#ifndef __SERVMAN_H #define __SERVMAN_H
-#define WIN32_LEAN_AND_MEAN +//#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <windowsx.h> /* GET_X/Y_LPARAM */ #include <stdio.h> @@ -16,6 +16,7 @@ BOOL RefreshServiceList(VOID);
BOOL CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); +BOOL CALLBACK CreateDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); BOOL CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
BOOL DoStartService(HWND hProgDlg); @@ -36,5 +37,7 @@
DWORD GetServiceList(VOID);
+VOID ExportFile(HWND hwnd);
+ #endif /* __SERVMAN_H */ _____
Modified: trunk/reactos/base/system/servman/start.c --- trunk/reactos/base/system/servman/start.c 2006-01-30 18:44:22 UTC (rev 44) +++ trunk/reactos/base/system/servman/start.c 2006-01-30 18:48:10 UTC (rev 45) @@ -99,7 +99,7 @@
GetError(0); return FALSE; } - + if (ServiceStatus.dwCheckPoint > dwOldCheckPoint) { /* The service is making progress. increment the progress bar */