Compare commits

...

142 Commits

Author SHA1 Message Date
Bernhard Miklautz
33d9497253
Merge pull request #5992 from alexpilotti/fix_build
Fix stable-1.1 build on Windows
2020-03-27 00:41:29 +01:00
Alessandro Pilotti
3850ba376c Add missing wincred.h include on Windows 2020-03-25 05:09:29 +02:00
Alessandro Pilotti
7ff58e992a Fix GetSecurityStatusString on Windows 2020-03-25 05:08:02 +02:00
Bernhard Miklautz
6b66f199e6 fix: add missing file 2019-05-17 09:48:21 +02:00
akallabeth
590fa7dbf6
Merge pull request #5391 from bmiklautz/stable-1.1-backports
Backport multiple fixes from master
2019-05-09 12:57:10 +02:00
Bernhard Miklautz
a99ec8cb65 new: support for protocol version 6
Based on 8df96364f2

Backported by:
	Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
	Bernhard Miklautz <bernhard.miklautz@thincast.com>
	Martin Fleisz <martin.fleisz@thincast.com>
2019-05-09 12:03:06 +02:00
Bernhard Miklautz
6fa64006a1 fix: CVE-2018-8789
Backport of 2ee663f39d
2019-05-09 11:30:56 +02:00
Bernhard Miklautz
af9a8fbf31 fix: CVE-2018-8788
Backport of d1112c279b
2019-05-09 11:29:57 +02:00
Bernhard Miklautz
f777230e15 fix: CVE-2018-8787
Backport of 09b9d4f199
2019-05-09 11:28:29 +02:00
Bernhard Miklautz
4f2a7bd7d4
Merge pull request #5390 from abagarwams/portCVE2018-8786
Porting patch for CVE2018-8786 to 1.1 branch
2019-05-09 11:10:02 +02:00
abagarewa
9f96ce255e Porting patch for CVE2018-8786 to 1.1 branch 2019-05-08 16:33:33 -07:00
Bernhard Miklautz
851f0979d5
Merge pull request #4427 from ondrejholy/tls1+-stable-1.1
tls: enable tls 1+ for stable-1.1
2018-02-13 16:06:24 +01:00
Bernhard Miklautz
1c1d825b2f tls: enable tls 1+
Currently TLS version 1.0 is used implicitly by using the TLSv1_method.
To be able to also use TLS 1.1 and later use SSLv23_client_method
instead. To make sure SSLv2 or SSLv3 isn't used disable them.

Commit aa80f63b from master was backported by Ondrej Holy <oholy@redhat.com>.

https://github.com/FreeRDP/FreeRDP/issues/2128
2018-02-13 15:54:15 +01:00
Bernhard Miklautz
03ab683189 Fix multiple security issues
Fix the following issues identified by the CISCO TALOS project:

* TALOS-2017-0336 CVE-2017-2834
* TALOS-2017-0337 CVE-2017-2835
* TALOS-2017-0338 CVE-2017-2836
* TALOS-2017-0339 CVE-2017-2837
* TALOS-2017-0340 CVE-2017-2838
* TALOS-2017-0341 CVE-2017-2839

Backported based on commit 8292b4558f.
2017-07-27 14:04:21 +02:00
Bernhard Miklautz
4c69c3ea14 Merge pull request #2818 from vancepym/stable-1.1
Error: "Unable to detect time zone" - Add support for tz package
2016-02-23 16:22:16 +01:00
Scott Fan
605d0a8518 Add support for tz package
Fixes error message while freerdp connected the remote desktop:
Unable to detect time zone
2015-07-13 15:18:52 +08:00
Marc-André Moreau
770c67d340 Merge pull request #2453 from bmiklautz/stable-1.1_cmd_fixes
settings: handle collection_add in detection case
2015-03-12 07:31:38 -04:00
Bernhard Miklautz
85856224f6 settings: handle collection_add in detection case
Command line detection is run with dummy settings where not everything
is allocated. Collections (device, dynamic channel and static
channel) didn't handle this case properly.

(cherry picked from commit e9985c2093)

Conflicts:
	client/common/test/TestClientCmdLine.c
2015-03-10 14:30:51 +01:00
Bernhard Miklautz
a700ee75f9 Merge pull request #2440 from bmiklautz/stable1.1/issue_2439
core/glyph: copy data when adding glyph to cache
2015-03-05 16:42:52 +01:00
Bernhard Miklautz
daea54925b core/glyph: copy data when adding glyph to cache
fixes #2439

(cherry picked from commit c99d9ee72b)
2015-03-05 15:10:48 +01:00
Norbert Federa
b21ff842ef Merge pull request #2380 from bmiklautz/stable-1.1_cmdline
Build and command line fixes
2015-02-12 11:09:30 +01:00
Bernhard Miklautz
f42b03f7bb build: fix build on win32
Manually pick changes and improvements from master to build on win32
(without specifying platform toolset)
2015-02-11 17:51:30 +01:00
Bernhard Miklautz
3cd91cf599 build: updates to build with pull request builder 2015-02-11 11:41:16 +01:00
Bernhard Miklautz
ab59334c66 build: fix TestClientCmdLine MONOLITHIC_BUILD 2015-02-11 10:47:57 +01:00
Bernhard Miklautz
892431326f ci: add config-linux-all.txt 2015-02-11 02:05:32 +01:00
Bernhard Miklautz
a5f6ba04cd client: fixed line compatibility 2015-02-11 01:58:16 +01:00
Bernhard Miklautz
eb9112c84b client/common: add test for client command line 2015-02-11 01:57:31 +01:00
Armin Novak
ae025ae332 Fixed memory leak.
(cherry picked from commit 9863ccfe66)
2015-01-16 14:07:38 +01:00
Armin Novak
2228cd6e73 Fixed multiple parsing errors for compatibility command line.
(cherry picked from commit dfb6176df6)

Conflicts:
	client/common/compatibility.c
2015-01-16 14:07:31 +01:00
Armin Novak
1fdf05da3f Fixed windows command line
freerdp_detect_windows_style_command_line_syntax returns negative values
in error but also in help and version case... oh boy

(cherry picked from commit f86ed3ffef)
2015-01-16 13:56:35 +01:00
Armin Novak
41313e6d70 Fixed missing NULL pointer check.
(cherry picked from commit 241848038c)

Conflicts:
	client/common/compatibility.c
2015-01-16 13:56:23 +01:00
Armin Novak
dab7113f0f Fixed clang warnings.
Fixed check for compatibility command line.

(cherry picked from commit 20f7e4d301)

Conflicts:
	client/common/cmdline.c
2015-01-16 13:54:16 +01:00
Armin Novak
cd21ac3498 Fixed command line pre filter, now returning 2 to skip argument.
(cherry picked from commit 1d4403cbbe)

Conflicts:
	client/common/compatibility.c
2015-01-16 13:53:00 +01:00
Bernhard Miklautz
7974c5072c winpr build: cmake 3.1 compatibility
* since 3.1 file(GLOB FILEPATHS RELATIVE .. returns single
* / instead of // as previously - necessary adoptions for regex and
  matches done. Should work with all cmake versions.
2015-01-16 13:43:04 +01:00
Bernhard Miklautz
0027350ff0 build: improve X11 detection on OS X
/usr/X11R6 doesn't exist on OS X per default (anymore). Therefore add
PATHS to all X11 detection modules pointing to the Xquarz installation
directory in /opt/X11.
For FindX11 it was also necessary to ensure that the frameworks are
searched as last (after PATHS) otherwise it could happen that X11 headers
of a framework (e.g. Tk.framework) were used.

(cherry picked from commit b35dc849ee)
2015-01-16 13:27:31 +01:00
Bernhard Miklautz
598d30f8b8 Mac: set policy to silent cmake >= 3.0 warnings
Set the following policies to "OLD" if cmake version is greater than
2.8.12:

CMP0026 - Disallow use of the LOCATION target property
CMP0045 - Error on non-existent target in get_target_property

(cherry picked from commit 10ee2f72d9)
2015-01-16 13:27:22 +01:00
Bernhard Miklautz
b065492890 build: cmake 3.1 compatibility
* fix problem with REMOVE_DUPLICATES on undefined lists
* since 3.1 file(GLOB FILEPATHS RELATIVE .. returns single / instead of // as
  previously - necessary adoptions for regex and matches done. Should
	work with all cmake versions.

Tested with 3.1.0-rc3

(cherry picked from commit 1b663ceffe)

Conflicts:
	client/CMakeLists.txt
	server/CMakeLists.txt
2015-01-16 13:27:08 +01:00
Bernhard Miklautz
6c6fb62029 mfreerdp: fix build with latest cmake
Newer versions of cmake seem to use CMAKE_C_FLAGS for objective-c.
Now both flags are set for compatibility.

(cherry picked from commit 9ab95adf0d)
2015-01-16 13:24:52 +01:00
Marc-André Moreau
440916eae2 Merge pull request #2061 from bmiklautz/remove_winpr_configh
Get rid of winpr/config.h
2014-08-25 09:52:43 -04:00
Bernhard Miklautz
6d2d377ed1 Get rid of winpr/config.h
winpr/config.h just contains WITH_NATIVE_SSPI which is already
defined in top level config.h.
2014-08-24 14:31:13 +02:00
Marc-André Moreau
6fc97c7179 Merge pull request #2040 from dpoe/stable-1.1
handle user@corp.net username correctly
2014-08-18 13:07:30 -04:00
Daryl Poe
248c918508 handle user@corp.net username correctly 2014-08-15 15:45:06 -06:00
Bernhard Miklautz
b07a5c11e4 Merge pull request #2031 from bmiklautz/fix/stable-1.1/ffmpeg2
build: fix tsmf ffmpeg build
2014-08-09 21:06:40 +02:00
Bernhard Miklautz
dc7f6abbed build: fix tsmf ffmpeg build
Backported fixes to build against libavcodec >= 9.0
2014-08-08 16:05:45 +02:00
Bernhard Miklautz
7b5cd86a3e Merge pull request #2030 from bmiklautz/fix/stable-1.1/ffmpeg
build: fix tsmf ffmpeg
2014-08-08 15:22:12 +02:00
Ian Whyman
75b6e12c11 Backwards compat defines
Conflicts:
	channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c
2014-08-08 15:13:25 +02:00
Ian Whyman
3b9b030b0e CODEC_ID_* -> AV_CODEC_ID_* 2014-08-08 15:08:15 +02:00
Bernhard Miklautz
28f65ff297 Merge pull request #1887 from dpoe/stable-1.1
correct Pause key sequence
2014-07-25 11:23:09 +02:00
Hardening
3122946757 Merge pull request #1891 from hardening/CVE-2014-0250_1dot1
Fix for CVE 2014-0250
2014-06-19 10:24:10 +02:00
Hardening
5ad707ddf3 Fix CVE-2014-0250
This patch fixes CVE-2014-0250 by checking width, height and bpp when
receiving a new pointer.
2014-06-06 23:24:16 +02:00
Daryl Poe
46a00b5c9e correct Pause key sequence 2014-06-04 15:41:17 -06:00
Marc-André Moreau
01865f0e28 Merge pull request #1770 from dpoe/stable-1.1
/kbd: option should be unsigned
2014-04-08 23:56:49 -04:00
Daryl Poe
fc6b72017f /kbd: option should be unsigned 2014-04-04 14:09:48 -06:00
Marc-André Moreau
2604ff20bd Merge pull request #1673 from dpoe/stable-1.1
Fixes for redirected-drive cut, mode, read/write
2014-02-27 13:55:30 -05:00
Daryl Poe
865b816b80 fixes for drive cut, mode, read/write 2014-01-27 17:21:34 -07:00
Marc-André Moreau
997d40639c Merge pull request #1658 from dbungert/compression
Address bitmap related crashes.
2014-01-14 11:16:01 -08:00
Dan Bungert
580e6b68c9 Switch back to 64K (RDP5) compression. 2014-01-10 08:05:23 -07:00
Marc-André Moreau
69af35a1b5 Merge pull request #1630 from bmiklautz/stable-1.1-bp
master stable sync
2013-12-08 15:52:51 -08:00
Bernhard Miklautz
7c4ebe2bc4 ios build: updated README.ios
(cherry picked from commit fa1bc1f2fe)
2013-12-08 17:35:57 +01:00
Bernhard Miklautz
37ac70aa1c ios ssl build: support for user specified sdks
To build against a specific (not auto detected) SDK version set
USER_OS_SDK and/or USER_SIM_SDK at the top of the script.
(cherry picked from commit 38883e5ecd)
2013-12-08 17:35:51 +01:00
Bernhard Miklautz
3754d07163 ios ssl build: do sdk detection before download
(cherry picked from commit 27d8844fab)
2013-12-08 17:35:43 +01:00
Bernhard Miklautz
2ef6c552c4 Cleaned up and improved iOS openssl build script
* Added support for optional build directory (first argument)
* Automatically detect iOS/iPhoneSimulator SDKs (oldest SDK found is used)
(cherry picked from commit e30d6109bc)
2013-12-08 17:35:36 +01:00
Bernhard Miklautz
323b081192 ios build: added option to set signing certificate
Code signing certificate can be set with with cmake option CODE_SIGN_IDENTITY.
Like -DCODE_SIGN_IDENTITY="signing identity"
(cherry picked from commit f30d3ac3a1)
2013-12-08 17:35:27 +01:00
Bernhard Miklautz
413c4dea65 ios simulator build: set CMAKE_OSX_SYSROOT
When building for iphone simulator it is required to set the CMAKE_OSX_SYSROOT
to "iphonesimulator" otherwise command line builds (with cmake --build) will fail.
(cherry picked from commit 6d2142182d)
2013-12-08 17:35:22 +01:00
Bernhard Miklautz
88963aae5c ios build: fixed toolchain for cmake 2.8.10
(cherry picked from commit 7b706ba840)
2013-12-08 17:35:15 +01:00
Bernhard Miklautz
30de5b226d windows build: use different .def file for xp
Use different def file for windows < 5.1.
(cherry picked from commit 57d295441f)
2013-12-08 17:27:58 +01:00
Bernhard Miklautz
5360f59940 windows build: ignore generated files (nmake)
(cherry picked from commit 23f33ca20e)
2013-12-08 17:27:50 +01:00
Bernhard Miklautz
abf84cf6e0 Cmake preload scripts for CI added
(cherry picked from commit f2b7876302)
2013-12-08 17:22:21 +01:00
Bernhard Miklautz
613b20d482 android: use version.h 2013-12-08 17:17:12 +01:00
Bernhard Miklautz
37602e6000 use version.h in ios client
(cherry picked from commit 0147b06d06)
2013-12-08 16:48:48 +01:00
Bernhard Miklautz
0380e652d0 install version.h
(cherry picked from commit c9f49162bd)
2013-12-08 16:47:53 +01:00
Bernhard Miklautz
23512af600 moved version information to freerdp/version.h
fixed #1465
(cherry picked from commit a0161a12ac)
2013-12-08 16:47:47 +01:00
Marc-André Moreau
d2a9df1ce0 Merge pull request #1494 from dpoe/stable-1.1
send RDP_NEG_REQ also in the case of a null server certificate
2013-09-19 13:03:46 -07:00
Daryl Poe
afec6957c4 send RDP_NEG_REQ also in the case of a null server certificate 2013-09-18 17:16:48 -06:00
Marc-André Moreau
d8d7a9c1c6 Merge pull request #1435 from dpoe/stable-1.1
Apply glyph fragment offset after fragment
2013-09-16 13:38:46 -07:00
Marc-André Moreau
fe40452d65 Merge pull request #1443 from bmiklautz/stable-1.1-sync
Backported commits from master
2013-09-03 15:40:57 -07:00
Marc-André Moreau
214fe2198a xfreerdp: fix monolithic build
(cherry picked from commit 3194967957)
2013-08-26 20:20:33 +02:00
Bernhard Miklautz
ec6b84fde4 Merge pull request #1429 from master 2013-08-26 20:19:55 +02:00
Armin Novak
a91592bd68 Using a monitor thread for tty input now to work around a WaitForMultipleObjects
limitation of winpr.
Using infinite timeout now in threads to reduce CPU usage to nearly zero.
2013-08-26 20:19:03 +02:00
Armin Novak
48ce36fd11 Reset file descriptor set only, if necessary now. 2013-08-26 20:19:03 +02:00
Armin Novak
313250d99b Fixed check for _GNU_SOURCE pthread extensions. 2013-08-26 20:19:03 +02:00
Armin Novak
ebff396e90 Fixed compilation error, now using WaitForMultipleObjects. 2013-08-26 20:16:06 +02:00
Armin Novak
c3923afa1f Fixed initialization of serial device, now aborting pending
read / write operations.
2013-08-26 20:16:06 +02:00
Bernhard Miklautz
d1e6221b25 Merge pull request #1395 from master 2013-08-26 20:14:17 +02:00
richterger
8d92adca1d Fix off by one problem in StreamPool allocation 2013-08-26 20:13:44 +02:00
richterger
ceae1b87a5 Fixed memory corruption problems within client redirect
- set freed pointers to NULL to avoid double free
- realloc mppc to cleanly restart compression
- avoid releaseing StreamPool from already freed transport after client redirect
2013-08-26 20:13:44 +02:00
Bernhard Miklautz
84f1001573 Merge pull request 1422 from master 2013-08-26 20:11:31 +02:00
Armin Novak
bd74f5c8b5 Removed EAGAIN handling, again passing on the error to the server. 2013-08-26 20:10:43 +02:00
Armin Novak
cf6b9d44ac Fixed invalid access to tty in thread, which was already removed by
serial_process_irp_close
Retry read now, if non blocking IO returns EAGAIN.
2013-08-26 20:10:43 +02:00
Armin Novak
4a5b19e816 Fixed high CPU usage. 2013-08-26 20:10:43 +02:00
Armin Novak
605f956486 Fixed resource leaks and missing thread sync. 2013-08-26 20:10:43 +02:00
Armin Novak
86c0c02975 Fixed resource leaks. 2013-08-26 20:10:42 +02:00
Armin Novak
ac63b9ae56 Using WaitForMultipleObjects now to reduce CPU load. 2013-08-26 20:10:42 +02:00
Bernhard Miklautz
0e758fef5b Merge pull request #1394 from master 2013-08-26 20:07:35 +02:00
Armin Novak
eab49cf89f Added generated documentation files to gitignore. 2013-08-26 20:05:09 +02:00
Armin Novak
6e5e62da60 Replaced xmlto with xsltproc to word around a bug preventing manpages
to be build, when there are spaces in the build path.
2013-08-26 20:05:09 +02:00
Armin Novak
8be65019e6 Added missing dependency for custom command generating manpage. 2013-08-26 20:05:09 +02:00
Armin Novak
9281014e4d Removed placeholder for channel documentation until it is available. 2013-08-26 20:05:09 +02:00
Armin Novak
25eda0dce7 Added better formatting of commands in manpage. 2013-08-26 20:05:09 +02:00
Armin Novak
387a75d1ef Minor adjustments in naming. 2013-08-26 20:05:08 +02:00
Armin Novak
a5d1b98e5b Added examples with short description to manpage.
Added placeholder for channel documentation.
2013-08-26 20:05:08 +02:00
Armin Novak
e92eef9579 Fixed generation of configure header, now replacing date fields
with current date.
Added CMake script to generate a variable containing the current
date.
Removed last argument (the terminating NULL element) from output.
2013-08-26 20:05:08 +02:00
Armin Novak
75e2b2a5ef Removed extended text field. 2013-08-26 20:05:08 +02:00
Armin Novak
cb5ffc497a Added simple converter generating docbook XML from command line
argument struct.
Modified xfreerdp.1.xml to include generated documentation.
Modified CMake to regenerate manpages correctly using the generator.
2013-08-26 20:05:08 +02:00
Bernhard Miklautz
5166dfec6e Merge pull request #1415 from master 2013-08-26 20:02:57 +02:00
Armin Novak
28ee436374 Added links to documentation of message sequences for clipboard data exchange. 2013-08-26 20:01:59 +02:00
Armin Novak
c3dc19cc5f Fixed invalid package size allocation and calculation in cliprdr_process_format_list_event
Enabled and fixed error handling in cliprdr_process_format_list_response
2013-08-26 20:01:50 +02:00
Armin Novak
7015f83d97 Fixed #1404, using WaitForMultipleObjects now.
(cherry picked from commit 44c80c29cc)
2013-08-26 20:00:20 +02:00
Bernhard Miklautz
4bec3a6547 Merged pull request #1416 from master 2013-08-26 19:58:36 +02:00
Armin Novak
20cd361fc5 winpr config.h now generated in binary tree. 2013-08-26 19:58:16 +02:00
Armin Novak
93cb8fc11a Moved generated tables.c to binary folder. 2013-08-26 19:58:09 +02:00
Armin Novak
387f780414 Generating config.h now in binray tree. 2013-08-26 19:57:39 +02:00
Bernhard Miklautz
4fe23c0788 Merge pull request #1421 from master 2013-08-26 19:01:41 +02:00
Armin Novak
84d4ec009c Added error messages for not implemented functions. 2013-08-26 18:59:29 +02:00
Armin Novak
83e9adf30d Thread timed join now only available with _GUN_SOURCE. 2013-08-26 18:59:29 +02:00
Armin Novak
2863a55f5b Implemented timeouts for WaitForSingleObject.
Added assertions for functions not implemented.
2013-08-26 18:59:22 +02:00
Norbert Federa
df7311b4f9 codec/rfx: fix multithreaded encoder
Some component of the encoder chain (I suspect the rlgr encoder) expects
the output buffer to be zeroed. The multithreaded RemoteFX encoder uses
wStreams from the StreamPool which are reused and not zeroed out of
course. For now, in order to prevent data corruption we clear the stream.
(cherry picked from commit ccc5d1b279)
2013-08-26 15:31:34 +02:00
Bernhard Miklautz
d817ef3516 android: updated toolchain file
* support for ndk version r8d+
* improved x86_64 host machine support
* support non-release NDK layouts
(cherry picked from commit 553f7c24f7)
2013-08-26 15:29:07 +02:00
Norbert Federa
75f23925cd codec/rfx: added multithreaded encoder
(cherry picked from commit 0d916527bc)
2013-08-26 15:28:53 +02:00
Norbert Federa
41ce9a0969 libwinpr-utils: Use criticalsection with spincount
Use InitializeCriticalSectionAndSpinCount instead of IntializeCriticalSection.
Using spin counts for critical sections of short duration enables the calling
thread to avoid the wait operation in most situations which can dramatically
improve the overall performance on multiprocessor systems.

On Linux this change has no effect because the new winpr critical section
implementation does not use the SpinCount field under Linux because the NPTL
synchronization primitives are implemented using the extremely performant
futex system calls which have this magic already built in.

However, on Mac OS X this change improved the overall performance of the
multithreaded RemoteFX decoder by 25 percent.

I've used a SpinCount of 4000 which avoided 99 percent of the wait calls.
This value is also used by Microsoft's heap manager for its per-heap
critical sections.

Note: This change requires pull request #1397 to be merged.
(cherry picked from commit 3a58934eb2)
2013-08-26 15:27:32 +02:00
Norbert Federa
434ac77b83 libwinpr-sync: New complete critical section code
- Complete implementation including recursion support
- Added an intensive ctest (TestSynchCritical)
- Struct members are used exactly as Windows does it internally:
  LockCount starts at -1, RecursionCount at 0
- Same performance optimizations as internally on Windows:
    - Fast lock acquisition path using CAS -> SpinCount -> wait
    - SpinCount automatically disabled on uniprocessor systems
- On Linux SpinCount is disabled because it provided no advantage over NPTL/futex in all tests

Support for CRITICAL_SECTION's DebugInfo is not yet included (but trivial to add).
(cherry picked from commit 2b25b4a520)
2013-08-26 15:27:15 +02:00
Norbert Federa
47b17b5386 codec/rfx: removed unnecessary WaitForSingleObject
The WaitForSingleObject call on TilePool's event is called with a zero time-out
interval and the event is a manual reset event ... thus no locking or waiting
is involved anyways and Queue_Dequeue may very well return NULL independently
of calling WaitForSingleObject which is already correctly handled.
(cherry picked from commit 938a0890a3)
2013-08-26 15:26:22 +02:00
Armin Novak
d67624684f Added proper find_feature check for JPEG library.
(cherry picked from commit 4d13b27a02)
2013-08-26 15:26:15 +02:00
Bernhard Miklautz
deb9d2bc8e Merge pull request #1389 2013-08-26 14:53:40 +02:00
Armin Novak
b6d06ec012 Added libusb detection CMake script. 2013-08-26 14:41:47 +02:00
Armin Novak
c22b539153 Fixed linking with libusb, now linking against correct library. 2013-08-26 14:41:47 +02:00
Armin Novak
fe221cdc56 Now using libraries detected by CMake for linking against libusb. 2013-08-26 14:41:47 +02:00
Armin Novak
67808b8bc3 Added proper CMake checks for libraries linked with urbdrc 2013-08-26 14:41:47 +02:00
Norbert Federa
f25f2e6055 winpr: improve and fix locking for data structures
- Improved/completed(almost) winpr's critical section implementation
- Replaced WaitForSingleObject locking with critical sections

Note:
WaitForSingleObject should _never_ be used for granular low-contention
locks as it _always_ enters the kernel.

Just replacing WaitForSingleObject locking in Bufferpool with
EnterCriticalSection boosts the multithreaded rfx decoder
performance by almost 400% on win32.
(pull #1388 - cherry picked from commit 81ef251fc8)
2013-08-26 12:53:43 +02:00
Bernhard Miklautz
e5bdfc5eed Fixed typo(cherry picked from commit 558d40b18c) 2013-08-26 12:45:23 +02:00
Vic Lee
0fc2d1d1d2 libfreerdp-core/fastpath: fix memory leak when sending large packet.
(cherry picked from commit 21796ad73d)
2013-08-26 12:44:59 +02:00
Daryl Poe
eb2f3a02b4 apply glyph fragment offset after fragment 2013-08-20 12:00:36 -06:00
Marc-André Moreau
14d4adb901 Merge pull request #1403 from dpoe/stable-1.1
fix per-device CAL licensing
2013-08-14 06:59:50 -07:00
Daryl Poe
d6d0d81d08 fix per-device CAL licensing 2013-08-07 16:28:31 -06:00
Bernhard Miklautz
fd8fc31ce6 Merge pull request #1378 from dpoe/stable-1.1
careful with passwd in compatibility.c
2013-07-30 05:11:03 -07:00
Daryl Poe
a4a5baf0da careful with passwd in compatibility.c 2013-07-29 16:50:38 -06:00
Norbert Federa
aca7d9366e codec/rfx: removed unused queue TileQueue
Declared, created, deleted but not used:

    git grep TileQueue
    libfreerdp/codec/rfx_types.h: wQueue* TileQueue;
    libfreerdp/codec/rfx.c:       context->priv->TileQueue = Queue_New(TRUE, -1, -1);
    libfreerdp/codec/rfx.c:       Queue_Free(context->priv->TileQueue);
(cherry picked from commit 1d384ce863)
2013-07-29 20:31:08 +02:00
Bernhard Miklautz
f3019b2b40 Merge pull request #1373 from dpoe/stable-1.1
fix segfault due to pulse input race condition
2013-07-29 09:18:02 -07:00
Daryl Poe
be51676541 fix segfault due to pulse input race condition 2013-07-26 13:54:20 -06:00
Bernhard Miklautz
359c5d258e Merge pull request #1371 from dpoe/stable-1.1
cover the case of servers asking for cached bitmaps they have never defi...
2013-07-26 02:45:45 -07:00
Daryl Poe
46a691db02 cover the case of servers asking for cached bitmaps they have never defined 2013-07-25 15:01:56 -06:00
Marc-André Moreau
cd68f79519 channels/disp: remove RDP8.1 Preview MS-RDPEDISP support from 1.1 stable branch (will be included in next release) 2013-07-16 15:21:17 -04:00
169 changed files with 4323 additions and 1929 deletions

12
.gitignore vendored
View File

@ -15,6 +15,7 @@ DartConfiguration.tcl
_CPack_Packages
external/*
!external/README
include/freerdp/version.h
# Packages
*.zip
@ -37,6 +38,9 @@ external/*
# Documentation
docs/api
client/X11/xfreerdp.1
client/X11/xfreerdp.1.xml
client/X11/xfreerdp-channels.1.xml
client/X11/xfreerdp-examples.1.xml
# Mac OS X
.DS_Store
@ -62,6 +66,14 @@ Thumbs.db
ipch
Debug
RelWithDebInfo
*.lib
*.exp
*.pdb
*.dll
*.ilk
*.resource.txt
*.embed.manifest*
*.intermediate.manifest*
# Binaries
*.a

View File

@ -175,9 +175,24 @@ endif()
if(WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUNICODE -D_UNICODE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_WIN32_WINNT=0x0501")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN")
if(NOT DEFINED CMAKE_WINDOWS_VERSION)
set(CMAKE_WINDOWS_VERSION "WINXP")
endif()
if(CMAKE_WINDOWS_VERSION STREQUAL "WINXP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0501 -DWIN32_WINNT=0x0501")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0501 -DWIN32_WINNT=0x0501")
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN7")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0601 -DWIN32_WINNT=0x0601")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0601 -DWIN32_WINNT=0x0601")
elseif(CMAKE_WINDOWS_VERSION STREQUAL "WIN8")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINVER=0x0602 -DWIN32_WINNT=0x0602")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINVER=0x0602 -DWIN32_WINNT=0x0602")
endif()
endif()
if(IOS)
@ -313,6 +328,10 @@ set(NPP_FEATURE_TYPE "OPTIONAL")
set(NPP_FEATURE_PURPOSE "performance")
set(NPP_FEATURE_DESCRIPTION "NVIDIA Performance Primitives library")
set(JPEG_FEATURE_TYPE "OPTIONAL")
set(JPEG_FEATURE_PURPOSE "codec")
set(JPEG_FEATURE_DESCRIPTION "use JPEG library")
if(WIN32)
set(X11_FEATURE_TYPE "DISABLED")
set(ZLIB_FEATURE_TYPE "DISABLED")
@ -372,6 +391,8 @@ find_feature(PCSC ${PCSC_FEATURE_TYPE} ${PCSC_FEATURE_PURPOSE} ${PCSC_FEATURE_DE
find_feature(FFmpeg ${FFMPEG_FEATURE_TYPE} ${FFMPEG_FEATURE_PURPOSE} ${FFMPEG_FEATURE_DESCRIPTION})
find_feature(Gstreamer ${GSTREAMER_FEATURE_TYPE} ${GSTREAMER_FEATURE_PURPOSE} ${GSTREAMER_FEATURE_DESCRIPTION})
find_feature(JPEG ${JPEG_FEATURE_TYPE} ${JPEG_FEATURE_PURPOSE} ${JPEG_FEATURE_DESCRIPTION})
if(TARGET_ARCH MATCHES "x86|x64")
if (NOT APPLE)
# Intel Performance Primitives
@ -400,12 +421,13 @@ set(FREERDP_ADDIN_PATH "${FREERDP_PLUGIN_PATH}")
set(FREERDP_EXTENSION_PATH "${CMAKE_INSTALL_FULL_LIBDIR}/freerdp/extensions")
# Include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
# Configure files
add_definitions("-DHAVE_CONFIG_H")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
# RPATH configuration
set(CMAKE_SKIP_BUILD_RPATH FALSE)
@ -430,8 +452,8 @@ if(BUILD_TESTING)
endif()
# WinPR
set(WINPR_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/winpr/include")
include_directories(${WINPR_INCLUDE_DIR})
include_directories("${CMAKE_SOURCE_DIR}/winpr/include")
include_directories("${CMAKE_BINARY_DIR}/winpr/include")
add_subdirectory(winpr)
@ -465,8 +487,12 @@ endif()
if (IOS)
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
if (IOS_PLATFORM MATCHES "SIMULATOR")
set(CMAKE_OSX_SYSROOT "iphonesimulator")
else()
set(CMAKE_OSX_SYSROOT "iphoneos")
endif()
endif()
if(WITH_CLIENT)
add_subdirectory(client)

View File

@ -202,8 +202,8 @@ set(FILENAME "ChannelOptions.cmake")
file(GLOB FILEPATHS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*/${FILENAME}")
foreach(FILEPATH ${FILEPATHS})
if(${FILEPATH} MATCHES "^([^/]*)//${FILENAME}")
string(REGEX REPLACE "^([^/]*)//${FILENAME}" "\\1" DIR ${FILEPATH})
if(${FILEPATH} MATCHES "^([^/]*)/+${FILENAME}")
string(REGEX REPLACE "^([^/]*)/+${FILENAME}" "\\1" DIR ${FILEPATH})
set(CHANNEL_OPTION)
include(${FILEPATH})
if(${CHANNEL_OPTION})

View File

@ -290,6 +290,17 @@ static void audin_pulse_stream_request_callback(pa_stream* stream, size_t length
BYTE* encoded_data;
AudinPulseDevice* pulse = (AudinPulseDevice*) userdata;
/* There is a race condition here where we may receive this callback
* before the buffer has been set up in the main code. It's probably
* possible to fix with additional locking, but it's easier just to
* ignore input until the buffer is ready.
*/
if (pulse->buffer == NULL)
{
/* fprintf(stderr, "%s: ignoring input, pulse buffer not ready.\n", __func__); */
return;
}
pa_stream_peek(stream, &data, &length);
frames = length / pulse->bytes_per_frame;
@ -373,6 +384,7 @@ static void audin_pulse_open(IAudinDevice* device, AudinReceive receive, void* u
DEBUG_DVC("");
pulse->buffer = NULL;
pulse->receive = receive;
pulse->user_data = user_data;

View File

@ -19,18 +19,20 @@ set(MODULE_NAME "freerdp-channels-client")
set(MODULE_PREFIX "FREERDP_CHANNELS_CLIENT")
set(${MODULE_PREFIX}_SRCS
tables.c
tables.h
addin.c
addin.h
init.c
init.h
open.c
open.h
channels.c
channels.h)
${CMAKE_CURRENT_BINARY_DIR}/tables.c
${CMAKE_CURRENT_SOURCE_DIR}/tables.h
${CMAKE_CURRENT_SOURCE_DIR}/addin.c
${CMAKE_CURRENT_SOURCE_DIR}/addin.h
${CMAKE_CURRENT_SOURCE_DIR}/init.c
${CMAKE_CURRENT_SOURCE_DIR}/init.h
${CMAKE_CURRENT_SOURCE_DIR}/open.c
${CMAKE_CURRENT_SOURCE_DIR}/open.h
${CMAKE_CURRENT_SOURCE_DIR}/channels.c
${CMAKE_CURRENT_SOURCE_DIR}/channels.h)
if(CHANNEL_STATIC_CLIENT_ENTRIES)
list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES)
endif()
foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES})
foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES})
@ -96,7 +98,7 @@ foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES})
endforeach()
set(CLIENT_STATIC_ADDIN_TABLE "${CLIENT_STATIC_ADDIN_TABLE}\n\t{ NULL, NULL, NULL }\n};")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tables.c.in ${CMAKE_CURRENT_SOURCE_DIR}/tables.c)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tables.c.in ${CMAKE_CURRENT_BINARY_DIR}/tables.c)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}

