Commit Graph

2809 Commits

Author SHA1 Message Date
akallabeth
3b5347e229 [channel,dvc] unify and log DVC callbacks
* Added a check function that logs errors if the required callbacks are
  not set.
* Encapsulate calling in (static) helper functions
2022-12-15 14:57:29 +01:00
akallabeth
1f16250a7b [channels,rdpsnd] prevend multiple OnOpen calls
due to the nature of the sound channel there are multiple listeners
waiting for the server to open the channel and most of them are called
by the server. Only open the channel once.
2022-12-15 14:57:29 +01:00
akallabeth
a2329281a4 [channels,rdpdr] fix possible surface leak
* Ensure DeleteSurface is called before CreateSurface: Under certain
  conditions it is possible that there already exists a surface with the
  same id as the new CreateSurface PDU. Delete the already existing
  instance in that case before creating a new one.
* Simplify surface cleanup on shutdown: Use HashTable_Foreach
2022-12-15 14:57:29 +01:00
Armin Novak
df4c076946 [channels,rdpdr] abort on invalid device request
If a request references a non existing device abort.
2022-12-15 14:57:29 +01:00
Armin Novak
186e97e0a8 [channels,rdpdr] better logging of device manager
if a device could not be found print a better log message
2022-12-15 14:57:29 +01:00
Armin Novak
231babef5e [channels,rdpdr] improve log message
try to stringify magic numbers in log message
2022-12-15 14:57:29 +01:00
akallabeth
4ab9fb4425 [channels,rdpsnd] Add PlayEx callback
This new callback is preferred over the older Play callback and provides
the AUDIO_FORMAT as additional argument.
2022-12-14 10:17:30 +01:00
akallabeth
8aa880c0ba [channels,rdpsnd] Callback on server format
When the server sends the format list to the client call a device
callback that provides the details to the audio backend.
2022-12-14 10:17:30 +01:00
akallabeth
babc47e19c [channels,rdpsnd] fix rdpsnd channel cleanup
The rdpsnd channel needs to keep the resources allocated until the last
user (static, dynamic channel) is terminated.
2022-12-13 10:57:34 +01:00
akallabeth
7ab917dca8 Fixed Wsign-compare warnings 2022-12-09 15:58:26 +01:00
akallabeth
7e1065a9b9 Fixed Wshadow warnings 2022-12-09 15:58:26 +01:00
akallabeth
aaae70ff05 Fixed missing const casts 2022-12-09 15:58:26 +01:00
Armin Novak
c3e42de5b5 [drdynvc] assert and proper cleanup 2022-12-09 13:23:00 +01:00
akallabeth
dfcd168af6 [channels,rdp2tcp] only reset event if signalled 2022-12-09 12:30:14 +01:00
Armin Novak
0f4be4befd [channels] fix addin queue free
Only clear messages with an ID of 0
2022-12-09 12:30:14 +01:00
Armin Novak
64c94e06f3 [channel,rdpsnd] fix queue cleanup
The argument is of type wMessage* and we only care for messages with an
ID of 0
2022-12-09 12:30:14 +01:00
Armin Novak
b25234da66 [channels] Abort event wain on abortEvent 2022-12-09 12:30:14 +01:00
Armin Novak
ec68b1f2a5 [channels,rdpdr] fix computer name sending
The name should be '\0' terminated.
2022-12-08 13:29:46 +01:00
Armin Novak
25b00bc483 [channel,urbdrc] fix type of usb hotplug callback
The libusb_hotplug_callback_fn uses LIBUSB_CALL call type
2022-12-07 11:32:59 +01:00
Armin Novak
1422136e81 [channel,cliprdr] append '\0' to format names 2022-12-03 10:53:18 +01:00
Armin Novak
cfe09892be [channel,cliprdr] log debug information
Log cliprdr debug information without compile flags
2022-12-03 10:53:18 +01:00
Armin Novak
e1eacad74c [scard] fixed memory leak
card_id_and_name_* return allocated values, free after use
2022-12-02 15:08:09 +01:00
Armin Novak
a57c480b29 [channel,rdpdr] proper queue cleanup for rdpdr 2022-12-02 15:08:09 +01:00
Armin Novak
bc3904ec65 [channel,smartcard] Fix message cleanup on shutdown 2022-12-02 15:08:09 +01:00
akallabeth
5799fb2018 Replace ConvertFromUnicode and ConvertToUnicode
* Use new ConvertUtf8ToWChar, ConvertUtf8NToWChar,
  ConvertUtf8ToWCharAlloc and ConvertUtf8NToWCharAlloc
* Use new ConvertWCharToUtf8, ConvertWCharNToUtf8,
  ConvertWCharToUtf8Alloc and ConvertWCharNToUtf8Alloc
