mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
Merge Service Manager from audited repositry
Revision: 98 Author: gedmurphy Date: 20:32:56, 06 February 2006 Message: - fix some buffer checks - remove item from listview when deleted ---- Modified : /trunk/reactos/base/applications/servman/En.rc Modified : /trunk/reactos/base/applications/servman/about.c Modified : /trunk/reactos/base/applications/servman/create.c Modified : /trunk/reactos/base/applications/servman/delete.c Modified : /trunk/reactos/base/applications/servman/geterror.c Modified : /trunk/reactos/base/applications/servman/query.c Modified : /trunk/reactos/base/applications/servman/resource.h Modified : /trunk/reactos/base/applications/servman/servman.c Revision: 97 Author: gedmurphy Date: 20:18:58, 05 February 2006 Message: ensure required fields are filled. ---- Modified : /trunk/reactos/base/applications/servman/En.rc Modified : /trunk/reactos/base/applications/servman/create.c Revision: 96 Author: gedmurphy Date: 20:09:42, 05 February 2006 Message: use a modeless dialog ---- Modified : /trunk/reactos/base/applications/servman/create.c Revision: 88 Author: gedmurphy Date: 13:25:46, 04 February 2006 Message: these were in the wrong place according to the new tree structure http://www.reactos.org/wiki/index.php/New_Tree_Structure ---- Modified : /trunk/reactos/base/applications/applications.rbuild Added : /trunk/reactos/base/applications/msconfig(Copy From Path: /trunk/reactos/base/system/msconfig, Revision, 84 Added : /trunk/reactos/base/applications/sc(Copy From Path: /trunk/reactos/base/system/sc, Revision, 84 Added : /trunk/reactos/base/applications/servman(Copy From Path: /trunk/reactos/base/system/servman, Revision, 84 Deleted : /trunk/reactos/base/system/msconfig Deleted : /trunk/reactos/base/system/sc Deleted : /trunk/reactos/base/system/servman Modified : /trunk/reactos/base/system/system.rbuild Revision: 77 Author: gedmurphy Date: 20:38:07, 03 February 2006 Message: fix setting of the description when creating services ---- Modified : /trunk/reactos/base/system/servman/create.c Modified : /trunk/reactos/base/system/servman/query.c Modified : /trunk/reactos/base/system/servman/servman.h Revision: 76 Author: gedmurphy Date: 20:03:48, 03 February 2006 Message: group registry gathering data together ---- Modified : /trunk/reactos/base/system/servman/propsheet.c Modified : /trunk/reactos/base/system/servman/query.c Modified : /trunk/reactos/base/system/servman/servman.h Revision: 75 Author: gedmurphy Date: 19:18:17, 03 February 2006 Message: fix displaying of large icons. Thanks to Christoph for pointing this out. ---- Modified : /trunk/reactos/base/system/servman/query.c Revision: 74 Author: gedmurphy Date: 18:19:53, 03 February 2006 Message: - add functionality to delete current services - allow setting of a description when creating services - turn off toolbar buttons and menu items when not usable - fix the toolbar icons so they don't look weird when greyed out - a few other random bugfixes and alterations. ---- Modified : /trunk/reactos/base/system/servman/En.rc Modified : /trunk/reactos/base/system/servman/create.c Added : /trunk/reactos/base/system/servman/delete.c Modified : /trunk/reactos/base/system/servman/propsheet.c Modified : /trunk/reactos/base/system/servman/query.c Modified : /trunk/reactos/base/system/servman/res/toolbar.bmp 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/servman.rbuild Revision: 72 Author: martinf Date: 20:20:51, 02 February 2006 Message: convert *.rbuild files into valid XML files by inserting XML headers and a <rbuild> root nodes ---- Modified : /trunk/reactos/ReactOS-ppc.rbuild Modified : /trunk/reactos/ReactOS.rbuild Modified : /trunk/reactos/base/applications/applications.rbuild Modified : /trunk/reactos/base/applications/ibrowser/ibrowser.rbuild Modified : /trunk/reactos/base/applications/network/arp/arp.rbuild Modified : /trunk/reactos/base/applications/network/ipconfig/ipconfig.rbuild Modified : /trunk/reactos/base/applications/network/netstat/netstat.rbuild Modified : /trunk/reactos/base/applications/network/tracert/tracert.rbuild Modified : /trunk/reactos/base/applications/winefile/winefile.rbuild Modified : /trunk/reactos/base/base.rbuild Modified : /trunk/reactos/base/services/tcpsvcs/tcpsvcs.rbuild Modified : /trunk/reactos/base/shell/explorer/explorer.rbuild Modified : /trunk/reactos/base/shell/explorer/notifyhook/notifyhook.rbuild Modified : /trunk/reactos/base/shell/shell.rbuild Modified : /trunk/reactos/base/system/msconfig/msconfig.rbuild Modified : /trunk/reactos/base/system/sc/sc.rbuild Modified : /trunk/reactos/base/system/servman/servman.rbuild Modified : /trunk/reactos/base/system/system.rbuild Modified : /trunk/reactos/baseaddress.rbuild Modified : /trunk/reactos/boot/boot.rbuild Modified : /trunk/reactos/boot/bootcd/bootcd.rbuild Modified : /trunk/reactos/boot/freeldr/bootsect/bootsect.rbuild Modified : /trunk/reactos/boot/freeldr/freeldr.rbuild Modified : /trunk/reactos/config.template.rbuild Modified : /trunk/reactos/drivers/base/null/null.rbuild Modified : /trunk/reactos/lib/directory.rbuild Modified : /trunk/reactos/lib/inflib/inflib.rbuild Modified : /trunk/reactos/lib/rossym Modified : /trunk/reactos/lib/rossym/rossym.rbuild Modified : /trunk/reactos/subsystems/subsystems.rbuild Revision: 71 Author: gedmurphy Date: 22:07:06, 01 February 2006 Message: fix writing to file ---- Modified : /trunk/reactos/base/system/servman/export.c Revision: 70 Author: gedmurphy Date: 19:41:17, 01 February 2006 Message: - set the button states according to the service - Set the main and popup menus according to the current environment or service - allow viewing in list or icon mode too ---- Modified : /trunk/reactos/base/system/servman/En.rc Modified : /trunk/reactos/base/system/servman/export.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 Revision: 69 Author: gedmurphy Date: 22:41:45, 31 January 2006 Message: add missing library ---- Modified : /trunk/reactos/base/system/servman/servman.rbuild Revision: 68 Author: gedmurphy Date: 20:43:06, 31 January 2006 Message: - write services to file - added a roadmap for fun ---- Modified : /trunk/reactos/base/system/servman/export.c Added : /trunk/reactos/base/system/servman/roadmap.txt Revision: 61 Author: gedmurphy Date: 22:50:50, 30 January 2006 Message: revert the progress dialog change until I write a better solution. ---- Modified : /trunk/reactos/base/system/servman/servman.c Revision: 46 Author: gedmurphy Date: 18:55:32, 30 January 2006 Message: Forgot the rbuild file. ---- Modified : /trunk/reactos/base/system/servman/servman.rbuild Revision: 45 Author: gedmurphy Date: 18:48:10, 30 January 2006 Message: - 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 svn path=/trunk/; revision=21159
This commit is contained in:
@@ -2,54 +2,60 @@ IDR_MAINMENU MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "E&xit",ID_EXIT
|
||||
MENUITEM "Export...", ID_EXPORT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "E&xit", ID_EXIT
|
||||
END
|
||||
POPUP "Action"
|
||||
BEGIN
|
||||
MENUITEM "Start",ID_START
|
||||
MENUITEM "Stop",ID_STOP
|
||||
MENUITEM "Pause",ID_PAUSE
|
||||
MENUITEM "Resume",ID_RESUME
|
||||
MENUITEM "Restart",ID_RESTART
|
||||
MENUITEM "Connect to...", ID_NET_CON, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Refresh",ID_REFRESH
|
||||
MENUITEM "Start", ID_START, GRAYED
|
||||
MENUITEM "Stop", ID_STOP, GRAYED
|
||||
MENUITEM "Pause", ID_PAUSE, GRAYED
|
||||
MENUITEM "Resume", ID_RESUME, GRAYED
|
||||
MENUITEM "Restart", ID_RESTART, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Properties",ID_PROP
|
||||
MENUITEM "Refresh", ID_REFRESH
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Edit...", ID_EDIT, GRAYED
|
||||
MENUITEM "Create...", ID_CREATE
|
||||
MENUITEM "Delete...", ID_DELETE, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Properties...", ID_PROP, GRAYED
|
||||
END
|
||||
POPUP "View"
|
||||
BEGIN
|
||||
MENUITEM "Customize",ID_VIEW_CUSTOMIZE
|
||||
MENUITEM "Large Icons", ID_VIEW_LARGE
|
||||
MENUITEM "Small Icons", ID_VIEW_SMALL
|
||||
MENUITEM "List", ID_VIEW_LIST
|
||||
MENUITEM "Details", ID_VIEW_DETAILS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Customize...",ID_VIEW_CUSTOMIZE, GRAYED
|
||||
END
|
||||
POPUP "Help"
|
||||
BEGIN
|
||||
MENUITEM "About",ID_ABOUT
|
||||
MENUITEM "About...", ID_ABOUT
|
||||
END
|
||||
END
|
||||
IDR_POPUP MENU
|
||||
BEGIN
|
||||
POPUP "popup"
|
||||
BEGIN
|
||||
MENUITEM "Start",ID_START
|
||||
MENUITEM "Stop",ID_STOP
|
||||
MENUITEM "Pause",ID_PAUSE
|
||||
MENUITEM "Resume",ID_RESUME
|
||||
MENUITEM "Restart",ID_RESTART
|
||||
MENUITEM "Start", ID_START, GRAYED
|
||||
MENUITEM "Stop", ID_STOP, GRAYED
|
||||
MENUITEM "Pause", ID_PAUSE, GRAYED
|
||||
MENUITEM "Resume", ID_RESUME, GRAYED
|
||||
MENUITEM "Restart", ID_RESTART, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
POPUP "All tasks"
|
||||
BEGIN
|
||||
MENUITEM "Start",ID_START
|
||||
MENUITEM "Stop",ID_STOP
|
||||
MENUITEM "Pause",ID_PAUSE
|
||||
MENUITEM "Resume",ID_RESUME
|
||||
MENUITEM "Restart",ID_RESTART
|
||||
MENUITEM "Refresh",ID_REFRESH
|
||||
END
|
||||
MENUITEM "Refresh", ID_REFRESH
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Refresh",ID_REFRESH
|
||||
MENUITEM "Edit...", ID_EDIT, GRAYED
|
||||
MENUITEM "Delete...", ID_DELETE, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Properties",ID_PROP
|
||||
MENUITEM "Properties...", ID_PROP, GRAYED
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Help",ID_HELP
|
||||
MENUITEM "Help...", ID_HELP
|
||||
END
|
||||
END
|
||||
|
||||
@@ -58,7 +64,7 @@ CAPTION "About Service Manager"
|
||||
FONT 8,"Tahoma",0,0
|
||||
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
|
||||
BEGIN
|
||||
LTEXT "Service Manager v0.1\nCopyright (C) 2006\nby Ged Murphy ([email protected])", IDC_STATIC, 48, 7, 130, 26
|
||||
LTEXT "Service Manager v0.5\nCopyright (C) 2005-2006\nby Ged Murphy ([email protected])", IDC_STATIC, 48, 7, 130, 26
|
||||
PUSHBUTTON "Close", IDOK, 75, 162, 44, 15
|
||||
ICON IDI_SM_ICON, IDC_STATIC, 10, 10, 7, 30
|
||||
EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE
|
||||
@@ -74,19 +80,19 @@ BEGIN
|
||||
EDITTEXT IDC_DESCRIPTION, 70, 46, 176, 24, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_MULTILINE | ES_READONLY
|
||||
EDITTEXT IDC_EXEPATH, 6, 86, 240, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_READONLY
|
||||
CONTROL "",IDC_START_TYPE,"ComboBox",0x50010003,70,107,176,11
|
||||
PUSHBUTTON "Start", IDC_START, 6, 155, 54, 15
|
||||
PUSHBUTTON "Stop", IDC_STOP, 68, 155, 54, 15
|
||||
PUSHBUTTON "Pause", IDC_PAUSE , 130, 155, 54, 15
|
||||
PUSHBUTTON "Resume", IDC_RESUME, 192, 155, 54, 15
|
||||
PUSHBUTTON "Start", IDC_START, 6, 155, 54, 15, WS_DISABLED
|
||||
PUSHBUTTON "Stop", IDC_STOP, 68, 155, 54, 15, WS_DISABLED
|
||||
PUSHBUTTON "Pause", IDC_PAUSE , 130, 155, 54, 15, WS_DISABLED
|
||||
PUSHBUTTON "Resume", IDC_RESUME, 192, 155, 54, 15, WS_DISABLED
|
||||
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 +103,9 @@ STYLE WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GRO
|
||||
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
|
||||
@@ -112,9 +118,9 @@ BEGIN
|
||||
CONTROL "",IDC_CREATE_PATH,"Edit",0x50010000,8,62,214,13,0x00000200
|
||||
CONTROL "",IDC_CREATE_DESC,"Edit",0x50010000,10,97,210,48,0x00000200
|
||||
CONTROL "",IDC_CREATE_OPTIONS,"Edit",0x50010000,10,162,210,13,0x00000200
|
||||
CONTROL "Service Name :",IDC_STATIC,"Static",0x50000202,12,12,54,9
|
||||
CONTROL "Display Name :",IDC_STATIC,"Static",0x50000202,12,33,54,9
|
||||
CONTROL "Path to executable :",IDC_STATIC,"Static",0x50000000,10,51,68,9
|
||||
CONTROL "*Service Name :",IDC_STATIC,"Static",0x50000202,12,12,54,9
|
||||
CONTROL "*Display Name :",IDC_STATIC,"Static",0x50000202,12,33,54,9
|
||||
CONTROL "*Path to executable :",IDC_STATIC,"Static",0x50000000,10,51,68,9
|
||||
CONTROL "Description :",IDC_STATIC,"Static",0x50000000,12,86,44,9
|
||||
CONTROL "OK",IDOK,"Button",0x50010000,126,192,44,13
|
||||
CONTROL "Cancel",IDCANCEL,"Button",0x50010000,176,192,46,13
|
||||
@@ -122,6 +128,29 @@ BEGIN
|
||||
CONTROL "Help",ID_CREATE_HELP,"Button",0x50010000,6,192,44,13
|
||||
END
|
||||
|
||||
IDD_DLG_DELETE DIALOGEX 6,6,185,148
|
||||
CAPTION "Delete a service"
|
||||
FONT 8,"Tahoma",0,0
|
||||
STYLE WS_BORDER | WS_DLGFRAME | DS_MODALFRAME
|
||||
BEGIN
|
||||
ICON IDI_WARNING, IDC_STATIC, 10, 8, 24, 22
|
||||
LTEXT "Are you sure you want to delete the following service? This cannot be undone once removed!", IDC_STATIC, 50, 6, 125, 25
|
||||
LTEXT "Service Name:",IDC_STATIC, 6, 40, 80, 9
|
||||
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
|
||||
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
|
||||
PUSHBUTTON "Yes", IDOK, 26, 129, 54, 13
|
||||
PUSHBUTTON "No", IDCANCEL, 102, 129, 54, 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
|
||||
@@ -129,9 +158,9 @@ STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
|
||||
EXSTYLE WS_EX_TOOLWINDOW
|
||||
BEGIN
|
||||
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
|
||||
LTEXT "", IDC_SERVCON_INFO, 8, 5, 236, 11
|
||||
LTEXT "", IDC_SERVCON_NAME, 8, 25, 66, 11
|
||||
PUSHBUTTON "&Close", IDOK, 100, 70, 54, 13
|
||||
END
|
||||
|
||||
|
||||
@@ -159,7 +188,7 @@ END
|
||||
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 +207,14 @@ END
|
||||
|
||||
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"
|
||||
IDS_CREATE_SUCCESS "Service Created Succesfully"
|
||||
IDS_CREATE_REQ "* = required fields"
|
||||
IDS_DELETE_STOP "You must manually stop the service before deleting!"
|
||||
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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: subsys/system/servman/about.c
|
||||
* FILE: base/system/servman/about.c
|
||||
* PURPOSE: About dialog box message handler
|
||||
* COPYRIGHT: Copyright 2005 Ged Murphy <[email protected]>
|
||||
*
|
||||
@@ -21,7 +21,7 @@ AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HWND hLicenseEditWnd;
|
||||
HICON hIcon = NULL;
|
||||
TCHAR strLicense[0x1000];
|
||||
TCHAR strLicense[700];
|
||||
|
||||
switch (message)
|
||||
{
|
||||
@@ -32,7 +32,8 @@ AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
hLicenseEditWnd = GetDlgItem(hDlg, IDC_LICENSE_EDIT);
|
||||
|
||||
LoadString(hInstance, IDS_LICENSE, strLicense, 0x1000);
|
||||
LoadString(hInstance, IDS_LICENSE, strLicense,
|
||||
sizeof(strLicense) / sizeof(TCHAR));
|
||||
|
||||
SetWindowText(hLicenseEditWnd, strLicense);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: subsys/system/servman/control
|
||||
* FILE: base/system/servman/control
|
||||
* PURPOSE: Stops, pauses and resumes a service
|
||||
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <[email protected]>
|
||||
*
|
||||
@@ -106,7 +106,7 @@ BOOL Control(HWND hProgDlg, DWORD Control)
|
||||
GetError(0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (ServiceStatus.dwCheckPoint > dwOldCheckPoint)
|
||||
{
|
||||
/* The service is making progress. increment the progress bar */
|
||||
|
||||
@@ -0,0 +1,266 @@
|
||||
/*
|
||||
* 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 2006 Ged Murphy <[email protected]>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "servman.h"
|
||||
|
||||
extern HINSTANCE hInstance;
|
||||
BOOL bHelpOpen = FALSE;
|
||||
|
||||
|
||||
BOOL Create(LPTSTR ServiceName,
|
||||
LPTSTR DisplayName,
|
||||
LPTSTR BinPath,
|
||||
LPTSTR Description,
|
||||
LPTSTR Options)
|
||||
{
|
||||
SC_HANDLE hSCManager;
|
||||
SC_HANDLE hSc;
|
||||
TCHAR Buf[32];
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
SetDescription(ServiceName, Description);
|
||||
|
||||
LoadString(hInstance, IDS_CREATE_SUCCESS, Buf,
|
||||
sizeof(Buf) / sizeof(TCHAR));
|
||||
DisplayString(Buf);
|
||||
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,
|
||||
sizeof(Buf) / sizeof(TCHAR));
|
||||
|
||||
SetWindowText(hHelp, Buf);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
|
||||
{
|
||||
DestroyIcon(hIcon);
|
||||
DestroyWindow(hDlg);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
bHelpOpen = FALSE;
|
||||
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;
|
||||
TCHAR Buf[32];
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadString(hInstance, IDS_CREATE_REQ, Buf,
|
||||
sizeof(Buf) / sizeof(TCHAR));
|
||||
DisplayString(Buf);
|
||||
SetFocus(hwnd);
|
||||
break;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadString(hInstance, IDS_CREATE_REQ, Buf,
|
||||
sizeof(Buf) / sizeof(TCHAR));
|
||||
DisplayString(Buf);
|
||||
SetFocus(hwnd);
|
||||
break;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadString(hInstance, IDS_CREATE_REQ, Buf,
|
||||
sizeof(Buf) / sizeof(TCHAR));
|
||||
DisplayString(Buf);
|
||||
SetFocus(hwnd);
|
||||
break;
|
||||
}
|
||||
|
||||
/* get description */
|
||||
iLen = 0;
|
||||
hwnd = GetDlgItem(hDlg, IDC_CREATE_DESC);
|
||||
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:
|
||||
{
|
||||
HWND hHelp;
|
||||
|
||||
if (! bHelpOpen)
|
||||
{
|
||||
hHelp = CreateDialog(hInstance,
|
||||
MAKEINTRESOURCE(IDD_DLG_HELP_OPTIONS),
|
||||
hDlg,
|
||||
(DLGPROC)CreateHelpDialogProc);
|
||||
if(hHelp != NULL)
|
||||
{
|
||||
ShowWindow(hHelp, SW_SHOW);
|
||||
bHelpOpen = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/system/servman/delete.c
|
||||
* PURPOSE: Delete an existing service
|
||||
* COPYRIGHT: Copyright 2006 Ged Murphy <[email protected]>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "servman.h"
|
||||
|
||||
extern HINSTANCE hInstance;
|
||||
extern HWND hListView;
|
||||
|
||||
BOOL DoDeleteService(HWND hDlg)
|
||||
{
|
||||
SC_HANDLE hSCManager;
|
||||
SC_HANDLE hSc;
|
||||
ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
|
||||
|
||||
/* open handle to the SCM */
|
||||
hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
|
||||
if (hSCManager == NULL)
|
||||
{
|
||||
GetError(0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* copy pointer to selected service */
|
||||
Service = GetSelectedService();
|
||||
|
||||
/* get a handle to the service requested for starting */
|
||||
hSc = OpenService(hSCManager, Service->lpServiceName, DELETE);
|
||||
if (hSc == NULL)
|
||||
{
|
||||
GetError(0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* start the service opened */
|
||||
if (! DeleteService(hSc))
|
||||
{
|
||||
GetError(0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
CloseServiceHandle(hSCManager);
|
||||
CloseServiceHandle(hSc);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4100)
|
||||
#endif
|
||||
BOOL CALLBACK
|
||||
DeleteDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
|
||||
HICON hIcon = NULL;
|
||||
TCHAR Buf[1000];
|
||||
LVITEM item;
|
||||
|
||||
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);
|
||||
|
||||
/* get pointer to selected service */
|
||||
Service = GetSelectedService();
|
||||
|
||||
SendDlgItemMessage(hDlg, IDC_DEL_NAME, WM_SETTEXT, 0, (LPARAM)Service->lpDisplayName);
|
||||
|
||||
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iItem = GetSelectedItem();
|
||||
item.iSubItem = 1;
|
||||
item.pszText = Buf;
|
||||
item.cchTextMax = sizeof(Buf);
|
||||
SendMessage(hListView, LVM_GETITEM, 0, (LPARAM)&item);
|
||||
|
||||
SendDlgItemMessage(hDlg, IDC_DEL_DESC, WM_SETTEXT, 0,
|
||||
(LPARAM)Buf);
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDOK:
|
||||
if (DoDeleteService(hDlg))
|
||||
ListView_DeleteItem(hListView, GetSelectedItem());
|
||||
|
||||
DestroyIcon(hIcon);
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
DestroyIcon(hIcon);
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 2006 Ged Murphy <[email protected]>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "servman.h"
|
||||
|
||||
extern HWND hListView;
|
||||
|
||||
|
||||
DWORD GetTextFromListView(TCHAR Text[500], INT row, INT col)
|
||||
{
|
||||
LVITEM item;
|
||||
DWORD NumChars;
|
||||
|
||||
ZeroMemory(&item, sizeof(item));
|
||||
item.mask = LVIF_TEXT;
|
||||
item.iSubItem = col;
|
||||
item.pszText = Text;
|
||||
item.cchTextMax = 500;
|
||||
NumChars = (INT)SendMessage(hListView, LVM_GETITEMTEXT, row, (LPARAM)&item);
|
||||
|
||||
return NumChars;
|
||||
}
|
||||
|
||||
|
||||
BOOL SaveServicesToFile(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)
|
||||
{
|
||||
TCHAR LVText[500];
|
||||
TCHAR newl = _T('\n');
|
||||
TCHAR tab = _T('\t');
|
||||
DWORD dwTextLength, dwWritten;
|
||||
INT NumListedServ = 0;
|
||||
INT i, k;
|
||||
|
||||
NumListedServ = ListView_GetItemCount(hListView);
|
||||
|
||||
for (i=0; i < NumListedServ; i++)
|
||||
{
|
||||
for (k=0; k<5; k++)
|
||||
{
|
||||
dwTextLength = GetTextFromListView(LVText, i, k);
|
||||
if (LVText != NULL)
|
||||
{
|
||||
WriteFile(hFile, LVText, sizeof(TCHAR) * dwTextLength, &dwWritten, NULL);
|
||||
WriteFile(hFile, &tab, sizeof(TCHAR), &dwWritten, NULL);
|
||||
}
|
||||
}
|
||||
WriteFile(hFile, &newl, sizeof(TCHAR), &dwWritten, NULL);
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
bSuccess = TRUE;
|
||||
}
|
||||
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 (Tab Delimited)(*.txt)\0*.txt\0Text (Comma Delimited)(*.csv)\0*.csv\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))
|
||||
{
|
||||
if (SaveServicesToFile(szFileName))
|
||||
return;
|
||||
}
|
||||
|
||||
if (CommDlgExtendedError() != CDERR_GENERALCODES)
|
||||
MessageBox(NULL, _T("Export to file failed"), NULL, 0);
|
||||
}
|
||||
@@ -1,6 +1,14 @@
|
||||
//#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 <[email protected]>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "servman.h"
|
||||
/* temp file for debugging */
|
||||
|
||||
|
||||
VOID GetError(DWORD err)
|
||||
{
|
||||
@@ -28,6 +36,6 @@ VOID GetError(DWORD err)
|
||||
VOID DisplayString(PTCHAR Msg)
|
||||
{
|
||||
|
||||
MessageBox(NULL, Msg, _T("Error!"), MB_OK | MB_ICONERROR);
|
||||
MessageBox(NULL, Msg, _T("Note!"), MB_OK);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: subsys/system/servman/progress.c
|
||||
* FILE: base/system/servman/progress.c
|
||||
* PURPOSE: Progress dialog box message handler
|
||||
* COPYRIGHT: Copyright 2006 Ged Murphy <[email protected]>
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: subsys/system/servman/propsheet.c
|
||||
* FILE: base/system/servman/propsheet.c
|
||||
* PURPOSE: Property dialog box message handler
|
||||
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <[email protected]>
|
||||
*
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "servman.h"
|
||||
|
||||
HWND hwndGenDlg;
|
||||
extern ENUM_SERVICE_STATUS_PROCESS *pServiceStatus;
|
||||
extern HINSTANCE hInstance;
|
||||
extern HWND hListView;
|
||||
@@ -27,18 +28,67 @@ typedef struct _PROP_DLG_INFO
|
||||
} PROP_DLG_INFO, *PPROP_DLG_INFO;
|
||||
|
||||
|
||||
|
||||
VOID SetButtonStates()
|
||||
{
|
||||
HWND hButton;
|
||||
ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
|
||||
DWORD Flags, State;
|
||||
|
||||
/* get pointer to selected service */
|
||||
Service = GetSelectedService();
|
||||
|
||||
Flags = Service->ServiceStatusProcess.dwControlsAccepted;
|
||||
State = Service->ServiceStatusProcess.dwCurrentState;
|
||||
|
||||
if (State == SERVICE_STOPPED)
|
||||
{
|
||||
hButton = GetDlgItem(hwndGenDlg, IDC_START);
|
||||
EnableWindow (hButton, TRUE);
|
||||
}
|
||||
|
||||
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||
{
|
||||
hButton = GetDlgItem(hwndGenDlg, IDC_STOP);
|
||||
EnableWindow (hButton, TRUE);
|
||||
}
|
||||
|
||||
if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) )
|
||||
{
|
||||
hButton = GetDlgItem(hwndGenDlg, IDC_PAUSE);
|
||||
EnableWindow (hButton, TRUE);
|
||||
}
|
||||
|
||||
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||
{
|
||||
hButton = GetDlgItem(hwndGenDlg, IDC_PAUSE);
|
||||
EnableWindow (hButton, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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(LPTSTR lpServiceName)
|
||||
{
|
||||
HWND hList;
|
||||
HKEY hKey;
|
||||
TCHAR buf[25];
|
||||
DWORD dwValueSize = 0;
|
||||
DWORD StartUp = 0;
|
||||
LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s");
|
||||
TCHAR KeyBuf[300];
|
||||
|
||||
hList = GetDlgItem(hwndDlg, IDC_START_TYPE);
|
||||
/* open the registry key for the service */
|
||||
_sntprintf(KeyBuf, sizeof(KeyBuf) / sizeof(TCHAR), Path, lpServiceName);
|
||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
KeyBuf,
|
||||
0,
|
||||
KEY_READ,
|
||||
&hKey);
|
||||
|
||||
hList = GetDlgItem(hwndGenDlg, IDC_START_TYPE);
|
||||
|
||||
LoadString(hInstance, IDS_SERVICES_AUTO, buf, sizeof(buf) / sizeof(TCHAR));
|
||||
SendMessage(hList, CB_ADDSTRING, 0, (LPARAM)buf);
|
||||
@@ -73,51 +123,41 @@ VOID SetStartupType(HKEY hKey, HWND hwndDlg)
|
||||
* Populates the General Properties dialog with
|
||||
* the relevant service information
|
||||
*/
|
||||
VOID GetDlgInfo(HWND hwndDlg)
|
||||
VOID GetDlgInfo()
|
||||
{
|
||||
HKEY hKey;
|
||||
ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
|
||||
PROP_DLG_INFO DlgInfo;
|
||||
LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s");
|
||||
TCHAR buf[300];
|
||||
|
||||
|
||||
/* get pointer to selected service */
|
||||
Service = GetSelectedService();
|
||||
|
||||
/* open the registry key for the service */
|
||||
_sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, Service->lpServiceName);
|
||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
buf,
|
||||
0,
|
||||
KEY_READ,
|
||||
&hKey);
|
||||
|
||||
/* 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,
|
||||
if (GetDescription(Service->lpServiceName, &DlgInfo.lpDescription))
|
||||
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(Service->lpServiceName);
|
||||
|
||||
|
||||
/* set service status */
|
||||
@@ -125,21 +165,19 @@ VOID GetDlgInfo(HWND hwndDlg)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4100)
|
||||
#endif
|
||||
@@ -148,54 +186,72 @@ VOID GetDlgInfo(HWND hwndDlg)
|
||||
* 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);
|
||||
break;
|
||||
GetDlgInfo();
|
||||
SetButtonStates();
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case IDC_START_TYPE:
|
||||
/* Enable the 'Apply' button */
|
||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
|
||||
case IDC_START:
|
||||
SendMessage(hMainWnd, WM_COMMAND, ID_START, 0);
|
||||
break;
|
||||
break;
|
||||
|
||||
case IDC_STOP:
|
||||
SendMessage(hMainWnd, WM_COMMAND, ID_STOP, 0);
|
||||
break;
|
||||
break;
|
||||
|
||||
case IDC_PAUSE:
|
||||
SendMessage(hMainWnd, WM_COMMAND, ID_PAUSE, 0);
|
||||
break;
|
||||
break;
|
||||
|
||||
case IDC_RESUME:
|
||||
SendMessage(hMainWnd, WM_COMMAND, ID_RESUME, 0);
|
||||
break;
|
||||
break;
|
||||
|
||||
case IDC_START_PARAM:
|
||||
/* Enable the 'Apply' button */
|
||||
//PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
break;
|
||||
break;
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
||||
|
||||
switch (lpnm->code)
|
||||
|
||||
default:
|
||||
{
|
||||
case MCN_SELECT:
|
||||
/* Enable the 'Apply' button */
|
||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -207,12 +263,11 @@ GeneralPageProc(HWND hwndDlg,
|
||||
* 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)
|
||||
@@ -252,6 +307,37 @@ DependanciesPageProc(HWND hwndDlg,
|
||||
}
|
||||
|
||||
|
||||
INT CALLBACK AddEditButton(HWND hwnd, UINT message, LPARAM lParam)
|
||||
{
|
||||
HWND hEditButton;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case PSCB_PRECREATE:
|
||||
/*hEditButton = CreateWindowEx(0,
|
||||
WC_BUTTON,
|
||||
NULL,
|
||||
WS_CHILD | WS_VISIBLE,
|
||||
20, 300, 30, 15,
|
||||
hwnd,
|
||||
NULL,
|
||||
hInstance,
|
||||
NULL);
|
||||
if (hEditButton == NULL)
|
||||
GetError(0);*/
|
||||
|
||||
hEditButton = GetDlgItem(hwnd, PSBTN_OK);
|
||||
DestroyWindow(hEditButton);
|
||||
//SetWindowText(hEditButton, _T("test"));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static VOID
|
||||
InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
|
||||
{
|
||||
@@ -267,29 +353,30 @@ InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
|
||||
LONG APIENTRY
|
||||
OpenPropSheet(HWND hwnd)
|
||||
{
|
||||
PROPSHEETHEADER psh;
|
||||
PROPSHEETPAGE psp[2];
|
||||
TCHAR Caption[256];
|
||||
PROPSHEETHEADER psh;
|
||||
PROPSHEETPAGE psp[2];
|
||||
ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
|
||||
|
||||
LoadString(hInstance, IDS_PROP_SHEET, Caption, sizeof(Caption) / sizeof(TCHAR));
|
||||
Service = GetSelectedService();
|
||||
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
|
||||
psh.hwndParent = NULL;
|
||||
psh.hInstance = hInstance;
|
||||
psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SM_ICON));
|
||||
psh.pszCaption = Caption;
|
||||
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
||||
psh.nStartPage = 0;
|
||||
psh.ppsp = psp;
|
||||
|
||||
InitPropSheetPage(&psp[0], IDD_DLG_GENERAL, GeneralPageProc);
|
||||
//InitPropSheetPage(&psp[1], IDD_DLG_GENERAL, LogonPageProc);
|
||||
//InitPropSheetPage(&psp[2], IDD_DLG_GENERAL, RecoveryPageProc);
|
||||
InitPropSheetPage(&psp[1], IDD_DLG_DEPEND, DependanciesPageProc);
|
||||
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
||||
psh.dwSize = sizeof(PROPSHEETHEADER);
|
||||
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE | PSH_USECALLBACK;
|
||||
psh.hwndParent = hwnd;
|
||||
psh.hInstance = hInstance;
|
||||
psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SM_ICON));
|
||||
psh.pszCaption = Service->lpDisplayName;
|
||||
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
|
||||
psh.nStartPage = 0;
|
||||
psh.pfnCallback = AddEditButton;
|
||||
psh.ppsp = psp;
|
||||
|
||||
|
||||
return (LONG)(PropertySheet(&psh) != -1);
|
||||
InitPropSheetPage(&psp[0], IDD_DLG_GENERAL, GeneralPageProc);
|
||||
//InitPropSheetPage(&psp[1], IDD_DLG_GENERAL, LogonPageProc);
|
||||
//InitPropSheetPage(&psp[2], IDD_DLG_GENERAL, RecoveryPageProc);
|
||||
InitPropSheetPage(&psp[1], IDD_DLG_DEPEND, DependanciesPageProc);
|
||||
|
||||
return (LONG)(PropertySheet(&psh) != -1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: subsys/system/servman/query.c
|
||||
* FILE: base/system/servman/query.c
|
||||
* PURPOSE: Query service information
|
||||
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <[email protected]>
|
||||
*
|
||||
@@ -25,7 +25,7 @@ VOID FreeMemory(VOID)
|
||||
|
||||
|
||||
|
||||
ENUM_SERVICE_STATUS_PROCESS*
|
||||
ENUM_SERVICE_STATUS_PROCESS*
|
||||
GetSelectedService(VOID)
|
||||
{
|
||||
ENUM_SERVICE_STATUS_PROCESS *pSelectedService = NULL;
|
||||
@@ -42,18 +42,67 @@ GetSelectedService(VOID)
|
||||
}
|
||||
|
||||
|
||||
/* Retrives the service description from the registry */
|
||||
BOOL GetDescription(HKEY hKey, LPTSTR *retDescription)
|
||||
/* Sets the service description in the registry */
|
||||
BOOL SetDescription(LPTSTR ServiceName, LPTSTR Description)
|
||||
{
|
||||
HKEY hKey;
|
||||
LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s");
|
||||
TCHAR buf[300];
|
||||
TCHAR szBuf[MAX_PATH];
|
||||
LONG val;
|
||||
|
||||
|
||||
/* open the registry key for the service */
|
||||
_sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, ServiceName);
|
||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
buf,
|
||||
0,
|
||||
KEY_WRITE,
|
||||
&hKey);
|
||||
|
||||
|
||||
if ((val = RegSetValueEx(hKey,
|
||||
_T("Description"),
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)Description,
|
||||
(DWORD)lstrlen(szBuf)+1)) != ERROR_SUCCESS)
|
||||
{
|
||||
GetError(val);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
RegCloseKey(hKey);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Retrives the service description from the registry */
|
||||
BOOL GetDescription(LPTSTR lpServiceName, LPTSTR *retDescription)
|
||||
{
|
||||
HKEY hKey;
|
||||
LPTSTR Description = NULL;
|
||||
DWORD dwValueSize = 0;
|
||||
LONG ret = RegQueryValueEx(hKey,
|
||||
_T("Description"),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&dwValueSize);
|
||||
LONG ret;
|
||||
LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s");
|
||||
TCHAR buf[300];
|
||||
|
||||
/* open the registry key for the service */
|
||||
_sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, lpServiceName);
|
||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
buf,
|
||||
0,
|
||||
KEY_READ,
|
||||
&hKey);
|
||||
|
||||
ret = RegQueryValueEx(hKey,
|
||||
_T("Description"),
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&dwValueSize);
|
||||
if (ret != ERROR_SUCCESS && ret != ERROR_FILE_NOT_FOUND && ret != ERROR_INVALID_HANDLE)
|
||||
{
|
||||
RegCloseKey(hKey);
|
||||
@@ -158,6 +207,34 @@ cleanup:
|
||||
}
|
||||
|
||||
|
||||
VOID InitListViewImage(VOID)
|
||||
{
|
||||
HICON hSmIconItem, hLgIconItem; /* icon for list-view items */
|
||||
HIMAGELIST hSmall, hLarge; /* image list for other views */
|
||||
|
||||
|
||||
/* Create the icon image lists */
|
||||
hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
|
||||
GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, 1, 1);
|
||||
|
||||
hLarge = ImageList_Create(GetSystemMetrics(SM_CXICON),
|
||||
GetSystemMetrics(SM_CYICON), ILC_MASK | ILC_COLOR32, 1, 1);
|
||||
|
||||
/* Add an icon to each image list */
|
||||
hSmIconItem = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON),
|
||||
IMAGE_ICON, 16, 16, 0);
|
||||
ImageList_AddIcon(hSmall, hSmIconItem);
|
||||
|
||||
hLgIconItem = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON),
|
||||
IMAGE_ICON, 32, 32, 0);
|
||||
ImageList_AddIcon(hLarge, hLgIconItem);
|
||||
|
||||
/* assign the image to the list view */
|
||||
ListView_SetImageList(hListView, hSmall, LVSIL_SMALL);
|
||||
ListView_SetImageList(hListView, hLarge, LVSIL_NORMAL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOL
|
||||
@@ -172,27 +249,15 @@ RefreshServiceList(VOID)
|
||||
|
||||
ListView_DeleteAllItems(hListView);
|
||||
|
||||
InitListViewImage();
|
||||
|
||||
NumServices = GetServiceList();
|
||||
|
||||
if (NumServices)
|
||||
{
|
||||
HICON hiconItem; /* icon for list-view items */
|
||||
HIMAGELIST hSmall; /* image list for other views */
|
||||
TCHAR buf[300]; /* buffer to hold key path */
|
||||
INT NumListedServ = 0; /* how many services were listed */
|
||||
|
||||
/* Create the icon image lists */
|
||||
hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),
|
||||
GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR16, 1, 1);
|
||||
|
||||
/* Add an icon to each image list */
|
||||
hiconItem = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON),
|
||||
IMAGE_ICON, 16, 16, 0);
|
||||
ImageList_AddIcon(hSmall, hiconItem);
|
||||
|
||||
/* assign the image to the list view */
|
||||
ListView_SetImageList(hListView, hSmall, LVSIL_SMALL);
|
||||
|
||||
for (Index = 0; Index < NumServices; Index++)
|
||||
{
|
||||
HKEY hKey = NULL;
|
||||
@@ -228,10 +293,9 @@ RefreshServiceList(VOID)
|
||||
|
||||
|
||||
|
||||
|
||||
/* set the description */
|
||||
|
||||
if (GetDescription(hKey, &Description))
|
||||
if (GetDescription(pServiceStatus[Index].lpServiceName, &Description))
|
||||
{
|
||||
item.pszText = Description;
|
||||
item.iSubItem = 1;
|
||||
@@ -414,206 +478,3 @@ GetServiceList(VOID)
|
||||
|
||||
return NumServices;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
//WORD wCodePage;
|
||||
//WORD wLangID;
|
||||
//SC_HANDLE hService;
|
||||
//DWORD dwHandle, dwLen;
|
||||
//UINT BufLen;
|
||||
//TCHAR* lpData;
|
||||
//TCHAR* lpBuffer;
|
||||
//TCHAR szStrFileInfo[80];
|
||||
//TCHAR FileName[MAX_PATH];
|
||||
//LPVOID pvData;
|
||||
|
||||
//LPSERVICE_FAILURE_ACTIONS pServiceFailureActions = NULL;
|
||||
//LPQUERY_SERVICE_CONFIG pServiceConfig = NULL;
|
||||
|
||||
BytesNeeded = 0;
|
||||
hService = OpenService(ScHandle,
|
||||
pServiceStatus[Index].lpServiceName,
|
||||
SC_MANAGER_CONNECT);
|
||||
if (hService != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
/ * check if service is required by the system* /
|
||||
if (!QueryServiceConfig2(hService,
|
||||
SERVICE_CONFIG_FAILURE_ACTIONS,
|
||||
(LPBYTE)pServiceFailureActions,
|
||||
0,
|
||||
&BytesNeeded))
|
||||
{
|
||||
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
pServiceFailureActions = (LPSERVICE_FAILURE_ACTIONS)
|
||||
HeapAlloc(GetProcessHeap(), 0, BytesNeeded);
|
||||
if (pServiceFailureActions == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!QueryServiceConfig2(hService,
|
||||
SERVICE_CONFIG_FAILURE_ACTIONS,
|
||||
(LPBYTE)pServiceFailureActions,
|
||||
BytesNeeded,
|
||||
&BytesNeeded))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pServiceFailureActions);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else / * exit on failure * /
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (pServiceFailureActions->cActions)
|
||||
{
|
||||
if (pServiceFailureActions->lpsaActions[0].Type == SC_ACTION_REBOOT)
|
||||
{
|
||||
LoadString(hInstance, IDS_SERVICES_YES, szStatus, 128);
|
||||
item.pszText = szStatus;
|
||||
item.iSubItem = 1;
|
||||
SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
|
||||
}
|
||||
}
|
||||
|
||||
if (pServiceFailureActions != NULL)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pServiceFailureActions);
|
||||
pServiceFailureActions = NULL;
|
||||
}
|
||||
|
||||
/ * get vendor of service binary * /
|
||||
BytesNeeded = 0;
|
||||
if (!QueryServiceConfig(hService, pServiceConfig, 0, &BytesNeeded))
|
||||
{
|
||||
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
pServiceConfig = (LPQUERY_SERVICE_CONFIG)
|
||||
HeapAlloc(GetProcessHeap(), 0, BytesNeeded);
|
||||
if (pServiceConfig == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!QueryServiceConfig(hService,
|
||||
pServiceConfig,
|
||||
BytesNeeded,
|
||||
&BytesNeeded))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, pServiceConfig);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else / * exit on failure * /
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
memset(&FileName, 0, MAX_PATH);
|
||||
if (_tcscspn(pServiceConfig->lpBinaryPathName, _T("\"")))
|
||||
{
|
||||
_tcsncpy(FileName, pServiceConfig->lpBinaryPathName,
|
||||
_tcscspn(pServiceConfig->lpBinaryPathName, _T(" ")) );
|
||||
}
|
||||
else
|
||||
{
|
||||
_tcscpy(FileName, pServiceConfig->lpBinaryPathName);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, pServiceConfig);
|
||||
pServiceConfig = NULL;
|
||||
|
||||
dwLen = GetFileVersionInfoSize(FileName, &dwHandle);
|
||||
if (dwLen)
|
||||
{
|
||||
lpData = (TCHAR*) HeapAlloc(GetProcessHeap(), 0, dwLen);
|
||||
if (lpData == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!GetFileVersionInfo (FileName, dwHandle, dwLen, lpData)) {
|
||||
HeapFree(GetProcessHeap(), 0, lpData);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"), &pvData, (PUINT) &BufLen))
|
||||
{
|
||||
wCodePage = LOWORD(*(DWORD*) pvData);
|
||||
wLangID = HIWORD(*(DWORD*) pvData);
|
||||
wsprintf(szStrFileInfo, _T("StringFileInfo\\%04X%04X\\CompanyName"), wCodePage, wLangID);
|
||||
}
|
||||
|
||||
if (VerQueryValue (lpData, szStrFileInfo, (LPVOID) &lpBuffer, (PUINT) &BufLen)) {
|
||||
item.pszText = lpBuffer;
|
||||
item.iSubItem = 2;
|
||||
SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, lpData);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadString(hInstance, IDS_SERVICES_UNKNOWN, szStatus, 128);
|
||||
item.pszText = szStatus;
|
||||
item.iSubItem = 2;
|
||||
SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
|
||||
}
|
||||
CloseServiceHandle(hService);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, pServiceConfig);
|
||||
pServiceConfig = NULL;
|
||||
|
||||
dwLen = GetFileVersionInfoSize(FileName, &dwHandle);
|
||||
if (dwLen)
|
||||
{
|
||||
lpData = (TCHAR*) HeapAlloc(GetProcessHeap(), 0, dwLen);
|
||||
if (lpData == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!GetFileVersionInfo (FileName, dwHandle, dwLen, lpData)) {
|
||||
HeapFree(GetProcessHeap(), 0, lpData);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (VerQueryValue(lpData, _T("\\VarFileInfo\\Translation"),
|
||||
&pvData, (PUINT) &BufLen))
|
||||
{
|
||||
wCodePage = LOWORD(*(DWORD*) pvData);
|
||||
wLangID = HIWORD(*(DWORD*) pvData);
|
||||
wsprintf(szStrFileInfo, _T("StringFileInfo\\%04X%04X\\CompanyName"),
|
||||
wCodePage, wLangID);
|
||||
}
|
||||
|
||||
if (VerQueryValue (lpData, szStrFileInfo, (LPVOID) &lpBuffer, (PUINT) &BufLen))
|
||||
{
|
||||
item.pszText = lpBuffer;
|
||||
item.iSubItem = 2;
|
||||
SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, lpData);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadString(hInstance, IDS_SERVICES_UNKNOWN, szStatus, 128);
|
||||
item.pszText = szStatus;
|
||||
item.iSubItem = 2;
|
||||
SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define IDC_SERVLIST 1000
|
||||
#define IDC_TOOLBAR 1001
|
||||
#define IDC_STATUSBAR 1002
|
||||
#define IDC_EDIT_BUTTON 1003
|
||||
|
||||
#define ID_PROP 2000
|
||||
#define ID_REFRESH 2001
|
||||
@@ -17,13 +18,20 @@
|
||||
#define ID_PAUSE 2005
|
||||
#define ID_RESUME 2006
|
||||
#define ID_RESTART 2007
|
||||
#define ID_NEW 2008
|
||||
#define ID_HELP 2009
|
||||
#define ID_EXIT 2010
|
||||
#define ID_EDIT 2008
|
||||
#define ID_CREATE 2009
|
||||
#define ID_DELETE 2010
|
||||
#define ID_HELP 2011
|
||||
#define ID_EXIT 2012
|
||||
#define ID_NET_CON 2013
|
||||
|
||||
#define IDR_MAINMENU 102
|
||||
#define IDR_POPUP 103
|
||||
#define ID_VIEW_CUSTOMIZE 4021
|
||||
#define ID_VIEW_LARGE 4022
|
||||
#define ID_VIEW_SMALL 4023
|
||||
#define ID_VIEW_LIST 4024
|
||||
#define ID_VIEW_DETAILS 4025
|
||||
#define ID_ABOUT 4031
|
||||
|
||||
/* List view columns */
|
||||
@@ -59,7 +67,7 @@
|
||||
#define TBICON_PROP 0
|
||||
#define TBICON_REFRESH 1
|
||||
#define TBICON_EXPORT 2
|
||||
#define TBICON_NEW 3
|
||||
#define TBICON_CREATE 3
|
||||
#define TBICON_START 4
|
||||
#define TBICON_STOP 5
|
||||
#define TBICON_PAUSE 6
|
||||
@@ -68,7 +76,6 @@
|
||||
#define TBICON_EXIT 9
|
||||
|
||||
/* properties dialog */
|
||||
#define IDS_PROP_SHEET 10000
|
||||
#define IDD_DLG_GENERAL 10001
|
||||
#define IDC_SERV_NAME 10041
|
||||
#define IDC_DISP_NAME 10051
|
||||
@@ -82,6 +89,7 @@
|
||||
#define IDC_RESUME 10161
|
||||
#define IDC_START_PARAM 10191
|
||||
|
||||
/* dependancies dialog */
|
||||
#define IDD_DLG_DEPEND 20001
|
||||
#define IDC_DEPEND_TREE1 20002
|
||||
#define IDC_DEPEND_TREE2 20003
|
||||
@@ -96,10 +104,27 @@
|
||||
#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
|
||||
#define IDS_CREATE_SUCCESS 8023
|
||||
#define IDS_CREATE_REQ 8024
|
||||
|
||||
|
||||
/* delete service dialog */
|
||||
#define IDD_DLG_DELETE 9000
|
||||
#define IDC_DEL_GROUP 9001
|
||||
#define IDC_DEL_NAME 9002
|
||||
#define IDC_DEL_DESC 9003
|
||||
#define IDS_DELETE_STOP 9010
|
||||
|
||||
|
||||
/* 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
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: subsys/system/servman/servman.c
|
||||
* FILE: base/system/servman/servman.c
|
||||
* PURPOSE: Main window message handler
|
||||
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <[email protected]>
|
||||
*
|
||||
@@ -18,7 +18,11 @@ HWND hStatus;
|
||||
HWND hTool;
|
||||
HWND hProgDlg;
|
||||
HMENU hShortcutMenu;
|
||||
INT SelectedItem;
|
||||
INT SelectedItem = -1;
|
||||
|
||||
TBBUTTON *ptbb;
|
||||
|
||||
extern HWND hwndGenDlg;
|
||||
|
||||
|
||||
INT GetSelectedItem(VOID)
|
||||
@@ -26,6 +30,99 @@ INT GetSelectedItem(VOID)
|
||||
return SelectedItem;
|
||||
}
|
||||
|
||||
VOID SetView(DWORD View)
|
||||
{
|
||||
DWORD Style = GetWindowLong(hListView, GWL_STYLE);
|
||||
|
||||
if ((Style & LVS_TYPEMASK) != View)
|
||||
SetWindowLong(hListView, GWL_STYLE, (Style & ~LVS_TYPEMASK) | View);
|
||||
}
|
||||
|
||||
|
||||
VOID SetMenuAndButtonStates()
|
||||
{
|
||||
HMENU hMainMenu;
|
||||
ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
|
||||
DWORD Flags, State;
|
||||
|
||||
/* get handle to menu */
|
||||
hMainMenu = GetMenu(hMainWnd);
|
||||
|
||||
/* set all to greyed */
|
||||
EnableMenuItem(hMainMenu, ID_START, MF_GRAYED);
|
||||
EnableMenuItem(hMainMenu, ID_STOP, MF_GRAYED);
|
||||
EnableMenuItem(hMainMenu, ID_PAUSE, MF_GRAYED);
|
||||
EnableMenuItem(hMainMenu, ID_RESUME, MF_GRAYED);
|
||||
EnableMenuItem(hMainMenu, ID_RESTART, MF_GRAYED);
|
||||
|
||||
EnableMenuItem(hShortcutMenu, ID_START, MF_GRAYED);
|
||||
EnableMenuItem(hShortcutMenu, ID_STOP, MF_GRAYED);
|
||||
EnableMenuItem(hShortcutMenu, ID_PAUSE, MF_GRAYED);
|
||||
EnableMenuItem(hShortcutMenu, ID_RESUME, MF_GRAYED);
|
||||
EnableMenuItem(hShortcutMenu, ID_RESTART, MF_GRAYED);
|
||||
|
||||
SendMessage(hTool, TB_SETSTATE, ID_START,
|
||||
(LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
|
||||
SendMessage(hTool, TB_SETSTATE, ID_STOP,
|
||||
(LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
|
||||
SendMessage(hTool, TB_SETSTATE, ID_PAUSE,
|
||||
(LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
|
||||
SendMessage(hTool, TB_SETSTATE, ID_RESTART,
|
||||
(LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
|
||||
|
||||
if (GetSelectedItem() != -1)
|
||||
{
|
||||
/* get pointer to selected service */
|
||||
Service = GetSelectedService();
|
||||
|
||||
Flags = Service->ServiceStatusProcess.dwControlsAccepted;
|
||||
State = Service->ServiceStatusProcess.dwCurrentState;
|
||||
|
||||
if (State == SERVICE_STOPPED)
|
||||
{
|
||||
EnableMenuItem(hMainMenu, ID_START, MF_ENABLED);
|
||||
EnableMenuItem(hShortcutMenu, ID_START, MF_ENABLED);
|
||||
SendMessage(hTool, TB_SETSTATE, ID_START,
|
||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||
}
|
||||
|
||||
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||
{
|
||||
EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED);
|
||||
EnableMenuItem(hShortcutMenu, ID_STOP, MF_ENABLED);
|
||||
SendMessage(hTool, TB_SETSTATE, ID_STOP,
|
||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||
}
|
||||
|
||||
if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) )
|
||||
{
|
||||
EnableMenuItem(hMainMenu, ID_PAUSE, MF_ENABLED);
|
||||
EnableMenuItem(hShortcutMenu, ID_PAUSE, MF_ENABLED);
|
||||
SendMessage(hTool, TB_SETSTATE, ID_PAUSE,
|
||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||
}
|
||||
|
||||
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||
{
|
||||
EnableMenuItem(hMainMenu, ID_RESTART, MF_ENABLED);
|
||||
EnableMenuItem(hShortcutMenu, ID_RESTART, MF_ENABLED);
|
||||
SendMessage(hTool, TB_SETSTATE, ID_RESTART,
|
||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EnableMenuItem(hMainMenu, ID_PROP, MF_GRAYED);
|
||||
EnableMenuItem(hMainMenu, ID_DELETE, MF_GRAYED);
|
||||
EnableMenuItem(hShortcutMenu, ID_DELETE, MF_GRAYED);
|
||||
SendMessage(hTool, TB_SETSTATE, ID_PROP,
|
||||
(LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
@@ -42,29 +139,31 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
/* Toolbar buttons */
|
||||
TBBUTTON tbb [NUM_BUTTONS] =
|
||||
{ /* iBitmap, idCommand, fsState, fsStyle, bReserved[2], dwData, iString */
|
||||
{TBICON_PROP, ID_PROP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* properties */
|
||||
{TBICON_REFRESH, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* refresh */
|
||||
{TBICON_EXPORT, ID_EXPORT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* export */
|
||||
{TBICON_PROP, ID_PROP, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0}, /* properties */
|
||||
{TBICON_REFRESH, ID_REFRESH, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* refresh */
|
||||
{TBICON_EXPORT, ID_EXPORT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0}, /* export */
|
||||
|
||||
/* Note: First item for a seperator is its width in pixels */
|
||||
{15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
|
||||
{15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
|
||||
|
||||
{TBICON_NEW, ID_NEW, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* create */
|
||||
{TBICON_CREATE, ID_CREATE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* create */
|
||||
|
||||
{15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
|
||||
{15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
|
||||
|
||||
{TBICON_START, ID_START, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* start */
|
||||
{TBICON_STOP, ID_STOP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* stop */
|
||||
{TBICON_PAUSE, ID_PAUSE, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* pause */
|
||||
{TBICON_RESTART, ID_RESTART, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* restart */
|
||||
{TBICON_START, ID_START, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* start */
|
||||
{TBICON_STOP, ID_STOP, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* stop */
|
||||
{TBICON_PAUSE, ID_PAUSE, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* pause */
|
||||
{TBICON_RESTART, ID_RESTART, TBSTATE_INDETERMINATE, BTNS_BUTTON, {0}, 0, 0 }, /* restart */
|
||||
|
||||
{15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
|
||||
{15, 0, TBSTATE_ENABLED, BTNS_SEP, {0}, 0, 0}, /* separator */
|
||||
|
||||
{TBICON_HELP, ID_HELP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* help */
|
||||
{TBICON_EXIT, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* exit */
|
||||
{TBICON_HELP, ID_HELP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* help */
|
||||
{TBICON_EXIT, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* exit */
|
||||
|
||||
};
|
||||
|
||||
ptbb = tbb;
|
||||
|
||||
/* ======================== Create Toolbar ============================== */
|
||||
|
||||
/* Create Toolbar */
|
||||
@@ -90,7 +189,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
tbb[0].iBitmap += iImageOffset; /* properties */
|
||||
tbb[1].iBitmap += iImageOffset; /* refresh */
|
||||
tbb[2].iBitmap += iImageOffset; /* export */
|
||||
tbb[4].iBitmap += iImageOffset; /* new */
|
||||
tbb[4].iBitmap += iImageOffset; /* create */
|
||||
tbb[6].iBitmap += iImageOffset; /* start */
|
||||
tbb[7].iBitmap += iImageOffset; /* stop */
|
||||
tbb[8].iBitmap += iImageOffset; /* pause */
|
||||
@@ -122,7 +221,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
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;
|
||||
@@ -132,35 +231,40 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
/* name */
|
||||
lvc.iSubItem = 0;
|
||||
lvc.cx = 150;
|
||||
LoadString(hInstance, IDS_FIRSTCOLUMN, szTemp, 256);
|
||||
LoadString(hInstance, IDS_FIRSTCOLUMN, szTemp,
|
||||
sizeof(szTemp) / sizeof(TCHAR));
|
||||
lvc.pszText = szTemp;
|
||||
ListView_InsertColumn(hListView, 0, &lvc);
|
||||
|
||||
/* description */
|
||||
lvc.iSubItem = 1;
|
||||
lvc.cx = 240;
|
||||
LoadString(hInstance, IDS_SECONDCOLUMN, szTemp, 256);
|
||||
LoadString(hInstance, IDS_SECONDCOLUMN, szTemp,
|
||||
sizeof(szTemp) / sizeof(TCHAR));
|
||||
lvc.pszText = szTemp;
|
||||
ListView_InsertColumn(hListView, 1, &lvc);
|
||||
|
||||
/* status */
|
||||
lvc.iSubItem = 2;
|
||||
lvc.cx = 55;
|
||||
LoadString(hInstance, IDS_THIRDCOLUMN, szTemp, 256);
|
||||
LoadString(hInstance, IDS_THIRDCOLUMN, szTemp,
|
||||
sizeof(szTemp) / sizeof(TCHAR));
|
||||
lvc.pszText = szTemp;
|
||||
ListView_InsertColumn(hListView, 2, &lvc);
|
||||
|
||||
/* startup type */
|
||||
lvc.iSubItem = 3;
|
||||
lvc.cx = 80;
|
||||
LoadString(hInstance, IDS_FOURTHCOLUMN, szTemp, 256);
|
||||
LoadString(hInstance, IDS_FOURTHCOLUMN, szTemp,
|
||||
sizeof(szTemp) / sizeof(TCHAR));
|
||||
lvc.pszText = szTemp;
|
||||
ListView_InsertColumn(hListView, 3, &lvc);
|
||||
|
||||
/* logon as */
|
||||
lvc.iSubItem = 4;
|
||||
lvc.cx = 100;
|
||||
LoadString(hInstance, IDS_FITHCOLUMN, szTemp, 256);
|
||||
LoadString(hInstance, IDS_FITHCOLUMN, szTemp,
|
||||
sizeof(szTemp) / sizeof(TCHAR));
|
||||
lvc.pszText = szTemp;
|
||||
ListView_InsertColumn(hListView, 4, &lvc);
|
||||
|
||||
@@ -244,12 +348,47 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
OpenPropSheet(hwnd);
|
||||
break;
|
||||
|
||||
case LVN_COLUMNCLICK:
|
||||
|
||||
break;
|
||||
|
||||
case LVN_ITEMCHANGED:
|
||||
{
|
||||
LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
|
||||
ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
|
||||
HMENU hMainMenu;
|
||||
|
||||
/* get handle to menu */
|
||||
hMainMenu = GetMenu(hMainWnd);
|
||||
|
||||
/* activate properties menu item, if not already */
|
||||
if (GetMenuState(hMainMenu, ID_PROP, MF_BYCOMMAND) != MF_ENABLED)
|
||||
EnableMenuItem(hMainMenu, ID_PROP, MF_ENABLED);
|
||||
|
||||
/* activate delete menu item, if not already */
|
||||
if (GetMenuState(hMainMenu, ID_DELETE, MF_BYCOMMAND) != MF_ENABLED)
|
||||
{
|
||||
EnableMenuItem(hMainMenu, ID_DELETE, MF_ENABLED);
|
||||
EnableMenuItem(hShortcutMenu, ID_DELETE, MF_ENABLED);
|
||||
}
|
||||
|
||||
|
||||
/* globally set selected service */
|
||||
SelectedItem = pnmv->iItem;
|
||||
|
||||
/* alter options for the service */
|
||||
SetMenuAndButtonStates();
|
||||
|
||||
/* get pointer to selected service */
|
||||
Service = GetSelectedService();
|
||||
|
||||
/* set current selected service in the status bar */
|
||||
SendMessage(hStatus, SB_SETTEXT, 1, (LPARAM)Service->lpDisplayName);
|
||||
|
||||
/* show the properties button */
|
||||
SendMessage(hTool, TB_SETSTATE, ID_PROP,
|
||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -277,6 +416,10 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXPORT);
|
||||
break;
|
||||
|
||||
case ID_CREATE:
|
||||
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_NEW);
|
||||
break;
|
||||
|
||||
case ID_START:
|
||||
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_START);
|
||||
break;
|
||||
@@ -293,10 +436,6 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
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;
|
||||
@@ -332,42 +471,88 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
switch(LOWORD(wParam))
|
||||
{
|
||||
case ID_PROP:
|
||||
OpenPropSheet(hwnd);
|
||||
if (GetSelectedItem() != -1)
|
||||
OpenPropSheet(hwnd);
|
||||
|
||||
break;
|
||||
|
||||
case ID_REFRESH:
|
||||
RefreshServiceList();
|
||||
SelectedItem = -1;
|
||||
|
||||
/* disable menus and buttons */
|
||||
SetMenuAndButtonStates();
|
||||
|
||||
/* clear the service in the status bar */
|
||||
SendMessage(hStatus, SB_SETTEXT, 1, _T('\0'));
|
||||
|
||||
break;
|
||||
|
||||
case ID_EXPORT:
|
||||
ExportFile(hListView);
|
||||
SetFocus(hListView);
|
||||
break;
|
||||
|
||||
case ID_CREATE:
|
||||
DialogBox(hInstance,
|
||||
MAKEINTRESOURCE(IDD_DLG_CREATE),
|
||||
hMainWnd,
|
||||
(DLGPROC)CreateDialogProc);
|
||||
SetFocus(hListView);
|
||||
break;
|
||||
|
||||
case ID_DELETE:
|
||||
{
|
||||
ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
|
||||
|
||||
Service = GetSelectedService();
|
||||
|
||||
if (Service->ServiceStatusProcess.dwCurrentState !=
|
||||
SERVICE_RUNNING)
|
||||
{
|
||||
DialogBox(hInstance,
|
||||
MAKEINTRESOURCE(IDD_DLG_DELETE),
|
||||
hMainWnd,
|
||||
(DLGPROC)DeleteDialogProc);
|
||||
}
|
||||
else
|
||||
{
|
||||
TCHAR Buf[60];
|
||||
LoadString(hInstance, IDS_DELETE_STOP, Buf,
|
||||
sizeof(Buf) / sizeof(TCHAR));
|
||||
DisplayString(Buf);
|
||||
}
|
||||
|
||||
SetFocus(hListView);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_START:
|
||||
{
|
||||
ENUM_SERVICE_STATUS_PROCESS *Service = NULL;
|
||||
TCHAR buf1[100];
|
||||
TCHAR buf2[100];
|
||||
TCHAR ProgDlgBuf[100];
|
||||
|
||||
/* open the progress dialog */
|
||||
hProgDlg = CreateDialog(GetModuleHandle(NULL),
|
||||
hProgDlg = CreateDialog(GetModuleHandle(NULL),
|
||||
MAKEINTRESOURCE(IDD_DLG_PROGRESS),
|
||||
hMainWnd,
|
||||
hMainWnd,
|
||||
(DLGPROC)ProgressDialogProc);
|
||||
if (hProgDlg != NULL)
|
||||
{
|
||||
ShowWindow(hProgDlg, SW_SHOW);
|
||||
|
||||
/* 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);
|
||||
LoadString(hInstance, IDS_PROGRESS_INFO_START, ProgDlgBuf,
|
||||
sizeof(ProgDlgBuf) / sizeof(TCHAR));
|
||||
SendDlgItemMessage(hProgDlg, IDC_SERVCON_INFO, WM_SETTEXT,
|
||||
0, (LPARAM)ProgDlgBuf);
|
||||
|
||||
/* get pointer to selected service */
|
||||
Service = GetSelectedService();
|
||||
|
||||
/* write the service name to the progress dialog */
|
||||
SendDlgItemMessage(hProgDlg, IDC_SERVCON_NAME, WM_SETTEXT, 0,
|
||||
SendDlgItemMessage(hProgDlg, IDC_SERVCON_NAME, WM_SETTEXT, 0,
|
||||
(LPARAM)Service->lpServiceName);
|
||||
}
|
||||
|
||||
@@ -375,6 +560,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LVITEM item;
|
||||
TCHAR szStatus[64];
|
||||
TCHAR buf[25];
|
||||
|
||||
LoadString(hInstance, IDS_SERVICES_STARTED, szStatus,
|
||||
sizeof(szStatus) / sizeof(TCHAR));
|
||||
@@ -382,51 +568,72 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
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];
|
||||
TCHAR ProgDlgBuf[100];
|
||||
|
||||
/* open the progress dialog */
|
||||
hProgDlg = CreateDialog(GetModuleHandle(NULL),
|
||||
hProgDlg = CreateDialog(GetModuleHandle(NULL),
|
||||
MAKEINTRESOURCE(IDD_DLG_PROGRESS),
|
||||
hMainWnd,
|
||||
hMainWnd,
|
||||
(DLGPROC)ProgressDialogProc);
|
||||
if (hProgDlg != NULL)
|
||||
{
|
||||
ShowWindow(hProgDlg, SW_SHOW);
|
||||
|
||||
/* 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);
|
||||
LoadString(hInstance, IDS_PROGRESS_INFO_STOP, ProgDlgBuf,
|
||||
sizeof(ProgDlgBuf) / sizeof(TCHAR));
|
||||
SendDlgItemMessage(hProgDlg, IDC_SERVCON_INFO,
|
||||
WM_SETTEXT, 0, (LPARAM)ProgDlgBuf);
|
||||
|
||||
/* get pointer to selected service */
|
||||
Service = GetSelectedService();
|
||||
|
||||
/* write the service name to the progress dialog */
|
||||
SendDlgItemMessage(hProgDlg, IDC_SERVCON_NAME, WM_SETTEXT, 0,
|
||||
SendDlgItemMessage(hProgDlg, IDC_SERVCON_NAME, WM_SETTEXT, 0,
|
||||
(LPARAM)Service->lpServiceName);
|
||||
}
|
||||
|
||||
if( Control(hProgDlg, SERVICE_CONTROL_STOP) )
|
||||
{
|
||||
LVITEM item;
|
||||
TCHAR buf[25];
|
||||
|
||||
item.pszText = '\0';
|
||||
item.pszText = _T('\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,18 +650,32 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
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);
|
||||
SetFocus(hListView);
|
||||
break;
|
||||
|
||||
case ID_EXIT:
|
||||
PostMessage(hwnd, WM_CLOSE, 0, 0);
|
||||
break;
|
||||
|
||||
case ID_VIEW_LARGE:
|
||||
SetView(LVS_ICON);
|
||||
break;
|
||||
|
||||
case ID_VIEW_SMALL:
|
||||
SetView(LVS_SMALLICON);
|
||||
break;
|
||||
|
||||
case ID_VIEW_LIST:
|
||||
SetView(LVS_LIST);
|
||||
break;
|
||||
|
||||
case ID_VIEW_DETAILS:
|
||||
SetView(LVS_REPORT);
|
||||
break;
|
||||
|
||||
case ID_VIEW_CUSTOMIZE:
|
||||
break;
|
||||
|
||||
@@ -463,7 +684,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
MAKEINTRESOURCE(IDD_ABOUTBOX),
|
||||
hMainWnd,
|
||||
(DLGPROC)AboutDialogProc);
|
||||
break;
|
||||
SetFocus(hListView);
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -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,8 @@
|
||||
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 DeleteDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
BOOL CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
BOOL DoStartService(HWND hProgDlg);
|
||||
@@ -29,12 +31,14 @@ VOID GetError(DWORD);
|
||||
VOID FreeMemory(VOID);
|
||||
VOID DisplayString(PTCHAR);
|
||||
|
||||
BOOL GetDescription(HKEY, LPTSTR *);
|
||||
BOOL SetDescription(LPTSTR, LPTSTR);
|
||||
BOOL GetDescription(LPTSTR, LPTSTR *);
|
||||
BOOL GetExecutablePath(LPTSTR *);
|
||||
|
||||
LONG APIENTRY OpenPropSheet(HWND);
|
||||
|
||||
DWORD GetServiceList(VOID);
|
||||
|
||||
VOID ExportFile(HWND);
|
||||
|
||||
#endif /* __SERVMAN_H */
|
||||
|
||||
@@ -1,29 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE project SYSTEM "tools/rbuild/project.dtd">
|
||||
<module name="servman" type="win32gui" installbase="system32" installname="servman.exe">
|
||||
<include base="servman">.</include>
|
||||
<define name="UNICODE" />
|
||||
<define name="_UNICODE" />
|
||||
<define name="__REACTOS__" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x501</define>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>advapi32</library>
|
||||
<library>version</library>
|
||||
<library>comctl32</library>
|
||||
<library>shell32</library>
|
||||
<compilationunit name="unit.c">
|
||||
<file>about.c</file>
|
||||
<file>control.c</file>
|
||||
<file>geterror.c</file>
|
||||
<file>progress.c</file>
|
||||
<file>propsheet.c</file>
|
||||
<file>query.c</file>
|
||||
<file>servman.c</file>
|
||||
<file>start.c</file>
|
||||
</compilationunit>
|
||||
<file>servman.rc</file>
|
||||
<pch>servman.h</pch>
|
||||
</module>
|
||||
<rbuild xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<module name="servman" type="win32gui" installbase="system32" installname="servman.exe">
|
||||
<include base="servman">.</include>
|
||||
<define name="UNICODE" />
|
||||
<define name="_UNICODE" />
|
||||
<define name="__REACTOS__" />
|
||||
<define name="__USE_W32API" />
|
||||
<define name="_WIN32_IE">0x600</define>
|
||||
<define name="_WIN32_WINNT">0x501</define>
|
||||
<library>kernel32</library>
|
||||
<library>user32</library>
|
||||
<library>advapi32</library>
|
||||
<library>version</library>
|
||||
<library>comctl32</library>
|
||||
<library>shell32</library>
|
||||
<library>comdlg32</library>
|
||||
<compilationunit name="unit.c">
|
||||
<file>about.c</file>
|
||||
<file>control.c</file>
|
||||
<file>create.c</file>
|
||||
<file>delete.c</file>
|
||||
<file>export.c</file>
|
||||
<file>geterror.c</file>
|
||||
<file>progress.c</file>
|
||||
<file>propsheet.c</file>
|
||||
<file>query.c</file>
|
||||
<file>servman.c</file>
|
||||
<file>start.c</file>
|
||||
</compilationunit>
|
||||
<file>servman.rc</file>
|
||||
<pch>servman.h</pch>
|
||||
</module>
|
||||
</rbuild>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: subsys/system/servman/start.c
|
||||
* FILE: base/system/servman/start.c
|
||||
* PURPOSE: Start a service
|
||||
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <[email protected]>
|
||||
*
|
||||
@@ -99,7 +99,7 @@ BOOL DoStartService(HWND hProgDlg)
|
||||
GetError(0);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
if (ServiceStatus.dwCheckPoint > dwOldCheckPoint)
|
||||
{
|
||||
/* The service is making progress. increment the progress bar */
|
||||
|
||||
Reference in New Issue
Block a user