diff --git a/reactos/base/applications/mscutils/servman/listview.c b/reactos/base/applications/mscutils/servman/listview.c index a6d426de32b..a291fc7e68c 100644 --- a/reactos/base/applications/mscutils/servman/listview.c +++ b/reactos/base/applications/mscutils/servman/listview.c @@ -42,10 +42,10 @@ ListViewSelectionChanged(PMAIN_WND_INFO Info, EnableMenuItem(hMainMenu, ID_PROP, MF_ENABLED); - EnableMenuItem(Info->hShortcutMenu, + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PROP, MF_ENABLED); - SetMenuDefaultItem(Info->hShortcutMenu, + SetMenuDefaultItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PROP, MF_BYCOMMAND); } @@ -58,7 +58,7 @@ ListViewSelectionChanged(PMAIN_WND_INFO Info, EnableMenuItem(hMainMenu, ID_DELETE, MF_ENABLED); - EnableMenuItem(Info->hShortcutMenu, + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED); } diff --git a/reactos/base/applications/mscutils/servman/mainwnd.c b/reactos/base/applications/mscutils/servman/mainwnd.c index 156fba88dd4..0f336a8b78b 100644 --- a/reactos/base/applications/mscutils/servman/mainwnd.c +++ b/reactos/base/applications/mscutils/servman/mainwnd.c @@ -162,7 +162,7 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info) for (i = ID_START; i <= ID_RESTART; i++) { EnableMenuItem(hMainMenu, i, MF_GRAYED); - EnableMenuItem(Info->hShortcutMenu, ID_START, MF_GRAYED); + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_START, MF_GRAYED); SendMessage(Info->hTool, TB_SETSTATE, i, (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0)); } @@ -175,7 +175,7 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info) SendMessage(Info->hTool, TB_SETSTATE, ID_DELETE, (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); EnableMenuItem(hMainMenu, ID_DELETE, MF_ENABLED); - EnableMenuItem(Info->hShortcutMenu, ID_DELETE, MF_ENABLED); + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_ENABLED); } Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted; @@ -184,7 +184,7 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info) if (State == SERVICE_STOPPED) { EnableMenuItem(hMainMenu, ID_START, MF_ENABLED); - EnableMenuItem(Info->hShortcutMenu, ID_START, MF_ENABLED); + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_START, MF_ENABLED); SendMessage(Info->hTool, TB_SETSTATE, ID_START, (LPARAM)MAKELONG(TBSTATE_ENABLED, 0)); } @@ -192,7 +192,7 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info) if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) ) { EnableMenuItem(hMainMenu, ID_STOP, MF_ENABLED); - EnableMenuItem(Info->hShortcutMenu, 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)); } @@ -200,7 +200,7 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info) if ( (Flags & SERVICE_ACCEPT_PAUSE_CONTINUE) && (State == SERVICE_RUNNING) ) { EnableMenuItem(hMainMenu, ID_PAUSE, MF_ENABLED); - EnableMenuItem(Info->hShortcutMenu, 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)); } @@ -208,7 +208,7 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info) if ( (Flags & SERVICE_ACCEPT_STOP) && (State == SERVICE_RUNNING) ) { EnableMenuItem(hMainMenu, ID_RESTART, MF_ENABLED); - EnableMenuItem(Info->hShortcutMenu, 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)); } @@ -218,8 +218,8 @@ VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info) /* disable tools which rely on a selected service */ EnableMenuItem(hMainMenu, ID_PROP, MF_GRAYED); EnableMenuItem(hMainMenu, ID_DELETE, MF_GRAYED); - EnableMenuItem(Info->hShortcutMenu, ID_PROP, MF_GRAYED); - EnableMenuItem(Info->hShortcutMenu, ID_DELETE, MF_GRAYED); + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_PROP, MF_GRAYED); + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_DELETE, MF_GRAYED); SendMessage(Info->hTool, TB_SETSTATE, ID_PROP, (LPARAM)MAKELONG(TBSTATE_INDETERMINATE, 0)); SendMessage(Info->hTool, TB_SETSTATE, ID_DELETE, @@ -347,8 +347,6 @@ InitMainWnd(PMAIN_WND_INFO Info) /* Create Popup Menu */ Info->hShortcutMenu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_POPUP)); - Info->hShortcutMenu = GetSubMenu(Info->hShortcutMenu, - 0); Info->bIsUserAnAdmin = IsUserAnAdmin(); if (Info->bIsUserAnAdmin) @@ -365,7 +363,7 @@ InitMainWnd(PMAIN_WND_INFO Info) ID_CREATE, MF_ENABLED); } - EnableMenuItem(Info->hShortcutMenu, + EnableMenuItem(GetSubMenu(Info->hShortcutMenu, 0), ID_CREATE, MF_ENABLED); } @@ -766,7 +764,7 @@ MainWndProc(HWND hwnd, GetWindowRect(Info->hListView, &lvRect); if (PtInRect(&lvRect, pt)) { - TrackPopupMenuEx(Info->hShortcutMenu, + TrackPopupMenuEx(GetSubMenu(Info->hShortcutMenu, 0), TPM_RIGHTBUTTON, xPos, yPos, diff --git a/reactos/base/applications/mscutils/servman/propsheet.c b/reactos/base/applications/mscutils/servman/propsheet.c index f1eac06499c..6262905939d 100644 --- a/reactos/base/applications/mscutils/servman/propsheet.c +++ b/reactos/base/applications/mscutils/servman/propsheet.c @@ -180,6 +180,9 @@ InitGeneralPage(PSERVICEPROPSHEET dlgInfo, WM_SETTEXT, 0, (LPARAM)pServiceConfig->lpBinaryPathName); + HeapFree(ProcessHeap, + 0, + pServiceConfig); } diff --git a/reactos/base/applications/mscutils/servman/query.c b/reactos/base/applications/mscutils/servman/query.c index d14347f3ba3..cffff230d65 100644 --- a/reactos/base/applications/mscutils/servman/query.c +++ b/reactos/base/applications/mscutils/servman/query.c @@ -271,6 +271,13 @@ GetServiceList(PMAIN_WND_INFO Info, *NumServices = 0; + if (Info->pAllServices != NULL) + { + HeapFree(ProcessHeap, + 0, + Info->pAllServices); + } + ScHandle = OpenSCManager(NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE);