From 4c8044a5cdb6bee1379b9cf4e3a44c6126fa7fd2 Mon Sep 17 00:00:00 2001 From: Cliff Woolley Date: Tue, 7 Aug 2001 19:54:10 +0000 Subject: [PATCH] This is a nearly blind commit of an update posted by Mladen Turk just after the initial import. Mladen, please check this to see if I got it right. Submitted by: Mladen Turk git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@90004 13f79535-47bb-0310-9956-ffa450edef68 --- support/win32/ApacheMonitor.c | 782 +++++++++++++++++++------------- support/win32/ApacheMonitor.dsp | 284 ++++++------ support/win32/ApacheMonitor.h | 26 +- support/win32/apache_header.bmp | Bin 6183 -> 33566 bytes 4 files changed, 617 insertions(+), 475 deletions(-) diff --git a/support/win32/ApacheMonitor.c b/support/win32/ApacheMonitor.c index 156f896abc..3538909083 100644 --- a/support/win32/ApacheMonitor.c +++ b/support/win32/ApacheMonitor.c @@ -57,7 +57,7 @@ */ /* ==================================================================== - * ApacheService.c Simple program to manage and monitor Apache services. + * ApacheMonitor.c Simple program to manage and monitor Apache services. * * Contributed by Mladen Turk * @@ -86,34 +86,14 @@ #define WM_TRAYMESSAGE (WM_APP+1) #define WM_UPDATEMESSAGE (WM_USER+1) +#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 - -#ifndef SERVICE_RUNS_IN_SYSTEM_PROCESS -#define SERVICE_RUNS_IN_SYSTEM_PROCESS 0x00000001 - -typedef struct _SERVICE_STATUS_PROCESS { - DWORD dwServiceType; - DWORD dwCurrentState; - DWORD dwControlsAccepted; - DWORD dwWin32ExitCode; - DWORD dwServiceSpecificExitCode; - DWORD dwCheckPoint; - DWORD dwWaitHint; - DWORD dwProcessId; - DWORD dwServiceFlags; -} SERVICE_STATUS_PROCESS, *LPSERVICE_STATUS_PROCESS; - -typedef enum _SC_STATUS_TYPE { - SC_STATUS_PROCESS_INFO = 0 -} SC_STATUS_TYPE; - -#endif - -typedef BOOL (WINAPI *QUERYSERVICESTATUSEX)(SC_HANDLE, SC_STATUS_TYPE, - LPBYTE, DWORD, LPDWORD); +#define REFRESH_TIME 1000 /* service refresh time (ms) */ +#define RESCAN_TIME 10000 /* registry rescan time (ms) */ typedef struct _st_APACHE_SERVICE { @@ -135,14 +115,24 @@ UINT ap_uiTaskbarCreated; DWORD ap_OSVersion; BOOL dlgAboutOn = FALSE; BOOL dlgServiceOn = FALSE; +BOOL ap_consoleRun = FALSE; ST_APACHE_SERVICE ap_stServices[MAX_APACHE_SERVICES]; HBITMAP hbmpStart, hbmpStop; HBITMAP hbmpPicture, hbmpOld; -HWND ap_hServiceDlg; BOOL ap_rescanServices; HWND ap_hServiceDlg; - +HWND ap_hMainWnd; +HWND ap_hStdoutWnd; +HCURSOR ap_cHourglass; +HCURSOR ap_cArrow; + +HANDLE h_stdOutR; +HANDLE h_stdOutW; +HANDLE h_stdInR; +HANDLE h_stdInW; +HANDLE h_stdErr; +PROCESS_INFORMATION ap_redirectedPI; void ap_ClearServicesSt() { @@ -190,11 +180,11 @@ LPTSTR GetStringRes(int id) BOOL GetSystemOSVersion(LPSTR szVersion, LPDWORD dwVersion) { OSVERSIONINFOEX osvi; - BOOL bOsVersionInfoEx; - char szBuff[256]; - HKEY hKey; - char szProductType[80]; - DWORD dwBufLen; + BOOL bOsVersionInfoEx; + char szBuff[256]; + HKEY hKey; + char szProductType[80]; + DWORD dwBufLen; /* Try calling GetVersionEx using the OSVERSIONINFOEX structure. @@ -359,12 +349,37 @@ static VOID ShowNotifyIcon(HWND hWnd, DWORD dwMessage) } else nid.hIcon = NULL; + if (n == i) + lstrcpy(nid.szTip, "Running all Apache services"); + else if (n) + sprintf(nid.szTip, "Running %d from %d Apache services", n, i); + else + sprintf(nid.szTip, "Running none from %d Apache services", n, i); - sprintf(nid.szTip, "Running: %d Services", n); Shell_NotifyIcon(dwMessage, &nid); } +void appendMenuItem(HMENU hMenu, UINT uMenuId, LPSTR szName, BOOL fDefault) +{ + MENUITEMINFO mii; + + ZeroMemory(&mii, sizeof(MENUITEMINFO)); + mii.cbSize = sizeof(MENUITEMINFO); + mii.fMask = MIIM_ID | MIIM_TYPE | MIIM_STATE; + if (lstrlen(szName)) + { + mii.fType = MFT_STRING; + mii.wID = uMenuId; + if (fDefault) + mii.fState = MFS_DEFAULT; + mii.dwTypeData = szName; + } + else + mii.fType = MFT_SEPARATOR; + InsertMenuItem(hMenu, uMenuId, FALSE, &mii); +} + void ShowTryPopupMenu(HWND hWnd) { /* create popup menu */ @@ -373,10 +388,10 @@ void ShowTryPopupMenu(HWND hWnd) if (hMenu) { - AppendMenu(hMenu, MF_STRING, IDM_ABOUT, "&About..."); - AppendMenu(hMenu, MF_STRING, IDM_RESTORE, "&Show Services..."); - AppendMenu(hMenu, MF_SEPARATOR, 0, ""); - AppendMenu(hMenu, MF_STRING, IDM_EXIT, "&Exit..."); + appendMenuItem(hMenu, IDM_ABOUT, "&About...", FALSE); + appendMenuItem(hMenu, IDM_RESTORE, "&Show Services...", TRUE); + appendMenuItem(hMenu, 0, "", FALSE); + appendMenuItem(hMenu, IDM_EXIT, "&Exit...", FALSE); GetCursorPos(&pt); SetForegroundWindow(NULL); @@ -389,7 +404,7 @@ BOOL CenterWindow(HWND hwndChild) RECT rChild, rWorkArea; int wChild, hChild; int xNew, yNew; - BOOL bResult; + BOOL bResult; /* Get the Height and Width of the child window */ GetWindowRect(hwndChild, &rChild); @@ -398,7 +413,7 @@ BOOL CenterWindow(HWND hwndChild) /* Get the limits of the 'workarea' */ bResult = SystemParametersInfo( - SPI_GETWORKAREA, /* system parameter to query or set */ + SPI_GETWORKAREA, sizeof(RECT), &rWorkArea, 0); @@ -408,7 +423,7 @@ BOOL CenterWindow(HWND hwndChild) rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN); } - /* Calculate new X position, then adjust for workarea */ + /* 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); @@ -422,56 +437,172 @@ static void addItem(HWND hDlg, LPSTR lpStr, HBITMAP hBmp) SendMessage(hDlg, LB_SETITEMDATA, nItem, (LPARAM)hBmp); } +static DWORD WINAPI ConsoleOutputThread(LPVOID lpThreadParameter) +{ + static BYTE lpBuffer[513]; + LPSTR lpBuf = lpBuffer; + BYTE ch; + DWORD dwReaded; -BOOL RunAndForgetConsole(LPTSTR szCmdLine, - LPDWORD nRetValue, - BOOL showConsole) + while (ReadFile(h_stdOutR, &ch, 1, &dwReaded, NULL) == TRUE) + { + if (dwReaded > 0) + { + if (ch == '\n') + { + *lpBuf = '\0'; + ListBox_SetCurSel(ap_hStdoutWnd, + ListBox_AddString(ap_hStdoutWnd, lpBuffer)); + lpBuf = lpBuffer; + } + else if (ch == '\t') + { + int i, t; + t = ((int)lpBuf - (int)lpBuffer) % 8; + for (i = 0; i < 8 - t; ++i) + *lpBuf++ = ' '; + } + else if (ch != '\r') + *lpBuf++ = ch; + } + } + CloseHandle(h_stdInW); + CloseHandle(h_stdOutR); + CloseHandle(h_stdErr); + return 0; +} + + +DWORD WINAPI ConsoleWaitingThread(LPVOID lpThreadParameter) +{ + WaitForSingleObject(ap_redirectedPI.hThread, INFINITE); + CloseHandle(ap_redirectedPI.hThread); + MessageBeep(100); + ap_consoleRun = FALSE; + SetCursor(ap_cArrow); + return 0; +} + + +BOOL RunRedirectedConsole(LPTSTR szCmdLine, LPDWORD nRetValue) { + DWORD dwThreadId; + HANDLE hProc; + STARTUPINFO stInfo; + BOOL bResult; + ZeroMemory(&stInfo, sizeof(stInfo)); + stInfo.cb = sizeof(stInfo); + stInfo.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW; + stInfo.wShowWindow = SW_HIDE; + + hProc = GetCurrentProcess(); + + if (!CreatePipe(&h_stdInR, &h_stdInW, NULL, MAX_PATH)) + ErrorMessage(ERROR_SUCCESS); + if (!CreatePipe(&h_stdOutR, &h_stdOutW, NULL, MAX_PATH*8)) + ErrorMessage(ERROR_SUCCESS); + + DuplicateHandle(hProc, h_stdInR, hProc, &h_stdInR, 0, TRUE, + DUPLICATE_CLOSE_SOURCE|DUPLICATE_SAME_ACCESS); + DuplicateHandle(hProc, h_stdOutW, hProc, &h_stdOutW, 0, TRUE, + DUPLICATE_CLOSE_SOURCE|DUPLICATE_SAME_ACCESS); + DuplicateHandle(hProc, h_stdOutW, hProc, &h_stdErr, 0, TRUE, + DUPLICATE_SAME_ACCESS); + stInfo.hStdInput = h_stdInR; + stInfo.hStdOutput = h_stdOutW; + stInfo.hStdError = h_stdErr; + + bResult = CreateProcess(NULL, + szCmdLine, + NULL, + NULL, + TRUE, + CREATE_SUSPENDED, + NULL, + NULL , + &stInfo, + &ap_redirectedPI); + + + CloseHandle(h_stdInR); + CloseHandle(h_stdOutW); + CloseHandle(h_stdErr); + + if (!bResult) + { + if (nRetValue) + *nRetValue = GetLastError(); + CloseHandle(h_stdInW); + CloseHandle(h_stdOutR); + CloseHandle(h_stdErr); + return FALSE; + } + + CloseHandle(CreateThread(NULL, 0, ConsoleOutputThread, 0, 0, &dwThreadId)); + ResumeThread(ap_redirectedPI.hThread); + CloseHandle(CreateThread(NULL, 0, ConsoleWaitingThread, 0, 0, &dwThreadId)); + + return TRUE; +} + +BOOL RunAndForgetConsole(LPTSTR szCmdLine, + LPDWORD nRetValue, + BOOL bRedirectConsole) +{ + STARTUPINFO stInfo; PROCESS_INFORMATION prInfo; BOOL bResult; + + if (bRedirectConsole) + return RunRedirectedConsole(szCmdLine, nRetValue); + + ZeroMemory(&stInfo, sizeof(stInfo)); stInfo.cb = sizeof(stInfo); stInfo.dwFlags = STARTF_USESHOWWINDOW; - stInfo.wShowWindow = showConsole ? SW_SHOWNORMAL : SW_HIDE; - + stInfo.wShowWindow = SW_HIDE; + bResult = CreateProcess(NULL, szCmdLine, NULL, NULL, TRUE, - CREATE_NEW_CONSOLE , + CREATE_NEW_CONSOLE, NULL, NULL , &stInfo, &prInfo); - if (nRetValue) - *nRetValue = GetLastError(); - + + if (!bResult) + { + if (nRetValue) + *nRetValue = GetLastError(); + return FALSE; + } + if (ap_OSVersion == OS_VERSION_WIN9X) /* give some time to rescan the status */ + Sleep(2000); CloseHandle(prInfo.hThread); CloseHandle(prInfo.hProcess); - if (!bResult) - return FALSE; - else - return TRUE; + return TRUE; } - BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwCommand) { - CHAR szBuf[MAX_PATH]; - LPSTR sPos; - DWORD retCode; - BOOL retValue; - BOOL ntService = TRUE; - SC_HANDLE schService; - SC_HANDLE schSCManager; + CHAR szBuf[MAX_PATH]; + CHAR szMsg[MAX_PATH]; + LPSTR sPos; + DWORD retCode; + BOOL retValue; + BOOL serviceFlag = TRUE; + SC_HANDLE schService; + SC_HANDLE schSCManager; SERVICE_STATUS schSStatus; - LPSTR *args; - int ticks; + LPSTR *args; + int ticks; if (ap_OSVersion == OS_VERSION_WIN9X) { @@ -485,14 +616,15 @@ BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwComma lstrcat(szBuf, " -k stop -n "); break; case SERVICE_CONTROL_CONTINUE: + sprintf(szMsg, "The %s is starting.", szServiceName); + ListBox_SetCurSel(ap_hStdoutWnd, + ListBox_AddString(ap_hStdoutWnd, szMsg)); lstrcat(szBuf, " -k start -n "); + serviceFlag = FALSE; break; case SERVICE_APACHE_RESTART: lstrcat(szBuf, " -k restart -n "); break; - case SERVICE_CONTROL_SHUTDOWN: - lstrcat(szBuf, " -k uninstall -n "); - break; default: return FALSE; } @@ -500,36 +632,37 @@ BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwComma } else return FALSE; - if (!RunAndForgetConsole(szBuf, &retCode, FALSE)) + ap_consoleRun = TRUE; + SetCursor(ap_cHourglass); + if (!RunAndForgetConsole(szBuf, &retCode, serviceFlag)) { ErrorMessage(retCode); + ap_consoleRun = FALSE; + SetCursor(ap_cArrow); return FALSE; } + else if (!serviceFlag) + { + sprintf(szMsg, "The %s has started.", szServiceName); + ListBox_SetCurSel(ap_hStdoutWnd, + ListBox_AddString(ap_hStdoutWnd, szMsg)); + + ap_consoleRun = FALSE; + SetCursor(ap_cArrow); + return TRUE; + } } else { + /* Apache 2.0 uses '-k runservice' as cmdline parameter */ sPos = strstr(szImagePath, "--ntservice"); if (!sPos) { sPos = strstr(szImagePath, "-k runservice"); - ntService = FALSE; + serviceFlag = FALSE; } if (sPos) - { lstrcpyn(szBuf, szImagePath, sPos - szImagePath); - if (dwCommand == SERVICE_CONTROL_SHUTDOWN) - { - lstrcat(szBuf, " -k uninstall -n "); - lstrcat(szBuf, szServiceName); - if (!RunAndForgetConsole(szBuf, &retCode, FALSE)) - { - ErrorMessage(retCode); - return FALSE; - } - else - return TRUE; - } - } else return FALSE; schSCManager = OpenSCManager( @@ -544,9 +677,14 @@ BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwComma if (schService != NULL) { retValue = FALSE; + ap_consoleRun = TRUE; + SetCursor(ap_cHourglass); switch (dwCommand) { case SERVICE_CONTROL_STOP: + sprintf(szMsg, "The %s is stopping.", szServiceName); + ListBox_SetCurSel(ap_hStdoutWnd, + ListBox_AddString(ap_hStdoutWnd, szMsg)); if(ControlService(schService, SERVICE_CONTROL_STOP, &schSStatus)) { Sleep(1000); @@ -561,20 +699,28 @@ BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwComma if (QueryServiceStatus(schService, &schSStatus)) { if(schSStatus.dwCurrentState == SERVICE_STOPPED) + { retValue = TRUE; + sprintf(szMsg, "The %s has stopped.", szServiceName); + ListBox_SetCurSel(ap_hStdoutWnd, + ListBox_AddString(ap_hStdoutWnd, szMsg)); + } } break; case SERVICE_CONTROL_CONTINUE: + sprintf(szMsg, "The %s is starting.", szServiceName); + ListBox_SetCurSel(ap_hStdoutWnd, + ListBox_AddString(ap_hStdoutWnd, szMsg)); args = (char **)malloc(3 * sizeof(char*)); args[0] = szBuf; - if (ntService) + if (serviceFlag) args[1] = "--ntservice"; else { args[1] = "-k"; args[2] = "runservice"; } - if(StartService(schService, ntService ? 2 : 3, args)) + if(StartService(schService, serviceFlag ? 2 : 3, args)) { Sleep(1000); while (QueryServiceStatus(schService, &schSStatus)) @@ -588,12 +734,20 @@ BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwComma if (QueryServiceStatus(schService, &schSStatus)) { if(schSStatus.dwCurrentState == SERVICE_RUNNING) + { retValue = TRUE; + sprintf(szMsg, "The %s has started.", szServiceName); + ListBox_SetCurSel(ap_hStdoutWnd, + ListBox_AddString(ap_hStdoutWnd, szMsg)); + } } /* is this OK to do? */ free(args); break; case SERVICE_APACHE_RESTART: + sprintf(szMsg, "The %s is restarting.", szServiceName); + ListBox_SetCurSel(ap_hStdoutWnd, + ListBox_AddString(ap_hStdoutWnd, szMsg)); if(ControlService(schService, SERVICE_APACHE_RESTART, &schSStatus)) { ticks = 60; @@ -604,6 +758,8 @@ BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwComma { CloseServiceHandle(schService); CloseServiceHandle(schSCManager); + ap_consoleRun = FALSE; + SetCursor(ap_cArrow); return FALSE; } if (!--ticks) @@ -611,11 +767,20 @@ BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwComma } } if(schSStatus.dwCurrentState == SERVICE_RUNNING) - retValue = TRUE; + { + retValue = TRUE; + sprintf(szMsg, "The %s has restarted.", szServiceName); + ListBox_SetCurSel(ap_hStdoutWnd, + ListBox_AddString(ap_hStdoutWnd, szMsg)); + } break; } CloseServiceHandle(schService); CloseServiceHandle(schSCManager); + if (!retValue) + ErrorMessage(ERROR_SUCCESS); + ap_consoleRun = FALSE; + SetCursor(ap_cArrow); return retValue; } @@ -632,21 +797,18 @@ BOOL ApacheManageService(LPCSTR szServiceName, LPCSTR szImagePath, DWORD dwComma BOOL IsServiceRunning(LPCSTR szServiceName, LPDWORD lpdwPid) { - DWORD dwPid, dwBytes; - HWND hWnd; - SC_HANDLE schService; - SC_HANDLE schSCManager; - SERVICE_STATUS schSStatus; - SERVICE_STATUS_PROCESS schSProcess; - HANDLE hAdvapi; - QUERYSERVICESTATUSEX pQueryServiceStatusEx = NULL; + DWORD dwPid; + HWND hWnd; + SC_HANDLE schService; + SC_HANDLE schSCManager; + SERVICE_STATUS schSStatus; if (ap_OSVersion == OS_VERSION_WIN9X) { hWnd = FindWindow("ApacheWin95ServiceMonitor", szServiceName); if (hWnd && GetWindowThreadProcessId(hWnd, &dwPid)) { - *lpdwPid = dwPid; + *lpdwPid = 1; return TRUE; } else @@ -674,25 +836,6 @@ BOOL IsServiceRunning(LPCSTR szServiceName, LPDWORD lpdwPid) if (lpdwPid) *lpdwPid = 1; } - if (ap_OSVersion == OS_VERSION_WIN2K) - { - hAdvapi = LoadLibrary("ADVAPI32.DLL"); - if (hAdvapi != NULL) - pQueryServiceStatusEx = (QUERYSERVICESTATUSEX)GetProcAddress(hAdvapi, - "QueryServiceStatusEx"); - if (hAdvapi != NULL && pQueryServiceStatusEx != NULL) - { - if (pQueryServiceStatusEx(schService, SC_STATUS_PROCESS_INFO, - (LPBYTE)&schSProcess, sizeof(SERVICE_STATUS_PROCESS), &dwBytes)) - { - dwPid = schSProcess.dwCurrentState; - if (lpdwPid) - *lpdwPid = schSProcess.dwProcessId; - } - } - if (hAdvapi != NULL) - FreeLibrary(hAdvapi); - } CloseServiceHandle(schService); CloseServiceHandle(schSCManager); return dwPid == SERVICE_RUNNING ? TRUE : FALSE; @@ -728,16 +871,16 @@ BOOL FindRunningServices() BOOL GetApacheServicesStatus() { - CHAR szKey[MAX_PATH]; - CHAR achKey[MAX_PATH]; - CHAR szImagePath[MAX_PATH]; - CHAR szBuf[MAX_PATH]; + CHAR szKey[MAX_PATH]; + CHAR achKey[MAX_PATH]; + CHAR szImagePath[MAX_PATH]; + CHAR szBuf[MAX_PATH]; - HKEY hKey, hSubKey; - DWORD retCode, rv, dwKeyType; - DWORD dwBufLen = MAX_PATH; + HKEY hKey, hSubKey; + DWORD retCode, rv, dwKeyType; + DWORD dwBufLen = MAX_PATH; + int i, stPos = 0; - int i, stPos = 0; ap_rescanServices = FALSE; retCode = RegOpenKeyEx(HKEY_LOCAL_MACHINE, @@ -796,22 +939,134 @@ BOOL GetApacheServicesStatus() return TRUE; } +LRESULT CALLBACK AboutDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + static HFONT hfontDlg; /* Font for dialog text */ + static HFONT hFinePrint; /* Font for 'fine print' in dialog */ + DWORD dwVerInfoSize; /* Size of version information block */ + LPSTR lpVersion; /* String pointer to 'version' text */ + DWORD dwVerHnd=0; /* An 'ignored' parameter, always '0' */ + UINT uVersionLen; + WORD wRootLen; + BOOL bRetCode; + int i; + char szFullPath[256]; + char szResult[256]; + char szGetName[256]; + char szVersion[256]; + DWORD dwResult; + + switch (message) { + case WM_INITDIALOG: + ShowWindow(hDlg, SW_HIDE); + ap_hwndAboutDlg = hDlg; + + hfontDlg = CreateFont(13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + VARIABLE_PITCH | FF_SWISS, ""); + hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + VARIABLE_PITCH | FF_SWISS, ""); + + CenterWindow(hDlg); + GetModuleFileName(ap_hInstance, szFullPath, sizeof(szFullPath)); + + /* Now lets dive in and pull out the version information: */ + dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd); + if (dwVerInfoSize) { + LPSTR lpstrVffInfo; + HANDLE hMem; + hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize); + lpstrVffInfo = GlobalLock(hMem); + GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo); + lstrcpy(szGetName, GetStringRes(IDS_VER_INFO_LANG)); + + wRootLen = lstrlen(szGetName); /* Save this position */ + + /* Set the title of the dialog: */ + lstrcat(szGetName, "ProductName"); + bRetCode = VerQueryValue((LPVOID)lpstrVffInfo, + (LPSTR)szGetName, + (LPVOID)&lpVersion, + (UINT *)&uVersionLen); + + /* Notice order of version and string... */ + lstrcpy(szResult, "About "); + lstrcat(szResult, lpVersion); + + SetWindowText(hDlg, szResult); + + /* Walk through the dialog items that we want to replace: */ + for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) { + GetDlgItemText(hDlg, i, szResult, sizeof(szResult)); + szGetName[wRootLen] = (char)0; + lstrcat(szGetName, szResult); + uVersionLen = 0; + lpVersion = NULL; + bRetCode = VerQueryValue((LPVOID)lpstrVffInfo, + (LPSTR)szGetName, + (LPVOID)&lpVersion, + (UINT *)&uVersionLen); + + if (bRetCode && uVersionLen && lpVersion) { + /* Replace dialog item text with version info */ + lstrcpy(szResult, lpVersion); + SetDlgItemText(hDlg, i, szResult); + } + else + { + dwResult = GetLastError(); + + wsprintf(szResult, GetStringRes(IDS_VERSION_ERROR), dwResult); + SetDlgItemText(hDlg, i, szResult); + } + SendMessage(GetDlgItem(hDlg, i), WM_SETFONT, + (UINT)((i==DLG_VERLAST)?hFinePrint:hfontDlg), + TRUE); + } + + + GlobalUnlock(hMem); + GlobalFree(hMem); + + } + + SendMessage(GetDlgItem(hDlg, IDC_LABEL), WM_SETFONT, + (WPARAM)hfontDlg,(LPARAM)TRUE); + if (!GetSystemOSVersion(szVersion, NULL)) + strcpy(szVersion, "Unknown Version"); + SetWindowText(GetDlgItem(hDlg, IDC_OSVERSION), szVersion); + ShowWindow(hDlg, SW_SHOW); + return (TRUE); + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { + EndDialog(hDlg, TRUE); + DeleteObject(hfontDlg); + DeleteObject(hFinePrint); + return (TRUE); + } + break; + } + + return FALSE; +} + LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { - CHAR tchBuffer[MAX_PATH]; - CHAR tsbBuffer[MAX_PATH]; - CHAR szBuf[64]; - HWND hListBox; + CHAR tchBuffer[MAX_PATH]; + CHAR tsbBuffer[MAX_PATH]; + HWND hListBox; static HWND hStatusBar; - TEXTMETRIC tm; - int i, y; - HDC hdcMem; + TEXTMETRIC tm; + int i, y; + HDC hdcMem; + RECT rcBitmap; + UINT nItem; LPMEASUREITEMSTRUCT lpmis; - LPDRAWITEMSTRUCT lpdis; - RECT rcBitmap; - UINT nItem; + LPDRAWITEMSTRUCT lpdis; + ZeroMemory(tchBuffer, MAX_PATH); + ZeroMemory(tsbBuffer, MAX_PATH); switch (message) { @@ -824,8 +1079,8 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l 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_SUNINSTALL), FALSE); hListBox = GetDlgItem(hDlg, IDL_SERVICES); + ap_hStdoutWnd = GetDlgItem(hDlg, IDL_STDOUT); hStatusBar = CreateStatusWindow(SBT_TOOLTIPS | WS_CHILD | WS_VISIBLE, "", hDlg, IDC_STATBAR); if (GetApacheServicesStatus()) @@ -850,7 +1105,6 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l 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_SUNINSTALL), FALSE); i = 0; while (ap_stServices[i].szServiceName != NULL) { @@ -860,7 +1114,7 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l } SendMessage(hListBox, LB_SETCURSEL, 0, 0); /* Dirty hack to bring the window to the foreground */ - SetWindowPos(hDlg, HWND_TOPMOST, 0, 0, 0, 0, + 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); @@ -872,7 +1126,12 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l lpmis = (LPMEASUREITEMSTRUCT) lParam; lpmis->itemHeight = 16; return TRUE; - + case WM_SETCURSOR: + if (ap_consoleRun) + SetCursor(ap_cHourglass); + else + SetCursor(ap_cArrow); + return TRUE; case WM_DRAWITEM: lpdis = (LPDRAWITEMSTRUCT) lParam; @@ -905,7 +1164,7 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l SelectObject(hdcMem, hbmpOld); DeleteDC(hdcMem); - rcBitmap.left = lpdis->rcItem.left + XBITMAP; + rcBitmap.left = lpdis->rcItem.left + XBITMAP + 2; rcBitmap.top = lpdis->rcItem.top; rcBitmap.right = lpdis->rcItem.right; rcBitmap.bottom = lpdis->rcItem.top + YBITMAP; @@ -917,39 +1176,16 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l Button_Enable(GetDlgItem(hDlg, IDC_SSTART), TRUE); Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), FALSE); - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), TRUE); - } else if (hbmpPicture == hbmpStart) { Button_Enable(GetDlgItem(hDlg, IDC_SSTART), FALSE); Button_Enable(GetDlgItem(hDlg, IDC_SSTOP), TRUE); Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), TRUE); - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), FALSE); - - } - i = 0; - while (ap_stServices[i].szServiceName != NULL) - { - if (lstrcmp(ap_stServices[i].szDisplayName, tchBuffer) == 0) - { - if (ap_stServices[i].szDescription) - lstrcpy(tsbBuffer, ap_stServices[i].szDescription); - else - lstrcpy(tsbBuffer, ap_stServices[i].szImagePath); - if (ap_stServices[i].dwPid != 0) - { - if (ap_stServices[i].dwPid & 0xFF000000) - sprintf(szBuf, " PID : 0x%08X", ap_stServices[i].dwPid); - else - sprintf(szBuf, " PID : %d", ap_stServices[i].dwPid); - lstrcat(tsbBuffer, szBuf); - } - SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)tsbBuffer); - break; - } - ++i; } + if (ap_stServices[lpdis->itemID].szDescription) + lstrcpy(tsbBuffer, ap_stServices[lpdis->itemID].szDescription); + SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)tsbBuffer); SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT)); @@ -979,10 +1215,28 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l switch (HIWORD(wParam)) { case LBN_DBLCLK: - GetApacheServicesStatus(); - SendMessage(hDlg, WM_UPDATEMESSAGE, 0, 0); + /* if started then stop, if stopped the start the service */ + hListBox = GetDlgItem(hDlg, IDL_SERVICES); + nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); + if (nItem != LB_ERR) + { + hbmpPicture = (HBITMAP)SendMessage(hListBox, LB_GETITEMDATA, + nItem, (LPARAM) 0); + if (hbmpPicture == hbmpStop) + { + ApacheManageService(ap_stServices[nItem].szServiceName, + ap_stServices[nItem].szImagePath, + SERVICE_CONTROL_CONTINUE); + } + else + ApacheManageService(ap_stServices[nItem].szServiceName, + ap_stServices[nItem].szImagePath, + SERVICE_CONTROL_STOP); + + } return TRUE; - } + break; + } break; case IDOK: EndDialog(hDlg, TRUE); @@ -1027,18 +1281,17 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l Button_Enable(GetDlgItem(hDlg, IDC_SRESTART), TRUE); return TRUE; break; - case IDC_SUNINSTALL: - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), FALSE); - hListBox = GetDlgItem(hDlg, IDL_SERVICES); - nItem = SendMessage(hListBox, LB_GETCURSEL, 0, 0); - if (nItem != LB_ERR) - { - ApacheManageService(ap_stServices[nItem].szServiceName, - ap_stServices[nItem].szImagePath, - SERVICE_CONTROL_SHUTDOWN); - } - ap_rescanServices = TRUE; - Button_Enable(GetDlgItem(hDlg, IDC_SUNINSTALL), TRUE); + case IDC_SABOUT: + if (!dlgAboutOn) + { + dlgAboutOn = TRUE; + DialogBox(ap_hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), + ap_hMainWnd, (DLGPROC)AboutDlgProc); + dlgAboutOn = FALSE; + ap_hwndAboutDlg = NULL; + } + else if (ap_hwndAboutDlg) + SetFocus(ap_hwndAboutDlg); return TRUE; break; } @@ -1052,9 +1305,6 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l break; } break; - case WM_ERASEBKGND: - - break; case WM_CLOSE: EndDialog(hDlg, TRUE); return TRUE; @@ -1062,144 +1312,51 @@ LRESULT CALLBACK ServiceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l DeleteObject(hbmpStart); DeleteObject(hbmpStop); return TRUE; - default: return FALSE; } return FALSE; } -/* About Box from MS Generic Sample */ -LRESULT CALLBACK AboutDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - static HFONT hfontDlg; /* Font for dialog text */ - static HFONT hFinePrint; /* Font for 'fine print' in dialog */ - DWORD dwVerInfoSize; /* Size of version information block */ - LPSTR lpVersion; /* String pointer to 'version' text */ - DWORD dwVerHnd=0; /* An 'ignored' parameter, always '0' */ - UINT uVersionLen; - WORD wRootLen; - BOOL bRetCode; - int i; - char szFullPath[256]; - char szResult[256]; - char szGetName[256]; - char szVersion[256]; - DWORD dwResult; - - switch (message) { - case WM_INITDIALOG: - ShowWindow(hDlg, SW_HIDE); - ap_hwndAboutDlg = hDlg; - - hfontDlg = CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - VARIABLE_PITCH | FF_SWISS, ""); - hFinePrint = CreateFont(11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - VARIABLE_PITCH | FF_SWISS, ""); - - CenterWindow(hDlg); - GetModuleFileName(ap_hInstance, szFullPath, sizeof(szFullPath)); - - /* Now lets dive in and pull out the version information: */ - dwVerInfoSize = GetFileVersionInfoSize(szFullPath, &dwVerHnd); - if (dwVerInfoSize) { - LPSTR lpstrVffInfo; - HANDLE hMem; - hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize); - lpstrVffInfo = GlobalLock(hMem); - GetFileVersionInfo(szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo); - lstrcpy(szGetName, GetStringRes(IDS_VER_INFO_LANG)); - - wRootLen = lstrlen(szGetName); /* Save this position */ - - /* Set the title of the dialog: */ - lstrcat(szGetName, "ProductName"); - bRetCode = VerQueryValue((LPVOID)lpstrVffInfo, - (LPSTR)szGetName, - (LPVOID)&lpVersion, - (UINT *)&uVersionLen); - - /* Notice order of version and string... */ - lstrcpy(szResult, "About "); - lstrcat(szResult, lpVersion); - - SetWindowText(hDlg, szResult); - - /* Walk through the dialog items that we want to replace: */ - for (i = DLG_VERFIRST; i <= DLG_VERLAST; i++) { - GetDlgItemText(hDlg, i, szResult, sizeof(szResult)); - szGetName[wRootLen] = (char)0; - lstrcat(szGetName, szResult); - uVersionLen = 0; - lpVersion = NULL; - bRetCode = VerQueryValue((LPVOID)lpstrVffInfo, - (LPSTR)szGetName, - (LPVOID)&lpVersion, - (UINT *)&uVersionLen); - - if (bRetCode && uVersionLen && lpVersion) { - /* Replace dialog item text with version info */ - lstrcpy(szResult, lpVersion); - SetDlgItemText(hDlg, i, szResult); - } - else - { - dwResult = GetLastError(); - - wsprintf(szResult, GetStringRes(IDS_VERSION_ERROR), dwResult); - SetDlgItemText(hDlg, i, szResult); - } - SendMessage(GetDlgItem(hDlg, i), WM_SETFONT, - (UINT)((i==DLG_VERLAST)?hFinePrint:hfontDlg), - TRUE); - } - - - GlobalUnlock(hMem); - GlobalFree(hMem); - - } - - SendMessage(GetDlgItem(hDlg, IDC_LABEL), WM_SETFONT, - (WPARAM)hfontDlg,(LPARAM)TRUE); - if (!GetSystemOSVersion(szVersion, NULL)) - strcpy(szVersion, "Unknown Version"); - SetWindowText(GetDlgItem(hDlg, IDC_OSVERSION), szVersion); - ShowWindow(hDlg, SW_SHOW); - return (TRUE); - - case WM_COMMAND: - if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { - EndDialog(hDlg, TRUE); - DeleteObject(hfontDlg); - DeleteObject(hFinePrint); - return (TRUE); - } - break; - } - - return FALSE; -} VOID CALLBACK MainTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime) { - if (ap_rescanServices) + int nPrev = 0, nNew = 0; + if (idEvent == WM_TIMER_RESCAN) { + if (FindRunningServices() || ap_rescanServices) + { + ShowNotifyIcon(hWnd, NIM_MODIFY); + if (ap_hServiceDlg) + PostMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0); + } + /* check if services list changed */ + while (ap_stServices[nPrev].szServiceName != NULL) + ++nPrev; GetApacheServicesStatus(); - ShowNotifyIcon(hWnd, NIM_MODIFY); - if (ap_hServiceDlg) + while (ap_stServices[nNew].szServiceName != NULL) + ++nNew; + if (nPrev != nNew) { - SendMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0); - + ShowNotifyIcon(hWnd, NIM_MODIFY); + if (ap_hServiceDlg) + PostMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0); } } - else if (FindRunningServices()) + else if (idEvent == WM_TIMER_REFRESH) { - ShowNotifyIcon(hWnd, NIM_MODIFY); - if (ap_hServiceDlg) + if (ap_rescanServices) { - SendMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0); - + GetApacheServicesStatus(); + ShowNotifyIcon(hWnd, NIM_MODIFY); + if (ap_hServiceDlg) + PostMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0); + } + else if (FindRunningServices()) + { + ShowNotifyIcon(hWnd, NIM_MODIFY); + if (ap_hServiceDlg) + PostMessage(ap_hServiceDlg, WM_UPDATEMESSAGE, 0, 0); } } } @@ -1208,9 +1365,10 @@ VOID CALLBACK MainTimerProc(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime) LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { + if (message == ap_uiTaskbarCreated) { - /* reinstall tray icon */ + /* restore the tray icon on shell restart */ ShowNotifyIcon(hWnd, NIM_ADD); return DefWindowProc(hWnd, message, wParam, lParam); } @@ -1220,8 +1378,9 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, GetSystemOSVersion(NULL, &ap_OSVersion); GetApacheServicesStatus(); ShowNotifyIcon(hWnd, NIM_ADD); - SetTimer(hWnd, 10, 1000, (TIMERPROC)MainTimerProc); - ap_hServiceDlg = NULL; + SetTimer(hWnd, WM_TIMER_REFRESH, REFRESH_TIME, (TIMERPROC)MainTimerProc); + SetTimer(hWnd, WM_TIMER_RESCAN, RESCAN_TIME, (TIMERPROC)MainTimerProc); + ap_hServiceDlg = NULL; break; case WM_QUIT: ShowNotifyIcon(hWnd, NIM_DELETE); @@ -1279,7 +1438,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, } else if (ap_hwndAboutDlg) SetFocus(ap_hwndAboutDlg); - break; case IDM_EXIT: PostQuitMessage(0); @@ -1307,7 +1465,7 @@ HWND CreateMainWindow(HINSTANCE hInstance) wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_APSRVMON); - wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hCursor = ap_cArrow; wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcex.lpszMenuName = (LPCSTR)IDC_APSRVMON; wcex.lpszClassName = szWindowClass; @@ -1330,7 +1488,6 @@ int WINAPI WinMain(HINSTANCE hInstance, LPTSTR lpCmdLine, int nCmdShow) { - HWND hwnd; MSG msg; /* single instance mutex */ HANDLE hMutex = CreateMutex(NULL, FALSE, "APSRVMON_MUTEX"); @@ -1341,7 +1498,6 @@ int WINAPI WinMain(HINSTANCE hInstance, return 0; } - InitCommonControls(); ap_hInstance = hInstance; @@ -1349,12 +1505,14 @@ int WINAPI WinMain(HINSTANCE hInstance, LoadString(hInstance, IDC_APSRVMON, szWindowClass, MAX_LOADSTRING); ap_icoStop = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICOSTOP)); ap_icoRun = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICORUN)); - ap_uiTaskbarCreated = RegisterWindowMessage("TaskbarCreated"); + ap_cHourglass = LoadCursor(NULL, IDC_WAIT); + ap_cArrow = LoadCursor(NULL, IDC_ARROW); ZeroMemory(ap_stServices, sizeof(ST_APACHE_SERVICE) * MAX_APACHE_SERVICES); - hwnd = CreateMainWindow(hInstance); - if (hwnd != NULL) + ap_hMainWnd = CreateMainWindow(hInstance); + if (ap_hMainWnd != NULL) { + ap_uiTaskbarCreated = RegisterWindowMessage("TaskbarCreated"); while (GetMessage(&msg, NULL, 0, 0) == TRUE) { TranslateMessage(&msg); diff --git a/support/win32/ApacheMonitor.dsp b/support/win32/ApacheMonitor.dsp index 8699a75baa..3c9a145cec 100644 --- a/support/win32/ApacheMonitor.dsp +++ b/support/win32/ApacheMonitor.dsp @@ -1,143 +1,141 @@ -# 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 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fd"Release/ApacheMonitor" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib version.lib /nologo /subsystem:windows /map /machine:I386 - -!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 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /Fd"Debug/ApacheMonitor" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib version.lib /nologo /subsystem:windows /incremental:no /debug /machine:I386 -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "ApacheMonitor - Win32 Release" -# Name "ApacheMonitor - Win32 Debug" -# Begin Group "Resource Files" - -# PROP Default_Filter "*.rc,*.ico,*.bmp" -# Begin Source File - -SOURCE=.\apache_header.bmp -# End Source File -# Begin Source File - -SOURCE=.\ApacheMonitor.ico -# End Source File -# Begin Source File - -SOURCE=.\ApacheMonitor.rc - -!IF "$(CFG)" == "ApacheMonitor - Win32 Release" - -!ELSEIF "$(CFG)" == "ApacheMonitor - Win32 Debug" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\aprun.ico -# End Source File -# Begin Source File - -SOURCE=.\apsmall.ico -# End Source File -# Begin Source File - -SOURCE=.\apsrvmon.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 -# End Target -# End Project +# 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 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /FD /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x41a /d "NDEBUG" +# ADD RSC /l 0x41a /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib comctl32.lib /nologo /subsystem:windows /machine:I386 + +!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 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /FD /GZ /c +# SUBTRACT CPP /YX /Yc /Yu +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x41a /d "_DEBUG" +# ADD RSC /l 0x41a /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib comctl32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept + +!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.h +# End Source File +# Begin Source File + +SOURCE=.\ApacheMonitor.ico +# End Source File +# Begin Source File + +SOURCE=.\ApacheMonitor.rc +# End Source File +# Begin Source File + +SOURCE=.\aprun.ico +# End Source File +# Begin Source File + +SOURCE=.\apsmall.ico +# End Source File +# Begin Source File + +SOURCE=.\apsrvmon.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 +# End Target +# End Project diff --git a/support/win32/ApacheMonitor.h b/support/win32/ApacheMonitor.h index 4bdfc15914..0b4b280846 100644 --- a/support/win32/ApacheMonitor.h +++ b/support/win32/ApacheMonitor.h @@ -1,7 +1,3 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by ApSrvmon.rc -// #define IDD_APSRVMON_DIALOG 101 #define IDD_ABOUTBOX 102 #define IDS_APP_TITLE 103 @@ -30,20 +26,10 @@ #define IDB_BMPSTOP 155 #define IDB_BMPRUN 156 #define IDB_BMPHEADER 158 -#define IDL_SERVICES 1003 -#define IDC_SSTART 1004 -#define IDC_SSTOP 1005 -#define IDC_SRESTART 1006 -#define IDC_SUNINSTALL 1008 +#define IDL_SERVICES 1001 +#define IDL_STDOUT 1002 +#define IDC_SSTART 1003 +#define IDC_SSTOP 1004 +#define IDC_SRESTART 1005 +#define IDC_SABOUT 1006 #define IDC_STATIC -1 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 159 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1009 -#define _APS_NEXT_SYMED_VALUE 110 -#endif -#endif diff --git a/support/win32/apache_header.bmp b/support/win32/apache_header.bmp index 7b116fc3da78e14ad8201a54dfde24f841c8e04b..e840ad0d4a1bc2e1fa9e389e2381ab60b72129e1 100644 GIT binary patch literal 33566 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 delta 8 PcmbQ&#