Commit Graph

2952 Commits

Author SHA1 Message Date
akallabeth
5cb463e74b [channel,rdpgfx] disable client side caps
If no image scaling is available disable capabilities that require image
scaling to function properly
2024-01-29 19:26:18 +01:00
akallabeth
278a56263b [channels,rdpgfx] add server side channel checks
check if the message is allowed in current channel state.
2024-01-29 19:26:18 +01:00
akallabeth
01e415b801 [channel,rdpgfx] use dynamic WLog for server channel 2024-01-29 19:26:18 +01:00
Vic Lee
16206cb505 [channels,drdynvc] Add settings to enable synchronous dynamic channels. 2024-01-11 15:24:55 +01:00
Vic Lee
277ea28926 [channels,rdpgfx] fix potential stack corruption. 2024-01-11 13:44:47 +01:00
Armin Novak
650154b2e7 [channels,rdpgfx] add debug logs for server side
add debug logs for cache import offer and reply
2024-01-10 21:49:38 +01:00
Armin Novak
6e1bb4e1c3 [channels,gfx] default reply to cache import offer
by default we do not use the cache, so reply with 0 imported messages by default.
can be overridden by server implementations, but provides a sane default
if not.
2023-12-20 11:26:54 +01:00
Armin Novak
9575f386cd fixed WCHAR constants, use endian safe definitions 2023-12-20 09:03:58 +01:00
Armin Novak
28e5167435 [unicode] fix definition of _wcschr search char 2023-12-20 09:03:58 +01:00
Armin Novak
731e1f183d [channel,rdpds] ignore XPS device messages
if FreeRDP_IgnoreInvalidDevices is set ignore XPS messages for unknown
devices
2023-12-06 15:22:59 +01:00
Armin Novak
303c477c06 [channels,rdpdr] fix #9610
windows RDP server randomly sends PAKID_CORE_SERVER_CAPABILITY to
reinitialize the rdpdr channel. Allow this message in all following
states.
2023-12-06 15:22:59 +01:00
Armin Novak
1d06edb8d9 [channels,tsmf] fix gstreamer detection 2023-12-05 08:33:12 +01:00
akallabeth
1b31852d32 [git] remove .gitignore
we do no longer allow in source builds, so remove all the .gitignore
files just hiding generated files
2023-11-28 12:14:55 +01:00
Armin Novak
4fd7a5cf16 [channels,tsmf] fix ffmpeg deprecation 2023-11-24 18:19:03 +01:00
Armin Novak
2e9ee7a583 [channels,rdpsnd] fix missing include 2023-11-24 18:19:03 +01:00
Armin Novak
854df33db1 [warnings] fix log_libusb_result empty format string 2023-11-24 18:19:03 +01:00
akallabeth
ceb7bd1d41 [warnings] fixed clang build warnings 2023-11-24 18:19:03 +01:00
Armin Novak
593e2bf4a9 [api] fix compiler warnings
check #if defined(__GNUC__)
2023-11-24 14:54:56 +01:00
akallabeth
4e438d1c3e [client] make settings opaque 2023-11-24 14:54:56 +01:00
akallabeth
eb445f7c43 [channels] make settings opaque 2023-11-24 14:54:56 +01:00
Armin Novak
68a77b8156 [channels,cups] use PDF printer on mac os sonoma
apple removed postscript support, so switch to PDF printer if running on
mac os sonoma (14) or newer. Requires windows 10 or newer or a custom
PDF printer driver
2023-11-16 15:43:51 +01:00
Armin Novak
57b4f3df20 [channels,cups] add debug logging for failures 2023-11-16 15:43:51 +01:00
Armin Novak
f5d9c5f815 [channels,cups] remove support for CUPS < 2.0 2023-11-16 15:43:51 +01:00
LucasMou
412c5c4ba6 fix abnormal exit: when removing the USB flash drive, the program abnormal exit 2023-11-15 10:46:42 +01:00
Raphaël ZHOU
ad7b41c997 (clipboard) Make sure there is always a Client Format List PUD after a Client Clipboard Capabilities PDU. 2023-11-09 11:40:00 +01:00
Armin Novak
e7f8c05bb6 [channel,rdpdr] relax state checks
ClientID confirm message might be sent async to userloggedon. So allow
these messages to arrive in any order
2023-11-09 10:12:16 +01:00
Armin Novak
43fc6bbfdc [channel,rdpdr] use server general caps
* read server CAP_GENERAL_TYPE
* check if messages are allowed according to caps
2023-11-09 10:12:16 +01:00
akallabeth
f0709d00a9 [channel,rail] move client_rail_server_start_cmd
the function needs access to channel internals, so move to channel
2023-11-07 14:42:56 +01:00
Igor V. Kovalenko
cfcb363c4a rdpsnd_pulse: Use C99 constants 2023-11-03 08:12:12 +01:00
Igor V. Kovalenko
2867c806fc rdpsnd_pulse: Allow reconnecting to pulseaudio server
Detect if pulseaudio context has lost connection to server and initiate
reconnection during play call.
2023-11-03 08:12:12 +01:00
Igor V. Kovalenko
087eb20431 rdpsnd_pulse: Eliminate synchronous write loop
Since complete sound frame is already available, just write it out to
pulseaudio stream using more efficient pa_stream_begin_write API.

