Start the move towards a partial rewrite of servman

Too many changes for me to bother listing

svn path=/trunk/; revision=28521
This commit is contained in:
Ged Murphy 2007-08-24 18:27:12 +00:00
parent 00e28fca7d
commit 6aa2fcb6f6
21 changed files with 316 additions and 652 deletions

View file

@ -1,7 +1,7 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/servman/control
* FILE: base/applications/mscutils/servman/control
* PURPOSE: Stops, pauses and resumes a service
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
*
@ -11,9 +11,9 @@
BOOL
Control(PMAIN_WND_INFO Info,
HWND hProgDlg,
DWORD Control)
{
HWND hProgBar;
SC_HANDLE hSCManager;
SC_HANDLE hSc;
SERVICE_STATUS_PROCESS ServiceStatus;
@ -29,19 +29,6 @@ Control(PMAIN_WND_INFO Info,
0,
(LPARAM)&item);
/* set the progress bar range and step */
hProgBar = GetDlgItem(Info->hProgDlg,
IDC_SERVCON_PROGRESS);
SendMessage(hProgBar,
PBM_SETRANGE,
0,
MAKELPARAM(0, PROGRESSRANGE));
SendMessage(hProgBar,
PBM_SETSTEP,
(WPARAM)1,
0);
/* open handle to the SCM */
hSCManager = OpenSCManager(NULL,
NULL,
@ -100,11 +87,7 @@ Control(PMAIN_WND_INFO Info,
else if (dwWaitTime > 5000)
dwWaitTime = 5000;
/* increment the progress bar */
SendMessage(hProgBar,
PBM_STEPIT,
0,
0);
IncrementProgressBar(hProgDlg);
/* wait before checking status */
Sleep(dwWaitTime);
@ -122,11 +105,7 @@ Control(PMAIN_WND_INFO Info,
if (ServiceStatus.dwCheckPoint > dwOldCheckPoint)
{
/* The service is making progress. increment the progress bar */
SendMessage(hProgBar,
PBM_STEPIT,
0,
0);
IncrementProgressBar(hProgDlg);
dwStartTickCount = GetTickCount();
dwOldCheckPoint = ServiceStatus.dwCheckPoint;
}
@ -144,10 +123,7 @@ Control(PMAIN_WND_INFO Info,
if (ServiceStatus.dwCurrentState == Control)
{
SendMessage(hProgBar,
PBM_DELTAPOS,
PROGRESSRANGE,
0);
CompleteProgressBar(hProgDlg);
Sleep(1000);
return TRUE;
}

View file

@ -1,9 +1,9 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/servman/create.c
* FILE: base/applications/mscutils/servman/create.c
* PURPOSE: Create a new service
* COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
* COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
*
*/
@ -70,9 +70,9 @@ DoCreate(PCREATE_DATA Data)
IDS_CREATE_SUCCESS,
Buf,
sizeof(Buf) / sizeof(TCHAR));
DisplayString(Buf);
DisplayString(Buf);
CloseServiceHandle(hSCManager);
CloseServiceHandle(hSCManager);
CloseServiceHandle(hSc);
return TRUE;

View file

@ -36,10 +36,10 @@ static BOOL
SaveServicesToFile(PMAIN_WND_INFO Info,
LPCTSTR pszFileName)
{
HANDLE hFile;
BOOL bSuccess = FALSE;
HANDLE hFile;
BOOL bSuccess = FALSE;
hFile = CreateFile(pszFileName,
hFile = CreateFile(pszFileName,
GENERIC_WRITE,
0,
NULL,
@ -47,21 +47,21 @@ SaveServicesToFile(PMAIN_WND_INFO Info,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(hFile != INVALID_HANDLE_VALUE)
{
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;
DWORD dwTextLength, dwWritten;
INT NumListedServ = 0;
INT i, k;
NumListedServ = ListView_GetItemCount(Info->hListView);
NumListedServ = ListView_GetItemCount(Info->hListView);
for (i=0; i < NumListedServ; i++)
{
for (k=0; k<5; k++)
{
for (i=0; i < NumListedServ; i++)
{
for (k=0; k<5; k++)
{
dwTextLength = GetTextFromListView(Info,
LVText,
i,
@ -80,46 +80,43 @@ SaveServicesToFile(PMAIN_WND_INFO Info,
&dwWritten,
NULL);
}
}
WriteFile(hFile,
}
WriteFile(hFile,
&newl,
sizeof(TCHAR),
&dwWritten,
NULL);
}
}
CloseHandle(hFile);
bSuccess = TRUE;
}
CloseHandle(hFile);
bSuccess = TRUE;
}
return bSuccess;
return bSuccess;
}
VOID ExportFile(PMAIN_WND_INFO Info)
{
OPENFILENAME ofn;
TCHAR szFileName[MAX_PATH] = _T("");
OPENFILENAME ofn;
TCHAR szFileName[MAX_PATH] = _T("");
ZeroMemory(&ofn, sizeof(ofn));
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = Info->hMainWnd;
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;
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = Info->hMainWnd;
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(Info, szFileName))
if(GetSaveFileName(&ofn))
{
if (SaveServicesToFile(Info, szFileName))
return;
}
}
if (CommDlgExtendedError() != CDERR_GENERALCODES)
if (CommDlgExtendedError() != CDERR_GENERALCODES)
MessageBox(NULL, _T("Export to file failed"), NULL, 0);
}

View file

@ -208,8 +208,6 @@ BEGIN
IDS_TOOLTIP_STOP "Ñïèðàíå íà óñëóãàòà"
IDS_TOOLTIP_PAUSE "Çàäúðæàíå (ïàóçà) íà óñëóãàòà"
IDS_TOOLTIP_RESTART "Ïðåçàïóñê íà óñëóãàòà"
IDS_TOOLTIP_HELP "Ïîìîù"
IDS_TOOLTIP_EXIT "Èçõîä"
END
STRINGTABLE DISCARDABLE
@ -226,30 +224,7 @@ 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" */
IDS_HELP_OPTIONS "ÍÀÑÒÐÎÉÊÈ ÇÀ ÑÚÇÄÀÂÀÍÅ:\r\nÇÀÁÅËÅÆÊÀ: Èìåíàòà íà íàñòðîéêèòå âêëþ÷âàò çíàê çà ðàâåíñòâî.\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
#define IDS_HINT_BLANK 20000
#define IDS_HINT_EXPORT 20001
#define IDS_HINT_EXIT 20002
#define IDS_HINT_CONNECT 20011
#define IDS_HINT_START 20012
#define IDS_HINT_STOP 21013
#define IDS_HINT_PAUSE 21014
#define IDS_HINT_RESUME 20015
#define IDS_HINT_RESTART 20016
#define IDS_HINT_REFRESH 20017
#define IDS_HINT_EDIT 20018
#define IDS_HINT_CREATE 20019
#define IDS_HINT_DELETE 20020
#define IDS_HINT_PROP 20021
#define IDS_HINT_LARGE 20030
#define IDS_HINT_SMALL 20031
#define IDS_HINT_LIST 20032
#define IDS_HINT_DETAILS 20033
#define IDS_HINT_CUST 20034
#define IDS_HINT_HELP 20040
#define IDS_HINT_ABOUT 20041
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN

View file

@ -204,8 +204,6 @@ BEGIN
IDS_TOOLTIP_STOP "Dienst beenden"
IDS_TOOLTIP_PAUSE "Dienst anhalten"
IDS_TOOLTIP_RESTART "Dienst neu starten"
IDS_TOOLTIP_HELP "Hilfe"
IDS_TOOLTIP_EXIT "Beenden"
END
STRINGTABLE DISCARDABLE
@ -221,30 +219,7 @@ STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_OPTIONS "ERSTELLOPTIONEN:\r\nBEACHTEN SIE: Der Optionsname enthält das Gleichheitszeichen.\r\n type= <own|share|interact|kernel|filesys|rec>\r\n (Standard = own)\r\n start= <boot|system|auto|demand|disabled>\r\n (Standard = demand) \r\n error= <normal|severe|critical|ignore>\r\n (Standard = normal)\r\n group= <LoadOrderGroup>\r\n tag= <yes|no>\r\n depend= <Abhängigkeiten (getrennt durch / (Schrägstrich))>\r\n obj= <KontoName|ObjektName>\r\n (Standard = LocalSystem)\r\n password= <Passwort>\r\n"
END
#define IDS_HINT_BLANK 20000
#define IDS_HINT_EXPORT 20001
#define IDS_HINT_EXIT 20002
#define IDS_HINT_CONNECT 20011
#define IDS_HINT_START 20012
#define IDS_HINT_STOP 21013
#define IDS_HINT_PAUSE 21014
#define IDS_HINT_RESUME 20015
#define IDS_HINT_RESTART 20016
#define IDS_HINT_REFRESH 20017
#define IDS_HINT_EDIT 20018
#define IDS_HINT_CREATE 20019
#define IDS_HINT_DELETE 20020
#define IDS_HINT_PROP 20021
#define IDS_HINT_LARGE 20030
#define IDS_HINT_SMALL 20031
#define IDS_HINT_LIST 20032
#define IDS_HINT_DETAILS 20033
#define IDS_HINT_CUST 20034
#define IDS_HINT_HELP 20040
#define IDS_HINT_ABOUT 20041
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN

View file

@ -204,8 +204,6 @@ BEGIN
IDS_TOOLTIP_STOP "Stop service"
IDS_TOOLTIP_PAUSE "Pause service"
IDS_TOOLTIP_RESTART "Restart service"
IDS_TOOLTIP_HELP "Help"
IDS_TOOLTIP_EXIT "Exit"
END
STRINGTABLE DISCARDABLE
@ -221,30 +219,7 @@ 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
#define IDS_HINT_BLANK 20000
#define IDS_HINT_EXPORT 20001
#define IDS_HINT_EXIT 20002
#define IDS_HINT_CONNECT 20011
#define IDS_HINT_START 20012
#define IDS_HINT_STOP 21013
#define IDS_HINT_PAUSE 21014
#define IDS_HINT_RESUME 20015
#define IDS_HINT_RESTART 20016
#define IDS_HINT_REFRESH 20017
#define IDS_HINT_EDIT 20018
#define IDS_HINT_CREATE 20019
#define IDS_HINT_DELETE 20020
#define IDS_HINT_PROP 20021
#define IDS_HINT_LARGE 20030
#define IDS_HINT_SMALL 20031
#define IDS_HINT_LIST 20032
#define IDS_HINT_DETAILS 20033
#define IDS_HINT_CUST 20034
#define IDS_HINT_HELP 20040
#define IDS_HINT_ABOUT 20041
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN

View file

@ -208,8 +208,6 @@ BEGIN
IDS_TOOLTIP_STOP "Arrêter le service"
IDS_TOOLTIP_PAUSE "Suspendre le service"
IDS_TOOLTIP_RESTART "Redémarrer le service"
IDS_TOOLTIP_HELP "Aide"
IDS_TOOLTIP_EXIT "Quitter"
END
STRINGTABLE DISCARDABLE
@ -225,30 +223,7 @@ STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_OPTIONS "OPTIONS DE CREATION:\r\nNOTE: le nom de l'option inclue le signe =.\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
#define IDS_HINT_BLANK 20000
#define IDS_HINT_EXPORT 20001
#define IDS_HINT_EXIT 20002
#define IDS_HINT_CONNECT 20011
#define IDS_HINT_START 20012
#define IDS_HINT_STOP 21013
#define IDS_HINT_PAUSE 21014
#define IDS_HINT_RESUME 20015
#define IDS_HINT_RESTART 20016
#define IDS_HINT_REFRESH 20017
#define IDS_HINT_EDIT 20018
#define IDS_HINT_CREATE 20019
#define IDS_HINT_DELETE 20020
#define IDS_HINT_PROP 20021
#define IDS_HINT_LARGE 20030
#define IDS_HINT_SMALL 20031
#define IDS_HINT_LIST 20032
#define IDS_HINT_DETAILS 20033
#define IDS_HINT_CUST 20034
#define IDS_HINT_HELP 20040
#define IDS_HINT_ABOUT 20041
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN

View file

@ -204,8 +204,6 @@ BEGIN
IDS_TOOLTIP_STOP "Menghentikan layanan"
IDS_TOOLTIP_PAUSE "Mengistirahatkan layanan"
IDS_TOOLTIP_RESTART "Memulai lagi layanan"
IDS_TOOLTIP_HELP "Bantuan"
IDS_TOOLTIP_EXIT "Keluar"
END
STRINGTABLE DISCARDABLE
@ -221,30 +219,7 @@ STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_OPTIONS "OPSI BUAT:\r\nCATATAN: Nama opsi termasuk tanda sama dengan.\r\n type= <own|share|interact|kernel|filesys|rec>\r\n (standar = own)\r\n start= <boot|system|auto|demand|disabled>\r\n (standar = demand) \r\n error= <normal|severe|critical|ignore>\r\n (standar = normal)\r\n group= <LoadOrderGroup>\r\n tag= <yes|no>\r\n depend= <Dependencies(dipisahkan oleh / (garis miring))>\r\n obj= <AccountName|ObjectName>\r\n (standar = LocalSystem)\r\n password= <password>\r\n"
END
#define IDS_HINT_BLANK 20000
#define IDS_HINT_EXPORT 20001
#define IDS_HINT_EXIT 20002
#define IDS_HINT_CONNECT 20011
#define IDS_HINT_START 20012
#define IDS_HINT_STOP 21013
#define IDS_HINT_PAUSE 21014
#define IDS_HINT_RESUME 20015
#define IDS_HINT_RESTART 20016
#define IDS_HINT_REFRESH 20017
#define IDS_HINT_EDIT 20018
#define IDS_HINT_CREATE 20019
#define IDS_HINT_DELETE 20020
#define IDS_HINT_PROP 20021
#define IDS_HINT_LARGE 20030
#define IDS_HINT_SMALL 20031
#define IDS_HINT_LIST 20032
#define IDS_HINT_DETAILS 20033
#define IDS_HINT_CUST 20034
#define IDS_HINT_HELP 20040
#define IDS_HINT_ABOUT 20041
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN

View file

@ -204,8 +204,6 @@ BEGIN
IDS_TOOLTIP_STOP "Ferma servizio"
IDS_TOOLTIP_PAUSE "Pausa servizio"
IDS_TOOLTIP_RESTART "Riavvia servizio"
IDS_TOOLTIP_HELP "Aiuto"
IDS_TOOLTIP_EXIT "Esci"
END
STRINGTABLE DISCARDABLE
@ -221,30 +219,7 @@ STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_OPTIONS "CREATE OPTIONS:\r\nNOTA: Il nome dell'ozione comprende il simbolo di uguale.\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
#define IDS_HINT_BLANK 20000
#define IDS_HINT_EXPORT 20001
#define IDS_HINT_EXIT 20002
#define IDS_HINT_CONNECT 20011
#define IDS_HINT_START 20012
#define IDS_HINT_STOP 21013
#define IDS_HINT_PAUSE 21014
#define IDS_HINT_RESUME 20015
#define IDS_HINT_RESTART 20016
#define IDS_HINT_REFRESH 20017
#define IDS_HINT_EDIT 20018
#define IDS_HINT_CREATE 20019
#define IDS_HINT_DELETE 20020
#define IDS_HINT_PROP 20021
#define IDS_HINT_LARGE 20030
#define IDS_HINT_SMALL 20031
#define IDS_HINT_LIST 20032
#define IDS_HINT_DETAILS 20033
#define IDS_HINT_CUST 20034
#define IDS_HINT_HELP 20040
#define IDS_HINT_ABOUT 20041
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN

View file

@ -211,8 +211,6 @@ BEGIN
IDS_TOOLTIP_STOP "Zatrzymaj us³ugê"
IDS_TOOLTIP_PAUSE "Wstrzymaj us³ugê"
IDS_TOOLTIP_RESTART "Wznów us³ugê"
IDS_TOOLTIP_HELP "Pomoc"
IDS_TOOLTIP_EXIT "Zakoñcz"
END
STRINGTABLE DISCARDABLE
@ -228,30 +226,7 @@ STRINGTABLE DISCARDABLE
BEGIN
IDS_HELP_OPTIONS "CREATE OPTIONS:\r\nNOTE: Nazwa opcji zawiera znak równoœci.\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
#define IDS_HINT_BLANK 20000
#define IDS_HINT_EXPORT 20001
#define IDS_HINT_EXIT 20002
#define IDS_HINT_CONNECT 20011
#define IDS_HINT_START 20012
#define IDS_HINT_STOP 21013
#define IDS_HINT_PAUSE 21014
#define IDS_HINT_RESUME 20015
#define IDS_HINT_RESTART 20016
#define IDS_HINT_REFRESH 20017
#define IDS_HINT_EDIT 20018
#define IDS_HINT_CREATE 20019
#define IDS_HINT_DELETE 20020
#define IDS_HINT_PROP 20021
#define IDS_HINT_LARGE 20030
#define IDS_HINT_SMALL 20031
#define IDS_HINT_LIST 20032
#define IDS_HINT_DETAILS 20033
#define IDS_HINT_CUST 20034
#define IDS_HINT_HELP 20040
#define IDS_HINT_ABOUT 20041
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN

View file

@ -203,8 +203,6 @@ BEGIN
IDS_TOOLTIP_STOP "Îñòàíîâèòü ñëóæáó"
IDS_TOOLTIP_PAUSE "Ïðèîñòàíîâèòü ñëóæáó"
IDS_TOOLTIP_RESTART "Ïåðåçàïóñê ñëóæáû"
IDS_TOOLTIP_HELP "Ñïðàâêà"
IDS_TOOLTIP_EXIT "Âûõîä"
END
STRINGTABLE DISCARDABLE
@ -221,31 +219,6 @@ BEGIN
IDS_HELP_OPTIONS "ÎÏÖÈÈ ÑÎÇÄÀÍÈß:\r\nÏðèìå÷àíèå: Èìÿ îïöèè âêëþ÷àåò çíàê ""ðàâíî"".\r\n type= <own|share|interact|kernel|filesys|rec>\r\n (ïî óìîë÷àíèþ = own)\r\n start= <boot|system|auto|demand|disabled>\r\n (ïî óìîë÷àíèþ = demand) \r\n error= <normal|severe|critical|ignore>\r\n (ïî óìîë÷àíèþ = normal)\r\n group= <LoadOrderGroup>\r\n tag= <yes|no>\r\n depend= <Dependencies(îòäåëÿåòñÿ / (íàêëîííàÿ ÷åðòà))>\r\n obj= <AccountName|ObjectName>\r\n (ïî óìîë÷àíèþ = LocalSystem)\r\n password= <password>\r\n"
END
#define IDS_HINT_BLANK 20000
#define IDS_HINT_EXPORT 20001
#define IDS_HINT_EXIT 20002
#define IDS_HINT_CONNECT 20011
#define IDS_HINT_START 20012
#define IDS_HINT_STOP 21013
#define IDS_HINT_PAUSE 21014
#define IDS_HINT_RESUME 20015
#define IDS_HINT_RESTART 20016
#define IDS_HINT_REFRESH 20017
#define IDS_HINT_EDIT 20018
#define IDS_HINT_CREATE 20019
#define IDS_HINT_DELETE 20020
#define IDS_HINT_PROP 20021
#define IDS_HINT_LARGE 20030
#define IDS_HINT_SMALL 20031
#define IDS_HINT_LIST 20032
#define IDS_HINT_DETAILS 20033
#define IDS_HINT_CUST 20034
#define IDS_HINT_HELP 20040
#define IDS_HINT_ABOUT 20041
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN

View file

@ -213,8 +213,6 @@ BEGIN
IDS_TOOLTIP_STOP "Stop service"
IDS_TOOLTIP_PAUSE "Pause service"
IDS_TOOLTIP_RESTART "Restart service"
IDS_TOOLTIP_HELP "Help"
IDS_TOOLTIP_EXIT "Exit"
END
STRINGTABLE DISCARDABLE
@ -230,30 +228,7 @@ 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
#define IDS_HINT_BLANK 20000
#define IDS_HINT_EXPORT 20001
#define IDS_HINT_EXIT 20002
#define IDS_HINT_CONNECT 20011
#define IDS_HINT_START 20012
#define IDS_HINT_STOP 21013
#define IDS_HINT_PAUSE 21014
#define IDS_HINT_RESUME 20015
#define IDS_HINT_RESTART 20016
#define IDS_HINT_REFRESH 20017
#define IDS_HINT_EDIT 20018
#define IDS_HINT_CREATE 20019
#define IDS_HINT_DELETE 20020
#define IDS_HINT_PROP 20021
#define IDS_HINT_LARGE 20030
#define IDS_HINT_SMALL 20031
#define IDS_HINT_LIST 20032
#define IDS_HINT_DETAILS 20033
#define IDS_HINT_CUST 20034
#define IDS_HINT_HELP 20040
#define IDS_HINT_ABOUT 20041
/* Hints */
STRINGTABLE DISCARDABLE
BEGIN

View file

@ -1,9 +1,9 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/servman/mainwnd.c
* FILE: base/applications/mscutils/servman/mainwnd.c
* PURPOSE: Main window message handler
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
* COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
*
*/
@ -33,12 +33,6 @@ TBBUTTON Buttons [NUM_BUTTONS] =
{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 */
{TBICON_HELP, ID_HELP, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* help */
{TBICON_EXIT, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON, {0}, 0, 0 }, /* exit */
};
@ -281,7 +275,7 @@ pCreateToolbar(PMAIN_WND_INFO Info)
0);
hImageList = InitImageList(IDB_PROP,
IDB_EXIT,
IDB_RESTART,
16,
16);
if (hImageList == NULL)
@ -585,22 +579,9 @@ MainWndCommand(PMAIN_WND_INFO Info,
{
if (Info->SelectedItem != NO_ITEM_SELECTED)
{
PPROP_DLG_INFO PropSheet;
PropSheet = (PROP_DLG_INFO*) HeapAlloc(ProcessHeap,
HEAP_ZERO_MEMORY,
sizeof(PROP_DLG_INFO));
if (PropSheet != NULL)
{
Info->PropSheet = PropSheet;
OpenPropSheet(Info);
}
HeapFree(ProcessHeap,
0,
PropSheet);
Info->PropSheet = NULL;
Info->bDlgOpen = TRUE;
OpenPropSheet(Info);
Info->bDlgOpen = FALSE;
}
}
break;
@ -667,27 +648,29 @@ MainWndCommand(PMAIN_WND_INFO Info,
case ID_START:
{
DoStart(Info);
if (DoStart(Info))
SetMenuAndButtonStates(Info);
}
break;
case ID_STOP:
{
DoStop(Info);
if (DoStop(Info))
SetMenuAndButtonStates(Info);
}
break;
case ID_PAUSE:
{
Control(Info,
SERVICE_CONTROL_PAUSE);
//Control(Info,
// SERVICE_CONTROL_PAUSE);
}
break;
case ID_RESUME:
{
Control(Info,
SERVICE_CONTROL_CONTINUE );
//Control(Info,
// SERVICE_CONTROL_CONTINUE );
}
break;
@ -847,60 +830,60 @@ MainWndProc(HWND hwnd,
}
break;
case WM_SIZE:
{
case WM_SIZE:
{
MainWndResize(Info,
LOWORD(lParam),
HIWORD(lParam));
}
break;
}
break;
case WM_NOTIFY:
case WM_NOTIFY:
{
LPNMHDR pnmhdr = (LPNMHDR)lParam;
switch (pnmhdr->code)
{
case NM_DBLCLK:
{
POINT pt;
RECT rect;
case NM_DBLCLK:
{
POINT pt;
RECT rect;
GetCursorPos(&pt);
GetWindowRect(Info->hListView, &rect);
GetCursorPos(&pt);
GetWindowRect(Info->hListView, &rect);
if (PtInRect(&rect, pt))
{
if (PtInRect(&rect, pt))
{
SendMessage(hwnd,
WM_COMMAND,
//ID_PROP,
MAKEWPARAM((WORD)ID_PROP, (WORD)0),
0);
}
}
//OpenPropSheet(Info);
}
break;
}
break;
case LVN_COLUMNCLICK:
{
case LVN_COLUMNCLICK:
{
LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
(void)ListView_SortItems(Info->hListView,
CompareFunc,
pnmv->iSubItem);
bSortAscending = !bSortAscending;
}
}
break;
case LVN_ITEMCHANGED:
{
LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
case LVN_ITEMCHANGED:
{
LPNMLISTVIEW pnmv = (LPNMLISTVIEW) lParam;
ListViewSelectionChanged(Info, pnmv);
ListViewSelectionChanged(Info, pnmv);
}
break;
}
break;
case TTN_GETDISPINFO:
{
@ -949,15 +932,6 @@ MainWndProc(HWND hwnd,
case ID_RESTART:
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_RESTART);
break;
case ID_HELP:
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_HELP);
break;
case ID_EXIT:
lpttt->lpszText = MAKEINTRESOURCE(IDS_TOOLTIP_EXIT);
break;
}
}
break;
@ -1031,19 +1005,19 @@ MainWndProc(HWND hwnd,
break;
}
case WM_CLOSE:
{
case WM_CLOSE:
{
/* Free service array */
HeapFree(ProcessHeap,
0,
Info->pServiceStatus);
DestroyMenu(Info->hShortcutMenu);
DestroyWindow(hwnd);
}
break;
DestroyWindow(hwnd);
}
break;
case WM_DESTROY:
case WM_DESTROY:
{
//DestroyMainWnd(Info);
@ -1057,18 +1031,18 @@ MainWndProc(HWND hwnd,
/* Break the message queue loop */
PostQuitMessage(0);
}
break;
break;
default:
{
default:
{
HandleDefaultMessage:
Ret = DefWindowProc(hwnd,
msg,
wParam,
lParam);
}
break;
}
break;
}
return Ret;
}

View file

@ -13,52 +13,26 @@
#pragma warning(disable : 4100)
#endif
#ifndef SB_SIMPLEID
#define SB_SIMPLEID 0xFF
#endif
#define NO_ITEM_SELECTED -1
#define MAX_KEY_LENGTH 256
#define NUM_BUTTONS 14
#define NUM_BUTTONS 11
#define PROGRESSRANGE 8
typedef struct _PROP_DLG_INFO
{
HWND hwndGenDlg;
HWND hwndDepDlg;
LPTSTR lpServiceName;
LPTSTR lpDisplayName;
LPTSTR lpDescription;
LPTSTR lpPathToExe;
TCHAR szStartupType;
TCHAR szServiceStatus[25];
LPTSTR lpStartParams;
} PROP_DLG_INFO, *PPROP_DLG_INFO;
typedef struct _MAIN_WND_INFO
{
HWND hMainWnd;
HWND hListView;
HWND hStatus;
HWND hTool;
HWND hProgDlg;
HMENU hShortcutMenu;
int nCmdShow;
/* Stores the complete services array */
ENUM_SERVICE_STATUS_PROCESS *pServiceStatus;
ENUM_SERVICE_STATUS_PROCESS *pServiceStatus; /* Stores the complete services array */
ENUM_SERVICE_STATUS_PROCESS *CurrentService; /* Stores the current selected service */
/* Stores the current selected service */
ENUM_SERVICE_STATUS_PROCESS *CurrentService;
/* selection number in the list view */
INT SelectedItem;
struct _PROP_DLG_INFO *PropSheet;
/* status flags */
INT SelectedItem;/* selection number in the list view */
BOOL bDlgOpen;
BOOL InMenuLoop;
} MAIN_WND_INFO, *PMAIN_WND_INFO;
@ -92,7 +66,12 @@ BOOL DoStart(PMAIN_WND_INFO Info);
BOOL DoStop(PMAIN_WND_INFO Info);
/* control */
BOOL Control(PMAIN_WND_INFO Info, DWORD Control);
BOOL Control(PMAIN_WND_INFO Info, HWND hProgDlg, DWORD Control);
/* progress.c */
HWND CreateProgressDialog(HWND hParent, LPTSTR lpServiceName);
VOID IncrementProgressBar(HWND hProgDlg);
VOID CompleteProgressBar(HWND hProgDlg);
/* query.c */
ENUM_SERVICE_STATUS_PROCESS* GetSelectedService(PMAIN_WND_INFO Info);

View file

@ -1,20 +1,73 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/servman/progress.c
* FILE: base/applications/mscutils/servman/progress.c
* PURPOSE: Progress dialog box message handler
* COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
* COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
*
*/
#include "precomp.h"
BOOL CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
VOID
CompleteProgressBar(HWND hProgDlg)
{
HWND hProgBar;
hProgBar = GetDlgItem(hProgDlg,
IDC_SERVCON_PROGRESS);
if (hProgBar)
{
SendMessage(hProgBar,
PBM_DELTAPOS,
PROGRESSRANGE,
0);
}
}
VOID
IncrementProgressBar(HWND hProgDlg)
{
HWND hProgBar;
hProgBar = GetDlgItem(hProgDlg,
IDC_SERVCON_PROGRESS);
if (hProgBar)
{
SendMessage(hProgBar,
PBM_STEPIT,
0,
0);
}
}
BOOL CALLBACK
ProgressDialogProc(HWND hDlg,
UINT Message,
WPARAM wParam,
LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
{
HWND hProgBar;
/* set the progress bar range and step */
hProgBar = GetDlgItem(hDlg,
IDC_SERVCON_PROGRESS);
SendMessage(hProgBar,
PBM_SETRANGE,
0,
MAKELPARAM(0, PROGRESSRANGE));
SendMessage(hProgBar,
PBM_SETSTEP,
(WPARAM)1,
0);
}
break;
case WM_COMMAND:
@ -39,3 +92,42 @@ BOOL CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM
}
HWND
CreateProgressDialog(HWND hParent,
LPTSTR lpServiceName)
{
HWND hProgDlg;
TCHAR ProgDlgBuf[100];
/* open the progress dialog */
hProgDlg = CreateDialog(hInstance,
MAKEINTRESOURCE(IDD_DLG_PROGRESS),
hParent,
(DLGPROC)ProgressDialogProc);
if (hProgDlg != NULL)
{
ShowWindow(hProgDlg,
SW_SHOW);
/* 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)lpServiceName);
}
return hProgDlg;
}

View file

@ -1,16 +1,17 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/servman/propsheet.c
* FILE: base/applications/mscutils/servman/propsheet.c
* PURPOSE: Property dialog box message handler
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
* COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
*
*/
#include "precomp.h"
static VOID
SetButtonStates(PMAIN_WND_INFO Info)
SetButtonStates(PMAIN_WND_INFO Info,
HWND hwndDlg)
{
HWND hButton;
DWORD Flags, State;
@ -20,25 +21,25 @@ SetButtonStates(PMAIN_WND_INFO Info)
if (State == SERVICE_STOPPED)
{
hButton = GetDlgItem(Info->PropSheet->hwndGenDlg, IDC_START);
hButton = GetDlgItem(hwndDlg, IDC_START);
EnableWindow (hButton, TRUE);
}
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
{
hButton = GetDlgItem(Info->PropSheet->hwndGenDlg, IDC_STOP);
hButton = GetDlgItem(hwndDlg, IDC_STOP);
EnableWindow (hButton, TRUE);
}
if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) )
{
hButton = GetDlgItem(Info->PropSheet->hwndGenDlg, IDC_PAUSE);
hButton = GetDlgItem(hwndDlg, IDC_PAUSE);
EnableWindow (hButton, TRUE);
}
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
{
hButton = GetDlgItem(Info->PropSheet->hwndGenDlg, IDC_PAUSE);
hButton = GetDlgItem(hwndDlg, IDC_PAUSE);
EnableWindow (hButton, TRUE);
}
}
@ -48,7 +49,8 @@ SetButtonStates(PMAIN_WND_INFO Info)
* values and sets it to value of the selected item
*/
static VOID
SetStartupType(PMAIN_WND_INFO Info)
SetStartupType(PMAIN_WND_INFO Info,
HWND hwndDlg)
{
HWND hList;
HKEY hKey;
@ -70,7 +72,7 @@ SetStartupType(PMAIN_WND_INFO Info)
KEY_READ,
&hKey);
hList = GetDlgItem(Info->PropSheet->hwndGenDlg, IDC_START_TYPE);
hList = GetDlgItem(hwndDlg, IDC_START_TYPE);
LoadString(hInstance, IDS_SERVICES_AUTO, buf, sizeof(buf) / sizeof(TCHAR));
SendMessage(hList, CB_ADDSTRING, 0, (LPARAM)buf);
@ -97,7 +99,6 @@ SetStartupType(PMAIN_WND_INFO Info)
SendMessage(hList, CB_SETCURSEL, 1, 0);
else if (StartUp == 0x04)
SendMessage(hList, CB_SETCURSEL, 2, 0);
}
@ -106,75 +107,90 @@ SetStartupType(PMAIN_WND_INFO Info)
* the relevant service information
*/
static VOID
GetDlgInfo(PMAIN_WND_INFO Info)
GetDlgInfo(PMAIN_WND_INFO Info,
HWND hwndDlg)
{
LPTSTR lpDescription;
LPTSTR lpPathToExe;
/* set the service name */
Info->PropSheet->lpServiceName = Info->CurrentService->lpServiceName;
SendDlgItemMessage(Info->PropSheet->hwndGenDlg,
SendDlgItemMessage(hwndDlg,
IDC_SERV_NAME,
WM_SETTEXT,
0,
(LPARAM)Info->PropSheet->lpServiceName);
(LPARAM)Info->CurrentService->lpServiceName);
/* set the display name */
Info->PropSheet->lpDisplayName = Info->CurrentService->lpDisplayName;
SendDlgItemMessage(Info->PropSheet->hwndGenDlg,
SendDlgItemMessage(hwndDlg,
IDC_DISP_NAME,
WM_SETTEXT,
0,
(LPARAM)Info->PropSheet->lpDisplayName);
(LPARAM)Info->CurrentService->lpDisplayName);
/* set the description */
if ((Info->PropSheet->lpDescription = GetDescription(Info->CurrentService->lpServiceName)))
if ((lpDescription = GetDescription(Info->CurrentService->lpServiceName)))
{
SendDlgItemMessage(Info->PropSheet->hwndGenDlg,
SendDlgItemMessage(hwndDlg,
IDC_DESCRIPTION,
WM_SETTEXT,
0,
(LPARAM)Info->PropSheet->lpDescription);
(LPARAM)lpDescription);
HeapFree(ProcessHeap,
0,
lpDescription);
}
/* set the executable path */
if ((Info->PropSheet->lpPathToExe = GetExecutablePath(Info)))
if ((lpPathToExe = GetExecutablePath(Info)))
{
SendDlgItemMessage(Info->PropSheet->hwndGenDlg,
SendDlgItemMessage(hwndDlg,
IDC_EXEPATH,
WM_SETTEXT,
0,
(LPARAM)Info->PropSheet->lpPathToExe);
(LPARAM)lpPathToExe);
HeapFree(ProcessHeap,
0,
lpPathToExe);
}
/* set startup type */
SetStartupType(Info);
SetStartupType(Info, hwndDlg);
/* set service status */
if (Info->CurrentService->ServiceStatusProcess.dwCurrentState == SERVICE_RUNNING)
{
TCHAR szServiceStatus[32];
LoadString(hInstance,
IDS_SERVICES_STARTED,
Info->PropSheet->szServiceStatus,
sizeof(Info->PropSheet->szServiceStatus) / sizeof(TCHAR));
szServiceStatus,
_tcslen(szServiceStatus) + 1);
SendDlgItemMessage(Info->PropSheet->hwndGenDlg,
SendDlgItemMessage(hwndDlg,
IDC_SERV_STATUS,
WM_SETTEXT,
0,
(LPARAM)Info->PropSheet->szServiceStatus);
(LPARAM)szServiceStatus);
}
else
{
TCHAR szServiceStatus[32];
LoadString(hInstance,
IDS_SERVICES_STOPPED,
Info->PropSheet->szServiceStatus,
sizeof(Info->PropSheet->szServiceStatus) / sizeof(TCHAR));
szServiceStatus,
_tcslen(szServiceStatus) + 1);
SendDlgItemMessage(Info->PropSheet->hwndGenDlg,
SendDlgItemMessage(hwndDlg,
IDC_SERV_STATUS,
WM_SETTEXT,
0,
(LPARAM)Info->PropSheet->szServiceStatus);
(LPARAM)szServiceStatus);
}
}
@ -207,13 +223,11 @@ GeneralPageProc(HWND hwndDlg,
Info = (PMAIN_WND_INFO)(((LPPROPSHEETPAGE)lParam)->lParam);
if (Info != NULL)
{
Info->PropSheet->hwndGenDlg = hwndDlg;
SetWindowLongPtr(hwndDlg,
GWLP_USERDATA,
(LONG_PTR)Info);
GetDlgInfo(Info);
SetButtonStates(Info);
GetDlgInfo(Info, hwndDlg);
SetButtonStates(Info, hwndDlg);
}
}
break;
@ -251,16 +265,6 @@ GeneralPageProc(HWND hwndDlg,
break;
case WM_DESTROY:
if (Info->PropSheet->lpDescription)
HeapFree(ProcessHeap,
0,
Info->PropSheet->lpDescription);
if (Info->PropSheet->lpPathToExe)
HeapFree(ProcessHeap,
0,
Info->PropSheet->lpPathToExe);
break;
case WM_NOTIFY:
@ -290,8 +294,8 @@ GeneralPageProc(HWND hwndDlg,
static INT_PTR CALLBACK
DependanciesPageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
WPARAM wParam,
LPARAM lParam)
{
PMAIN_WND_INFO Info;
@ -311,8 +315,6 @@ DependanciesPageProc(HWND hwndDlg,
Info = (PMAIN_WND_INFO)(((LPPROPSHEETPAGE)lParam)->lParam);
if (Info != NULL)
{
Info->PropSheet->hwndDepDlg = hwndDlg;
SetWindowLongPtr(hwndDlg,
GWLP_USERDATA,
(LONG_PTR)Info);
@ -377,8 +379,6 @@ AddEditButton(HWND hwnd, UINT message, LPARAM lParam)
}
static VOID
InitPropSheetPage(PROPSHEETPAGE *psp,
PMAIN_WND_INFO Info,

View file

@ -1,9 +1,9 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/servman/query.c
* FILE: base/applications/mscutils/servman/query.c
* PURPOSE: Query service information
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
* COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
*
*/
@ -320,32 +320,36 @@ DWORD
GetServiceList(PMAIN_WND_INFO Info)
{
SC_HANDLE ScHandle;
BOOL bGotServices = FALSE;
DWORD BytesNeeded = 0;
DWORD ResumeHandle = 0;
DWORD NumServices = 0;
ScHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE);
ScHandle = OpenSCManager(NULL,
NULL,
SC_MANAGER_ENUMERATE_SERVICE);
if (ScHandle != INVALID_HANDLE_VALUE)
{
if (EnumServicesStatusEx(ScHandle,
SC_ENUM_PROCESS_INFO,
SERVICE_WIN32,
SERVICE_STATE_ALL,
(LPBYTE)Info->pServiceStatus,
0, &BytesNeeded,
&NumServices,
&ResumeHandle,
0) == FALSE)
if (!EnumServicesStatusEx(ScHandle,
SC_ENUM_PROCESS_INFO,
SERVICE_WIN32,
SERVICE_STATE_ALL,
(LPBYTE)Info->pServiceStatus,
0,
&BytesNeeded,
&NumServices,
&ResumeHandle,
0))
{
/* Call function again if required size was returned */
if (GetLastError() == ERROR_MORE_DATA)
{
/* reserve memory for service info array */
Info->pServiceStatus = (ENUM_SERVICE_STATUS_PROCESS *)
HeapAlloc(ProcessHeap,
0,
BytesNeeded);
HeapAlloc(ProcessHeap,
0,
BytesNeeded);
if (Info->pServiceStatus == NULL)
return FALSE;
@ -359,22 +363,23 @@ GetServiceList(PMAIN_WND_INFO Info)
&BytesNeeded,
&NumServices,
&ResumeHandle,
0) == FALSE)
0))
{
HeapFree(ProcessHeap,
0,
Info->pServiceStatus);
return FALSE;
bGotServices = TRUE;
}
}
else /* exit on failure */
{
return FALSE;
}
}
}
CloseServiceHandle(ScHandle);
if (ScHandle)
CloseServiceHandle(ScHandle);
if (!bGotServices)
{
HeapFree(ProcessHeap,
0,
Info->pServiceStatus);
}
return NumServices;
}

View file

@ -1,9 +1,9 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/servman/reg.c
* FILE: base/applications/mscutils/servman/reg.c
* PURPOSE: Query service information
* COPYRIGHT: Copyright 2005 - 2007 Ged Murphy <gedmurphy@gmail.com>
* COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
*
*/

View file

@ -51,8 +51,6 @@
#define IDS_TOOLTIP_STOP 6006
#define IDS_TOOLTIP_PAUSE 6007
#define IDS_TOOLTIP_RESTART 6008
#define IDS_TOOLTIP_HELP 6009
#define IDS_TOOLTIP_EXIT 6010
#define IDS_SERVICES_STARTED 5000
#define IDS_SERVICES_STOPPED 5001
@ -73,8 +71,6 @@
#define IDB_STOP 10006
#define IDB_PAUSE 10007
#define IDB_RESTART 10008
#define IDB_HELP 10009
#define IDB_EXIT 10010
/* toolbar buttons */
#define TBICON_PROP 0
@ -86,8 +82,6 @@
#define TBICON_STOP 6
#define TBICON_PAUSE 7
#define TBICON_RESTART 8
#define TBICON_HELP 9
#define TBICON_EXIT 10
/* menu hints */

View file

@ -1,18 +1,18 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/servman/start.c
* FILE: base/applications/mscutils/servman/start.c
* PURPOSE: Start a service
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
* COPYRIGHT: Copyright 2005-2007 Ged Murphy <gedmurphy@reactos.org>
*
*/
#include "precomp.h"
static BOOL
DoStartService(PMAIN_WND_INFO Info)
DoStartService(PMAIN_WND_INFO Info,
HWND hProgDlg)
{
HWND hProgBar;
SC_HANDLE hSCManager;
SC_HANDLE hSc;
SERVICE_STATUS_PROCESS ServiceStatus;
@ -20,21 +20,6 @@ DoStartService(PMAIN_WND_INFO Info)
INT ArgCount = 0;
DWORD dwStartTickCount, dwOldCheckPoint;
/* set the progress bar range and step */
hProgBar = GetDlgItem(Info->hProgDlg,
IDC_SERVCON_PROGRESS);
SendMessage(hProgBar,
PBM_SETRANGE,
0,
MAKELPARAM(0, PROGRESSRANGE));
SendMessage(hProgBar,
PBM_SETSTEP,
(WPARAM)1,
0);
/* open handle to the SCM */
hSCManager = OpenSCManager(NULL,
NULL,
@ -92,8 +77,7 @@ DoStartService(PMAIN_WND_INFO Info)
else if ( dwWaitTime > 5000 )
dwWaitTime = 5000;
/* increment the progress bar */
SendMessage(hProgBar, PBM_STEPIT, 0, 0);
IncrementProgressBar(hProgDlg);
/* wait before checking status */
Sleep(ServiceStatus.dwWaitHint / 8);
@ -112,7 +96,7 @@ DoStartService(PMAIN_WND_INFO Info)
if (ServiceStatus.dwCheckPoint > dwOldCheckPoint)
{
/* The service is making progress. increment the progress bar */
SendMessage(hProgBar, PBM_STEPIT, 0, 0);
IncrementProgressBar(hProgDlg);
dwStartTickCount = GetTickCount();
dwOldCheckPoint = ServiceStatus.dwCheckPoint;
}
@ -130,96 +114,34 @@ DoStartService(PMAIN_WND_INFO Info)
if (ServiceStatus.dwCurrentState == SERVICE_RUNNING)
{
SendMessage(hProgBar,
PBM_DELTAPOS,
PROGRESSRANGE,
0);
CompleteProgressBar(hProgDlg);
Sleep(1000);
return TRUE;
}
else
return FALSE;
}
BOOL
DoStart(PMAIN_WND_INFO Info)
{
HWND hProgDlg;
TCHAR ProgDlgBuf[100];
BOOL bRet = FALSE;
/* open the progress dialog */
hProgDlg = CreateDialog(hInstance,
MAKEINTRESOURCE(IDD_DLG_PROGRESS),
Info->hMainWnd,
(DLGPROC)ProgressDialogProc);
if (hProgDlg != NULL)
hProgDlg = CreateProgressDialog(Info->hMainWnd,
Info->CurrentService->lpServiceName);
if (hProgDlg)
{
ShowWindow(hProgDlg,
SW_SHOW);
bRet = DoStartService(Info,
hProgDlg);
/* 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)Info->CurrentService->lpServiceName);
SendMessage(hProgDlg,
WM_DESTROY,
0,
0);
}
/* start the service */
if ( DoStartService(Info) )
{
LVITEM item;
TCHAR szStatus[64];
TCHAR buf[25];
LoadString(hInstance,
IDS_SERVICES_STARTED,
szStatus,
sizeof(szStatus) / sizeof(TCHAR));
item.pszText = szStatus;
item.iItem = Info->SelectedItem;
item.iSubItem = 2;
SendMessage(Info->hListView,
LVM_SETITEMTEXT,
item.iItem,
(LPARAM) &item);
/* change dialog status */
if (Info->PropSheet != NULL)
{
LoadString(hInstance,
IDS_SERVICES_STARTED,
buf,
sizeof(buf) / sizeof(TCHAR));
SendDlgItemMessageW(Info->PropSheet->hwndGenDlg,
IDC_SERV_STATUS,
WM_SETTEXT,
0,
(LPARAM)buf);
}
}
SendMessage(hProgDlg,
WM_DESTROY,
0,
0);
return TRUE;
return bRet;
}

View file

@ -1,9 +1,9 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/system/servman/stop.c
* FILE: base/applications/mscutils/servman/stop.c
* PURPOSE: Stops a service
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
* COPYRIGHT: Copyright 2005-2007 Ged Murphy <gedmurphy@reactos.org>
*
*/
@ -11,68 +11,20 @@
BOOL DoStop(PMAIN_WND_INFO Info)
{
BOOL ret = FALSE;
HWND hProgDlg;
TCHAR ProgDlgBuf[100];
/* open the progress dialog */
hProgDlg = CreateDialog(hInstance,
MAKEINTRESOURCE(IDD_DLG_PROGRESS),
Info->hMainWnd,
(DLGPROC)ProgressDialogProc);
if (hProgDlg != NULL)
hProgDlg = CreateProgressDialog(Info->hMainWnd,
Info->CurrentService->lpServiceName);
if (hProgDlg)
{
ShowWindow(hProgDlg,
SW_SHOW);
ret = Control(Info,
hProgDlg,
SERVICE_CONTROL_STOP);
/* 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)Info->CurrentService->lpServiceName);
SendMessage(hProgDlg, WM_DESTROY, 0, 0);
}
if ( Control(Info, SERVICE_CONTROL_STOP) )
{
LVITEM item;
TCHAR buf[25];
item.pszText = _T('\0');
item.iItem = Info->SelectedItem;
item.iSubItem = 2;
SendMessage(Info->hListView,
LVM_SETITEMTEXT,
item.iItem,
(LPARAM) &item);
/* change dialog status */
if (Info->PropSheet != NULL)
{
LoadString(hInstance,
IDS_SERVICES_STOPPED,
buf,
sizeof(buf) / sizeof(TCHAR));
SendDlgItemMessageW(Info->PropSheet->hwndGenDlg,
IDC_SERV_STATUS, WM_SETTEXT,
0,
(LPARAM)buf);
}
}
SendMessage(hProgDlg, WM_DESTROY, 0, 0);
return TRUE;
return ret;
}