View File

@ -87,14 +87,15 @@ void cliprdr_process_format_list_event(cliprdrPlugin* cliprdr, RDP_CB_FORMAT_LIS
if (!cliprdr->use_long_format_names)
name_length = 32;
Stream_EnsureRemainingCapacity(body, Stream_Capacity(body) + 4 + name_length);
Stream_EnsureRemainingCapacity(body, 4 + name_length);
Stream_Write_UINT32(body, cb_event->formats[i]);
Stream_Write(body, name, name_length);
}
s = cliprdr_packet_new(CB_FORMAT_LIST, 0, Stream_Capacity(body));
Stream_Write(s, Stream_Buffer(body), Stream_Capacity(body));
Stream_SealLength(body);
s = cliprdr_packet_new(CB_FORMAT_LIST, 0, Stream_Length(body));
Stream_Write(s, Stream_Buffer(body), Stream_Length(body));
Stream_Free(body, TRUE);
}
@ -290,16 +291,16 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, wStream* s, UINT32 data
void cliprdr_process_format_list_response(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)
{
/* where is this documented? */
#if 0
/* http://msdn.microsoft.com/en-us/library/hh872154.aspx */
wMessage* event;
if ((msgFlags & CB_RESPONSE_FAIL) != 0)
{
event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_MONITOR_READY, NULL, NULL);
/* In case of an error the clipboard will not be synchronized with the server.
* Post this event to restart format negociation and data transfer. */
event = freerdp_event_new(CliprdrChannel_Class, CliprdrChannel_MonitorReady, NULL, NULL);
svc_plugin_send_event((rdpSvcPlugin*) cliprdr, event);
}
#endif
}
void cliprdr_process_format_data_request(cliprdrPlugin* cliprdr, wStream* s, UINT32 dataLen, UINT16 msgFlags)

View File

@ -1,22 +0,0 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# FreeRDP cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
define_channel("disp")
if(WITH_CLIENT_CHANNELS)
add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME})
endif()

View File

@ -1,12 +0,0 @@
set(OPTION_DEFAULT OFF)
set(OPTION_CLIENT_DEFAULT ON)
set(OPTION_SERVER_DEFAULT OFF)
define_channel_options(NAME "disp" TYPE "dynamic"
DESCRIPTION "Display Update Virtual Channel Extension"
SPECIFICATIONS "[MS-RDPEDISP]"
DEFAULT ${OPTION_DEFAULT})
define_channel_client_options(${OPTION_CLIENT_DEFAULT})
define_channel_server_options(${OPTION_SERVER_DEFAULT})

View File

@ -1,47 +0,0 @@
# FreeRDP: A Remote Desktop Protocol Implementation
# FreeRDP cmake build script
#
# Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
define_channel_client("disp")
set(${MODULE_PREFIX}_SRCS
disp_main.c
disp_main.h)
include_directories(..)
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry")
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-common freerdp-utils)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-sysinfo)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
if(NOT STATIC_CHANNELS)
install(TARGETS ${MODULE_NAME} DESTINATION ${FREERDP_PLUGIN_PATH})
endif()
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Client")

View File

@ -1,341 +0,0 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Display Update Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/print.h>
#include <winpr/thread.h>
#include <winpr/stream.h>
#include <winpr/sysinfo.h>
#include <winpr/cmdline.h>
#include <winpr/collections.h>
#include <freerdp/addin.h>
#include "disp_main.h"
struct _DISP_CHANNEL_CALLBACK
{
IWTSVirtualChannelCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
IWTSVirtualChannel* channel;
};
typedef struct _DISP_CHANNEL_CALLBACK DISP_CHANNEL_CALLBACK;
struct _DISP_LISTENER_CALLBACK
{
IWTSListenerCallback iface;
IWTSPlugin* plugin;
IWTSVirtualChannelManager* channel_mgr;
DISP_CHANNEL_CALLBACK* channel_callback;
};
typedef struct _DISP_LISTENER_CALLBACK DISP_LISTENER_CALLBACK;
struct _DISP_PLUGIN
{
IWTSPlugin iface;
IWTSListener* listener;
DISP_LISTENER_CALLBACK* listener_callback;
UINT32 MaxNumMonitors;
UINT32 MaxMonitorWidth;
UINT32 MaxMonitorHeight;
};
typedef struct _DISP_PLUGIN DISP_PLUGIN;
int disp_send_display_control_monitor_layout_pdu(DISP_CHANNEL_CALLBACK* callback, UINT32 NumMonitors, DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors)
{
int index;
int status;
wStream* s;
UINT32 type;
UINT32 length;
DISP_PLUGIN* disp;
UINT32 MonitorLayoutSize;
disp = (DISP_PLUGIN*) callback->plugin;
#ifdef DISP_PREVIEW
MonitorLayoutSize = 32;
#else
MonitorLayoutSize = 40;
#endif
length = 8 + 8 + (NumMonitors * MonitorLayoutSize);
type = DISPLAY_CONTROL_PDU_TYPE_MONITOR_LAYOUT;
s = Stream_New(NULL, length);
Stream_Write_UINT32(s, type); /* Type (4 bytes) */
Stream_Write_UINT32(s, length); /* Length (4 bytes) */
if (NumMonitors > disp->MaxNumMonitors)
NumMonitors = disp->MaxNumMonitors;
#ifdef DISP_PREVIEW
Stream_Write_UINT32(s, NumMonitors); /* NumMonitors (4 bytes) */
#else
Stream_Write_UINT32(s, MonitorLayoutSize); /* MonitorLayoutSize (4 bytes) */
#endif
Stream_Write_UINT32(s, NumMonitors); /* NumMonitors (4 bytes) */
//fprintf(stderr, "NumMonitors: %d\n", NumMonitors);
for (index = 0; index < NumMonitors; index++)
{
Monitors[index].Width -= (Monitors[index].Width % 2);
if (Monitors[index].Width < 200)
Monitors[index].Width = 200;
if (Monitors[index].Width > disp->MaxMonitorWidth)
Monitors[index].Width = disp->MaxMonitorWidth;
if (Monitors[index].Height < 200)
Monitors[index].Height = 200;
if (Monitors[index].Height > disp->MaxMonitorHeight)
Monitors[index].Height = disp->MaxMonitorHeight;
Stream_Write_UINT32(s, Monitors[index].Flags); /* Flags (4 bytes) */
Stream_Write_UINT32(s, Monitors[index].Left); /* Left (4 bytes) */
Stream_Write_UINT32(s, Monitors[index].Top); /* Top (4 bytes) */
Stream_Write_UINT32(s, Monitors[index].Width); /* Width (4 bytes) */
Stream_Write_UINT32(s, Monitors[index].Height); /* Height (4 bytes) */
Stream_Write_UINT32(s, Monitors[index].PhysicalWidth); /* PhysicalWidth (4 bytes) */
Stream_Write_UINT32(s, Monitors[index].PhysicalHeight); /* PhysicalHeight (4 bytes) */
Stream_Write_UINT32(s, Monitors[index].Orientation); /* Orientation (4 bytes) */
#if 0
fprintf(stderr, "\t: Flags: 0x%04X\n", Monitors[index].Flags);
fprintf(stderr, "\t: Left: %d\n", Monitors[index].Left);
fprintf(stderr, "\t: Top: %d\n", Monitors[index].Top);
fprintf(stderr, "\t: Width: %d\n", Monitors[index].Width);
fprintf(stderr, "\t: Height: %d\n", Monitors[index].Height);
fprintf(stderr, "\t: PhysicalWidth: %d\n", Monitors[index].PhysicalWidth);
fprintf(stderr, "\t: PhysicalHeight: %d\n", Monitors[index].PhysicalHeight);
fprintf(stderr, "\t: Orientation: %d\n", Monitors[index].Orientation);
#endif
#ifndef DISP_PREVIEW
Stream_Write_UINT32(s, Monitors[index].DesktopScaleFactor); /* DesktopScaleFactor (4 bytes) */
Stream_Write_UINT32(s, Monitors[index].DeviceScaleFactor); /* DeviceScaleFactor (4 bytes) */
#endif
}
Stream_SealLength(s);
status = callback->channel->Write(callback->channel, Stream_Length(s), Stream_Buffer(s), NULL);
Stream_Free(s, TRUE);
return status;
}
int disp_recv_display_control_caps_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* s)
{
DISP_PLUGIN* disp;
disp = (DISP_PLUGIN*) callback->plugin;
Stream_Read_UINT32(s, disp->MaxNumMonitors); /* MaxNumMonitors (4 bytes) */
Stream_Read_UINT32(s, disp->MaxMonitorWidth); /* MaxMonitorWidth (4 bytes) */
Stream_Read_UINT32(s, disp->MaxMonitorHeight); /* MaxMonitorHeight (4 bytes) */
//fprintf(stderr, "DisplayControlCapsPdu: MaxNumMonitors: %d MaxMonitorWidth: %d MaxMonitorHeight: %d\n",
// disp->MaxNumMonitors, disp->MaxMonitorWidth, disp->MaxMonitorHeight);
return 0;
}
int disp_recv_pdu(DISP_CHANNEL_CALLBACK* callback, wStream* s)
{
UINT32 type;
UINT32 length;
Stream_Read_UINT32(s, type); /* Type (4 bytes) */
Stream_Read_UINT32(s, length); /* Length (4 bytes) */
//fprintf(stderr, "Type: %d Length: %d\n", type, length);
switch (type)
{
case DISPLAY_CONTROL_PDU_TYPE_CAPS:
disp_recv_display_control_caps_pdu(callback, s);
break;
default:
break;
}
return 0;
}
static int disp_on_data_received(IWTSVirtualChannelCallback* pChannelCallback, UINT32 cbSize, BYTE* pBuffer)
{
wStream* s;
int status = 0;
DISP_CHANNEL_CALLBACK* callback = (DISP_CHANNEL_CALLBACK*) pChannelCallback;
s = Stream_New(pBuffer, cbSize);
status = disp_recv_pdu(callback, s);
Stream_Free(s, FALSE);
return status;
}
static int disp_on_close(IWTSVirtualChannelCallback* pChannelCallback)
{
DISP_CHANNEL_CALLBACK* callback = (DISP_CHANNEL_CALLBACK*) pChannelCallback;
if (callback)
{
free(callback);
}
return 0;
}
static int disp_on_new_channel_connection(IWTSListenerCallback* pListenerCallback,
IWTSVirtualChannel* pChannel, BYTE* Data, int* pbAccept,
IWTSVirtualChannelCallback** ppCallback)
{
DISP_CHANNEL_CALLBACK* callback;
DISP_LISTENER_CALLBACK* listener_callback = (DISP_LISTENER_CALLBACK*) pListenerCallback;
callback = (DISP_CHANNEL_CALLBACK*) malloc(sizeof(DISP_CHANNEL_CALLBACK));
ZeroMemory(callback, sizeof(DISP_CHANNEL_CALLBACK));
callback->iface.OnDataReceived = disp_on_data_received;
callback->iface.OnClose = disp_on_close;
callback->plugin = listener_callback->plugin;
callback->channel_mgr = listener_callback->channel_mgr;
callback->channel = pChannel;
listener_callback->channel_callback = callback;
*ppCallback = (IWTSVirtualChannelCallback*) callback;
return 0;
}
static int disp_plugin_initialize(IWTSPlugin* pPlugin, IWTSVirtualChannelManager* pChannelMgr)
{
int status;
DISP_PLUGIN* disp = (DISP_PLUGIN*) pPlugin;
disp->listener_callback = (DISP_LISTENER_CALLBACK*) malloc(sizeof(DISP_LISTENER_CALLBACK));
ZeroMemory(disp->listener_callback, sizeof(DISP_LISTENER_CALLBACK));
disp->listener_callback->iface.OnNewChannelConnection = disp_on_new_channel_connection;
disp->listener_callback->plugin = pPlugin;
disp->listener_callback->channel_mgr = pChannelMgr;
status = pChannelMgr->CreateListener(pChannelMgr, DISP_DVC_CHANNEL_NAME, 0,
(IWTSListenerCallback*) disp->listener_callback, &(disp->listener));
disp->listener->pInterface = disp->iface.pInterface;
return status;
}
static int disp_plugin_terminated(IWTSPlugin* pPlugin)
{
DISP_PLUGIN* disp = (DISP_PLUGIN*) pPlugin;
if (disp)
{
free(disp);
}
return 0;
}
/**
* Channel Client Interface
*/
int disp_send_monitor_layout(DispClientContext* context, UINT32 NumMonitors, DISPLAY_CONTROL_MONITOR_LAYOUT* Monitors)
{
DISP_PLUGIN* disp = (DISP_PLUGIN*) context->handle;
DISP_CHANNEL_CALLBACK* callback = disp->listener_callback->channel_callback;
disp_send_display_control_monitor_layout_pdu(callback, NumMonitors, Monitors);
return 1;
}
#ifdef STATIC_CHANNELS
#define DVCPluginEntry disp_DVCPluginEntry
#endif
int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints)
{
int error = 0;
DISP_PLUGIN* disp;
DispClientContext* context;
disp = (DISP_PLUGIN*) pEntryPoints->GetPlugin(pEntryPoints, "disp");
if (disp == NULL)
{
disp = (DISP_PLUGIN*) malloc(sizeof(DISP_PLUGIN));
if (disp)
{
ZeroMemory(disp, sizeof(DISP_PLUGIN));
disp->iface.Initialize = disp_plugin_initialize;
disp->iface.Connected = NULL;
disp->iface.Disconnected = NULL;
disp->iface.Terminated = disp_plugin_terminated;
context = (DispClientContext*) malloc(sizeof(DispClientContext));
context->handle = (void*) disp;
context->SendMonitorLayout = disp_send_monitor_layout;
disp->iface.pInterface = (void*) context;
disp->MaxNumMonitors = 16;
disp->MaxMonitorWidth = 8192;
disp->MaxMonitorHeight = 8192;
error = pEntryPoints->RegisterPlugin(pEntryPoints, "disp", (IWTSPlugin*) disp);
}
}
return error;
}

View File

@ -1,40 +0,0 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Display Update Virtual Channel Extension
*
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FREERDP_CHANNEL_DISP_CLIENT_MAIN_H
#define FREERDP_CHANNEL_DISP_CLIENT_MAIN_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <freerdp/dvc.h>
#include <freerdp/types.h>
#include <freerdp/addin.h>
#include <freerdp/utils/debug.h>
#include <freerdp/client/disp.h>
#define DISPLAY_CONTROL_PDU_TYPE_MONITOR_LAYOUT 0x00000002
#define DISPLAY_CONTROL_PDU_TYPE_CAPS 0x00000003
#define DISP_PREVIEW 1
#endif /* FREERDP_CHANNEL_DISP_CLIENT_MAIN_H */

View File

@ -299,15 +299,19 @@ DRIVE_FILE* drive_file_new(const char* base_path, const char* path, UINT32 id,
if (!drive_file_init(file, DesiredAccess, CreateDisposition, CreateOptions))
{
drive_file_free(file);
(void) drive_file_free(file, TRUE);
return NULL;
}
return file;
}
void drive_file_free(DRIVE_FILE* file)
int drive_file_free(DRIVE_FILE* file, BOOL recursive)
{
int retval;
retval = 0;
if (file->fd != -1)
close(file->fd);
@ -317,14 +321,36 @@ void drive_file_free(DRIVE_FILE* file)
if (file->delete_pending)
{
if (file->is_dir)
drive_file_remove_dir(file->fullpath);
{
if (recursive)
{
if (!drive_file_remove_dir(file->fullpath))
{
retval = EPERM;
}
}
else
unlink(file->fullpath);
{
if (rmdir(file->fullpath) != 0)
{
retval = errno;
}
}
}
else
{
if (unlink(file->fullpath) != 0)
{
retval = errno;
}
}
}
free(file->pattern);
free(file->fullpath);
free(file);
return retval;
}
BOOL drive_file_seek(DRIVE_FILE* file, UINT64 Offset)
@ -340,37 +366,55 @@ BOOL drive_file_seek(DRIVE_FILE* file, UINT64 Offset)
BOOL drive_file_read(DRIVE_FILE* file, BYTE* buffer, UINT32* Length)
{
ssize_t r;
size_t left;
BYTE *bufptr;
if (file->is_dir || file->fd == -1)
return FALSE;
r = read(file->fd, buffer, *Length);
if (r < 0)
bufptr = buffer;
left = *Length;
while (left > 0)
{
ssize_t bytesRead;
bytesRead = read(file->fd, bufptr, left);
if (bytesRead < 0)
{
if ((errno == EAGAIN) || (errno == EINTR))
continue;
else
return FALSE;
}
else if (bytesRead == 0) break; /* EOF */
bufptr += bytesRead;
left -= bytesRead;
}
*Length = (UINT32) r;
*Length -= left;
return TRUE;
}
BOOL drive_file_write(DRIVE_FILE* file, BYTE* buffer, UINT32 Length)
BOOL drive_file_write(DRIVE_FILE* file, const BYTE* buffer, UINT32 Length)
{
ssize_t r;
if (file->is_dir || file->fd == -1)
return FALSE;
while (Length > 0)
{
r = write(file->fd, buffer, Length);
ssize_t bytesWritten;
bytesWritten = write(file->fd, buffer, Length);
if (r == -1)
if (bytesWritten < 0)
{
if ((errno == EAGAIN) || (errno == EINTR))
continue;
else
return FALSE;
}
Length -= r;
buffer += r;
Length -= bytesWritten;
buffer += bytesWritten;
}
return TRUE;
@ -476,7 +520,7 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
else
m &= ~S_IWUSR;
if (m != st.st_mode)
fchmod(file->fd, st.st_mode);
fchmod(file->fd, m);
}
#endif
break;
@ -497,6 +541,25 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
Stream_Read_UINT8(input, file->delete_pending);
else
file->delete_pending = 1;
if (file->delete_pending && file->is_dir)
{
/* mstsc causes this to FAIL if the directory is not empty,
* and that's what the server is expecting. If we wait for
* the close to flag a failure, cut and paste of a folder
* will lose the folder's contents.
*/
int status;
status = rmdir(file->fullpath);
if (status == 0)
{
/* Put it back so the normal pending delete will work. */
mkdir(file->fullpath, 0755);
}
else
{
return FALSE;
}
}
break;
case FileRenameInformation:

View File

@ -108,11 +108,11 @@ struct _DRIVE_FILE
DRIVE_FILE* drive_file_new(const char* base_path, const char* path, UINT32 id,
UINT32 DesiredAccess, UINT32 CreateDisposition, UINT32 CreateOptions);
void drive_file_free(DRIVE_FILE* file);
int drive_file_free(DRIVE_FILE* file, BOOL recursive);
BOOL drive_file_seek(DRIVE_FILE* file, UINT64 Offset);
BOOL drive_file_read(DRIVE_FILE* file, BYTE* buffer, UINT32* Length);
BOOL drive_file_write(DRIVE_FILE* file, BYTE* buffer, UINT32 Length);
BOOL drive_file_write(DRIVE_FILE* file, const BYTE* buffer, UINT32 Length);
BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, wStream* output);
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, wStream* input);
BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYTE InitialQuery,

View File

@ -159,7 +159,8 @@ static void drive_process_irp_create(DRIVE_DEVICE* disk, IRP* irp)
/* map errno to windows result */
irp->IoStatus = drive_map_posix_err(file->err);
drive_file_free(file);
/* Already in the error path, no need to check return value here. */
(void) drive_file_free(file, TRUE);
}
else
{
@ -208,10 +209,12 @@ static void drive_process_irp_close(DRIVE_DEVICE* disk, IRP* irp)
}
else
{
int err;
DEBUG_SVC("%s(%d) closed.", file->fullpath, file->id);
list_remove(disk->files, file);
drive_file_free(file);
if ((err = drive_file_free(file, FALSE)) != 0)
irp->IoStatus = drive_map_posix_err(err);
}
Stream_Zero(irp->output, 5); /* Padding(5) */
@ -672,8 +675,9 @@ static void drive_free(DEVICE* device)
_aligned_free(disk->pIrpList);
/* Cleaning up; no need to check for drive_file_free error. */
while ((file = (DRIVE_FILE*) list_dequeue(disk->files)) != NULL)
drive_file_free(file);
(void) drive_file_free(file, TRUE);
list_free(disk->files);

View File

@ -286,6 +286,7 @@ static void parallel_free(DEVICE* device)
MessageQueue_PostQuit(parallel->queue, 0);
WaitForSingleObject(parallel->thread, INFINITE);
Stream_Free(parallel->device.data, TRUE);
MessageQueue_Free(parallel->queue);
CloseHandle(parallel->thread);

View File

@ -179,13 +179,16 @@ static void* printer_thread_func(void* arg)
{
IRP* irp;
PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) arg;
HANDLE obj[] = {printer_dev->event, printer_dev->stopEvent};
while (1)
{
WaitForSingleObject(printer_dev->event, INFINITE);
DWORD rc = WaitForMultipleObjects(2, obj, FALSE, INFINITE);
if (WaitForSingleObject(printer_dev->stopEvent, 0) == WAIT_OBJECT_0)
if (rc == WAIT_OBJECT_0 + 1)
break;
else if( rc != WAIT_OBJECT_0 )
continue;
ResetEvent(printer_dev->event);

View File

@ -63,7 +63,9 @@ struct _SERIAL_DEVICE
SERIAL_TTY* tty;
HANDLE thread;
HANDLE mthread;
HANDLE stopEvent;
HANDLE newEvent;
wQueue* queue;
LIST* pending_irps;
@ -80,6 +82,7 @@ static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32
static void serial_check_for_events(SERIAL_DEVICE* serial);
static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp);
static BOOL serial_check_fds(SERIAL_DEVICE* serial);
static void* serial_thread_mfunc(void* arg);
static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
{
@ -113,6 +116,18 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
else
{
serial->tty = tty;
serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_NONE,
STATUS_CANCELLED);
serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_READ,
STATUS_CANCELLED);
serial_abort_single_io(serial, serial->timeout_id, SERIAL_ABORT_IO_WRITE,
STATUS_CANCELLED);
serial->mthread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) serial_thread_mfunc, (void*) serial,
0, NULL);
DEBUG_SVC("%s(%d) created.", serial->path, FileId);
}
@ -139,6 +154,11 @@ static void serial_process_irp_close(SERIAL_DEVICE* serial, IRP* irp)
{
DEBUG_SVC("%s(%d) closed.", serial->path, tty->id);
TerminateThread(serial->mthread, 0);
WaitForSingleObject(serial->mthread, INFINITE);
CloseHandle(serial->mthread);
serial->mthread = NULL;
serial_tty_free(tty);
serial->tty = NULL;
}
@ -318,36 +338,66 @@ static void serial_process_irp(SERIAL_DEVICE* serial, IRP* irp)
serial_check_for_events(serial);
}
/* This thread is used as a workaround for the missing serial event
* support in WaitForMultipleObjects.
* It monitors the terminal for events and posts it in a supported
* form that WaitForMultipleObjects can use it. */
void* serial_thread_mfunc(void* arg)
{
SERIAL_DEVICE* serial = (SERIAL_DEVICE*)arg;
while(1)
{
int sl;
fd_set rd;
if(!serial->tty || serial->tty->fd <= 0)
{
DEBUG_WARN("Monitor thread still running, but no terminal opened!");
sleep(1);
}
else
{
FD_ZERO(&rd);
FD_SET(serial->tty->fd, &rd);
sl = select(serial->tty->fd + 1, &rd, NULL, NULL, NULL);
if( sl > 0 )
SetEvent(serial->newEvent);
}
}
return NULL;
}
static void* serial_thread_func(void* arg)
{
IRP* irp;
DWORD status;
SERIAL_DEVICE* serial = (SERIAL_DEVICE*)arg;
HANDLE ev[] = {serial->stopEvent, Queue_Event(serial->queue), serial->newEvent};
while (1)
{
if (WaitForSingleObject(serial->stopEvent, 0) == WAIT_OBJECT_0)
status = WaitForMultipleObjects(3, ev, FALSE, INFINITE);
if (WAIT_OBJECT_0 == status)
break;
status = WaitForSingleObject(Queue_Event(serial->queue), 10);
if ((status != WAIT_OBJECT_0) && (status != WAIT_TIMEOUT))
break;
serial->nfds = 1;
else if (status == WAIT_OBJECT_0 + 1)
{
FD_ZERO(&serial->read_fds);
FD_ZERO(&serial->write_fds);
serial->tv.tv_sec = 1;
serial->tv.tv_sec = 0;
serial->tv.tv_usec = 0;
serial->select_timeout = 0;
if (status == WAIT_OBJECT_0)
{
if ((irp = (IRP*) Queue_Dequeue(serial->queue)))
serial_process_irp(serial, irp);
}
else if (status == WAIT_OBJECT_0 + 2)
ResetEvent(serial->newEvent);
if(serial->tty)
serial_check_fds(serial);
}
@ -367,10 +417,25 @@ static void serial_free(DEVICE* device)
DEBUG_SVC("freeing device");
/* Stop thread */
SetEvent(serial->stopEvent);
if(serial->mthread)
{
TerminateThread(serial->mthread, 0);
WaitForSingleObject(serial->mthread, INFINITE);
CloseHandle(serial->mthread);
}
WaitForSingleObject(serial->thread, INFINITE);
/* TODO: free lists */
serial_tty_free(serial->tty);
/* Clean up resources */
Stream_Free(serial->device.data, TRUE);
Queue_Free(serial->queue);
list_free(serial->pending_irps);
CloseHandle(serial->stopEvent);
CloseHandle(serial->newEvent);
CloseHandle(serial->thread);
free(serial);
}
@ -383,6 +448,11 @@ static void serial_abort_single_io(SERIAL_DEVICE* serial, UINT32 file_id, UINT32
DEBUG_SVC("[in] pending size %d", list_size(serial->pending_irps));
tty = serial->tty;
if(!tty)
{
DEBUG_WARN("tty = %p", tty);
return;
}
switch (abort_io)
{
@ -433,6 +503,11 @@ static void serial_check_for_events(SERIAL_DEVICE* serial)
SERIAL_TTY* tty;
tty = serial->tty;
if(!tty)
{
DEBUG_WARN("tty = %p", tty);
return;
}
DEBUG_SVC("[in] pending size %d", list_size(serial->pending_irps));
@ -478,6 +553,11 @@ void serial_get_timeouts(SERIAL_DEVICE* serial, IRP* irp, UINT32* timeout, UINT3
DEBUG_SVC("length read %u", Length);
tty = serial->tty;
if(!tty)
{
DEBUG_WARN("tty = %p", tty);
return;
}
*timeout = (tty->read_total_timeout_multiplier * Length) + tty->read_total_timeout_constant;
*interval_timeout = tty->read_interval_timeout;
@ -492,6 +572,11 @@ static void serial_handle_async_irp(SERIAL_DEVICE* serial, IRP* irp)
SERIAL_TTY* tty;
tty = serial->tty;
if(!tty)
{
DEBUG_WARN("tty = %p", tty);
return;
}
switch (irp->MajorFunction)
{
@ -542,6 +627,11 @@ static void __serial_check_fds(SERIAL_DEVICE* serial)
ZeroMemory(&serial->tv, sizeof(struct timeval));
tty = serial->tty;
if(!tty)
{
DEBUG_WARN("tty = %p", tty);
return;
}
/* scan every pending */
irp = list_peek(serial->pending_irps);
@ -604,6 +694,11 @@ static void serial_set_fds(SERIAL_DEVICE* serial)
DEBUG_SVC("[in] pending size %d", list_size(serial->pending_irps));
tty = serial->tty;
if(!tty)
{
DEBUG_WARN("tty = %p", tty);
return;
}
irp = (IRP*) list_peek(serial->pending_irps);
while (irp)
@ -636,6 +731,13 @@ static BOOL serial_check_fds(SERIAL_DEVICE* serial)
if (list_size(serial->pending_irps) == 0)
return 1;
FD_ZERO(&serial->read_fds);
FD_ZERO(&serial->write_fds);
serial->tv.tv_sec = 0;
serial->tv.tv_usec = 0;
serial->select_timeout = 0;
serial_set_fds(serial);
DEBUG_SVC("waiting %lu %lu", serial->tv.tv_sec, serial->tv.tv_usec);
@ -702,10 +804,13 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
serial->pending_irps = list_new();
serial->stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
serial->newEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
pEntryPoints->RegisterDevice(pEntryPoints->devman, (DEVICE*) serial);
serial->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) serial_thread_func, (void*) serial, 0, NULL);
serial->thread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE) serial_thread_func, (void*) serial, 0, NULL);
serial->mthread = NULL;
}
return 0;

