2010-02-27 19:51:54 +00:00
|
|
|
#ifndef __SERVMAN_PRECOMP_H
|
|
|
|
#define __SERVMAN_PRECOMP_H
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
2014-01-07 16:27:17 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
2020-05-01 17:01:59 +00:00
|
|
|
#include <winerror.h>
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <wingdi.h>
|
|
|
|
#include <winsvc.h>
|
2013-05-04 20:43:16 +00:00
|
|
|
#include <wincon.h>
|
2020-05-01 17:01:59 +00:00
|
|
|
|
2007-08-28 19:54:25 +00:00
|
|
|
#include <shlobj.h>
|
2016-11-02 18:55:51 +00:00
|
|
|
#include <commdlg.h>
|
2014-05-26 09:53:49 +00:00
|
|
|
#include <strsafe.h>
|
2017-12-05 12:25:14 +00:00
|
|
|
#include <process.h>
|
2016-11-02 18:55:51 +00:00
|
|
|
|
2006-11-08 11:47:44 +00:00
|
|
|
#include "resource.h"
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(disable : 4100)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define NO_ITEM_SELECTED -1
|
2015-04-08 17:28:46 +00:00
|
|
|
#define MAX_KEY_LENGTH 256
|
|
|
|
|
|
|
|
#define LVNAME 0
|
|
|
|
#define LVDESC 1
|
|
|
|
#define LVSTATUS 2
|
|
|
|
#define LVSTARTUP 3
|
|
|
|
#define LVLOGONAS 4
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2015-04-08 17:28:46 +00:00
|
|
|
#define IMAGE_UNKNOWN 0
|
|
|
|
#define IMAGE_SERVICE 1
|
|
|
|
#define IMAGE_DRIVER 2
|
2007-08-29 15:46:52 +00:00
|
|
|
|
2015-04-08 17:28:46 +00:00
|
|
|
#define ACTION_START 1
|
|
|
|
#define ACTION_STOP 2
|
|
|
|
#define ACTION_PAUSE 3
|
|
|
|
#define ACTION_RESUME 4
|
|
|
|
#define ACTION_RESTART 5
|
2010-01-02 12:10:14 +00:00
|
|
|
|
2016-04-03 22:13:01 +00:00
|
|
|
#define ORD_ASCENDING 1
|
|
|
|
#define ORD_DESCENDING -1
|
|
|
|
|
2006-11-08 11:47:44 +00:00
|
|
|
typedef struct _MAIN_WND_INFO
|
|
|
|
{
|
|
|
|
HWND hMainWnd;
|
|
|
|
HWND hListView;
|
|
|
|
HWND hStatus;
|
|
|
|
HWND hTool;
|
2016-04-03 22:13:01 +00:00
|
|
|
HWND hHeader;
|
2006-11-08 11:47:44 +00:00
|
|
|
HMENU hShortcutMenu;
|
|
|
|
int nCmdShow;
|
|
|
|
|
2007-08-25 13:41:44 +00:00
|
|
|
ENUM_SERVICE_STATUS_PROCESS *pAllServices;
|
2007-08-27 19:31:09 +00:00
|
|
|
ENUM_SERVICE_STATUS_PROCESS *pCurrentService;
|
2017-04-23 17:39:26 +00:00
|
|
|
DWORD NumServices;
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2007-08-24 18:27:12 +00:00
|
|
|
INT SelectedItem;/* selection number in the list view */
|
2016-04-03 22:13:01 +00:00
|
|
|
INT SortSelection;
|
|
|
|
INT SortDirection;
|
|
|
|
|
2007-08-24 18:27:12 +00:00
|
|
|
BOOL bDlgOpen;
|
2007-08-28 19:54:25 +00:00
|
|
|
BOOL bInMenuLoop;
|
|
|
|
BOOL bIsUserAnAdmin;
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2010-01-05 19:19:06 +00:00
|
|
|
PVOID pTag;
|
|
|
|
|
2006-11-08 11:47:44 +00:00
|
|
|
} MAIN_WND_INFO, *PMAIN_WND_INFO;
|
|
|
|
|
|
|
|
|
Merge 34758, 34771, 34786, 34787, 34906, 35826, 36174, 36274, 36444, 36445, 36446, 36447, 36448, 36477, 36511, 36898, 36903 from amd64 branch
svn path=/trunk/; revision=37910
2008-12-07 12:11:46 +00:00
|
|
|
INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
|
|
|
INT_PTR CALLBACK CreateDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
|
|
|
INT_PTR CALLBACK DeleteDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
|
|
|
INT_PTR CALLBACK ProgressDialogProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
|
2006-11-08 11:47:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* servman.c */
|
|
|
|
extern HINSTANCE hInstance;
|
|
|
|
extern HANDLE ProcessHeap;
|
|
|
|
|
|
|
|
/* mainwnd.c */
|
|
|
|
typedef struct _MENU_HINT
|
|
|
|
{
|
|
|
|
WORD CmdId;
|
|
|
|
UINT HintId;
|
|
|
|
} MENU_HINT, *PMENU_HINT;
|
|
|
|
|
2007-10-11 11:09:39 +00:00
|
|
|
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info);
|
2007-08-30 13:39:59 +00:00
|
|
|
VOID UpdateServiceCount(PMAIN_WND_INFO Info);
|
2007-08-29 15:46:52 +00:00
|
|
|
VOID ChangeListViewText(PMAIN_WND_INFO Info, ENUM_SERVICE_STATUS_PROCESS* pService, UINT Column);
|
2006-11-08 11:47:44 +00:00
|
|
|
BOOL InitMainWindowImpl(VOID);
|
|
|
|
VOID UninitMainWindowImpl(VOID);
|
|
|
|
HWND CreateMainWindow(LPCTSTR lpCaption, int nCmdShow);
|
|
|
|
|
2007-08-29 18:10:58 +00:00
|
|
|
/* listview.c */
|
|
|
|
VOID SetListViewStyle(HWND hListView, DWORD View);
|
|
|
|
VOID ListViewSelectionChanged(PMAIN_WND_INFO Info, LPNMLISTVIEW pnmv);
|
|
|
|
BOOL CreateListView(PMAIN_WND_INFO Info);
|
|
|
|
|
2015-04-08 17:28:46 +00:00
|
|
|
/* start / stop / control */
|
2020-05-01 17:01:59 +00:00
|
|
|
DWORD DoStartService(LPWSTR ServiceName, HANDLE hProgress, LPWSTR lpStartParams);
|
|
|
|
DWORD DoStopService(LPWSTR ServiceName, HANDLE hProgress);
|
|
|
|
DWORD DoControlService(LPWSTR ServiceName, HWND hProgress, DWORD Control);
|
2007-08-24 18:27:12 +00:00
|
|
|
|
|
|
|
/* progress.c */
|
2010-01-05 18:08:41 +00:00
|
|
|
#define DEFAULT_STEP 0
|
2015-04-08 18:14:16 +00:00
|
|
|
BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action, PVOID Param);
|
2015-04-08 17:28:46 +00:00
|
|
|
VOID IncrementProgressBar(HANDLE hProgress, UINT NewPos);
|
|
|
|
VOID CompleteProgressBar(HANDLE hProgress);
|
2006-11-08 11:47:44 +00:00
|
|
|
|
|
|
|
/* query.c */
|
|
|
|
ENUM_SERVICE_STATUS_PROCESS* GetSelectedService(PMAIN_WND_INFO Info);
|
2015-04-08 17:28:46 +00:00
|
|
|
LPQUERY_SERVICE_CONFIG GetServiceConfig(LPWSTR lpServiceName);
|
|
|
|
BOOL SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig, LPWSTR lpServiceName, LPWSTR lpPassword);
|
|
|
|
LPWSTR GetServiceDescription(LPWSTR lpServiceName);
|
|
|
|
BOOL SetServiceDescription(LPWSTR lpServiceName, LPWSTR lpDescription);
|
|
|
|
LPWSTR GetExecutablePath(LPWSTR lpServiceName);
|
2017-04-23 17:39:26 +00:00
|
|
|
VOID FreeServiceList(PMAIN_WND_INFO Info);
|
2006-11-08 11:47:44 +00:00
|
|
|
BOOL RefreshServiceList(PMAIN_WND_INFO Info);
|
2007-08-27 19:31:09 +00:00
|
|
|
BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS* pService);
|
2017-04-23 17:39:26 +00:00
|
|
|
BOOL GetServiceList(PMAIN_WND_INFO Info);
|
2007-08-25 14:51:36 +00:00
|
|
|
|
2006-11-08 11:47:44 +00:00
|
|
|
/* propsheet.c */
|
2009-05-04 18:44:54 +00:00
|
|
|
typedef struct _SERVICEPROPSHEET
|
|
|
|
{
|
|
|
|
PMAIN_WND_INFO Info;
|
|
|
|
ENUM_SERVICE_STATUS_PROCESS *pService;
|
2017-12-05 22:13:02 +00:00
|
|
|
|
|
|
|
} SERVICEPROPSHEET, *PSERVICEPROPSHEET;
|
|
|
|
|
|
|
|
typedef struct _DEPENDDATA
|
|
|
|
{
|
|
|
|
PSERVICEPROPSHEET pDlgInfo;
|
2009-05-04 18:44:54 +00:00
|
|
|
HIMAGELIST hDependsImageList;
|
2009-12-21 11:57:58 +00:00
|
|
|
HWND hDependsWnd;
|
|
|
|
HWND hDependsTreeView1;
|
|
|
|
HWND hDependsTreeView2;
|
2017-12-05 22:13:02 +00:00
|
|
|
|
|
|
|
} DEPENDDATA, *PDEPENDDATA;
|
2009-05-04 18:44:54 +00:00
|
|
|
|
2009-12-21 11:57:58 +00:00
|
|
|
|
2015-04-08 17:28:46 +00:00
|
|
|
HTREEITEM AddItemToTreeView(HWND hTreeView, HTREEITEM hRoot, LPWSTR lpDisplayName, LPWSTR lpServiceName, ULONG serviceType, BOOL bHasChildren);
|
2009-12-21 11:57:58 +00:00
|
|
|
|
2010-01-05 17:14:08 +00:00
|
|
|
/* stop_dependencies */
|
2009-12-21 11:57:58 +00:00
|
|
|
INT_PTR CALLBACK StopDependsDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
2010-01-05 17:14:08 +00:00
|
|
|
LPWSTR GetListOfServicesToStop(LPWSTR lpServiceName);
|
2015-04-08 17:28:46 +00:00
|
|
|
BOOL
|
|
|
|
CreateStopDependsDialog(HWND hParent,
|
|
|
|
LPWSTR ServiceName,
|
|
|
|
LPWSTR DisplayName,
|
|
|
|
LPWSTR ServiceList);
|
2009-12-21 11:57:58 +00:00
|
|
|
|
|
|
|
/* tv1_dependencies */
|
2017-12-05 22:13:02 +00:00
|
|
|
BOOL TV1_Initialize(PDEPENDDATA pDependData, LPWSTR lpServiceName);
|
|
|
|
VOID TV1_AddDependantsToTree(PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName);
|
2009-12-21 11:57:58 +00:00
|
|
|
|
|
|
|
/* tv2_dependencies */
|
2017-12-05 22:13:02 +00:00
|
|
|
BOOL TV2_Initialize(PDEPENDDATA pDependData, LPWSTR lpServiceName);
|
|
|
|
VOID TV2_AddDependantsToTree(PDEPENDDATA pDependData, HTREEITEM hParent, LPWSTR lpServiceName);
|
2010-01-02 12:10:14 +00:00
|
|
|
BOOL TV2_HasDependantServices(LPWSTR lpServiceName);
|
2010-01-05 17:14:08 +00:00
|
|
|
LPENUM_SERVICE_STATUS TV2_GetDependants(LPWSTR lpServiceName, LPDWORD lpdwCount);
|
2009-12-21 11:57:58 +00:00
|
|
|
|
2017-12-05 12:25:14 +00:00
|
|
|
VOID OpenPropSheet(PMAIN_WND_INFO Info);
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2009-05-04 18:44:54 +00:00
|
|
|
/* propsheet window procs */
|
|
|
|
INT_PTR CALLBACK DependenciesPageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam);
|
|
|
|
INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam);
|
2016-07-09 16:51:21 +00:00
|
|
|
INT_PTR CALLBACK LogonPageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam);
|
|
|
|
INT_PTR CALLBACK RecoveryPageProc(HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam);
|
2009-05-04 18:44:54 +00:00
|
|
|
|
2006-11-08 11:47:44 +00:00
|
|
|
/* export.c */
|
|
|
|
VOID ExportFile(PMAIN_WND_INFO Info);
|
|
|
|
|
|
|
|
/* misc.c */
|
2015-04-08 17:28:46 +00:00
|
|
|
INT AllocAndLoadString(OUT LPWSTR *lpTarget,
|
2006-11-08 11:47:44 +00:00
|
|
|
IN HINSTANCE hInst,
|
|
|
|
IN UINT uID);
|
|
|
|
DWORD LoadAndFormatString(IN HINSTANCE hInstance,
|
|
|
|
IN UINT uID,
|
2015-04-08 17:28:46 +00:00
|
|
|
OUT LPWSTR *lpTarget,
|
2006-11-08 11:47:44 +00:00
|
|
|
...);
|
|
|
|
BOOL StatusBarLoadAndFormatString(IN HWND hStatusBar,
|
|
|
|
IN INT PartId,
|
|
|
|
IN HINSTANCE hInstance,
|
|
|
|
IN UINT uID,
|
|
|
|
...);
|
|
|
|
BOOL StatusBarLoadString(IN HWND hStatusBar,
|
|
|
|
IN INT PartId,
|
|
|
|
IN HINSTANCE hInstance,
|
|
|
|
IN UINT uID);
|
2015-04-08 17:28:46 +00:00
|
|
|
INT GetTextFromEdit(OUT LPWSTR lpString,
|
2006-11-08 11:47:44 +00:00
|
|
|
IN HWND hDlg,
|
|
|
|
IN UINT Res);
|
|
|
|
VOID GetError(VOID);
|
2015-04-08 17:28:46 +00:00
|
|
|
VOID DisplayString(PWCHAR);
|
2009-05-04 18:44:54 +00:00
|
|
|
HIMAGELIST InitImageList(UINT StartResource,
|
|
|
|
UINT EndResource,
|
2006-11-08 11:47:44 +00:00
|
|
|
UINT Width,
|
2009-05-04 18:44:54 +00:00
|
|
|
UINT Height,
|
|
|
|
ULONG type);
|
2016-07-18 21:49:19 +00:00
|
|
|
VOID
|
|
|
|
ResourceMessageBox(
|
|
|
|
HINSTANCE hInstance,
|
|
|
|
HWND hwnd,
|
|
|
|
UINT uType,
|
|
|
|
UINT uCaptionId,
|
|
|
|
UINT uMessageId);
|
2010-02-27 19:51:54 +00:00
|
|
|
|
|
|
|
#endif /* __SERVMAN_PRECOMP_H */
|