* Use new Stream UTF16 to/from UTF8 read/write functions
* Use new settings UTF16 to/from UTF8 read/write functions
2022-11-28 10:42:36 +01:00
akallabeth
a6593f2dc1 [rdpdr] fixed server side channel parsing 2022-11-22 15:30:31 +01:00
akallabeth
febc4b3073 [gdi,gfx] Fixed possible memory leaks
* WINPR_ASSERT all callbacks required to be set
* Unify cache slot creation/destruction
* Destroy cache slot before setting it
2022-11-22 15:30:31 +01:00
akallabeth
7c224c2427 [drdynvc] fix cleanup in case of no thread
If drdynvc is used without an own thread the dynamic channels were not
properly cleaned up on disconnect.
2022-11-22 15:30:31 +01:00
Armin Novak
7c5652c15a Fixed -Wmissing-prototypes 2022-11-21 10:12:31 +01:00
Armin Novak
476bed5731 Fixed -Wconditional-uninitialized 2022-11-21 10:12:31 +01:00
Armin Novak
6ea2e99d51 Fixed -Wunreachable-code-break 2022-11-21 10:12:31 +01:00
Armin Novak
921315fdbf Fixed -Wmissing-variable-declarations 2022-11-21 10:12:31 +01:00
Armin Novak
dacebc62a3 Use Stream_CheckAndLogRequiredLength, fix WLog TAG
* Log stream length requirement violations
* Use proper defines for WLog tags
2022-11-21 09:57:27 +01:00
David PHAM-VAN
f2e14d68eb Replace backslashes with underscores in printer names 2022-11-21 08:04:10 +01:00
akallabeth
0f60ac5988 Fixed path validation in drive channel
Check that canonical path is a subpath of the shared directory
2022-11-14 09:28:22 +01:00
akallabeth
96aef5f1af Fixed missing stream length check in drive_file_query_directory 2022-11-14 09:28:22 +01:00
akallabeth
d9e687d7e1 Added missing length check in urb_control_transfer 2022-11-14 09:28:22 +01:00
akallabeth
b366ff19a5 Fixed missing input buffer length check in urbdrc 2022-11-14 09:28:22 +01:00
akallabeth
49bd22aea7 Ensure urb_create_iocompletion uses size_t for calculation 2022-11-14 09:28:22 +01:00
akallabeth
b54ca508ac Fixed division by zero in urbdrc 2022-11-14 09:28:22 +01:00
Armin Novak
60d2e525f5 [channel rdpdr] Clean up IRP on processing errors 2022-11-11 06:42:45 +01:00
Martin Fleisz
b5e8b419b8 drive: Fix an issue when redirecting drives on Windows
CreateFile/GetFileInformationByHandle will fail if used with just a
drive letter i.e. C:/.