View File

@ -412,7 +412,11 @@ BOOL serial_tty_read(SERIAL_TTY* tty, BYTE* buffer, UINT32* Length)
status = read(tty->fd, buffer, *Length);
if (status < 0)
{
DEBUG_WARN("failed with %zd, errno=[%d] %s\n",
status, errno, strerror(errno));
return FALSE;
}
tty->event_txempty = status;
*Length = status;
@ -456,6 +460,9 @@ void serial_tty_free(SERIAL_TTY* tty)
{
DEBUG_SVC("in");
if(!tty)
return;
if (tty->fd >= 0)
{
if (tty->pold_termios)

View File

@ -44,8 +44,7 @@ static void smartcard_free(DEVICE* dev)
SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) dev;
SetEvent(smartcard->stopEvent);
CloseHandle(smartcard->thread);
CloseHandle(smartcard->irpEvent);
WaitForSingleObject(smartcard->thread, INFINITE);
while ((irp = (IRP*) InterlockedPopEntrySList(smartcard->pIrpList)) != NULL)
irp->Discard(irp);
@ -57,6 +56,12 @@ static void smartcard_free(DEVICE* dev)
while ((CompletionIdInfo = (COMPLETIONIDINFO*) list_dequeue(smartcard->CompletionIds)) != NULL)
free(CompletionIdInfo);
CloseHandle(smartcard->thread);
CloseHandle(smartcard->irpEvent);
CloseHandle(smartcard->stopEvent);
CloseHandle(smartcard->CompletionIdsMutex);
Stream_Free(smartcard->device.data, TRUE);
list_free(smartcard->CompletionIds);
/* End TS Client defect workaround. */
@ -119,13 +124,16 @@ static void smartcard_process_irp_thread_func(SMARTCARD_IRP_WORKER* irpWorker)
static void* smartcard_thread_func(void* arg)
{
SMARTCARD_DEVICE* smartcard = (SMARTCARD_DEVICE*) arg;
HANDLE ev[] = {smartcard->irpEvent, smartcard->stopEvent};
while (1)
{
WaitForSingleObject(smartcard->irpEvent, INFINITE);
DWORD status = WaitForMultipleObjects(2, ev, FALSE, INFINITE);
if (WaitForSingleObject(smartcard->stopEvent, 0) == WAIT_OBJECT_0)
if (status == WAIT_OBJECT_0 + 1)
break;
else if(status != WAIT_OBJECT_0)
continue;
ResetEvent(smartcard->irpEvent);
smartcard_process_irp_list(smartcard);

View File

@ -43,12 +43,35 @@
#define AVMEDIA_TYPE_AUDIO 1
#endif
#if LIBAVCODEC_VERSION_MAJOR < 54
#define MAX_AUDIO_FRAME_SIZE AVCODEC_MAX_AUDIO_FRAME_SIZE
#else
#define MAX_AUDIO_FRAME_SIZE 192000
#endif
#if LIBAVCODEC_VERSION_MAJOR < 55
#define AV_CODEC_ID_VC1 CODEC_ID_VC1
#define AV_CODEC_ID_WMAV2 CODEC_ID_WMAV2
#define AV_CODEC_ID_WMAPRO CODEC_ID_WMAPRO
#define AV_CODEC_ID_MP3 CODEC_ID_MP3
#define AV_CODEC_ID_MP2 CODEC_ID_MP2
#define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO
#define AV_CODEC_ID_WMV3 CODEC_ID_WMV3
#define AV_CODEC_ID_AAC CODEC_ID_AAC
#define AV_CODEC_ID_H264 CODEC_ID_H264
#define AV_CODEC_ID_AC3 CODEC_ID_AC3
#endif
typedef struct _TSMFFFmpegDecoder
{
ITSMFDecoder iface;
int media_type;
#if LIBAVCODEC_VERSION_MAJOR < 55
enum CodecID codec_id;
#else
enum AVCodecID codec_id;
#endif
AVCodecContext* codec_context;
AVCodec* codec;
AVFrame* frame;
@ -97,7 +120,7 @@ static BOOL tsmf_ffmpeg_init_audio_stream(ITSMFDecoder* decoder, const TS_AM_MED
mdecoder->codec_context->bit_rate = media_type->BitRate;
mdecoder->codec_context->channels = media_type->Channels;
mdecoder->codec_context->block_align = media_type->BlockAlign;
#if LIBAVCODEC_VERSION_MAJOR < 55
#ifdef AV_CPU_FLAG_SSE2
mdecoder->codec_context->dsp_mask = AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2;
#else
@ -107,7 +130,13 @@ static BOOL tsmf_ffmpeg_init_audio_stream(ITSMFDecoder* decoder, const TS_AM_MED
mdecoder->codec_context->dsp_mask = FF_MM_SSE2 | FF_MM_MMX2;
#endif
#endif
#else /* LIBAVCODEC_VERSION_MAJOR < 55 */
#ifdef AV_CPU_FLAG_SSE2
av_set_cpu_flags_mask(AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2);
#else
av_set_cpu_flags_mask(FF_MM_SSE2 | FF_MM_MMX2);
#endif
#endif /* LIBAVCODEC_VERSION_MAJOR < 55 */
return TRUE;
}
@ -216,28 +245,28 @@ static BOOL tsmf_ffmpeg_set_format(ITSMFDecoder* decoder, TS_AM_MEDIA_TYPE* medi
switch (media_type->SubType)
{
case TSMF_SUB_TYPE_WVC1:
mdecoder->codec_id = CODEC_ID_VC1;
mdecoder->codec_id = AV_CODEC_ID_VC1;
break;
case TSMF_SUB_TYPE_WMA2:
mdecoder->codec_id = CODEC_ID_WMAV2;
mdecoder->codec_id = AV_CODEC_ID_WMAV2;
break;
case TSMF_SUB_TYPE_WMA9:
mdecoder->codec_id = CODEC_ID_WMAPRO;
mdecoder->codec_id = AV_CODEC_ID_WMAPRO;
break;
case TSMF_SUB_TYPE_MP3:
mdecoder->codec_id = CODEC_ID_MP3;
mdecoder->codec_id = AV_CODEC_ID_MP3;
break;
case TSMF_SUB_TYPE_MP2A:
mdecoder->codec_id = CODEC_ID_MP2;
mdecoder->codec_id = AV_CODEC_ID_MP2;
break;
case TSMF_SUB_TYPE_MP2V:
mdecoder->codec_id = CODEC_ID_MPEG2VIDEO;
mdecoder->codec_id = AV_CODEC_ID_MPEG2VIDEO;
break;
case TSMF_SUB_TYPE_WMV3:
mdecoder->codec_id = CODEC_ID_WMV3;
mdecoder->codec_id = AV_CODEC_ID_WMV3;
break;
case TSMF_SUB_TYPE_AAC:
mdecoder->codec_id = CODEC_ID_AAC;
mdecoder->codec_id = AV_CODEC_ID_AAC;
/* For AAC the pFormat is a HEAACWAVEINFO struct, and the codec data
is at the end of it. See
http://msdn.microsoft.com/en-us/library/dd757806.aspx */
@ -249,10 +278,10 @@ static BOOL tsmf_ffmpeg_set_format(ITSMFDecoder* decoder, TS_AM_MEDIA_TYPE* medi
break;
case TSMF_SUB_TYPE_H264:
case TSMF_SUB_TYPE_AVC1:
mdecoder->codec_id = CODEC_ID_H264;
mdecoder->codec_id = AV_CODEC_ID_H264;
break;
case TSMF_SUB_TYPE_AC3:
mdecoder->codec_id = CODEC_ID_AC3;
mdecoder->codec_id = AV_CODEC_ID_AC3;
break;
default:
return FALSE;
@ -351,7 +380,7 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
#endif
if (mdecoder->decoded_size_max == 0)
mdecoder->decoded_size_max = AVCODEC_MAX_AUDIO_FRAME_SIZE + 16;
mdecoder->decoded_size_max = MAX_AUDIO_FRAME_SIZE + 16;
mdecoder->decoded_data = malloc(mdecoder->decoded_size_max);
ZeroMemory(mdecoder->decoded_data, mdecoder->decoded_size_max);
/* align the memory for SSE2 needs */
@ -363,7 +392,7 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE* data, UI
while (src_size > 0)
{
/* Ensure enough space for decoding */
if (mdecoder->decoded_size_max - mdecoder->decoded_size < AVCODEC_MAX_AUDIO_FRAME_SIZE)
if (mdecoder->decoded_size_max - mdecoder->decoded_size < MAX_AUDIO_FRAME_SIZE)
{
mdecoder->decoded_size_max = mdecoder->decoded_size_max * 2 + 16;
mdecoder->decoded_data = realloc(mdecoder->decoded_data, mdecoder->decoded_size_max);

View File

@ -31,6 +31,10 @@ set(${MODULE_PREFIX}_SRCS
include_directories(..)
find_package(UDev REQUIRED)
find_package(UUID REQUIRED)
find_package(DbusGlib REQUIRED)
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry")
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
@ -38,9 +42,9 @@ set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
#set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} libusb-devman)
set(${MODULE_PREFIX}_LIBS
dbus-glib-1
udev
uuid)
${DBUS_GLIB_LIBRARIES}
${UDEV_LIBRARIES}
${UUID_LIBRARIES})
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}

View File

@ -27,6 +27,8 @@ set(${MODULE_PREFIX}_SRCS
include_directories(..)
find_package(libusb-1.0 REQUIRED)
add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "")
set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
@ -35,9 +37,10 @@ set(${MODULE_PREFIX}_LIBS
${CMAKE_THREAD_LIBS_INIT})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS}
dbus-glib-1
usb-1.0
udev)
${DBUS_GLIB_LIBRARIES}
${UUID_LIBRARIES}
${LIBUSB_1_LIBRARIES}
)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}

View File

@ -0,0 +1,6 @@
message("PRELOADING android cache")
set(CMAKE_TOOLCHAIN_FILE "cmake/AndroidToolchain.cmake" CACHE PATH "ToolChain file")
set(FREERDP_ANDROID_EXTERNAL_SSL_PATH $ENV{ANDROID_SSL_PATH} CACHE PATH "android ssl")
# ANDROID_NDK and ANDROID_SDK must be set as environment variable
#set(ANDROID_NDK $ENV{ANDROID_SDK} CACHE PATH "Android NDK")
#set(ANDROID_SDK "${ANDROID_NDK}" CACHE PATH "android SDK")

View File

@ -0,0 +1,9 @@
message("PRELOADING cache")
set (WITH_MANPAGES OFF CACHE BOOL "man pages")
set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "build type")
set (WITH_CUPS OFF CACHE BOOL "CUPS printing")
set (WITH_ALSA OFF CACHE BOOL "alsa audio")
set (WITH_FFMPEG OFF CACHE BOOL "ffmepg support")
set (WITH_XV OFF CACHE BOOL "xvideo support")
set (BUILD_TESTING ON CACHE BOOL "build testing")
set (WITH_XSHM OFF CACHE BOOL "build with xshm support")

View File

@ -0,0 +1,5 @@
message("PRELOADING android cache")
set(CMAKE_TOOLCHAIN_FILE "cmake/iOSToolchain.cmake" CACHE PATH "ToolChain file")
set(FREERDP_IOS_EXTERNAL_SSL_PATH $ENV{FREERDP_IOS_EXTERNAL_SSL_PATH} CACHE PATH "android ssl")
set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "build type")
set(IOS_PLATFORM "SIMULATOR" CACHE STRING "iso platfrorm to build")

View File

@ -0,0 +1,9 @@
message("PRELOADING cache")
set (BUILD_TESTING ON CACHE BOOL "testing")
set (WITH_MANPAGES OFF CACHE BOOL "man pages")
set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "build type")
set (BUILD_TESTING ON CACHE BOOL "build testing")
set (WITH_PULSE ON CACHE BOOL "pulse")
set (WITH_CHANNELS ON CACHE BOOL "channels")
set (STATIC_CHANNELS ON CACHE BOOL "static channels")
set (WITH_CUPS ON CACHE BOOL "cups")

View File

@ -0,0 +1,5 @@
message("PRELOADING mac cache")
set (WITH_MANPAGES OFF CACHE BOOL "man pages")
set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "build type")
set (WITH_CUPS OFF CACHE BOOL "CUPS printing")
set (BUILD_TESTING OFF CACHE BOOL "build testing")

View File

@ -0,0 +1,9 @@
message("PRELOADING cache")
set (WITH_MANPAGES OFF CACHE BOOL "man pages")
set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "build type")
set (WITH_CUPS OFF CACHE BOOL "CUPS printing")
set (WITH_ALSA OFF CACHE BOOL "alsa audio")
set (WITH_FFMPEG OFF CACHE BOOL "ffmepg support")
set (WITH_XV OFF CACHE BOOL "xvideo support")
set (BUILD_TESTING ON CACHE BOOL "build testing")
set (WITH_XSHM OFF CACHE BOOL "build with xshm support")

View File

@ -0,0 +1,3 @@
message("PRELOADING windows cache")
set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "build type")
#set (BUILD_TESTING ON CACHE BOOL "build testing")

View File

@ -25,6 +25,7 @@
#include <freerdp/utils/event.h>
#include <freerdp/constants.h>
#include <freerdp/locale/keyboard.h>
#include <freerdp/version.h>
#include <android/bitmap.h>

View File

@ -1,5 +1,11 @@
project(MacFreeRDP-library)
if(${CMAKE_VERSION} GREATER 2.8.12)
cmake_policy(SET CMP0026 OLD)
cmake_policy(SET CMP0045 OLD)
endif()
set(MODULE_NAME "MacFreeRDP-library")
set(MODULE_OUTPUT_NAME "MacFreeRDP")
set(MODULE_PREFIX "FREERDP_CLIENT_MAC-LIB")

View File

@ -67,6 +67,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fobjc-nonfragile-abi")
# Tell the compiler where to look for the FreeRDP framework
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -F../")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -F../")
# Tell XCode where to look for the MacFreeRDP framework
set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_FRAMEWORK_SEARCH_PATHS

2
client/X11/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.xml
generate_argument_docbook

View File

@ -18,7 +18,7 @@
set(MODULE_NAME "xfreerdp-client")
set(MODULE_PREFIX "FREERDP_CLIENT_X11_CONTROL")
include(FindXmlto)
include(FindDocBookXSL)
include_directories(${X11_INCLUDE_DIRS})
set(${MODULE_PREFIX}_SRCS
@ -65,18 +65,55 @@ set(${MODULE_PREFIX}_LIBS
${CMAKE_DL_LIBS})
if(WITH_MANPAGES)
if(XMLTO_FOUND)
find_program( XSLTPROC_EXECUTABLE NAMES xsltproc)
if(DOCBOOKXSL_FOUND AND XSLTPROC_EXECUTABLE)
# We need the variable ${MAN_TODAY} to contain the current date in ISO
# format to replace it in the configure_file step.
include(today)
TODAY(MAN_TODAY)
configure_file(xfreerdp.1.xml.in xfreerdp.1.xml @ONLY IMMEDIATE)
add_executable(generate_argument_docbook generate_argument_docbook.c)
set(GAD_LIBS freerdp-client)
set_complex_link_libraries(VARIABLE GAD_LIBS MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-utils)
set_complex_link_libraries(VARIABLE GAD_LIBS MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-core freerdp-utils)
message(WARNING "GAD_LIBS: ${GAD_LIBS}")
target_link_libraries(generate_argument_docbook ${GAD_LIBS})
add_custom_command(OUTPUT xfreerdp.1
COMMAND ${XMLTO_EXECUTABLE} man ${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp.1.xml
DEPENDS xfreerdp.1.xml)
COMMAND generate_argument_docbook
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-channels.1.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-examples.1.xml ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${XSLTPROC_EXECUTABLE} ${DOCBOOKXSL_DIR}/manpages/docbook.xsl xfreerdp.1.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1.xml
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-examples.1.xml
${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-channels.1.xml
generate_argument_docbook)
add_custom_target(xfreerdp.manpage ALL
DEPENDS xfreerdp.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1 DESTINATION share/man/man1)
else(XMLTO_FOUND)
message(WARNING "WITH_MANPAGES was set, but xmlto was not found. man-pages will not be installed")
endif(XMLTO_FOUND)
else()
message(WARNING "WITH_MANPAGES was set, but xsltproc was not found. man-pages will not be installed")
endif()
endif(WITH_MANPAGES)
set(XSHM_FEATURE_TYPE "REQUIRED")

View File

@ -0,0 +1,177 @@
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <winpr/cmdline.h>
/* We need to include the command line c file to get access to
* the argument struct. */
#include "../common/cmdline.c"
LPSTR tmp = NULL;
LPCSTR tr_esc_str(LPCSTR arg)
{
size_t cs = 0, x, ds;
size_t s;
if( NULL == arg )
return NULL;
s = strlen(arg);
/* Find trailing whitespaces */
while( (s > 0) && isspace(arg[s-1]))
s--;
/* Prepare a initial buffer with the size of the result string. */
tmp = malloc(s * sizeof(LPCSTR));
if( NULL == tmp )
{
fprintf(stderr, "Could not allocate string buffer.");
exit(-2);
}
/* Copy character for character and check, if it is necessary to escape. */
ds = s + 1;
for(x=0; x<s; x++)
{
switch(arg[x])
{
case '<':
ds += 3;
tmp = realloc(tmp, ds * sizeof(LPCSTR));
if( NULL == tmp )
{
fprintf(stderr, "Could not reallocate string buffer.");
exit(-3);
}
tmp[cs++] = '&';
tmp[cs++] = 'l';
tmp[cs++] = 't';
tmp[cs++] = ';';
break;
case '>':
ds += 3;
tmp = realloc(tmp, ds * sizeof(LPCSTR));
if( NULL == tmp )
{
fprintf(stderr, "Could not reallocate string buffer.");
exit(-4);
}
tmp[cs++] = '&';
tmp[cs++] = 'g';
tmp[cs++] = 't';
tmp[cs++] = ';';
break;
case '\'':
ds += 5;
tmp = realloc(tmp, ds * sizeof(LPCSTR));
if( NULL == tmp )
{
fprintf(stderr, "Could not reallocate string buffer.");
exit(-5);
}
tmp[cs++] = '&';
tmp[cs++] = 'a';
tmp[cs++] = 'p';
tmp[cs++] = 'o';
tmp[cs++] = 's';
tmp[cs++] = ';';
break;
case '"':
ds += 5;
tmp = realloc(tmp, ds * sizeof(LPCSTR));
if( NULL == tmp )
{
fprintf(stderr, "Could not reallocate string buffer.");
exit(-6);
}
tmp[cs++] = '&';
tmp[cs++] = 'q';
tmp[cs++] = 'u';
tmp[cs++] = 'o';
tmp[cs++] = 't';
tmp[cs++] = ';';
break;
case '&':
ds += 4;
tmp = realloc(tmp, ds * sizeof(LPCSTR));
if( NULL == tmp )
{
fprintf(stderr, "Could not reallocate string buffer.");
exit(-7);
}
tmp[cs++] = '&';
tmp[cs++] = 'a';
tmp[cs++] = 'm';
tmp[cs++] = 'p';
tmp[cs++] = ';';
break;
default:
tmp[cs++] = arg[x];
break;
}
/* Assure, the string is '\0' terminated. */
tmp[ds-1] = '\0';
}
return tmp;
}
int main(int argc, char *argv[])
{
size_t elements = sizeof(args)/sizeof(args[0]);
size_t x;
const char *fname = "xfreerdp-argument.1.xml";
FILE *fp = NULL;
/* Open output file for writing, truncate if existing. */
fp = fopen(fname, "w");
if( NULL == fp )
{
fprintf(stderr, "Could not open '%s' for writing.", fname);
return -1;
}
/* The tag used as header in the manpage */
fprintf(fp, "<refsect1>\n");
fprintf(fp, "\t<title>Options</title>\n");
fprintf(fp, "\t\t<variablelist>\n");
/* Iterate over argument struct and write data to docbook 4.5
* compatible XML */
if( elements < 2 )
{
fprintf(stderr, "The argument array 'args' is empty, writing an empty file.");
elements = 1;
}
for(x=0; x<elements - 1; x++)
{
const COMMAND_LINE_ARGUMENT_A *arg = &args[x];
fprintf(fp, "\t\t\t<varlistentry>\n");
if( COMMAND_LINE_VALUE_REQUIRED == arg->Flags )
fprintf(fp, "\t\t\t\t<term><option>/%s</option> <replaceable>%s</replaceable></term>\n", tr_esc_str(arg->Name), tr_esc_str(arg->Format) );
else
fprintf(fp, "\t\t\t\t<term><option>/%s</option></term>\n", tr_esc_str(arg->Name) );
fprintf(fp, "\t\t\t\t<listitem>\n");
fprintf(fp, "\t\t\t\t\t<para>%s</para>\n", tr_esc_str(arg->Text));
fprintf(fp, "\t\t\t\t</listitem>\n");
fprintf(fp, "\t\t\t</varlistentry>\n");
}
fprintf(fp, "\t\t</variablelist>\n");
fprintf(fp, "\t</refsect1>\n");
fclose(fp);
if(NULL != tmp)
free(tmp);
return 0;
}

View File

@ -914,7 +914,7 @@ static void xf_cliprdr_process_unicodetext(clipboardContext* cb, BYTE* data, int
crlf2lf(cb->data, &cb->data_length);
}
static void xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size)
static BOOL xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size)
{
wStream* s;
UINT16 bpp;
@ -926,12 +926,18 @@ static void xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size)
if (size < 40)
{
DEBUG_X11_CLIPRDR("dib size %d too short", size);
return;
return FALSE;
}
s = Stream_New(data, size);
Stream_Seek(s, 14);
Stream_Read_UINT16(s, bpp);
if ((bpp < 1) || (bpp > 32))
{
fprintf(stderr, "%s: invalid bpp value %d", __FUNCTION__, bpp);
return FALSE;
}
Stream_Read_UINT32(s, ncolors);
offset = 14 + 40 + (bpp <= 8 ? (ncolors == 0 ? (1 << bpp) : ncolors) * 4 : 0);
Stream_Free(s, FALSE);
@ -949,6 +955,7 @@ static void xf_cliprdr_process_dib(clipboardContext* cb, BYTE* data, int size)
cb->data = Stream_Buffer(s);
cb->data_length = Stream_GetPosition(s);
Stream_Free(s, FALSE);
return TRUE;
}
static void xf_cliprdr_process_html(clipboardContext* cb, BYTE* data, int size)

View File

@ -102,13 +102,13 @@ void xf_kbd_send_key(xfContext* xfc, BOOL down, BYTE keycode)
else if (rdp_scancode == RDP_SCANCODE_PAUSE &&
!xf_kbd_key_pressed(xfc, XK_Control_L) && !xf_kbd_key_pressed(xfc, XK_Control_R))
{
/* Pause without Ctrl has to be sent as Ctrl + NumLock. */
/* Pause without Ctrl has to be sent as a series of keycodes
* in a single input PDU. Pause only happens on "press";
* no code is sent on "release".
*/
if (down)
{
freerdp_input_send_keyboard_event_ex(input, TRUE, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_ex(input, TRUE, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_event_ex(input, FALSE, RDP_SCANCODE_LCONTROL);
freerdp_input_send_keyboard_event_ex(input, FALSE, RDP_SCANCODE_NUMLOCK);
freerdp_input_send_keyboard_pause_event(input);
}
}
else

View File

View File

@ -0,0 +1,89 @@
<refsect1>
<title>Examples</title>
<variablelist>
<varlistentry>
<term><command>xfreerdp connection.rdp /p:Pwd123! /f</command></term>
<listitem>
<para>Connect in fullscreen mode using a stored configuration <replaceable>connection.rdp</replaceable> and the password <replaceable>Pwd123!</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>xfreerdp /u:CONTOSO\\JohnDoe /p:Pwd123! /v:rdp.contoso.com</command></term>
<listitem>
<para>Connect to host <replaceable>rdp.contoso.com</replaceable> with user <replaceable>CONTOSO\\JohnDoe</replaceable> and password <replaceable>Pwd123!</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>xfreerdp /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192.168.1.100:4489</command></term>
<listitem>
<para>Connect to host <replaceable>192.168.1.100</replaceable> on port <replaceable>4489</replaceable> with user <replaceable>JohnDoe</replaceable>, password <replaceable>Pwd123!</replaceable>. The screen width is set to <replaceable>1366</replaceable> and the height to <replaceable>768</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>xfreerdp /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 /v:192.168. 1.100</command></term>
<listitem>
<para>Establish a connection to host <replaceable>192.168.1.100</replaceable> with user <replaceable>JohnDoe</replaceable>, password <replaceable>Pwd123!</replaceable> and connect to Hyper-V console (use port 2179, disable negotiation) with VMID <replaceable>C824F53E-95D2-46C6-9A18-23A5BB403532</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>+clipboard</command></term>
<listitem>
<para>Activate clipboard redirection</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/drive:home,/home/user</command></term>
<listitem>
<para>Activate drive redirection of <replaceable>/home/user</replaceable> as home drive</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/smartcard:&lt;device&gt;</command></term>
<listitem>
<para>Activate smartcard redirection for device <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/printer:&lt;device&gt;,&lt;driver&gt;</command></term>
<listitem>
<para>Activate printer redirection for printer <replaceable>device</replaceable> using driver <replaceable>driver</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/serial:&lt;device&gt;</command></term>
<listitem>
<para>Activate serial port redirection for port <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/parallel:&lt;device&gt;</command></term>
<listitem>
<para>Activate parallel port redirection for port <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/sound:sys:alsa</command></term>
<listitem>
<para>Activate audio output redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/microphone:sys:alsa</command></term>
<listitem>
<para>Activate audio input redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/multimedia:sys:alsa</command></term>
<listitem>
<para>Activate multimedia redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/usb:id,dev:054c:0268</command></term>
<listitem>
<para>Activate USB device redirection for the device identified by <replaceable>054c:0268</replaceable></para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -1,571 +0,0 @@
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry>
<refentryinfo>
<date>2011-08-27</date>
<author>
<authorblurb><para>The FreeRDP Team</para></authorblurb>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>xfreerdp</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="source">freerdp</refmiscinfo>
<refmiscinfo class="manual">xfreerdp</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>xfreerdp</application></refname>
<refpurpose>FreeRDP X11 client</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>2011-08-27</date>
</refsynopsisdivinfo>
<para>
<command>xfreerdp</command> [options] server[:port] [[options] server[:port] …]
</para>
</refsynopsisdiv>
<refsect1>
<refsect1info>
<date>2011-08-27</date>
</refsect1info>
<title>DESCRIPTION</title>
<para>
<command>xfreerdp</command> is an X11 Remote Desktop Protocol (RDP)
client which is part of the FreeRDP project. An RDP server is built-in
to many editions of Windows. Alternative servers included xrdp and VRDP (VirtualBox).
</para>
</refsect1>
<refsect1>
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>-0</term>
<listitem>
<para>
Attach to the admin console of the server.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-a <replaceable class="parameter">bpp</replaceable></term>
<listitem>
<para>
Sets the color depth for the connection to <replaceable class="parameter">bpp</replaceable> bits per pixel.
Valid values are 8, 15, 16, 24 and 32. The default value is the color depth of the FreeRDP-window.
</para>
</listitem>
</varlistentry>
<varlistentry id="WorkingDir">
<term>-c <replaceable class="parameter">dir</replaceable></term>
<listitem>
<para>
Sets the working-dir to <replaceable class="parameter">dir</replaceable>.
This parameter is only used when an AlternateShell (<xref linkend="AlternateShell"/>) is requested.
<replaceable class="parameter">dir</replaceable> should contain the executable file specified in the AlternateShell.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-D</term>
<listitem>
<para>
Removes the windows decorations.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-d</term>
<listitem>
<para>
Domain used in authentication.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-f</term>
<listitem>
<para>
start in full screen mode. This mode can always be en- and disabled using Ctrl-Alt-Enter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-T <replaceable class="parameter">text</replaceable></term>
<listitem>
<para>
Sets the window title to <replaceable class="parameter">text</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-g <replaceable class="parameter">geometry</replaceable></term>
<listitem>
<para>
Sets the size of the FreeRDP window (and of the remote desktop, when establishing a new connection).
<replaceable class="parameter">geometry</replaceable> can have one of the following forms:
<itemizedlist>
<listitem>
<para>
<replaceable class="parameter">W</replaceable>x<replaceable class="parameter">H</replaceable> -
in this case the resulting window will be of
<replaceable class="parameter">W</replaceable>x<replaceable class="parameter">H</replaceable> pixels.
</para>
</listitem>
<listitem>
<para>
<replaceable class="parameter">P</replaceable>% -
in this case the resulting window will be <replaceable class="parameter">P</replaceable>%
of your screen.
</para>
</listitem>
<listitem>
<para>
The special keyword <emphasis>workarea</emphasis> -
in this case the resulting window will be of the same size as your workarea.
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-h</term>
<listitem>
<para>
Print help.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-k <replaceable class="parameter">id</replaceable></term>
<listitem>
<para>
Sets the keyboard-layout-id to <replaceable class="parameter">id</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-K</term>
<listitem>
<para>
Do not interfere with window manager bindings. Normally, xfreerdp captures all keystrokes while its window is focused.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-n <replaceable class="parameter">hostname</replaceable></term>
<listitem>
<para>
Set the reported client hostname to <replaceable class="parameter">hostname</replaceable>.
Default is to automatically detect the hostname.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-o</term>
<listitem>
<para>
Play audio on the console instead of redirecting to the client.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-p <replaceable class="parameter">password</replaceable></term>
<listitem>
<para>
Password used in authentication.
</para>
</listitem>
</varlistentry>
<varlistentry id="AlternateShell">
<term>-s <replaceable class="parameter">shell</replaceable></term>
<listitem>
<para>
Sets the startup-shell to <replaceable class="parameter">shell</replaceable>.
This parameter should contain a complete path to the alternate shell.
If the alternete shell requires a different working directory use <xref linkend="WorkingDir"/>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-t <replaceable class="parameter">port</replaceable></term>
<listitem>
<para>
Connect to <replaceable class="parameter">port</replaceable>, instead of the default 3389.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-u <replaceable class="parameter">username</replaceable></term>
<listitem>
<para>
Username used in authentication.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-x <replaceable class="parameter">flag</replaceable></term>
<listitem>
<para>
Set the experience performance flags.
<replaceable class="parameter">flag</replaceable> can be one of:
<itemizedlist>
<listitem>
<para>
m - (modem): Equivalent to 15.
</para>
</listitem>
<listitem>
<para>
b - (broadband): Equivalent to 1.
</para>
</listitem>
<listitem>
<para>
l - (lan): Equivalent to 0.
</para>
</listitem>
<listitem>
<para>
<replaceable class="parameter">num</replaceable> - A hexadecimal number that
represents a bit-mask, were numbers mean the following
<footnote><para>Taken from <ulink url="http://msdn.microsoft.com/en-us/library/cc240476%28v=prot.10%29.aspx">
MS-RDPBCGR Section 2.2.1.11.1.1.1 - Extended Info Packet</ulink></para></footnote>:
<itemizedlist>
<listitem>
<para>1: Disable desktop wallpaper.</para>
</listitem>
<listitem>
<para>2: Disable full-window drag (only the window outline is displayed when the window is moved).</para>
</listitem>
<listitem>
<para>4: Disable menu animations.</para>
</listitem>
<listitem>
<para>8: Disable user interface themes.</para>
</listitem>
<listitem>
<para>20: Disable mouse cursor shadows.</para>
</listitem>
<listitem>
<para>40: Disable cursor blinking.</para>
</listitem>
<listitem>
<para>80: Enable font smoothing.</para>
</listitem>
<listitem>
<para>100: Enable Desktop Composition.</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</itemizedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-X <replaceable class="parameter">xid</replaceable></term>
<listitem>
<para>embed xfreerdp into window with <replaceable class="parameter">xid</replaceable>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-z</term>
<listitem>
<para>
Enable compression.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--app</term>
<listitem>
<para>
initialize a RemoteApp connection. This implies -g workarea.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-auth</term>
<listitem>
<para>
Skips authentication. This is useful e.g. for the current FreeRDP server that doesn't yet support server-side authentication.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--authonly</term>
<listitem>
<para>
Only authenticates. This is useful to test your credentials (username and password).
Returns status code 0 if the client can connect, 1 otherwise. Requires a username,
password and connection host at the command line.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--bcv3 <replaceable class="parameter">codec</replaceable></term>
<listitem>
<para>Use <replaceable class="parameter">codec</replaceable> for bitmap cache v3
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-bmp-cache</term>
<listitem>
<para>
Disable bitmap cache.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--certificate-name <replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
use <replaceable class="parameter">name</replaceable> for the logon certificate, instead of the server name
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--composition</term>
<listitem>
<para>
Enable composition (RDVH only, not to be confused with remote composition).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--ext <replaceable class="parameter">extname</replaceable></term>
<listitem>
<para>
load extension <replaceable class="parameter">extname</replaceable>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-fastpath</term>
<listitem>
<para>
Disables fast-path. Use slow-path packets instead, which have larger headers.
It might be good for debugging certain issues when you suspect it might be
linked to the parsing of one of the two header types.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--from-stdin</term>
<listitem>
<para>Prompts for unspecified arguments -u username, -p
password, -d domain and connection host. This is useful to
hide arguments from ps. Also useful for scripts that will
feed these arguments to the client via (what else?) stdin.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-full-window-drag</term>
<listitem>
<para>
Disable full window drag.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--gdi <replaceable class="parameter">backend</replaceable></term>
<listitem>
<para>
GDI (Graphics Device Interface) rendering backend. <replaceable class="parameter">backend</replaceable> can be either sw (software) or hw (hardware).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--ignore-certificate</term>
<listitem>
<para>
ignore verification of logon certificate.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--kbd-list</term>
<listitem>
<para>
list all keyboard layout ids used by -k
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-menu-animations</term>
<listitem>
<para>
Disable menu animations.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-motion</term>
<listitem>
<para>
Don't send mouse motion events.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-nego</term>
<listitem>
<para>disable negotiation of security layer and enforce highest enabled security protocol.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-nla</term>
<listitem>
<para>
Disable network level authentication.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--nsc</term>
<listitem>
<para>
Enable NSCodec.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-osb</term>
<listitem>
<para>
Disable off screen bitmaps.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--pcb <replaceable class="parameter">blob</replaceable></term>
<listitem>
<para>
Use preconnection <replaceable class="parameter">blob</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--pcid <replaceable class="parameter">id</replaceable></term>
<listitem>
<para>
Use preconnection <replaceable class="parameter">id</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--plugin <replaceable class="parameter">pluginname</replaceable></term>
<listitem>
<para>
load <replaceable class="parameter">pluginname</replaceable>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-rdp</term>
<listitem>
<para>
Disable Standard RDP encryption.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--rfx</term>
<listitem>
<para>
Enable RemoteFX.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--rfx-mode</term>
<listitem>
<para>
RemoteFX operational flags. <replaceable class="parameter">flags</replaceable> can be either v[ideo], i[mage]), default is video.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-salted-checksum</term>
<listitem>
<para>
disable salted checksums with Standard RDP encryption.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--ntlm</term>
<listitem>
<para>
force NTLM protocol version. <replaceable class="parameter">version</replaceable> can be one of 1 or 2.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--sec <replaceable class="parameter">proto</replaceable></term>
<listitem>
<para>
force protocol security. <replaceable class="parameter">proto</replaceable> can be one of rdp, tls or nla.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-theming</term>
<listitem>
<para>
Disable theming.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--no-tls</term>
<listitem>
<para>
Disable TLS encryption.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--tsg
<replaceable class="parameter">username</replaceable>
<replaceable class="parameter">password</replaceable>
<replaceable class="parameter">hostname</replaceable> </term>
<listitem>
<para>
Use Terminal Server Gateway with
<replaceable class="parameter">username</replaceable>
<replaceable class="parameter">password</replaceable>
<replaceable class="parameter">hostname</replaceable>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--version</term>
<listitem>
<para>
Print version information.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>--disable-wallpaper</term>
<listitem>
<para>
Disable wallpaper.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>LINKS</title>
<para>
<ulink url="http://www.freerdp.com/">http://www.freerdp.com/</ulink>
</para>
</refsect1>
</refentry>

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry
PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY syntax SYSTEM "xfreerdp-argument.1.xml">
<!ENTITY channels SYSTEM "xfreerdp-channels.1.xml">
<!ENTITY examples SYSTEM "xfreerdp-examples.1.xml">
]
>
<refentry>
<refentryinfo>
<date>@MAN_TODAY@</date>
<author>
<authorblurb><para>The FreeRDP Team</para></authorblurb>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>xfreerdp</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="source">freerdp</refmiscinfo>
<refmiscinfo class="manual">xfreerdp</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>xfreerdp</application></refname>
<refpurpose>FreeRDP X11 client</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>@MAN_TODAY@</date>
</refsynopsisdivinfo>
<para>
<command>xfreerdp</command> [file] [options] [/v:server[:port]]
</para>
</refsynopsisdiv>
<refsect1>
<refsect1info>
<date>@MAN_TODAY@</date>
</refsect1info>
<title>DESCRIPTION</title>
<para>
<command>xfreerdp</command> is an X11 Remote Desktop Protocol (RDP)
client which is part of the FreeRDP project. An RDP server is built-in
to many editions of Windows. Alternative servers included xrdp and VRDP (VirtualBox).
</para>
</refsect1>
&syntax;
&channels;
&examples;
<refsect1>
<title>LINKS</title>
<para>
<ulink url="http://www.freerdp.com/">http://www.freerdp.com/</ulink>
</para>
</refsect1>
</refentry>

View File

@ -25,9 +25,10 @@ set(${MODULE_PREFIX}_SRCS
compatibility.h
file.c)
set(FREERDP_CHANNELS_CLIENT_PATH "../../channels/client")
foreach(FREERDP_CHANNELS_CLIENT_SRC ${FREERDP_CHANNELS_CLIENT_SRCS})
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} "${FREERDP_CHANNELS_CLIENT_PATH}/${FREERDP_CHANNELS_CLIENT_SRC}")
get_filename_component(NINC ${FREERDP_CHANNELS_CLIENT_SRC} PATH)
include_directories(${NINC})
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} "${FREERDP_CHANNELS_CLIENT_SRC}")
endforeach()
if(MSVC)

View File