This removes a few milliseconds of pure wait time from each play call and
makes audio playback a bit smoother.
2023-11-03 08:12:12 +01:00
Armin Novak
d000d9e957 [channels] add <NAME>_CHANNEL_NAME for each
* made <NAME>_CHANNEL_NAME defines consistent, each channel now has a
  define for the library name.
* use these defines instead of string constants
2023-11-02 12:44:28 +01:00
Armin Novak
9e361b613d [channels,rdpdr] fix user loggedon handling
PAKID_CORE_USER_LOGGEDON might happen in quite a lot of combinations not
obvious from the spec at first glance. Relax state checks so that all
valid combinations are allowed.
2023-11-02 11:21:32 +01:00
David Fort
4a0e0ae88f [egfx] reset total decoded frames when receiving caps
It seems like some windows servers don't like to receive ack frame messages
with a totalDecodedFrame number that is bigger than the frameId.
That can happen if the connection starts, some frames are decoded, we receive a
renegotiate message, then egfx channel is reopened and the frame ids we receive
go back to 1. In the previous situation, we ended up with sending an ack
with frameId=1 and totalDecodedFrames=38, with the patch totalDecodedFrames is
reset when receiving caps, so it's always lower than frameId.
2023-10-27 19:09:41 +02:00
Pascal Nowack
687ed017d3 server: Add channel handling for mouse cursor channel ([MS-RDPEMSC])
The mouse cursor channel enables remoting of the mouse cursor (bitmap)
over a DVC. The main use case is UDP, as only virtual channels can be
transported via UDP in RDP.
2023-10-25 12:57:26 +02:00
Pascal Nowack
aac8945fe9 server: Add channel handling for location channel ([MS-RDPEL])
With the location channel, an RDP server can redirect the location of
the user from the client side to the server side.
The PDUs are almost the same as in the documentation, except for the
encoded types, these ones are here already parsed.
Optional values are accessed via pointers. If the pointer of a value is
NULL, then that value was not supplied by the client side.
2023-10-17 10:18:08 +02:00
Armin Novak
60390ea40c [pragma] unify compiler diagnostics 2023-10-16 15:10:13 +02:00
Armin Novak
c91a250623 [warnings] add WINPR_FORMAT_ARG
with WINPR_FORMAT_ARG format strings are marked for MSVC to avoid
warnings
2023-10-16 15:10:13 +02:00
Armin Novak
07543a6042 [warnings] fix various warnings
* missing const in casts
* missing static for functions
* missing WINPR_ATTR_FORMAT_ARG for printf like functions
2023-10-16 15:10:13 +02:00
akallabeth
822ba31c31 [bsd] clean up bsd related detections 2023-10-10 22:59:53 +02:00
akallabeth
f1eaa01de2 [oss] moved detection to module 2023-10-10 22:59:53 +02:00
akallabeth
f977de89e3 [pulse] move detection to module 2023-10-10 22:59:53 +02:00
akallabeth
f06c027824 [alsa] move detection to module 2023-10-10 22:59:53 +02:00
akallabeth
046767b195 [opensles] moved detection to modules
* Rename variables to match package name
* Move find_package to where it is actually used
2023-10-10 22:59:53 +02:00
ichaoX
a6e9cfa6d9 [channels,rdpei] fix pen contact 2023-09-13 15:57:59 +02:00
akallabeth
4eb3a16120 [channels,audin] fix return value type 2023-09-02 07:56:21 +02:00
akallabeth
bb5345c60e [freerdp,api] add FREERDP_ENTRY_POINT
C requires prototypes or compilers will complain about them missing. Our
library entry points do not have such, therefore add the macro
FREERDP_ENTRY_POINT which declares the function prototype automatically
before the function.
2023-08-25 14:36:05 +02:00
akallabeth
ad51c6a0f5 [channels,printer] default CUPS to being enabled
* printer support now enabled by default unless iOS or ANDROID is build.
* Move cups library detection to printer module
2023-08-25 13:54:29 +02:00
akallabeth
4e824b243f [winpr] add WINPR_ATTR_FORMAT_ARG
this macro declares the function argument (pos,arg) to be a printf
style format string and enables compiler checks for that.
2023-08-25 12:56:36 +02:00
akallabeth
9cee9b3c08 [c standard] use WINPR_FALLTHROUGH
use the macro to silence intentional switch fallthrough locations
2023-08-25 12:56:36 +02:00
akallabeth
04f5790fd4 [channel,rdpgfx] fix wrong return type 2023-08-25 08:42:31 +02:00
akallabeth
7a71441476 [warnings] fix integer multiplications
Ensure the integer width for size arguments is 64bit in a
multiplication. Leading 64bit constant 1ull expands width, a trailing
one is ignored.
2023-08-22 11:55:00 +02:00
Marc-André Moreau
c691ef9c8d allow selecting smartcard emulator at runtime rather than link time 2023-08-21 12:00:17 +02:00
akallabeth
41bd8bd3fb [various] fix integer conversions 2023-08-04 15:07:56 +02:00
ehdgks0627
8e3d72e814 Add return statement when not enough data 2023-08-03 10:16:05 +02:00
Martin Fleisz
45ee30da5e rdpdr: Fix potential null pointer access 2023-08-02 19:09:26 +02:00
Kai Pastor
5ecc011c13 Export interface include directories 2023-08-01 11:12:46 +02:00
Armin Novak
ef5c0e78ab [build] use define WINPR_FALLTHROUGH
with c17 compatible compilers annotate with [[fallthrough]]
2023-07-31 23:46:53 +02:00
Armin Novak
62da5c7e8e [channels,rdpgfx] make internal server thread optional 2023-07-31 20:18:48 +02:00
ehdgks0627
d04ba8d6ef Correct typos and formatting errors in format strings
In several files, fixed typos in format strings that were causing unexpected output and formatting issues.
2023-07-28 15:34:46 +02:00
Armin Novak
045fcedd12 [channels,printer] fix backend load function
changed the signature of the backend loader function. the previous
version casted the allocated pointer to UINT which might not be able to
hold a pointer.
2023-07-28 12:24:22 +02:00
Armin Novak
3612948bad [channels,audin] assertions and warning fixes 2023-07-27 20:02:43 +02:00
Armin Novak
70e437dbeb [channels,echo] assertions and warning fixes 2023-07-27 20:02:43 +02:00
Armin Novak
bd0d927b08 [channels,encomsp] assertions and warning fixes 2023-07-27 20:02:43 +02:00
Armin Novak
e61880d077 [standard] replace __FUNCTION__ with __func__ 2023-07-27 20:02:43 +02:00
Armin Novak
99bf501f0f [channels,drive] remove unused member filename 2023-07-26 10:57:42 +02:00
Armin Novak
70ddb6518a [PathCchAppend] fix missing return checks 2023-07-26 10:57:42 +02:00
Armin Novak
4154779672 [channel,drive] path must not end with separator
the fullpath string must not end with a path separator as FindFirstFile
returns an error in such cases.
2023-07-26 10:57:42 +02:00
Armin Novak
c4f93891fd [channels,drive] use winpr recursive directory remove 2023-07-26 10:57:42 +02:00
Pascal Nowack
b8c2b6abd7 channels/cliprdr: Fix writing incorrect PDU type for unlock PDUs 2023-07-20 11:36:11 +02:00
Martin Fleisz
c88c777482 drive: Fix double free in client drive channel 2023-07-05 14:02:31 +02:00
akallabeth
bd7f0ecd24 [collections] fix ListDictionary usage 2023-07-05 08:46:00 +02:00
Martin Fleisz
622a2a8df0 misc: More int to BOOL conversion fixes
This is a follow up to #9129.

