void vncPropertiesPoll::SaveToIniFile() { bool use_uac=false; if (!myIniFile.IsWritable()) { myIniFile.IniFileSetTemp( m_Tempfile); if (!myIniFile.IsWritable()) { vnclog.Print(LL_INTERR, VNCLOG("file %s not writable, error saving new settings\n"), m_Tempfile); return; } if (!Copy_to_Temp(m_Tempfile)) { vnclog.Print(LL_INTERR, VNCLOG("file %s not writable, error saving new settings\n"), m_Tempfile); return; } SaveUserPrefsPollToIniFile(); myIniFile.copy_to_secure(); myIniFile.IniFileSetSecure(); } SaveUserPrefsPollToIniFile(); }
BOOL CALLBACK vncSetAuth::DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) { // We use the dialog-box's USERDATA to store a _this pointer // This is set only once WM_INITDIALOG has been recieved, though! vncSetAuth *_this = helper::SafeGetWindowUserData<vncSetAuth>(hwnd); switch (uMsg) { case WM_INITDIALOG: { // Retrieve the Dialog box parameter and use it as a pointer // to the calling vncProperties object helper::SafeSetWindowUserData(hwnd, lParam); _this = (vncSetAuth *) lParam; SetDlgItemText(hwnd, IDC_GROUP1, _this->pszgroup1); SetDlgItemText(hwnd, IDC_GROUP2, _this->pszgroup2); SetDlgItemText(hwnd, IDC_GROUP3, _this->pszgroup3); if (_this->locdom1==1 || _this->locdom1==3) { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG1L); SendMessage(hG1l,BM_SETCHECK,true,0); } else { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG1L); SendMessage(hG1l,BM_SETCHECK,false,0); } if (_this->locdom1==2 || _this->locdom1==3) { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG1D); SendMessage(hG1l,BM_SETCHECK,true,0); } else { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG1D); SendMessage(hG1l,BM_SETCHECK,false,0); } if (_this->locdom2==1 || _this->locdom2==3) { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG2L); SendMessage(hG1l,BM_SETCHECK,true,0); } else { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG2L); SendMessage(hG1l,BM_SETCHECK,false,0); } if (_this->locdom2==2 || _this->locdom2==3) { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG2D); SendMessage(hG1l,BM_SETCHECK,true,0); } else { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG2D); SendMessage(hG1l,BM_SETCHECK,false,0); } if (_this->locdom3==1 || _this->locdom3==3) { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG3L); SendMessage(hG1l,BM_SETCHECK,true,0); } else { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG3L); SendMessage(hG1l,BM_SETCHECK,false,0); } if (_this->locdom3==2 || _this->locdom3==3) { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG3D); SendMessage(hG1l,BM_SETCHECK,true,0); } else { HWND hG1l = GetDlgItem(hwnd, IDC_CHECKG3D); SendMessage(hG1l,BM_SETCHECK,false,0); } //already handled by vncproperties //if we get at thgis place //IDC_MSLOGON_CHECKD was checked /*HWND hMSLogon = GetDlgItem(hwnd, IDC_MSLOGON_CHECKD); SendMessage(hMSLogon, BM_SETCHECK, _this->m_server->MSLogonRequired(), 0); if (SendMessage(hMSLogon, BM_GETCHECK,0, 0) == BST_CHECKED) { EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1D), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2D), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3D), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1L), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2L), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3L), true); EnableWindow(GetDlgItem(hwnd, IDC_GROUP1), true); EnableWindow(GetDlgItem(hwnd, IDC_GROUP2), true); EnableWindow(GetDlgItem(hwnd, IDC_GROUP3), true); } else { EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1D), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2D), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3D), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1L), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2L), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3L), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_GROUP1), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_GROUP2), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_GROUP3), FALSE); }*/ // Show the dialog SetForegroundWindow(hwnd); _this->m_dlgvisible = TRUE; return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: EndDialog(hwnd, TRUE); _this->m_dlgvisible = FALSE; return TRUE; case IDOK: { _this->locdom1=0; _this->locdom2=0; _this->locdom3=0; if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG1L),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom1=_this->locdom1+1; if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG1D),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom1=_this->locdom1+2; if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG2L),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom2=_this->locdom2+1; if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG2D),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom2=_this->locdom2+2; if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG3L),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom3=_this->locdom3+1; if (SendMessage(GetDlgItem(hwnd, IDC_CHECKG3D),BM_GETCHECK,0,0) == BST_CHECKED) _this->locdom3=_this->locdom3+2; GetDlgItemText(hwnd, IDC_GROUP1, (LPSTR) _this->pszgroup1, 240); GetDlgItemText(hwnd, IDC_GROUP2, (LPSTR) _this->pszgroup2, 240); GetDlgItemText(hwnd, IDC_GROUP3, (LPSTR) _this->pszgroup3, 240); bool use_uac=false; if (!_this->myIniFile.IsWritable() || vncService::RunningAsService() ) { // We can't write to the ini file , Vista in service mode if (!Copy_to_Temp(_this->m_Tempfile)) { // temp is not writable, we need to close else // ini get overwritten by default EndDialog(hwnd, TRUE); _this->m_dlgvisible = FALSE; return TRUE; } _this->myIniFile.IniFileSetTemp(_this->m_Tempfile); use_uac=true; } _this->savegroup1(_this->pszgroup1); _this->savegroup2(_this->pszgroup2); _this->savegroup3(_this->pszgroup3); _this->savelocdom1(_this->locdom1); _this->savelocdom2(_this->locdom2); _this->savelocdom3(_this->locdom3); if (use_uac==true) { _this->myIniFile.copy_to_secure(); _this->myIniFile.IniFileSetSecure(); } EndDialog(hwnd, TRUE); _this->m_dlgvisible = FALSE; return TRUE; } // rdv not needed, already handled by vncproperties // /*case IDC_MSLOGON_CHECKD: { HWND hMSLogon = GetDlgItem(hwnd, IDC_MSLOGON_CHECKD); _this->m_server->RequireMSLogon(SendMessage(hMSLogon, BM_GETCHECK, 0, 0) == BST_CHECKED); if (SendMessage(hMSLogon, BM_GETCHECK,0, 0) == BST_CHECKED) { EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1D), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2D), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3D), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1L), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2L), true); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3L), true); EnableWindow(GetDlgItem(hwnd, IDC_GROUP1), true); EnableWindow(GetDlgItem(hwnd, IDC_GROUP2), true); EnableWindow(GetDlgItem(hwnd, IDC_GROUP3), true); } else { EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1D), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2D), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3D), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG1L), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG2L), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHECKG3L), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_GROUP1), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_GROUP2), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_GROUP3), FALSE); } }*/ } break; case WM_DESTROY: EndDialog(hwnd, FALSE); _this->m_dlgvisible = FALSE; return TRUE; } return 0; }