@ -30,6 +30,7 @@
#include <freerdp/locale/keyboard.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/version.h>
#include "compatibility.h"
@ -91,7 +92,6 @@ COMMAND_LINE_ARGUMENT_A args[] =
{ "usb", COMMAND_LINE_VALUE_REQUIRED, NULL, NULL, NULL, -1, NULL, "Redirect USB device" },
{ "multitouch", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Redirect multitouch input" },
{ "echo", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, "echo", "Echo channel" },
{ "disp", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Display control" },
{ "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Smooth fonts (ClearType)" },
{ "aero", COMMAND_LINE_VALUE_BOOL, NULL, NULL, BoolValueFalse, -1, NULL, "Desktop composition" },
{ "window-drag", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Full window drag" },
@ -421,7 +421,7 @@ char** freerdp_command_line_parse_comma_separated_values(char* list, int* count)
int index;
int nCommas;
nArgs = nCommas = 0;
nCommas = 0;
for (index = 0; list[index]; index++)
nCommas += (list[index] == ',') ? 1 : 0;
@ -608,16 +608,6 @@ int freerdp_client_command_line_post_filter(void* context, COMMAND_LINE_ARGUMENT
freerdp_client_add_dynamic_channel(settings, count, p);
}
CommandLineSwitchCase(arg, "disp")
{
char* p[1];
int count;
count = 1;
p[0] = "disp";
freerdp_client_add_dynamic_channel(settings, count, p);
}
CommandLineSwitchCase(arg, "sound")
{
if (arg->Flags & COMMAND_LINE_VALUE_PRESENT)
@ -716,22 +706,13 @@ int freerdp_parse_username(char* username, char** user, char** domain)
}
else
{
p = strchr(username, '@');
if (p)
{
length = p - username;
*user = (char*) malloc(length + 1);
strncpy(*user, username, length);
(*user)[length] = '\0';
*domain = _strdup(&p[1]);
}
else
{
/* Do not break up the name for '@'; both credSSP and the
* ClientInfo PDU expect 'user@corp.net' to be transmitted
* as username 'user@corp.net', domain empty.
*/
*user = _strdup(username);
*domain = NULL;
}
}
return 0;
}
@ -934,8 +915,13 @@ BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* flags)
*flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
*flags |= COMMAND_LINE_SIGIL_ENABLE_DISABLE;
if (windows_cli_count > posix_cli_count)
if (posix_cli_status <= COMMAND_LINE_STATUS_PRINT)
return compatibility;
/* Check, if this may be windows style syntax... */
if ((windows_cli_count && (windows_cli_count >= posix_cli_count)) || (windows_cli_status <= COMMAND_LINE_STATUS_PRINT))
{
windows_cli_count = 1;
*flags = COMMAND_LINE_SEPARATOR_COLON;
*flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
}
@ -1039,8 +1025,7 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
freerdp_client_command_line_pre_filter, freerdp_client_command_line_post_filter);
}
arg = CommandLineFindArgumentA(args, "v");
CommandLineFindArgumentA(args, "v");
arg = args;
@ -1175,17 +1160,17 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
}
CommandLineSwitchCase(arg, "kbd")
{
int id;
unsigned long int id;
char* pEnd;
id = strtol(arg->Value, &pEnd, 16);
id = strtoul(arg->Value, &pEnd, 16);
if (pEnd != (arg->Value + strlen(arg->Value)))
id = 0;
if (id == 0)
{
id = freerdp_map_keyboard_layout_name_to_id(arg->Value);
id = (unsigned long int) freerdp_map_keyboard_layout_name_to_id(arg->Value);
if (!id)
{
@ -1193,7 +1178,7 @@ int freerdp_client_parse_command_line_arguments(int argc, char** argv, rdpSettin
}
}
settings->KeyboardLayout = id;
settings->KeyboardLayout = (UINT32) id;
}
CommandLineSwitchCase(arg, "kbd-type")
{

View File

@ -118,18 +118,25 @@ void freerdp_client_old_parse_hostname(char* str, char** ServerHostname, UINT32*
int freerdp_client_old_process_plugin(rdpSettings* settings, ADDIN_ARGV* args)
{
int args_handled = 0;
if (strcmp(args->argv[0], "cliprdr") == 0)
{
args_handled++;
settings->RedirectClipboard = TRUE;
fprintf(stderr, "--plugin cliprdr -> +clipboard\n");
}
else if (strcmp(args->argv[0], "rdpdr") == 0)
{
args_handled++;
if (args->argc < 2)
return 1;
if ((strcmp(args->argv[1], "disk") == 0) ||
(strcmp(args->argv[1], "drive") == 0))
{
freerdp_addin_replace_argument(args, "disk", "drive");
freerdp_client_add_device_channel(settings, args->argc - 1, &args->argv[1]);
args_handled++;
}
else if (strcmp(args->argv[1], "printer") == 0)
{
@ -152,15 +159,29 @@ int freerdp_client_old_process_plugin(rdpSettings* settings, ADDIN_ARGV* args)
}
else if (strcmp(args->argv[0], "drdynvc") == 0)
{
args_handled++;
if (args->argc < 2)
return args_handled;
freerdp_client_add_dynamic_channel(settings, args->argc - 1, &args->argv[1]);
}
else if (strcmp(args->argv[0], "rdpsnd") == 0)
{
args_handled++;
if (args->argc > 2)
{
args_handled++;
freerdp_addin_replace_argument_value(args, args->argv[1], "sys", args->argv[1]);
}
freerdp_client_add_static_channel(settings, args->argc, args->argv);
}
else if (strcmp(args->argv[0], "rail") == 0)
{
args_handled++;
if (args->argc < 2)
return 1;
args_handled++;
settings->RemoteApplicationProgram = _strdup(args->argv[1]);
}
else
@ -168,14 +189,12 @@ int freerdp_client_old_process_plugin(rdpSettings* settings, ADDIN_ARGV* args)
freerdp_client_add_static_channel(settings, args->argc, args->argv);
}
return 1;
return args_handled;
}
int freerdp_client_old_command_line_pre_filter(void* context, int index, int argc, LPCSTR* argv)
{
rdpSettings* settings;
settings = (rdpSettings*) context;
rdpSettings* settings = (rdpSettings*) context;
if (index == (argc - 1))
{
@ -191,6 +210,8 @@ int freerdp_client_old_command_line_pre_filter(void* context, int index, int arg
return -1;
}
freerdp_client_old_parse_hostname((char*) argv[index], &settings->ServerHostname, &settings->ServerPort);
return 1;
}
else
{
@ -215,20 +236,18 @@ int freerdp_client_old_command_line_pre_filter(void* context, int index, int arg
return -1;
args = (ADDIN_ARGV*) malloc(sizeof(ADDIN_ARGV));
args->argv = (char**) malloc(sizeof(char*) * 5);
args->argv = (char**) calloc(argc, sizeof(char*));
args->argc = 1;
args->argv[0] = _strdup(argv[t]);
if ((index < argc - 1) && strcmp("--data", argv[index + 1]) == 0)
{
i = 0;
index += 2;
args->argc = 1;
while ((index < argc) && (strcmp("--", argv[index]) != 0))
{
args->argc = 1;
args->argv[0] = _strdup(argv[t]);
for (j = 0, p = (char*) argv[index]; (j < 4) && (p != NULL); j++)
{
@ -250,8 +269,12 @@ int freerdp_client_old_command_line_pre_filter(void* context, int index, int arg
if (p != NULL)
{
length = p - a;
args->argv[j + 1] = malloc(length + 1);
p = strchr(p, ':');
}
if (p != NULL)
{
length = (int) (p - a);
args->argv[j + 1] = (char*) malloc(length + 1);
CopyMemory(args->argv[j + 1], a, length);
args->argv[j + 1][length] = '\0';
p++;
@ -264,21 +287,34 @@ int freerdp_client_old_command_line_pre_filter(void* context, int index, int arg
args->argc++;
}
if (settings->instance)
if (settings)
{
freerdp_client_old_process_plugin(settings, args);
}
for (i = 0; i < args->argc; i++)
free(args->argv[i]);
memset(args->argv, 0, argc * sizeof(char*));
for (i = 0; i < args->argc; i++)
free(args->argv[i]);
memset(args->argv, 0, argc * sizeof(char*));
index++;
i++;
}
} else {
if (settings->instance)
}
else
{
if (settings)
{
args->argv[0] = _strdup(argv[t]);
freerdp_client_old_process_plugin(settings, args);
free (args->argv[0]);
}
}
free(args->argv);
free(args);
return (index - old_index);
}
@ -473,7 +509,9 @@ int freerdp_client_parse_old_command_line_arguments(int argc, char** argv, rdpSe
CommandLineSwitchCase(arg, "p")
{
settings->Password = _strdup(arg->Value);
fprintf(stderr, "-p %s -> /p:%s\n", arg->Value, arg->Value);
fprintf(stderr, "-p ****** -> /p:******\n");
/* Hide the value from 'ps'. */
FillMemory(arg->Value, strlen(arg->Value), '*');
}
CommandLineSwitchCase(arg, "s")
{

View File

@ -6,7 +6,9 @@ set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
set(${MODULE_PREFIX}_TESTS
TestClientRdpFile.c
TestClientChannels.c)
TestClientChannels.c
TestClientCmdLine.c
)
create_test_sourcelist(${MODULE_PREFIX}_SRCS
${${MODULE_PREFIX}_DRIVER}
@ -15,11 +17,16 @@ create_test_sourcelist(${MODULE_PREFIX}_SRCS
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client)
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS MONOLITHIC ${MONOLITHIC_BUILD}
MODULE freerdp
MODULES freerdp-core)
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
foreach(test ${${MODULE_PREFIX}_TESTS})
get_filename_component(TestName ${test} NAME_WE)
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})

View File

@ -0,0 +1,118 @@
#include <freerdp/client.h>
#include <freerdp/client/cmdline.h>
#include <freerdp/settings.h>
#include <winpr/cmdline.h>
#include <winpr/spec.h>
#define TESTCASE(cmd, expected_return) status = freerdp_client_parse_command_line_arguments(ARRAYSIZE(cmd), cmd, settings); \
if (status != expected_return) { \
printf("Test argument %s failed\n", #cmd); \
return -1; \
}
#define TESTCASE_SUCCESS(cmd) status = freerdp_client_parse_command_line_arguments(ARRAYSIZE(cmd), cmd, settings); \
if (status < 0) { \
printf("Test argument %s failed\n", #cmd); \
return -1; \
}
int TestClientCmdLine(int argc, char* argv[])
{
int status;
rdpSettings* settings = freerdp_settings_new(0);
char* cmd1[] = {"xfreerdp", "--help"};
TESTCASE(cmd1, COMMAND_LINE_STATUS_PRINT_HELP);
char* cmd2[] = {"xfreerdp", "/help"};
TESTCASE(cmd2, COMMAND_LINE_STATUS_PRINT_HELP);
char* cmd3[] = {"xfreerdp", "-help"};
TESTCASE(cmd3, COMMAND_LINE_STATUS_PRINT_HELP);
char* cmd4[] = {"xfreerdp", "--version"};
TESTCASE(cmd4, COMMAND_LINE_STATUS_PRINT_VERSION);
char* cmd5[] = {"xfreerdp", "/version"};
TESTCASE(cmd5, COMMAND_LINE_STATUS_PRINT_VERSION);
char* cmd6[] = {"xfreerdp", "-version"};
TESTCASE(cmd6, COMMAND_LINE_STATUS_PRINT_VERSION);
char* cmd7[] = {"xfreerdp", "test.freerdp.com"};
TESTCASE_SUCCESS(cmd7);
char* cmd8[] = {"xfreerdp", "-v", "test.freerdp.com"};
TESTCASE_SUCCESS(cmd8);
char* cmd9[] = {"xfreerdp", "--v", "test.freerdp.com"};
TESTCASE_SUCCESS(cmd9);
char* cmd10[] = {"xfreerdp", "/v:test.freerdp.com"};
TESTCASE_SUCCESS(cmd10);
char* cmd11[] = {"xfreerdp", "--plugin", "rdpsnd", "--plugin", "rdpdr", "--data", "disk:media:/tmp", "--", "test.freerdp.com" };
TESTCASE_SUCCESS(cmd11);
char* cmd12[] = {"xfreerdp", "/sound", "/drive:media:/tmp", "/v:test.freerdp.com" };
TESTCASE_SUCCESS(cmd12);
// password gets overwritten therefore it need to be writeable
char* cmd13[6] = {"xfreerdp", "-u", "test", "-p", "test", "test.freerdp.com"};
cmd13[4] = malloc(5);
strncpy(cmd13[4], "test", 4);
TESTCASE_SUCCESS(cmd13);
free(cmd13[4]);
char* cmd14[] = {"xfreerdp", "-u", "test", "-p", "test", "-v", "test.freerdp.com"};
cmd14[4] = malloc(5);
strncpy(cmd14[4], "test", 4);
TESTCASE_SUCCESS(cmd14);
free(cmd14[4]);
char* cmd15[] = {"xfreerdp", "/u:test", "/p:test", "/v:test.freerdp.com"};
cmd15[2] = malloc(7);
strncpy(cmd15[2], "/p:test", 6);
TESTCASE_SUCCESS(cmd15);
free(cmd15[2]);
#if 0
char* cmd16[] = {"xfreerdp", "-invalid"};
TESTCASE(cmd16, COMMAND_LINE_ERROR_NO_KEYWORD);
char* cmd17[] = {"xfreerdp", "--invalid"};
TESTCASE(cmd17, COMMAND_LINE_ERROR_NO_KEYWORD);
#endif
char* cmd18[] = {"xfreerdp", "/kbd-list"};
TESTCASE(cmd18, COMMAND_LINE_STATUS_PRINT);
char* cmd19[] = {"xfreerdp", "/monitor-list"};
TESTCASE(cmd19, COMMAND_LINE_STATUS_PRINT);
/*
* Faulty command misses -- after data and the data for disk is incorrect
* This tests was added because it caused a segfault
* The command line is "valid" but disk isn't initialized correctly
*/
char* cmd20[] = { "xfreerdp", "-g", "1920x1200", "-d", "domain", "-u", "username", "-D", "-a", "16", "--plugin", "rdpsnd", "--plugin", "rdpdr", "-data", "disk", "media", "/home/username/media/", "-x", "l", "--rfx", "--ignore-certificate", "--plugin", "cliprdr", "some.host.name.com"};
TESTCASE_SUCCESS(cmd20);
/* Command misses -- for data */
char* cmd21[] = { "xfreerdp", "-g", "1920x1200", "-d", "domain", "-u", "username", "-D", "-a", "16", "--plugin", "rdpsnd", "--plugin", "rdpdr", "--data", "disk:media:/home/username/media/", "-x", "l", "--rfx", "--ignore-certificate", "--plugin", "cliprdr", "xxx"};
TESTCASE_SUCCESS(cmd21);
if (settings->ServerHostname && !strcmp(settings->ServerHostname, "xxx")){
printf("cmd21 problem - hostname shoudn't be set because -- is missing after data (status %d - %s)", status, settings->ServerHostname);
return -1;
}
char* cmd22[] = { "xfreerdp", "-g", "1920x1200", "-d", "domain", "-u", "username", "-D", "-a", "16", "--plugin", "rdpsnd", "--plugin", "rdpdr", "--data", "disk:media:/home/username/media/", "--", "-x", "l", "--rfx", "--ignore-certificate", "--plugin", "cliprdr", "some.host.name.com"};
TESTCASE_SUCCESS(cmd22);
#if 0
char* cmd23[] = {"xfreerdp -z --plugin cliprdr --plugin rdpsnd --data alsa latency:100 -- --plugin rdpdr --data disk:w7share:/home/w7share -- --plugin drdynvc --data tsmf:decoder:gstreamer -- -u test host.example.com"};
TESTCASE(cmd23, COMMAND_LINE_STATUS_PRINT);
#endif
return 0;
}

View File

@ -117,6 +117,9 @@ set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_COMBINE_HIDPI_IM
set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_SKIP_INSTALL NO)
set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_INSTALL_PATH "/Applications")
set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS YES)
if (CODE_SIGN_IDENTITY)
set_target_properties(${MODULE_NAME} PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${CODE_SIGN_IDENTITY}")
endif()
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${EXTRA_LIBS})

View File

@ -12,6 +12,7 @@
#import "TSXAdditions.h"
#import <freerdp/input.h>
#import <freerdp/version.h>
#import "config.h"
#include <sys/types.h>

View File

@ -1,5 +1,5 @@
# Copyright (c) 2010-2011, Ethan Rublee
# Copyright (c) 2011-2012, Andrey Kamaev
# Copyright (c) 2011-2014, Andrey Kamaev
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -12,9 +12,9 @@
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. The name of the copyright holders may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@ -29,13 +29,12 @@
# POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Android CMake toolchain file, for use with the Android NDK r5-r8
# Android CMake toolchain file, for use with the Android NDK r5-r9
# Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
# See home page: https://github.com/taka-no-me/android-cmake
#
# The file is mantained by the OpenCV project. The latest version can be get at
# http://code.opencv.org/projects/opencv/repository/revisions/master/changes/android/android.toolchain.cmake
# Git commit: 084b1c796900b0825fc4e0593ab3143da3f3a90e
#
# Usage Linux:
# $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
@ -86,10 +85,15 @@
# "armeabi-v7a with VFPV3" - same as armeabi-v7a, but
# sets VFPV3 as floating-point unit (has 32 registers instead of 16).
# "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP.
# "arm64-v8a" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
# "x86" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
# "mips" - matches to the NDK ABI with the same name
# (It is not tested on real devices by the authos of this toolchain)
# "x86_64" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
# "mips" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
# "mips64" - matches to the NDK ABI with the same name.
# See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
#
# ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
@ -183,13 +187,13 @@
# ANDROID and BUILD_ANDROID will be set to true, you may test any of these
# variables to make necessary Android-specific configuration changes.
#
# Also ARMEABI or ARMEABI_V7A or X86 or MIPS will be set true, mutually
# Also ARMEABI or ARMEABI_V7A or ARM64_V8A or X86 or X86_64 or MIPS or MIPS64 will be set true, mutually
# exclusive. NEON option will be set true if VFP is set to NEON.
#
# LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where Android
# libraries will be installed.
# Default is ${CMAKE_SOURCE_DIR}, and the android libs will always be
# under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
# under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_OUTPUT_ABI_NAME}
# (depending on the target ABI). This is convenient for Android packaging.
#
# Change Log:
@ -282,8 +286,32 @@
# [+] updated for NDK r8c
# [+] added support for clang compiler
# - December 2012
# [+] suppress warning about unused CMAKE_TOOLCHAIN_FILE variable
# [+] adjust API level to closest compatible as NDK does
# [~] fixed ccache full path search
# [+] updated for NDK r8d
# [~] compiler options are aligned with NDK r8d
# - March 2013
# [+] updated for NDK r8e (x86 version)
# [+] support x86_64 version of NDK
# - April 2013
# [+] support non-release NDK layouts (from Linaro git and Android git)
# [~] automatically detect if explicit link to crtbegin_*.o is needed
# - June 2013
# [~] fixed stl include path for standalone toolchain made by NDK >= r8c
# - July 2013
# [+] updated for NDK r9
# - November 2013
# [+] updated for NDK r9b
# - December 2013
# [+] updated for NDK r9c
# - January 2014
# [~] fix copying of shared STL
# - April 2014
# [+] updated for NDK r9d
# - July 2014
# [+] updated for NDK r10
# [+] arm64_v8a, x86_64, mips64 toolchain support (experimental)
# ------------------------------------------------------------------------------
cmake_minimum_required( VERSION 2.6.3 )
@ -293,6 +321,10 @@ if( DEFINED CMAKE_CROSSCOMPILING )
return()
endif()
if( CMAKE_TOOLCHAIN_FILE )
# touch toolchain variable only to suppress "unused variable" warning
endif()
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
if( _CMAKE_IN_TRY_COMPILE )
include( "${CMAKE_CURRENT_SOURCE_DIR}/../android.toolchain.config.cmake" OPTIONAL )
@ -312,7 +344,7 @@ endif()
# rpath makes low sence for Android
set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10 -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
if( CMAKE_HOST_WIN32 )
file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
@ -327,12 +359,18 @@ if(NOT DEFINED ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH)
endif()
set( ANDROID_SUPPORTED_ABIS_arm "armeabi-v7a;armeabi;armeabi-v7a with NEON;armeabi-v7a with VFPV3;armeabi-v6 with VFP" )
set( ANDROID_SUPPORTED_ABIS_arm64 "arm64-v8a" )
set( ANDROID_SUPPORTED_ABIS_x86 "x86" )
set( ANDROID_SUPPORTED_ABIS_x86_64 "x86_64" )
set( ANDROID_SUPPORTED_ABIS_mipsel "mips" )
set( ANDROID_SUPPORTED_ABIS_mips64el "mips64" )
set( ANDROID_DEFAULT_NDK_API_LEVEL 8 )
set( ANDROID_DEFAULT_NDK_API_LEVEL 9 )
set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 )
set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 )
set( ANDROID_DEFAULT_NDK_API_LEVEL_arm64 "L" )
set( ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 "L" )
set( ANDROID_DEFAULT_NDK_API_LEVEL_mips64 "L" )
macro( __LIST_FILTER listvar regex )
@ -456,19 +494,32 @@ if( ANDROID_FORBID_SYGWIN )
endif()
endif()
# detect current host platform
if( NOT DEFINED ANDROID_NDK_HOST_X64 AND (CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64" OR CMAKE_HOST_APPLE) )
set( ANDROID_NDK_HOST_X64 1 CACHE BOOL "Try to use 64-bit compiler toolchain" )
mark_as_advanced( ANDROID_NDK_HOST_X64 )
endif()
set( TOOL_OS_SUFFIX "" )
if( CMAKE_HOST_APPLE )
set( ANDROID_NDK_HOST_SYSTEM_NAME "darwin-x86" )
set( ANDROID_NDK_HOST_SYSTEM_NAME "darwin-x86_64" )
set( ANDROID_NDK_HOST_SYSTEM_NAME2 "darwin-x86" )
elseif( CMAKE_HOST_WIN32 )
set( ANDROID_NDK_HOST_SYSTEM_NAME "windows" )
set( ANDROID_NDK_HOST_SYSTEM_NAME "windows-x86_64" )
set( ANDROID_NDK_HOST_SYSTEM_NAME2 "windows" )
set( TOOL_OS_SUFFIX ".exe" )
elseif( CMAKE_HOST_UNIX )
set( ANDROID_NDK_HOST_SYSTEM_NAME "linux-x86" )
set( ANDROID_NDK_HOST_SYSTEM_NAME "linux-x86_64" )
set( ANDROID_NDK_HOST_SYSTEM_NAME2 "linux-x86" )
else()
message( FATAL_ERROR "Cross-compilation on your platform is not supported by this cmake toolchain" )
endif()
if( NOT ANDROID_NDK_HOST_X64 )
set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} )
endif()
# see if we have path to Android NDK
__INIT_VARIABLE( ANDROID_NDK PATH ENV_ANDROID_NDK )
if( NOT ANDROID_NDK )
@ -500,35 +551,19 @@ if( NOT ANDROID_NDK )
endif( ANDROID_NDK )
endif( NOT ANDROID_STANDALONE_TOOLCHAIN )
endif( NOT ANDROID_NDK )
# remember found paths
if( ANDROID_NDK )
get_filename_component( ANDROID_NDK "${ANDROID_NDK}" ABSOLUTE )
# try to detect change
if( CMAKE_AR )
string( LENGTH "${ANDROID_NDK}" __length )
string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidNdkPreviousPath )
if( NOT __androidNdkPreviousPath STREQUAL ANDROID_NDK )
message( FATAL_ERROR "It is not possible to change the path to the NDK on subsequent CMake run. You must remove all generated files from your build folder first.
" )
endif()
unset( __androidNdkPreviousPath )
unset( __length )
endif()
set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" FORCE )
set( BUILD_WITH_ANDROID_NDK True )
file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_TXT LIMIT_COUNT 1 REGEX r[0-9]+[a-z]? )
if(${ANDROID_NDK_RELEASE_TXT} MATCHES "^r[0-9]+[a-z] \([^ ]+\)$")
string( REGEX REPLACE "^(r[0-9]+[a-z]) \(([^ ]+)\)$" "\\1" ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_TXT}" )
string( REGEX REPLACE "^(r[0-9]+[a-z]) \(([^ ]+)\)$" "\\2" ANDROID_NDK_RELEASE_EXTRA "${ANDROID_NDK_RELEASE_TXT}" )
set( ANDROID_NDK_64BIT True)
set( ANDROID_NDK_HOST_SYSTEM_NAME "${ANDROID_NDK_HOST_SYSTEM_NAME}_64" )
if( EXISTS "${ANDROID_NDK}/RELEASE.TXT" )
file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX r[0-9]+[a-z]? )
string( REGEX MATCH r[0-9]+[a-z]? ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
else()
set( ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_TXT}" )
set( ANDROID_NDK_RELEASE "r1x" )
set( ANDROID_NDK_RELEASE_FULL "unreleased" )
endif()
elseif( ANDROID_STANDALONE_TOOLCHAIN )
get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
# try to detect change
@ -555,6 +590,54 @@ else()
sudo ln -s ~/my-android-toolchain ${ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH}" )
endif()
# android NDK layout
if( BUILD_WITH_ANDROID_NDK )
if( NOT DEFINED ANDROID_NDK_LAYOUT )
# try to automatically detect the layout
if( EXISTS "${ANDROID_NDK}/RELEASE.TXT")
set( ANDROID_NDK_LAYOUT "RELEASE" )
elseif( EXISTS "${ANDROID_NDK}/../../linux-x86/toolchain/" )
set( ANDROID_NDK_LAYOUT "LINARO" )
elseif( EXISTS "${ANDROID_NDK}/../../gcc/" )
set( ANDROID_NDK_LAYOUT "ANDROID" )
endif()
endif()
set( ANDROID_NDK_LAYOUT "${ANDROID_NDK_LAYOUT}" CACHE STRING "The inner layout of NDK" )
mark_as_advanced( ANDROID_NDK_LAYOUT )
if( ANDROID_NDK_LAYOUT STREQUAL "LINARO" )
set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} ) # only 32-bit at the moment
set( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK}/../../${ANDROID_NDK_HOST_SYSTEM_NAME}/toolchain" )
set( ANDROID_NDK_TOOLCHAINS_SUBPATH "" )
set( ANDROID_NDK_TOOLCHAINS_SUBPATH2 "" )
elseif( ANDROID_NDK_LAYOUT STREQUAL "ANDROID" )
set( ANDROID_NDK_HOST_SYSTEM_NAME ${ANDROID_NDK_HOST_SYSTEM_NAME2} ) # only 32-bit at the moment
set( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK}/../../gcc/${ANDROID_NDK_HOST_SYSTEM_NAME}/arm" )
set( ANDROID_NDK_TOOLCHAINS_SUBPATH "" )
set( ANDROID_NDK_TOOLCHAINS_SUBPATH2 "" )
else() # ANDROID_NDK_LAYOUT STREQUAL "RELEASE"
set( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK}/toolchains" )
set( ANDROID_NDK_TOOLCHAINS_SUBPATH "/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
set( ANDROID_NDK_TOOLCHAINS_SUBPATH2 "/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME2}" )
endif()
get_filename_component( ANDROID_NDK_TOOLCHAINS_PATH "${ANDROID_NDK_TOOLCHAINS_PATH}" ABSOLUTE )
# try to detect change of NDK
if( CMAKE_AR )
string( LENGTH "${ANDROID_NDK_TOOLCHAINS_PATH}" __length )
message("${CMAKE_AR}")
message("${__length}")
message("${ANDROID_NDK_TOOLCHAINS_PATH}")
string( SUBSTRING "${CMAKE_AR}" 0 ${__length} __androidNdkPreviousPath )
if( NOT __androidNdkPreviousPath STREQUAL ANDROID_NDK_TOOLCHAINS_PATH )
message( FATAL_ERROR "It is not possible to change the path to the NDK on subsequent CMake run. You must remove all generated files from your build folder first.
" )
endif()
unset( __androidNdkPreviousPath )
unset( __length )
endif()
endif()
# get all the details about standalone toolchain
if( BUILD_WITH_STANDALONE_TOOLCHAIN )
__DETECT_NATIVE_API_LEVEL( ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot/usr/include/android/api-level.h" )
@ -582,22 +665,33 @@ if( BUILD_WITH_STANDALONE_TOOLCHAIN )
endif()
endif()
macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar )
foreach( __toolchain ${${__availableToolchainsVar}} )
if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK}/toolchains/${__toolchain}/prebuilt/" )
macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst __toolchain_subpath )
foreach( __toolchain ${${__availableToolchainsLst}} )
if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}${__toolchain_subpath}" )
string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
else()
set( __gcc_toolchain "${__toolchain}" )
endif()
__DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK}/toolchains/${__gcc_toolchain}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
__DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK_TOOLCHAINS_PATH}/${__gcc_toolchain}${__toolchain_subpath}" )
if( __machine )
string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9]+)?$" __version "${__gcc_toolchain}" )
string( REGEX MATCH "^[^-]+" __arch "${__gcc_toolchain}" )
string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9x]+)?$" __version "${__gcc_toolchain}" )
if( __machine MATCHES i686 )
set( __arch "x86" )
elseif( __machine MATCHES x86_64 )
set( __arch "x86_64" )
elseif( __machine MATCHES arm )
set( __arch "arm" )
elseif( __machine MATCHES aarch64 )
set( __arch "arm64" )
elseif( __machine MATCHES mipsel )
set( __arch "mipsel" )
elseif( __machine MATCHES mips64el )
set( __arch "mips64el" )
endif()
list( APPEND __availableToolchainMachines "${__machine}" )
list( APPEND __availableToolchainArchs "${__arch}" )
list( APPEND __availableToolchainCompilerVersions "${__version}" )
else()
list( REMOVE_ITEM ${__availableToolchainsVar} "${__toolchain}" )
list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
endif()
unset( __gcc_toolchain )
endforeach()
@ -611,19 +705,32 @@ if( BUILD_WITH_ANDROID_NDK )
set( __availableToolchainMachines "" )
set( __availableToolchainArchs "" )
set( __availableToolchainCompilerVersions "" )
if( ANDROID_TOOLCHAIN_NAME AND EXISTS "${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/" )
if( ANDROID_TOOLCHAIN_NAME AND EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_TOOLCHAIN_NAME}/" )
# do not go through all toolchains if we know the name
set( __availableToolchains "${ANDROID_TOOLCHAIN_NAME}" )
__GLOB_NDK_TOOLCHAINS( __availableToolchains )
set( __availableToolchainsLst "${ANDROID_TOOLCHAIN_NAME}" )
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
if( NOT __availableToolchains AND NOT ANDROID_NDK_TOOLCHAINS_SUBPATH STREQUAL ANDROID_NDK_TOOLCHAINS_SUBPATH2 )
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH2}" )
if( __availableToolchains )
set( ANDROID_NDK_TOOLCHAINS_SUBPATH ${ANDROID_NDK_TOOLCHAINS_SUBPATH2} )
endif()
endif()
endif()
if( NOT __availableToolchains )
file( GLOB __availableToolchains RELATIVE "${ANDROID_NDK}/toolchains" "${ANDROID_NDK}/toolchains/*" )
file( GLOB __availableToolchainsLst RELATIVE "${ANDROID_NDK_TOOLCHAINS_PATH}" "${ANDROID_NDK_TOOLCHAINS_PATH}/*" )
if( __availableToolchains )
list(SORT __availableToolchains) # we need clang to go after gcc
list(SORT __availableToolchainsLst) # we need clang to go after gcc
endif()
__LIST_FILTER( __availableToolchainsLst "^[.]" )
__LIST_FILTER( __availableToolchainsLst "llvm" )
__LIST_FILTER( __availableToolchainsLst "renderscript" )
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
if( NOT __availableToolchains AND NOT ANDROID_NDK_TOOLCHAINS_SUBPATH STREQUAL ANDROID_NDK_TOOLCHAINS_SUBPATH2 )
__GLOB_NDK_TOOLCHAINS( __availableToolchains __availableToolchainsLst "${ANDROID_NDK_TOOLCHAINS_SUBPATH2}" )
if( __availableToolchains )
set( ANDROID_NDK_TOOLCHAINS_SUBPATH ${ANDROID_NDK_TOOLCHAINS_SUBPATH2} )
endif()
endif()
__LIST_FILTER( __availableToolchains "^[.]" )
__LIST_FILTER( __availableToolchains "llvm" )
__GLOB_NDK_TOOLCHAINS( __availableToolchains )
endif()
if( NOT __availableToolchains )
message( FATAL_ERROR "Could not find any working toolchain in the NDK. Probably your Android NDK is broken." )
@ -648,7 +755,7 @@ __INIT_VARIABLE( ANDROID_ABI OBSOLETE_ARM_TARGET OBSOLETE_ARM_TARGETS VALUES ${A
# verify that target ABI is supported
list( FIND ANDROID_SUPPORTED_ABIS "${ANDROID_ABI}" __androidAbiIdx )
if( __androidAbiIdx EQUAL -1 )
string( REPLACE ";" "\", \"", PRINTABLE_ANDROID_SUPPORTED_ABIS "${ANDROID_SUPPORTED_ABIS}" )
string( REPLACE ";" "\", \"" PRINTABLE_ANDROID_SUPPORTED_ABIS "${ANDROID_SUPPORTED_ABIS}" )
message( FATAL_ERROR "Specified ANDROID_ABI = \"${ANDROID_ABI}\" is not supported by this cmake toolchain or your NDK/toolchain.
Supported values are: \"${PRINTABLE_ANDROID_SUPPORTED_ABIS}\"
" )
@ -663,6 +770,13 @@ if( ANDROID_ABI STREQUAL "x86" )
set( ANDROID_ARCH_FULLNAME "x86" )
set( ANDROID_LLVM_TRIPLE "i686-none-linux-android" )
set( CMAKE_SYSTEM_PROCESSOR "i686" )
elseif( ANDROID_ABI STREQUAL "x86_64" )
set( X86_64 true )
set( ANDROID_NDK_ABI_NAME "x86_64" )
set( ANDROID_ARCH_NAME "x86_64" )
set( ANDROID_ARCH_FULLNAME "x86_64" )
set( ANDROID_LLVM_TRIPLE "x86_64-none-linux-android" )
set( CMAKE_SYSTEM_PROCESSOR "x86_64" )
elseif( ANDROID_ABI STREQUAL "mips" )
set( MIPS true )
set( ANDROID_NDK_ABI_NAME "mips" )
@ -670,6 +784,13 @@ elseif( ANDROID_ABI STREQUAL "mips" )
set( ANDROID_ARCH_FULLNAME "mipsel" )
set( ANDROID_LLVM_TRIPLE "mipsel-none-linux-android" )
set( CMAKE_SYSTEM_PROCESSOR "mips" )
elseif( ANDROID_ABI STREQUAL "mips64" )
set( MIPS64 true )
set( ANDROID_NDK_ABI_NAME "mips64" )
set( ANDROID_ARCH_NAME "mips64" )
set( ANDROID_ARCH_FULLNAME "mips64el" )
set( ANDROID_LLVM_TRIPLE "mips64el-none-linux-android" )
set( CMAKE_SYSTEM_PROCESSOR "mips64" )
elseif( ANDROID_ABI STREQUAL "armeabi" )
set( ARMEABI true )
set( ANDROID_NDK_ABI_NAME "armeabi" )
@ -710,10 +831,25 @@ elseif( ANDROID_ABI STREQUAL "armeabi-v7a with NEON" )
set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
set( VFPV3 true )
set( NEON true )
elseif( ANDROID_ABI STREQUAL "arm64-v8a" )
set( ARM64_V8A true )
set( ANDROID_NDK_ABI_NAME "arm64-v8a" )
set( ANDROID_ARCH_NAME "arm64" )
set( ANDROID_ARCH_FULLNAME "arm64" )
set( ANDROID_LLVM_TRIPLE "armv8-none-linux-androideabi" )
set( CMAKE_SYSTEM_PROCESSOR "aarch64" )
set( VFPV3 true )
set( NEON true )
else()
message( SEND_ERROR "Unknown ANDROID_ABI=\"${ANDROID_ABI}\" is specified." )
endif()
if( X86_64 )
set( ANDROID_NDK_OUTPUT_ABI_NAME "x86-64" )
else()
set( ANDROID_NDK_OUTPUT_ABI_NAME ${ANDROID_NDK_ABI_NAME} )
endif()
if( CMAKE_BINARY_DIR AND EXISTS "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake" )
# really dirty hack
# it is not possible to change CMAKE_SYSTEM_PROCESSOR after the first run...
@ -752,6 +888,7 @@ else()
list( GET __availableToolchainArchs ${__idx} __toolchainArch )
if( __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
list( GET __availableToolchainCompilerVersions ${__idx} __toolchainVersion )
string( REPLACE "x" "99" __toolchainVersion "${__toolchainVersion}")
if( __toolchainVersion VERSION_GREATER __toolchainMaxVersion )
set( __toolchainMaxVersion "${__toolchainVersion}" )
set( __toolchainIdx ${__idx} )
@ -778,12 +915,24 @@ unset( __availableToolchainCompilerVersions )
# choose native API level
__INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
if( NOT ANDROID_NATIVE_API_LEVEL STREQUAL "L" )
string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
# TODO: filter out unsupported levels
# adjust API level
set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
if( NOT __level GREATER ANDROID_NATIVE_API_LEVEL AND NOT __level LESS __real_api_level )
set( __real_api_level ${__level} )
endif()
endforeach()
if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level )
message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
endif()
unset(__real_api_level)
# validate
list( FIND ANDROID_SUPPORTED_NATIVE_API_LEVELS "${ANDROID_NATIVE_API_LEVEL}" __levelIdx )
if( __levelIdx EQUAL -1 )
message( SEND_ERROR "Specified Android native API level (${ANDROID_NATIVE_API_LEVEL}) is not supported by your NDK/toolchain." )
message( SEND_ERROR "Specified Android native API level 'android-${ANDROID_NATIVE_API_LEVEL}' is not supported by your NDK/toolchain." )
else()
if( BUILD_WITH_ANDROID_NDK )
__DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
@ -799,6 +948,7 @@ else()
endif()
endif()
unset( __levelIdx )
endif()
# remember target ABI
@ -893,7 +1043,11 @@ if( BUILD_WITH_STANDALONE_TOOLCHAIN )
set( ANDROID_SYSROOT "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot" )
if( NOT ANDROID_STL STREQUAL "none" )
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_STANDALONE_TOOLCHAIN}/include/c++/${ANDROID_COMPILER_VERSION}" )
if( NOT EXISTS "${ANDROID_STL_INCLUDE_DIRS}" )
# old location ( pre r8c )
set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/include/c++/${ANDROID_COMPILER_VERSION}" )
endif()
if( ARMEABI_V7A AND EXISTS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}/bits" )
list( APPEND ANDROID_STL_INCLUDE_DIRS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/${CMAKE_SYSTEM_PROCESSOR}" )
elseif( ARMEABI AND NOT ANDROID_FORCE_ARM_BUILD AND EXISTS "${ANDROID_STL_INCLUDE_DIRS}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/thumb/bits" )
@ -944,11 +1098,11 @@ if( "${ANDROID_TOOLCHAIN_NAME}" STREQUAL "standalone-clang" )
elseif( "${ANDROID_TOOLCHAIN_NAME}" MATCHES "-clang3[.][0-9]?$" )
string( REGEX MATCH "3[.][0-9]$" ANDROID_CLANG_VERSION "${ANDROID_TOOLCHAIN_NAME}")
string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-4.6" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
if( NOT EXISTS "${ANDROID_NDK}/toolchains/llvm-${ANDROID_CLANG_VERSION}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}/bin/clang${TOOL_OS_SUFFIX}" )
message( FATAL_ERROR "Could not find the " )
if( NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/llvm-${ANDROID_CLANG_VERSION}${ANDROID_NDK_TOOLCHAINS_SUBPATH}/bin/clang${TOOL_OS_SUFFIX}" )
message( FATAL_ERROR "Could not find the Clang compiler driver" )
endif()
set( ANDROID_COMPILER_IS_CLANG 1 )
set( ANDROID_CLANG_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/llvm-${ANDROID_CLANG_VERSION}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
set( ANDROID_CLANG_TOOLCHAIN_ROOT "${ANDROID_NDK_TOOLCHAINS_PATH}/llvm-${ANDROID_CLANG_VERSION}${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
else()
set( ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
unset( ANDROID_COMPILER_IS_CLANG CACHE )
@ -962,7 +1116,7 @@ endif()
# setup paths and STL for NDK
if( BUILD_WITH_ANDROID_NDK )
set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/${ANDROID_GCC_TOOLCHAIN_NAME}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )
set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}${ANDROID_NDK_TOOLCHAINS_SUBPATH}" )
set( ANDROID_SYSROOT "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}" )
if( ANDROID_STL STREQUAL "none" )
@ -1021,11 +1175,11 @@ if( BUILD_WITH_ANDROID_NDK )
endif()
# find libsupc++.a - rtti & exceptions
if( ANDROID_STL STREQUAL "system_re" OR ANDROID_STL MATCHES "gnustl" )
if( ANDROID_NDK_RELEASE STRGREATER "r8" ) # r8b
set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" )
elseif( NOT ANDROID_NDK_RELEASE STRLESS "r7" AND ANDROID_NDK_RELEASE STRLESS "r8b")
set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" )
else( ANDROID_NDK_RELEASE STRLESS "r7" )
set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) # r8b or newer
if( NOT EXISTS "${__libsupcxx}" )
set( __libsupcxx "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/libs/${ANDROID_NDK_ABI_NAME}/libsupc++.a" ) # r7-r8
endif()
if( NOT EXISTS "${__libsupcxx}" ) # before r7
if( ARMEABI_V7A )
if( ANDROID_FORCE_ARM_BUILD )
set( __libsupcxx "${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib/${CMAKE_SYSTEM_PROCESSOR}/libsupc++.a" )
@ -1048,15 +1202,7 @@ endif()
# case of shared STL linkage
if( ANDROID_STL MATCHES "shared" AND DEFINED __libstl )
string( REPLACE "_static.a" "_shared.so" __libstl "${__libstl}" )
if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
get_filename_component( __libstlname "${__libstl}" NAME )
execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
endif()
unset( __fileCopyProcess )
unset( __libstlname )
endif()
# TODO: check if .so file exists before the renaming
endif()
@ -1075,7 +1221,7 @@ unset( _ndk_ccache )
# setup the cross-compiler
if( NOT CMAKE_C_COMPILER )
if( NDK_CCACHE )
if( NDK_CCACHE AND NOT ANDROID_SYSROOT MATCHES "[ ;\"]" )
set( CMAKE_C_COMPILER "${NDK_CCACHE}" CACHE PATH "ccache as C compiler" )
set( CMAKE_CXX_COMPILER "${NDK_CCACHE}" CACHE PATH "ccache as C++ compiler" )
if( ANDROID_COMPILER_IS_CLANG )
@ -1123,7 +1269,11 @@ if( ANDROID_COMPILER_IS_CLANG )
set( CMAKE_C_COMPILER_ID Clang)
endif()
set( CMAKE_C_PLATFORM_ID Linux )
if( ARM64_V8A OR X86_64 OR MIPS64 )
set( CMAKE_C_SIZEOF_DATA_PTR 8 )
else()
set( CMAKE_C_SIZEOF_DATA_PTR 4 )
endif()
set( CMAKE_C_HAS_ISYSROOT 1 )
set( CMAKE_C_COMPILER_ABI ELF )
CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU )
@ -1131,7 +1281,11 @@ if( ANDROID_COMPILER_IS_CLANG )
set( CMAKE_CXX_COMPILER_ID Clang)
endif()
set( CMAKE_CXX_PLATFORM_ID Linux )
if( ARM64_V8A OR X86_64 OR MIPS64 )
set( CMAKE_CXX_SIZEOF_DATA_PTR 8 )
else()
set( CMAKE_CXX_SIZEOF_DATA_PTR 4 )
endif()
set( CMAKE_CXX_HAS_ISYSROOT 1 )
set( CMAKE_CXX_COMPILER_ABI ELF )
set( CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc cp cxx cpp CPP c++ C )
@ -1148,10 +1302,24 @@ remove_definitions( -DANDROID )
add_definitions( -DANDROID )
if( ANDROID_SYSROOT MATCHES "[ ;\"]" )
if( CMAKE_HOST_WIN32 )
# try to convert path to 8.3 form
file( WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cvt83.cmd" "@echo %~s1" )
execute_process( COMMAND "$ENV{ComSpec}" /c "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/cvt83.cmd" "${ANDROID_SYSROOT}"
OUTPUT_VARIABLE __path OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE __result ERROR_QUIET )
if( __result EQUAL 0 )
file( TO_CMAKE_PATH "${__path}" ANDROID_SYSROOT )
set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT}" )
else()
set( ANDROID_CXX_FLAGS "--sysroot=\"${ANDROID_SYSROOT}\"" )
endif()
else()
set( ANDROID_CXX_FLAGS "'--sysroot=${ANDROID_SYSROOT}'" )
endif()
if( NOT _CMAKE_IN_TRY_COMPILE )
# quotes will break try_compile and compiler identification
message(WARNING "Your Android system root has non-alphanumeric symbols. It can break compiler features detection and the whole build.")
# quotes can break try_compile and compiler identification
message(WARNING "Path to your Android NDK (or toolchain) has non-alphanumeric symbols.\nThe build might be broken.\n")
endif()
else()
set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT}" )
@ -1159,38 +1327,52 @@ endif()
# NDK flags
if( ARMEABI OR ARMEABI_V7A )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__" )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables" )
if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
# It is recommended to use the -mthumb compiler flag to force the generation
# of 16-bit Thumb-1 instructions (the default being 32-bit ARM ones).
set( ANDROID_CXX_FLAGS_RELEASE "-mthumb" )
set( ANDROID_CXX_FLAGS_DEBUG "-marm -finline-limit=64" )
set( ANDROID_CXX_FLAGS_RELEASE "-mthumb -fomit-frame-pointer -fno-strict-aliasing" )
set( ANDROID_CXX_FLAGS_DEBUG "-marm -fno-omit-frame-pointer -fno-strict-aliasing" )
if( NOT ANDROID_COMPILER_IS_CLANG )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -finline-limit=64" )
endif()
else()
# always compile ARMEABI_V6 in arm mode; otherwise there is no difference from ARMEABI
# O3 instead of O2/Os in release mode - like cmake sets for desktop gcc
set( ANDROID_CXX_FLAGS_RELEASE "-marm" )
set( ANDROID_CXX_FLAGS_DEBUG "-marm -finline-limit=300" )
set( ANDROID_CXX_FLAGS_RELEASE "-marm -fomit-frame-pointer -fstrict-aliasing" )
set( ANDROID_CXX_FLAGS_DEBUG "-marm -fno-omit-frame-pointer -fno-strict-aliasing" )
if( NOT ANDROID_COMPILER_IS_CLANG )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
endif()
elseif( X86 )
endif()
elseif( X86 OR X86_64 )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
set( ANDROID_CXX_FLAGS_RELEASE "" )
set( ANDROID_CXX_FLAGS_DEBUG "-finline-limit=300" )
elseif( MIPS )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -frename-registers" )
set( ANDROID_CXX_FLAGS_RELEASE "-finline-limit=300 -fno-strict-aliasing" )
set( ANDROID_CXX_FLAGS_DEBUG "-finline-functions -fgcse-after-reload -frerun-cse-after-loop" )
if( NOT ANDROID_COMPILER_IS_CLANG )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
else()
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fPIC" )
endif()
set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
set( ANDROID_CXX_FLAGS_DEBUG "-fno-omit-frame-pointer -fno-strict-aliasing" )
elseif( MIPS OR MIPS64 )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" )
set( ANDROID_CXX_FLAGS_DEBUG "-fno-omit-frame-pointer" )
if( NOT ANDROID_COMPILER_IS_CLANG )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers" )
set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -funswitch-loops -finline-limit=300" )
endif()
elseif()
set( ANDROID_CXX_FLAGS_RELEASE "" )
set( ANDROID_CXX_FLAGS_DEBUG "" )
endif()
if( NOT X86 )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fsigned-char" ) # good/necessary when porting desktop libraries
if( NOT X86 AND NOT ANDROID_COMPILER_IS_CLANG )
set( ANDROID_CXX_FLAGS "-Wno-psabi ${ANDROID_CXX_FLAGS}" )
endif()
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fsigned-char" ) # good/necessary when porting desktop libraries
set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -fomit-frame-pointer" )
set( ANDROID_CXX_FLAGS_DEBUG "${ANDROID_CXX_FLAGS_DEBUG} -fno-strict-aliasing -fno-omit-frame-pointer" )
if( NOT ANDROID_COMPILER_VERSION VERSION_LESS "4.6" )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -no-canonical-prefixes" ) # see https://android-review.googlesource.com/#/c/47564/
endif()
# ABI-specific flags
if( ARMEABI_V7A )
@ -1206,11 +1388,11 @@ elseif( ARMEABI_V6 )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv6 -mfloat-abi=softfp -mfpu=vfp" ) # vfp == vfpv2
elseif( ARMEABI )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv5te -mtune=xscale -msoft-float" )
elseif( ARM64_V8A )
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -march=armv8-a" )
endif()
# STL
if( EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}" )
if( ANDROID_STL MATCHES "gnustl" )
if( ANDROID_STL MATCHES "gnustl" AND (EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}") )
set( CMAKE_CXX_CREATE_SHARED_LIBRARY "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
set( CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
set( CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
@ -1219,11 +1401,9 @@ if( EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}" )
set( CMAKE_CXX_CREATE_SHARED_MODULE "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>" )
set( CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" )
endif()
if ( X86 AND ANDROID_STL MATCHES "gnustl" AND ANDROID_NDK_RELEASE STREQUAL "r6" )
# workaround "undefined reference to `__dso_handle'" problem
set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
set( CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
endif()
# STL
if( EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}" )
if( EXISTS "${__libstl}" )
set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} \"${__libstl}\"" )
set( CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE} \"${__libstl}\"" )
@ -1242,9 +1422,12 @@ if( EXISTS "${__libstl}" OR EXISTS "${__libsupcxx}" )
set( CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} \"${__libsupcxx}\"" )
endif()
if( ANDROID_STL MATCHES "gnustl" )
set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} -lm" )
set( CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE} -lm" )
set( CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} -lm" )
if( NOT EXISTS "${ANDROID_LIBM_PATH}" )
set( ANDROID_LIBM_PATH -lm )
endif()
set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} ${ANDROID_LIBM_PATH}" )
set( CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE} ${ANDROID_LIBM_PATH}" )
set( CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${ANDROID_LIBM_PATH}" )
endif()
endif()
@ -1280,8 +1463,15 @@ if( ARMEABI_V7A )
endif()
if( ANDROID_NO_UNDEFINED )
if( MIPS )
# there is some sysroot-related problem in mips linker...
if( NOT ANDROID_SYSROOT MATCHES "[ ;\"]" )
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--no-undefined -Wl,-rpath-link,${ANDROID_SYSROOT}/usr/lib" )
endif()
else()
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,--no-undefined" )
endif()
endif()
if( ANDROID_SO_UNDEFINED )
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -Wl,-allow-shlib-undefined" )
@ -1327,9 +1517,6 @@ if( ANDROID_COMPILER_IS_CLANG )
set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS}" )
endif()
if( BUILD_WITH_ANDROID_NDK )
if(ANDROID_ARCH_NAME STREQUAL "arm" )
set( ANDROID_CXX_FLAGS "-isystem ${ANDROID_CLANG_TOOLCHAIN_ROOT}/lib/clang/${ANDROID_CLANG_VERSION}/include ${ANDROID_CXX_FLAGS}" )
endif()
set( ANDROID_CXX_FLAGS "-gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_CXX_FLAGS}" )
endif()
endif()
@ -1345,6 +1532,12 @@ set( CMAKE_SHARED_LINKER_FLAGS "" CACHE STRING "shared li
set( CMAKE_MODULE_LINKER_FLAGS "" CACHE STRING "module linker flags" )
set( CMAKE_EXE_LINKER_FLAGS "-Wl,-z,nocopyreloc" CACHE STRING "executable linker flags" )
# put flags to cache (for debug purpose only)
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS}" CACHE INTERNAL "Android specific c/c++ flags" )
set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE}" CACHE INTERNAL "Android specific c/c++ Release flags" )
set( ANDROID_CXX_FLAGS_DEBUG "${ANDROID_CXX_FLAGS_DEBUG}" CACHE INTERNAL "Android specific c/c++ Debug flags" )
set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS}" CACHE INTERNAL "Android specific c/c++ linker flags" )
# finish flags
set( CMAKE_CXX_FLAGS "${ANDROID_CXX_FLAGS} ${CMAKE_CXX_FLAGS}" )
set( CMAKE_C_FLAGS "${ANDROID_CXX_FLAGS} ${CMAKE_C_FLAGS}" )
@ -1357,9 +1550,9 @@ set( CMAKE_MODULE_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FL
set( CMAKE_EXE_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}" )
if( MIPS AND BUILD_WITH_ANDROID_NDK AND ANDROID_NDK_RELEASE STREQUAL "r8" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_SHARED_LINKER_FLAGS}" )
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_MODULE_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK}/toolchains/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.x ${CMAKE_EXE_LINKER_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_SHARED_LINKER_FLAGS}" )
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_MODULE_LINKER_FLAGS}" )
set( CMAKE_EXE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.x ${CMAKE_EXE_LINKER_FLAGS}" )
endif()
# configure rtti
@ -1384,7 +1577,45 @@ endif()
# global includes and link directories
include_directories( SYSTEM "${ANDROID_SYSROOT}/usr/include" ${ANDROID_STL_INCLUDE_DIRS} )
link_directories( "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" )
get_filename_component(__android_install_path "${CMAKE_INSTALL_PREFIX}/libs/${ANDROID_NDK_ABI_NAME}" ABSOLUTE) # avoid CMP0015 policy warning
link_directories( "${__android_install_path}" )
# detect if need link crtbegin_so.o explicitly
if( NOT DEFINED ANDROID_EXPLICIT_CRT_LINK )
set( __cmd "${CMAKE_CXX_CREATE_SHARED_LIBRARY}" )
string( REPLACE "<CMAKE_CXX_COMPILER>" "${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}" __cmd "${__cmd}" )
string( REPLACE "<CMAKE_C_COMPILER>" "${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}" __cmd "${__cmd}" )
string( REPLACE "<CMAKE_SHARED_LIBRARY_CXX_FLAGS>" "${CMAKE_CXX_FLAGS}" __cmd "${__cmd}" )
string( REPLACE "<LANGUAGE_COMPILE_FLAGS>" "" __cmd "${__cmd}" )
string( REPLACE "<LINK_FLAGS>" "${CMAKE_SHARED_LINKER_FLAGS}" __cmd "${__cmd}" )
string( REPLACE "<CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS>" "-shared" __cmd "${__cmd}" )
string( REPLACE "<CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG>" "" __cmd "${__cmd}" )
string( REPLACE "<TARGET_SONAME>" "" __cmd "${__cmd}" )
string( REPLACE "<TARGET>" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/toolchain_crtlink_test.so" __cmd "${__cmd}" )
string( REPLACE "<OBJECTS>" "\"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" __cmd "${__cmd}" )
string( REPLACE "<LINK_LIBRARIES>" "" __cmd "${__cmd}" )
separate_arguments( __cmd )
foreach( __var ANDROID_NDK ANDROID_NDK_TOOLCHAINS_PATH ANDROID_STANDALONE_TOOLCHAIN )
if( ${__var} )
set( __tmp "${${__var}}" )
separate_arguments( __tmp )
string( REPLACE "${__tmp}" "${${__var}}" __cmd "${__cmd}")
endif()
endforeach()
string( REPLACE "'" "" __cmd "${__cmd}" )
string( REPLACE "\"" "" __cmd "${__cmd}" )
execute_process( COMMAND ${__cmd} RESULT_VARIABLE __cmd_result OUTPUT_QUIET ERROR_QUIET )
if( __cmd_result EQUAL 0 )
set( ANDROID_EXPLICIT_CRT_LINK ON )
else()
set( ANDROID_EXPLICIT_CRT_LINK OFF )
endif()
endif()
if( ANDROID_EXPLICIT_CRT_LINK )
set( CMAKE_CXX_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
set( CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE} \"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o\"" )
endif()
# setup output directories
set( LIBRARY_OUTPUT_PATH_ROOT ${CMAKE_SOURCE_DIR} CACHE PATH "root for library output, set this to change where android libs are installed to" )
@ -1392,13 +1623,25 @@ set( CMAKE_INSTALL_PREFIX "${ANDROID_TOOLCHAIN_ROOT}/user" CACHE STRING "path fo
if(NOT _CMAKE_IN_TRY_COMPILE)
if( EXISTS "${CMAKE_SOURCE_DIR}/jni/CMakeLists.txt" )
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_ABI_NAME}" CACHE PATH "Output directory for applications" )
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin/${ANDROID_NDK_OUTPUT_ABI_NAME}" CACHE PATH "Output directory for applications" )
else()
set( EXECUTABLE_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/bin" CACHE PATH "Output directory for applications" )
endif()
set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}" CACHE PATH "path for android libs" )
set( LIBRARY_OUTPUT_PATH "${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_OUTPUT_ABI_NAME}" CACHE PATH "path for android libs" )
endif()
# copy shaed stl library to build directory
if( NOT _CMAKE_IN_TRY_COMPILE AND __libstl MATCHES "[.]so$" )
get_filename_component( __libstlname "${__libstl}" NAME )
execute_process( COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${__libstl}" "${LIBRARY_OUTPUT_PATH}/${__libstlname}" RESULT_VARIABLE __fileCopyProcess )
if( NOT __fileCopyProcess EQUAL 0 OR NOT EXISTS "${LIBRARY_OUTPUT_PATH}/${__libstlname}")
message( SEND_ERROR "Failed copying of ${__libstl} to the ${LIBRARY_OUTPUT_PATH}/${__libstlname}" )
endif()
unset( __fileCopyProcess )
unset( __libstlname )
endif()
# set these global flags for cmake client scripts to change behavior
set( ANDROID True )
set( BUILD_ANDROID True )
@ -1461,10 +1704,16 @@ macro( ANDROID_GET_ABI_RAWNAME TOOLCHAIN_FLAG VAR )
set( ${VAR} "armeabi" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARMEABI_V7A" )
set( ${VAR} "armeabi-v7a" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "ARM64_V8A" )
set( ${VAR} "arm64-v8a" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86" )
set( ${VAR} "x86" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "X86_64" )
set( ${VAR} "x86_64" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS" )
set( ${VAR} "mips" )
elseif( "${TOOLCHAIN_FLAG}" STREQUAL "MIPS64" )
set( ${VAR} "mips64" )
else()
set( ${VAR} "unknown" )
endif()
@ -1475,7 +1724,9 @@ endmacro()
if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
set( __toolchain_config "")
foreach( __var NDK_CCACHE LIBRARY_OUTPUT_PATH_ROOT ANDROID_FORBID_SYGWIN ANDROID_SET_OBSOLETE_VARIABLES
ANDROID_NDK_HOST_X64
ANDROID_NDK
ANDROID_NDK_LAYOUT
ANDROID_STANDALONE_TOOLCHAIN
ANDROID_TOOLCHAIN_NAME
ANDROID_ABI
@ -1489,6 +1740,8 @@ if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
ANDROID_GOLD_LINKER
ANDROID_NOEXECSTACK
ANDROID_RELRO
ANDROID_LIBM_PATH
ANDROID_EXPLICIT_CRT_LINK
)
if( DEFINED ${__var} )
if( "${__var}" MATCHES " ")
@ -1503,6 +1756,19 @@ if( NOT PROJECT_NAME STREQUAL "CMAKE_TRY_COMPILE" )
endif()
# force cmake to produce / instead of \ in build commands for Ninja generator
if( CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_HOST_WIN32 )
# it is a bad hack after all
# CMake generates Ninja makefiles with UNIX paths only if it thinks that we are going to build with MinGW
set( CMAKE_COMPILER_IS_MINGW TRUE ) # tell CMake that we are MinGW
set( CMAKE_CROSSCOMPILING TRUE ) # stop recursion
enable_language( C )
enable_language( CXX )
# unset( CMAKE_COMPILER_IS_MINGW ) # can't unset because CMake does not convert back-slashes in response files without it
unset( MINGW )
endif()
# set some obsolete variables for backward compatibility
set( ANDROID_SET_OBSOLETE_VARIABLES ON CACHE BOOL "Define obsolete Andrid-specific cmake variables" )
mark_as_advanced( ANDROID_SET_OBSOLETE_VARIABLES )
@ -1514,7 +1780,7 @@ endif()
# Variables controlling behavior or set by cmake toolchain:
# ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips"
# ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "arm64-v8a", "x86", "x86_64", "mips", "mips64"
# ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14 (depends on NDK version)
# ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none
# ANDROID_FORBID_SYGWIN : ON/OFF
@ -1531,6 +1797,8 @@ endif()
# ANDROID_NDK
# ANDROID_STANDALONE_TOOLCHAIN
# ANDROID_TOOLCHAIN_NAME : the NDK name of compiler toolchain
# ANDROID_NDK_HOST_X64 : try to use x86_64 toolchain (default for x64 host systems)
# ANDROID_NDK_LAYOUT : the inner NDK structure (RELEASE, LINARO, ANDROID)
# LIBRARY_OUTPUT_PATH_ROOT : <any valid path>
# NDK_CCACHE : <path to your ccache executable>
# Obsolete:
@ -1546,16 +1814,19 @@ endif()
# ARMEABI : TRUE for arm v6 and older devices
# ARMEABI_V6 : TRUE for arm v6
# ARMEABI_V7A : TRUE for arm v7a
# ARM64_V8A : TRUE for arm64 v8a
# NEON : TRUE if NEON unit is enabled
# VFPV3 : TRUE if VFP version 3 is enabled
# X86 : TRUE if configured for x86
# X86_64 : TRUE if configured for x86_64
# MIPS : TRUE if configured for mips
# MIPS64 : TRUE if configured for mips64
# BUILD_ANDROID : always TRUE
# BUILD_WITH_ANDROID_NDK : TRUE if NDK is used
# BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
# ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86", "linux-x86_64" or "darwin-x86" depending on host platform
# ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
# ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86" or "mips" depending on ANDROID_ABI
# ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e; set only for NDK
# ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9, r9b, r9c, r9d, r10; set only for NDK
# ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
# ANDROID_SYSROOT : path to the compiler sysroot
# TOOL_OS_SUFFIX : "" or ".exe" depending on host platform
@ -1576,6 +1847,7 @@ endif()
# ANDROID_EXCEPTIONS : if exceptions are enabled by the runtime
# ANDROID_GCC_TOOLCHAIN_NAME : read-only, differs from ANDROID_TOOLCHAIN_NAME only if clang is used
# ANDROID_CLANG_VERSION : version of clang compiler if clang is used
# ANDROID_LIBM_PATH : path to libm.so (set to something like $(TOP)/out/target/product/<product_name>/obj/lib/libm.so) to workaround unresolved `sincos`
#
# Defaults:
# ANDROID_DEFAULT_NDK_API_LEVEL

73
cmake/FindDBus.cmake Normal file
View File

@ -0,0 +1,73 @@
# - Try to find the low-level D-Bus library
# Once done this will define
#
# DBUS_FOUND - system has D-Bus
# DBUS_INCLUDE_DIR - the D-Bus include directory
# DBUS_ARCH_INCLUDE_DIR - the D-Bus architecture-specific include directory
# DBUS_LIBRARIES - the libraries needed to use D-Bus
# Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
# modeled after FindLibArt.cmake:
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
# in cache already
SET(DBUS_FOUND TRUE)
else (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
IF (NOT WIN32)
FIND_PACKAGE(PkgConfig)
IF (PKG_CONFIG_FOUND)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
pkg_check_modules(_DBUS_PC QUIET dbus-1)
ENDIF (PKG_CONFIG_FOUND)
ENDIF (NOT WIN32)
FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
${_DBUS_PC_INCLUDE_DIRS}
/usr/include
/usr/include/dbus-1.0
/usr/local/include
)
FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
${_DBUS_PC_INCLUDE_DIRS}
/usr/lib${LIB_SUFFIX}/include
/usr/lib${LIB_SUFFIX}/dbus-1.0/include
/usr/lib64/include
/usr/lib64/dbus-1.0/include
/usr/lib/include
/usr/lib/dbus-1.0/include
)
FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 dbus
PATHS
${_DBUS_PC_LIBDIR}
)
if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
set(DBUS_FOUND TRUE)
endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
if (DBUS_FOUND)
if (NOT DBus_FIND_QUIETLY)
message(STATUS "Found D-Bus: ${DBUS_LIBRARIES}")
endif (NOT DBus_FIND_QUIETLY)
else (DBUS_FOUND)
if (DBus_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find D-Bus")
endif (DBus_FIND_REQUIRED)
endif (DBUS_FOUND)
MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR DBUS_LIBRARIES)
endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)

38
cmake/FindDbusGlib.cmake Normal file
View File

@ -0,0 +1,38 @@
# DbusGlib library detection
#
# Copyright 2013 Thinstuff Technologies GmbH
# Copyright 2013 Armin Novak <anovak@thinstuff.at>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
find_package(PkgConfig)
pkg_check_modules(PC_DBUS_GLIB QUIET dbus-glib-1)
set(DBUS_GLIB_DEFINITIONS ${PC_DBUS_GLIB_CFLAGS_OTHER})
find_path(DBUS_GLIB_INCLUDE_DIR dbus/dbus-glib.h
HINTS ${PC_DBUS_GLIB_INCLUDEDIR} ${PC_DBUS_GLIB_INCLUDE_DIRS}
PATH_SUFFIXES dbus-glib-1 )
find_library(DBUS_GLIB_LIBRARY NAMES dbus-glib-1 dbus-glib
HINTS ${PC_DBUS_GLIB_LIBDIR} ${PC_DBUS_GLIB_LIBRARY_DIRS} )
set(DBUS_GLIB_LIBRARIES ${DBUS_GLIB_LIBRARY} )
set(DBUS_GLIB_INCLUDE_DIRS ${DBUS_GLIB_INCLUDE_DIR} )
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set DBUS_GLIB_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(dbus-glib DEFAULT_MSG
DBUS_GLIB_LIBRARY DBUS_GLIB_INCLUDE_DIR)
mark_as_advanced(DBUS_GLIB_INCLUDE_DIR DBUS_GLIB_LIBRARY )

View File

@ -0,0 +1,52 @@
# Try to find DocBook XSL stylesheet
# Once done, it will define:
#
# DOCBOOKXSL_FOUND - system has the required DocBook XML DTDs
# DOCBOOKXSL_DIR - the directory containing the stylesheets
# used to process DocBook XML
# Copyright (c) 2010, Luigi Toscano, <luigi.toscano@tiscali.it>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
set (STYLESHEET_PATH_LIST
share/xml/docbook/stylesheet/docbook-xsl
share/xml/docbook/xsl-stylesheets
share/sgml/docbook/xsl-stylesheets
share/xml/docbook/stylesheet/nwalsh/current
share/xml/docbook/stylesheet/nwalsh
share/xsl/docbook
share/xsl/docbook-xsl
)
find_path (DOCBOOKXSL_DIR lib/lib.xsl
PATHS ${CMAKE_SYSTEM_PREFIX_PATH}
PATH_SUFFIXES ${STYLESHEET_PATH_LIST}
)
if (NOT DOCBOOKXSL_DIR)
# hacks for systems that put the version in the stylesheet dirs
set (STYLESHEET_PATH_LIST)
foreach (STYLESHEET_PREFIX_ITER ${CMAKE_SYSTEM_PREFIX_PATH})
file(GLOB STYLESHEET_SUFFIX_ITER RELATIVE ${STYLESHEET_PREFIX_ITER}
${STYLESHEET_PREFIX_ITER}/share/xml/docbook/xsl-stylesheets-*
)
if (STYLESHEET_SUFFIX_ITER)
list (APPEND STYLESHEET_PATH_LIST ${STYLESHEET_SUFFIX_ITER})
endif ()
endforeach ()
find_path (DOCBOOKXSL_DIR VERSION
PATHS ${CMAKE_SYSTEM_PREFIX_PATH}
PATH_SUFFIXES ${STYLESHEET_PATH_LIST}
)
endif (NOT DOCBOOKXSL_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args (DocBookXSL
"Could NOT find DocBook XSL stylesheets"
DOCBOOKXSL_DIR)
mark_as_advanced (DOCBOOKXSL_DIR)

View File

@ -54,6 +54,8 @@ SET(_OPENSSL_ROOT_HINTS_AND_PATHS
FIND_PATH(OPENSSL_INCLUDE_DIR
NAMES
openssl/ssl.h
PATH_SUFFIXES
"include"
HINTS
${_OPENSSL_INCLUDEDIR}
${_OPENSSL_ROOT_HINTS_AND_PATHS}
@ -143,14 +145,10 @@ IF(WIN32 AND NOT CYGWIN)
"lib/VC"
)
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
set( OPENSSL_LIBRARIES
optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG}
optimized ${LIB_EAY_RELEASE} debug ${LIB_EAY_DEBUG}
)
else()
set( OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} )
endif()
set( OPENSSL_DEBUG_LIBRARIES ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG} )
set( OPENSSL_RELEASE_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} )
set( OPENSSL_LIBRARIES ${OPENSSL_RELEASE_LIBRARIES} )
MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE)
ELSEIF(MINGW)
@ -270,7 +268,7 @@ if (OPENSSL_INCLUDE_DIR)
set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
REGEX "^#.?define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
# The status gives if this is a developer or prerelease and is ignored here.
@ -322,4 +320,4 @@ else (OPENSSL_VERSION)
)
endif (OPENSSL_VERSION)
MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES OPENSSL_DEBUG_LIBRARIES OPENSSL_RELEASE_LIBRARIES)

