前言
查资料知道有freerdp这个开源库,尝试编译一下。
实验
- 工程下载点
freerdp发布版本列表url
我做实验的版本是FreeRDP-2.0.0-rc4.tar.gz - 安装c++全家桶
apt-get install build-essential
- 安装freerdp依赖
apt-get install ninja-build build-essential git-core debhelper cdbs dpkg-dev autotools-dev cmake pkg-config xmlto libssl-dev docbook-xsl xsltproc libxkbfile-dev libx11-dev libwayland-dev libxrandr-dev libxi-dev libxrender-dev libxext-dev libxinerama-dev libxfixes-dev libxcursor-dev libxv-dev libxdamage-dev libxtst-dev libcups2-dev libpcsclite-dev libasound2-dev libpulse-dev libjpeg-dev libgsm1-dev libusb-1.0-0-dev libudev-dev libdbus-glib-1-dev uuid-dev libxml2-dev libgstreamer1.0-dev libgstreamer0.10-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-base0.10-dev
apt-get install libavutil-dev libavcodec-dev libavresample-dev
apt-get install libcunit1-dev libdirectfb-dev xmlto doxygen libxtst-dev
编译freerdp
cmake -GNinja -DCHANNEL_URBDRC=ON -DWITH_DSP_FFMPEG=ON -DWITH_CUPS=ON -DWITH_PULSE=ON .
cmake --build .
安装freerdp
cmake --build . --target install
查看freerdp的安装路径
root@debian8-8-bits64:/home/dev/FreeRDP-2.0.0-rc4# which xfreerdp
/usr/local/bin/xfreerdp
- 查看freerdp编译选项
需要在debian桌面环境中的终端运行’xfreerdp /buildconfig’才行
或者在SecureCRT中设置环境变量DISPLAY
export DISPLAY=:0.0
lostspeed@debian8-8-bits64:~$ xfreerdp /buildconfig
This is FreeRDP version 2.0.0-rc4 (n/a)
Build configuration: BUILD_TESTING=OFF BUILTIN_CHANNELS=ON HAVE_AIO_H=1 HAVE_EXECINFO_H=1 HAVE_FCNTL_H=1 HAVE_INTTYPES_H=1 HAVE_MATH_C99_LONG_DOUBLE=1 HAVE_POLL_H=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK=ON HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL= HAVE_SYSLOG_H=1 HAVE_SYS_EVENTFD_H=1 HAVE_SYS_FILIO_H= HAVE_SYS_MODEM_H= HAVE_SYS_SELECT_H=1 HAVE_SYS_SOCKIO_H= HAVE_SYS_STRTIO_H= HAVE_SYS_TIMERFD_H=1 HAVE_TM_GMTOFF=1 HAVE_UNISTD_H=1 HAVE_XI_TOUCH_CLASS=1 WITH_ALSA=ON WITH_CCACHE=ON WITH_CHANNELS=ON WITH_CLIENT=ON WITH_CLIENT_AVAILABLE=1 WITH_CLIENT_CHANNELS=ON WITH_CLIENT_CHANNELS_AVAILABLE=1 WITH_CLIENT_COMMON=ON WITH_CLIENT_INTERFACE=OFF WITH_CUPS=ON WITH_DEBUG_ALL=OFF WITH_DEBUG_CAPABILITIES=OFF WITH_DEBUG_CERTIFICATE=OFF WITH_DEBUG_CHANNELS=OFF WITH_DEBUG_CLIPRDR=OFF WITH_DEBUG_DVC=OFF WITH_DEBUG_KBD=OFF WITH_DEBUG_LICENSE=OFF WITH_DEBUG_MUTEX=OFF WITH_DEBUG_NEGO=OFF WITH_DEBUG_NLA=OFF WITH_DEBUG_NTLM=OFF WITH_DEBUG_RAIL=OFF WITH_DEBUG_RDP=OFF WITH_DEBUG_RDPDR=OFF WITH_DEBUG_RDPEI=OFF WITH_DEBUG_REDIR=OFF WITH_DEBUG_RFX=OFF WITH_DEBUG_RINGBUFFER=OFF WITH_DEBUG_SCARD=OFF WITH_DEBUG_SND=OFF WITH_DEBUG_SVC=OFF WITH_DEBUG_SYMBOLS=OFF WITH_DEBUG_THREADS=OFF WITH_DEBUG_TIMEZONE=OFF WITH_DEBUG_TRANSPORT=OFF WITH_DEBUG_TSG=OFF WITH_DEBUG_TSMF=OFF WITH_DEBUG_WND=OFF WITH_DEBUG_X11=OFF WITH_DEBUG_X11_CLIPRDR=OFF WITH_DEBUG_X11_LOCAL_MOVESIZE=OFF WITH_DEBUG_XV=OFF WITH_DIRECTFB=OFF WITH_DSP_EXPERIMENTAL=OFF WITH_DSP_FFMPEG=OFF WITH_EVENTFD_READ_WRITE=1 WITH_FAAC=OFF WITH_FAAD2=OFF WITH_FFMPEG=TRUE WITH_GFX_H264=ON WITH_GPROF=OFF WITH_GSM=OFF WITH_GSSAPI=OFF WITH_GSTREAMER_0_10=OFF WITH_GSTREAMER_1_0=ON WITH_ICU=OFF WITH_IPP=OFF WITH_JPEG=OFF WITH_LAME=OFF WITH_LIBRARY_VERSIONING=ON WITH_LIBSYSTEMD=OFF WITH_MACAUDIO=OFF WITH_MACAUDIO_AVAILABLE=0 WITH_MANPAGES=ON WITH_MBEDTLS=OFF WITH_OPENH264=OFF WITH_OPENSLES=OFF WITH_OPENSSL=ON WITH_OSS=ON WITH_PCSC=OFF WITH_PROFILER=OFF WITH_PULSE=ON WITH_SAMPLE=OFF WITH_SANITIZE_ADDRESS=OFF WITH_SANITIZE_ADDRESS_AVAILABLE=1 WITH_SANITIZE_MEMORY=OFF WITH_SANITIZE_MEMORY_AVAILABLE=1 WITH_SANITIZE_THREAD=OFF WITH_SANITIZE_THREAD_AVAILABLE=1 WITH_SERVER=OFF WITH_SERVER_INTERFACE=ON WITH_SMARTCARD_INSPECT=OFF WITH_SOXR=OFF WITH_SSE2=ON WITH_THIRD_PARTY=OFF WITH_VALGRIND_MEMCHECK=OFF WITH_VALGRIND_MEMCHECK_AVAILABLE=1 WITH_WAYLAND=OFF WITH_X11=ON WITH_X264=OFF WITH_XCURSOR=ON WITH_XEXT=ON WITH_XFIXES=ON WITH_XI=ON WITH_XINERAMA=ON WITH_XKBFILE=ON WITH_XRANDR=ON WITH_XRENDER=ON WITH_XSHM=ON WITH_XV=ON WITH_ZLIB=ON
Build type: Release
CFLAGS: -fPIC -Wall -Wno-unused-result -Wno-unused-but-set-variable -Wno-deprecated-declarations -fvisibility=hidden -Wimplicit-function-declaration -Wredundant-decls -DWINPR_DLL
Compiler: GNU, 4.9.2
Target architecture: x64
freerdp的库位置
lostspeed@debian8-8-bits64:~$ ls -l /usr/local/lib/ |grep freerdp
lrwxrwxrwx 1 root staff 16 12月 7 22:41 libfreerdp2.so -> libfreerdp2.so.2
lrwxrwxrwx 1 root staff 20 12月 7 22:41 libfreerdp2.so.2 -> libfreerdp2.so.2.0.0
-rw-r--r-- 1 root staff 1658000 12月 7 22:40 libfreerdp2.so.2.0.0
lrwxrwxrwx 1 root staff 23 12月 7 22:41 libfreerdp-client2.so -> libfreerdp-client2.so.2
lrwxrwxrwx 1 root staff 27 12月 7 22:41 libfreerdp-client2.so.2 -> libfreerdp-client2.so.2.0.0
-rw-r--r-- 1 root staff 887416 12月 7 22:40 libfreerdp-client2.so.2.0.0
freerdp命令行参数
root@debian8-8-bits64:~# xfreerdp --help
FreeRDP - A Free Remote Desktop Protocol Implementation
See www.freerdp.com for more information
Usage: xfreerdp [file] [options] [/v:<server>[:port]]
Syntax:
/flag (enables flag)
/option:<value> (specifies option with value)
+toggle -toggle (enables or disables toggle, where '/' is a synonym of '+')
/a:<addin>[,<options>] Addin
/action-script:<file-name> Action script
/admin Admin (or console) session
+aero Enable desktop composition
/app:<path> or ||<alias> Remote application program
/app-cmd:<parameters> Remote application command-line parameters
/app-file:<file-name> File to open with remote application
/app-guid:<app-guid> Remote application GUID
/app-icon:<icon-path> Remote application icon for user interface
/app-name:<app-name> Remote application name for user interface
/assistance:<password> Remote assistance password
+async-channels Enable Asynchronous channels (experimental)
+async-input Enable Asynchronous input
+async-update Enable Asynchronous update
/audio-mode:<mode> Audio output mode
+auth-only Enable Authenticate only
-authentication Disable Authentication (expermiental)
+auto-reconnect Enable Automatic reconnection
/auto-reconnect-max-retries:... Automatic reconnection maximum retries, 0 for unlimited [0,1000]
-bitmap-cache Disable bitmap cache
/bpp:<depth> Session bpp (color depth)
/buildconfig Print the build configuration
/cert-ignore Ignore certificate
/cert-name:<name> Certificate name
/cert-tofu Automatically accept certificate on first connect
/client-hostname:<name> Client Hostname to send to server
-clipboard Disable Redirect clipboard
/codec-cache:rfx|nsc|jpeg Bitmap codec cache
-compression Disable compression
/compression-level:<level> Compression level (0,1,2)
+credentials-delegation Enable credentials delegation
/d:<domain> Domain
-decorations Disable Window decorations
/disp Display control
/drive:<name>,<path> Redirect directory <path> as named share <name>
+drives Enable Redirect all mount points as shares
/dvc:<channel>[,<options>] Dynamic virtual channel
/dynamic-resolution Send resolution updates when the window is resized
/echo Echo channel
-encryption Disable Encryption (experimental)
/encryption-methods:... RDP standard security encryption methods
/f Fullscreen mode (<Ctrl>+<Alt>+<Enter> toggles fullscreen)
-fast-path Disable fast-path input/output
+fipsmode Enable FIPS mode
-floatbar Disable floatbar in fullscreen mode
+fonts Enable smooth fonts (ClearType)
/frame-ack:<number> Number of frame acknowledgement
/from-stdin[:force] Read credentials from stdin. With <force> the prompt is done before connection, otherwise on server request.
/g:<gateway>[:<port>] Gateway Hostname
/gateway-usage-method:direct|detect Gateway usage method
/gd:<domain> Gateway domain
/gdi:sw|hw GDI rendering
/geometry Geometry tracking channel
+gestures Enable Consume multitouch input locally
/gfx[:RFX|AVC420|AVC444] RDP8 graphics pipeline (experimental)
/gfx-h264[:AVC420|AVC444] RDP8.1 graphics pipeline using H264 codec
+gfx-progressive Enable RDP8 graphics pipeline using progressive codec
+gfx-small-cache Enable RDP8 graphics pipeline using small cache mode
+gfx-thin-client Enable RDP8 graphics pipeline using thin client mode
+glyph-cache Enable Glyph cache (experimental)
/gp:<password> Gateway password
-grab-keyboard Disable Grab keyboard
/gt:rpc|http|auto Gateway transport type
/gu:... Gateway username
/gat:<access token> Gateway Access Token
/h:<height> Height
+heartbeat Enable Support heartbeat PDUs
/help Print help
+home-drive Enable Redirect user home as share
/ipv6 Prefer IPv6 AAA record over IPv4 A record
/kbd:0x<id> or <name> Keyboard layout
/kbd-fn-key:<value> Function key value
/kbd-list List keyboard layouts
/kbd-subtype:<id> Keyboard subtype
/kbd-type:<id> Keyboard type
/load-balance-info:<info-string> Load balance info
/log-filters:... Set logger filters, see wLog(7) for details
/log-level:... Set the default log level, see wLog(7) for details
/max-fast-path-size:<size> Specify maximum fast-path update size
/max-loop-time:<time> Specify maximum time in milliseconds spend treating packets
+menu-anims Enable menu animations
/microphone[:...] Audio input (microphone)
/monitor-list List detected monitors
/monitors:<id>[,<id>[,...]] Select monitors to use
-mouse-motion Disable Send mouse motion
/multimedia[:...] Redirect multimedia (video)
/multimon[:force] Use multiple monitors
+multitouch Enable Redirect multitouch input
+multitransport Enable Support multitransport protocol
-nego Disable protocol security negotiation
/network:... Network connection type
/nsc NSCodec support
-offscreen-cache Disable offscreen bitmap cache
/orientation:0|90|180|270 Orientation of display in degrees
+old-license Enable Use the old license workflow (no CAL and hwId set to 0)
/p:<password> Password
/parallel[:<name>[,<path>]] Redirect parallel device
/parent-window:<window-id> Parent window id
+password-is-pin Enable Use smart card authentication with password as smart card PIN
/pcb:<blob> Preconnection Blob
/pcid:<id> Preconnection Id
/pheight:<height> Physical height of display (in millimeters)
/play-rfx:<pcap-file> Replay rfx pcap file
/port:<number> Server port
+print-reconnect-cookie Enable Print base64 reconnect cookie after connecting
/printer[:<name>[,<driver>]] Redirect printer device
/proxy:... Proxy settings: override env.var (see also environment variable below).
Protocol "socks5" should be given explicitly where "http" is default.
Note: socks proxy is not supported by env. variable
/pth:<password-hash> Pass the hash (restricted admin mode)
/pwidth:<width> Physical width of display (in millimeters)
/reconnect-cookie:<base64-cookie> Pass base64 reconnect cookie to the connection
/redirect-prefer:... Override the preferred redirection order
/relax-order-checks Do not check if a RDP order was announced during capability exchange, only use when connecting to a buggy server
/restricted-admin Restricted admin mode
/rfx RemoteFX
/rfx-mode:image|video RemoteFX mode
/scale:100|140|180 Scaling factor of the display
/scale-desktop:<percentage> Scaling factor for desktop applications (value between 100 and 500)
/scale-device:100|140|180 Scaling factor for app store applications
/sec:rdp|tls|nla|ext Force specific protocol security
+sec-ext Enable NLA extended protocol security
-sec-nla Disable NLA protocol security
-sec-rdp Disable RDP protocol security
-sec-tls Disable TLS protocol security
/serial[:...] Redirect serial device
/shell:<shell> Alternate shell
/shell-dir:<dir> Shell working directory
/size:... Screen size
/smart-sizing[:<width>x<height>] Scale remote desktop to window size
/smartcard[:<str>[,<str>…]] Redirect the smartcard devices containing any of the <str> in their names.
/smartcard-logon Activates Smartcard Logon authentication. (EXPERIMENTAL: NLA not supported)
/sound[:...] Audio output (sound)
/span Span screen over multiple monitors
/spn-class:<service-class> SPN authentication service class
/ssh-agent SSH Agent forwarding channel
/t:<title> Window title
-themes Disable themes
/tls-ciphers:netmon|ma|ciphers Allowed TLS ciphers
/tls-seclevel:<level> TLS security level - defaults to 1
-toggle-fullscreen Disable Alt+Ctrl+Enter toggles fullscreen
/u:... Username
+unmap-buttons Enable Let server see real physical pointer button
/usb:... Redirect USB device
/v:<server>[:port] Server hostname
/vc:<channel>[,<options>] Static virtual channel
/version Print version
/video Video optimized remoting channel
/vmconnect[:<vmid>] Hyper-V console (use port 2179, disable negotiation)
/w:<width> Width
-wallpaper Disable wallpaper
+window-drag Enable full window drag
/window-position:<xpos>x<ypos> window position
/wm-class:<class-name> Set the WM_CLASS hint for the window instance
/workarea Use available work area
Examples:
xfreerdp connection.rdp /p:Pwd123! /f
xfreerdp /u:CONTOSO\JohnDoe /p:Pwd123! /v:rdp.contoso.com
xfreerdp /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192.168.1.100:4489
xfreerdp /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 /v:192.168.1.100
Clipboard Redirection: +clipboard
Drive Redirection: /drive:home,/home/user
Smartcard Redirection: /smartcard:<device>
Serial Port Redirection: /serial:<name>,<device>,[SerCx2|SerCx|Serial],[permissive]
Serial Port Redirection: /serial:COM1,/dev/ttyS0
Parallel Port Redirection: /parallel:<name>,<device>
Printer Redirection: /printer:<device>,<driver>
Audio Output Redirection: /sound:sys:oss,dev:1,format:1
Audio Output Redirection: /sound:sys:alsa
Audio Input Redirection: /microphone:sys:oss,dev:1,format:1
Audio Input Redirection: /microphone:sys:alsa
Multimedia Redirection: /multimedia:sys:oss,dev:/dev/dsp1,decoder:ffmpeg
Multimedia Redirection: /multimedia:sys:alsa
USB Device Redirection: /usb:id,dev:054c:0268
For Gateways, the https_proxy environment variable is respected:
export https_proxy=http://proxy.contoso.com:3128/
xfreerdp /g:rdp.contoso.com ...
More documentation is coming, in the meantime consult source files
测试用xfreerdp连接远程的windows
rdp协议的默认端口是3389
xfreerdp /u:administrator /p:my_pwd /v:192.168.2.61
在debian桌面的控制台中运行上述命令,就直接打开了远程桌面,可以直接操作远程windows了。
为了调试源码-确定编译的debug选项
root@debian8-8-bits64:/home/dev/FreeRDP-2.0.0-rc4# cmake -L . | grep WITH_DEBUG
FREERDP_VERSION=2.0.0-rc4
CMake Warning at CMakeLists.txt:911 (message):
FFmpeg version detected (56.1.0) is too old. (Require at least 57.48.101
for sound). Deactivating
WITH_DEBUG_ALL:BOOL=OFF
WITH_DEBUG_CAPABILITIES:BOOL=OFF
WITH_DEBUG_CERTIFICATE:BOOL=OFF
WITH_DEBUG_CHANNELS:BOOL=OFF
WITH_DEBUG_CLIPRDR:BOOL=OFF
WITH_DEBUG_DVC:BOOL=OFF
WITH_DEBUG_KBD:BOOL=OFF
WITH_DEBUG_LICENSE:BOOL=OFF
WITH_DEBUG_MUTEX:BOOL=OFF
WITH_DEBUG_NEGO:BOOL=OFF
WITH_DEBUG_NLA:BOOL=OFF
WITH_DEBUG_NTLM:BOOL=OFF
WITH_DEBUG_RAIL:BOOL=OFF
WITH_DEBUG_RDP:BOOL=OFF
WITH_DEBUG_RDPDR:BOOL=OFF
WITH_DEBUG_RDPEI:BOOL=OFF
WITH_DEBUG_REDIR:BOOL=OFF
WITH_DEBUG_RFX:BOOL=OFF
WITH_DEBUG_RINGBUFFER:BOOL=OFF
WITH_DEBUG_SCARD:BOOL=OFF
WITH_DEBUG_SND:BOOL=OFF
WITH_DEBUG_SVC:BOOL=OFF
WITH_DEBUG_SYMBOLS:BOOL=OFF
WITH_DEBUG_THREADS:BOOL=OFF
WITH_DEBUG_TIMEZONE:BOOL=OFF
WITH_DEBUG_TRANSPORT:BOOL=OFF
WITH_DEBUG_TSG:BOOL=OFF
WITH_DEBUG_TSMF:BOOL=OFF
WITH_DEBUG_WND:BOOL=OFF
WITH_DEBUG_X11:BOOL=OFF
WITH_DEBUG_X11_CLIPRDR:BOOL=OFF
WITH_DEBUG_X11_LOCAL_MOVESIZE:BOOL=OFF
WITH_DEBUG_XV:BOOL=OFF
重新编译debug版
加入以下选项
-DCMAKE_BUILD_TYPE=Debug
WITH_DEBUG_ALL=ON
cmake -DCMAKE_BUILD_TYPE=Debug -GNinja -DCHANNEL_URBDRC=ON -DWITH_DSP_FFMPEG=ON -DWITH_CUPS=ON -DWITH_PULSE=ON WITH_DEBUG_ALL=ON .
cmake --build .
cmake --build . --target install
./client/X11/xfreerdp /buildconfig
可以看到,已经是debug版了
root@debian8-8-bits64:/home/dev/FreeRDP-2.0.0-rc4# ./client/X11/xfreerdp /buildconfig
This is FreeRDP version 2.0.0-rc4 (n/a)
Build configuration: BUILD_TESTING=OFF BUILTIN_CHANNELS=ON HAVE_AIO_H=1 HAVE_EXECINFO_H=1 HAVE_FCNTL_H=1 HAVE_INTTYPES_H=1 HAVE_MATH_C99_LONG_DOUBLE=1 HAVE_POLL_H=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK=ON HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB=1 HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL= HAVE_SYSLOG_H=1 HAVE_SYS_EVENTFD_H=1 HAVE_SYS_FILIO_H= HAVE_SYS_MODEM_H= HAVE_SYS_SELECT_H=1 HAVE_SYS_SOCKIO_H= HAVE_SYS_STRTIO_H= HAVE_SYS_TIMERFD_H=1 HAVE_TM_GMTOFF=1 HAVE_UNISTD_H=1 HAVE_XI_TOUCH_CLASS=1 WITH_ALSA=ON WITH_CCACHE=ON WITH_CHANNELS=ON WITH_CLIENT=ON WITH_CLIENT_AVAILABLE=1 WITH_CLIENT_CHANNELS=ON WITH_CLIENT_CHANNELS_AVAILABLE=1 WITH_CLIENT_COMMON=ON WITH_CLIENT_INTERFACE=OFF WITH_CUPS=ON WITH_DEBUG_ALL=OFF WITH_DEBUG_CAPABILITIES=OFF WITH_DEBUG_CERTIFICATE=OFF WITH_DEBUG_CHANNELS=OFF WITH_DEBUG_CLIPRDR=OFF WITH_DEBUG_DVC=OFF WITH_DEBUG_KBD=OFF WITH_DEBUG_LICENSE=OFF WITH_DEBUG_MUTEX=OFF WITH_DEBUG_NEGO=OFF WITH_DEBUG_NLA=OFF WITH_DEBUG_NTLM=OFF WITH_DEBUG_RAIL=OFF WITH_DEBUG_RDP=OFF WITH_DEBUG_RDPDR=OFF WITH_DEBUG_RDPEI=OFF WITH_DEBUG_REDIR=OFF WITH_DEBUG_RFX=OFF WITH_DEBUG_RINGBUFFER=OFF WITH_DEBUG_SCARD=OFF WITH_DEBUG_SND=OFF WITH_DEBUG_SVC=OFF WITH_DEBUG_SYMBOLS=OFF WITH_DEBUG_THREADS=OFF WITH_DEBUG_TIMEZONE=OFF WITH_DEBUG_TRANSPORT=OFF WITH_DEBUG_TSG=OFF WITH_DEBUG_TSMF=OFF WITH_DEBUG_WND=OFF WITH_DEBUG_X11=OFF WITH_DEBUG_X11_CLIPRDR=OFF WITH_DEBUG_X11_LOCAL_MOVESIZE=OFF WITH_DEBUG_XV=OFF WITH_DIRECTFB=OFF WITH_DSP_EXPERIMENTAL=OFF WITH_DSP_FFMPEG=OFF WITH_EVENTFD_READ_WRITE=1 WITH_FAAC=OFF WITH_FAAD2=OFF WITH_FFMPEG=TRUE WITH_GFX_H264=ON WITH_GPROF=OFF WITH_GSM=OFF WITH_GSSAPI=OFF WITH_GSTREAMER_0_10=OFF WITH_GSTREAMER_1_0=ON WITH_ICU=OFF WITH_IPP=OFF WITH_JPEG=OFF WITH_LAME=OFF WITH_LIBRARY_VERSIONING=ON WITH_LIBSYSTEMD=OFF WITH_MACAUDIO=OFF WITH_MACAUDIO_AVAILABLE=0 WITH_MANPAGES=ON WITH_MBEDTLS=OFF WITH_OPENH264=OFF WITH_OPENSLES=OFF WITH_OPENSSL=ON WITH_OSS=ON WITH_PCSC=OFF WITH_PROFILER=OFF WITH_PULSE=ON WITH_SAMPLE=OFF WITH_SANITIZE_ADDRESS=OFF WITH_SANITIZE_ADDRESS_AVAILABLE=1 WITH_SANITIZE_MEMORY=OFF WITH_SANITIZE_MEMORY_AVAILABLE=1 WITH_SANITIZE_THREAD=OFF WITH_SANITIZE_THREAD_AVAILABLE=1 WITH_SERVER=OFF WITH_SERVER_INTERFACE=ON WITH_SMARTCARD_INSPECT=OFF WITH_SOXR=OFF WITH_SSE2=ON WITH_THIRD_PARTY=OFF WITH_VALGRIND_MEMCHECK=OFF WITH_VALGRIND_MEMCHECK_AVAILABLE=1 WITH_WAYLAND=OFF WITH_X11=ON WITH_X264=OFF WITH_XCURSOR=ON WITH_XEXT=ON WITH_XFIXES=ON WITH_XI=ON WITH_XINERAMA=ON WITH_XKBFILE=ON WITH_XRANDR=ON WITH_XRENDER=ON WITH_XSHM=ON WITH_XV=ON WITH_ZLIB=ON
Build type: Debug
CFLAGS: -fPIC -Wall -Wno-unused-result -Wno-unused-but-set-variable -Wno-deprecated-declarations -fvisibility=hidden -Wimplicit-function-declaration -Wredundant-decls -g -DWINPR_DLL
Compiler: GNU, 4.9.2
Target architecture: x64
调试
gdb -tui --args ./client/X11/xfreerdp /u:administrator /p:111111 /v:192.168.2.61 +auth-only
好使,可以单步调试了。
登录的代码
\FreeRDP-2.0.0-rc4\client\X11\xf_client.c
static DWORD WINAPI xf_client_thread(LPVOID param)
{
BOOL status;
DWORD exit_code = 0;
DWORD nCount;
DWORD waitStatus;
HANDLE handles[64];
xfContext* xfc;
freerdp* instance;
rdpContext* context;
HANDLE inputEvent = NULL;
HANDLE inputThread = NULL;
HANDLE timer = NULL;
LARGE_INTEGER due;
rdpSettings* settings;
TimerEventArgs timerEvent;
EventArgsInit(&timerEvent, "xfreerdp");
instance = (freerdp*) param;
context = instance->context;
status = freerdp_connect(instance); // 仅仅是连接rdp服务器, 并没有去拿用户名和口令去登录。
// freerdp_connect执行成功了,也仅说明rdp服务器的ip给的对。
xfc = (xfContext*) instance->context;
if (!status)
{
if (freerdp_get_last_error(instance->context) ==
FREERDP_ERROR_AUTHENTICATION_FAILED)
exit_code = XF_EXIT_AUTH_FAILURE;
else if (freerdp_get_last_error(instance->context) == FREERDP_ERROR_SECURITY_NEGO_CONNECT_FAILED)
exit_code = XF_EXIT_NEGO_FAILURE;
else
exit_code = XF_EXIT_CONN_FAILED;
}
else
exit_code = XF_EXIT_SUCCESS;
if (!status)
goto end;
断开连接
freerdp_disconnect(instance);