summaryrefslogtreecommitdiffstats
path: root/support/win32
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:33:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:33:50 +0000
commitfe39ffb8b90ae4e002ed73fe98617cd590abb467 (patch)
treeb80e5956907d8aeaaffe4e4f0c068c0e6157ce8b /support/win32
parentInitial commit. (diff)
downloadapache2-upstream.tar.xz
apache2-upstream.zip
Adding upstream version 2.4.56.upstream/2.4.56upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'support/win32')
-rw-r--r--support/win32/ApacheMonitor.c1671
-rw-r--r--support/win32/ApacheMonitor.dep18
-rw-r--r--support/win32/ApacheMonitor.dsp143
-rw-r--r--support/win32/ApacheMonitor.h78
-rw-r--r--support/win32/ApacheMonitor.icobin0 -> 1078 bytes
-rw-r--r--support/win32/ApacheMonitor.mak309
-rw-r--r--support/win32/ApacheMonitor.manifest10
-rw-r--r--support/win32/ApacheMonitor.rc103
-rw-r--r--support/win32/apache_header.bmpbin0 -> 6498 bytes
-rw-r--r--support/win32/aprun.icobin0 -> 318 bytes
-rw-r--r--support/win32/apstop.icobin0 -> 318 bytes
-rw-r--r--support/win32/srun.bmpbin0 -> 246 bytes
-rw-r--r--support/win32/sstop.bmpbin0 -> 246 bytes
-rw-r--r--support/win32/wintty.c374
-rw-r--r--support/win32/wintty.dep5
-rw-r--r--support/win32/wintty.dsp106
-rw-r--r--support/win32/wintty.mak317
17 files changed, 3134 insertions, 0 deletions
diff --git a/support/win32/ApacheMonitor.c b/support/win32/ApacheMonitor.c
new file mode 100644
index 0000000..841b4ab
--- /dev/null
+++ b/support/win32/ApacheMonitor.c
@@ -0,0 +1,1671 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* ====================================================================
+ * ApacheMonitor.c Simple program to manage and monitor Apache services.
+ *
+ * Contributed by Mladen Turk <mturk mappingsoft.com>
+ *
+ * 05 Aug 2001
+ * ====================================================================
+ */
+
+#define _WIN32_WINNT 0x0500
+#ifndef STRICT
+#define STRICT
+#endif
+#ifndef OEMRESOURCE
+#define OEMRESOURCE
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+#include <windows.h>
+#include <windowsx.h>
+#include <commctrl.h>
+#include <objbase.h>
+#include <shlobj.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <WtsApi32.h>
+#include <tchar.h>
+#include "ApacheMonitor.h"
+
+#ifndef AM_STRINGIFY
+/** Properly quote a value as a string in the C preprocessor */
+#define AM_STRINGIFY(n) AM_STRINGIFY_HELPER(n)
+/** Helper macro for AM_STRINGIFY */
+#define AM_STRINGIFY_HELPER(n) #n
+#endif
+
+#define OS_VERSION_WINNT 2
+#define OS_VERSION_WIN2K 3
+
+/* Should be enough */
+#define MAX_APACHE_SERVICES 128
+#define MAX_APACHE_COMPUTERS 32
+
+#define WM_TRAYMESSAGE (WM_APP+1)
+#define WM_UPDATEMESSAGE (WM_USER+1)
+#define WM_MANAGEMESSAGE (WM_USER+2)
+#define WM_TIMER_REFRESH 10
+#define WM_TIMER_RESCAN 11
+#define SERVICE_APACHE_RESTART 128
+#define XBITMAP 16
+#define YBITMAP 16
+#define MAX_LOADSTRING 100
+#define REFRESH_TIME 2000 /* service refresh time (ms) */
+#define RESCAN_TIME 20000 /* registry rescan time (ms) */
+
+typedef struct _st_APACHE_SERVICE
+{
+ LPTSTR szServiceName;
+ LPTSTR szDisplayName;
+ LPTSTR szDescription;
+ LPTSTR szImagePath;
+ LPTSTR szComputerName;
+ DWORD dwPid;
+} ST_APACHE_SERVICE;
+
+typedef struct _st_MONITORED_COMPUTERS
+{
+ LPTSTR szComputerName;
+ HKEY hRegistry;
+} ST_MONITORED_COMP;
+
+/* Global variables */
+HINSTANCE g_hInstance = NULL;
+TCHAR *g_szTitle; /* The title bar text */
+TCHAR *g_szWindowClass; /* Window Class Name */
+HICON g_icoStop;
+HICON g_icoRun;
+UINT g_bUiTaskbarCreated;
+DWORD g_dwOSVersion;
+BOOL g_bDlgServiceOn = FALSE;
+BOOL g_bConsoleRun = FALSE;
+ST_APACHE_SERVICE g_stServices[MAX_APACHE_SERVICES];
+ST_MONITORED_COMP g_stComputers[MAX_APACHE_COMPUTERS];
+
+HBITMAP g_hBmpStart, g_hBmpStop;
+HBITMAP g_hBmpPicture, g_hBmpOld;
+BOOL g_bRescanServices;
+HWND g_hwndServiceDlg;
+HWND g_hwndMain;
+HWND g_hwndStdoutList;
+HWND g_hwndConnectDlg;
+HCURSOR g_hCursorHourglass;
+HCURSOR g_hCursorArrow;
+
+LANGID g_LangID;
+CRITICAL_SECTION g_stcSection;
+LPTSTR g_szLocalHost;
+
+/* locale language support */
+static TCHAR *g_lpMsg[IDS_MSG_LAST - IDS_MSG_FIRST + 1];
+
+
+void am_ClearServicesSt()
+{
+ int i;
+ for (i = 0; i < MAX_APACHE_SERVICES; i++)
+ {
+ if (g_stServices[i].szServiceName) {
+ free(g_stServices[i].szServiceName);
+ }
+ if (g_stServices[i].szDisplayName) {
+ free(g_stServices[i].szDisplayName);
+ }
+ if (g_stServices[i].szDescription) {
+ free(g_stServices[i].szDescription);
+ }
+ if (g_stServices[i].szImagePath) {
+ free(g_stServices[i].szImagePath);
+ }
+ if (g_stServices[i].szComputerName) {
+ free(g_stServices[i].szComputerName);
+ }
+
+ }
+ memset(g_stServices, 0, sizeof(ST_APACHE_SERVICE) * MAX_APACHE_SERVICES);
+
+}
+
+
+void am_ClearComputersSt()
+{
+ int i;
+ for (i = 0; i < MAX_APACHE_COMPUTERS; i++) {
+ if (g_stComputers[i].szComputerName) {
+ free(g_stComputers[i].szComputerName);
+ RegCloseKey(g_stComputers[i].hRegistry);
+ }
+ }
+ memset(g_stComputers, 0, sizeof(ST_MONITORED_COMP) * MAX_APACHE_COMPUTERS);
+
+}
+
+
+BOOL am_IsComputerConnected(LPTSTR szComputerName)
+{
+ int i = 0;
+ while (g_stComputers[i].szComputerName != NULL) {
+ if (_tcscmp(g_stComputers[i].szComputerName, szComputerName) == 0) {
+ return TRUE;
+ }
+ ++i;
+ }
+ return FALSE;
+}
+
+
+void am_DisconnectComputer(LPTSTR szComputerName)
+{
+ int i = 0, j;
+ while (g_stComputers[i].szComputerName != NULL) {
+ if (_tcscmp(g_stComputers[i].szComputerName, szComputerName) == 0) {
+ break;
+ }
+ ++i;
+ }
+ if (g_stComputers[i].szComputerName != NULL) {
+ free(g_stComputers[i].szComputerName);
+ RegCloseKey(g_stComputers[i].hRegistry);
+ for (j = i; j < MAX_APACHE_COMPUTERS - 1; j++) {
+ g_stComputers[j].szComputerName= g_stComputers[j+1].szComputerName;
+ g_stComputers[j].hRegistry = g_stComputers[j+1].hRegistry;
+ }
+ g_stComputers[j].szComputerName = NULL;
+ g_stComputers[j].hRegistry = NULL;
+ }
+}
+
+
+void ErrorMessage(LPCTSTR szError, BOOL bFatal)
+{
+ LPVOID lpMsgBuf = NULL;
+ if (szError) {
+ MessageBox(NULL, szError, g_lpMsg[IDS_MSG_ERROR - IDS_MSG_FIRST],
+ MB_OK | (bFatal ? MB_ICONERROR : MB_ICONEXCLAMATION));
+ }
+ else {
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, GetLastError(), g_LangID,
+ (LPTSTR) &lpMsgBuf, 0, NULL);
+ MessageBox(NULL, (LPCTSTR)lpMsgBuf,
+ g_lpMsg[IDS_MSG_ERROR - IDS_MSG_FIRST],
+ MB_OK | (bFatal ? MB_ICONERROR : MB_ICONEXCLAMATION));
+ LocalFree(lpMsgBuf);
+ }
+ if (bFatal) {
+ PostQuitMessage(0);
+ }
+}
+
+
+int am_RespawnAsUserAdmin(HWND hwnd, DWORD op, LPCTSTR szService,
+ LPCTSTR szComputerName)
+{
+ TCHAR args[MAX_PATH + MAX_COMPUTERNAME_LENGTH + 12];
+
+ if (g_dwOSVersion < OS_VERSION_WIN2K) {
+ ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST], FALSE);
+ return 0;
+ }
+
+ _sntprintf(args, sizeof(args) / sizeof(TCHAR),
+ _T("%d \"%s\" \"%s\""), op, szService,
+ szComputerName ? szComputerName : _T(""));
+ if (!ShellExecute(hwnd, _T("runas"), __targv[0], args, NULL, SW_NORMAL)) {
+ ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
+ FALSE);
+ return 0;
+ }
+
+ return 1;
+}
+
+
+BOOL am_ConnectComputer(LPTSTR szComputerName)
+{
+ int i = 0;
+ HKEY hKeyRemote;
+ TCHAR szTmp[MAX_PATH];
+
+ while (g_stComputers[i].szComputerName != NULL) {
+ if (_tcscmp(g_stComputers[i].szComputerName, szComputerName) == 0) {
+ return FALSE;
+ }
+ ++i;
+ }
+ if (i > MAX_APACHE_COMPUTERS - 1) {
+ return FALSE;
+ }
+ if (RegConnectRegistry(szComputerName, HKEY_LOCAL_MACHINE, &hKeyRemote)
+ != ERROR_SUCCESS) {
+ _sntprintf(szTmp, sizeof(szTmp) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_ECONNECT - IDS_MSG_FIRST],
+ szComputerName);
+ ErrorMessage(szTmp, FALSE);
+ return FALSE;
+ }
+ else {
+ g_stComputers[i].szComputerName = _tcsdup(szComputerName);
+ g_stComputers[i].hRegistry = hKeyRemote;
+ return TRUE;
+ }
+}
+
+
+LPTSTR GetStringRes(int id)
+{
+ static TCHAR buffer[MAX_PATH];
+
+ buffer[0] = 0;
+ LoadString(GetModuleHandle(NULL), id, buffer, MAX_PATH);
+ return buffer;
+}
+
+
+BOOL GetSystemOSVersion(LPDWORD dwVersion)
+{
+ OSVERSIONINFO osvi;
+ /*
+ Try calling GetVersionEx using the OSVERSIONINFOEX structure.
+ If that fails, try using the OSVERSIONINFO structure.
+ */
+ memset(&osvi, 0, sizeof(OSVERSIONINFO));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+
+ if (!GetVersionEx(&osvi)) {
+ return FALSE;
+ }
+
+ switch (osvi.dwPlatformId)
+ {
+ case VER_PLATFORM_WIN32_NT:
+ if (osvi.dwMajorVersion >= 5)
+ *dwVersion = OS_VERSION_WIN2K;
+ else
+ *dwVersion = OS_VERSION_WINNT;
+ break;
+
+ case VER_PLATFORM_WIN32_WINDOWS:
+ case VER_PLATFORM_WIN32s:
+ default:
+ *dwVersion = 0;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+static VOID ShowNotifyIcon(HWND hWnd, DWORD dwMessage)
+{
+ NOTIFYICONDATA nid;
+ int i = 0, n = 0;
+
+ memset(&nid, 0, sizeof(nid));
+ nid.cbSize = sizeof(NOTIFYICONDATA);
+ nid.hWnd = hWnd;
+ nid.uID = 0xFF;
+ nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
+ nid.uCallbackMessage = WM_TRAYMESSAGE;
+
+ while (g_stServices[i].szServiceName != NULL)
+ {
+ if (g_stServices[i].dwPid != 0) {
+ ++n;
+ }
+ ++i;
+ }
+ if (dwMessage != NIM_DELETE)
+ {
+ if (n) {
+ nid.hIcon = g_icoRun;
+ }
+ else {
+ nid.hIcon = g_icoStop;
+ }
+ }
+ else {
+ nid.hIcon = NULL;
+ }
+ if (n == i && n > 0) {
+ _tcscpy(nid.szTip, g_lpMsg[IDS_MSG_RUNNINGALL - IDS_MSG_FIRST]);
+ }
+ else if (n) {
+ _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_RUNNING - IDS_MSG_FIRST], n, i);
+ }
+ else if (i) {
+ _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_RUNNINGNONE - IDS_MSG_FIRST], i);
+ }
+ else {
+ _tcscpy(nid.szTip, g_lpMsg[IDS_MSG_NOSERVICES - IDS_MSG_FIRST]);
+ }
+ Shell_NotifyIcon(dwMessage, &nid);
+}
+
+
+void appendMenuItem(HMENU hMenu, UINT uMenuId, LPTSTR szName,
+ BOOL fDefault, BOOL fEnabled)
+{
+ MENUITEMINFO mii;
+
+ memset(&mii, 0, sizeof(MENUITEMINFO));
+ mii.cbSize = sizeof(MENUITEMINFO);
+ mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE;
+ if (_tcslen(szName))
+ {
+ mii.fType = MFT_STRING;
+ mii.wID = uMenuId;
+ if (fDefault) {
+ mii.fState = MFS_DEFAULT;
+ }
+ if (!fEnabled) {
+ mii.fState |= MFS_DISABLED;
+ }
+ mii.dwTypeData = szName;
+ }
+ else {
+ mii.fType = MFT_SEPARATOR;
+ }
+ InsertMenuItem(hMenu, uMenuId, FALSE, &mii);
+}
+
+
+void appendServiceMenu(HMENU hMenu, UINT uMenuId,
+ LPTSTR szServiceName, BOOL fRunning)
+{
+ MENUITEMINFO mii;
+ HMENU smh;
+
+ smh = CreatePopupMenu();
+
+ appendMenuItem(smh, IDM_SM_START + uMenuId,
+ g_lpMsg[IDS_MSG_SSTART - IDS_MSG_FIRST], FALSE, !fRunning);
+ appendMenuItem(smh, IDM_SM_STOP + uMenuId,
+ g_lpMsg[IDS_MSG_SSTOP - IDS_MSG_FIRST], FALSE, fRunning);
+ appendMenuItem(smh, IDM_SM_RESTART + uMenuId,
+ g_lpMsg[IDS_MSG_SRESTART - IDS_MSG_FIRST], FALSE, fRunning);
+
+ memset(&mii, 0, sizeof(MENUITEMINFO));
+ mii.cbSize = sizeof(MENUITEMINFO);
+ mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE | MIIM_SUBMENU
+ | MIIM_CHECKMARKS;
+ mii.fType = MFT_STRING;
+ mii.wID = uMenuId;
+ mii.hbmpChecked = g_hBmpStart;
+ mii.hbmpUnchecked = g_hBmpStop;
+ mii.dwTypeData = szServiceName;
+ mii.hSubMenu = smh;
+ mii.fState = fRunning ? MFS_CHECKED : MFS_UNCHECKED;
+ InsertMenuItem(hMenu, IDM_SM_SERVICE + uMenuId, FALSE, &mii);
+}
+
+
+void ShowTryPopupMenu(HWND hWnd)
+{
+ /* create popup menu */
+ HMENU hMenu = CreatePopupMenu();
+ POINT pt;
+
+ if (hMenu)
+ {
+ appendMenuItem(hMenu, IDM_RESTORE,
+ g_lpMsg[IDS_MSG_MNUSHOW - IDS_MSG_FIRST],
+ TRUE, TRUE);
+ appendMenuItem(hMenu, IDC_SMANAGER,
+ g_lpMsg[IDS_MSG_MNUSERVICES - IDS_MSG_FIRST],
+ FALSE, TRUE);
+ appendMenuItem(hMenu, 0, _T(""), FALSE, TRUE);
+ appendMenuItem(hMenu, IDM_EXIT,
+ g_lpMsg[IDS_MSG_MNUEXIT - IDS_MSG_FIRST],
+ FALSE, TRUE);
+
+ if (!SetForegroundWindow(hWnd)) {
+ SetForegroundWindow(NULL);
+ }
+ GetCursorPos(&pt);
+ TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RIGHTBUTTON,
+ pt.x, pt.y, 0, hWnd, NULL);
+ DestroyMenu(hMenu);
+ }
+}
+
+
+void ShowTryServicesMenu(HWND hWnd)
+{
+ /* create services list popup menu and submenus */
+ HMENU hMenu = CreatePopupMenu();
+ POINT pt;
+ int i = 0;
+
+ if (hMenu)
+ {
+ while (g_stServices[i].szServiceName != NULL)
+ {
+ appendServiceMenu(hMenu, i, g_stServices[i].szDisplayName,
+ g_stServices[i].dwPid != 0);
+ ++i;
+ }
+ if (i)
+ {
+ if (!SetForegroundWindow(hWnd)) {
+ SetForegroundWindow(NULL);
+ }
+ GetCursorPos(&pt);
+ TrackPopupMenu(hMenu, TPM_LEFTALIGN|TPM_RIGHTBUTTON,
+ pt.x, pt.y, 0, hWnd, NULL);
+ DestroyMenu(hMenu);
+ }
+ }
+}
+
+
+BOOL CenterWindow(HWND hwndChild)
+{
+ RECT rChild, rWorkArea;
+ int wChild, hChild;
+ int xNew, yNew;
+ BOOL bResult;
+
+ /* Get the Height and Width of the child window */
+ GetWindowRect(hwndChild, &rChild);
+ wChild = rChild.right - rChild.left;
+ hChild = rChild.bottom - rChild.top;
+
+ /* Get the limits of the 'workarea' */
+ bResult = SystemParametersInfo(SPI_GETWORKAREA, sizeof(RECT),
+ &rWorkArea, 0);
+ if (!bResult) {
+ rWorkArea.left = rWorkArea.top = 0;
+ rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
+ rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
+ }
+
+ /* Calculate new X and Y position*/
+ xNew = (rWorkArea.right - wChild) / 2;
+ yNew = (rWorkArea.bottom - hChild) / 2;
+ return SetWindowPos(hwndChild, HWND_TOP, xNew, yNew, 0, 0,
+ SWP_NOSIZE | SWP_SHOWWINDOW);
+}
+
+
+static void addListBoxItem(HWND hDlg, LPTSTR lpStr, HBITMAP hBmp)
+{
+ LRESULT nItem;
+
+ nItem = SendMessage(hDlg, LB_ADDSTRING, 0, (LPARAM)lpStr);
+ SendMessage(hDlg, LB_SETITEMDATA, nItem, (LPARAM)hBmp);
+}
+
+
+static void addListBoxString(HWND hListBox, LPTSTR lpStr)
+{
+ static int nItems = 0;
+ if (!g_bDlgServiceOn) {
+ return;
+ }
+ ++nItems;
+ if (nItems > MAX_LOADSTRING)
+ {
+ SendMessage(hListBox, LB_RESETCONTENT, 0, 0);
+ nItems = 1;
+ }
+ ListBox_SetCurSel(hListBox,
+ ListBox_AddString(hListBox, lpStr));
+
+}
+
+
+BOOL ApacheManageService(LPCTSTR szServiceName, LPCTSTR szImagePath,
+ LPTSTR szComputerName, DWORD dwCommand)
+{
+ TCHAR szMsg[MAX_PATH];
+ BOOL retValue;
+ SC_HANDLE schService;
+ SC_HANDLE schSCManager;
+ SERVICE_STATUS schSStatus;
+ int ticks;
+
+ schSCManager = OpenSCManager(szComputerName, NULL,
+ SC_MANAGER_CONNECT);
+ if (!schSCManager) {
+ ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
+ FALSE);
+ return FALSE;
+ }
+
+ schService = OpenService(schSCManager, szServiceName,
+ SERVICE_QUERY_STATUS | SERVICE_START |
+ SERVICE_STOP | SERVICE_USER_DEFINED_CONTROL);
+ if (schService == NULL)
+ {
+ /* Avoid recursion of ImagePath NULL (from this Respawn) */
+ if (szImagePath) {
+ am_RespawnAsUserAdmin(g_hwndMain, dwCommand,
+ szServiceName, szComputerName);
+ }
+ else {
+ ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
+ FALSE);
+ }
+ CloseServiceHandle(schSCManager);
+ return FALSE;
+ }
+ else
+ {
+ retValue = FALSE;
+ g_bConsoleRun = TRUE;
+ SetCursor(g_hCursorHourglass);
+ switch (dwCommand)
+ {
+ case SERVICE_CONTROL_STOP:
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVSTOP - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
+ if (ControlService(schService, SERVICE_CONTROL_STOP,
+ &schSStatus)) {
+ Sleep(1000);
+ while (QueryServiceStatus(schService, &schSStatus))
+ {
+ if (schSStatus.dwCurrentState == SERVICE_STOP_PENDING)
+ {
+ Sleep(1000);
+ }
+ else {
+ break;
+ }
+ }
+ }
+ if (QueryServiceStatus(schService, &schSStatus))
+ {
+ if (schSStatus.dwCurrentState == SERVICE_STOPPED)
+ {
+ retValue = TRUE;
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVSTOPPED - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
+ }
+ }
+ break;
+
+ case SERVICE_CONTROL_CONTINUE:
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVSTART - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
+
+ if (StartService(schService, 0, NULL))
+ {
+ Sleep(1000);
+ while (QueryServiceStatus(schService, &schSStatus))
+ {
+ if (schSStatus.dwCurrentState == SERVICE_START_PENDING)
+ {
+ Sleep(1000);
+ }
+ else {
+ break;
+ }
+ }
+ }
+ if (QueryServiceStatus(schService, &schSStatus))
+ {
+ if (schSStatus.dwCurrentState == SERVICE_RUNNING)
+ {
+ retValue = TRUE;
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVSTARTED - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
+ }
+ }
+ break;
+
+ case SERVICE_APACHE_RESTART:
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVRESTART - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
+ if (ControlService(schService, SERVICE_APACHE_RESTART,
+ &schSStatus))
+ {
+ ticks = 60;
+ while (schSStatus.dwCurrentState == SERVICE_START_PENDING)
+ {
+ Sleep(1000);
+ if (!QueryServiceStatus(schService, &schSStatus))
+ {
+ CloseServiceHandle(schService);
+ CloseServiceHandle(schSCManager);
+ g_bConsoleRun = FALSE;
+ SetCursor(g_hCursorArrow);
+ return FALSE;
+ }
+ if (!--ticks) {
+ break;
+ }
+ }
+ }
+ if (schSStatus.dwCurrentState == SERVICE_RUNNING)
+ {
+ retValue = TRUE;
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ g_lpMsg[IDS_MSG_SRVRESTARTED - IDS_MSG_FIRST],
+ szServiceName);
+ addListBoxString(g_hwndStdoutList, szMsg);
+ }
+ break;
+ }
+ CloseServiceHandle(schService);
+ CloseServiceHandle(schSCManager);
+ if (!retValue) {
+ ErrorMessage(g_lpMsg[IDS_MSG_SRVFAILED - IDS_MSG_FIRST],
+ FALSE);
+ }
+ g_bConsoleRun = FALSE;
+ SetCursor(g_hCursorArrow);
+ return retValue;
+ }
+ return FALSE;
+}
+
+
+BOOL IsServiceRunning(LPCTSTR szServiceName, LPCTSTR szComputerName,
+ LPDWORD lpdwPid)
+{
+ DWORD dwPid;
+ SC_HANDLE schService;
+ SC_HANDLE schSCManager;
+ SERVICE_STATUS schSStatus;
+
+ dwPid = 0;
+ schSCManager = OpenSCManager(szComputerName, NULL,
+ SC_MANAGER_CONNECT);
+ if (!schSCManager) {
+ return FALSE;
+ }
+
+ schService = OpenService(schSCManager, szServiceName,
+ SERVICE_QUERY_STATUS);
+ if (schService != NULL)
+ {
+ if (QueryServiceStatus(schService, &schSStatus))
+ {
+ dwPid = schSStatus.dwCurrentState;
+ if (lpdwPid) {
+ *lpdwPid = 1;
+ }
+ }
+ CloseServiceHandle(schService);
+ CloseServiceHandle(schSCManager);
+ return dwPid == SERVICE_RUNNING ? TRUE : FALSE;
+ }
+ else {
+ g_bRescanServices = TRUE;
+ }
+ CloseServiceHandle(schSCManager);
+ return FALSE;
+}
+
+
+BOOL FindRunningServices(void)
+{
+ int i = 0;
+ DWORD dwPid;
+ BOOL rv = FALSE;
+ while (g_stServices[i].szServiceName != NULL)
+ {
+ if (!IsServiceRunning(g_stServices[i].szServiceName,
+ g_stServices[i].szComputerName, &dwPid)) {
+ dwPid = 0;
+ }
+ if (g_stServices[i].dwPid != dwPid) {
+ rv = TRUE;
+ }
+ g_stServices[i].dwPid = dwPid;
+ ++i;
+ }
+ return rv;
+}
+
+
+BOOL GetApacheServicesStatus()
+{
+ TCHAR szKey[MAX_PATH];
+ TCHAR achKey[MAX_PATH];
+ TCHAR szImagePath[MAX_PATH];
+ TCHAR szBuf[MAX_PATH];
+ TCHAR szTmp[MAX_PATH];
+ HKEY hKey, hSubKey, hKeyRemote;
+ DWORD retCode, rv, dwKeyType;
+ DWORD dwBufLen = MAX_PATH;
+ int i, stPos = 0;
+ int computers = 0;
+
+ g_bRescanServices = FALSE;
+
+ am_ClearServicesSt();
+ while (g_stComputers[computers].szComputerName != NULL) {
+ hKeyRemote = g_stComputers[computers].hRegistry;
+ retCode = RegOpenKeyEx(hKeyRemote,
+ _T("System\\CurrentControlSet\\Services\\"),
+ 0, KEY_READ, &hKey);
+ if (retCode != ERROR_SUCCESS)
+ {
+ ErrorMessage(NULL, FALSE);
+ return FALSE;
+ }
+ for (i = 0, retCode = ERROR_SUCCESS; retCode == ERROR_SUCCESS; i++)
+ {
+ retCode = RegEnumKey(hKey, i, achKey, MAX_PATH);
+ if (retCode == ERROR_SUCCESS)
+ {
+ _tcscpy(szKey, _T("System\\CurrentControlSet\\Services\\"));
+ _tcscat(szKey, achKey);
+
+ if (RegOpenKeyEx(hKeyRemote, szKey, 0,
+ KEY_QUERY_VALUE, &hSubKey) == ERROR_SUCCESS)
+ {
+ dwBufLen = MAX_PATH;
+ rv = RegQueryValueEx(hSubKey, _T("ImagePath"), NULL,
+ &dwKeyType, (LPBYTE)szImagePath, &dwBufLen);
+
+ if (rv == ERROR_SUCCESS
+ && (dwKeyType == REG_SZ
+ || dwKeyType == REG_EXPAND_SZ)
+ && dwBufLen)
+ {
+ _tcscpy(szBuf, szImagePath);
+ CharLower(szBuf);
+ /* the service name could be httpd*.exe or Apache*.exe */
+ if (((_tcsstr(szBuf, _T("\\apache")) != NULL)
+ || (_tcsstr(szBuf, _T("\\httpd")) != NULL))
+ && _tcsstr(szBuf, _T(".exe"))
+ && (_tcsstr(szBuf, _T("--ntservice")) != NULL
+ || _tcsstr(szBuf, _T("-k ")) != NULL))
+ {
+ g_stServices[stPos].szServiceName = _tcsdup(achKey);
+ g_stServices[stPos].szImagePath = _tcsdup(szImagePath);
+ g_stServices[stPos].szComputerName =
+ _tcsdup(g_stComputers[computers].szComputerName);
+ dwBufLen = MAX_PATH;
+ if (RegQueryValueEx(hSubKey, _T("Description"), NULL,
+ &dwKeyType, (LPBYTE)szBuf, &dwBufLen)
+ == ERROR_SUCCESS) {
+ g_stServices[stPos].szDescription = _tcsdup(szBuf);
+ }
+ dwBufLen = MAX_PATH;
+ if (RegQueryValueEx(hSubKey, _T("DisplayName"), NULL,
+ &dwKeyType, (LPBYTE)szBuf, &dwBufLen)
+ == ERROR_SUCCESS)
+ {
+ if (_tcscmp(g_stComputers[computers]
+ .szComputerName, g_szLocalHost) != 0)
+ {
+ _tcscpy(szTmp, g_stComputers[computers]
+ .szComputerName + 2);
+ _tcscat(szTmp, _T("@"));
+ _tcscat(szTmp, szBuf);
+ }
+ else {
+ _tcscpy(szTmp, szBuf);
+ }
+ g_stServices[stPos].szDisplayName = _tcsdup(szTmp);
+
+ }
+ ++stPos;
+ if (stPos >= MAX_APACHE_SERVICES) {
+ retCode = !ERROR_SUCCESS;
+ }
+ }
+ }
+ RegCloseKey(hSubKey);
+ }
+ }
+ }
+ ++computers;
+ RegCloseKey(hKey);
+ }
+ FindRunningServices();
+ return TRUE;
+}
+
+
+LRESULT CALLBACK ConnectDlgProc(HWND hDlg, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ TCHAR szCmp[MAX_COMPUTERNAME_LENGTH+4];
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ ShowWindow(hDlg, SW_HIDE);
+ g_hwndConnectDlg = hDlg;
+ CenterWindow(hDlg);
+ ShowWindow(hDlg, SW_SHOW);
+ SetFocus(GetDlgItem(hDlg, IDC_COMPUTER));
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
+ memset(szCmp, 0, sizeof(szCmp));
+ _tcscpy(szCmp, _T("\\\\"));
+ SendMessage(GetDlgItem(hDlg, IDC_COMPUTER), WM_GETTEXT,
+ (WPARAM) MAX_COMPUTERNAME_LENGTH,
+ (LPARAM) szCmp+2);
+
+ _tcsupr(szCmp);
+ if (_tcslen(szCmp) < 3) {
+ EndDialog(hDlg, TRUE);
+ return TRUE;
+ }
+ am_ConnectComputer(szCmp);
+ SendMessage(g_hwndMain, WM_TIMER, WM_TIMER_RESCAN, 0);
+
+ case IDCANCEL:
+ EndDialog(hDlg, TRUE);
+ return TRUE;
+
+ case IDC_LBROWSE:
+ {
+ BROWSEINFO bi;
+ ITEMIDLIST *il;
+ LPMALLOC pMalloc;
+ memset(&bi, 0, sizeof(BROWSEINFO));
+ SHGetSpecialFolderLocation(hDlg, CSIDL_NETWORK, &il);
+
+ bi.lpszTitle = _T("ApacheMonitor :\nSelect Network Computer!");
+ bi.pszDisplayName = szCmp;
+ bi.hwndOwner = hDlg;
+ bi.ulFlags = BIF_BROWSEFORCOMPUTER;
+ bi.lpfn = NULL;
+ bi.lParam = 0;
+ bi.iImage = 0;
+ bi.pidlRoot = il;
+
+ if (SHBrowseForFolder(&bi) != NULL) {
+ SendMessage(GetDlgItem(hDlg, IDC_COMPUTER),
+ WM_SETTEXT,
+ (WPARAM) NULL, (LPARAM) szCmp);
+ }
+ if (SUCCEEDED(SHGetMalloc(&pMalloc))) {
+ pMalloc->lpVtbl->Free(pMalloc, il);
+ pMalloc->lpVtbl->Release(pMalloc);
+ }
+ return TRUE;
+ }
+ }
+ break;
+
+ case WM_QUIT:
+ case WM_CLOSE:
+ EndDialog(hDlg, TRUE);
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ return FALSE;
+
+}
+
+
+LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ TCHAR szBuf[MAX_PATH];
+ HWND hListBox;
+ static HWND hStatusBar;
+ TEXTMETRIC tm;
+ int i, y;
+ HDC hdcMem;
+ RECT rcBitmap;
+ LRESULT nItem;
+ LPMEASUREITEMSTRUCT lpmis;
+ LPDRAWITEMSTRUCT lpdis;
+
+ memset(szBuf, 0, sizeof(szBuf));
+ switch (message)
+ {
+ case WM_INITDIALOG:
+ ShowWindow(hDlg, SW_HIDE);
+ g_hwndServiceDlg = hDlg;
+ SetWindowText(hDlg, g_szTitle);
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SDISCONN), FALSE);
+ SetWindowText(GetDlgItem(hDlg, IDC_SSTART),
+ g_lpMsg[IDS_MSG_SSTART - IDS_MSG_FIRST]);
+ SetWindowText(GetDlgItem(hDlg, IDC_SSTOP),
+ g_lpMsg[IDS_MSG_SSTOP - IDS_MSG_FIRST]);
+ SetWindowText(GetDlgItem(hDlg, IDC_SRESTART),
+ g_lpMsg[IDS_MSG_SRESTART - IDS_MSG_FIRST]);
+ SetWindowText(GetDlgItem(hDlg, IDC_SMANAGER),
+ g_lpMsg[IDS_MSG_SERVICES - IDS_MSG_FIRST]);
+ SetWindowText(GetDlgItem(hDlg, IDC_SCONNECT),
+ g_lpMsg[IDS_MSG_CONNECT - IDS_MSG_FIRST]);
+ SetWindowText(GetDlgItem(hDlg, IDCANCEL),
+ g_lpMsg[IDS_MSG_OK - IDS_MSG_FIRST]);
+ hListBox = GetDlgItem(hDlg, IDL_SERVICES);
+ g_hwndStdoutList = GetDlgItem(hDlg, IDL_STDOUT);
+ hStatusBar = CreateStatusWindow(0x0800 /* SBT_TOOLTIPS */
+ | WS_CHILD | WS_VISIBLE,
+ _T(""), hDlg, IDC_STATBAR);
+ if (GetApacheServicesStatus())
+ {
+ i = 0;
+ while (g_stServices[i].szServiceName != NULL)
+ {
+ addListBoxItem(hListBox, g_stServices[i].szDisplayName,
+ g_stServices[i].dwPid == 0 ? g_hBmpStop
+ : g_hBmpStart);
+ ++i;
+ }
+ }
+ CenterWindow(hDlg);
+ ShowWindow(hDlg, SW_SHOW);
+ SetFocus(hListBox);
+ SendMessage(hListBox, LB_SETCURSEL, 0, 0);
+ return TRUE;
+ break;
+
+ case WM_MANAGEMESSAGE:
+ ApacheManageService(g_stServices[LOWORD(wParam)].szServiceName,
+ g_stServices[LOWORD(wParam)].szImagePath,
+ g_stServices[LOWORD(wParam)].szComputerName,
+ LOWORD(lParam));
+
+ return TRUE;
+ break;
+
+ case WM_UPDATEMESSAGE:
+ hListBox = GetDlgItem(hDlg, IDL_SERVICES);
+ SendMessage(hListBox, LB_RESETCONTENT, 0, 0);
+ SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)_T(""));
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SDISCONN), FALSE);
+ i = 0;
+ while (g_stServices[i].szServiceName != NULL)
+ {
+ addListBoxItem(hListBox, g_stServices[i].szDisplayName,
+ g_stServices[i].dwPid == 0 ? g_hBmpStop : g_hBmpStart);
+ ++i;
+ }
+ SendMessage(hListBox, LB_SETCURSEL, 0, 0);
+ /* Dirty hack to bring the window to the foreground */
+ SetWindowPos(hDlg, HWND_TOPMOST, 0, 0, 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
+ SetWindowPos(hDlg, HWND_NOTOPMOST, 0, 0, 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
+ SetFocus(hListBox);
+ return TRUE;
+ break;
+
+ case WM_MEASUREITEM:
+ lpmis = (LPMEASUREITEMSTRUCT) lParam;
+ lpmis->itemHeight = YBITMAP;
+ return TRUE;
+
+ case WM_SETCURSOR:
+ if (g_bConsoleRun) {
+ SetCursor(g_hCursorHourglass);
+ }
+ else {
+ SetCursor(g_hCursorArrow);
+ }
+ return TRUE;
+
+ case WM_DRAWITEM:
+ lpdis = (LPDRAWITEMSTRUCT) lParam;
+ if (lpdis->itemID == -1) {
+ break;
+ }
+ switch (lpdis->itemAction)
+ {
+ case ODA_FOCUS:
+ case ODA_SELECT:
+ case ODA_DRAWENTIRE:
+ g_hBmpPicture = (HBITMAP)SendMessage(lpdis->hwndItem,
+ LB_GETITEMDATA,
+ lpdis->itemID, (LPARAM) 0);
+
+ hdcMem = CreateCompatibleDC(lpdis->hDC);
+ g_hBmpOld = SelectObject(hdcMem, g_hBmpPicture);
+
+ BitBlt(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top,
+ lpdis->rcItem.right - lpdis->rcItem.left,
+ lpdis->rcItem.bottom - lpdis->rcItem.top,
+ hdcMem, 0, 0, SRCCOPY);
+ SendMessage(lpdis->hwndItem, LB_GETTEXT,
+ lpdis->itemID, (LPARAM) szBuf);
+
+ GetTextMetrics(lpdis->hDC, &tm);
+ y = (lpdis->rcItem.bottom + lpdis->rcItem.top - tm.tmHeight) / 2;
+
+ SelectObject(hdcMem, g_hBmpOld);
+ DeleteDC(hdcMem);
+
+ rcBitmap.left = lpdis->rcItem.left + XBITMAP + 2;
+ rcBitmap.top = lpdis->rcItem.top;
+ rcBitmap.right = lpdis->rcItem.right;
+ rcBitmap.bottom = lpdis->rcItem.top + YBITMAP;
+
+ if (lpdis->itemState & ODS_SELECTED)
+ {
+ if (g_hBmpPicture == g_hBmpStop)
+ {
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTART), TRUE);
+ Button_SetStyle(GetDlgItem(hDlg, IDC_SSTART), BS_DEFPUSHBUTTON, TRUE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
+ }
+ else if (g_hBmpPicture == g_hBmpStart)
+ {
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), TRUE);
+ Button_SetStyle(GetDlgItem(hDlg, IDC_SSTOP), BS_DEFPUSHBUTTON, TRUE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), TRUE);
+ }
+ else {
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
+ Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
+ }
+ if (_tcscmp(g_stServices[lpdis->itemID].szComputerName,
+ g_szLocalHost) == 0) {
+ Button_Enable(GetDlgItem(hDlg, IDC_SDISCONN), FALSE);
+ }
+ else {
+ Button_Enable(GetDlgItem(hDlg, IDC_SDISCONN), TRUE);
+ }
+
+ if (g_stServices[lpdis->itemID].szDescription) {
+ SendMessage(hStatusBar, SB_SETTEXT, 0,
+ (LPARAM)g_stServices[lpdis->itemID].szDescription);
+ }
+ else {
+ SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)_T(""));
+ }
+ if (lpdis->itemState & ODS_FOCUS) {
+ SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
+ SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT));
+ FillRect(lpdis->hDC, &rcBitmap, (HBRUSH)(COLOR_HIGHLIGHT+1));
+ }
+ else {
+ SetTextColor(lpdis->hDC, GetSysColor(COLOR_INACTIVECAPTIONTEXT));
+ SetBkColor(lpdis->hDC, GetSysColor(COLOR_INACTIVECAPTION));
+ FillRect(lpdis->hDC, &rcBitmap, (HBRUSH)(COLOR_INACTIVECAPTION+1));
+ }
+ }
+ else
+ {
+ SetTextColor(lpdis->hDC, GetSysColor(COLOR_MENUTEXT));
+ SetBkColor(lpdis->hDC, GetSysColor(COLOR_WINDOW));
+ FillRect(lpdis->hDC, &rcBitmap, (HBRUSH)(COLOR_WINDOW+1));
+ }
+ TextOut(lpdis->hDC, XBITMAP + 6, y, szBuf, (int)_tcslen(szBuf));
+ break;
+ }
+ return TRUE;
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDL_SERVICES:
+ switch (HIWORD(wParam))
+ {
+ case LBN_DBLCLK:
+ /* if started then stop, if stopped then start */
+ hListBox = GetDlgItem(hDlg, IDL_SERVICES);
+ nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0);
+ if (nItem != LB_ERR)
+ {
+ g_hBmpPicture = (HBITMAP)SendMessage(hListBox,
+ LB_GETITEMDATA,
+ nItem, (LPARAM) 0);
+ if (g_hBmpPicture == g_hBmpStop) {
+ SendMessage(hDlg, WM_MANAGEMESSAGE, nItem,
+ SERVICE_CONTROL_CONTINUE);
+ }
+ else {
+ SendMessage(hDlg, WM_MANAGEMESSAGE, nItem,
+ SERVICE_CONTROL_STOP);
+ }
+
+ }
+ return TRUE;
+ }
+ break;
+
+ case IDCANCEL:
+ EndDialog(hDlg, TRUE);
+ return TRUE;
+
+ case IDC_SSTART:
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE);
+ hListBox = GetDlgItem(hDlg, IDL_SERVICES);
+ nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0);
+ if (nItem != LB_ERR) {
+ SendMessage(hDlg, WM_MANAGEMESSAGE, nItem,
+ SERVICE_CONTROL_CONTINUE);
+ }
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTART), TRUE);
+ return TRUE;
+
+ case IDC_SSTOP:
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE);
+ hListBox = GetDlgItem(hDlg, IDL_SERVICES);
+ nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0);
+ if (nItem != LB_ERR) {
+ SendMessage(hDlg, WM_MANAGEMESSAGE, nItem,
+ SERVICE_CONTROL_STOP);
+ }
+ Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), TRUE);
+ return TRUE;
+
+ case IDC_SRESTART:
+ Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE);
+ hListBox = GetDlgItem(hDlg, IDL_SERVICES);
+ nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0);
+ if (nItem != LB_ERR) {
+ SendMessage(hDlg, WM_MANAGEMESSAGE, nItem,
+ SERVICE_APACHE_RESTART);
+ }
+ Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), TRUE);
+ return TRUE;
+
+ case IDC_SMANAGER:
+ if (g_dwOSVersion >= OS_VERSION_WIN2K) {
+ ShellExecute(hDlg, _T("open"), _T("services.msc"), _T("/s"),
+ NULL, SW_NORMAL);
+ }
+ else {
+ WinExec("Control.exe SrvMgr.cpl Services", SW_NORMAL);
+ }
+ return TRUE;
+
+ case IDC_SCONNECT:
+ DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DLGCONNECT),
+ hDlg, (DLGPROC)ConnectDlgProc);
+ return TRUE;
+
+ case IDC_SDISCONN:
+ hListBox = GetDlgItem(hDlg, IDL_SERVICES);
+ nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0);
+ if (nItem != LB_ERR) {
+ am_DisconnectComputer(g_stServices[nItem].szComputerName);
+ SendMessage(g_hwndMain, WM_TIMER, WM_TIMER_RESCAN, 0);
+ }
+ return TRUE;
+ }
+ break;
+
+ case WM_SIZE:
+ switch (LOWORD(wParam))
+ {
+ case SIZE_MINIMIZED:
+ EndDialog(hDlg, TRUE);
+ return TRUE;
+ break;
+ }
+ break;
+
+ case WM_QUIT:
+ case WM_CLOSE:
+ EndDialog(hDlg, TRUE);
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+ return FALSE;
+}
+
+
+LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ if (message == g_bUiTaskbarCreated)
+ {
+ /* restore the tray icon on shell restart */
+ ShowNotifyIcon(hWnd, NIM_ADD);
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+ switch (message)
+ {
+ case WM_CREATE:
+ GetApacheServicesStatus();
+ ShowNotifyIcon(hWnd, NIM_ADD);
+ SetTimer(hWnd, WM_TIMER_REFRESH, REFRESH_TIME, NULL);
+ SetTimer(hWnd, WM_TIMER_RESCAN, RESCAN_TIME, NULL);
+ break;
+
+ case WM_TIMER:
+ switch (wParam)
+ {
+ case WM_TIMER_RESCAN:
+ {
+ int nPrev = 0, nNew = 0;
+ EnterCriticalSection(&g_stcSection);
+ if (FindRunningServices() || g_bRescanServices)
+ {
+ ShowNotifyIcon(hWnd, NIM_MODIFY);
+ if (g_hwndServiceDlg)
+ PostMessage(g_hwndServiceDlg, WM_UPDATEMESSAGE, 0, 0);
+ }
+ /* check if services list changed */
+ while (g_stServices[nPrev].szServiceName != NULL)
+ ++nPrev;
+ GetApacheServicesStatus();
+ while (g_stServices[nNew].szServiceName != NULL)
+ ++nNew;
+ if (nPrev != nNew)
+ {
+ ShowNotifyIcon(hWnd, NIM_MODIFY);
+ if (g_hwndServiceDlg) {
+ PostMessage(g_hwndServiceDlg, WM_UPDATEMESSAGE, 0, 0);
+ }
+ }
+ LeaveCriticalSection(&g_stcSection);
+ break;
+ }
+
+ case WM_TIMER_REFRESH:
+ {
+ EnterCriticalSection(&g_stcSection);
+ if (g_bRescanServices)
+ {
+ GetApacheServicesStatus();
+ ShowNotifyIcon(hWnd, NIM_MODIFY);
+ if (g_hwndServiceDlg) {
+ PostMessage(g_hwndServiceDlg, WM_UPDATEMESSAGE, 0, 0);
+ }
+ }
+ else if (FindRunningServices())
+ {
+ ShowNotifyIcon(hWnd, NIM_MODIFY);
+ if (g_hwndServiceDlg) {
+ PostMessage(g_hwndServiceDlg, WM_UPDATEMESSAGE, 0, 0);
+ }
+ }
+ LeaveCriticalSection(&g_stcSection);
+ break;
+ }
+ }
+ break;
+
+ case WM_QUIT:
+ ShowNotifyIcon(hWnd, NIM_DELETE);
+ break;
+
+ case WM_TRAYMESSAGE:
+ switch (lParam)
+ {
+ case WM_LBUTTONDBLCLK:
+ if (!g_bDlgServiceOn)
+ {
+ g_bDlgServiceOn = TRUE;
+ DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DLGSERVICES),
+ hWnd, (DLGPROC)ServiceDlgProc);
+ g_bDlgServiceOn = FALSE;
+ g_hwndServiceDlg = NULL;
+ }
+ else if (IsWindow(g_hwndServiceDlg))
+ {
+ /* Dirty hack to bring the window to the foreground */
+ SetWindowPos(g_hwndServiceDlg, HWND_TOPMOST, 0, 0, 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
+ SetWindowPos(g_hwndServiceDlg, HWND_NOTOPMOST, 0, 0, 0, 0,
+ SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW);
+ SetFocus(g_hwndServiceDlg);
+ }
+ break;
+
+ case WM_LBUTTONUP:
+ ShowTryServicesMenu(hWnd);
+ break;
+
+ case WM_RBUTTONUP:
+ ShowTryPopupMenu(hWnd);
+ break;
+ }
+ break;
+
+ case WM_COMMAND:
+ if ((LOWORD(wParam) & IDM_SM_START) == IDM_SM_START)
+ {
+ ApacheManageService(g_stServices[LOWORD(wParam)
+ - IDM_SM_START].szServiceName,
+ g_stServices[LOWORD(wParam)
+ - IDM_SM_START].szImagePath,
+ g_stServices[LOWORD(wParam)
+ - IDM_SM_START].szComputerName,
+ SERVICE_CONTROL_CONTINUE);
+ return TRUE;
+ }
+ else if ((LOWORD(wParam) & IDM_SM_STOP) == IDM_SM_STOP)
+ {
+ ApacheManageService(g_stServices[LOWORD(wParam)
+ - IDM_SM_STOP].szServiceName,
+ g_stServices[LOWORD(wParam)
+ - IDM_SM_STOP].szImagePath,
+ g_stServices[LOWORD(wParam)
+ - IDM_SM_STOP].szComputerName,
+ SERVICE_CONTROL_STOP);
+ return TRUE;
+ }
+ else if ((LOWORD(wParam) & IDM_SM_RESTART) == IDM_SM_RESTART)
+ {
+ ApacheManageService(g_stServices[LOWORD(wParam)
+ - IDM_SM_RESTART].szServiceName,
+ g_stServices[LOWORD(wParam)
+ - IDM_SM_RESTART].szImagePath,
+ g_stServices[LOWORD(wParam)
+ - IDM_SM_RESTART].szComputerName,
+ SERVICE_APACHE_RESTART);
+ return TRUE;
+ }
+ switch (LOWORD(wParam))
+ {
+ case IDM_RESTORE:
+ if (!g_bDlgServiceOn)
+ {
+ g_bDlgServiceOn = TRUE;
+ DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DLGSERVICES),
+ hWnd, (DLGPROC)ServiceDlgProc);
+ g_bDlgServiceOn = FALSE;
+ g_hwndServiceDlg = NULL;
+ }
+ else if (IsWindow(g_hwndServiceDlg)) {
+ SetFocus(g_hwndServiceDlg);
+ }
+ break;
+
+ case IDC_SMANAGER:
+ if (g_dwOSVersion >= OS_VERSION_WIN2K) {
+ ShellExecute(NULL, _T("open"), _T("services.msc"), _T("/s"),
+ NULL, SW_NORMAL);
+ }
+ else {
+ WinExec("Control.exe SrvMgr.cpl Services", SW_NORMAL);
+ }
+ return TRUE;
+
+ case IDM_EXIT:
+ ShowNotifyIcon(hWnd, NIM_DELETE);
+ PostQuitMessage(0);
+ return TRUE;
+ }
+
+ default:
+ return DefWindowProc(hWnd, message, wParam, lParam);
+ }
+
+ return FALSE;
+}
+
+
+static int KillAWindow(HWND appwindow)
+{
+ HANDLE appproc;
+ DWORD procid;
+ BOOL postres;
+
+ SetLastError(0);
+ GetWindowThreadProcessId(appwindow, &procid);
+ if (GetLastError())
+ return(2);
+
+ appproc = OpenProcess(SYNCHRONIZE, 0, procid);
+ postres = PostMessage(appwindow, WM_COMMAND, IDM_EXIT, 0);
+ if (appproc && postres) {
+ if (WaitForSingleObject(appproc, 10 /* seconds */ * 1000)
+ == WAIT_OBJECT_0) {
+ CloseHandle(appproc);
+ return (0);
+ }
+ }
+ if (appproc)
+ CloseHandle(appproc);
+
+ if ((appproc = OpenProcess(PROCESS_TERMINATE, 0, procid)) != NULL) {
+ if (TerminateProcess(appproc, 0)) {
+ CloseHandle(appproc);
+ return (0);
+ }
+ CloseHandle(appproc);
+ }
+
+ /* Perhaps we were short of permissions? */
+ return (2);
+}
+
+
+static int KillAllMonitors(void)
+{
+ HWND appwindow;
+ int exitcode = 0;
+ PWTS_PROCESS_INFO tsProcs;
+ DWORD tsProcCount, i;
+ DWORD thisProcId;
+
+ /* This is graceful, close our own Window, clearing the icon */
+ if ((appwindow = FindWindow(g_szWindowClass, g_szTitle)) != NULL)
+ exitcode = KillAWindow(appwindow);
+
+ if (g_dwOSVersion < OS_VERSION_WIN2K)
+ return exitcode;
+
+ thisProcId = GetCurrentProcessId();
+
+ if (!WTSEnumerateProcesses(WTS_CURRENT_SERVER_HANDLE, 0, 1,
+ &tsProcs, &tsProcCount))
+ return exitcode;
+
+ /* This is ungraceful; close other Windows, with a lingering icon.
+ * Since on terminal server it's not possible to post the message
+ * to exit across sessions, we have to suffer this side effect
+ * of a taskbar 'icon' which will evaporate the next time that
+ * the user hovers over it or when the taskbar area is updated.
+ */
+ for (i = 0; i < tsProcCount; ++i) {
+ if (_tcscmp(tsProcs[i].pProcessName, _T(AM_STRINGIFY(BIN_NAME))) == 0
+ && tsProcs[i].ProcessId != thisProcId)
+ WTSTerminateProcess(WTS_CURRENT_SERVER_HANDLE,
+ tsProcs[i].ProcessId, 1);
+ }
+ WTSFreeMemory(tsProcs);
+ return exitcode;
+}
+
+
+/* Create main invisible window */
+HWND CreateMainWindow(HINSTANCE hInstance)
+{
+ HWND hWnd = NULL;
+ WNDCLASSEX wcex;
+
+ wcex.cbSize = sizeof(WNDCLASSEX);
+
+ wcex.style = CS_HREDRAW | CS_VREDRAW;
+ wcex.lpfnWndProc = (WNDPROC)WndProc;
+ wcex.cbClsExtra = 0;
+ wcex.cbWndExtra = 0;
+ wcex.hInstance = hInstance;
+ wcex.hIcon = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_APSRVMON),
+ IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR);
+ wcex.hCursor = g_hCursorArrow;
+ wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
+ wcex.lpszMenuName = 0;
+ wcex.lpszClassName = g_szWindowClass;
+ wcex.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_APSRVMON),
+ IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+
+ if (RegisterClassEx(&wcex)) {
+ hWnd = CreateWindow(g_szWindowClass, g_szTitle,
+ 0, 0, 0, 0, 0,
+ NULL, NULL, hInstance, NULL);
+ }
+ return hWnd;
+}
+
+
+#ifndef UNICODE
+/* Borrowed from CRT internal.h for _MBCS argc/argv parsing in this GUI app */
+int __cdecl _setargv(void);
+#endif
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ LPSTR lpCmdLine, int nCmdShow)
+{
+ TCHAR szTmp[MAX_LOADSTRING];
+ TCHAR szCmp[MAX_COMPUTERNAME_LENGTH+4];
+ MSG msg;
+ /* existing window */
+ HWND appwindow;
+ DWORD dwControl;
+ int i;
+ DWORD d;
+
+ if (!GetSystemOSVersion(&g_dwOSVersion))
+ {
+ ErrorMessage(NULL, TRUE);
+ return 1;
+ }
+
+ g_LangID = GetUserDefaultLangID();
+ if ((g_LangID & 0xFF) != LANG_ENGLISH) {
+ g_LangID = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL);
+ }
+ for (i = IDS_MSG_FIRST; i <= IDS_MSG_LAST; ++i) {
+ LoadString(hInstance, i, szTmp, MAX_LOADSTRING);
+ g_lpMsg[i - IDS_MSG_FIRST] = _tcsdup(szTmp);
+ }
+ LoadString(hInstance, IDS_APMONITORTITLE, szTmp, MAX_LOADSTRING);
+ d = MAX_COMPUTERNAME_LENGTH+1;
+ _tcscpy(szCmp, _T("\\\\"));
+ GetComputerName(szCmp + 2, &d);
+ _tcsupr(szCmp);
+ g_szLocalHost = _tcsdup(szCmp);
+
+ memset(g_stComputers, 0, sizeof(ST_MONITORED_COMP) * MAX_APACHE_COMPUTERS);
+ g_stComputers[0].szComputerName = _tcsdup(szCmp);
+ g_stComputers[0].hRegistry = HKEY_LOCAL_MACHINE;
+ g_szTitle = _tcsdup(szTmp);
+ LoadString(hInstance, IDS_APMONITORCLASS, szTmp, MAX_LOADSTRING);
+ g_szWindowClass = _tcsdup(szTmp);
+
+ appwindow = FindWindow(g_szWindowClass, g_szTitle);
+
+#ifdef UNICODE
+ __wargv = CommandLineToArgvW(GetCommandLineW(), &__argc);
+#else
+#if defined(_MSC_VER) && _MSC_VER < 1800
+ _setargv();
+#endif
+#endif
+
+ if ((__argc == 2) && (_tcscmp(__targv[1], _T("--kill")) == 0))
+ {
+ /* Off to chase and close up every ApacheMonitor taskbar window */
+ return KillAllMonitors();
+ }
+ else if ((__argc == 4) && (g_dwOSVersion >= OS_VERSION_WIN2K))
+ {
+ dwControl = _ttoi(__targv[1]);
+ if ((dwControl != SERVICE_CONTROL_CONTINUE) &&
+ (dwControl != SERVICE_APACHE_RESTART) &&
+ (dwControl != SERVICE_CONTROL_STOP))
+ {
+ return 1;
+ }
+
+ /* Chase down and close up our session's previous window */
+ if ((appwindow) != NULL)
+ KillAWindow(appwindow);
+ }
+ else if (__argc != 1) {
+ return 1;
+ }
+ else if (appwindow)
+ {
+ ErrorMessage(g_lpMsg[IDS_MSG_APPRUNNING - IDS_MSG_FIRST], FALSE);
+ return 0;
+ }
+
+ g_icoStop = LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICOSTOP),
+ IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+ g_icoRun = LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICORUN),
+ IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+ g_hCursorHourglass = LoadImage(NULL, MAKEINTRESOURCE(OCR_WAIT),
+ IMAGE_CURSOR, LR_DEFAULTSIZE,
+ LR_DEFAULTSIZE, LR_SHARED);
+ g_hCursorArrow = LoadImage(NULL, MAKEINTRESOURCE(OCR_NORMAL),
+ IMAGE_CURSOR, LR_DEFAULTSIZE,
+ LR_DEFAULTSIZE, LR_SHARED);
+ g_hBmpStart = LoadImage(hInstance, MAKEINTRESOURCE(IDB_BMPRUN),
+ IMAGE_BITMAP, XBITMAP, YBITMAP,
+ LR_DEFAULTCOLOR);
+ g_hBmpStop = LoadImage(hInstance, MAKEINTRESOURCE(IDB_BMPSTOP),
+ IMAGE_BITMAP, XBITMAP, YBITMAP,
+ LR_DEFAULTCOLOR);
+
+ memset(g_stServices, 0, sizeof(ST_APACHE_SERVICE) * MAX_APACHE_SERVICES);
+ CoInitialize(NULL);
+ InitCommonControls();
+ g_hInstance = hInstance;
+ g_hwndMain = CreateMainWindow(hInstance);
+ g_bUiTaskbarCreated = RegisterWindowMessage(_T("TaskbarCreated"));
+ InitializeCriticalSection(&g_stcSection);
+ g_hwndServiceDlg = NULL;
+ if (g_hwndMain != NULL)
+ {
+ /* To avoid recursion, pass ImagePath NULL (a noop on NT and later) */
+ if ((__argc == 4) && (g_dwOSVersion >= OS_VERSION_WIN2K))
+ ApacheManageService(__targv[2], NULL, __targv[3], dwControl);
+
+ while (GetMessage(&msg, NULL, 0, 0) == TRUE)
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ am_ClearServicesSt();
+ }
+ am_ClearComputersSt();
+ DeleteCriticalSection(&g_stcSection);
+ DestroyIcon(g_icoStop);
+ DestroyIcon(g_icoRun);
+ DestroyCursor(g_hCursorHourglass);
+ DestroyCursor(g_hCursorArrow);
+ DeleteObject(g_hBmpStart);
+ DeleteObject(g_hBmpStop);
+ CoUninitialize();
+ return 0;
+}
+
diff --git a/support/win32/ApacheMonitor.dep b/support/win32/ApacheMonitor.dep
new file mode 100644
index 0000000..d0eac54
--- /dev/null
+++ b/support/win32/ApacheMonitor.dep
@@ -0,0 +1,18 @@
+# Microsoft Developer Studio Generated Dependency File, included by ApacheMonitor.mak
+
+.\ApacheMonitor.c : \
+ ".\ApacheMonitor.h"\
+
+
+.\ApacheMonitor.rc : \
+ "..\..\build\win32\httpd.rc"\
+ "..\..\include\ap_release.h"\
+ ".\apache_header.bmp"\
+ ".\ApacheMonitor.h"\
+ ".\ApacheMonitor.ico"\
+ ".\ApacheMonitor.manifest"\
+ ".\aprun.ico"\
+ ".\apstop.ico"\
+ ".\srun.bmp"\
+ ".\sstop.bmp"\
+
diff --git a/support/win32/ApacheMonitor.dsp b/support/win32/ApacheMonitor.dsp
new file mode 100644
index 0000000..3465ecd
--- /dev/null
+++ b/support/win32/ApacheMonitor.dsp
@@ -0,0 +1,143 @@
+# Microsoft Developer Studio Project File - Name="ApacheMonitor" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+CFG=ApacheMonitor - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ApacheMonitor.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ApacheMonitor.mak" CFG="ApacheMonitor - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ApacheMonitor - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "ApacheMonitor - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ApacheMonitor - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /EHsc /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# ADD CPP /nologo /MD /W3 /EHsc /O2 /Oy- /Zi /I "../../include" /I "../../srclib/apr/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /Fd"Release/ApacheMonitor_src" /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /i "../../include" /I "../../srclib/apr/include" /d "NDEBUG" /d "APP_FILE"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib wtsapi32.lib /nologo /subsystem:windows
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib wtsapi32.lib /nologo /subsystem:windows /debug /opt:ref
+# Begin Special Build Tool
+TargetPath=.\Release\ApacheMonitor.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).manifest -outputresource:$(TargetPath);1
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /EHsc /Zi /Od /I "../../include" /I "../../srclib/apr/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /Fd"Debug/ApacheMonitor_src" /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /i "../../include" /I "../../srclib/apr/include" /d "_DEBUG" /d "APP_FILE"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib wtsapi32.lib /nologo /subsystem:windows /debug
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib wtsapi32.lib /nologo /subsystem:windows /incremental:no /debug
+# Begin Special Build Tool
+TargetPath=.\Debug\ApacheMonitor.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).manifest -outputresource:$(TargetPath);1
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "ApacheMonitor - Win32 Release"
+# Name "ApacheMonitor - Win32 Debug"
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\apache_header.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ApacheMonitor.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\aprun.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\apstop.ico
+# End Source File
+# Begin Source File
+
+SOURCE=.\srun.bmp
+# End Source File
+# Begin Source File
+
+SOURCE=.\sstop.bmp
+# End Source File
+# End Group
+# Begin Source File
+
+SOURCE=.\ApacheMonitor.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ApacheMonitor.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ApacheMonitor.rc
+# End Source File
+# End Target
+# End Project
diff --git a/support/win32/ApacheMonitor.h b/support/win32/ApacheMonitor.h
new file mode 100644
index 0000000..87109aa
--- /dev/null
+++ b/support/win32/ApacheMonitor.h
@@ -0,0 +1,78 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file ApacheMonitor.h
+ * @brief Resource definitions for ApacheMonitor.rc and ApacheMonitor.c
+ */
+#define BIN_NAME ApacheMonitor.exe
+
+#define IDD_DLGSERVICES 101
+#define IDS_APMONITORTITLE 102
+#define IDS_APMONITORCLASS 103
+#define IDM_RESTORE 104
+#define IDM_EXIT 105
+#define IDI_APSRVMON 106
+#define IDI_ICOSTOP 107
+#define IDI_ICORUN 108
+#define IDC_STATBAR 109
+#define IDC_SSTATUS 110
+#define IDB_BMPSTOP 111
+#define IDB_BMPRUN 112
+#define IDB_BMPHEADER 114
+#define IDL_SERVICES 115
+#define IDL_STDOUT 116
+#define IDC_SSTART 117
+#define IDC_SSTOP 118
+#define IDC_SRESTART 119
+#define IDC_SMANAGER 121
+#define IDD_DLGCONNECT 122
+#define IDC_LREMOTE 123
+#define IDC_LBROWSE 124
+#define IDC_COMPUTER 125
+#define IDC_SCONNECT 126
+#define IDC_SDISCONN 127
+#define IDS_MSG_FIRST 256
+#define IDS_MSG_APPRUNNING 256
+#define IDS_MSG_ERROR 257
+#define IDS_MSG_RUNNINGALL 258
+#define IDS_MSG_RUNNING 259
+#define IDS_MSG_RUNNINGNONE 260
+#define IDS_MSG_NOSERVICES 261
+#define IDS_MSG_MNUSERVICES 262
+#define IDS_MSG_MNUSHOW 263
+#define IDS_MSG_MNUEXIT 264
+#define IDS_MSG_SRVSTART 265
+#define IDS_MSG_SRVSTARTED 266
+#define IDS_MSG_SRVSTOP 267
+#define IDS_MSG_SRVSTOPPED 268
+#define IDS_MSG_SRVRESTART 269
+#define IDS_MSG_SRVRESTARTED 270
+#define IDS_MSG_SRVFAILED 271
+#define IDS_MSG_SSTART 272
+#define IDS_MSG_SSTOP 273
+#define IDS_MSG_SRESTART 274
+#define IDS_MSG_SERVICES 275
+#define IDS_MSG_CONNECT 276
+#define IDS_MSG_ECONNECT 277
+#define IDS_MSG_OK 278
+#define IDS_MSG_LAST 278
+#define IDM_SM_SERVICE 0x1100
+#define IDM_SM_START 0x1200
+#define IDM_SM_STOP 0x1400
+#define IDM_SM_RESTART 0x1800
+#define IDC_STATIC -1
+
diff --git a/support/win32/ApacheMonitor.ico b/support/win32/ApacheMonitor.ico
new file mode 100644
index 0000000..cd28dc5
--- /dev/null
+++ b/support/win32/ApacheMonitor.ico
Binary files differ
diff --git a/support/win32/ApacheMonitor.mak b/support/win32/ApacheMonitor.mak
new file mode 100644
index 0000000..5143155
--- /dev/null
+++ b/support/win32/ApacheMonitor.mak
@@ -0,0 +1,309 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on ApacheMonitor.dsp
+!IF "$(CFG)" == ""
+CFG=ApacheMonitor - Win32 Debug
+!MESSAGE No configuration specified. Defaulting to ApacheMonitor - Win32 Debug.
+!ENDIF
+
+!IF "$(CFG)" != "ApacheMonitor - Win32 Release" && "$(CFG)" != "ApacheMonitor - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ApacheMonitor.mak" CFG="ApacheMonitor - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ApacheMonitor - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "ApacheMonitor - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == "ApacheMonitor - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\ApacheMonitor.exe" "$(DS_POSTBUILD_DEP)"
+
+!ELSE
+
+ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\ApacheMonitor.exe" "$(DS_POSTBUILD_DEP)"
+
+!ENDIF
+
+!IF "$(RECURSE)" == "1"
+CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
+!ELSE
+CLEAN :
+!ENDIF
+ -@erase "$(INTDIR)\ApacheMonitor.obj"
+ -@erase "$(INTDIR)\ApacheMonitor.res"
+ -@erase "$(INTDIR)\ApacheMonitor_src.idb"
+ -@erase "$(INTDIR)\ApacheMonitor_src.pdb"
+ -@erase "$(OUTDIR)\ApacheMonitor.exe"
+ -@erase "$(OUTDIR)\ApacheMonitor.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../../include" /I "../../srclib/apr/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ApacheMonitor_src" /FD /EHsc /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ApacheMonitor.res" /i "../../include" /i "../../srclib/apr/include" /d "NDEBUG" /d "APP_FILE"
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ApacheMonitor.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib wtsapi32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\ApacheMonitor.pdb" /debug /out:"$(OUTDIR)\ApacheMonitor.exe" /opt:ref
+LINK32_OBJS= \
+ "$(INTDIR)\ApacheMonitor.obj" \
+ "$(INTDIR)\ApacheMonitor.res" \
+ "..\..\srclib\apr\LibR\apr-1.lib" \
+ "..\..\srclib\apr-util\LibR\aprutil-1.lib"
+
+"$(OUTDIR)\ApacheMonitor.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\Release\ApacheMonitor.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\ApacheMonitor.exe"
+ if exist .\Release\ApacheMonitor.exe.manifest mt.exe -manifest .\Release\ApacheMonitor.exe.manifest -outputresource:.\Release\ApacheMonitor.exe;1
+ echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\ApacheMonitor.exe" "$(DS_POSTBUILD_DEP)"
+
+!ELSE
+
+ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\ApacheMonitor.exe" "$(DS_POSTBUILD_DEP)"
+
+!ENDIF
+
+!IF "$(RECURSE)" == "1"
+CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
+!ELSE
+CLEAN :
+!ENDIF
+ -@erase "$(INTDIR)\ApacheMonitor.obj"
+ -@erase "$(INTDIR)\ApacheMonitor.res"
+ -@erase "$(INTDIR)\ApacheMonitor_src.idb"
+ -@erase "$(INTDIR)\ApacheMonitor_src.pdb"
+ -@erase "$(OUTDIR)\ApacheMonitor.exe"
+ -@erase "$(OUTDIR)\ApacheMonitor.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MDd /W3 /Gm /Zi /Od /I "../../include" /I "../../srclib/apr/include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\ApacheMonitor_src" /FD /EHsc /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\ApacheMonitor.res" /i "../../include" /i "../../srclib/apr/include" /d "_DEBUG" /d "APP_FILE"
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\ApacheMonitor.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib wtsapi32.lib /nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\ApacheMonitor.pdb" /debug /out:"$(OUTDIR)\ApacheMonitor.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\ApacheMonitor.obj" \
+ "$(INTDIR)\ApacheMonitor.res" \
+ "..\..\srclib\apr\LibD\apr-1.lib" \
+ "..\..\srclib\apr-util\LibD\aprutil-1.lib"
+
+"$(OUTDIR)\ApacheMonitor.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\Debug\ApacheMonitor.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\ApacheMonitor.exe"
+ if exist .\Debug\ApacheMonitor.exe.manifest mt.exe -manifest .\Debug\ApacheMonitor.exe.manifest -outputresource:.\Debug\ApacheMonitor.exe;1
+ echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ENDIF
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("ApacheMonitor.dep")
+!INCLUDE "ApacheMonitor.dep"
+!ELSE
+!MESSAGE Warning: cannot find "ApacheMonitor.dep"
+!ENDIF
+!ENDIF
+
+
+!IF "$(CFG)" == "ApacheMonitor - Win32 Release" || "$(CFG)" == "ApacheMonitor - Win32 Debug"
+
+!IF "$(CFG)" == "ApacheMonitor - Win32 Release"
+
+"apr - Win32 Release" :
+ cd ".\..\..\srclib\apr"
+ $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
+ cd "..\..\support\win32"
+
+"apr - Win32 ReleaseCLEAN" :
+ cd ".\..\..\srclib\apr"
+ $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
+ cd "..\..\support\win32"
+
+!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug"
+
+"apr - Win32 Debug" :
+ cd ".\..\..\srclib\apr"
+ $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
+ cd "..\..\support\win32"
+
+"apr - Win32 DebugCLEAN" :
+ cd ".\..\..\srclib\apr"
+ $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
+ cd "..\..\support\win32"
+
+!ENDIF
+
+!IF "$(CFG)" == "ApacheMonitor - Win32 Release"
+
+"aprutil - Win32 Release" :
+ cd ".\..\..\srclib\apr-util"
+ $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
+ cd "..\..\support\win32"
+
+"aprutil - Win32 ReleaseCLEAN" :
+ cd ".\..\..\srclib\apr-util"
+ $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
+ cd "..\..\support\win32"
+
+!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug"
+
+"aprutil - Win32 Debug" :
+ cd ".\..\..\srclib\apr-util"
+ $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
+ cd "..\..\support\win32"
+
+"aprutil - Win32 DebugCLEAN" :
+ cd ".\..\..\srclib\apr-util"
+ $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
+ cd "..\..\support\win32"
+
+!ENDIF
+
+SOURCE=.\ApacheMonitor.c
+
+"$(INTDIR)\ApacheMonitor.obj" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\ApacheMonitor.rc
+
+"$(INTDIR)\ApacheMonitor.res" : $(SOURCE) "$(INTDIR)"
+ $(RSC) $(RSC_PROJ) $(SOURCE)
+
+
+
+!ENDIF
+
diff --git a/support/win32/ApacheMonitor.manifest b/support/win32/ApacheMonitor.manifest
new file mode 100644
index 0000000..94860b0
--- /dev/null
+++ b/support/win32/ApacheMonitor.manifest
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity version="3.1.0.0" processorArchitecture="*" name="Apache.ApacheMonitor" type="win32" />
+<description>Apache Service Monitor</description>
+<dependency>
+<dependentAssembly>
+<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*" />
+</dependentAssembly>
+</dependency>
+</assembly>
diff --git a/support/win32/ApacheMonitor.rc b/support/win32/ApacheMonitor.rc
new file mode 100644
index 0000000..d4203bf
--- /dev/null
+++ b/support/win32/ApacheMonitor.rc
@@ -0,0 +1,103 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <windows.h>
+
+#include "ApacheMonitor.h"
+
+#define LONG_NAME Apache HTTP Server Monitor
+
+#include "../../build/win32/httpd.rc"
+
+
+IDI_APSRVMON ICON DISCARDABLE "ApacheMonitor.ico"
+IDI_ICOSTOP ICON DISCARDABLE "apstop.ico"
+IDI_ICORUN ICON DISCARDABLE "aprun.ico"
+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "ApacheMonitor.manifest"
+
+IDD_DLGSERVICES DIALOGEX 0, 0, 350, 192
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_MINIMIZEBOX | WS_VISIBLE |
+ WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_CONTROLPARENT
+CAPTION "Apache Service Monitor"
+FONT 8, "MS Sans Serif"
+BEGIN
+ PUSHBUTTON "OK",IDCANCEL,298,161,50,14
+ CONTROL IDB_BMPHEADER,IDC_STATIC,"Static",SS_BITMAP,0,0,349,38
+ LTEXT "Service St&atus :",IDC_SSTATUS,3,40,272,8
+ LISTBOX IDL_SERVICES,2,49,285,73,LBS_OWNERDRAWFIXED |
+ LBS_HASSTRINGS | LBS_USETABSTOPS | LBS_NOINTEGRALHEIGHT |
+ LBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP
+ LISTBOX IDL_STDOUT,2,124,285,51,LBS_NOINTEGRALHEIGHT |
+ LBS_DISABLENOSCROLL | LBS_NOSEL | WS_VSCROLL
+ PUSHBUTTON "&Start",IDC_SSTART,298,49,50,14
+ PUSHBUTTON "S&top",IDC_SSTOP,298,65,50,14
+ PUSHBUTTON "&Restart",IDC_SRESTART,298,81,50,14
+ PUSHBUTTON "Ser&vices",IDC_SMANAGER,298,97,50,14
+ PUSHBUTTON "&Connect",IDC_SCONNECT,298,113,50,14
+ PUSHBUTTON "&Disconnect",IDC_SDISCONN,298,129,50,14
+END
+
+IDD_DLGCONNECT DIALOGEX 0, 0, 240, 54
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | WS_VISIBLE | WS_CLIPCHILDREN |
+ WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_CONTROLPARENT
+CAPTION "Connect To A Remote Computer"
+FONT 8, "MS Sans Serif"
+BEGIN
+ LTEXT "Computer &Name:",IDC_LREMOTE,7,4,155,8
+ EDITTEXT IDC_COMPUTER,7,14,169,14,ES_AUTOHSCROLL
+ DEFPUSHBUTTON "&OK",IDOK,183,14,50,14
+ PUSHBUTTON "&Cancel",IDCANCEL,183,34,50,14
+ PUSHBUTTON "&Browse",IDC_LBROWSE,7,34,50,14
+END
+
+IDB_BMPSTOP BITMAP DISCARDABLE "sstop.bmp"
+IDB_BMPRUN BITMAP DISCARDABLE "srun.bmp"
+IDB_BMPHEADER BITMAP DISCARDABLE "apache_header.bmp"
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_APMONITORTITLE "Apache Service Monitor"
+ IDS_APMONITORCLASS "ApacheServiceMonitorClass"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_MSG_APPRUNNING "Apache monitor is already started"
+ IDS_MSG_ERROR "Error"
+ IDS_MSG_RUNNINGALL "Running all Apache services"
+ IDS_MSG_RUNNING "Running %d of %d Apache services"
+ IDS_MSG_RUNNINGNONE "Running none of %d Apache services"
+ IDS_MSG_NOSERVICES "No services installed"
+ IDS_MSG_MNUSERVICES "Open &Services"
+ IDS_MSG_MNUSHOW "&Open Apache Monitor"
+ IDS_MSG_MNUEXIT "E&xit"
+ IDS_MSG_OK "OK"
+ IDS_MSG_SRVSTART "The %s service is starting."
+ IDS_MSG_SRVSTARTED "The %s service has started."
+ IDS_MSG_SRVSTOP "The %s service is stopping."
+ IDS_MSG_SRVSTOPPED "The %s service has stopped."
+ IDS_MSG_SRVRESTART "The %s service is restarting."
+ IDS_MSG_SRVRESTARTED "The %s service has restarted."
+ IDS_MSG_SRVFAILED "The requested operation has failed!"
+ IDS_MSG_SSTART "&Start"
+ IDS_MSG_SSTOP "S&top"
+ IDS_MSG_SRESTART "&Restart"
+ IDS_MSG_SERVICES "Ser&vices"
+ IDS_MSG_CONNECT "&Connect"
+ IDS_MSG_ECONNECT "Unable to connect to the remote registry on %s"
+END
diff --git a/support/win32/apache_header.bmp b/support/win32/apache_header.bmp
new file mode 100644
index 0000000..7340fac
--- /dev/null
+++ b/support/win32/apache_header.bmp
Binary files differ
diff --git a/support/win32/aprun.ico b/support/win32/aprun.ico
new file mode 100644
index 0000000..dbd5832
--- /dev/null
+++ b/support/win32/aprun.ico
Binary files differ
diff --git a/support/win32/apstop.ico b/support/win32/apstop.ico
new file mode 100644
index 0000000..fba49ad
--- /dev/null
+++ b/support/win32/apstop.ico
Binary files differ
diff --git a/support/win32/srun.bmp b/support/win32/srun.bmp
new file mode 100644
index 0000000..90ecd46
--- /dev/null
+++ b/support/win32/srun.bmp
Binary files differ
diff --git a/support/win32/sstop.bmp b/support/win32/sstop.bmp
new file mode 100644
index 0000000..ba73d87
--- /dev/null
+++ b/support/win32/sstop.bmp
Binary files differ
diff --git a/support/win32/wintty.c b/support/win32/wintty.c
new file mode 100644
index 0000000..684ce5b
--- /dev/null
+++ b/support/win32/wintty.c
@@ -0,0 +1,374 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* --------------------------------------------------------------------
+ *
+ * wintty : a Apache/WinNT support utility for monitoring and
+ * reflecting user feedback from the Apache process via
+ * stdin/stdout, even as running within the service context.
+ *
+ * Originally contributed by William Rowe <wrowe covalent.net>
+ *
+ * Note: this implementation is _very_ experimental, and error handling
+ * is far from complete. Using it as a cgi or pipe process allows the
+ * programmer to discover if facilities such as reliable piped logs
+ * are working as expected, or answer operator prompts that would
+ * otherwise be discarded by the service process.
+ *
+ * Also note the isservice detection semantics, which far exceed any
+ * mechanism we have discovered thus far.
+ *
+ * --------------------------------------------------------------------
+ */
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+#define _CRT_SECURE_NO_DEPRECATE
+#pragma warning(disable: 4996)
+#endif
+
+const char *options =
+"\nwintty: a utility for echoing the stdin stream to a new console window,\n"
+"\teven when invoked from within a service (such as the Apache server.)\n"
+"\tAlso reflects the console input back to the stdout stream, allowing\n"
+"\tthe operator to respond to prompts from the context of a service.\n\n"
+"Syntax: %s [opts] [-t \"Window Title\"]\n\n"
+" opts: -c{haracter} or -l{ine} input\n"
+"\t-q{uiet} or -e{cho} input\n"
+"\t-u{nprocessed} or -p{rocessed} input\n"
+"\t-n{owrap} or -w{rap} output lines\n"
+"\t-f{ormatted} or -r{aw} output lines\n"
+"\t-O{output} [number of seconds]\n"
+"\t-v{erbose} error reporting (for debugging)\n"
+"\t-? for this message\n\n";
+
+BOOL verbose = FALSE;
+
+void printerr(char *fmt, ...)
+{
+ char str[1024];
+ va_list args;
+ if (!verbose)
+ return;
+ va_start(args, fmt);
+ wvsprintf(str, fmt, args);
+ OutputDebugString(str);
+}
+
+DWORD WINAPI feedback(LPVOID args);
+
+typedef struct feedback_args_t {
+ HANDLE in;
+ HANDLE out;
+} feedback_args_t;
+
+int main(int argc, char** argv)
+{
+ char str[1024], *contitle = NULL;
+ HANDLE hproc, thread;
+ HANDLE hwinsta = NULL, hsavewinsta;
+ HANDLE hdesk = NULL, hsavedesk = NULL;
+ HANDLE conin, conout;
+ HANDLE hstdin, hstdout, hstderr, hdup;
+ feedback_args_t feed;
+ DWORD conmode;
+ DWORD newinmode = 0, notinmode = 0;
+ DWORD newoutmode = 0, notoutmode = 0;
+ DWORD tid;
+ DWORD len;
+ DWORD timeout = INFINITE;
+ BOOL isservice = FALSE;
+ char *arg0 = argv[0];
+
+ while (--argc) {
+ ++argv;
+ if (**argv == '/' || **argv == '-') {
+ switch (tolower((*argv)[1])) {
+ case 'c':
+ notinmode |= ENABLE_LINE_INPUT; break;
+ case 'l':
+ newinmode |= ENABLE_LINE_INPUT; break;
+ case 'q':
+ notinmode |= ENABLE_ECHO_INPUT; break;
+ case 'e':
+ newinmode |= ENABLE_ECHO_INPUT; break;
+ case 'u':
+ notinmode |= ENABLE_PROCESSED_INPUT; break;
+ case 'p':
+ newinmode |= ENABLE_PROCESSED_INPUT; break;
+ case 'n':
+ notoutmode |= ENABLE_WRAP_AT_EOL_OUTPUT; break;
+ case 'w':
+ newoutmode |= ENABLE_WRAP_AT_EOL_OUTPUT; break;
+ case 'r':
+ notoutmode |= ENABLE_PROCESSED_OUTPUT; break;
+ case 'f':
+ newoutmode |= ENABLE_PROCESSED_OUTPUT; break;
+ case 'o':
+ if (*(argv + 1) && *(argv + 1)[0] != '-') {
+ *(++argv);
+ timeout = atoi(*argv) / 1000;
+ --argc;
+ }
+ else {
+ timeout = 0;
+ }
+ break;
+ case 'v':
+ verbose = TRUE;
+ break;
+ case 't':
+ contitle = *(++argv);
+ --argc;
+ break;
+ case '?':
+ printf(options, arg0);
+ exit(1);
+ default:
+ printf("wintty option %s not recognized, use -? for help.\n\n", *argv);
+ exit(1);
+ }
+ }
+ else {
+ printf("wintty argument %s not understood, use -? for help.\n\n", *argv);
+ exit(1);
+ }
+ }
+
+ hproc = GetCurrentProcess();
+ hsavewinsta = GetProcessWindowStation();
+ if (!hsavewinsta || hsavewinsta == INVALID_HANDLE_VALUE) {
+ printerr("GetProcessWindowStation() failed (%d)\n", GetLastError());
+ }
+ else if (!GetUserObjectInformation(hsavewinsta, UOI_NAME, str, sizeof(str), &len)) {
+ printerr("GetUserObjectInfoformation(hWinSta) failed (%d)\n", GetLastError());
+ }
+ else if (strnicmp(str, "Service-", 8) == 0) {
+ printerr("WindowStation Name %s is a service\n", str);
+ isservice = TRUE;
+ }
+ SetLastError(0);
+
+ hstdin = GetStdHandle(STD_INPUT_HANDLE);
+ if (!hstdin || hstdin == INVALID_HANDLE_VALUE) {
+ printerr("GetStdHandle(STD_INPUT_HANDLE) failed (%d)\n",
+ GetLastError());
+ }
+ else if (DuplicateHandle(hproc, hstdin, hproc, &hdup, 0,
+ isservice, DUPLICATE_SAME_ACCESS)) {
+ CloseHandle(hstdin);
+ hstdin = hdup;
+ }
+ else {
+ printerr("DupHandle(stdin [%x]) failed (%d)\n",
+ hstdin, GetLastError());
+ }
+
+ hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (!hstdout || hstdout == INVALID_HANDLE_VALUE) {
+ printerr("GetStdHandle(STD_OUTPUT_HANDLE) failed (%d)\n",
+ GetLastError());
+ }
+ else if (DuplicateHandle(hproc, hstdout, hproc, &hdup, 0,
+ isservice, DUPLICATE_SAME_ACCESS)) {
+ CloseHandle(hstdout);
+ hstdout = hdup;
+ }
+ else {
+ printerr("DupHandle(stdout [%x]) failed (%d)\n",
+ hstdout, GetLastError());
+ }
+
+ hstderr = GetStdHandle(STD_ERROR_HANDLE);
+ if (!hstderr || hstderr == INVALID_HANDLE_VALUE) {
+ printerr("GetStdHandle(STD_ERROR_HANDLE) failed (%d)\n",
+ GetLastError());
+ }
+ else if (DuplicateHandle(hproc, hstderr, hproc, &hdup, 0,
+ isservice, DUPLICATE_SAME_ACCESS)) {
+ CloseHandle(hstderr);
+ hstderr = hdup;
+ }
+ else {
+ printerr("DupHandle(stderr [%x]) failed (%d)\n",
+ hstderr, GetLastError());
+ }
+
+ /* You can't close the console till all the handles above were
+ * rescued by DuplicateHandle()
+ */
+ if (!FreeConsole())
+ printerr("FreeConsole() failed (%d)\n", GetLastError());
+
+ if (isservice) {
+#ifdef WE_EVER_FIGURE_OUT_WHY_THIS_DOESNT_WORK
+ hsavedesk = GetThreadDesktop(GetCurrentThreadId());
+ if (!hsavedesk || hsavedesk == INVALID_HANDLE_VALUE) {
+ printerr("GetThreadDesktop(GetTID()) failed (%d)\n", GetLastError());
+ }
+ CloseWindowStation(hwinsta);
+ hwinsta = OpenWindowStation("WinSta0", TRUE, MAXIMUM_ALLOWED);
+ if (!hwinsta || hwinsta == INVALID_HANDLE_VALUE) {
+ printerr("OpenWinSta(WinSta0) failed (%d)\n", GetLastError());
+ }
+ else if (!SetProcessWindowStation(hwinsta)) {
+ printerr("SetProcWinSta(WinSta0) failed (%d)\n", GetLastError());
+ }
+ hdesk = OpenDesktop("Default", 0, TRUE, MAXIMUM_ALLOWED);
+ if (!hdesk || hdesk == INVALID_HANDLE_VALUE) {
+ printerr("OpenDesktop(Default) failed (%d)\n", GetLastError());
+ }
+ else if (!SetThreadDesktop(hdesk)) {
+ printerr("SetThreadDesktop(Default) failed (%d)\n", GetLastError());
+ }
+#else
+ PROCESS_INFORMATION pi;
+ STARTUPINFO si;
+ DWORD exitcode = 1;
+ char appbuff[MAX_PATH];
+ char *appname = NULL;
+ char *cmdline = GetCommandLine();
+
+ if (!GetModuleFileName(NULL, appbuff, sizeof(appbuff))) {
+ appname = appbuff;
+ }
+
+ memset(&si, 0, sizeof(si));
+ si.cb = sizeof(si);
+ si.dwFlags = STARTF_USESHOWWINDOW
+ | STARTF_USESTDHANDLES;
+ si.lpDesktop = "WinSta0\\Default";
+ si.wShowWindow = 1; /* SW_SHOWNORMAL */
+ si.hStdInput = hstdin;
+ si.hStdOutput = hstdout;
+ si.hStdError = hstderr;
+
+ /* Instantly, upon creating the new process, we will close our
+ * copies of the handles so our parent isn't confused when the
+ * child closes their copy of the handle. Without this action,
+ * we would hold a copy of the handle, and the parent would not
+ * receive their EOF notification.
+ */
+ if (CreateProcess(appname, cmdline, NULL, NULL, TRUE,
+ CREATE_SUSPENDED | CREATE_NEW_CONSOLE,
+ NULL, NULL, &si, &pi)) {
+ CloseHandle(si.hStdInput);
+ CloseHandle(si.hStdOutput);
+ CloseHandle(si.hStdError);
+ ResumeThread(pi.hThread);
+ CloseHandle(pi.hThread);
+ WaitForSingleObject(pi.hProcess, INFINITE);
+ GetExitCodeProcess(pi.hProcess, &exitcode);
+ CloseHandle(pi.hProcess);
+ return exitcode;
+ }
+ return 1;
+#endif
+ }
+
+ if (!AllocConsole()) {
+ printerr("AllocConsole(Default) failed (%d)\n", GetLastError());
+ }
+
+ if (contitle && !SetConsoleTitle(contitle)) {
+ printerr("SetConsoleTitle() failed (%d)\n", GetLastError());
+ }
+
+ conout = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ FALSE, OPEN_EXISTING, 0, NULL);
+ if (!conout || conout == INVALID_HANDLE_VALUE) {
+ printerr("CreateFile(CONOUT$) failed (%d)\n", GetLastError());
+ }
+ else if (!GetConsoleMode(conout, &conmode)) {
+ printerr("GetConsoleMode(CONOUT) failed (%d)\n", GetLastError());
+ }
+ else if (!SetConsoleMode(conout, conmode = ((conmode | newoutmode)
+ & ~notoutmode))) {
+ printerr("SetConsoleMode(CONOUT, 0x%x) failed (%d)\n",
+ conmode, GetLastError());
+ }
+
+ conin = CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ FALSE, OPEN_EXISTING, 0, NULL);
+ if (!conin || conin == INVALID_HANDLE_VALUE) {
+ printerr("CreateFile(CONIN$) failed (%d)\n", GetLastError());
+ }
+ else if (!GetConsoleMode(conin, &conmode)) {
+ printerr("GetConsoleMode(CONIN) failed (%d)\n", GetLastError());
+ }
+ else if (!SetConsoleMode(conin, conmode = ((conmode | newinmode)
+ & ~notinmode))) {
+ printerr("SetConsoleMode(CONIN, 0x%x) failed (%d)\n",
+ conmode, GetLastError());
+ }
+
+ feed.in = conin;
+ feed.out = hstdout;
+ thread = CreateThread(NULL, 0, feedback, (LPVOID)&feed, 0, &tid);
+
+ while (ReadFile(hstdin, str, sizeof(str), &len, NULL))
+ if (!len || !WriteFile(conout, str, len, &len, NULL))
+ break;
+
+ printerr("[EOF] from stdin (%d)\n", GetLastError());
+
+ CloseHandle(stdout);
+ if (!GetConsoleTitle(str, sizeof(str))) {
+ printerr("SetConsoleTitle() failed (%d)\n", GetLastError());
+ }
+ else {
+ strcat(str, " - [Finished]");
+ if (!SetConsoleTitle(str)) {
+ printerr("SetConsoleTitle() failed (%d)\n", GetLastError());
+ }
+ }
+
+ WaitForSingleObject(thread, timeout);
+ FreeConsole();
+ if (isservice) {
+ if (!SetProcessWindowStation(hsavewinsta)) {
+ len = GetLastError();
+ }
+ if (!SetThreadDesktop(hsavedesk)) {
+ len = GetLastError();
+ }
+ CloseDesktop(hdesk);
+ CloseWindowStation(hwinsta);
+ }
+ return 0;
+}
+
+
+DWORD WINAPI feedback(LPVOID arg)
+{
+ feedback_args_t *feed = (feedback_args_t*)arg;
+ char *str[1024];
+ DWORD len;
+
+ while (ReadFile(feed->in, str, sizeof(str), &len, NULL))
+ if (!len || !WriteFile(feed->out, str, len, &len, NULL))
+ break;
+
+ printerr("[EOF] from Console (%d)\n", GetLastError());
+
+ return 0;
+}
diff --git a/support/win32/wintty.dep b/support/win32/wintty.dep
new file mode 100644
index 0000000..8f57409
--- /dev/null
+++ b/support/win32/wintty.dep
@@ -0,0 +1,5 @@
+# Microsoft Developer Studio Generated Dependency File, included by wintty.mak
+
+..\..\build\win32\httpd.rc : \
+ "..\..\include\ap_release.h"\
+
diff --git a/support/win32/wintty.dsp b/support/win32/wintty.dsp
new file mode 100644
index 0000000..337ba17
--- /dev/null
+++ b/support/win32/wintty.dsp
@@ -0,0 +1,106 @@
+# Microsoft Developer Studio Project File - Name="wintty" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=wintty - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "wintty.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "wintty.mak" CFG="wintty - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "wintty - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "wintty - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "wintty - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c
+# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Release/wintty_src" /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /fo"Release/wintty.res" /i "../../include" /i "../../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /subsystem:console
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /subsystem:console /debug /opt:ref
+# Begin Special Build Tool
+TargetPath=.\Release\wintty.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).manifest -outputresource:$(TargetPath);1
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "wintty - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /FD /c
+# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fd"Debug/wintty_src" /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /fo"Debug/wintty.res" /i "../../include" /i "../../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /subsystem:console /incremental:no /debug
+# ADD LINK32 kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /subsystem:console /incremental:no /debug
+# Begin Special Build Tool
+TargetPath=.\Debug\wintty.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).manifest -outputresource:$(TargetPath);1
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "wintty - Win32 Release"
+# Name "wintty - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\wintty.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\build\win32\httpd.rc
+# End Source File
+# End Target
+# End Project
diff --git a/support/win32/wintty.mak b/support/win32/wintty.mak
new file mode 100644
index 0000000..d2c3d6c
--- /dev/null
+++ b/support/win32/wintty.mak
@@ -0,0 +1,317 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on wintty.dsp
+!IF "$(CFG)" == ""
+CFG=wintty - Win32 Debug
+!MESSAGE No configuration specified. Defaulting to wintty - Win32 Debug.
+!ENDIF
+
+!IF "$(CFG)" != "wintty - Win32 Release" && "$(CFG)" != "wintty - Win32 Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "wintty.mak" CFG="wintty - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "wintty - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "wintty - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+
+!IF "$(CFG)" == "wintty - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\wintty.exe" "$(DS_POSTBUILD_DEP)"
+
+!ELSE
+
+ALL : "aprutil - Win32 Release" "apr - Win32 Release" "$(OUTDIR)\wintty.exe" "$(DS_POSTBUILD_DEP)"
+
+!ENDIF
+
+!IF "$(RECURSE)" == "1"
+CLEAN :"apr - Win32 ReleaseCLEAN" "aprutil - Win32 ReleaseCLEAN"
+!ELSE
+CLEAN :
+!ENDIF
+ -@erase "$(INTDIR)\wintty.obj"
+ -@erase "$(INTDIR)\wintty.res"
+ -@erase "$(INTDIR)\wintty_src.idb"
+ -@erase "$(INTDIR)\wintty_src.pdb"
+ -@erase "$(OUTDIR)\wintty.exe"
+ -@erase "$(OUTDIR)\wintty.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\wintty_src" /FD /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\wintty.res" /i "../../include" /i "../../srclib/apr/include" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe"
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\wintty.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\wintty.pdb" /debug /out:"$(OUTDIR)\wintty.exe" /opt:ref
+LINK32_OBJS= \
+ "$(INTDIR)\wintty.obj" \
+ "$(INTDIR)\wintty.res" \
+ "..\..\srclib\apr\LibR\apr-1.lib" \
+ "..\..\srclib\apr-util\LibR\aprutil-1.lib"
+
+"$(OUTDIR)\wintty.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\Release\wintty.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\wintty.exe"
+ if exist .\Release\wintty.exe.manifest mt.exe -manifest .\Release\wintty.exe.manifest -outputresource:.\Release\wintty.exe;1
+ echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ELSEIF "$(CFG)" == "wintty - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\wintty.exe" "$(DS_POSTBUILD_DEP)"
+
+!ELSE
+
+ALL : "aprutil - Win32 Debug" "apr - Win32 Debug" "$(OUTDIR)\wintty.exe" "$(DS_POSTBUILD_DEP)"
+
+!ENDIF
+
+!IF "$(RECURSE)" == "1"
+CLEAN :"apr - Win32 DebugCLEAN" "aprutil - Win32 DebugCLEAN"
+!ELSE
+CLEAN :
+!ENDIF
+ -@erase "$(INTDIR)\wintty.obj"
+ -@erase "$(INTDIR)\wintty.res"
+ -@erase "$(INTDIR)\wintty_src.idb"
+ -@erase "$(INTDIR)\wintty_src.pdb"
+ -@erase "$(OUTDIR)\wintty.exe"
+ -@erase "$(OUTDIR)\wintty.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP=cl.exe
+CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "../srclib/apr/include" /I "../srclib/apr-util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "APR_DECLARE_STATIC" /D "APU_DECLARE_STATIC" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\wintty_src" /FD /EHsc /c
+
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\wintty.res" /i "../../include" /i "../../srclib/apr/include" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe"
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\wintty.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+LINK32_FLAGS=kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /subsystem:console /incremental:no /pdb:"$(OUTDIR)\wintty.pdb" /debug /out:"$(OUTDIR)\wintty.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\wintty.obj" \
+ "$(INTDIR)\wintty.res" \
+ "..\..\srclib\apr\LibD\apr-1.lib" \
+ "..\..\srclib\apr-util\LibD\aprutil-1.lib"
+
+"$(OUTDIR)\wintty.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+TargetPath=.\Debug\wintty.exe
+SOURCE="$(InputPath)"
+PostBuild_Desc=Embed .manifest
+DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
+
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+"$(DS_POSTBUILD_DEP)" : "$(OUTDIR)\wintty.exe"
+ if exist .\Debug\wintty.exe.manifest mt.exe -manifest .\Debug\wintty.exe.manifest -outputresource:.\Debug\wintty.exe;1
+ echo Helper for Post-build step > "$(DS_POSTBUILD_DEP)"
+
+!ENDIF
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("wintty.dep")
+!INCLUDE "wintty.dep"
+!ELSE
+!MESSAGE Warning: cannot find "wintty.dep"
+!ENDIF
+!ENDIF
+
+
+!IF "$(CFG)" == "wintty - Win32 Release" || "$(CFG)" == "wintty - Win32 Debug"
+
+!IF "$(CFG)" == "wintty - Win32 Release"
+
+"apr - Win32 Release" :
+ cd ".\..\..\srclib\apr"
+ $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release"
+ cd "..\..\support\win32"
+
+"apr - Win32 ReleaseCLEAN" :
+ cd ".\..\..\srclib\apr"
+ $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Release" RECURSE=1 CLEAN
+ cd "..\..\support\win32"
+
+!ELSEIF "$(CFG)" == "wintty - Win32 Debug"
+
+"apr - Win32 Debug" :
+ cd ".\..\..\srclib\apr"
+ $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug"
+ cd "..\..\support\win32"
+
+"apr - Win32 DebugCLEAN" :
+ cd ".\..\..\srclib\apr"
+ $(MAKE) /$(MAKEFLAGS) /F ".\apr.mak" CFG="apr - Win32 Debug" RECURSE=1 CLEAN
+ cd "..\..\support\win32"
+
+!ENDIF
+
+!IF "$(CFG)" == "wintty - Win32 Release"
+
+"aprutil - Win32 Release" :
+ cd ".\..\..\srclib\apr-util"
+ $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release"
+ cd "..\..\support\win32"
+
+"aprutil - Win32 ReleaseCLEAN" :
+ cd ".\..\..\srclib\apr-util"
+ $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Release" RECURSE=1 CLEAN
+ cd "..\..\support\win32"
+
+!ELSEIF "$(CFG)" == "wintty - Win32 Debug"
+
+"aprutil - Win32 Debug" :
+ cd ".\..\..\srclib\apr-util"
+ $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug"
+ cd "..\..\support\win32"
+
+"aprutil - Win32 DebugCLEAN" :
+ cd ".\..\..\srclib\apr-util"
+ $(MAKE) /$(MAKEFLAGS) /F ".\aprutil.mak" CFG="aprutil - Win32 Debug" RECURSE=1 CLEAN
+ cd "..\..\support\win32"
+
+!ENDIF
+
+SOURCE=..\..\build\win32\httpd.rc
+
+!IF "$(CFG)" == "wintty - Win32 Release"
+
+
+"$(INTDIR)\wintty.res" : $(SOURCE) "$(INTDIR)"
+ $(RSC) /l 0x409 /fo"$(INTDIR)\wintty.res" /i "../../include" /i "../../srclib/apr/include" /i "../../build\win32" /d "NDEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe" $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "wintty - Win32 Debug"
+
+
+"$(INTDIR)\wintty.res" : $(SOURCE) "$(INTDIR)"
+ $(RSC) /l 0x409 /fo"$(INTDIR)\wintty.res" /i "../../include" /i "../../srclib/apr/include" /i "../../build\win32" /d "_DEBUG" /d "APP_FILE" /d BIN_NAME="wintty.exe" /d LONG_NAME="Apache wintty console pipe" $(SOURCE)
+
+
+!ENDIF
+
+SOURCE=.\wintty.c
+
+"$(INTDIR)\wintty.obj" : $(SOURCE) "$(INTDIR)"
+
+
+
+!ENDIF
+