53
cmake/FindUDev.cmake Normal file
View File

@ -0,0 +1,53 @@
# razor-de: Configure libudev environment
#
# UDEV_FOUND - system has a libudev
# UDEV_INCLUDE_DIR - where to find header files
# UDEV_LIBRARIES - the libraries to link against udev
# UDEV_STABLE - it's true when is the version greater or equals to 143 - version when the libudev was stabilized in its API
#
# copyright (c) 2011 Petr Vanek <petr@scribus.info>
# Redistribution and use is allowed according to the terms of the BSD license.
#
FIND_PATH(
UDEV_INCLUDE_DIR
libudev.h
/usr/include
/usr/local/include
${UDEV_PATH_INCLUDES}
)
FIND_LIBRARY(
UDEV_LIBRARIES
NAMES udev libudev
PATHS
/usr/lib${LIB_SUFFIX}
/usr/local/lib${LIB_SUFFIX}
${UDEV_PATH_LIB}
)
IF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
SET(UDEV_FOUND "YES")
execute_process(COMMAND pkg-config --atleast-version=143 libudev RESULT_VARIABLE UDEV_STABLE)
# retvale is 0 of the condition is "true" so we need to negate the value...
if (UDEV_STABLE)
set(UDEV_STABLE 0)
else (UDEV_STABLE)
set(UDEV_STABLE 1)
endif (UDEV_STABLE)
message(STATUS "libudev stable: ${UDEV_STABLE}")
ENDIF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
IF (UDEV_FOUND)
MESSAGE(STATUS "Found UDev: ${UDEV_LIBRARIES}")
MESSAGE(STATUS " include: ${UDEV_INCLUDE_DIR}")
ELSE (UDEV_FOUND)
MESSAGE(STATUS "UDev not found.")
MESSAGE(STATUS "UDev: You can specify includes: -DUDEV_PATH_INCLUDES=/opt/udev/include")
MESSAGE(STATUS " currently found includes: ${UDEV_INCLUDE_DIR}")
MESSAGE(STATUS "UDev: You can specify libs: -DUDEV_PATH_LIB=/opt/udev/lib")
MESSAGE(STATUS " currently found libs: ${UDEV_LIBRARIES}")
IF (UDev_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find UDev library")
ENDIF (UDev_FIND_REQUIRED)
ENDIF (UDEV_FOUND)

113
cmake/FindUUID.cmake Normal file
View File

@ -0,0 +1,113 @@
# - Try to find UUID
# Once done this will define
#
# UUID_FOUND - system has UUID
# UUID_INCLUDE_DIRS - the UUID include directory
# UUID_LIBRARIES - Link these to use UUID
# UUID_DEFINITIONS - Compiler switches required for using UUID
#
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
# in cache already
set(UUID_FOUND TRUE)
else (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)
find_path(UUID_INCLUDE_DIR
NAMES
uuid/uuid.h
PATHS
${UUID_DIR}/include
$ENV{UUID_DIR}/include
$ENV{UUID_DIR}
${DELTA3D_EXT_DIR}/inc
$ENV{DELTA_ROOT}/ext/inc
$ENV{DELTA_ROOT}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/usr/include/gdal
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include
)
find_library(UUID_LIBRARY
NAMES
uuid
PATHS
${UUID_DIR}/lib
$ENV{UUID_DIR}/lib
$ENV{UUID_DIR}
${DELTA3D_EXT_DIR}/lib
$ENV{DELTA_ROOT}/ext/lib
$ENV{DELTA_ROOT}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
find_library(UUID_LIBRARY_DEBUG
NAMES
uuidd
PATHS
${UUID_DIR}/lib
$ENV{UUID_DIR}/lib
$ENV{UUID_DIR}
${DELTA3D_EXT_DIR}/lib
$ENV{DELTA_ROOT}/ext/lib
$ENV{DELTA_ROOT}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
set(UUID_INCLUDE_DIRS
${UUID_INCLUDE_DIR}
)
set(UUID_LIBRARIES
${UUID_LIBRARY}
)
if (UUID_INCLUDE_DIRS AND UUID_LIBRARIES)
set(UUID_FOUND TRUE)
endif (UUID_INCLUDE_DIRS AND UUID_LIBRARIES)
if (UUID_FOUND)
if (NOT UUID_FIND_QUIETLY)
message(STATUS "Found UUID: ${UUID_LIBRARIES}")
endif (NOT UUID_FIND_QUIETLY)
else (UUID_FOUND)
if (UUID_FIND_REQUIRED)
message(FATAL_ERROR "Could not find UUID")
endif (UUID_FIND_REQUIRED)
endif (UUID_FOUND)
# show the UUID_INCLUDE_DIRS and UUID_LIBRARIES variables only in the advanced view
mark_as_advanced(UUID_INCLUDE_DIRS UUID_LIBRARIES)
endif (UUID_LIBRARIES AND UUID_INCLUDE_DIRS)

View File

@ -28,15 +28,26 @@
# limitations under the License.
#=============================================================================
if (APPLE)
set(CMAKE_FIND_FRAMEWORK_OLD ${CMAKE_FIND_FRAMEWORK})
set(CMAKE_FIND_FRAMEWORK LAST)
endif ()
find_path(X11_INCLUDE_DIR NAMES X11/Xlib.h
PATH_SUFFIXES X11
PATHS /opt/X11/include
DOC "The X11 include directory"
)
find_library(X11_LIBRARY NAMES X11
PATHS /opt/X11/lib
DOC "The X11 library"
)
if(APPLE)
set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_OLD})
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11 DEFAULT_MSG X11_LIBRARY X11_INCLUDE_DIR)

View File

@ -30,10 +30,12 @@
find_path(XKBFILE_INCLUDE_DIR NAMES X11/extensions/XKBfile.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XKBFile include directory"
)
find_library(XKBFILE_LIBRARY NAMES xkbfile
PATHS /opt/X11/lib
DOC "The XKBFile library"
)

View File

@ -28,10 +28,12 @@
find_path(XRANDR_INCLUDE_DIR NAMES X11/extensions/Xrandr.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XRANDR include directory"
)
find_library(XRANDR_LIBRARY NAMES Xrandr
PATHS /opt/X11/lib
DOC "The XRANDR library"
)

View File

@ -30,10 +30,12 @@
find_path(XSHM_INCLUDE_DIR NAMES X11/extensions/XShm.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XShm include directory"
)
find_library(XSHM_LIBRARY NAMES Xext
PATHS /opt/X11/lib
DOC "The XShm library"
)

View File

@ -30,10 +30,12 @@
find_path(XTEST_INCLUDE_DIR NAMES X11/extensions/XTest.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The XTest include directory"
)
find_library(XTEST_LIBRARY NAMES Xtst
PATHS /opt/X11/lib
DOC "The XTest library"
)

View File

@ -30,10 +30,12 @@
find_path(XCURSOR_INCLUDE_DIR NAMES X11/Xcursor/Xcursor.h
PATH_SUFFIXES X11/Xcursor
PATHS /opt/X11/include
DOC "The Xcursor include directory"
)
find_library(XCURSOR_LIBRARY NAMES Xcursor
PATHS /opt/X11/lib
DOC "The Xcursor library"
)

View File

@ -30,10 +30,12 @@
find_path(XDAMAGE_INCLUDE_DIR NAMES X11/extensions/Xdamage.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The Xdamage include directory"
)
find_library(XDAMAGE_LIBRARY NAMES Xdamage
PATHS /opt/X11/lib
DOC "The Xdamage library"
)

View File

@ -30,10 +30,12 @@
find_path(XEXT_INCLUDE_DIR NAMES X11/extensions/Xext.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The Xext include directory"
)
find_library(XEXT_LIBRARY NAMES Xext
PATHS /opt/X11/lib
DOC "The Xext library"
)

View File

@ -30,10 +30,12 @@
find_path(XFIXES_INCLUDE_DIR NAMES X11/extensions/Xfixes.h
PATH_SUFFIXES X11/extensions
PATHS /opt/X11/include
DOC "The Xfixes include directory"
)
find_library(XFIXES_LIBRARY NAMES Xfixes
PATHS /opt/X11/lib
DOC "The Xfixes library"
)

View File

@ -31,9 +31,11 @@
include(CheckSymbolExists)
find_path(XI_INCLUDE_DIR NAMES X11/extensions/XInput2.h
PATHS /opt/X11/include
DOC "The Xi include directory")
find_library(XI_LIBRARY NAMES Xi
PATHS /opt/X11/lib
DOC "The Xi library")
include(FindPackageHandleStandardArgs)

View File

