mirror of
https://github.com/reactos/reactos.git
synced 2024-07-23 20:58:16 +00:00
a better fix for bug 2519
svn path=/trunk/; revision=29496
This commit is contained in:
parent
8596afd334
commit
f3d656d276
|
@ -151,8 +151,8 @@ UpdateServiceCount(PMAIN_WND_INFO Info)
|
||||||
|
|
||||||
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
|
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
|
||||||
{
|
{
|
||||||
|
LPQUERY_SERVICE_CONFIG lpServiceConfig;
|
||||||
HMENU hMainMenu;
|
HMENU hMainMenu;
|
||||||
DWORD Flags, State;
|
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
/* get handle to menu */
|
/* get handle to menu */
|
||||||
|
@ -178,39 +178,47 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
|
||||||
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED);
|
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED);
|
||||||
}
|
}
|
||||||
|
|
||||||
Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted;
|
lpServiceConfig = GetServiceConfig(Info->pCurrentService->lpServiceName);
|
||||||
State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState;
|
if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
|
||||||
|
|
||||||
if (State == SERVICE_STOPPED)
|
|
||||||
{
|
{
|
||||||
EnableMenuItem(hMainMenu, ID_START, MF_ENABLED);
|
DWORD Flags, State;
|
||||||
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_START, MF_ENABLED);
|
|
||||||
SendMessage(Info->hTool, TB_SETSTATE, ID_START,
|
|
||||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted;
|
||||||
{
|
State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState;
|
||||||
EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED);
|
|
||||||
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_STOP, MF_ENABLED);
|
|
||||||
SendMessage(Info->hTool, TB_SETSTATE, ID_STOP,
|
|
||||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) )
|
if (State == SERVICE_STOPPED)
|
||||||
{
|
{
|
||||||
EnableMenuItem(hMainMenu, ID_PAUSE, MF_ENABLED);
|
EnableMenuItem(hMainMenu, ID_START, MF_ENABLED);
|
||||||
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PAUSE, MF_ENABLED);
|
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_START, MF_ENABLED);
|
||||||
SendMessage(Info->hTool, TB_SETSTATE, ID_PAUSE,
|
SendMessage(Info->hTool, TB_SETSTATE, ID_START,
|
||||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||||
{
|
{
|
||||||
EnableMenuItem(hMainMenu, ID_RESTART, MF_ENABLED);
|
EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED);
|
||||||
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_RESTART, MF_ENABLED);
|
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_STOP, MF_ENABLED);
|
||||||
SendMessage(Info->hTool, TB_SETSTATE, ID_RESTART,
|
SendMessage(Info->hTool, TB_SETSTATE, ID_STOP,
|
||||||
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) )
|
||||||
|
{
|
||||||
|
EnableMenuItem(hMainMenu, ID_PAUSE, MF_ENABLED);
|
||||||
|
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PAUSE, MF_ENABLED);
|
||||||
|
SendMessage(Info->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(GetSubMenu(Info->hShortcutMenu, 0), ID_RESTART, MF_ENABLED);
|
||||||
|
SendMessage(Info->hTool, TB_SETSTATE, ID_RESTART,
|
||||||
|
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -21,13 +21,12 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo,
|
||||||
HWND hwndDlg)
|
HWND hwndDlg)
|
||||||
{
|
{
|
||||||
HWND hButton;
|
HWND hButton;
|
||||||
|
LPQUERY_SERVICE_CONFIG lpServiceConfig;
|
||||||
DWORD Flags, State;
|
DWORD Flags, State;
|
||||||
UINT i;
|
UINT i;
|
||||||
LPQUERY_SERVICE_CONFIG lpServiceConfig;
|
|
||||||
|
|
||||||
Flags = dlgInfo->pService->ServiceStatusProcess.dwControlsAccepted;
|
Flags = dlgInfo->pService->ServiceStatusProcess.dwControlsAccepted;
|
||||||
State = dlgInfo->pService->ServiceStatusProcess.dwCurrentState;
|
State = dlgInfo->pService->ServiceStatusProcess.dwCurrentState;
|
||||||
lpServiceConfig = GetServiceConfig(dlgInfo->pService->lpServiceName);
|
|
||||||
|
|
||||||
for (i = IDC_START; i <= IDC_RESUME; i++)
|
for (i = IDC_START; i <= IDC_RESUME; i++)
|
||||||
{
|
{
|
||||||
|
@ -35,26 +34,27 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo,
|
||||||
EnableWindow (hButton, FALSE);
|
EnableWindow (hButton, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (State == SERVICE_STOPPED) && (lpServiceConfig->dwStartType != SERVICE_DISABLED) )
|
lpServiceConfig = GetServiceConfig(dlgInfo->pService->lpServiceName);
|
||||||
|
if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
|
||||||
{
|
{
|
||||||
hButton = GetDlgItem(hwndDlg, IDC_START);
|
if (State == SERVICE_STOPPED)
|
||||||
EnableWindow (hButton, TRUE);
|
{
|
||||||
}
|
hButton = GetDlgItem(hwndDlg, IDC_START);
|
||||||
else if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
EnableWindow (hButton, TRUE);
|
||||||
{
|
}
|
||||||
hButton = GetDlgItem(hwndDlg, IDC_STOP);
|
else if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) )
|
||||||
EnableWindow (hButton, TRUE);
|
{
|
||||||
}
|
hButton = GetDlgItem(hwndDlg, IDC_STOP);
|
||||||
else if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) )
|
EnableWindow (hButton, TRUE);
|
||||||
{
|
}
|
||||||
hButton = GetDlgItem(hwndDlg, IDC_PAUSE);
|
else if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) )
|
||||||
EnableWindow (hButton, TRUE);
|
{
|
||||||
}
|
hButton = GetDlgItem(hwndDlg, IDC_PAUSE);
|
||||||
|
EnableWindow (hButton, TRUE);
|
||||||
HeapFree(ProcessHeap,
|
}
|
||||||
0,
|
|
||||||
lpServiceConfig);
|
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -492,4 +492,3 @@ OpenPropSheet(PMAIN_WND_INFO Info)
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue