From: Cliff Woolley Date: Tue, 7 Aug 2001 19:54:10 +0000 (+0000) Subject: This is a nearly blind commit of an update posted by Mladen Turk just X-Git-Tag: 2.0.23~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c8044a5cdb6bee1379b9cf4e3a44c6126fa7fd2;p=apache 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 --- 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 7b116fc3da..e840ad0d4a 100644 Binary files a/support/win32/apache_header.bmp and b/support/win32/apache_header.bmp differ