3389連接埠是Windows 2000(2003) Server 遠端桌面的服務連接埠,可以通過這個連接埠,用"遠端桌面"等串連工具來串連到遠端伺服器,如果串連上了,輸入系統管理員的使用者名稱和密碼後,將變得可以像操作本機一樣操作遠端電腦,因此遠程伺服器一般都將這個連接埠修改數值或者關閉。
3389連接埠的關閉:
首先說明3389連接埠是windows的遠端管理終端所開的連接埠,它並不是一個木馬程式,請先確定該服務是否是你自己開放的。
如果不是必須的,建議關閉該服務。
win2000 server 開始-->程式-->管理工具-->服務裡找到Terminal Services服務項,選中屬性選項將啟動類型改成手動,並停止該服務。
win2000 pro 開始-->設定-->控制台-->管理工具-->服務裡找到Terminal Services服務項,選中屬性選項將啟動類型改成手動,並停止該服務。
windows xp關閉的方法:在我的電腦上點右鍵選屬性-->遠程,將裡面的遠程協助和遠端桌面兩個選項框裡的勾去掉
我們下面編程實現3389遠程登入遠端桌面。
#include <windows.h>//#include <winuser.h>int _stdcall WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd){HWND MessageBoxHandle,MessageBoxHandle1;POINT pt;char* MstscCommandLine = "mstsc.exe c:\\Default.rdp \/w 1024 \/h 768";WinExec(MstscCommandLine,SW_SHOW); //串連3389for (int i = 0; i<20;i++){//尋找視窗控制代碼MessageBoxHandle1 = FindWindow("TSSHELLWND",NULL);MessageBoxHandle = FindWindowEx(MessageBoxHandle1,0,"TSCAXHOST",NULL);MessageBoxHandle = FindWindowEx(MessageBoxHandle,0,"ATL:6A688220",NULL);MessageBoxHandle = FindWindowEx(MessageBoxHandle,0,"UIMainClass",NULL); MessageBoxHandle = FindWindowEx(MessageBoxHandle,0,"UIContainerClass",NULL);MessageBoxHandle = FindWindowEx(MessageBoxHandle,0,"OPWindowClass",NULL);//MessageBoxHandle = FindWindowEx(0,0,0,"Default - 192.168.123.117 - 遠端桌面");if (MessageBoxHandle){Sleep(2000);//以下發送訊息的代碼未能測試成功,注釋了 /*LRESULT returnvalue = SendMessage(MessageBoxHandle,WM_KEYDOWN,VK_F1,1L); SendMessage(MessageBoxHandle,WM_CHAR,'I',0); Sleep(1000); SendMessage(MessageBoxHandle,WM_CHAR,'I',1); SendMessage(MessageBoxHandle,WM_CHAR,13,NULL); SendMessage(MessageBoxHandle,WM_KEYDOWN,VK_CONTROL,1);*/SetForegroundWindow(MessageBoxHandle1); SendMessage(MessageBoxHandle1,WM_SYSCOMMAND,SC_MAXIMIZE,0); Sleep(1000);mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0); Sleep(1000); mouse_event(MOUSEEVENTF_RIGHTDOWN|MOUSEEVENTF_RIGHTUP,0,0,0,0); Sleep(1000); GetCursorPos(&pt); SetCursorPos(pt.x + 20,pt.y+95); mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0); Sleep(1000); GetCursorPos(&pt); SetCursorPos(pt.x + 164,pt.y); mouse_event(MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP,0,0,0,0); break;}Sleep(100);}return 0;}