@ -29,11 +29,13 @@
#=============================================================================
find_path(XINERAMA_INCLUDE_DIR NAMES X11/extensions/Xinerama.h
PATHS /opt/X11/include
PATH_SUFFIXES X11/extensions
DOC "The Xinerama include directory"
)
find_library(XINERAMA_LIBRARY NAMES Xinerama
PATHS /opt/X11/lib
DOC "The Xinerama library"
)

View File

@ -27,9 +27,11 @@
#=============================================================================
find_path(XRENDER_INCLUDE_DIR NAMES X11/extensions/Xrender.h
PATHS /opt/X11/include
DOC "The Xrender include directory")
find_library(XRENDER_LIBRARY NAMES Xrender
PATHS /opt/X11/lib
DOC "The Xrender library")
include(FindPackageHandleStandardArgs)

View File

@ -29,10 +29,12 @@
#=============================================================================
find_path(XV_INCLUDE_DIR NAMES X11/extensions/Xv.h
PATHS /opt/X11/include
DOC "The Xv include directory"
)
find_library(XV_LIBRARY NAMES Xv
PATHS /opt/X11/lib
DOC "The Xv library"
)

View File

@ -0,0 +1,98 @@
# - Try to find libusb-1.0
# Once done this will define
#
# LIBUSB_1_FOUND - system has libusb
# LIBUSB_1_INCLUDE_DIRS - the libusb include directory
# LIBUSB_1_LIBRARIES - Link these to use libusb
# LIBUSB_1_DEFINITIONS - Compiler switches required for using libusb
#
# Adapted from cmake-modules Google Code project
#
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
# (Changes for libusb) Copyright (c) 2008 Kyle Machulis <kyle@nonpolynomial.com>
#
# Redistribution and use is allowed according to the terms of the New BSD license.
#
# CMake-Modules Project New BSD License
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of the CMake-Modules Project nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
if (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
# in cache already
set(LIBUSB_FOUND TRUE)
else (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)
find_path(LIBUSB_1_INCLUDE_DIR
NAMES
libusb.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
PATH_SUFFIXES
libusb-1.0
)
find_library(LIBUSB_1_LIBRARY
NAMES
usb-1.0 usb
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
set(LIBUSB_1_INCLUDE_DIRS
${LIBUSB_1_INCLUDE_DIR}
)
set(LIBUSB_1_LIBRARIES
${LIBUSB_1_LIBRARY}
)
if (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
set(LIBUSB_1_FOUND TRUE)
endif (LIBUSB_1_INCLUDE_DIRS AND LIBUSB_1_LIBRARIES)
if (LIBUSB_1_FOUND)
if (NOT libusb_1_FIND_QUIETLY)
message(STATUS "Found libusb-1.0:")
message(STATUS " - Includes: ${LIBUSB_1_INCLUDE_DIRS}")
message(STATUS " - Libraries: ${LIBUSB_1_LIBRARIES}")
endif (NOT libusb_1_FIND_QUIETLY)
else (LIBUSB_1_FOUND)
if (libusb_1_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libusb")
endif (libusb_1_FIND_REQUIRED)
endif (LIBUSB_1_FOUND)
# show the LIBUSB_1_INCLUDE_DIRS and LIBUSB_1_LIBRARIES variables only in the advanced view
mark_as_advanced(LIBUSB_1_INCLUDE_DIRS LIBUSB_1_LIBRARIES)
endif (LIBUSB_1_LIBRARIES AND LIBUSB_1_INCLUDE_DIRS)

View File

@ -36,6 +36,9 @@ set (UNIX True)
set (APPLE True)
set (IOS True)
# Required as of cmake 2.8.10
set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE)
# Determine the cmake host system version so we know where to find the iOS SDKs
find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
if (CMAKE_UNAME)
@ -131,7 +134,7 @@ if (NOT DEFINED CMAKE_IOS_SDK_ROOT)
list (REVERSE _CMAKE_IOS_SDKS)
list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)
else (_CMAKE_IOS_SDKS)
message (FATAL_ERROR "No iOS SDK's found in default seach path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
endif (_CMAKE_IOS_SDKS)
message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)

16
cmake/today.cmake Normal file
View File

@ -0,0 +1,16 @@
# This script returns the current date in ISO format
#
# YYYY-MM-DD
#
MACRO (TODAY RESULT)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "cmd" " /C date +%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
ELSEIF(UNIX)
EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${RESULT})
string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
ELSE (WIN32)
MESSAGE(SEND_ERROR "date not implemented")
SET(${RESULT} 000000)
ENDIF (WIN32)
ENDMACRO (TODAY)

View File

@ -1,15 +1,6 @@
#ifndef __CONFIG_H
#define __CONFIG_H
#define FREERDP_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}
#define FREERDP_VERSION_MINOR ${FREERDP_VERSION_MINOR}
#define FREERDP_VERSION_REVISION ${FREERDP_VERSION_REVISION}
#define FREERDP_VERSION_SUFFIX "${FREERDP_VERSION_SUFFIX}"
#define FREERDP_API_VERSION "${FREERDP_API_VERSION}"
#define FREERDP_VERSION "${FREERDP_VERSION}"
#define FREERDP_VERSION_FULL "${FREERDP_VERSION_FULL}"
#define GIT_REVISION "${GIT_REVISION}"
#define FREERDP_DATA_PATH "${FREERDP_DATA_PATH}"
#define FREERDP_KEYMAP_PATH "${FREERDP_KEYMAP_PATH}"
#define FREERDP_PLUGIN_PATH "${FREERDP_PLUGIN_PATH}"

View File

@ -34,8 +34,8 @@ However, any other static build should work as well.
To build openssl:
git clone git@github.com:bmiklautz/Android-external-openssl-ndk-static.git
cd Android-external-openssl-ndk-static
git clone git@github.com:bmiklautz/android-external-openssl-ndk-static.git
cd android-external-openssl-ndk-static
ndk-build # found in the Android NDK

View File

@ -4,7 +4,6 @@ Overview
The FreeRDP iOS port allows users to enjoy FreeRDP features on Apple iOS devices.
The application was written to be compatible with devices running iOS 4.3 or higher.
Build requirements
==================
@ -13,6 +12,7 @@ The following prerequisites are required in order to build the iOS port:
- cmake version >= 2.8.9
- latest Xcode installed (>= 4.6)
- installed Provisioning Profile and iOS Developer Certificate for code signing
(not required for simulator builds)
- pre-build static OpenSSL libraries (see below)
FreeRDP requires OpenSSL libraries for building but they are not part of the iOS SDK and therefore they need to be pre-build manually.
@ -23,12 +23,28 @@ If you don't care about modifying the OpenSSL build you can run the following co
./scripts/OpenSSL-DownloadAndBuild.command
The script is using the latest iOS SDK 6.1 to build the OpenSSL libraries.
If you want to use a different SDK version simply edit the OpenSSL-iFreeRDP.diff file and modify the -isysroot parameters to point to the SDK version you want to build with.
The output of the script will be found in external/openssl/. In case you want a
different install/build directory you specify it as first parameter:
When the script finishes the external/openssl/lib subfolder will contain libcrypto.a and libssl.a, both universal binary libraries containing arm and i386 targets in order to compile FreeRDP for iOS devices and the simulator.
./scripts/OpenSSL-DownloadAndBuild.command /tmp/
If you build OpenSSL youself you need to set FREERDP_IOS_EXTERNAL_SSL_PATH when running cmake.
In the example above the output can then be found in /tmp/openssl.
The script uses oldest iOS/iPhoneSimulator SDK found on the build machine per default. If you need to build against a different SDK you can set USER_OS_SDK
and/or USER_SIM_SDK in the top of the build script to the SDK version you need. E.g.:
USER_SIM_SDK="iPhoneSimulator6.0.sdk"
When the script is finished you will find libcrypto.a and libssl.at, both universal libraries containing all openssl/lib
subfolder in the specified
install directory (external per default)
When the script finishes you will find libcrypto.a and libssl.a, both universal
binary libraries containing arm and i386 targets in order to compile FreeRDP for
iOS devices and the simulator, in the lib subfolder of your installation
directory.
If you build OpenSSL youself or with an install directory specified you need to set FREERDP_IOS_EXTERNAL_SSL_PATH when running cmake.
Building
@ -45,12 +61,15 @@ Alternatively you can also build the project from the command line using xcodebu
xcodebuild -project FreeRDP.xcodeproj -configuration Debug -sdk iphoneos6.1
or with cmake --build . in your build directory.
Notes:
* XCode, by default will build the application into its derived data location (usually in ~/Library/Developer/...).
If you want to specify an output directory add CONFIGURATION_BUILD_DIR=<output-path-here> to the end of above command line.
* If using XCode choose "Open Other" from the welcome screen, browse to the FreeRDP root directory and select FreeRDP.xcodeproj.
* If using XCode choose "Open Other" from the welcome screen, browse to the FreeRDP root directory and select FreeRDP.xcodeproj. Alternatively you can
also start it with "open FreeRDP.xcodeproj".
* If you switch between platforms (OS and SIMULATOR) please remove CMakeCache.txt and CMakeFiles/ before calling cmake again.
Otherwise build errors might occur (this seems to be a bug with cmake or the cmake scripts). To switch between platforms do:
@ -79,3 +98,5 @@ CMAKE_IOS_SDK_ROOT (used by toolchain file)
FREERDP_IOS_EXTERNAL_SSL_PATH (used by FindOpenSSL)
* absolut root path to the pre-built static OpenSSL libraries
CODE_SIGN_IDENTITY
* specify the identity to sign the code with

View File

@ -17,8 +17,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/freerdp/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/freerdp/version.h)
file(GLOB FREERDP_HEADERS "freerdp/*.h")
install(FILES ${FREERDP_HEADERS} DESTINATION include/freerdp COMPONENT headers)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/freerdp/version.h DESTINATION include/freerdp COMPONENT headers)
install(DIRECTORY freerdp/cache DESTINATION include/freerdp COMPONENT headers FILES_MATCHING PATTERN "*.h")
install(DIRECTORY freerdp/codec DESTINATION include/freerdp COMPONENT headers FILES_MATCHING PATTERN "*.h")

View File

@ -59,8 +59,8 @@ struct _NSC_CONTEXT
/* color palette allocated by the application */
const BYTE* palette;
void (*decode)(NSC_CONTEXT* context);
void (*encode)(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride);
BOOL (*decode)(NSC_CONTEXT* context);
BOOL (*encode)(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride);
NSC_CONTEXT_PRIV* priv;
};

View File

@ -74,6 +74,7 @@ struct crypto_cert_struct
X509 * px509;
};
#define CRYPTO_SHA256_DIGEST_LENGTH SHA256_DIGEST_LENGTH
#define CRYPTO_SHA1_DIGEST_LENGTH SHA_DIGEST_LENGTH
typedef struct crypto_sha1_struct* CryptoSha1;
@ -132,10 +133,10 @@ extern const BYTE tssk_modulus[];
extern const BYTE tssk_privateExponent[];
extern const BYTE tssk_exponent[];
FREERDP_API void crypto_rsa_public_encrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, BYTE* output);
FREERDP_API void crypto_rsa_public_decrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, BYTE* output);
FREERDP_API void crypto_rsa_private_encrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output);
FREERDP_API void crypto_rsa_private_decrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output);
FREERDP_API int crypto_rsa_public_encrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, BYTE* output);
FREERDP_API int crypto_rsa_public_decrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* exponent, BYTE* output);
FREERDP_API int crypto_rsa_private_encrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output);
FREERDP_API int crypto_rsa_private_decrypt(const BYTE* input, int length, UINT32 key_length, const BYTE* modulus, const BYTE* private_exponent, BYTE* output);
FREERDP_API void crypto_reverse(BYTE* data, int length);
FREERDP_API void crypto_nonce(BYTE* nonce, int size);

View File

@ -64,6 +64,7 @@ typedef struct rdp_input_proxy rdpInputProxy;
typedef void (*pSynchronizeEvent)(rdpInput* input, UINT32 flags);
typedef void (*pKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code);
typedef void (*pKeyboardPauseEvent)(rdpInput* input);
typedef void (*pUnicodeKeyboardEvent)(rdpInput* input, UINT16 flags, UINT16 code);
typedef void (*pMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
typedef void (*pExtendedMouseEvent)(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
@ -81,8 +82,9 @@ struct rdp_input
pMouseEvent MouseEvent; /* 19 */
pExtendedMouseEvent ExtendedMouseEvent; /* 20 */
pFocusInEvent FocusInEvent; /*21 */
pKeyboardPauseEvent KeyboardPauseEvent; /* 22 */
UINT32 paddingB[32 - 22]; /* 22 */
UINT32 paddingB[32 - 23]; /* 23 */
/* Internal */
@ -98,6 +100,7 @@ extern "C" {
FREERDP_API void freerdp_input_send_synchronize_event(rdpInput* input, UINT32 flags);
FREERDP_API void freerdp_input_send_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
FREERDP_API void freerdp_input_send_keyboard_event_ex(rdpInput* input, BOOL down, UINT32 rdp_scancode);
FREERDP_API void freerdp_input_send_keyboard_pause_event(rdpInput* input);
FREERDP_API void freerdp_input_send_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
FREERDP_API void freerdp_input_send_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
FREERDP_API void freerdp_input_send_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);

View File

@ -0,0 +1,32 @@
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* Version includes
*
* Copyright 2013 Thinstuff Technologies GmbH
* Copyright 2013 Bernhard Miklautz <bmiklautz@thinstuff.at>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _FREERDP_VERSION_H_
#define _FREERDP_VERSION_H_
#define FREERDP_VERSION_MAJOR ${FREERDP_VERSION_MAJOR}
#define FREERDP_VERSION_MINOR ${FREERDP_VERSION_MINOR}
#define FREERDP_VERSION_REVISION ${FREERDP_VERSION_REVISION}
#define FREERDP_VERSION_SUFFIX "${FREERDP_VERSION_SUFFIX}"
#define FREERDP_API_VERSION "${FREERDP_API_VERSION}"
#define FREERDP_VERSION "${FREERDP_VERSION}"
#define FREERDP_VERSION_FULL "${FREERDP_VERSION_FULL}"
#define GIT_REVISION "${GIT_REVISION}"
#endif // _FREERDP_VERSION_H_

View File

@ -40,6 +40,8 @@ void update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
bitmap = offscreen_cache_get(cache->offscreen, memblt->cacheIndex);
else
bitmap = bitmap_cache_get(cache->bitmap, (BYTE) memblt->cacheId, memblt->cacheIndex);
/* XP-SP2 servers sometimes ask for cached bitmaps they've never defined. */
if (bitmap == NULL) return;
memblt->bitmap = bitmap;
IFCALL(cache->bitmap->MemBlt, context, memblt);
@ -56,6 +58,8 @@ void update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
bitmap = offscreen_cache_get(cache->offscreen, mem3blt->cacheIndex);
else
bitmap = bitmap_cache_get(cache->bitmap, (BYTE) mem3blt->cacheId, mem3blt->cacheIndex);
/* XP-SP2 servers sometimes ask for cached bitmaps they've never defined. */
if (bitmap == NULL) return;
style = brush->style;

View File

@ -48,6 +48,7 @@ void update_process_glyph(rdpContext* context, BYTE* data, int* index,
if ((ulCharInc == 0) && (!(flAccel & SO_CHAR_INC_EQUAL_BM_BASE)))
{
/* Contrary to fragments, the offset is added before the glyph. */
(*index)++;
offset = data[*index];
@ -111,6 +112,12 @@ void update_process_glyph_fragments(rdpContext* context, BYTE* data, UINT32 leng
if (fragments != NULL)
{
for (n = 0; n < (int) size; n++)
{
update_process_glyph(context, fragments, &n, &x, &y, cacheId, ulCharInc, flAccel);
}
/* Contrary to glyphs, the offset is added after the fragment. */
if ((ulCharInc == 0) && (!(flAccel & SO_CHAR_INC_EQUAL_BM_BASE)))
{
if (flAccel & SO_VERTICAL)
@ -118,11 +125,6 @@ void update_process_glyph_fragments(rdpContext* context, BYTE* data, UINT32 leng
else
x += data[index + 2];
}
for (n = 0; n < (int) size; n++)
{
update_process_glyph(context, fragments, &n, &x, &y, cacheId, ulCharInc, flAccel);
}
}
index += (index + 2 < (int) length) ? 3 : 2;
@ -277,7 +279,7 @@ void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph)
if (y == -32768)
y = fast_glyph->bkTop;
if (fast_glyph->cbData > 1)
if (fast_glyph->cbData > 1 && NULL != fast_glyph->glyphData.aj)
{
/* got option font that needs to go into cache */
glyph_data = &fast_glyph->glyphData;
@ -288,7 +290,8 @@ void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph)
glyph->cx = glyph_data->cx;
glyph->cy = glyph_data->cy;
glyph->cb = glyph_data->cb;
glyph->aj = glyph_data->aj;
glyph->aj = malloc(glyph_data->cb);
CopyMemory(glyph->aj, glyph_data->aj, glyph->cb);
Glyph_New(context, glyph);
glyph_cache_put(cache->glyph, fast_glyph->cacheId, fast_glyph->data[0], glyph);
@ -368,16 +371,14 @@ rdpGlyph* glyph_cache_get(rdpGlyphCache* glyph_cache, UINT32 id, UINT32 index)
if (index > glyph_cache->glyphCache[id].number)
{
fprintf(stderr, "invalid glyph cache index: %d in cache id: %d\n", index, id);
fprintf(stderr, "index %d out of range for cache id: %d\n", index, id);
return NULL;
}
glyph = glyph_cache->glyphCache[id].entries[index];
if (glyph == NULL)
{
fprintf(stderr, "invalid glyph at cache index: %d in cache id: %d\n", index, id);
}
fprintf(stderr, "no glyph found at cache index: %d in cache id: %d\n", index, id);
return glyph;
}
@ -418,9 +419,7 @@ void* glyph_cache_fragment_get(rdpGlyphCache* glyph_cache, UINT32 index, UINT32*
*size = (BYTE) glyph_cache->fragCache.entries[index].size;
if (fragment == NULL)
{
fprintf(stderr, "invalid glyph fragment at index:%d\n", index);
}
return fragment;
}
@ -435,10 +434,8 @@ void glyph_cache_fragment_put(rdpGlyphCache* glyph_cache, UINT32 index, UINT32 s
glyph_cache->fragCache.entries[index].size = size;
if (prevFragment != NULL)
{
free(prevFragment);
}
}
void glyph_cache_register_callbacks(rdpUpdate* update)
{

View File

@ -43,7 +43,7 @@
#define NSC_INIT_SIMD(_nsc_context) do { } while (0)
#endif
static void nsc_decode(NSC_CONTEXT* context)
static BOOL nsc_decode(NSC_CONTEXT* context)
{
UINT16 x;
UINT16 y;
@ -60,11 +60,18 @@ static void nsc_decode(NSC_CONTEXT* context)
INT16 g_val;
INT16 b_val;
BYTE* bmpdata;
size_t pos = 0;
if (!context)
return FALSE;
bmpdata = context->bmpdata;
rw = ROUND_UP_TO(context->width, 8);
shift = context->nsc_stream.ColorLossLevel - 1; /* colorloss recovery + YCoCg shift */
if (!bmpdata)
return FALSE;
for (y = 0; y < context->height; y++)
{
if (context->nsc_stream.ChromaSubSamplingLevel > 0)
@ -88,6 +95,11 @@ static void nsc_decode(NSC_CONTEXT* context)
r_val = y_val + co_val - cg_val;
g_val = y_val + cg_val;
b_val = y_val - co_val - cg_val;
if (pos + 4 > context->bmpdata_length)
return FALSE;
pos += 4;
*bmpdata++ = MINMAX(b_val, 0, 0xFF);
*bmpdata++ = MINMAX(g_val, 0, 0xFF);
*bmpdata++ = MINMAX(r_val, 0, 0xFF);
@ -98,9 +110,11 @@ static void nsc_decode(NSC_CONTEXT* context)
aplane++;
}
}
return TRUE;
}
static void nsc_rle_decode(BYTE* in, BYTE* out, UINT32 origsz)
static BOOL nsc_rle_decode(BYTE* in, BYTE* out, UINT32 outSize, UINT32 origsz)
{
UINT32 len;
UINT32 left;
@ -113,6 +127,10 @@ static void nsc_rle_decode(BYTE* in, BYTE* out, UINT32 origsz)
if (left == 5)
{
if (outSize < 1)
return FALSE;
outSize--;
*out++ = value;
left--;
}
@ -130,6 +148,10 @@ static void nsc_rle_decode(BYTE* in, BYTE* out, UINT32 origsz)
len = *((UINT32*) in);
in += 4;
}
if (outSize < len)
return FALSE;
outSize -= len;
memset(out, value, len);
out += len;
left -= len;
@ -141,16 +163,24 @@ static void nsc_rle_decode(BYTE* in, BYTE* out, UINT32 origsz)
}
}
*((UINT32*)out) = *((UINT32*)in);
if ((outSize < 4) || (left < 4))
return FALSE;
memcpy(out, in, 4);
return TRUE;
}
static void nsc_rle_decompress_data(NSC_CONTEXT* context)
static BOOL nsc_rle_decompress_data(NSC_CONTEXT* context)
{
UINT16 i;
BYTE* rle;
UINT32 origsize;
UINT32 planesize;
if (!context)
return FALSE;
rle = context->nsc_stream.Planes;
for (i = 0; i < 4; i++)
@ -159,14 +189,30 @@ static void nsc_rle_decompress_data(NSC_CONTEXT* context)
planesize = context->nsc_stream.PlaneByteCount[i];
if (planesize == 0)
{
if (context->priv->plane_buf_length < origsize)
return FALSE;
memset(context->priv->plane_buf[i], 0xff, origsize);
}
else if (planesize < origsize)
nsc_rle_decode(rle, context->priv->plane_buf[i], origsize);
{
if (!nsc_rle_decode(rle, context->priv->plane_buf[i], context->priv->plane_buf_length,
origsize))
return FALSE;
}
else
{
if (context->priv->plane_buf_length < origsize)
return FALSE;
memcpy(context->priv->plane_buf[i], rle, origsize);
}
rle += planesize;
}
return TRUE;
}
static void nsc_stream_initialize(NSC_CONTEXT* context, wStream* s)
@ -337,12 +383,24 @@ void nsc_process_message(NSC_CONTEXT* context, UINT16 bpp,
Stream_Free(s, FALSE);
/* RLE decode */
{
BOOL rc;
PROFILER_ENTER(context->priv->prof_nsc_rle_decompress_data);
nsc_rle_decompress_data(context);
rc = nsc_rle_decompress_data(context);
PROFILER_EXIT(context->priv->prof_nsc_rle_decompress_data);
/* Colorloss recover, Chroma supersample and AYCoCg to ARGB Conversion in one step */
PROFILER_ENTER(context->priv->prof_nsc_decode);
context->decode(context);
PROFILER_EXIT(context->priv->prof_nsc_decode);
if (!rc)
return;
}
/* Colorloss recover, Chroma supersample and AYCoCg to ARGB Conversion in one step */
{
BOOL rc;
PROFILER_ENTER(context->priv->prof_nsc_decode);
rc = context->decode(context);
PROFILER_EXIT(context->priv->prof_nsc_decode);
if (!rc)
return;
}
}

View File

@ -67,7 +67,7 @@ static void nsc_context_initialize_encode(NSC_CONTEXT* context)
}
}
static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride)
static BOOL nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride)
{
UINT16 x;
UINT16 y;
@ -85,10 +85,20 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, BYTE* bmpdata, int r
UINT32 tempWidth;
UINT32 tempHeight;
if (!context || bmpdata || (rowstride == 0))
return FALSE;
tempWidth = ROUND_UP_TO(context->width, 8);
tempHeight = ROUND_UP_TO(context->height, 2);
rw = (context->nsc_stream.ChromaSubSamplingLevel > 0 ? tempWidth : context->width);
ccl = context->nsc_stream.ColorLossLevel;
if (context->priv->plane_buf_length < rw * rowstride)
return FALSE;
if (rw < rowstride * 2)
return FALSE;
yplane = context->priv->plane_buf[0];
coplane = context->priv->plane_buf[1];
cgplane = context->priv->plane_buf[2];
@ -196,32 +206,38 @@ static void nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, BYTE* bmpdata, int r
memcpy(coplane + rw, coplane, rw);
memcpy(cgplane + rw, cgplane, rw);
}
return TRUE;
}
static void nsc_encode_subsampling(NSC_CONTEXT* context)
static BOOL nsc_encode_subsampling(NSC_CONTEXT* context)
{
UINT16 x;
UINT16 y;
BYTE* co_dst;
BYTE* cg_dst;
INT8* co_src0;
INT8* co_src1;
INT8* cg_src0;
INT8* cg_src1;
UINT32 tempWidth;
UINT32 tempHeight;
if (!context)
return FALSE;
tempWidth = ROUND_UP_TO(context->width, 8);
tempHeight = ROUND_UP_TO(context->height, 2);
if (tempHeight == 0)
return FALSE;
if (tempWidth > context->priv->plane_buf_length / tempHeight)
return FALSE;
for (y = 0; y < tempHeight >> 1; y++)
{
co_dst = context->priv->plane_buf[1] + y * (tempWidth >> 1);
cg_dst = context->priv->plane_buf[2] + y * (tempWidth >> 1);
co_src0 = (INT8*) context->priv->plane_buf[1] + (y << 1) * tempWidth;
co_src1 = co_src0 + tempWidth;
cg_src0 = (INT8*) context->priv->plane_buf[2] + (y << 1) * tempWidth;
cg_src1 = cg_src0 + tempWidth;
BYTE* co_dst = context->priv->plane_buf[1] + y * (tempWidth >> 1);
BYTE* cg_dst = context->priv->plane_buf[2] + y * (tempWidth >> 1);
const INT8* co_src0 = (INT8*) context->priv->plane_buf[1] + (y << 1) * tempWidth;
const INT8* co_src1 = co_src0 + tempWidth;
const INT8* cg_src0 = (INT8*) context->priv->plane_buf[2] + (y << 1) * tempWidth;
const INT8* cg_src1 = cg_src0 + tempWidth;
for (x = 0; x < tempWidth >> 1; x++)
{
*co_dst++ = (BYTE) (((INT16) *co_src0 + (INT16) *(co_src0 + 1) +
@ -234,18 +250,28 @@ static void nsc_encode_subsampling(NSC_CONTEXT* context)
cg_src1 += 2;
}
}
return TRUE;
}
void nsc_encode(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride)
BOOL nsc_encode(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride)
{
nsc_encode_argb_to_aycocg(context, bmpdata, rowstride);
if (!context || !bmpdata || (rowstride == 0))
return FALSE;
if (!nsc_encode_argb_to_aycocg(context, bmpdata, rowstride))
return FALSE;
if (context->nsc_stream.ChromaSubSamplingLevel > 0)
{
nsc_encode_subsampling(context);
}
if (!nsc_encode_subsampling(context))
return FALSE;
}
static UINT32 nsc_rle_encode(BYTE* in, BYTE* out, UINT32 origsz)
return TRUE;
}
static UINT32 nsc_rle_encode(const BYTE* in, BYTE* out, UINT32 origsz)
{
UINT32 left;
UINT32 runlength = 1;

View File

@ -20,6 +20,6 @@
#ifndef __NSC_ENCODE_H
#define __NSC_ENCODE_H
void nsc_encode(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride);
BOOL nsc_encode(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride);
#endif

View File

@ -333,13 +333,15 @@ static void nsc_encode_subsampling_sse2(NSC_CONTEXT* context)
}
}
static void nsc_encode_sse2(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride)
static BOOL nsc_encode_sse2(NSC_CONTEXT* context, BYTE* bmpdata, int rowstride)
{
nsc_encode_argb_to_aycocg_sse2(context, bmpdata, rowstride);
if (context->nsc_stream.ChromaSubSamplingLevel > 0)
{
nsc_encode_subsampling_sse2(context);
}
return TRUE;
}
void nsc_init_sse2(NSC_CONTEXT* context)

View File

