//------------------------------------------------------------------------------ void simple_gui::import_rectangle(const uint32_t & p_x,const uint32_t & p_y, const uint32_t & p_width, const uint32_t & p_height,void* p_data) { SDL_Rect l_src_rect; l_src_rect.x = 0; l_src_rect.y = 0; l_src_rect.w = p_width * m_coef; l_src_rect.h = p_height * m_coef ; SDL_Rect l_dst_rect; l_dst_rect.x = p_x * m_coef; l_dst_rect.y = p_y * m_coef; l_dst_rect.w = p_width * m_coef; l_dst_rect.h = p_height * m_coef; int l_status = SDL_BlitSurface((SDL_Surface*)p_data,&l_src_rect,m_screen,&l_dst_rect); if(!l_status) return; std::string l_error_message(SDL_GetError()); throw quicky_exception::quicky_logic_exception(l_error_message,__LINE__,__FILE__); }
//------------------------------------------------------------------------------ void * simple_gui::export_rectangle(const uint32_t & p_x,const uint32_t & p_y, const uint32_t & p_width, const uint32_t & p_height) { SDL_Surface * l_surface = SDL_CreateRGBSurface(0,m_coef*p_width,m_coef*p_height,32,0,0,0,0); SDL_Rect l_src_rect; l_src_rect.x = p_x * m_coef; l_src_rect.y = p_y * m_coef; l_src_rect.w = p_width * m_coef; l_src_rect.h = p_height * m_coef; SDL_Rect l_dst_rect; l_dst_rect.x = 0; l_dst_rect.y = 0; l_dst_rect.w = p_width * m_coef; l_dst_rect.h = p_height * m_coef; int l_status = SDL_BlitSurface(m_screen,&l_src_rect,l_surface,&l_dst_rect); if(!l_status) return l_surface; std::string l_error_message(SDL_GetError()); throw quicky_exception::quicky_logic_exception(l_error_message,__LINE__,__FILE__); }
LRESULT NetworkPage::onAddWinFirewallException(WORD /* wNotifyCode */, WORD /*wID*/, HWND /* hWndCtl */, BOOL& /* bHandled */) { TCHAR l_app_path[MAX_PATH]; l_app_path[0] = 0; ::GetModuleFileName(NULL, l_app_path, MAX_PATH); #ifdef FLYLINKDC_USE_SSA_WINFIREWALL try { WinFirewall::WindowFirewallSetAppAuthorization(Text::toT(APPNAME).c_str(), l_app_path); } catch (...) { } #else // http://www.dslreports.com/faq/dc/3.1_Software_Firewalls talk_base::WinFirewall fw; HRESULT hr = {0}; HRESULT hr_auth = {0}; bool authorized = true; fw.Initialize(&hr); // TODO - try // https://github.com/zhaozongzhe/gmDev/blob/70a1a871bb350860bdfff46c91913815184badd6/gmSetup/fwCtl.cpp const auto l_res = fw.AddApplicationW(l_app_path, Text::toT(APPNAME).c_str(), authorized, &hr_auth); // "C:\\vc10\\r5xx\\compiled\\FlylinkDC_Debug.exe" if (l_res) { ::MessageBox(NULL, Text::toT("FlylinkDC_Debug.exe - OK").c_str(), _T("Windows Firewall"), MB_OK | MB_ICONINFORMATION); } else { _com_error l_error_message(hr_auth); tstring l_message = _T("FlylinkDC++ module: "); l_message += l_app_path; l_message += Text::toT("\r\nError code = " + Util::toString(hr_auth) + "\r\nError text = ") + l_error_message.ErrorMessage(); ::MessageBox(NULL, l_message.c_str(), _T("Windows Firewall"), MB_OK | MB_ICONERROR); } #endif TestWinFirewall(); return 0; }