a better fix for bug 2519

svn path=/trunk/; revision=29496
This commit is contained in:
Ged Murphy 2007-10-11 10:29:02 +00:00
parent 8596afd334
commit f3d656d276
2 changed files with 58 additions and 51 deletions

View file

@ -151,8 +151,8 @@ UpdateServiceCount(PMAIN_WND_INFO Info)
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
{
LPQUERY_SERVICE_CONFIG lpServiceConfig;
HMENU hMainMenu;
DWORD Flags, State;
UINT i;
/* get handle to menu */
@ -178,6 +178,11 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED);
}
lpServiceConfig = GetServiceConfig(Info->pCurrentService->lpServiceName);
if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
{
DWORD Flags, State;
Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted;
State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState;
@ -212,6 +217,9 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
SendMessage(Info->hTool, TB_SETSTATE, ID_RESTART,
(LPARAM)MAKELONG(TBSTATE_ENABLED, 0));
}
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
}
}
else
{

View file

@ -21,13 +21,12 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo,
HWND hwndDlg)
{
HWND hButton;
LPQUERY_SERVICE_CONFIG lpServiceConfig;
DWORD Flags, State;
UINT i;
LPQUERY_SERVICE_CONFIG lpServiceConfig;
Flags = dlgInfo->pService->ServiceStatusProcess.dwControlsAccepted;
State = dlgInfo->pService->ServiceStatusProcess.dwCurrentState;
lpServiceConfig = GetServiceConfig(dlgInfo->pService->lpServiceName);
for (i = IDC_START; i <= IDC_RESUME; i++)
{
@ -35,7 +34,10 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo,
EnableWindow (hButton, FALSE);
}
if ( (State == SERVICE_STOPPED) && (lpServiceConfig->dwStartType != SERVICE_DISABLED) )
lpServiceConfig = GetServiceConfig(dlgInfo->pService->lpServiceName);
if (lpServiceConfig && lpServiceConfig->dwStartType != SERVICE_DISABLED)
{
if (State == SERVICE_STOPPED)
{
hButton = GetDlgItem(hwndDlg, IDC_START);
EnableWindow (hButton, TRUE);
@ -51,10 +53,8 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo,
EnableWindow (hButton, TRUE);
}
HeapFree(ProcessHeap,
0,
lpServiceConfig);
HeapFree(GetProcessHeap(), 0, lpServiceConfig);
}
}
@ -492,4 +492,3 @@ OpenPropSheet(PMAIN_WND_INFO Info)
return Ret;
}