@ -156,7 +156,6 @@ RFX_CONTEXT* rfx_context_new(void)
ZeroMemory(context->priv, sizeof(RFX_CONTEXT_PRIV));
context->priv->TilePool = Queue_New(TRUE, -1, -1);
context->priv->TileQueue = Queue_New(TRUE, -1, -1);
/*
* align buffers to 16 byte boundary (needed for SSE/NEON instructions)
@ -228,6 +227,8 @@ RFX_CONTEXT* rfx_context_new(void)
if (context->priv->MaxThreadCount)
SetThreadpoolThreadMaximum(context->priv->ThreadPool, context->priv->MaxThreadCount);
context->priv->EncoderStreamPool = StreamPool_New(TRUE, 64*64*3+19);
}
/* initialize the default pixel format */
@ -254,7 +255,6 @@ void rfx_context_free(RFX_CONTEXT* context)
free(context->quants);
Queue_Free(context->priv->TilePool);
Queue_Free(context->priv->TileQueue);
rfx_profiler_print(context);
rfx_profiler_free(context);
@ -263,6 +263,7 @@ void rfx_context_free(RFX_CONTEXT* context)
{
CloseThreadpool(context->priv->ThreadPool);
DestroyThreadpoolEnvironment(&context->priv->ThreadPoolEnv);
StreamPool_Free(context->priv->EncoderStreamPool);
#ifdef WITH_PROFILER
fprintf(stderr, "\nWARNING: Profiling results probably unusable with multithreaded RemoteFX codec!\n");
#endif
@ -314,7 +315,6 @@ RFX_TILE* rfx_tile_pool_take(RFX_CONTEXT* context)
{
RFX_TILE* tile = NULL;
if (WaitForSingleObject(Queue_Event(context->priv->TilePool), 0) == WAIT_OBJECT_0)
tile = Queue_Dequeue(context->priv->TilePool);
if (!tile)
@ -585,17 +585,17 @@ static BOOL rfx_process_message_tile(RFX_CONTEXT* context, RFX_TILE* tile, wStre
tile->data, 64 * 4);
}
struct _RFX_TILE_WORK_PARAM
struct _RFX_TILE_PROCESS_WORK_PARAM
{
wStream s;
RFX_TILE* tile;
RFX_CONTEXT* context;
};
typedef struct _RFX_TILE_WORK_PARAM RFX_TILE_WORK_PARAM;
typedef struct _RFX_TILE_PROCESS_WORK_PARAM RFX_TILE_PROCESS_WORK_PARAM;
void CALLBACK rfx_process_message_tile_work_callback(PTP_CALLBACK_INSTANCE instance, void* context, PTP_WORK work)
{
RFX_TILE_WORK_PARAM* param = (RFX_TILE_WORK_PARAM*) context;
RFX_TILE_PROCESS_WORK_PARAM* param = (RFX_TILE_PROCESS_WORK_PARAM*) context;
rfx_process_message_tile(param->context, param->tile, &(param->s));
}
@ -610,7 +610,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
UINT32 blockType;
UINT32 tilesDataSize;
PTP_WORK* work_objects = NULL;
RFX_TILE_WORK_PARAM* params = NULL;
RFX_TILE_PROCESS_WORK_PARAM* params = NULL;
if (Stream_GetRemainingLength(s) < 14)
{
@ -694,7 +694,7 @@ static BOOL rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
if (context->priv->UseThreads)
{
work_objects = (PTP_WORK*) malloc(sizeof(PTP_WORK) * message->num_tiles);
params = (RFX_TILE_WORK_PARAM*) malloc(sizeof(RFX_TILE_WORK_PARAM) * message->num_tiles);
params = (RFX_TILE_PROCESS_WORK_PARAM*) malloc(sizeof(RFX_TILE_PROCESS_WORK_PARAM) * message->num_tiles);
}
/* tiles */
@ -1046,6 +1046,41 @@ static void rfx_compose_message_tile(RFX_CONTEXT* context, wStream* s,
Stream_SetPosition(s, end_pos);
}
struct _RFX_TILE_COMPOSE_WORK_PARAM
{
RFX_CONTEXT* context;
wStream *s;
BYTE* tile_data;
int tile_width;
int tile_height;
int rowstride;
UINT32* quantVals;
int quantIdxY;
int quantIdxCb;
int quantIdxCr;
int xIdx;
int yIdx;
};
typedef struct _RFX_TILE_COMPOSE_WORK_PARAM RFX_TILE_COMPOSE_WORK_PARAM;
void CALLBACK rfx_compose_message_tile_work_callback(PTP_CALLBACK_INSTANCE instance, void* context, PTP_WORK work)
{
RFX_TILE_COMPOSE_WORK_PARAM* param = (RFX_TILE_COMPOSE_WORK_PARAM*) context;
/**
* Some component of the encoder chain (I suspect the rlgr encoder) expects
* the output buffer to be zeroed. The multithreaded RemoteFX encoder uses
* wStreams from the StreamPool which are reused and not zeroed out of
* course. For now, in order to prevent data corruption we clear the stream.
*/
Stream_Clear(param->s);
rfx_compose_message_tile(param->context, param->s,
param->tile_data, param->tile_width, param->tile_height, param->rowstride,
param->quantVals, param->quantIdxY, param->quantIdxCb, param->quantIdxCr, param->xIdx, param->yIdx);
}
static void rfx_compose_message_tileset(RFX_CONTEXT* context, wStream* s,
BYTE* image_data, int width, int height, int rowstride)
{
@ -1064,6 +1099,11 @@ static void rfx_compose_message_tileset(RFX_CONTEXT* context, wStream* s,
int xIdx;
int yIdx;
int tilesDataSize;
BYTE* tileData;
int tileWidth;
int tileHeight;
PTP_WORK* work_objects = NULL;
RFX_TILE_COMPOSE_WORK_PARAM* params = NULL;
if (context->num_quants == 0)
{
@ -1112,17 +1152,64 @@ static void rfx_compose_message_tileset(RFX_CONTEXT* context, wStream* s,
DEBUG_RFX("width:%d height:%d rowstride:%d", width, height, rowstride);
end_pos = Stream_GetPosition(s);
if (context->priv->UseThreads)
{
work_objects = (PTP_WORK*) malloc(sizeof(PTP_WORK) * numTiles);
params = (RFX_TILE_COMPOSE_WORK_PARAM*) malloc(sizeof(RFX_TILE_COMPOSE_WORK_PARAM) * numTiles);
}
for (yIdx = 0; yIdx < numTilesY; yIdx++)
{
for (xIdx = 0; xIdx < numTilesX; xIdx++)
{
rfx_compose_message_tile(context, s,
image_data + yIdx * 64 * rowstride + xIdx * 8 * context->bits_per_pixel,
(xIdx < numTilesX - 1) ? 64 : width - xIdx * 64,
(yIdx < numTilesY - 1) ? 64 : height - yIdx * 64,
tileData = image_data + yIdx * 64 * rowstride + xIdx * 8 * context->bits_per_pixel;
tileWidth = (xIdx < numTilesX - 1) ? 64 : width - xIdx * 64;
tileHeight = (yIdx < numTilesY - 1) ? 64 : height - yIdx * 64;
if (context->priv->UseThreads)
{
i = yIdx * numTilesX + xIdx;
params[i].context = context;
params[i].s = StreamPool_Take(context->priv->EncoderStreamPool, 0);
params[i].tile_data = tileData;
params[i].tile_width = tileWidth;
params[i].tile_height = tileHeight;
params[i].rowstride = rowstride;
params[i].quantVals = (UINT32*)quantVals;
params[i].quantIdxY = quantIdxY;
params[i].quantIdxCb = quantIdxCb;
params[i].quantIdxCr = quantIdxCr;
params[i].xIdx = xIdx;
params[i].yIdx = yIdx;
work_objects[i] = CreateThreadpoolWork((PTP_WORK_CALLBACK) rfx_compose_message_tile_work_callback,
(void*) &params[i], &context->priv->ThreadPoolEnv);
SubmitThreadpoolWork(work_objects[i]);
}
else
{
rfx_compose_message_tile(context, s, tileData, tileWidth, tileHeight,
rowstride, quantVals, quantIdxY, quantIdxCb, quantIdxCr, xIdx, yIdx);
}
}
}
if (context->priv->UseThreads)
{
for (i = 0; i < numTiles; i++)
{
WaitForThreadpoolWorkCallbacks(work_objects[i], FALSE);
CloseThreadpoolWork(work_objects[i]);
Stream_Write(s, Stream_Buffer(params[i].s), Stream_GetPosition(params[i].s));
StreamPool_Return(context->priv->EncoderStreamPool, params[i].s);
}
free(work_objects);
free(params);
}
tilesDataSize = Stream_GetPosition(s) - end_pos;
size += tilesDataSize;
end_pos = Stream_GetPosition(s);

View File

@ -40,7 +40,6 @@
struct _RFX_CONTEXT_PRIV
{
wQueue* TilePool;
wQueue* TileQueue;
BOOL UseThreads;
DWORD MinThreadCount;
@ -50,6 +49,7 @@ struct _RFX_CONTEXT_PRIV
TP_CALLBACK_ENVIRON ThreadPoolEnv;
wBufferPool* BufferPool;
wStreamPool* EncoderStreamPool;
/* profilers */
PROFILER_DEFINE(prof_rfx_decode_rgb);

View File

@ -135,6 +135,9 @@ int freerdp_addin_replace_argument_value(ADDIN_ARGV* args, char* previous, char*
void freerdp_device_collection_add(rdpSettings* settings, RDPDR_DEVICE* device)
{
if (!settings->DeviceArray)
return;
if (settings->DeviceArraySize < (settings->DeviceCount + 1))
{
settings->DeviceArraySize *= 2;
@ -204,6 +207,9 @@ void freerdp_device_collection_free(rdpSettings* settings)
void freerdp_static_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel)
{
if (!settings->StaticChannelArray)
return;
if (settings->StaticChannelArraySize < (settings->StaticChannelCount + 1))
{
settings->StaticChannelArraySize *= 2;
@ -252,6 +258,9 @@ void freerdp_static_channel_collection_free(rdpSettings* settings)
void freerdp_dynamic_channel_collection_add(rdpSettings* settings, ADDIN_ARGV* channel)
{
if (!settings->DynamicChannelArray)
return;
if (settings->DynamicChannelArraySize < (settings->DynamicChannelCount + 1))
{
settings->DynamicChannelArraySize *= 2;

View File

@ -136,7 +136,7 @@ set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
set_complex_link_libraries(VARIABLE ${MODULE_PREFIX}_LIBS
MONOLITHIC ${MONOLITHIC_BUILD}
MODULE winpr
MODULES winpr-registry winpr-utils winpr-interlocked winpr-dsparse winpr-sspi winpr-rpc winpr-crt)
MODULES winpr-registry winpr-utils winpr-interlocked winpr-dsparse winpr-sspi winpr-rpc winpr-crt winpr-error)
if(MONOLITHIC_BUILD)
set(FREERDP_LIBS ${FREERDP_LIBS} ${${MODULE_PREFIX}_LIBS} PARENT_SCOPE)

View File

@ -3341,12 +3341,12 @@ BOOL rdp_recv_get_active_header(rdpRdp* rdp, wStream* s, UINT16* pChannelId)
if (rdp->settings->DisableEncryption)
{
if (!rdp_read_security_header(s, &securityFlags))
if (!rdp_read_security_header(s, &securityFlags, &length))
return FALSE;
if (securityFlags & SEC_ENCRYPT)
{
if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
if (!rdp_decrypt(rdp, s, length, securityFlags))
{
fprintf(stderr, "rdp_decrypt failed\n");
return FALSE;

View File

@ -327,10 +327,10 @@ static BOOL certificate_process_server_public_key(rdpCertificate* certificate, w
UINT32 keylen;
UINT32 bitlen;
UINT32 datalen;
UINT32 modlen;
if (Stream_GetRemainingLength(s) < 20)
return FALSE;
Stream_Read(s, magic, 4);
if (memcmp(magic, "RSA1", 4) != 0)
@ -343,12 +343,16 @@ static BOOL certificate_process_server_public_key(rdpCertificate* certificate, w
Stream_Read_UINT32(s, bitlen);
Stream_Read_UINT32(s, datalen);
Stream_Read(s, certificate->cert_info.exponent, 4);
modlen = keylen - 8;
if (Stream_GetRemainingLength(s) < modlen + 8) // count padding
if ((keylen <= 8) || (Stream_GetRemainingLength(s) < keylen))
return FALSE;
certificate->cert_info.ModulusLength = modlen;
certificate->cert_info.ModulusLength = keylen - 8;
certificate->cert_info.Modulus = malloc(certificate->cert_info.ModulusLength);
if (!certificate->cert_info.Modulus)
return FALSE;
Stream_Read(s, certificate->cert_info.Modulus, certificate->cert_info.ModulusLength);
/* 8 bytes of zero padding */
Stream_Seek(s, 8);
@ -500,7 +504,7 @@ BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate
BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, wStream* s)
{
int i;
UINT32 i;
UINT32 certLength;
UINT32 numCertBlobs;
BOOL ret;
@ -513,7 +517,7 @@ BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate,
certificate->x509_cert_chain = certificate_new_x509_certificate_chain(numCertBlobs);
for (i = 0; i < (int) numCertBlobs; i++)
for (i = 0; i < numCertBlobs; i++)
{
if (Stream_GetRemainingLength(s) < 4)
return FALSE;
@ -562,7 +566,7 @@ BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate,
* @param length certificate length
*/
int certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length)
int certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, size_t length)
{
wStream* s;
UINT32 dwVersion;

View File

@ -50,7 +50,7 @@ void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_chain);
BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate, wStream* s);
BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, wStream* s);
int certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length);
int certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, size_t length);
rdpCertificate* certificate_new(void);
void certificate_free(rdpCertificate* certificate);

View File

@ -77,14 +77,13 @@ BOOL rdp_client_connect(rdpRdp* rdp)
if (settings->GatewayEnabled)
{
char* user;
char* user = NULL;
char* domain;
char* cookie;
int user_length = 0;
int domain_length;
int cookie_length;
if (settings->Username)
{
user = settings->Username;
@ -194,24 +193,38 @@ BOOL rdp_client_redirect(rdpRdp* rdp)
rdp_client_disconnect(rdp);
/* FIXME: this is a subset of rdp_free */
/* --> this should really go into rdp.c */
crypto_rc4_free(rdp->rc4_decrypt_key);
rdp->rc4_decrypt_key = NULL ;
crypto_rc4_free(rdp->rc4_encrypt_key);
rdp->rc4_encrypt_key = NULL;
crypto_des3_free(rdp->fips_encrypt);
rdp->fips_encrypt = NULL ;
crypto_des3_free(rdp->fips_decrypt);
rdp->fips_decrypt = NULL ;
crypto_hmac_free(rdp->fips_hmac);
rdp->fips_hmac = NULL ;
free(settings->ServerRandom);
settings->ServerRandom = NULL ;
free(settings->ServerCertificate);
settings->ServerCertificate = NULL ;
free(settings->ClientAddress);
settings->ClientAddress = NULL ;
mppc_enc_free(rdp->mppc_enc);
mppc_dec_free(rdp->mppc_dec);
mcs_free(rdp->mcs);
nego_free(rdp->nego);
license_free(rdp->license);
transport_free(rdp->transport);
free(settings->ServerRandom);
free(settings->ServerCertificate);
free(settings->ClientAddress);
rdp->transport = transport_new(settings);
rdp->license = license_new(rdp);
rdp->nego = nego_new(rdp->transport);
rdp->mcs = mcs_new(rdp->transport);
rdp->mppc_dec = mppc_dec_new();
rdp->mppc_enc = mppc_enc_new(PROTO_RDP_50);
rdp->transport->layer = TRANSPORT_LAYER_TCP;
settings->RedirectedSessionId = redirection->sessionID;
@ -351,7 +364,7 @@ static BOOL rdp_server_establish_keys(rdpRdp* rdp, wStream* s)
return FALSE;
}
if (!rdp_read_security_header(s, &sec_flags))
if (!rdp_read_security_header(s, &sec_flags, NULL))
return FALSE;
if ((sec_flags & SEC_EXCHANGE_PKT) == 0)

View File

@ -254,7 +254,7 @@ static int fastpath_recv_update(rdpFastPath* fastpath, BYTE updateCode, UINT32 s
break;
case FASTPATH_UPDATETYPE_COLOR:
if (!update_read_pointer_color(s, &pointer->pointer_color))
if (!update_read_pointer_color(s, &pointer->pointer_color, 24))
return -1;
IFCALL(pointer->PointerColor, context, &pointer->pointer_color);
break;
@ -856,6 +856,8 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
comp_flags = FASTPATH_OUTPUT_COMPRESSION_USED;
header_bytes = 7 + sec_bytes;
bm = (BYTE*) (rdp->mppc_enc->outputBuffer - header_bytes);
if (comp_update)
Stream_Free(comp_update, FALSE);
comp_update = Stream_New(bm, pdu_data_bytes + header_bytes);
ls = comp_update;
}
@ -902,6 +904,8 @@ BOOL fastpath_send_update_pdu(rdpFastPath* fastpath, BYTE updateCode, wStream* s
Stream_Write_UINT16(ls, pdu_data_bytes);
if (update)
Stream_Free(update, FALSE);
update = Stream_New(bm, pduLength);
Stream_Seek(update, pduLength);

View File

@ -92,7 +92,8 @@ enum FASTPATH_INPUT_EVENT_CODE
enum FASTPATH_INPUT_KBDFLAGS
{
FASTPATH_INPUT_KBDFLAGS_RELEASE = 0x01,
FASTPATH_INPUT_KBDFLAGS_EXTENDED = 0x02
FASTPATH_INPUT_KBDFLAGS_EXTENDED = 0x02,
FASTPATH_INPUT_KBDFLAGS_PREFIX_E1 = 0x04 /* for pause sequence */
};
struct rdp_fastpath

View File

@ -37,6 +37,7 @@
#include <freerdp/error.h>
#include <freerdp/event.h>
#include <freerdp/locale/keyboard.h>
#include <freerdp/version.h>
/* connectErrorCode is 'extern' in error.h. See comment there.*/

View File

@ -830,6 +830,7 @@ BOOL gcc_read_server_security_data(wStream* s, rdpSettings* settings)
if (Stream_GetRemainingLength(s) < 8)
return FALSE;
Stream_Read_UINT32(s, settings->EncryptionMethods); /* encryptionMethod */
Stream_Read_UINT32(s, settings->EncryptionLevel); /* encryptionLevel */
@ -844,43 +845,50 @@ BOOL gcc_read_server_security_data(wStream* s, rdpSettings* settings)
if (Stream_GetRemainingLength(s) < 8)
return FALSE;
Stream_Read_UINT32(s, settings->ServerRandomLength); /* serverRandomLen */
Stream_Read_UINT32(s, settings->ServerCertificateLength); /* serverCertLen */
if (Stream_GetRemainingLength(s) < settings->ServerRandomLength + settings->ServerCertificateLength)
if (settings->ServerRandomLength == 0 || settings->ServerCertificateLength == 0)
return FALSE;
if (Stream_GetRemainingLength(s) < settings->ServerRandomLength)
return FALSE;
if (settings->ServerRandomLength > 0)
{
/* serverRandom */
settings->ServerRandom = (BYTE*) malloc(settings->ServerRandomLength);
Stream_Read(s, settings->ServerRandom, settings->ServerRandomLength);
}
else
{
if (!settings->ServerRandom)
return FALSE;
}
Stream_Read(s, settings->ServerRandom, settings->ServerRandomLength);
if (settings->ServerCertificateLength > 0)
{
/* serverCertificate */
if(Stream_GetRemainingLength(s) < settings->ServerCertificateLength)
goto out_fail1;
settings->ServerCertificate = (BYTE*) malloc(settings->ServerCertificateLength);
Stream_Read(s, settings->ServerCertificate, settings->ServerCertificateLength);
if (!settings->ServerCertificate)
goto out_fail1;
Stream_Read(s, settings->ServerCertificate, settings->ServerCertificateLength);
certificate_free(settings->RdpServerCertificate);
settings->RdpServerCertificate = certificate_new();
if (!settings->RdpServerCertificate)
goto out_fail2;
data = settings->ServerCertificate;
length = settings->ServerCertificateLength;
if (certificate_read_server_certificate(settings->RdpServerCertificate, data, length) < 1)
return FALSE;
}
else
{
return FALSE;
}
goto out_fail2;
return TRUE;
out_fail2:
free(settings->ServerCertificate);
settings->ServerCertificate = NULL;
out_fail1:
free(settings->ServerRandom);
settings->ServerRandom = NULL;
return FALSE;
}
static const BYTE initial_signature[] =

View File

@ -355,7 +355,7 @@ void rdp_write_info_packet(wStream* s, rdpSettings* settings)
flags |= INFO_REMOTECONSOLEAUDIO;
if (settings->CompressionEnabled)
flags |= INFO_COMPRESSION | INFO_PACKET_COMPR_TYPE_RDP6;
flags |= INFO_COMPRESSION | INFO_PACKET_COMPR_TYPE_64K;
if (settings->Domain)
{
@ -441,7 +441,7 @@ BOOL rdp_recv_client_info(rdpRdp* rdp, wStream* s)
if (!rdp_read_header(rdp, s, &length, &channelId))
return FALSE;
if (!rdp_read_security_header(s, &securityFlags))
if (!rdp_read_security_header(s, &securityFlags, &length))
return FALSE;
if ((securityFlags & SEC_INFO_PKT) == 0)
@ -457,7 +457,7 @@ BOOL rdp_recv_client_info(rdpRdp* rdp, wStream* s)
if (securityFlags & SEC_ENCRYPT)
{
if (!rdp_decrypt(rdp, s, length - 4, securityFlags))
if (!rdp_decrypt(rdp, s, length, securityFlags))
{
fprintf(stderr, "rdp_decrypt failed\n");
return FALSE;

View File

@ -166,6 +166,27 @@ void input_send_focus_in_event(rdpInput* input, UINT16 toggleStates, UINT16 x, U
input_send_extended_mouse_event(input, PTR_FLAGS_MOVE, x, y);
}
static void input_send_keyboard_pause_event(rdpInput* input)
{
/* In ancient days, pause-down without control sent E1 1D 45 E1 9D C5,
* and pause-up sent nothing. However, reverse engineering mstsc shows
* it sending the following sequence:
*/
/* Control down (0x1D) */
input_send_keyboard_event(input, 0,
RDP_SCANCODE_CODE(RDP_SCANCODE_LCONTROL));
/* Numlock down (0x45) */
input_send_keyboard_event(input, 0,
RDP_SCANCODE_CODE(RDP_SCANCODE_NUMLOCK));
/* Control up (0x1D) */
input_send_keyboard_event(input, KBD_FLAGS_RELEASE,
RDP_SCANCODE_CODE(RDP_SCANCODE_LCONTROL));
/* Numlock up (0x45) */
input_send_keyboard_event(input, KBD_FLAGS_RELEASE,
RDP_SCANCODE_CODE(RDP_SCANCODE_NUMLOCK));
}
void input_send_fastpath_synchronize_event(rdpInput* input, UINT32 flags)
{
wStream* s;
@ -250,6 +271,39 @@ void input_send_fastpath_focus_in_event(rdpInput* input, UINT16 toggleStates, UI
fastpath_send_multiple_input_pdu(rdp->fastpath, s, 4);
}
static void input_send_fastpath_keyboard_pause_event(rdpInput* input)
{
/* In ancient days, pause-down without control sent E1 1D 45 E1 9D C5,
* and pause-up sent nothing. However, reverse engineering mstsc shows
* it sending the following sequence:
*/
wStream* s;
rdpRdp* rdp = input->context->rdp;
const BYTE keyDownEvent = FASTPATH_INPUT_EVENT_SCANCODE << 5;
const BYTE keyUpEvent = (FASTPATH_INPUT_EVENT_SCANCODE << 5)
| FASTPATH_INPUT_KBDFLAGS_RELEASE;
s = fastpath_input_pdu_init_header(rdp->fastpath);
/* Control down (0x1D) */
Stream_Write_UINT8(s, keyDownEvent | FASTPATH_INPUT_KBDFLAGS_PREFIX_E1);
Stream_Write_UINT8(s, RDP_SCANCODE_CODE(RDP_SCANCODE_LCONTROL));
/* Numlock down (0x45) */
Stream_Write_UINT8(s, keyDownEvent);
Stream_Write_UINT8(s, RDP_SCANCODE_CODE(RDP_SCANCODE_NUMLOCK));
/* Control up (0x1D) */
Stream_Write_UINT8(s, keyUpEvent | FASTPATH_INPUT_KBDFLAGS_PREFIX_E1);
Stream_Write_UINT8(s, RDP_SCANCODE_CODE(RDP_SCANCODE_LCONTROL));
/* Numlock down (0x45) */
Stream_Write_UINT8(s, keyUpEvent);
Stream_Write_UINT8(s, RDP_SCANCODE_CODE(RDP_SCANCODE_NUMLOCK));
fastpath_send_multiple_input_pdu(rdp->fastpath, s, 4);
}
static BOOL input_recv_sync_event(rdpInput* input, wStream* s)
{
UINT32 toggleFlags;
@ -420,6 +474,7 @@ void input_register_client_callbacks(rdpInput* input)
{
input->SynchronizeEvent = input_send_fastpath_synchronize_event;
input->KeyboardEvent = input_send_fastpath_keyboard_event;
input->KeyboardPauseEvent = input_send_fastpath_keyboard_pause_event;
input->UnicodeKeyboardEvent = input_send_fastpath_unicode_keyboard_event;
input->MouseEvent = input_send_fastpath_mouse_event;
input->ExtendedMouseEvent = input_send_fastpath_extended_mouse_event;
@ -429,6 +484,7 @@ void input_register_client_callbacks(rdpInput* input)
{
input->SynchronizeEvent = input_send_synchronize_event;
input->KeyboardEvent = input_send_keyboard_event;
input->KeyboardPauseEvent = input_send_keyboard_pause_event;
input->UnicodeKeyboardEvent = input_send_unicode_keyboard_event;
input->MouseEvent = input_send_mouse_event;
input->ExtendedMouseEvent = input_send_extended_mouse_event;
@ -481,6 +537,11 @@ void freerdp_input_send_focus_in_event(rdpInput* input, UINT16 toggleStates, UIN
IFCALL(input->FocusInEvent, input, toggleStates, x, y);
}
void freerdp_input_send_keyboard_pause_event(rdpInput* input)
{
IFCALL(input->KeyboardPauseEvent, input);
}
int input_process_events(rdpInput* input)
{
return input_message_queue_process_pending_messages(input);

View File

@ -28,8 +28,8 @@
#include "license.h"
//#define LICENSE_NULL_CLIENT_RANDOM 1
#define LICENSE_NULL_PREMASTER_SECRET 1
/* #define LICENSE_NULL_CLIENT_RANDOM 1 */
/* #define LICENSE_NULL_PREMASTER_SECRET 1 */
#ifdef WITH_DEBUG_LICENSE
@ -195,7 +195,7 @@ BOOL license_send(rdpLicense* license, wStream* s, BYTE type)
* Using EXTENDED_ERROR_MSG_SUPPORTED here would cause mstsc to crash when
* running in server mode! This flag seems to be incorrectly documented.
*/
flags = PREAMBLE_VERSION_3_0;
flags = PREAMBLE_VERSION_3_0 | EXTENDED_ERROR_MSG_SUPPORTED;
rdp_write_header(license->rdp, s, length, MCS_GLOBAL_CHANNEL_ID);
rdp_write_security_header(s, sec_flags);
@ -240,12 +240,12 @@ BOOL license_recv(rdpLicense* license, wStream* s)
return FALSE;
}
if (!rdp_read_security_header(s, &securityFlags))
if (!rdp_read_security_header(s, &securityFlags, &length))
return FALSE;
if (securityFlags & SEC_ENCRYPT)
{
if (!rdp_decrypt(license->rdp, s, length - 4, securityFlags))
if (!rdp_decrypt(license->rdp, s, length, securityFlags))
{
fprintf(stderr, "rdp_decrypt failed\n");
return FALSE;
@ -409,7 +409,7 @@ void license_get_server_rsa_public_key(rdpLicense* license)
license->ModulusLength = ModulusLength;
license->Modulus = (BYTE*) malloc(ModulusLength);
ZeroMemory(license->Modulus, ModulusLength);
memcpy(license->Modulus, Modulus, ModulusLength);
}
void license_encrypt_premaster_secret(rdpLicense* license)
@ -430,14 +430,15 @@ void license_encrypt_premaster_secret(rdpLicense* license)
EncryptedPremasterSecret = (BYTE*) malloc(license->ModulusLength);
ZeroMemory(EncryptedPremasterSecret, license->ModulusLength);
license->EncryptedPremasterSecret->type = BB_RANDOM_BLOB;
license->EncryptedPremasterSecret->length = PREMASTER_SECRET_LENGTH;
#ifndef LICENSE_NULL_PREMASTER_SECRET
license->EncryptedPremasterSecret->length =
crypto_rsa_public_encrypt(license->PremasterSecret, PREMASTER_SECRET_LENGTH,
license->ModulusLength, license->Modulus, license->Exponent, EncryptedPremasterSecret);
#endif
license->EncryptedPremasterSecret->type = BB_RANDOM_BLOB;
license->EncryptedPremasterSecret->length = PREMASTER_SECRET_LENGTH;
license->EncryptedPremasterSecret->data = EncryptedPremasterSecret;
}
@ -473,25 +474,41 @@ BOOL license_read_product_info(wStream* s, PRODUCT_INFO* productInfo)
Stream_Read_UINT32(s, productInfo->cbCompanyName); /* cbCompanyName (4 bytes) */
if (Stream_GetRemainingLength(s) < productInfo->cbCompanyName + 4)
/* Name must be > 0, but there is no upper limit defined, use UINT32_MAX */
if ((productInfo->cbCompanyName < 2) || (productInfo->cbCompanyName % 2 != 0))
return FALSE;
if (Stream_GetRemainingLength(s) < productInfo->cbCompanyName)
return FALSE;
productInfo->pbCompanyName = (BYTE*) malloc(productInfo->cbCompanyName);
if (!productInfo->pbCompanyName)
return FALSE;
Stream_Read(s, productInfo->pbCompanyName, productInfo->cbCompanyName);
if (Stream_GetRemainingLength(s) < 4)
goto out_fail;
Stream_Read_UINT32(s, productInfo->cbProductId); /* cbProductId (4 bytes) */
if ((productInfo->cbProductId < 2) || (productInfo->cbProductId % 2 != 0))
goto out_fail;
if (Stream_GetRemainingLength(s) < productInfo->cbProductId)
{
goto out_fail;
productInfo->pbProductId = (BYTE*) malloc(productInfo->cbProductId);
if (!productInfo->pbProductId)
goto out_fail;
Stream_Read(s, productInfo->pbProductId, productInfo->cbProductId);
return TRUE;
out_fail:
free(productInfo->pbCompanyName);
productInfo->pbCompanyName = NULL;
return FALSE;
}
productInfo->pbProductId = (BYTE*) malloc(productInfo->cbProductId);
Stream_Read(s, productInfo->pbProductId, productInfo->cbProductId);
return TRUE;
}
/**
@ -795,7 +812,10 @@ BOOL license_read_platform_challenge_packet(rdpLicense* license, wStream* s)
/* EncryptedPlatformChallenge */
license->EncryptedPlatformChallenge->type = BB_ANY_BLOB;
license_read_binary_blob(s, license->EncryptedPlatformChallenge);
if (!license_read_binary_blob(s, license->EncryptedPlatformChallenge))
return FALSE;
license->EncryptedPlatformChallenge->type = BB_ENCRYPTED_DATA_BLOB;
if (Stream_GetRemainingLength(s) < 16)
@ -1044,11 +1064,11 @@ void license_send_platform_challenge_response_packet(rdpLicense* license)
fprintf(stderr, "\n");
fprintf(stderr, "HardwareId:\n");
winpr_HexDump(license->HardwareId, 20);
winpr_HexDump(license->HardwareId, HWID_LENGTH);
fprintf(stderr, "\n");
fprintf(stderr, "EncryptedHardwareId:\n");
winpr_HexDump(license->EncryptedHardwareId->data, 20);
winpr_HexDump(license->EncryptedHardwareId->data, HWID_LENGTH);
fprintf(stderr, "\n");
#endif

Some files were not shown because too many files have changed in this diff Show More