This PR fixes some problematic `int` to `BOOL` conversions that might
cause overflows when checking for bit flags.
2023-07-04 09:45:20 +02:00
Armin Novak
9af563d4d1 [smartcard] fix message queuing
the queye key must not be 0
2023-07-03 20:53:46 +02:00
akallabeth
e03b6596c6 [build] fix unused but set variable warnings 2023-06-29 18:34:51 +02:00
akallabeth
3f78b3c379 [build] fix unused compiler warnings 2023-06-28 09:45:09 +02:00
Vic Lee
eda91e6695 [channels,audin] negotiated format must be cleaned after closing. 2023-06-28 08:39:33 +02:00
akallabeth
54847499e9 [winpr,collections] fix ListDictionary New/Free handling 2023-06-27 15:05:43 +02:00
akallabeth
63d4da2d0d [winpr,collections] ListDictionary_GetKeys 2023-06-27 15:05:43 +02:00
akallabeth
ac39e8aac2 [winpr,collections] ListDictionary_Count 2023-06-27 15:05:43 +02:00
Armin Novak
535faeb879 [channels,rdpei] simplify new contact detection 2023-06-26 11:22:32 +02:00
Armin Novak
d6ae30e7fa [channels,rdpei] add variadic argument calls 2023-06-26 11:22:32 +02:00
digitalsignalperson
9c7a541d9c Implement pen functionality for X11, including pressure, hover, and eraser 2023-06-21 18:42:38 +02:00
Martin Fleisz
3b9a19e993 cliprdr: Fix an issue with file format filtering on Windows
This PR fixes an issue caused by clipboard format filtering which
discarded all formats but `FileGroupDescriptorW` to enable clipboard
file transfer. However at least on windows we also need `FileContents`
to be placed in the clipboard to make file transfer work correctly.

