void GeneralTab_OnRefresh (HWND hDlg, BOOL fRequery) { // If necessary, update any fields in g.Configuration that we care about // if (fRequery) { if (g.fIsWinNT) Config_GetGatewayFlag (&g.Configuration.fBeGateway); else Config_GetGatewayName (g.Configuration.szGateway); Config_GetCellName (g.Configuration.szCell); g.Configuration.fLogonAuthent=RWLogonOption(TRUE,LOGON_OPTION_INTEGRATED); Config_GetTrayIconFlag (&g.Configuration.fShowTrayIcon); if (!g.fIsWinNT) SetDlgItemText (hDlg, IDC_GATEWAY, g.Configuration.szGateway); else CheckDlgButton (hDlg, IDC_GATEWAY, g.Configuration.fBeGateway); SetDlgItemText (hDlg, IDC_CELL, g.Configuration.szCell); CheckDlgButton (hDlg, IDC_LOGON, g.Configuration.fLogonAuthent); CheckDlgButton (hDlg, IDC_TRAYICON, g.Configuration.fShowTrayIcon); } // Update our display of the service's status // DWORD CurrentState = Config_GetServiceState(); BOOL fIfServiceStopped = !(g.fIsWinNT && !g.fIsAdmin); BOOL fIfServiceRunning = fIfServiceStopped && (CurrentState == SERVICE_RUNNING); GeneralTab_ShowCurrentState (hDlg); EnableWindow (GetDlgItem (hDlg, IDC_CELL), fIfServiceStopped && g.fIsWinNT); EnableWindow (GetDlgItem (hDlg, IDC_LOGON), fIfServiceStopped); EnableWindow (GetDlgItem (hDlg, IDC_GATEWAY), fIfServiceStopped); // Update our warning. Note that under WinNT, this tab doesn't have any // controls (other than Start Service) which disable just because the // service isn't running...so don't show that warning in that case. // TCHAR szText[ cchRESOURCE ]; if ((!g.fIsWinNT) && (CurrentState != SERVICE_RUNNING)) { GetString (szText, IDS_WARN_STOPPED); SetDlgItemText (hDlg, IDC_WARN, szText); ShowWindow (GetDlgItem (hDlg, IDC_WARN), SW_SHOW); } else if (g.fIsWinNT && !g.fIsAdmin) { GetString (szText, IDS_WARN_ADMIN); SetDlgItemText (hDlg, IDC_WARN, szText); ShowWindow (GetDlgItem (hDlg, IDC_WARN), SW_SHOW); } else // ((CurrentState == SERVICE_RUNNING) && (g.fIsAdmin)) { ShowWindow (GetDlgItem (hDlg, IDC_WARN), SW_HIDE); } GeneralTab_OnGateway (hDlg); // If the service isn't running/stopped, we may need to complain // if ((CurrentState == SERVICE_RUNNING) && (l.fWarnIfNotStopped)) { Message (MB_ICONHAND, GetErrorTitle(), IDS_SERVICE_FAIL_STOP, TEXT("%08lX"), ERROR_SERVICE_SPECIFIC_ERROR); } else if ((CurrentState == SERVICE_STOPPED) && (l.fWarnIfStopped)) { Message (MB_ICONHAND, GetErrorTitle(), IDS_SERVICE_FAIL_START, TEXT("%08lX"), ERROR_SERVICE_SPECIFIC_ERROR); } if ((CurrentState == SERVICE_RUNNING) || (CurrentState == SERVICE_STOPPED)) { BOOL fRestart = ((CurrentState == SERVICE_STOPPED) && (l.fRestartIfStopped)); l.fWarnIfStopped = FALSE; l.fWarnIfNotStopped = FALSE; l.fRestartIfStopped = FALSE; l.fServiceIsRunning = (CurrentState == SERVICE_RUNNING); if (fRestart) { GeneralTab_DoStartStop (hDlg, TRUE, FALSE); } } }
void SetBitLogonOption(BOOL set,DWORD value) { RWLogonOption(FALSE,((set)?value | RWLogonOption(TRUE,0):RWLogonOption(TRUE,0) & ~value) ); }