Author: gedmurphy
Date: Wed Sep 12 17:50:51 2007
New Revision: 29018
URL:
http://svn.reactos.org/svn/reactos?rev=29018&view=rev
Log:
- rewrite the Control code
- smooth the progress bar movement
- clean up various other bits
Modified:
trunk/reactos/base/applications/mscutils/servman/about.c
trunk/reactos/base/applications/mscutils/servman/control.c
trunk/reactos/base/applications/mscutils/servman/lang/bg-BG.rc
trunk/reactos/base/applications/mscutils/servman/lang/de-DE.rc
trunk/reactos/base/applications/mscutils/servman/lang/en-US.rc
trunk/reactos/base/applications/mscutils/servman/lang/fr-FR.rc
trunk/reactos/base/applications/mscutils/servman/lang/id-ID.rc
trunk/reactos/base/applications/mscutils/servman/lang/it-IT.rc
trunk/reactos/base/applications/mscutils/servman/lang/pl-PL.rc
trunk/reactos/base/applications/mscutils/servman/lang/ru-RU.rc
trunk/reactos/base/applications/mscutils/servman/lang/th-TH.rc
trunk/reactos/base/applications/mscutils/servman/lang/uk-UA.rc
trunk/reactos/base/applications/mscutils/servman/progress.c
trunk/reactos/base/applications/mscutils/servman/start.c
Modified: trunk/reactos/base/applications/mscutils/servman/about.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/about.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/about.c Wed Sep 12 17:50:51 2007
@@ -12,43 +12,33 @@
BOOL CALLBACK
AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- HWND hLicenseEditWnd;
- HICON hIcon = NULL;
- TCHAR strLicense[700];
-
switch (message)
{
case WM_INITDIALOG:
-
- hIcon = (HICON)LoadImage(hInstance,
- MAKEINTRESOURCE(IDI_SM_ICON),
- IMAGE_ICON,
- 16,
- 16,
- 0);
- if (hIcon)
- {
- SendMessage(hDlg,
- WM_SETICON,
- ICON_SMALL,
- (LPARAM)hIcon);
- DestroyIcon(hIcon);
- }
+ {
+ HWND hLicenseEditWnd;
hLicenseEditWnd = GetDlgItem(hDlg,
IDC_LICENSE_EDIT);
if (hLicenseEditWnd)
{
- LoadString(hInstance,
- IDS_LICENSE,
- strLicense,
- sizeof(strLicense) / sizeof(TCHAR));
+ LPTSTR lpString;
- SetWindowText(hLicenseEditWnd,
- strLicense);
+ if (AllocAndLoadString(&lpString,
+ hInstance,
+ IDS_LICENSE))
+ {
+ SetWindowText(hLicenseEditWnd,
+ lpString);
+
+ HeapFree(GetProcessHeap(),
+ 0,
+ lpString);
+ }
}
return TRUE;
+ }
case WM_COMMAND:
Modified: trunk/reactos/base/applications/mscutils/servman/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/control.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/control.c Wed Sep 12 17:50:51 2007
@@ -18,117 +18,99 @@
SC_HANDLE hSc;
SERVICE_STATUS_PROCESS ServiceStatus;
SERVICE_STATUS Status;
- LVITEM item;
DWORD BytesNeeded = 0;
- DWORD dwStartTickCount, dwOldCheckPoint;
+ BOOL bRet = FALSE;
+ BOOL bDispErr = TRUE;
- item.mask = LVIF_PARAM;
- item.iItem = Info->SelectedItem;
- SendMessage(Info->hListView,
- LVM_GETITEM,
- 0,
- (LPARAM)&item);
-
- /* open handle to the SCM */
hSCManager = OpenSCManager(NULL,
NULL,
SC_MANAGER_ALL_ACCESS);
- if (hSCManager == NULL)
+ if (hSCManager != NULL)
{
- GetError();
- return FALSE;
- }
+ hSc = OpenService(hSCManager,
+ Info->pCurrentService->lpServiceName,
+ SERVICE_ALL_ACCESS);
+ if (hSc != NULL)
+ {
+ if (ControlService(hSc,
+ Control,
+ &Status))
+ {
+ bDispErr = FALSE;
- /* open handle to the service */
- hSc = OpenService(hSCManager,
- Info->pCurrentService->lpServiceName,
- SC_MANAGER_ALL_ACCESS);
- if (hSc == NULL)
- {
- GetError();
- return FALSE;
- }
+ if (QueryServiceStatusEx(hSc,
+ SC_STATUS_PROCESS_INFO,
+ (LPBYTE)&ServiceStatus,
+ sizeof(SERVICE_STATUS_PROCESS),
+ &BytesNeeded))
+ {
+ DWORD dwStartTickCount = GetTickCount();
+ DWORD dwOldCheckPoint = ServiceStatus.dwCheckPoint;
+ DWORD dwMaxWait = 2000 * 60; // wait for 2 mins
- /* process requested action */
- if (! ControlService(hSc,
- Control,
- &Status))
- {
- GetError();
- CloseServiceHandle(hSc);
- return FALSE;
- }
+ IncrementProgressBar(hProgDlg);
- /* query the state of the service */
- if (! QueryServiceStatusEx(hSc,
- SC_STATUS_PROCESS_INFO,
- (LPBYTE)&ServiceStatus,
- sizeof(SERVICE_STATUS_PROCESS),
- &BytesNeeded))
- {
- GetError();
- return FALSE;
- }
+ while (ServiceStatus.dwCurrentState != Control)
+ {
+ DWORD dwWaitTime = ServiceStatus.dwWaitHint / 10;
- /* Save the tick count and initial checkpoint. */
- dwStartTickCount = GetTickCount();
- dwOldCheckPoint = ServiceStatus.dwCheckPoint;
+ if (!QueryServiceStatusEx(hSc,
+ SC_STATUS_PROCESS_INFO,
+ (LPBYTE)&ServiceStatus,
+ sizeof(SERVICE_STATUS_PROCESS),
+ &BytesNeeded))
+ {
+ break;
+ }
- /* loop whilst service is not running */
- /* FIXME: needs more control adding. 'Loop' is temparary */
- while (ServiceStatus.dwCurrentState != Control)
- {
- DWORD dwWaitTime;
+ if (ServiceStatus.dwCheckPoint > dwOldCheckPoint)
+ {
+ /* The service is making progress, increment the progress bar
*/
+ IncrementProgressBar(hProgDlg);
+ dwStartTickCount = GetTickCount();
+ dwOldCheckPoint = ServiceStatus.dwCheckPoint;
+ }
+ else
+ {
+ if(GetTickCount() >= dwStartTickCount + dwMaxWait)
+ {
+ /* give up */
+ break;
+ }
+ }
- dwWaitTime = ServiceStatus.dwWaitHint / 10;
+ if(dwWaitTime < 200)
+ dwWaitTime = 200;
+ else if (dwWaitTime > 10000)
+ dwWaitTime = 10000;
- if (dwWaitTime < 500)
- dwWaitTime = 500;
- else if (dwWaitTime > 5000)
- dwWaitTime = 5000;
-
- IncrementProgressBar(hProgDlg);
-
- /* wait before checking status */
- Sleep(dwWaitTime);
-
- /* check status again */
- if (! QueryServiceStatusEx(hSc,
- SC_STATUS_PROCESS_INFO,
- (LPBYTE)&ServiceStatus,
- sizeof(SERVICE_STATUS_PROCESS),
- &BytesNeeded))
- {
- GetError();
- return FALSE;
+ Sleep(dwWaitTime);
+ }
+ }
+ }
+
+ CloseServiceHandle(hSc);
}
- if (ServiceStatus.dwCheckPoint > dwOldCheckPoint)
- {
- IncrementProgressBar(hProgDlg);
- dwStartTickCount = GetTickCount();
- dwOldCheckPoint = ServiceStatus.dwCheckPoint;
- }
- else
- {
- if(GetTickCount() - dwStartTickCount > ServiceStatus.dwWaitHint)
- {
- /* No progress made within the wait hint */
- break;
- }
- }
+ CloseServiceHandle(hSCManager);
}
-
- CloseServiceHandle(hSc);
if (ServiceStatus.dwCurrentState == Control)
{
CompleteProgressBar(hProgDlg);
- Sleep(1000);
- return TRUE;
+ Sleep(500);
+ bRet = TRUE;
}
else
- return FALSE;
+ {
+ if (bDispErr)
+ GetError();
+ else
+ DisplayString(_T("The service failed to start"));
+ }
+
+ return bRet;
+
}
@@ -146,7 +128,7 @@
hProgDlg,
SERVICE_CONTROL_STOP);
- SendMessage(hProgDlg, WM_DESTROY, 0, 0);
+ DestroyWindow(hProgDlg);
}
return ret;
@@ -166,7 +148,7 @@
hProgDlg,
SERVICE_CONTROL_PAUSE);
- SendMessage(hProgDlg, WM_DESTROY, 0, 0);
+ DestroyWindow(hProgDlg);
}
return ret;
@@ -186,7 +168,7 @@
hProgDlg,
SERVICE_CONTROL_CONTINUE);
- SendMessage(hProgDlg, WM_DESTROY, 0, 0);
+ DestroyWindow(hProgDlg);
}
return ret;
Modified: trunk/reactos/base/applications/mscutils/servman/lang/bg-BG.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/bg-BG.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/bg-BG.rc Wed Sep 12 17:50:51
2007
@@ -68,7 +68,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "Service Manager v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 130, 26
+ LTEXT "Service Manager v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 135, 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
@@ -162,7 +162,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "Óïðàâëåíèå íà óñëóãèòå"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000,
8, 46, 238, 13
Modified: trunk/reactos/base/applications/mscutils/servman/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/de-DE.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/de-DE.rc Wed Sep 12 17:50:51
2007
@@ -68,7 +68,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "Dienst-Manager v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 130, 26
+ LTEXT "Dienst-Manager v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 135, 26
PUSHBUTTON "Schließen", 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
@@ -159,7 +159,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "Dienststeuerung"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000,
8, 46, 238, 13
Modified: trunk/reactos/base/applications/mscutils/servman/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/en-US.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/en-US.rc Wed Sep 12 17:50:51
2007
@@ -68,7 +68,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "Service Manager v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 130, 26
+ LTEXT "Service Manager v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 135, 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
@@ -159,7 +159,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "Service Control"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000,
8, 46, 238, 13
Modified: trunk/reactos/base/applications/mscutils/servman/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/fr-FR.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/fr-FR.rc Wed Sep 12 17:50:51
2007
@@ -69,7 +69,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "Gestionnaire de services v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 130, 26
+ LTEXT "Gestionnaire de services v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 135, 26
PUSHBUTTON "Fermer", 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
@@ -160,7 +160,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "Contrôle du Service"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000,
8, 46, 238, 13
Modified: trunk/reactos/base/applications/mscutils/servman/lang/id-ID.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/id-ID.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/id-ID.rc Wed Sep 12 17:50:51
2007
@@ -68,7 +68,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "Manajer Layanan v0.8\nHak Cipta (C) 2005-2007\noleh Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 130, 26
+ LTEXT "Manajer Layanan v0.8\nHak Cipta (C) 2005-2007\noleh Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 135, 26
PUSHBUTTON "Tutup", 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
@@ -159,7 +159,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "Kontrol Layanan"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000,
8, 46, 238, 13
Modified: trunk/reactos/base/applications/mscutils/servman/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/it-IT.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/it-IT.rc Wed Sep 12 17:50:51
2007
@@ -68,7 +68,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "Gestione Servizi v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)gmail.com)"quot;, IDC_STATIC, 48, 7, 130, 26
+ LTEXT "Gestione Servizi v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)gmail.com)"quot;, IDC_STATIC, 48, 7, 135, 26
PUSHBUTTON "Chiudi", 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
@@ -159,7 +159,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "Service Control"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000,
8, 46, 238, 13
Modified: trunk/reactos/base/applications/mscutils/servman/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/pl-PL.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/pl-PL.rc Wed Sep 12 17:50:51
2007
@@ -75,7 +75,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "Service Manager v0.5.1\nCopyright (C) 2005-2006\nby Ged Murphy
(gedmurphy(a)gmail.com)"quot;, IDC_STATIC, 48, 7, 130, 26
+ LTEXT "Service Manager v0.5.1\nCopyright (C) 2005-2006\nby Ged Murphy
(gedmurphy(a)gmail.com)"quot;, IDC_STATIC, 48, 7, 135, 26
PUSHBUTTON "Zamknij", 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
@@ -165,7 +165,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "Us³uga kontrolna"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000,
8, 46, 238, 13
Modified: trunk/reactos/base/applications/mscutils/servman/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/ru-RU.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/ru-RU.rc Wed Sep 12 17:50:51
2007
@@ -67,7 +67,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "Ìåíåäæåð ñëóæá v0.8\nCopyright (C) 2005-2007\nîò Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 130, 30
+ LTEXT "Ìåíåäæåð ñëóæá v0.8\nCopyright (C) 2005-2007\nîò Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 135, 26
PUSHBUTTON "Çàêðûòü", 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
@@ -158,7 +158,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "Óïðàâëåíèå ñëóæáàìè"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL
"",IDC_SERVCON_PROGRESS,"msctls_progress32",0x50000000,8,46,238,13
Modified: trunk/reactos/base/applications/mscutils/servman/lang/th-TH.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/th-TH.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/th-TH.rc Wed Sep 12 17:50:51
2007
@@ -77,7 +77,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "â»Ãá¡ÃÁ¡ÒúÃÔ¡ÒèѴ¡Òà ÃØè¹ 0.8\nÅÔ¢ÊÔ·¸Ôì (C) 2005-2007\nâ´Â à¡é´ àÁÍÃì¿Õè
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 130, 26
+ LTEXT "â»Ãá¡ÃÁ¡ÒúÃÔ¡ÒèѴ¡Òà ÃØè¹ 0.8\nÅÔ¢ÊÔ·¸Ôì (C) 2005-2007\nâ´Â à¡é´ àÁÍÃì¿Õè
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 135, 26
PUSHBUTTON "»Ô´", 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
@@ -168,7 +168,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "µÑǤǺ¤ØÁºÃÔ¡ÒÃ"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000,
8, 46, 238, 13
Modified: trunk/reactos/base/applications/mscutils/servman/lang/uk-UA.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/uk-UA.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/uk-UA.rc Wed Sep 12 17:50:51
2007
@@ -76,7 +76,7 @@
FONT 8, "MS Shell Dlg",0,0
STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
BEGIN
- LTEXT "Äèñïåò÷åð êåðóâàííÿ ñëóæáàìè v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 130, 26
+ LTEXT "Äèñïåò÷åð êåðóâàííÿ ñëóæáàìè v0.8\nCopyright (C) 2005-2007\nby Ged Murphy
(gedmurphy(a)reactos.org)"quot;, IDC_STATIC, 48, 7, 135, 26
PUSHBUTTON "Çàêðèòè", 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
@@ -167,7 +167,7 @@
IDD_DLG_PROGRESS DIALOGEX 6,6,255,89
CAPTION "Óïðàâë³ííÿ ñëóæáàìè"
FONT 8, "MS Shell Dlg",0,0
-STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
+STYLE WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME
EXSTYLE WS_EX_TOOLWINDOW
BEGIN
CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000,
8, 46, 238, 13
Modified: trunk/reactos/base/applications/mscutils/servman/progress.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/progress.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/progress.c Wed Sep 12 17:50:51 2007
@@ -9,7 +9,7 @@
#include "precomp.h"
-#define PROGRESSRANGE 8
+#define PROGRESSRANGE 20
VOID
CompleteProgressBar(HWND hProgDlg)
@@ -21,10 +21,21 @@
if (hProgBar)
{
- SendMessage(hProgBar,
- PBM_DELTAPOS,
- PROGRESSRANGE,
- 0);
+ INT pos = 0;
+
+ pos = SendMessage(hProgBar,
+ PBM_GETPOS,
+ 0,
+ 0);
+
+ for (; pos <= PROGRESSRANGE; pos++)
+ {
+ SendMessage(hProgBar,
+ PBM_DELTAPOS,
+ pos,
+ 0);
+ Sleep(15);
+ }
}
}
@@ -82,10 +93,6 @@
}
break;
- case WM_DESTROY:
- DestroyWindow(hDlg);
- break;
-
default:
return FALSE;
}
@@ -109,9 +116,6 @@
(DLGPROC)ProgressDialogProc);
if (hProgDlg != NULL)
{
- ShowWindow(hProgDlg,
- SW_SHOW);
-
/* write the info to the progress dialog */
LoadString(hInstance,
Event,
Modified: trunk/reactos/base/applications/mscutils/servman/start.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/start.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/start.c Wed Sep 12 17:50:51 2007
@@ -18,6 +18,7 @@
SERVICE_STATUS_PROCESS ServiceStatus;
DWORD BytesNeeded = 0;
BOOL bRet = FALSE;
+ BOOL bDispErr = TRUE;
hSCManager = OpenSCManager(NULL,
NULL,
@@ -33,6 +34,8 @@
0,
NULL))
{
+ bDispErr = FALSE;
+
if (QueryServiceStatusEx(hSc,
SC_STATUS_PROCESS_INFO,
(LPBYTE)&ServiceStatus,
@@ -41,19 +44,13 @@
{
DWORD dwStartTickCount = GetTickCount();
DWORD dwOldCheckPoint = ServiceStatus.dwCheckPoint;
+ DWORD dwMaxWait = 2000 * 60; // wait for 2 mins
+
+ IncrementProgressBar(hProgDlg);
while (ServiceStatus.dwCurrentState != SERVICE_RUNNING)
{
DWORD dwWaitTime = ServiceStatus.dwWaitHint / 10;
-
- if(dwWaitTime < 1000)
- dwWaitTime = 500;
- else if (dwWaitTime > 10000)
- dwWaitTime = 10000;
-
- IncrementProgressBar(hProgDlg);
- Sleep(dwWaitTime );
- IncrementProgressBar(hProgDlg);
if (!QueryServiceStatusEx(hSc,
SC_STATUS_PROCESS_INFO,
@@ -73,12 +70,19 @@
}
else
{
- if(GetTickCount() - dwStartTickCount >
ServiceStatus.dwWaitHint)
+ if(GetTickCount() >= dwStartTickCount + dwMaxWait)
{
- /* No progress made within the wait hint */
+ /* give up */
break;
}
}
+
+ if(dwWaitTime < 200)
+ dwWaitTime = 200;
+ else if (dwWaitTime > 10000)
+ dwWaitTime = 10000;
+
+ Sleep(dwWaitTime);
}
}
}
@@ -92,11 +96,16 @@
if (ServiceStatus.dwCurrentState == SERVICE_RUNNING)
{
CompleteProgressBar(hProgDlg);
- Sleep(1000);
+ Sleep(500);
bRet = TRUE;
}
else
- GetError();
+ {
+ if (bDispErr)
+ GetError();
+ else
+ DisplayString(_T("The service failed to start"));
+ }
return bRet;
}
@@ -114,13 +123,12 @@
if (hProgDlg)
{
+ IncrementProgressBar(hProgDlg);
+
bRet = DoStartService(Info,
hProgDlg);
- SendMessage(hProgDlg,
- WM_DESTROY,
- 0,
- 0);
+ DestroyWindow(hProgDlg);
}
return bRet;