This PR fixes that case by using GetFileAttributesExW as a fallback in
case CreateFileW fails.
2022-11-03 15:02:27 +01:00
akallabeth
43c5289928 Replaced memset/ZeroMemory with initializer
* Addes WINPR_ASSERT on many occations
* Replaced memset with array initializer
* Replaced ZeroMemory with array initializer
2022-10-14 12:11:01 +02:00
akallabeth
6a2626498b Disable channel builds if -DWITH_CHANNEL=OFF 2022-10-13 14:38:06 +02:00
Armin Novak
2acf21b592 Improved error checks in server side rdpdr 2022-10-13 13:57:11 +02:00
akallabeth
080e44fc96 Fixed extra-semi-stmt warnings 2022-10-11 13:28:30 +02:00
akallabeth
9d197b263c Fixed conditional-uninitialized warnings 2022-10-11 13:28:30 +02:00
akallabeth
26ac2f0b27
Additional checks (#8279)
* Fix length checks in parallel driver

The length requested was not checked against the length read from
the port.

* Fixed missing length check in video channel

Data received in video redirection channel was not checked for
proper length.

* Fixed video presentation reference counter

Video channel presentation reference counter was not updated with
Video_Frame_new. A failing H264 decoding step could trigger a reference
decrement and the presentation was freed by accident.
Also clean up the increment and decrement of presentation

* Fixed tsmf ffmpeg context extra data size checks

tsmf_ffmpeg_init_stream did not abort if the video format ExtraDataSize
was not sufficiently large to satisfy expectations.

* Fixed missing input data length check

tsmf_ifman_exchange_capability_request did not check if the input
data stream actually contained the amount of bytes requested to
copy.

* Fixed TSMF tsmf_ffmpeg_set_format length checks

ExtraDataSize of format was not checked for expected minimum length

* Fixed TSMF tsmf_read_format_type length checks

ExtraDataSize of format was not checked for expected minimum
length

* Fixed TSMF tsmf_gstreamer_set_format length checks

ExtraDataSize of format was not checked for expected minimum
length
2022-10-06 15:30:54 +02:00
akallabeth
1849632c43
Fixed format strings to match arguments (#8254)
* Fixed format strings to match arguments

Reviewed and replaced all %d specifiers to match proper type

* Added proxy dynamic channel command type to log messages.
2022-09-29 14:55:27 +02:00
akallabeth
d2ab631c40
Test uri fix (#8232)
* Fixed TestUri unit test

* Make proper unit test out of the test function
* Add proper test cases

* Replace FindFirstFileA with FindFirstFileW for addins

This allows addin paths to contain unicode symbols.

* Fixed parse_uri_to_local_file definition

* Move to common clipboard.c file
* Move to header file so it can be included in test case

* Added WINPR_LOCAL for test builds

This macro exports internal functions in case of a unit test build
This way unit tests can access these without other workarounds.

* Fixed typo in function name is_dos_driver

* Cleaned up FindFirstFileW call

Use a wrapper function to convert to unicode and call the function

* Cleaned up BUILD_TESTING and EXPORT_ALL_SYMBOLS

* EXPORT_ALL_SYMBOLS now does as the name implies and exports all
  non static functions/variables from the library.
* BUILD_TESTING now only sets the defines for test code and
  activates EXPORT_ALL_SYMBOLS to allow tests to access internal
  code

* Fixed windows client warnings

* disable CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
2022-09-26 11:22:02 +02:00
Armin Novak
eaaeb62f05 Fixed -Wcomma warning 2022-09-20 15:52:14 +02:00
Simon Nivault
82b58325a3 Add switch to declare printer as default or not 2022-09-20 13:25:05 +02:00
Simon Nivault
8d97215881 Enable auto default printer detection only for enum printer 2022-09-20 13:25:05 +02:00
Armin Novak
320bda4a05 Fixed #8084: rdpei thread alive condition was FALSE 2022-09-13 09:16:55 +02:00
Armin Novak
6a1d44bb67 Added support for audin version 2 2022-09-12 10:03:31 +02:00
garbb
9a4a77b9a3 Update remdesk_main.c 2022-09-12 08:37:33 +02:00
garbb
64aa7e2635 Update remdesk_main.c 2022-09-12 08:37:33 +02:00
garbb
df51e69a6a Update remdesk_main.c 2022-09-12 08:37:33 +02:00
garbb
77372a24f3 handle remote assistance connection request denied 2022-09-12 08:37:33 +02:00
Simon Nivault
06827774b6
Manage default printer for the win backend (#8177)
* printer_win: Retrieve default printer name

* printer_win: Declare the local default printer as default

* printer_cups: Retrieve default printer name

* printer_cups: Declare the local default printer as default
2022-09-09 09:13:37 +02:00
David Fort
103f13575c
drdynvc: code cleanup of the client dynamic channel (#8148)
This patch does various cleanups in the client dynamic channel. The main
goal of the cleanup was to add the sending of Close messages to the server
when a channel is locally closed. The refcounter is there to ensures that
the DVC_CHANNEL is not freed while some pieces of code are still holding a
reference on it.

I did some tests by using a custom server-side echo channel at
https://github.com/hardening/echoChannel, it allows to send a given amount of
packets and then close (to test server-side initiated closes). It compiles
with mingw (so under linux) and so it can be easily deployed (no deps).
2022-08-25 08:47:00 +02:00
David Fort
1f08cb9a7d
Drdynvc needs love (#8059)
* winpr: add lock operation on HashTables

* drdynvc: change the listeners array for a hashtable and other micro cleanups

* logonInfo: drop warning that is shown at every connection

Let's avoid this log, we can't do anything if at Microsoft they don't respect
their own specs.

* rdpei: fix terminate of rdpei

* drdynvc: implement the channel list with a hashtable by channelId
2022-07-26 12:53:41 +02:00
Martin Fleisz
152c96032d channel/printer: Fix return type for localtime_s on Windows 2022-07-21 15:59:43 +02:00
David Fort
3478051f15 dynamic channels: mutualize things for listeners and plugins
The same code is copied in all dynamic channels to create a plugin, have a listener,
and manage the channel lifecycle. This patch does a mutualization effort so that channels
only have to code things that are specific to them.
2022-07-07 12:21:23 +00:00
David Fort
ffcb25a925 echo channel: use generic types for the echo channel
I missed this channel when doing the refactoring.
2022-07-07 12:21:23 +00:00
Armin Novak
42caca9223 Do not automatically set GfxSmallCache 2022-07-06 13:09:46 +00:00
Armin Novak
3bedc1f92e Fixed swscale and cairo checks 2022-07-06 13:09:46 +00:00
akallabeth
c71cc672f9 Decouple ffmpeg video encoder/decoder support from WITH_FFMPEG
It may be diesirable to only use FFMPEG for audio. Allow disabling
video decoding by introducing a new variable responsible for that.
2022-07-05 18:17:28 +02:00
akallabeth
7b02aba636 Removed ALAW/ULAW from alsa/oss/pulse backends
The codec does not work reliably with some hardware.
2022-07-05 14:20:19 +02:00
akallabeth
c3e8720c87 Removed ALAW/ULAW from supported backend formats
pulse/alsa/oss do not reliably work with ALAW/ULAW codecs with all
hardware available.
Since these formats are poor quality anyway, deactivate them for
audin channel.
2022-07-05 14:20:19 +02:00
akallabeth
2da280b8a1 Fixed compilation warnings 2022-07-04 14:59:21 +02:00
akallabeth
9a2a37786e Refactored clipboard structs 2022-07-04 14:31:08 +02:00
akallabeth
33a23d5637 Added debug logs 2022-07-04 08:20:33 +02:00
akallabeth
3f301ee6d5 Fixed copyright headers and stream length 2022-06-30 13:42:19 +02:00
akallabeth
90bb236dee Fixed stream advance before length checks 2022-06-30 12:28:22 +02:00
akallabeth
71cf5a8fa1 Reordered stream advance and length check, always add header byte length 2022-06-30 12:28:22 +02:00
akallabeth
40d142a566 Merged camera-device.h with existing rdpecam.h 2022-06-30 12:28:22 +02:00
akallabeth
eb04fe628b Use C style struct init 2022-06-30 12:28:22 +02:00
akallabeth
4d3003b154 Renamed server channel to rdpei 2022-06-30 12:28:22 +02:00
akallabeth
cfd87ab3f1 Fix rdpecam server channel naming 2022-06-30 12:28:22 +02:00
akallabeth
1061c3087c Used C style struct init 2022-06-30 12:28:22 +02:00
Pascal Nowack
78fc60802c server: Add channel handling for camera device and enumerator channel 2022-06-30 12:28:22 +02:00
Pascal Nowack
5637aeed91 telemetry/server: Fix copyright in license comment 2022-06-30 12:28:22 +02:00
Pascal Nowack
11351978a0 channels/server: Fix channel name in license comments 2022-06-30 12:28:22 +02:00
akallabeth
cb96e6143d Fixed -Wshadow warnings 2022-06-30 10:49:02 +02:00
akallabeth
deee697066 Fixed uninitialized warnings in rdpdr 2022-06-29 18:10:33 +02:00
akallabeth
8ecf841e71 Added RAIL compartmentinfo server to client message 2022-06-29 14:42:05 +02:00
akallabeth
ea0035b474 Added new rail orders textscaleinfo and caretblinkrate 2022-06-29 11:41:45 +02:00
akallabeth
e956a0e155 Added rail_get_order_type_string_full for better debug logs 2022-06-29 09:14:40 +02:00
Armin Novak
81d14e1c87 Fixed rdpdr stream leaks 2022-06-27 14:27:12 +02:00
akallabeth
76661f6019 Use StreamPool in rdpdr 2022-06-27 11:21:24 +02:00
Armin Novak
ada4671435 Cleaned up client rdpgfx
* use rdpContext for setup
* add WINPR_ASSERT
* Removed duplicated rdpSettings variables
2022-06-27 11:06:27 +02:00
Armin Novak
a3ac4e9b01 Add option to run drdynvc [client] without extra thread 2022-06-27 11:06:27 +02:00
akallabeth
7bc276ba04 Added WINPR_ASSERT to printer client channel
Assure all function calls have valid arguments.
2022-06-24 13:20:28 +02:00
akallabeth
c698f7e7d9 Expose client rdpsnd get context function 2022-06-23 14:19:50 +02:00
akallabeth
f1d3d457fb Code cleanups/initializations 2022-06-23 14:19:50 +02:00
akallabeth
bc8b4ade1c reformatted 2022-06-23 08:48:39 +02:00
akallabeth
1626530825 Some cleanups in rdpgfx channel 2022-06-23 07:45:55 +02:00
akallabeth
e2acd03498 Fixed rdpdr resource cleanup 2022-06-23 07:45:55 +02:00
akallabeth
5b163b7918 Add GetRdpContext function pointer for dynamic channels 2022-06-23 07:45:55 +02:00
akallabeth
90ce22283d Replaced direct settings access with getter/setter 2022-06-23 07:45:55 +02:00
akallabeth
1d2261e884 Added WINPR_ASSERT 2022-06-23 07:45:55 +02:00
akallabeth
f25261e271 Unifiy string append functions 2022-06-17 08:41:46 +02:00
David Fort
e389210673 client channels: mutualize common types between dynamic channels
Most dynamic channels share the same copied and pasted code for the XXX_CHANNEL_CALLBACK
and XXX_LISTENER_CALLBACK types. This patch introduce GENERIC_CHANNEL_CALLBACK and
GENERIC_LISTENER_CALLBACK that fits for most channels and discard custom type definitions.
2022-06-15 14:04:58 +02:00
Marc-André Moreau
161617c4a4 Implement RDP persistent bitmap cache 2022-06-08 23:37:06 +02:00
Pascal Nowack
9d627e0df2 channels/server: Add APIs for DVCs to get notified of channel id
This allows server implementations to watch these channel ids for their
creation statuses.
2022-06-08 15:26:51 +02:00
Pascal Nowack
1f0b3c8004 audin/server: Do not overwrite values of the server audio formats
It just makes the usage of codecs impossible.
2022-06-08 15:26:51 +02:00
Pascal Nowack
dacc1e1c0f server: Add channel handling for telemetry channel 2022-06-08 09:30:30 +02:00
Pascal Nowack
3337810520 server/rdpsnd: Add API to get notified of channel id 2022-06-08 09:30:30 +02:00
akallabeth
35f575a753 Refactored rdpsnd server
* Assert all input arguments
* Unify stream buffer handling
2022-06-03 08:48:46 +02:00
Pascal Nowack
902727df5e rdpsnd: Enhance server implementation
The current server sided channel handling of RDPSND/AUDIO_PLAYBACK_DVC
is currently very constrained.
So, solve this. This means:

- Add the missing Training/Training Confirm PDUs
- Stop overriding the average bytes per second values, when submitting
  the audio formats, as this currently makes the usage of codecs
  impossible
- Add a way to send the server formats manually again, to be able to
  restart the protocol after a Close PDU was sent
- Add a way to send already encoded audio data to let server
  implementations to take care of the encoding process and to set
  custom audio timestamps for the Video Optimized Remoting channel
- Add public attributes to let server implementations know the initial
  volume and pitch values
- Add public attribute to let server implementations know the quality
  mode setting
2022-06-03 08:48:46 +02:00
Marc-André Moreau
135d508a78 * libfreerdp-channels: fix remdesk, encomsp channel event handling 2022-05-26 17:18:40 +02:00
akallabeth
46ccf6d0d7
Fixed RDPGFX_CAPVERSION_106 according to errata (#7924)
The [MS-RDPEGFX] spec is not really sure which value to use, so we
just announce both, the one from the spec and the one from errata.
2022-05-25 13:11:29 +02:00
akallabeth
dc6c54af49 Fixed missing WINAPI for callback function declarations 2022-05-25 10:31:21 +02:00
Armin Novak
387d4bd8fd Disable scaled output PDU if no scaling support compiled 2022-05-24 10:08:53 +02:00
Armin Novak
40f5578206 Add GFX 10.7 capsets 2022-05-24 10:08:53 +02:00
Pascal Nowack
7d18ca4dc2
rdpsnd/client: Fix handling of WaveConfirm PDUs (#7910)
Currently, all FreeRDP-based clients don't send any WaveConfirm PDUs
for received samples, when using a dynamic channel for audio output
redirection.
[MS-RDPEA] 2.2.3.8 Wave Confirm PDU mentions, that a WaveConfirm PDU
MUST be sent, when a WaveInfo PDU + Wave PDU, or Wave2 PDU is received
and when the audio data sample is emitted to completion by the client.
The first WaveConfirm PDU is used by the server to determine the
network latency and the second WaveConfirm PDU is used by the server to
determine the render latency.

So, fix the current behaviour, where FreeRDP currently does not send
any WaveConfirm PDU, when using the dynamic channel, or only sends one
WaveConfirm PDU for the sample.
For the first WaveConfirm PDU, use the same timestamp, that was
included in the first WaveInfo/Wave2 PDU.
For the second WaveConfirm PDU, add the render latency on top of the
arrival timestamp.
2022-05-18 08:47:54 +02:00
Felix Deimel
8cabdf6a04 Fixed memory leak in audin mac 2022-05-13 10:23:41 +02:00
Felix Deimel
b0772fe2f0 Fixed memory leaks in rdpsnd mac 2022-05-12 14:51:56 +02:00
David Fort
77413f49b2 winpr: rework alignment functions
_align_XXX functions aren't widely available depending on the C runtime. That causes
problems with mingw where we can easily have some runtime mixes (which lead to mysterious
segfaults most of the time). This patch introduce winpr_aligned_XXX functions that will
either use the function available, or use an emulation layer.
2022-05-12 11:36:01 +02:00
akallabeth
860f44f762 CMake check_include and struct cleanup
Move to WinPR what should be there.
2022-04-29 14:27:44 +02:00
akallabeth
1819c24808 Remember received sound volume and apply on open. 2022-04-28 18:56:17 +02:00
akallabeth
5521a73e90 Some rdpsnd debug improvements 2022-04-28 18:56:17 +02:00
akallabeth
962c5c3ef0 Fixed dead store warnings 2022-04-28 12:37:19 +02:00
akallabeth
6fd71fe737 Eliminate Dead nested assignment warnings 2022-04-28 12:37:19 +02:00
akallabeth
ec699f6c75 scanbuild fixes 2022-04-28 12:37:19 +02:00
akallabeth
1dcc5a180a Fixed warnings 2022-04-28 11:24:51 +02:00
akallabeth
cc3e28f2f1 Fixed -Wdocumentation errors 2022-04-28 11:24:51 +02:00
akallabeth
667b471686 Fixed cast-quality warnings 2022-04-28 09:17:20 +02:00
akallabeth
73cdcdfe09
Logging and parser fixes (#7796)
* Fixed remdesk settings pointer

* Fixed sign warnings in display_write_monitor_layout_pdu

* Use freerdp_abort_connect_context and freerdp_shall_disconnect_context

* Added and updates settings

* info assert/dynamic timezone

* mcs assert/log/flags

* Fixed and added assertions for wStream

* Unified stream length checks

* Added new function to check for lenght and log
* Replace all usages with this new function

* Cleaned up PER, added parser logging

* Cleaned up BER, added parser logging

* log messages

* Modified Stream_CheckAndLogRequiredLengthEx

* Allow custom format and options
* Add Stream_CheckAndLogRequiredLengthExVa for prepared va_list

* Improved Stream_CheckAndLogRequiredLength

* Now have log level adjustable
* Added function equivalents for existing logger
* Added a backtrace in case of a failure is detected

* Fixed public API input checks
2022-04-19 14:29:17 +02:00
akallabeth
1378c8e671
Fixed #7753: Step calculation in YUV decoder (#7758)
* Fixed #7753: Step calculation in YUV decoder

* Fixed rectangle_is_empty

* Added rectangle intersection check in YUV decoder

* Skip intersecting rectangles in YUV decoder

* Refactored YUV work object handling

* Allocate / free in yuv_context_new and yuv_context_free
* WINPR_ASSERT all function arguments

* Pass yuv_context_reset result from h264_context_reset

* Reset PTP_WORK buffer to NULL after use
2022-03-29 13:55:52 +02:00
akallabeth
610f4b6bac Fixed WINPR_UNUSED/WINPR_ASSERT mixup 2022-03-28 15:52:32 +02:00
akallabeth
1319c08bba Cleaned up use of rdpSettings in channels 2022-03-28 15:52:32 +02:00
Armin Novak
c6924cb126 Moved clipboard utils to core library, fixes #6760 2022-03-28 14:59:30 +02:00
Zhengyi Fu
75a6e17752 drive: fix number of links 2022-03-24 13:40:31 +01:00
Armin Novak
e5b50c550b Use GetComputerName instead of gethostname 2022-03-22 10:59:58 +01:00
Armin Novak
ce63397323 Move drdynvc main path messages to trace level
They are noisy and hide more important information from debug log
2022-03-08 16:15:18 +01:00
akallabeth
37421b6614
Unified rdpsnd cleanup code (#7697) 2022-03-04 09:55:37 +01:00
Armin Novak
46e0adda93 Removed HAVE_CONFIG_H uses 2022-03-03 11:26:48 +01:00
Armin Novak
4d03d7c0bf Freerdp remove #ifdef HAVE_CONFIG_H 2022-03-03 11:26:48 +01:00
Armin Novak
b2ad47a809 Reorganized FreeRDP headers 2022-03-03 11:26:48 +01:00
Armin Novak
a9463bfdda Fixed const warnings 2022-03-01 08:00:25 +01:00
Martin Fleisz
1371970783 disp: Remove wrong assert 2022-02-25 11:57:28 +01:00
Armin Novak
42468f3684 Removed pdb file on windows (BUILDIN_CHANNELS removed) 2022-02-24 14:48:46 +01:00
Armin Novak
94634bfd67 Fixed const warning 2022-02-24 12:06:06 +01:00
Martin Fleisz
8d49175a94 Revert "drdynvc: Prevent opening an already opened dynamic channel"
This reverts commit feda57a739.
2022-02-23 17:18:50 +01:00
Armin Novak
fd027d1bf0 Removed BUILTIN_CHANNELS
Building client channels out of tree does not work reliable as the
dependencies can not be easily split. (exceptions may be simple ones
as echo channel)
It does complicate the build system and code though, so remove this
for maintainability reasons.
2022-02-23 10:43:46 +01:00
Armin Novak
130094de32 Fixed compilation warnings in ainput channel 2022-02-22 12:21:21 +01:00
Armin Novak
951a83e295 Fixed deprecated mac symbol 2022-02-22 11:29:56 +01:00
Armin Novak
0c7e6c3c2d Refactored disp channel
* Assert all input parameters
* Use DISP_CHANNEL_NAME define for channel name
2022-02-22 11:29:56 +01:00
Pascal Nowack
b2d0c42cbb server/disp: Sanitize optional physical monitor size values
The server sided handling of the display control channel currently
treats the physical monitor size values as obligatory values.
When the physical monitor size is invalid according to the
documentation, it is supposed to be ignored.
However, this is currently not done, leading to an abort of the display
control channel handling, when using Remmina, as Remmina does not submit
physical-monitor- widths and -heights.

Fix this issue by sanitizing the physical monitor size values, instead
of handling them as obligatory values, where both the physical with and
the physical height must be constrained to the values in the
documentation.
2022-02-22 10:55:22 +01:00
akallabeth
c5f7f9fba8 Add option for external thread to ainput server channel 2022-02-22 09:44:13 +01:00
akallabeth
42abdb056f Use define for channel name 2022-02-22 09:44:13 +01:00
Armin Novak
f03059e718 Extended AINPUT API:
* Each event now has a timestamp
* Relative and absolute events are sent simultaneously
* Added a flag indicating relative events are available
2022-02-22 09:44:13 +01:00
akallabeth
54259bc37c Added event logging for ainput channel 2022-02-22 09:44:13 +01:00
akallabeth
f45e515fcd Added Advanced Input Channel 2022-02-22 09:44:13 +01:00
Armin Novak
bf9f1eccc1 Fixed issued with mingw build 2022-02-18 08:38:28 +01:00
akallabeth
8cc6582044
Unify struct definitions (#7633)
* Unified enum/struct definitions, fixed include issues

* Fixed mac compilation issues

* Added missing include

* Fixed windows server build warnings

* Fixed VS2010 build issue

* Removed unnecessary library linking

* Fixed ThreadPool WinXP compatibility

* Fixed pr review remarks
2022-02-14 14:59:22 +01:00
akallabeth
2422985f2a Fixed cliprdr_parse_file_list 2022-02-05 14:06:08 +00:00
Armin Novak
b9cfa10513 Fixed some more warnings 2022-01-31 15:55:10 +01:00
Felix Deimel
6bc3def9d1 Fixes https://github.com/FreeRDP/FreeRDP/issues/7408 2022-01-31 15:54:17 +01:00
akallabeth
db1ee0cae6 Update nAvgBytesPerSec in audin_winmm_set_format
The format channel count and alignment may have changed.
Update nAvgBytesPerSec accordingly
2022-01-27 15:57:03 +01:00
akallabeth
4b416968c4 Added checks and asserts in rdpgfx_common 2022-01-27 10:33:30 +01:00
akallabeth
6f154da1ae Added plausibility checks and assert to rdpgfx_read_header 2022-01-27 09:50:35 +01:00
zbstao
5b8db18f26 Added pduLength check in rdpgfx_read_header function
if pduLength is zero will lead to an infinite loop in rdpgfx_recv_pdu function.
2022-01-27 16:24:26 +08:00
akallabeth
7dedfbb0b0 Added support for getpwuid_r, replaced duplicate code
* Use GetUserNameExA to get current user name when required.
* Add support for getpwuid_r if available
2022-01-25 15:33:04 +01:00
David Runge
d0488f8692 Guard avcodec_register_all() calls
{channels/tsmf/client/ffmpeg/tsmf,libfreerdp/codec/dsp}_ffmpeg.c:
Guard calls to `avcodec_register_all()` against use beyond
`AV_VERSION_INT(58, 10, 100)`, where upstream ffmpeg made it obsolete.
2022-01-25 08:52:29 +01:00
james
2d4850de66 Fix hotplug 2022-01-25 08:49:46 +01:00
akallabeth
7d5e5764e3 Removed dead code. 2022-01-19 09:24:57 +01:00
akallabeth
b0c4bb5e86 Used proper format string for wide print size_t 2022-01-19 09:24:57 +01:00
akallabeth
d73d0d4610 Use defines for echo channel 2022-01-19 09:24:57 +01:00
akallabeth
6ef65b97aa Fixed const warnings audin/winmm 2022-01-19 09:24:57 +01:00
akallabeth
bf19c925c2 Fixed 7526: Crash in RDPEI channel 2022-01-13 16:44:39 +01:00
akallabeth
f8758a4b10 Fixed const warning in opensl es backend 2022-01-11 14:32:18 +01:00
akallabeth
b4d28ab569 Fixed file name pattern checks in freerdp_channels_list_dynamic_addins
Reported by George Zaytsev from Positive Technologies
2022-01-11 14:32:18 +01:00
Armin Novak
3c72cc3306 Refactored rdpdr and dependent channels
* Move parsing code to core library
* Move definitions to public API to allow access from outside
* Move smartcard related parsing to core library
2022-01-11 12:34:43 +01:00
akallabeth
8c543b1de2 Added smartcard emulation layer 2022-01-11 12:34:43 +01:00
kubistika
4dd1747e21 rail: client: fix memory leak 2022-01-10 08:02:05 +01:00
Richard Markiewicz
16202322d1 freerdp: add audin channel for iOS 2021-12-21 08:31:04 +01:00
Armin Novak
0fb83a304d Adjusted channelID and server SetVolume data types 2021-12-20 08:11:00 +01:00
akallabeth
4a4d783d4f
Moved clipboard custom context checks to implementation (#7501) 2021-12-17 13:47:20 +01:00
Armin Novak
83f56bd565 Cleanup disp_send_display_control_monitor_layout_pdu 2021-12-17 10:06:54 +01:00
Richard Markiewicz
49f9f5c265 freerdp: remove SetFormat from iOS rdpsnd entry points, fix const-ness of interface methods 2021-12-16 08:49:49 +01:00
Armin Novak
fe4c30fc54 Fixed warning in rdpgfx server channel 2021-12-14 13:46:34 +01:00
Armin Novak
b2a6740d88 Added remdesk version check 2021-12-14 13:46:34 +01:00
Armin Novak
298c0f52db Fixed missing return check 2021-12-14 13:46:34 +01:00
Armin Novak
e07bd77507 Fixed missing return check 2021-12-14 13:46:34 +01:00
Armin Novak
b598a7b2a3 Remove failed redirected device from list 2021-12-14 13:46:34 +01:00
Armin Novak
223da39eac Updated RDPDR version checks 2021-12-14 13:46:34 +01:00
Martin Fleisz
7adf2f0bbd drdynvc: Prevent opening an already opened dynamic channel 2021-12-03 09:57:09 +01:00
Armin Novak
ed73cf0d17 Added libusb transfer cancel hack 2021-11-29 09:30:10 +01:00
Armin Novak
bae23de82f Fixed issues with libusb device unref 2021-11-29 09:30:10 +01:00
akallabeth
b73ce8a9f6 Fixed warning in mac audin backend. 2021-11-25 12:25:18 +01:00
Armin Novak
e80c24e837 Fix printer backend reference count 2021-11-18 14:17:25 +01:00
Armin Novak
8c74de191c Fix printer reference count 2021-11-16 08:27:24 +01:00
Armin Novak
239a3872d2 Fixed cups default printer. 2021-11-16 08:27:24 +01:00
Armin Novak
422b684957 Ensure default printer for windows backend. 2021-11-16 08:27:24 +01:00
Armin Novak
46d524cbc7 windows printer cleanup 2021-11-16 08:27:24 +01:00
David Fort
67986ea298 Fix compilation with mingw
This patch addresses some issues when compiling against mingw. With these changes
FreeRDP can be compiled out-of-the box on a Ubuntu 20.04.
2021-11-15 09:23:16 +01:00
akallabeth
5ed7c10840 Fixed RDPEI_PLUGIN source
Used the wrong pointer to cast to RDPEI_PLUGIN*, corrected that.
2021-11-08 12:49:13 +01:00
Alexandru Bagu
21ca4a009d
Urbrdc fix (#7417)
* fix libusb libusb_device usage (manually unref required usb devices, versus freeing all when we still hold references to the ones we want)
* disabled detach_kernel_driver & attach_kernel_driver on win32 since libusb does not support them
* fixed libusb async event handling

* add log for transfer request error

* Update libusb_udevice.c

* refactor code
2021-11-03 11:11:36 +01:00
Alexandru Bagu
3280363b66 fix call to localtime_s 2021-11-02 08:34:23 +01:00
Alexandru Bagu
a8cc80851f fixes argument order for rdpdr_load_drive 2021-10-22 09:31:25 +02:00
Steve Pronovost
e452467cd3 Fix protocol violation in Display Control Virtual Channel Extension
Length field of DISPLAYCONTROL_HEADER must include the size of the header
itself. See MS-RDPEDISP 2.2.1.1 DISPLAYCONTROL_HEADER.
2021-10-21 13:11:21 +02:00
Steve Pronovost
bb7e4f220b Add support for graphics redirection protocol
Add support for new graphics redirection protocol (aka VAIL) used by
WSLg. This protocol is currently being documented and the official
documentation will be posted in the near future.
2021-10-21 13:11:21 +02:00
Steve Pronovost
f6f4acc921 Added support for AUDIO_PLAYBACK_DVC
Support audio on dynamic channel. Please refer to MS-RDPEA.
2021-10-21 13:11:21 +02:00
Armin Novak
6e410e6dd4 Fixed broken message queue free function 2021-10-18 12:49:38 +02:00
Armin Novak
41d77cae46 Fixed /video buffer alignment, added assertions 2021-10-18 10:53:05 +02:00
Armin Novak
7d80c74e97 Cleaned up RDPDR channel interhitance
* All channels inheriting from RDPDR_DRIVE base struct
* Add functions to create/free a new device of a type
* Fixed settings array resize code, prevent 0 sizes
2021-10-18 09:21:02 +02:00
akallabeth
3ccb96d52f Fixed #7350: Warnings with Stream_StaticInit
* Properly initialize the stream buffer
* Add Stream_StaticConstInit accepting a const buffer
* Modify API to return a pointer to the stream initialized
2021-10-14 12:11:16 +02:00
akallabeth
834fdf0046
[audin] Always reset dsp_context before open (#7342) 2021-10-11 15:45:36 +02:00
Armin Novak
96cf17a45b Replaced (IWTSPlugin*) casts with struct address return 2021-10-07 16:22:04 +02:00
Armin Novak
18a3fcf2fc Updated wStream API and added torough checks
* Do length/capacity checks in every read/write/seek function
  if WINPR_ASSERT is defined.
* Ensure s->pointer is valid, e.g. within s->buffer + s->capacity
  (Stream_Rewind, Stream_Seek, ...)
* Add return values to Stream_Set* functions so inalid arguments
  can be reported to the caller
* Deprecated problematic stream manipulation functions
  (Stream_SetBuffer, Stream_SetPointer, Stream_SetCapacity)
* Ensure length/capacity functions never return a value larger
  than the actual length/capacity
2021-10-06 09:49:07 +02:00
Simon Nivault
845947651e Force one channel input fallback for audin
Windows winmm backend does not support stereo microphone properly.
Fall back to mono and ensure that fallback is used.
2021-09-30 11:15:24 +02:00
akallabeth
03a9ca80c8
Refactor proxy (#7312)
* Added hidden transport dump and replay options

* Added settings to enable transport dump and replay
* Added check in freerdp_connect to skip authentication on
  dump replay

* Fixed proxy issues

* Proper shutdown handling
* Uninitialized variables
* Skip proxy-client channels, initialize from peer channels and
  config
* Filter static channels like dynamic ones
* Added proxy module filtering from config data (channels, input, ...)

* Removed oboslete proxy decoding related files

* Added defines for RDPECAM channel

* Added proxy config options:

* VideoRedirection
* CameraRedirection

* Fixed duplicate channel free
2021-09-23 14:52:03 +02:00
akallabeth
e0a531f728
Channel fixes (#7309)
* Added missing CHANNEL_NAME defines.

* Fixed FreeRDP_ChannelDefArray setter

* Fixed code duplication due to merge error

* Added public function freerdp_channels_from_mcs

* Fixed const correctness in mcs
2021-09-22 14:27:21 +02:00
akallabeth
7b7e2d6f32 Prefer constant division over multiplication for length checks 2021-09-21 08:55:22 +02:00
Armin Novak
cbd30544f8 Fix rdpsnd number of event handles 2021-09-20 10:59:59 +02:00
akallabeth
5b78d02d5d Fixed unchecked variable access 2021-09-20 10:59:59 +02:00
akallabeth
a3a935283b Fixed invalid read in rdpdr 2021-09-20 10:59:59 +02:00
akallabeth
1ca7e1f7a0 Added option to disable graphics decoding in client code path 2021-09-20 10:59:59 +02:00
Pascal Nowack
b3ae8cec8d rdpei/server: Fix PDU length for RDPINPUT_PROTOCOL_V300
When the server supports the protocol version RDPINPUT_PROTOCOL_V300,
the additional supportedFeatures field will be present.
The pduLength in the RDPINPUT_HEADER should, however, reflect this.

So, fix this error by writing the correct PDU length when the
supportedFeatures field is present.
2021-09-20 08:41:03 +02:00
akallabeth
00c083a854 Fixed compilation warnings. 2021-09-14 09:45:03 +02:00
akallabeth
1904020d7f
Some code cleanups and WINPR_ASSERT (#7281) 2021-09-10 09:06:35 +02:00
Armin Novak
673fb46836 Fixed uninitialized warnings 2021-09-10 08:16:25 +02:00
Armin Novak
0fe1e2359e Fixed all reserved-id-macro warnings 2021-09-10 08:16:25 +02:00
Armin Novak
ba0da04217 Fixed compilation warnings and duplicate defines 2021-09-09 08:53:20 +02:00
Armin Novak
95ecc6929a Refactored channel error handling
* Fix WINPR_ASSERT if a client can not allocate new resources,
  terminated cleanly instead.
* Add WINPR_ASSERT for lots of channel arguments
2021-09-09 08:53:20 +02:00
Armin Novak
cde002f460 Cleaned up cliprdr 2021-09-09 08:53:20 +02:00
Armin Novak
f794a8c7d4 Cleaned up remdesk 2021-09-09 08:53:20 +02:00
Armin Novak
467f7c3f6a Fixed proxy ulimit graceful client disconnect 2021-09-09 08:53:20 +02:00
Armin Novak
0f8c52b9ca Fixed const warnings with argument parser 2021-09-09 08:53:20 +02:00
Armin Novak
4e44003832 Expose dynamic channel PDU types 2021-09-09 08:53:20 +02:00
Armin Novak
976c3c2ab9 Refactored proxy and proxy-modules:
* Split out proxy headers and moved to public API to allow external
  modules to be built.
* Split proxy into proxy library and proxy binary. The library
  can be used by other applications and provides a simple API
* Improved channel passthrough, now all channels including dynamic
  channels work.
* Extended module API to hook more events, improved module samples
* Cleaned up proxy code, removed global static variables used,
  added WINPR_ASSERT
2021-09-09 08:53:20 +02:00
akallabeth
732a4d3839 Ignore NULL pointer as rdpsnd_server_context_free argument 2021-09-06 10:11:14 +02:00
Armin Novak
413dcd3c28 Fixed RDPSND_CHANNEL_NAME
RDPSND channel is special, as it has many names.
(e.g. static channel, dynamic channel and UDP one.
Use RDPSND_CHANNEL_NAME to identify the module name instad of
RDPSND_DVC_CHANNEL_NAME
2021-08-25 13:40:47 +02:00
Armin Novak
054f0ea260 Use defines instad of channel names 2021-08-25 10:54:24 +02:00
Armin Novak
5afa592244 Fixed cast-qual warnings 2021-08-24 11:10:51 +02:00
Armin Novak
f515bd4560 Fixed shadowing and type errors 2021-08-24 10:45:57 +02:00
Hans-Peter Jansen
297f965052 Fix linking, if BUILTIN_CHANNELS switched off
If -DBUILTIN_CHANNELS=OFF is supplied to cmake, auxiliary channel modules
are built as plugins, that are loaded from $LIBDIR/freerdp as shared libs.

This patch fixes the linkage of these plugins by taking inter-channel dependencies
of this separation into account. If BUILTIN_CHANNELS=ON, these channel modules
are linked directly into the main modules. Therefore, the linking of the plugins
is conditioned accordingly.
2021-08-24 08:43:01 +02:00
Simon Nivault
e42696bb2e
Some fixes for audin redirection (#7231)
* Fixed research for native PCM format

* Fixed compatibility detection for resampling

* dsp: Makes channel mix and encoding process use separated buffers

* Give FramesPerPacket to freerdp_dsp_context_reset function

* dsp: Fix DVI_ADPCM codec by respecting the required packet size

* Forbid mono channel in macos

* Fix audin command line channel option

* Disable ADPCM codec as it does not work

* Refactor valid native codec research

* Native codec research: Try different channels number

* Fix dsp channel mix

* Fix dsp resample
2021-08-23 14:49:28 +02:00
Armin Novak
610396e197 Fixed compilation warnings
Try to get the number of warnings down
2021-08-02 10:28:06 +02:00
Armin Novak
6854c7da7e Fixed windows audio recording issues:
1. Fix recording channels to mono
2. Fix alignment of PCM data to 2 bytes
2021-07-29 15:27:24 +02:00
Armin Novak
275f9ab2f6 Added listforeach wrapper 2021-07-29 15:09:53 +02:00
Armin Novak
8a74bdb371 Fixed cast warning 2021-07-29 15:09:53 +02:00
Armin Novak
4e3a7562af Clarified log message for device redirection 2021-07-29 15:09:53 +02:00
Armin Novak
da57b0b91b Fixed resource cleanup 2021-07-29 15:09:53 +02:00
Armin Novak
55592049dc WINPR_ASSERT for drive redirection 2021-07-29 15:09:53 +02:00
Armin Novak
a788145519 Fixed wrong error message 2021-07-29 15:09:53 +02:00
akallabeth
7dfdd248ee
Monitor coordinates are exclusive (#7145)
* Monitor coordinates are exclusive

* Remove force override of shadow resolution.

The client might ignore the server requested values, in that case
retry
2021-07-07 11:54:01 +02:00