}
-int am_RespawnAsUserAdmin(HWND hwnd, DWORD op, LPCTSTR szService,
+int am_RespawnAsUserAdmin(HWND hwnd, DWORD op, LPCTSTR szService,
LPCTSTR szComputerName)
{
TCHAR args[MAX_PATH + MAX_COMPUTERNAME_LENGTH + 12];
return 0;
}
- _sntprintf(args, sizeof(args) / sizeof(TCHAR),
+ _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)) {
}
if (RegConnectRegistry(szComputerName, HKEY_LOCAL_MACHINE, &hKeyRemote)
!= ERROR_SUCCESS) {
- _sntprintf(szTmp, sizeof(szTmp) / sizeof(TCHAR),
+ _sntprintf(szTmp, sizeof(szTmp) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_ECONNECT - IDS_MSG_FIRST],
szComputerName);
ErrorMessage(szTmp, FALSE);
if (osvi.dwMajorVersion >= 5)
*dwVersion = OS_VERSION_WIN2K;
else
- *dwVersion = OS_VERSION_WINNT;
+ *dwVersion = OS_VERSION_WINNT;
break;
case VER_PLATFORM_WIN32_WINDOWS:
_tcscpy(nid.szTip, g_lpMsg[IDS_MSG_RUNNINGALL - IDS_MSG_FIRST]);
}
else if (n) {
- _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
+ _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),
+ _sntprintf(nid.szTip, sizeof(nid.szTip) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_RUNNINGNONE - IDS_MSG_FIRST], i);
}
else {
{
TCHAR szMsg[MAX_PATH];
BOOL retValue;
- BOOL serviceFlag = TRUE;
SC_HANDLE schService;
SC_HANDLE schSCManager;
SERVICE_STATUS schSStatus;
{
/* Avoid recursion of ImagePath NULL (from this Respawn) */
if (szImagePath) {
- am_RespawnAsUserAdmin(g_hwndMain, dwCommand,
+ am_RespawnAsUserAdmin(g_hwndMain, dwCommand,
szServiceName, szComputerName);
}
else {
switch (dwCommand)
{
case SERVICE_CONTROL_STOP:
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_SRVSTOP - IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
if (schSStatus.dwCurrentState == SERVICE_STOPPED)
{
retValue = TRUE;
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_SRVSTOPPED - IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
if (schSStatus.dwCurrentState == SERVICE_RUNNING)
{
retValue = TRUE;
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ _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),
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_SRVRESTART - IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
if (schSStatus.dwCurrentState == SERVICE_RUNNING)
{
retValue = TRUE;
- _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
+ _sntprintf(szMsg, sizeof(szMsg) / sizeof(TCHAR),
g_lpMsg[IDS_MSG_SRVRESTARTED - IDS_MSG_FIRST],
szServiceName);
addListBoxString(g_hwndStdoutList, szMsg);
g_lpMsg[IDS_MSG_SERVICES - IDS_MSG_FIRST]);
SetWindowText(GetDlgItem(hDlg, IDC_SCONNECT),
g_lpMsg[IDS_MSG_CONNECT - IDS_MSG_FIRST]);
- SetWindowText(GetDlgItem(hDlg, IDC_SEXIT),
- g_lpMsg[IDS_MSG_MNUEXIT - 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 */
}
switch (lpdis->itemAction)
{
+ case ODA_FOCUS:
case ODA_SELECT:
case ODA_DRAWENTIRE:
g_hBmpPicture = (HBITMAP)SendMessage(lpdis->hwndItem,
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);
}
{
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 {
else {
SendMessage(hStatusBar, SB_SETTEXT, 0, (LPARAM)_T(""));
}
- SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
- SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT));
- FillRect(lpdis->hDC, &rcBitmap, (HBRUSH)(COLOR_HIGHLIGHTTEXT));
+ 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
{
}
TextOut(lpdis->hDC, XBITMAP + 6, y, szBuf, (int)_tcslen(szBuf));
break;
-
- case ODA_FOCUS:
- break;
}
return TRUE;
case WM_COMMAND:
}
break;
- case IDOK:
+ case IDCANCEL:
EndDialog(hDlg, TRUE);
return TRUE;
}
return TRUE;
- case IDC_SEXIT:
- EndDialog(hDlg, TRUE);
- SendMessage(g_hwndMain, WM_COMMAND, (WPARAM)IDM_EXIT, 0);
- return TRUE;
-
case IDC_SCONNECT:
DialogBox(g_hInstance, MAKEINTRESOURCE(IDD_DLGCONNECT),
hDlg, (DLGPROC)ConnectDlgProc);
case WM_TIMER_REFRESH:
{
- int nPrev = 0, nNew = 0;
EnterCriticalSection(&g_stcSection);
if (g_bRescanServices)
{
int exitcode = 0;
PWTS_PROCESS_INFO tsProcs;
DWORD tsProcCount, i;
- DWORD thisProcId;
+ DWORD thisProcId;
/* This is graceful, close our own Window, clearing the icon */
if ((appwindow = FindWindow(g_szWindowClass, g_szTitle)) != NULL)
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,
+ WTSTerminateProcess(WTS_CURRENT_SERVER_HANDLE,
tsProcs[i].ProcessId, 1);
}
WTSFreeMemory(tsProcs);