The PR also unifies list filtering into a single functions instead of
having two different functions.
2023-06-14 17:14:14 +02:00
Armin Novak
970f0c54e8 [stream] use const correct Stream_Pointer access 2023-06-08 08:09:33 +02:00
Armin Novak
a4c6b36a19 [build] fix memory sanitizer stack frame warnings 2023-06-07 09:14:45 +02:00
akallabeth
00b393c094 [channels,rdpdr] enforce client state checks
Keep track of client channel state and abort on invalid messages for a
certain state
2023-06-05 09:56:43 +02:00
Armin Novak
3e44efc841 [cmake] use FindX11 from CMake 3.13 2023-05-31 11:05:56 +02:00
Armin Novak
e3f660e11f [channels,cliprdr] fix sending of empty format list 2023-05-30 13:42:28 +02:00
akallabeth
98fb56b767 [channels,cliprdr] implement client clipboard direction filter
* Filter remote -> local or local -> remote clipboard depending on
  setting.
* Filter remote -> local or local -> remote file clipboard
  depending on setting.
2023-05-25 16:26:39 +02:00
akallabeth
fc78064ec3 [warnings] fix -Wunused-variable 2023-05-24 08:24:32 +02:00
akallabeth
066276a85a [warnings] fix -Wsometimes-uninitialized 2023-05-24 08:24:32 +02:00
akallabeth
27d0da9df0 [cmake] remove duplicate setting for position independent code 2023-05-23 08:51:18 +02:00
Armin Novak
b15edda614 [cmake] changed rdpsnd-common to STATIC library 2023-05-22 12:57:16 +02:00
akallabeth
105f0d2366 [channel,audin] move common code to server channel
* manage channel related callbacks with default implementations
* use dynamic logger for server audin channel
2023-05-17 13:33:35 +02:00
Pascal Nowack
c5278c874f channels/audin: Rework API to be closer to documentation
The current server side channel handling of AUDIO_INPUT is currently
very constrained:

- Server implementations cannot measure the clients uplink, since the
  Incoming Data PDU is currently unhandled and FreeRDPs DSP handling
  delays the callback call of ReceiveSamples
- Servers currently cannot prefer a different protocol version
- Servers currently cannot change the used format

To solve these issues without running into the risk that some
simplifications constraint certain API usage, rework the current channel
handling to be very close to the documentation.
This means, that all documented API calls can be made by server
implementations and all documented PDUs, that the server side is
expected to receive are just parsed inside FreeRDP and then forwarded to
the API implementation.
2023-05-17 13:33:35 +02:00
akallabeth
7073aef79f [channel,cliprdr] add missing include in header 2023-05-12 13:57:56 +02:00
akallabeth
239cd9212e [channels] fix static linking of common libraries 2023-05-12 08:03:56 +02:00
akallabeth
2b3c8c47a4 [build] fix install with BUILD_SHARED_LIBS=OFF
generate proper CMake targets so static linking works again.
2023-05-12 08:03:56 +02:00
Joerg Pulz
61983cd6dc Replace deprecated ffmpeg functions:
avpicture_get_size -> av_image_get_buffer_size
  avpicture_fill -> av_image_fill_arrays
  av_picture_copy -> av_image_copy

Add missing includes.

This fixes build with ffmpeg-6.x.x
2023-05-02 15:12:07 +02:00
akallabeth
c950ca375c [client,common] fix value present flag check
need to check for COMMAND_LINE_VALUE_PRESENT instad of COMMAND_LINE_ARGUMENT_PRESENT
2023-04-28 07:39:35 +02:00
akallabeth
516668d02b [fclose] ensure no invalid pointers are passed.
fclose has undefined behaviour for NULL pointers, so check for these.
2023-04-28 07:39:35 +02:00
David Fort
0b16fcef18 rail: add missing server-side calls
This patch adds support for text_scale and caret_blink messages on the server-side.
2023-04-25 07:27:37 +02:00
Richard Markiewicz
13e52cfae2 [channels,settings] add a setting to ignore invalid devices 2023-04-24 11:29:05 +02:00
Armin Novak
9005e1edfb [channels,printer] fix printer_save_default_config 2023-04-24 10:58:01 +02:00
Andrey Af
58cdc9e82b rdpdr_server_drive_close_file_callback remaining length fixed 2023-04-24 09:33:26 +02:00
Pascal Nowack
4be3950fd8 rdpecam/server: Remove wrong assertion
Some PDUs, like the Activate Device Request only contain the header.
As a result, the size of the rest of the PDU is 0.
The assertion for the PDU size in device_server_packet_new only
considers the size of the body of the PDU.
When that value is 0, the assertion is hit and the server implementation
crashes.

To fix this issue, simply remove this assertion. Since the allocation
size is always at least the header size, there won't ever be an attempt
to create a stream with a size of 0.
2023-04-19 22:20:04 +02:00
Martin Fleisz
ecb4712a10 channels: Check return value of EnumPrinters 2023-03-23 17:40:08 +01:00
akallabeth
e28760f91e [cmake] fix OBJECT library link deps
Follow up to #8801, OBJECT libraries need to link dependencies with
PUBLIC so that the library using the OBJECT libraries can link against
these too
2023-03-16 10:58:01 +01:00
Marc-André Moreau
3cc12d5886 use cmake object libraries for built-in virtual channel plugins 2023-03-15 16:20:50 +01:00
Armin Novak
b54d2c1db3 [channels] removed duplicate includes 2023-03-15 08:22:23 +01:00
akallabeth
a5b42f0f84 [includes] untangled circular includes 2023-03-15 08:22:23 +01:00
akallabeth
a360f1ca8c [build] fix a few compiler warnings 2023-03-13 13:04:45 +01:00
Armin Novak
1bf0bb1a26 [server] fixed build without CHANNEL_AUDIN_SERVER 2023-03-06 21:46:51 +01:00
Armin Novak
3d8cb485f4 [warnings] Fixed strict-prototypes warnings 2023-03-06 10:04:59 +01:00
Armin Novak
1b28bd0d36 [channels,cliprdr] use logger tag macros 2023-03-05 17:55:28 +01:00
Armin Novak
9c56ce1336 [channels,tsmf] drop gstreamer 0.1 support 2023-03-01 15:34:09 +01:00
akallabeth
273bb6a7a8 [build] use static libraries as intermediate 2023-03-01 08:18:34 +01:00
akallabeth
b4e9c8b39f [build] removed complex libraries
* remove obsolete complex libraries helper
* fix static linking
2023-03-01 08:18:34 +01:00
akallabeth
c054666311 [channels] simplified channel subsystem linking 2023-03-01 08:18:34 +01:00
akallabeth
cf9777cd92 [channels] simplified server linking 2023-03-01 08:18:34 +01:00
akallabeth
c3a82daad6 [channels] simplified client linking 2023-03-01 08:18:34 +01:00
akallabeth
0307482506 [channels,rdpsnd] add rdpsnd-common object lib 2023-03-01 08:18:34 +01:00
akallabeth
aa2cb9aa5f Fixed #8686: Update h264 to use new FFMPEG API 2023-02-27 09:45:44 +01:00
Armin Novak
6256933e75 [channels,cliprdr] remove clipboard data hex dump
just too noisy for logging
2023-02-23 20:28:15 +01:00
Armin Novak
70f6c09ff4 [core] fix persistent bitmap cache setting
* Only activate if both, client and server support the capability
* Use settings getter to access setting
2023-01-26 09:30:17 +01:00
Armin Novak
641022b795 [logging] remove __FUNCTION__ from actual message
prefer the log formatter to provide that information.
2023-01-25 16:26:39 +01:00
akallabeth
075506f6c8 [winpr,stream] use new Stream_CheckAndLogRequiredLength* 2023-01-25 14:27:32 +01:00
akallabeth
8ed37e68d2 [stream] use logging capacity checks 2023-01-25 14:27:32 +01:00
akallabeth
275741cc75 [core,utils] add drdynvc stringification functions 2023-01-12 22:54:25 +01:00
akallabeth
6d7c07076d [chanenls,drdynvc] use proper types instead of int 2023-01-12 22:54:25 +01:00
akallabeth
82ba9ede9c [freerdp] use FREERDP_/UWAC_/RDTK_ prefix for conditional headers 2023-01-10 17:38:00 +01:00
Armin Novak
f1e7cc0d48 [rdpdr] unify header read/write 2023-01-10 11:49:38 +01:00
Armin Novak
920d5ee7a1 [rdpdr] improved version handling 2023-01-10 11:49:38 +01:00
Martin Fleisz
8d917698ea cliprdr: Fix sending of server-side PDUs
The old implementation used `Stream_GetLength` to obtain the amount of
data to send. However some PDUs (i.e. CLIPRDR_FILECONTENTS_REQUEST) are
overallocated as they contain optional data (clipDataId in this case).

We now use the position to determine the actual data written to the PDU
instead of the amount of bytes allocated, avoid sending garbage data to
the client.
2023-01-09 07:47:17 +01:00
Armin Novak
37454c7420 [utils] improve rdpdr packet dump 2022-12-22 15:09:03 +01:00
Armin Novak
833a1b2d24 [channel,rdpdr] use wLog* for server logging 2022-12-22 15:09:03 +01:00
Armin Novak
d5c5473aa9 [channel,rdpdr] use wLog* for client logging 2022-12-22 15:09:03 +01:00
Armin Novak
318b55adc1 [rdpdr] filter empty device announce 2022-12-22 15:09:03 +01:00
akallabeth
29c92af194 [channels,rdpgfx] fixed logger setup 2022-12-18 15:14:30 +01:00
akallabeth
06c070fc4d [gfx] moved rdpgfx_get_codec_id_string to utils
the gfx related stringify helpers are nice to have outside the channel
too so that meaningful logmessages can be written.
2022-12-18 15:14:30 +01:00
akallabeth
9d6a06a197 [channels,rdpdr] fix misleading log entries
* Use __FUNCTION__ instead of copying the name to the message
* Fix freerdp_rdpdr_dtyp_string argument to get correct name
2022-12-16 09:42:44 +01:00
Armin Novak
37d7b98449 [channels,rdpdr] refactoring server callbacks
* Add callbacks for all messages exchanged between client and server
  to allow server implementations to intercept them.
* Unify logging
* Add device tracking
2022-12-15 14:57:29 +01:00
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