[server] add WINPR_ATTR_NODISCARD macro

This commit is contained in:
akallabeth
2026-01-23 13:15:46 +01:00
committed by Armin Novak
parent 15c9fd0300
commit b2f325251a
77 changed files with 613 additions and 233 deletions

View File

@@ -31,6 +31,7 @@
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
WINPR_ATTR_NODISCARD
static UINT mf_peer_audin_data(audin_server_context* audin, const SNDIN_DATA* data)
{
/* TODO: Implement */

View File

@@ -27,7 +27,7 @@
#include "mf_types.h"
#include "mfreerdp.h"
BOOL mf_peer_audin_init(mfPeerContext* context);
WINPR_ATTR_NODISCARD BOOL mf_peer_audin_init(mfPeerContext* context);
void mf_peer_audin_uninit(mfPeerContext* context);
#endif /* FREERDP_SERVER_MAC_AUDIN_H */

View File

@@ -30,6 +30,7 @@
#include <freerdp/log.h>
#define TAG SERVER_TAG("mac")
WINPR_ATTR_NODISCARD
static int mf_is_event_set(mfEventQueue* event_queue)
{
fd_set rfds;

View File

@@ -60,16 +60,22 @@ struct mf_event_region
};
void mf_event_push(mfEventQueue* event_queue, mfEvent* event);
mfEvent* mf_event_peek(mfEventQueue* event_queue);
mfEvent* mf_event_pop(mfEventQueue* event_queue);
WINPR_ATTR_NODISCARD mfEvent* mf_event_peek(mfEventQueue* event_queue);
WINPR_ATTR_NODISCARD mfEvent* mf_event_pop(mfEventQueue* event_queue);
mfEventRegion* mf_event_region_new(int x, int y, int width, int height);
void mf_event_region_free(mfEventRegion* event_region);
mfEvent* mf_event_new(int type);
WINPR_ATTR_MALLOC(mf_event_region_free, 1)
WINPR_ATTR_NODISCARD mfEventRegion* mf_event_region_new(int x, int y, int width, int height);
void mf_event_free(mfEvent* event);
mfEventQueue* mf_event_queue_new(void);
WINPR_ATTR_MALLOC(mf_event_free, 1)
WINPR_ATTR_NODISCARD mfEvent* mf_event_new(int type);
void mf_event_queue_free(mfEventQueue* event_queue);
WINPR_ATTR_MALLOC(mf_event_queue_free, 1)
WINPR_ATTR_NODISCARD mfEventQueue* mf_event_queue_new(void);
#endif /* FREERDP_SERVER_MAC_EVENT_H */

View File

@@ -88,11 +88,10 @@ int mf_info_unlock(mfInfo* mfi)
return 1;
}
WINPR_ATTR_NODISCARD
static mfInfo* mf_info_init(void)
{
mfInfo* mfi;
mfi = (mfInfo*)calloc(1, sizeof(mfInfo));
mfInfo* mfi = (mfInfo*)calloc(1, sizeof(mfInfo));
if (mfi != NULL)
{

View File

@@ -28,20 +28,20 @@
#include "mf_interface.h"
int mf_info_lock(mfInfo* mfi);
int mf_info_try_lock(mfInfo* mfi, UINT32 ms);
int mf_info_unlock(mfInfo* mfi);
WINPR_ATTR_NODISCARD int mf_info_lock(mfInfo* mfi);
WINPR_ATTR_NODISCARD int mf_info_try_lock(mfInfo* mfi, UINT32 ms);
WINPR_ATTR_NODISCARD int mf_info_unlock(mfInfo* mfi);
mfInfo* mf_info_get_instance(void);
WINPR_ATTR_NODISCARD mfInfo* mf_info_get_instance(void);
void mf_info_peer_register(mfInfo* mfi, mfPeerContext* context);
void mf_info_peer_unregister(mfInfo* mfi, mfPeerContext* context);
BOOL mf_info_have_updates(mfInfo* mfi);
WINPR_ATTR_NODISCARD BOOL mf_info_have_updates(mfInfo* mfi);
void mf_info_update_changes(mfInfo* mfi);
void mf_info_find_invalid_region(mfInfo* mfi);
void mf_info_clear_invalid_region(mfInfo* mfi);
void mf_info_invalidate_full_screen(mfInfo* mfi);
BOOL mf_info_have_invalid_region(mfInfo* mfi);
WINPR_ATTR_NODISCARD BOOL mf_info_have_invalid_region(mfInfo* mfi);
void mf_info_getScreenData(mfInfo* mfi, long* width, long* height, BYTE** pBits, int* pitch);
// BOOL CALLBACK mf_info_monEnumCB(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM
// dwData);

View File

@@ -22,15 +22,20 @@
#include "mf_interface.h"
BOOL mf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code);
BOOL mf_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
BOOL mf_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
BOOL mf_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
WINPR_ATTR_NODISCARD BOOL mf_input_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code);
WINPR_ATTR_NODISCARD BOOL mf_input_unicode_keyboard_event(rdpInput* input, UINT16 flags,
UINT16 code);
WINPR_ATTR_NODISCARD BOOL mf_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
WINPR_ATTR_NODISCARD BOOL mf_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x,
UINT16 y);
// dummy versions
BOOL mf_input_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code);
BOOL mf_input_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code);
BOOL mf_input_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
BOOL mf_input_extended_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
WINPR_ATTR_NODISCARD BOOL mf_input_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code);
WINPR_ATTR_NODISCARD BOOL mf_input_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags,
UINT16 code);
WINPR_ATTR_NODISCARD BOOL mf_input_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x,
UINT16 y);
WINPR_ATTR_NODISCARD BOOL mf_input_extended_mouse_event_dummy(rdpInput* input, UINT16 flags,
UINT16 x, UINT16 y);
#endif /* FREERDP_SERVER_MAC_INPUT_H */

View File

@@ -22,17 +22,19 @@
#include <freerdp/codec/rfx.h>
int mf_mlion_display_info(UINT32* disp_width, UINT32* dispHeight, UINT32* scale);
WINPR_ATTR_NODISCARD int mf_mlion_display_info(UINT32* disp_width, UINT32* dispHeight,
UINT32* scale);
int mf_mlion_screen_updates_init(void);
WINPR_ATTR_NODISCARD int mf_mlion_screen_updates_init(void);
int mf_mlion_start_getting_screen_updates(void);
int mf_mlion_stop_getting_screen_updates(void);
WINPR_ATTR_NODISCARD int mf_mlion_start_getting_screen_updates(void);
WINPR_ATTR_NODISCARD int mf_mlion_stop_getting_screen_updates(void);
int mf_mlion_get_dirty_region(RFX_RECT* invalid);
int mf_mlion_peek_dirty_region(RFX_RECT* invalid);
int mf_mlion_clear_dirty_region(void);
WINPR_ATTR_NODISCARD int mf_mlion_get_dirty_region(RFX_RECT* invalid);
WINPR_ATTR_NODISCARD int mf_mlion_peek_dirty_region(RFX_RECT* invalid);
WINPR_ATTR_NODISCARD int mf_mlion_clear_dirty_region(void);
int mf_mlion_get_pixelData(long x, long y, long width, long height, BYTE** pxData);
WINPR_ATTR_NODISCARD int mf_mlion_get_pixelData(long x, long y, long width, long height,
BYTE** pxData);
#endif /* FREERDP_SERVER_MAC_MLION_H */

View File

@@ -62,6 +62,7 @@ static CGImageRef img;
static void mf_peer_context_free(freerdp_peer* client, rdpContext* context);
WINPR_ATTR_NODISCARD
static BOOL mf_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount)
{
if (info_event_queue->pipe_fd[0] == -1)
@@ -139,6 +140,7 @@ static void mf_peer_rfx_update(freerdp_peer* client)
// clean up... maybe?
}
WINPR_ATTR_NODISCARD
static BOOL mf_peer_check_fds(freerdp_peer* client)
{
mfPeerContext* context = (mfPeerContext*)client->context;
@@ -166,6 +168,7 @@ static BOOL mf_peer_check_fds(freerdp_peer* client)
}
/* Called when we have a new peer connecting */
WINPR_ATTR_NODISCARD
static BOOL mf_peer_context_new(freerdp_peer* client, rdpContext* context)
{
rdpSettings* settings;
@@ -233,6 +236,7 @@ static void mf_peer_context_free(freerdp_peer* client, rdpContext* context)
}
/* Called when a new client connects */
WINPR_ATTR_NODISCARD
static BOOL mf_peer_init(freerdp_peer* client)
{
client->ContextSize = sizeof(mfPeerContext);
@@ -262,6 +266,7 @@ static BOOL mf_peer_init(freerdp_peer* client)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL mf_peer_post_connect(freerdp_peer* client)
{
mfInfo* mfi = mf_info_get_instance();
@@ -313,6 +318,7 @@ static BOOL mf_peer_post_connect(freerdp_peer* client)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL mf_peer_activate(freerdp_peer* client)
{
WINPR_ASSERT(client);
@@ -330,11 +336,13 @@ static BOOL mf_peer_activate(freerdp_peer* client)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL mf_peer_synchronize_event(rdpInput* input, UINT32 flags)
{
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
{
bool state_down = FALSE;
@@ -346,16 +354,19 @@ static BOOL mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL mf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL mf_peer_suppress_output(rdpContext* context, BYTE allow, const RECTANGLE_16* area)
{
return FALSE;
}
WINPR_ATTR_NODISCARD
static void* mf_peer_main_loop(void* arg)
{
mfPeerContext* context;

View File

@@ -28,6 +28,6 @@ typedef struct
const char* key;
} mf_server_info;
BOOL mf_peer_accepted(freerdp_listener* instance, freerdp_peer* client);
WINPR_ATTR_NODISCARD BOOL mf_peer_accepted(freerdp_listener* instance, freerdp_peer* client);
#endif /* FREERDP_SERVER_MAC_PEER_H */

View File

@@ -52,7 +52,7 @@ typedef struct
RdpsndServerContext* snd_context;
} AQRecorderState;
BOOL mf_peer_rdpsnd_init(mfPeerContext* context);
BOOL mf_peer_rdpsnd_stop(void);
WINPR_ATTR_NODISCARD BOOL mf_peer_rdpsnd_init(mfPeerContext* context);
WINPR_ATTR_NODISCARD BOOL mf_peer_rdpsnd_stop(void);
#endif /* FREERDP_SERVER_MAC_RDPSND_H */

View File

@@ -38,6 +38,7 @@
*
* @return 0 on success, otherwise a Win32 error code
*/
WINPR_ATTR_NODISCARD
static UINT sf_peer_ainput_mouse_event(WINPR_ATTR_UNUSED ainput_server_context* context,
UINT64 timestamp, UINT64 flags, INT32 x, INT32 y)
{

View File

@@ -30,7 +30,7 @@
void sf_peer_ainput_init(testPeerContext* context);
void sf_peer_ainput_uninit(testPeerContext* context);
BOOL sf_peer_ainput_running(testPeerContext* context);
WINPR_ATTR_NODISCARD BOOL sf_peer_ainput_running(testPeerContext* context);
BOOL sf_peer_ainput_start(testPeerContext* context);
BOOL sf_peer_ainput_stop(testPeerContext* context);

View File

@@ -34,6 +34,7 @@
#if defined(CHANNEL_AUDIN_SERVER)
WINPR_ATTR_NODISCARD
static UINT sf_peer_audin_data(WINPR_ATTR_UNUSED audin_server_context* audin,
const SNDIN_DATA* data)
{

View File

@@ -25,10 +25,10 @@
#include "sfreerdp.h"
BOOL sf_peer_audin_init(testPeerContext* context);
WINPR_ATTR_NODISCARD BOOL sf_peer_audin_init(testPeerContext* context);
void sf_peer_audin_uninit(testPeerContext* context);
BOOL sf_peer_audin_running(testPeerContext* context);
WINPR_ATTR_NODISCARD BOOL sf_peer_audin_running(testPeerContext* context);
BOOL sf_peer_audin_start(testPeerContext* context);
BOOL sf_peer_audin_stop(testPeerContext* context);

View File

@@ -26,6 +26,6 @@
#include "sfreerdp.h"
BOOL sf_peer_encomsp_init(testPeerContext* context);
WINPR_ATTR_NODISCARD BOOL sf_peer_encomsp_init(testPeerContext* context);
#endif /* FREERDP_SERVER_SAMPLE_SF_ENCOMSP_H */

View File

@@ -26,6 +26,6 @@
#include "sfreerdp.h"
BOOL sf_peer_rdpsnd_init(testPeerContext* context);
WINPR_ATTR_NODISCARD BOOL sf_peer_rdpsnd_init(testPeerContext* context);
#endif /* FREERDP_SERVER_SAMPLE_SF_RDPSND_H */

View File

@@ -109,6 +109,7 @@ static void test_peer_context_free(freerdp_peer* client, rdpContext* ctx)
}
}
WINPR_ATTR_NODISCARD
static BOOL test_peer_context_new(freerdp_peer* client, rdpContext* ctx)
{
testPeerContext* context = (testPeerContext*)ctx;
@@ -153,6 +154,7 @@ fail:
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL test_peer_init(freerdp_peer* client)
{
WINPR_ASSERT(client);
@@ -163,6 +165,7 @@ static BOOL test_peer_init(freerdp_peer* client)
return freerdp_peer_context_new(client);
}
WINPR_ATTR_NODISCARD
static wStream* test_peer_stream_init(testPeerContext* context)
{
WINPR_ASSERT(context);
@@ -217,6 +220,7 @@ static void test_peer_end_frame(freerdp_peer* client)
context->frame_id++;
}
WINPR_ATTR_NODISCARD
static BOOL stream_surface_bits_supported(const rdpSettings* settings)
{
const UINT32 supported =
@@ -317,6 +321,7 @@ out:
return ret;
}
WINPR_ATTR_NODISCARD
static int open_icon(wImage* img)
{
char* paths[] = { SAMPLE_RESOURCE_ROOT, "." };
@@ -342,6 +347,7 @@ static int open_icon(wImage* img)
return -1;
}
WINPR_ATTR_NODISCARD
static BOOL test_peer_load_icon(freerdp_peer* client)
{
testPeerContext* context = NULL;
@@ -494,6 +500,7 @@ static void test_peer_draw_icon(freerdp_peer* client, UINT32 x, UINT32 y)
test_peer_end_frame(client);
}
WINPR_ATTR_NODISCARD
static BOOL test_sleep_tsdiff(UINT32* old_sec, UINT32* old_usec, UINT32 new_sec, UINT32 new_usec)
{
INT64 sec = 0;
@@ -600,6 +607,7 @@ fail:
return rc;
}
WINPR_ATTR_NODISCARD
static DWORD WINAPI tf_debug_channel_thread_func(LPVOID arg)
{
void* fd = NULL;
@@ -671,6 +679,7 @@ fail:
return 0;
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_post_connect(freerdp_peer* client)
{
testPeerContext* context = NULL;
@@ -762,16 +771,19 @@ static BOOL tf_peer_post_connect(freerdp_peer* client)
if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, RDPSND_CHANNEL_NAME))
{
sf_peer_rdpsnd_init(context); /* Audio Output */
if (!sf_peer_rdpsnd_init(context)) /* Audio Output */
return FALSE;
}
if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, ENCOMSP_SVC_CHANNEL_NAME))
{
sf_peer_encomsp_init(context); /* Lync Multiparty */
if (!sf_peer_encomsp_init(context)) /* Lync Multiparty */
return FALSE;
}
/* Dynamic Virtual Channels */
sf_peer_audin_init(context); /* Audio Input */
if (!sf_peer_audin_init(context)) /* Audio Input */
return FALSE;
#if defined(CHANNEL_AINPUT_SERVER)
sf_peer_ainput_init(context);
@@ -781,17 +793,16 @@ static BOOL tf_peer_post_connect(freerdp_peer* client)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_activate(freerdp_peer* client)
{
testPeerContext* context = NULL;
rdpSettings* settings = NULL;
BOOL rc = TRUE;
WINPR_ASSERT(client);
context = (testPeerContext*)client->context;
testPeerContext* context = (testPeerContext*)client->context;
WINPR_ASSERT(context);
settings = client->context->settings;
rdpSettings* settings = client->context->settings;
WINPR_ASSERT(settings);
struct server_info* info = client->ContextExtra;
@@ -821,13 +832,14 @@ static BOOL tf_peer_activate(freerdp_peer* client)
.height = (UINT16)freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight)
};
test_peer_begin_frame(client);
test_peer_draw_background(client, &rect);
rc = test_peer_draw_background(client, &rect);
test_peer_end_frame(client);
}
return TRUE;
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_synchronize_event(rdpInput* input, UINT32 flags)
{
WINPR_UNUSED(input);
@@ -836,6 +848,7 @@ static BOOL tf_peer_synchronize_event(rdpInput* input, UINT32 flags)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
{
freerdp_peer* client = NULL;
@@ -925,6 +938,7 @@ static BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
WINPR_UNUSED(input);
@@ -936,6 +950,7 @@ static BOOL tf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
WINPR_UNUSED(flags);
@@ -948,6 +963,7 @@ static BOOL tf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16
return TRUE;
}
WINPR_ATTR_NODISCARD
static UINT32 add(UINT32 old, UINT32 max, INT16 diff)
{
INT64 val = old;
@@ -959,6 +975,7 @@ static UINT32 add(UINT32 old, UINT32 max, INT16 diff)
return WINPR_ASSERTING_INT_CAST(uint32_t, val);
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_rel_mouse_event(rdpInput* input, UINT16 flags, INT16 xDelta, INT16 yDelta)
{
WINPR_UNUSED(flags);
@@ -982,6 +999,7 @@ static BOOL tf_peer_rel_mouse_event(rdpInput* input, UINT16 flags, INT16 xDelta,
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
WINPR_UNUSED(flags);
@@ -996,6 +1014,7 @@ static BOOL tf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_refresh_rect(rdpContext* context, BYTE count, const RECTANGLE_16* areas)
{
WINPR_UNUSED(context);
@@ -1013,6 +1032,7 @@ static BOOL tf_peer_refresh_rect(rdpContext* context, BYTE count, const RECTANGL
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL tf_peer_suppress_output(rdpContext* context, BYTE allow, const RECTANGLE_16* area)
{
WINPR_UNUSED(context);
@@ -1032,6 +1052,7 @@ static BOOL tf_peer_suppress_output(rdpContext* context, BYTE allow, const RECTA
return TRUE;
}
WINPR_ATTR_NODISCARD
static int hook_peer_write_pdu(rdpTransport* transport, wStream* s)
{
UINT64 ts = 0;
@@ -1095,6 +1116,7 @@ fail:
return -1;
}
WINPR_ATTR_NODISCARD
static DWORD WINAPI test_peer_mainloop(LPVOID arg)
{
BOOL rc = 0;
@@ -1300,6 +1322,7 @@ fail:
return error;
}
WINPR_ATTR_NODISCARD
static BOOL test_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
{
HANDLE hThread = NULL;
@@ -1383,6 +1406,7 @@ static void print_entry(FILE* fp, WINPR_FORMAT_ARG const char* fmt, const char*
}
WINPR_PRAGMA_DIAG_POP
WINPR_ATTR_NODISCARD
static int usage(const char* app, const char* invalid)
{
FILE* fp = stdout;

View File

@@ -4,10 +4,10 @@
#include <freerdp/server/rdpsnd.h>
#include "wf_interface.h"
int wf_rdpsnd_set_latest_peer(wfPeerContext* peer);
WINPR_ATTR_NODISCARD int wf_rdpsnd_set_latest_peer(wfPeerContext* peer);
int wf_directsound_activate(RdpsndServerContext* context);
WINPR_ATTR_NODISCARD int wf_directsound_activate(RdpsndServerContext* context);
DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam);
WINPR_ATTR_NODISCARD DWORD WINAPI wf_rdpsnd_directsound_thread(LPVOID lpParam);
#endif /* FREERDP_SERVER_WIN_DSOUND_H */

View File

@@ -22,20 +22,21 @@
#include "wf_interface.h"
int wf_dxgi_init(wfInfo* context);
WINPR_ATTR_NODISCARD int wf_dxgi_init(wfInfo* context);
int wf_dxgi_createDevice(wfInfo* context);
WINPR_ATTR_NODISCARD int wf_dxgi_createDevice(wfInfo* context);
int wf_dxgi_getDuplication(wfInfo* context);
WINPR_ATTR_NODISCARD int wf_dxgi_getDuplication(wfInfo* context);
int wf_dxgi_cleanup(wfInfo* context);
WINPR_ATTR_NODISCARD int wf_dxgi_cleanup(wfInfo* context);
int wf_dxgi_nextFrame(wfInfo* context, UINT timeout);
WINPR_ATTR_NODISCARD int wf_dxgi_nextFrame(wfInfo* context, UINT timeout);
int wf_dxgi_getPixelData(wfInfo* context, BYTE** data, int* pitch, RECT* invalid);
WINPR_ATTR_NODISCARD int wf_dxgi_getPixelData(wfInfo* context, BYTE** data, int* pitch,
RECT* invalid);
int wf_dxgi_releasePixelData(wfInfo* context);
WINPR_ATTR_NODISCARD int wf_dxgi_releasePixelData(wfInfo* context);
int wf_dxgi_getInvalidRegion(RECT* invalid);
WINPR_ATTR_NODISCARD int wf_dxgi_getInvalidRegion(RECT* invalid);
#endif /* FREERDP_SERVER_WIN_DXGI_H */

View File

@@ -25,22 +25,22 @@
#define FREERDP_SERVER_WIN_INFO_DEFAULT_FPS 24
#define FREERDP_SERVER_WIN_INFO_MAXPEERS 32
BOOL wf_info_lock(wfInfo* wfi);
BOOL wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds);
BOOL wf_info_unlock(wfInfo* wfi);
WINPR_ATTR_NODISCARD BOOL wf_info_lock(wfInfo* wfi);
WINPR_ATTR_NODISCARD BOOL wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds);
WINPR_ATTR_NODISCARD BOOL wf_info_unlock(wfInfo* wfi);
wfInfo* wf_info_get_instance(void);
BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context);
WINPR_ATTR_NODISCARD wfInfo* wf_info_get_instance(void);
WINPR_ATTR_NODISCARD BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context);
void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context);
BOOL wf_info_have_updates(wfInfo* wfi);
WINPR_ATTR_NODISCARD BOOL wf_info_have_updates(wfInfo* wfi);
void wf_info_update_changes(wfInfo* wfi);
void wf_info_find_invalid_region(wfInfo* wfi);
void wf_info_clear_invalid_region(wfInfo* wfi);
void wf_info_invalidate_full_screen(wfInfo* wfi);
BOOL wf_info_have_invalid_region(wfInfo* wfi);
WINPR_ATTR_NODISCARD BOOL wf_info_have_invalid_region(wfInfo* wfi);
void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, BYTE** pBits, int* pitch);
BOOL CALLBACK wf_info_monEnumCB(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor,
LPARAM dwData);
WINPR_ATTR_NODISCARD BOOL CALLBACK wf_info_monEnumCB(HMONITOR hMonitor, HDC hdcMonitor,
LPRECT lprcMonitor, LPARAM dwData);
#endif /* FREERDP_SERVER_WIN_INFO_H */

View File

@@ -22,15 +22,20 @@
#include "wf_interface.h"
BOOL wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code);
BOOL wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code);
BOOL wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
BOOL wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
WINPR_ATTR_NODISCARD BOOL wf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code);
WINPR_ATTR_NODISCARD BOOL wf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags,
UINT16 code);
WINPR_ATTR_NODISCARD BOOL wf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
WINPR_ATTR_NODISCARD BOOL wf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x,
UINT16 y);
// dummy versions
BOOL wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT8 code);
BOOL wf_peer_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT16 code);
BOOL wf_peer_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
BOOL wf_peer_extended_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y);
WINPR_ATTR_NODISCARD BOOL wf_peer_keyboard_event_dummy(rdpInput* input, UINT16 flags, UINT8 code);
WINPR_ATTR_NODISCARD BOOL wf_peer_unicode_keyboard_event_dummy(rdpInput* input, UINT16 flags,
UINT16 code);
WINPR_ATTR_NODISCARD BOOL wf_peer_mouse_event_dummy(rdpInput* input, UINT16 flags, UINT16 x,
UINT16 y);
WINPR_ATTR_NODISCARD BOOL wf_peer_extended_mouse_event_dummy(rdpInput* input, UINT16 flags,
UINT16 x, UINT16 y);
#endif /* FREERDP_SERVER_WIN_INPUT_H */

View File

@@ -115,23 +115,24 @@ typedef struct wf_server wfServer;
typedef void(__stdcall* cbCallback)(int, UINT32);
FREERDP_API int get_screen_info(int id, _TCHAR* name, size_t length, int* w, int* h, int* b);
FREERDP_API WINPR_ATTR_NODISCARD int get_screen_info(int id, _TCHAR* name, size_t length, int* w,
int* h, int* b);
FREERDP_API void set_screen_id(int id);
FREERDP_API BOOL wfreerdp_server_start(wfServer* server);
FREERDP_API BOOL wfreerdp_server_stop(wfServer* server);
FREERDP_API WINPR_ATTR_NODISCARD BOOL wfreerdp_server_start(wfServer* server);
FREERDP_API WINPR_ATTR_NODISCARD BOOL wfreerdp_server_stop(wfServer* server);
FREERDP_API wfServer* wfreerdp_server_new(void);
FREERDP_API WINPR_ATTR_NODISCARD wfServer* wfreerdp_server_new(void);
FREERDP_API void wfreerdp_server_free(wfServer* server);
FREERDP_API BOOL wfreerdp_server_is_running(wfServer* server);
FREERDP_API WINPR_ATTR_NODISCARD BOOL wfreerdp_server_is_running(wfServer* server);
FREERDP_API UINT32 wfreerdp_server_num_peers(void);
FREERDP_API UINT32 wfreerdp_server_get_peer_hostname(int pId, wchar_t* dstStr);
FREERDP_API BOOL wfreerdp_server_peer_is_local(int pId);
FREERDP_API BOOL wfreerdp_server_peer_is_connected(int pId);
FREERDP_API BOOL wfreerdp_server_peer_is_activated(int pId);
FREERDP_API BOOL wfreerdp_server_peer_is_authenticated(int pId);
FREERDP_API WINPR_ATTR_NODISCARD UINT32 wfreerdp_server_num_peers(void);
FREERDP_API WINPR_ATTR_NODISCARD UINT32 wfreerdp_server_get_peer_hostname(int pId, wchar_t* dstStr);
FREERDP_API WINPR_ATTR_NODISCARD BOOL wfreerdp_server_peer_is_local(int pId);
FREERDP_API WINPR_ATTR_NODISCARD BOOL wfreerdp_server_peer_is_connected(int pId);
FREERDP_API WINPR_ATTR_NODISCARD BOOL wfreerdp_server_peer_is_activated(int pId);
FREERDP_API WINPR_ATTR_NODISCARD BOOL wfreerdp_server_peer_is_authenticated(int pId);
FREERDP_API void wfreerdp_server_register_callback_event(cbCallback cb);

View File

@@ -207,13 +207,13 @@ typedef struct
ULONG nColorBmPalEntries;
} Esc_dmf_pointer_shape_get_OUT;
BOOL wf_mirror_driver_find_display_device(wfInfo* wfi);
BOOL wf_mirror_driver_display_device_attach(wfInfo* wfi, DWORD mode);
BOOL wf_mirror_driver_update(wfInfo* wfi, int mode);
BOOL wf_mirror_driver_map_memory(wfInfo* wfi);
BOOL wf_mirror_driver_cleanup(wfInfo* wfi);
WINPR_ATTR_NODISCARD BOOL wf_mirror_driver_find_display_device(wfInfo* wfi);
WINPR_ATTR_NODISCARD BOOL wf_mirror_driver_display_device_attach(wfInfo* wfi, DWORD mode);
WINPR_ATTR_NODISCARD BOOL wf_mirror_driver_update(wfInfo* wfi, int mode);
WINPR_ATTR_NODISCARD BOOL wf_mirror_driver_map_memory(wfInfo* wfi);
WINPR_ATTR_NODISCARD BOOL wf_mirror_driver_cleanup(wfInfo* wfi);
BOOL wf_mirror_driver_activate(wfInfo* wfi);
WINPR_ATTR_NODISCARD BOOL wf_mirror_driver_activate(wfInfo* wfi);
void wf_mirror_driver_deactivate(wfInfo* wfi);
#endif /* FREERDP_SERVER_WIN_MIRAGE_H */

View File

@@ -24,6 +24,6 @@
#include <freerdp/listener.h>
BOOL wf_peer_accepted(freerdp_listener* instance, freerdp_peer* client);
WINPR_ATTR_NODISCARD BOOL wf_peer_accepted(freerdp_listener* instance, freerdp_peer* client);
#endif /* FREERDP_SERVER_WIN_PEER_H */

View File

@@ -26,8 +26,8 @@
#include "wf_interface.h"
int wf_rdpsnd_lock(void);
int wf_rdpsnd_unlock(void);
BOOL wf_peer_rdpsnd_init(wfPeerContext* context);
WINPR_ATTR_NODISCARD int wf_rdpsnd_lock(void);
WINPR_ATTR_NODISCARD int wf_rdpsnd_unlock(void);
WINPR_ATTR_NODISCARD BOOL wf_peer_rdpsnd_init(wfPeerContext* context);
#endif /* FREERDP_SERVER_WIN_RDPSND_H */

View File

@@ -22,7 +22,9 @@
#include "wf_interface.h"
BOOL wf_settings_read_dword(HKEY key, LPCSTR subkey, LPTSTR name, DWORD* value);
BOOL wf_settings_read_string_ascii(HKEY key, LPCSTR subkey, LPTSTR name, char** value);
WINPR_ATTR_NODISCARD BOOL wf_settings_read_dword(HKEY key, LPCSTR subkey, LPTSTR name,
DWORD* value);
WINPR_ATTR_NODISCARD BOOL wf_settings_read_string_ascii(HKEY key, LPCSTR subkey, LPTSTR name,
char** value);
#endif /* FREERDP_SERVER_WIN_SETTINGS_H */

View File

@@ -25,7 +25,7 @@
void wf_update_encode(wfInfo* wfi);
void wf_update_send(wfInfo* wfi);
DWORD WINAPI wf_update_thread(LPVOID lpParam);
WINPR_ATTR_NODISCARD DWORD WINAPI wf_update_thread(LPVOID lpParam);
void wf_update_begin(wfInfo* wfi);
void wf_update_peer_send(wfInfo* wfi, wfPeerContext* context);

View File

@@ -4,12 +4,12 @@
#include <freerdp/server/rdpsnd.h>
#include "wf_interface.h"
int wf_rdpsnd_set_latest_peer(wfPeerContext* peer);
WINPR_ATTR_NODISCARD int wf_rdpsnd_set_latest_peer(wfPeerContext* peer);
int wf_wasapi_activate(RdpsndServerContext* context);
WINPR_ATTR_NODISCARD int wf_wasapi_activate(RdpsndServerContext* context);
int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR* deviceStr);
WINPR_ATTR_NODISCARD int wf_wasapi_get_device_string(LPWSTR pattern, LPWSTR* deviceStr);
DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam);
WINPR_ATTR_NODISCARD DWORD WINAPI wf_rdpsnd_wasapi_thread(LPVOID lpParam);
#endif /* FREERDP_SERVER_WIN_WASAPI_H */

View File

@@ -112,6 +112,7 @@ static const char* openstatus2str(PfDynChannelOpenStatus status)
dyn_log_((log), (level), (dynChannel), (cmd), (isBackData), __func__, __FILE__, __LINE__, \
__VA_ARGS__)
WINPR_ATTR_NODISCARD
static const char* getDirection(BOOL isBackData)
{
return isBackData ? "B->F" : "F->B";
@@ -145,6 +146,7 @@ static void dyn_log_(wLog* log, DWORD level, const pServerDynamicChannelContext*
free(msg);
}
WINPR_ATTR_NODISCARD
static PfChannelResult data_cb(pServerContext* ps, pServerDynamicChannelContext* channel,
BOOL isBackData, ChannelStateTracker* tracker, BOOL firstPacket,
BOOL lastPacket)
@@ -174,6 +176,27 @@ static PfChannelResult data_cb(pServerContext* ps, pServerDynamicChannelContext*
return dyn.result;
}
static void DynamicChannelContext_free(void* ptr)
{
pServerDynamicChannelContext* c = (pServerDynamicChannelContext*)ptr;
if (!c)
return;
if (c->backTracker.currentPacket)
Stream_Free(c->backTracker.currentPacket, TRUE);
if (c->frontTracker.currentPacket)
Stream_Free(c->frontTracker.currentPacket, TRUE);
if (c->channelDataDtor)
c->channelDataDtor(&c->channelData);
free(c->channelName);
free(c);
}
WINPR_ATTR_MALLOC(DynamicChannelContext_free, 1)
WINPR_ATTR_NODISCARD
static pServerDynamicChannelContext* DynamicChannelContext_new(wLog* log, pServerContext* ps,
const char* name, UINT32 id)
{
@@ -210,31 +233,14 @@ static pServerDynamicChannelContext* DynamicChannelContext_new(wLog* log, pServe
return ret;
}
static void DynamicChannelContext_free(void* ptr)
{
pServerDynamicChannelContext* c = (pServerDynamicChannelContext*)ptr;
if (!c)
return;
if (c->backTracker.currentPacket)
Stream_Free(c->backTracker.currentPacket, TRUE);
if (c->frontTracker.currentPacket)
Stream_Free(c->frontTracker.currentPacket, TRUE);
if (c->channelDataDtor)
c->channelDataDtor(&c->channelData);
free(c->channelName);
free(c);
}
WINPR_ATTR_NODISCARD
static UINT32 ChannelId_Hash(const void* key)
{
const UINT32* v = (const UINT32*)key;
return *v;
}
WINPR_ATTR_NODISCARD
static BOOL ChannelId_Compare(const void* objA, const void* objB)
{
const UINT32* v1 = objA;
@@ -242,6 +248,7 @@ static BOOL ChannelId_Compare(const void* objA, const void* objB)
return (*v1 == *v2);
}
WINPR_ATTR_NODISCARD
static DynvcReadResult dynvc_read_varInt(wLog* log, wStream* s, size_t len, UINT64* varInt,
BOOL last)
{
@@ -271,6 +278,7 @@ static DynvcReadResult dynvc_read_varInt(wLog* log, wStream* s, size_t len, UINT
return DYNCVC_READ_OK;
}
WINPR_ATTR_NODISCARD
static PfChannelResult DynvcTrackerPeekHandleByMode(ChannelStateTracker* tracker,
DynChannelTrackerState* trackerState,
pServerDynamicChannelContext* dynChannel,
@@ -332,6 +340,7 @@ static PfChannelResult DynvcTrackerPeekHandleByMode(ChannelStateTracker* tracker
return result;
}
WINPR_ATTR_NODISCARD
static PfChannelResult DynvcTrackerHandleClose(ChannelStateTracker* tracker,
pServerDynamicChannelContext* dynChannel,
DynChannelContext* dynChannelContext,
@@ -358,6 +367,7 @@ static PfChannelResult DynvcTrackerHandleClose(ChannelStateTracker* tracker,
return channelTracker_flushCurrent(tracker, firstPacket, lastPacket, !isBackData);
}
WINPR_ATTR_NODISCARD
static PfChannelResult DynvcTrackerHandleCreateBack(ChannelStateTracker* tracker, wStream* s,
DWORD flags, proxyData* pdata,
pServerDynamicChannelContext* dynChannel,
@@ -431,6 +441,7 @@ static PfChannelResult DynvcTrackerHandleCreateBack(ChannelStateTracker* tracker
return channelTracker_flushCurrent(tracker, firstPacket, lastPacket, FALSE);
}
WINPR_ATTR_NODISCARD
static PfChannelResult DynvcTrackerHandleCreateFront(ChannelStateTracker* tracker, wStream* s,
DWORD flags,
WINPR_ATTR_UNUSED proxyData* pdata,
@@ -458,6 +469,7 @@ static PfChannelResult DynvcTrackerHandleCreateFront(ChannelStateTracker* tracke
return channelTracker_flushCurrent(tracker, firstPacket, lastPacket, TRUE);
}
WINPR_ATTR_NODISCARD
static PfChannelResult DynvcTrackerHandleCreate(ChannelStateTracker* tracker, wStream* s,
DWORD flags,
pServerDynamicChannelContext* dynChannel,
@@ -488,6 +500,7 @@ static PfChannelResult DynvcTrackerHandleCreate(ChannelStateTracker* tracker, wS
dynChannelId);
}
WINPR_ATTR_NODISCARD
static PfChannelResult DynvcTrackerHandleCmdDATA(ChannelStateTracker* tracker,
pServerDynamicChannelContext* dynChannel,
wStream* s, BYTE cmd, UINT64 Length,
@@ -622,6 +635,7 @@ static PfChannelResult DynvcTrackerHandleCmdDATA(ChannelStateTracker* tracker,
lastPacket);
}
WINPR_ATTR_NODISCARD
static PfChannelResult DynvcTrackerHandleCmd(ChannelStateTracker* tracker,
pServerDynamicChannelContext* dynChannel, wStream* s,
BYTE cmd, UINT32 flags, UINT64 Length,
@@ -684,6 +698,7 @@ static PfChannelResult DynvcTrackerHandleCmd(ChannelStateTracker* tracker,
}
}
WINPR_ATTR_NODISCARD
static PfChannelResult DynvcTrackerPeekFn(ChannelStateTracker* tracker, BOOL firstPacket,
BOOL lastPacket)
{
@@ -805,6 +820,7 @@ static void DynChannelContext_free(void* context)
free(c);
}
WINPR_ATTR_NODISCARD
static const char* dynamic_context(void* arg)
{
proxyData* pdata = arg;
@@ -813,6 +829,8 @@ static const char* dynamic_context(void* arg)
return pdata->session_id;
}
WINPR_ATTR_MALLOC(DynChannelContext_free, 1)
WINPR_ATTR_NODISCARD
static DynChannelContext* DynChannelContext_new(proxyData* pdata,
pServerStaticChannelContext* channel)
{
@@ -862,6 +880,7 @@ fail:
return NULL;
}
WINPR_ATTR_NODISCARD
static PfChannelResult pf_dynvc_back_data(proxyData* pdata,
const pServerStaticChannelContext* channel,
const BYTE* xdata, size_t xsize, UINT32 flags,
@@ -876,6 +895,7 @@ static PfChannelResult pf_dynvc_back_data(proxyData* pdata,
return channelTracker_update(dyn->backTracker, xdata, xsize, flags, totalSize);
}
WINPR_ATTR_NODISCARD
static PfChannelResult pf_dynvc_front_data(proxyData* pdata,
const pServerStaticChannelContext* channel,
const BYTE* xdata, size_t xsize, UINT32 flags,

View File

@@ -21,6 +21,7 @@
#include <freerdp/server/proxy/proxy_context.h>
BOOL pf_channel_setup_drdynvc(proxyData* pdata, pServerStaticChannelContext* channel);
WINPR_ATTR_NODISCARD BOOL pf_channel_setup_drdynvc(proxyData* pdata,
pServerStaticChannelContext* channel);
#endif /* SERVER_PROXY_CHANNELS_PF_CHANNEL_DRDYNVC_H_ */

View File

@@ -143,6 +143,7 @@ typedef struct
__FILE__, (size_t)__LINE__)
#define Stream_CheckAndLogRequiredLengthRx(srv, log, s, len) \
Stream_CheckAndLogRequiredLengthRx_(srv, log, s, len, 1, __func__, __FILE__, __LINE__)
WINPR_ATTR_NODISCARD
static BOOL Stream_CheckAndLogRequiredLengthRx_(BOOL srv, wLog* log, wStream* s, size_t nmemb,
size_t size, const char* fkt, const char* file,
size_t line)
@@ -154,6 +155,7 @@ static BOOL Stream_CheckAndLogRequiredLengthRx_(BOOL srv, wLog* log, wStream* s,
line);
}
WINPR_ATTR_NODISCARD
static const char* rdpdr_server_state_to_string(pf_channel_server_state state)
{
switch (state)
@@ -173,6 +175,7 @@ static const char* rdpdr_server_state_to_string(pf_channel_server_state state)
}
}
WINPR_ATTR_NODISCARD
static const char* rdpdr_client_state_to_string(pf_channel_client_state state)
{
switch (state)
@@ -190,6 +193,7 @@ static const char* rdpdr_client_state_to_string(pf_channel_client_state state)
}
}
WINPR_ATTR_NODISCARD
static wStream* rdpdr_get_send_buffer(pf_channel_common_context* rdpdr, UINT16 component,
UINT16 PacketID, size_t capacity)
{
@@ -204,6 +208,7 @@ static wStream* rdpdr_get_send_buffer(pf_channel_common_context* rdpdr, UINT16 c
return rdpdr->s;
}
WINPR_ATTR_NODISCARD
static wStream* rdpdr_client_get_send_buffer(pf_channel_client_context* rdpdr, UINT16 component,
UINT16 PacketID, size_t capacity)
{
@@ -211,6 +216,7 @@ static wStream* rdpdr_client_get_send_buffer(pf_channel_client_context* rdpdr, U
return rdpdr_get_send_buffer(&rdpdr->common, component, PacketID, capacity);
}
WINPR_ATTR_NODISCARD
static wStream* rdpdr_server_get_send_buffer(pf_channel_server_context* rdpdr, UINT16 component,
UINT16 PacketID, size_t capacity)
{
@@ -218,6 +224,7 @@ static wStream* rdpdr_server_get_send_buffer(pf_channel_server_context* rdpdr, U
return rdpdr_get_send_buffer(&rdpdr->common, component, PacketID, capacity);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_client_send(wLog* log, pClientContext* pc, wStream* s)
{
UINT16 channelId = 0;
@@ -249,6 +256,7 @@ static UINT rdpdr_client_send(wLog* log, pClientContext* pc, wStream* s)
return CHANNEL_RC_OK;
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_seal_send_free_request(pf_channel_server_context* context, wStream* s)
{
BOOL status = 0;
@@ -267,6 +275,7 @@ static UINT rdpdr_seal_send_free_request(pf_channel_server_context* context, wSt
return (status) ? CHANNEL_RC_OK : ERROR_INTERNAL_ERROR;
}
WINPR_ATTR_NODISCARD
static BOOL rdpdr_process_server_header(BOOL server, wLog* log, wStream* s, UINT16 component,
UINT16 PacketId, size_t expect)
{
@@ -314,6 +323,7 @@ static BOOL rdpdr_process_server_header(BOOL server, wLog* log, wStream* s, UINT
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL rdpdr_check_version(BOOL server, wLog* log, UINT16 versionMajor, UINT16 versionMinor,
UINT16 component, UINT16 PacketId)
{
@@ -343,6 +353,7 @@ static BOOL rdpdr_check_version(BOOL server, wLog* log, UINT16 versionMajor, UIN
return TRUE;
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_server_announce_request(pf_channel_client_context* rdpdr, wStream* s)
{
const UINT16 component = RDPDR_CTYP_CORE;
@@ -373,6 +384,7 @@ static UINT rdpdr_process_server_announce_request(pf_channel_client_context* rdp
return CHANNEL_RC_OK;
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_server_send_announce_request(pf_channel_server_context* context)
{
wStream* s =
@@ -386,6 +398,7 @@ static UINT rdpdr_server_send_announce_request(pf_channel_server_context* contex
return rdpdr_seal_send_free_request(context, s);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_client_announce_reply(pf_channel_server_context* rdpdr, wStream* s)
{
const UINT16 component = RDPDR_CTYP_CORE;
@@ -430,6 +443,7 @@ static UINT rdpdr_process_client_announce_reply(pf_channel_server_context* rdpdr
return CHANNEL_RC_OK;
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_send_client_announce_reply(pClientContext* pc, pf_channel_client_context* rdpdr)
{
wStream* s =
@@ -443,6 +457,7 @@ static UINT rdpdr_send_client_announce_reply(pClientContext* pc, pf_channel_clie
return rdpdr_client_send(rdpdr->log, pc, s);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_client_name_request(pf_channel_server_context* rdpdr, wStream* s,
pClientContext* pc)
{
@@ -489,6 +504,7 @@ static UINT rdpdr_process_client_name_request(pf_channel_server_context* rdpdr,
return CHANNEL_RC_OK;
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_send_client_name_request(pClientContext* pc, pf_channel_client_context* rdpdr)
{
wStream* s = NULL;
@@ -521,6 +537,7 @@ static UINT rdpdr_send_client_name_request(pClientContext* pc, pf_channel_client
#define rdpdr_ignore_capset(srv, log, s, header) \
rdpdr_ignore_capset_((srv), (log), (s), header, __func__)
WINPR_ATTR_NODISCARD
static UINT rdpdr_ignore_capset_(WINPR_ATTR_UNUSED BOOL srv, WINPR_ATTR_UNUSED wLog* log,
wStream* s, const RDPDR_CAPABILITY_HEADER* header,
WINPR_ATTR_UNUSED const char* fkt)
@@ -532,6 +549,7 @@ static UINT rdpdr_ignore_capset_(WINPR_ATTR_UNUSED BOOL srv, WINPR_ATTR_UNUSED w
return CHANNEL_RC_OK;
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_client_process_general_capset(pf_channel_client_context* rdpdr, wStream* s,
const RDPDR_CAPABILITY_HEADER* header)
{
@@ -539,6 +557,7 @@ static UINT rdpdr_client_process_general_capset(pf_channel_client_context* rdpdr
return rdpdr_ignore_capset(FALSE, rdpdr->log, s, header);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_printer_capset(pf_channel_client_context* rdpdr, wStream* s,
const RDPDR_CAPABILITY_HEADER* header)
{
@@ -546,6 +565,7 @@ static UINT rdpdr_process_printer_capset(pf_channel_client_context* rdpdr, wStre
return rdpdr_ignore_capset(FALSE, rdpdr->log, s, header);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_port_capset(pf_channel_client_context* rdpdr, wStream* s,
const RDPDR_CAPABILITY_HEADER* header)
{
@@ -553,6 +573,7 @@ static UINT rdpdr_process_port_capset(pf_channel_client_context* rdpdr, wStream*
return rdpdr_ignore_capset(FALSE, rdpdr->log, s, header);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_drive_capset(pf_channel_client_context* rdpdr, wStream* s,
const RDPDR_CAPABILITY_HEADER* header)
{
@@ -560,6 +581,7 @@ static UINT rdpdr_process_drive_capset(pf_channel_client_context* rdpdr, wStream
return rdpdr_ignore_capset(FALSE, rdpdr->log, s, header);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_smartcard_capset(pf_channel_client_context* rdpdr, wStream* s,
const RDPDR_CAPABILITY_HEADER* header)
{
@@ -567,6 +589,7 @@ static UINT rdpdr_process_smartcard_capset(pf_channel_client_context* rdpdr, wSt
return rdpdr_ignore_capset(FALSE, rdpdr->log, s, header);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_server_core_capability_request(pf_channel_client_context* rdpdr,
wStream* s)
{
@@ -638,6 +661,7 @@ static UINT rdpdr_process_server_core_capability_request(pf_channel_client_conte
return CHANNEL_RC_OK;
}
WINPR_ATTR_NODISCARD
static BOOL rdpdr_write_general_capset(wLog* log, pf_channel_common_context* rdpdr, wStream* s)
{
WINPR_ASSERT(rdpdr);
@@ -662,6 +686,7 @@ static BOOL rdpdr_write_general_capset(wLog* log, pf_channel_common_context* rdp
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL rdpdr_write_printer_capset(wLog* log, pf_channel_common_context* rdpdr, wStream* s)
{
WINPR_ASSERT(rdpdr);
@@ -674,6 +699,7 @@ static BOOL rdpdr_write_printer_capset(wLog* log, pf_channel_common_context* rdp
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL rdpdr_write_port_capset(wLog* log, pf_channel_common_context* rdpdr, wStream* s)
{
WINPR_ASSERT(rdpdr);
@@ -686,6 +712,7 @@ static BOOL rdpdr_write_port_capset(wLog* log, pf_channel_common_context* rdpdr,
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL rdpdr_write_drive_capset(wLog* log, pf_channel_common_context* rdpdr, wStream* s)
{
WINPR_ASSERT(rdpdr);
@@ -698,6 +725,7 @@ static BOOL rdpdr_write_drive_capset(wLog* log, pf_channel_common_context* rdpdr
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL rdpdr_write_smartcard_capset(wLog* log, pf_channel_common_context* rdpdr, wStream* s)
{
WINPR_ASSERT(rdpdr);
@@ -710,6 +738,7 @@ static BOOL rdpdr_write_smartcard_capset(wLog* log, pf_channel_common_context* r
return TRUE;
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_send_server_capability_request(pf_channel_server_context* rdpdr)
{
wStream* s =
@@ -731,6 +760,7 @@ static UINT rdpdr_send_server_capability_request(pf_channel_server_context* rdpd
return rdpdr_seal_send_free_request(rdpdr, s);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_client_capability_response(pf_channel_server_context* rdpdr, wStream* s)
{
const UINT16 component = RDPDR_CTYP_CORE;
@@ -800,6 +830,7 @@ static UINT rdpdr_process_client_capability_response(pf_channel_server_context*
return status;
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_send_client_capability_response(pClientContext* pc,
pf_channel_client_context* rdpdr)
{
@@ -825,6 +856,7 @@ static UINT rdpdr_send_client_capability_response(pClientContext* pc,
return rdpdr_client_send(rdpdr->log, pc, s);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_send_server_clientid_confirm(pf_channel_server_context* rdpdr)
{
wStream* s = NULL;
@@ -838,6 +870,7 @@ static UINT rdpdr_send_server_clientid_confirm(pf_channel_server_context* rdpdr)
return rdpdr_seal_send_free_request(rdpdr, s);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_server_clientid_confirm(pf_channel_client_context* rdpdr, wStream* s)
{
UINT16 versionMajor = 0;
@@ -886,6 +919,7 @@ static UINT rdpdr_process_server_clientid_confirm(pf_channel_client_context* rdp
return CHANNEL_RC_OK;
}
WINPR_ATTR_NODISCARD
static BOOL
rdpdr_process_server_capability_request_or_clientid_confirm(pf_channel_client_context* rdpdr,
wStream* s)
@@ -943,6 +977,7 @@ rdpdr_process_server_capability_request_or_clientid_confirm(pf_channel_client_co
}
#if defined(WITH_PROXY_EMULATE_SMARTCARD)
WINPR_ATTR_NODISCARD
static UINT rdpdr_send_emulated_scard_device_list_announce_request(pClientContext* pc,
pf_channel_client_context* rdpdr)
{
@@ -963,6 +998,7 @@ static UINT rdpdr_send_emulated_scard_device_list_announce_request(pClientContex
return rdpdr_client_send(rdpdr->log, pc, s);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_send_emulated_scard_device_remove(pClientContext* pc,
pf_channel_client_context* rdpdr)
{
@@ -979,6 +1015,7 @@ static UINT rdpdr_send_emulated_scard_device_remove(pClientContext* pc,
return rdpdr_client_send(rdpdr->log, pc, s);
}
WINPR_ATTR_NODISCARD
static UINT rdpdr_process_server_device_announce_response(pf_channel_client_context* rdpdr,
wStream* s)
{
@@ -1021,6 +1058,7 @@ static UINT rdpdr_process_server_device_announce_response(pf_channel_client_cont
}
#endif
WINPR_ATTR_NODISCARD
static BOOL pf_channel_rdpdr_rewrite_device_list_to(wStream* s, UINT32 fromVersion,
UINT32 toVersion)
{
@@ -1108,6 +1146,7 @@ fail:
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_channel_rdpdr_rewrite_device_list(pf_channel_client_context* rdpdr,
pServerContext* ps, wStream* s, BOOL toServer)
{
@@ -1152,6 +1191,7 @@ static BOOL pf_channel_rdpdr_rewrite_device_list(pf_channel_client_context* rdpd
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_channel_rdpdr_client_send_to_server(pf_channel_client_context* rdpdr,
pServerContext* ps, wStream* s)
{
@@ -1179,9 +1219,11 @@ static BOOL pf_channel_rdpdr_client_send_to_server(pf_channel_client_context* rd
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_channel_send_client_queue(pClientContext* pc, pf_channel_client_context* rdpdr);
#if defined(WITH_PROXY_EMULATE_SMARTCARD)
WINPR_ATTR_NODISCARD
static BOOL rdpdr_process_server_loggedon_request(pServerContext* ps, pClientContext* pc,
pf_channel_client_context* rdpdr, wStream* s,
UINT16 component, UINT16 packetid)
@@ -1196,6 +1238,7 @@ static BOOL rdpdr_process_server_loggedon_request(pServerContext* ps, pClientCon
return pf_channel_rdpdr_client_send_to_server(rdpdr, ps, s);
}
WINPR_ATTR_NODISCARD
static BOOL filter_smartcard_io_requests(pf_channel_client_context* rdpdr, wStream* s,
UINT16* pPacketid)
{
@@ -1266,14 +1309,14 @@ fail:
BOOL pf_channel_send_client_queue(pClientContext* pc, pf_channel_client_context* rdpdr)
{
UINT16 channelId = 0;
WINPR_ASSERT(pc);
WINPR_ASSERT(rdpdr);
if (rdpdr->state != STATE_CLIENT_CHANNEL_RUNNING)
return FALSE;
channelId = freerdp_channels_get_id_by_name(pc->context.instance, RDPDR_SVC_CHANNEL_NAME);
const UINT16 channelId =
freerdp_channels_get_id_by_name(pc->context.instance, RDPDR_SVC_CHANNEL_NAME);
if ((channelId == 0) || (channelId == UINT16_MAX))
return TRUE;
@@ -1300,6 +1343,7 @@ BOOL pf_channel_send_client_queue(pClientContext* pc, pf_channel_client_context*
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL rdpdr_handle_server_announce_request(pClientContext* pc,
pf_channel_client_context* rdpdr, wStream* s)
{
@@ -1397,7 +1441,8 @@ BOOL pf_channel_rdpdr_client_handle(pClientContext* pc, UINT16 channelId, const
#endif
{
rdpdr->state = STATE_CLIENT_CHANNEL_RUNNING;
pf_channel_send_client_queue(pc, rdpdr);
if (!pf_channel_send_client_queue(pc, rdpdr))
return FALSE;
}
break;
@@ -1485,6 +1530,7 @@ static void pf_channel_rdpdr_client_context_free(InterceptContextMapEntry* base)
free(entry);
}
WINPR_ATTR_NODISCARD
static BOOL pf_channel_rdpdr_common_context_new(pf_channel_common_context* common,
void (*fkt)(InterceptContextMapEntry*))
{
@@ -1514,6 +1560,7 @@ static BOOL pf_channel_rdpdr_common_context_new(pf_channel_common_context* commo
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_channel_rdpdr_client_pass_message(pServerContext* ps, pClientContext* pc,
WINPR_ATTR_UNUSED UINT16 channelId,
const char* channel_name, wStream* s)
@@ -1532,11 +1579,11 @@ static BOOL pf_channel_rdpdr_client_pass_message(pServerContext* ps, pClientCont
return FALSE;
if (!Queue_Enqueue(rdpdr->queue, s))
return FALSE;
pf_channel_send_client_queue(pc, rdpdr);
return TRUE;
return pf_channel_send_client_queue(pc, rdpdr);
}
#if defined(WITH_PROXY_EMULATE_SMARTCARD)
WINPR_ATTR_NODISCARD
static BOOL filter_smartcard_device_list_remove(pf_channel_server_context* rdpdr, wStream* s)
{
size_t pos = 0;
@@ -1580,6 +1627,7 @@ static BOOL filter_smartcard_device_list_remove(pf_channel_server_context* rdpdr
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL filter_smartcard_device_io_request(pf_channel_server_context* rdpdr, wStream* s)
{
UINT32 DeviceID = 0;
@@ -1589,6 +1637,7 @@ static BOOL filter_smartcard_device_io_request(pf_channel_server_context* rdpdr,
return ArrayList_Contains(rdpdr->blockedDevices, (void*)(size_t)DeviceID);
}
WINPR_ATTR_NODISCARD
static BOOL filter_smartcard_device_list_announce(pf_channel_server_context* rdpdr, wStream* s)
{
UINT32 count = 0;
@@ -1636,6 +1685,7 @@ static BOOL filter_smartcard_device_list_announce(pf_channel_server_context* rdp
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL filter_smartcard_device_list_announce_request(pf_channel_server_context* rdpdr,
wStream* s)
{
@@ -1692,6 +1742,8 @@ fail:
}
#endif
WINPR_ATTR_MALLOC(Stream_Free, 1)
WINPR_ATTR_NODISCARD
static void* stream_copy(const void* obj)
{
const wStream* src = obj;
@@ -1710,6 +1762,7 @@ static void stream_free(void* obj)
Stream_Free(s, TRUE);
}
WINPR_ATTR_NODISCARD
static const char* pf_channel_rdpdr_client_context(void* arg)
{
pClientContext* pc = arg;
@@ -1777,6 +1830,7 @@ static void pf_channel_rdpdr_server_context_free(InterceptContextMapEntry* base)
free(entry);
}
WINPR_ATTR_NODISCARD
static const char* pf_channel_rdpdr_server_context(void* arg)
{
pServerContext* ps = arg;
@@ -1839,6 +1893,7 @@ void pf_channel_rdpdr_server_free(pServerContext* ps)
HashTable_Remove(ps->interceptContextMap, RDPDR_SVC_CHANNEL_NAME);
}
WINPR_ATTR_NODISCARD
static pf_channel_server_context* get_channel(pServerContext* ps, BOOL send)
{
pf_channel_server_context* rdpdr = NULL;
@@ -1972,6 +2027,7 @@ BOOL pf_channel_rdpdr_client_reset(pClientContext* pc)
return TRUE;
}
WINPR_ATTR_NODISCARD
static PfChannelResult pf_rdpdr_back_data(proxyData* pdata,
const pServerStaticChannelContext* channel,
const BYTE* xdata, size_t xsize, UINT32 flags,
@@ -1992,6 +2048,7 @@ static PfChannelResult pf_rdpdr_back_data(proxyData* pdata,
return PF_CHANNEL_RESULT_DROP;
}
WINPR_ATTR_NODISCARD
static PfChannelResult pf_rdpdr_front_data(proxyData* pdata,
const pServerStaticChannelContext* channel,
const BYTE* xdata, size_t xsize, UINT32 flags,

View File

@@ -23,25 +23,28 @@
#include <freerdp/server/proxy/proxy_context.h>
BOOL pf_channel_setup_rdpdr(pServerContext* ps, pServerStaticChannelContext* channel);
WINPR_ATTR_NODISCARD BOOL pf_channel_setup_rdpdr(pServerContext* ps,
pServerStaticChannelContext* channel);
void pf_channel_rdpdr_client_free(pClientContext* pc);
BOOL pf_channel_rdpdr_client_new(pClientContext* pc);
WINPR_ATTR_NODISCARD BOOL pf_channel_rdpdr_client_new(pClientContext* pc);
BOOL pf_channel_rdpdr_client_reset(pClientContext* pc);
BOOL pf_channel_rdpdr_client_handle(pClientContext* pc, UINT16 channelId, const char* channel_name,
const BYTE* xdata, size_t xsize, UINT32 flags,
size_t totalSize);
WINPR_ATTR_NODISCARD BOOL pf_channel_rdpdr_client_handle(pClientContext* pc, UINT16 channelId,
const char* channel_name,
const BYTE* xdata, size_t xsize,
UINT32 flags, size_t totalSize);
void pf_channel_rdpdr_server_free(pServerContext* ps);
BOOL pf_channel_rdpdr_server_new(pServerContext* ps);
WINPR_ATTR_NODISCARD BOOL pf_channel_rdpdr_server_new(pServerContext* ps);
BOOL pf_channel_rdpdr_server_announce(pServerContext* ps);
BOOL pf_channel_rdpdr_server_handle(pServerContext* ps, UINT16 channelId, const char* channel_name,
const BYTE* xdata, size_t xsize, UINT32 flags,
size_t totalSize);
WINPR_ATTR_NODISCARD BOOL pf_channel_rdpdr_server_announce(pServerContext* ps);
WINPR_ATTR_NODISCARD BOOL pf_channel_rdpdr_server_handle(pServerContext* ps, UINT16 channelId,
const char* channel_name,
const BYTE* xdata, size_t xsize,
UINT32 flags, size_t totalSize);
#endif /* FREERDP_SERVER_PROXY_RDPDR_H */

View File

@@ -58,6 +58,7 @@ typedef struct
pf_scard_send_fkt_t send_fkt;
} pf_channel_client_queue_element;
WINPR_ATTR_NODISCARD
static pf_channel_client_context* scard_get_client_context(pClientContext* pc)
{
pf_channel_client_context* scard = NULL;
@@ -71,6 +72,7 @@ static pf_channel_client_context* scard_get_client_context(pClientContext* pc)
return scard;
}
WINPR_ATTR_NODISCARD
static BOOL pf_channel_client_write_iostatus(wStream* out, const SMARTCARD_OPERATION* op,
NTSTATUS ioStatus)
{
@@ -111,6 +113,9 @@ struct thread_arg
};
static void queue_free(void* obj);
WINPR_ATTR_MALLOC(queue_free, 1)
WINPR_ATTR_NODISCARD
static void* queue_copy(const void* obj);
static VOID irp_thread(WINPR_ATTR_UNUSED PTP_CALLBACK_INSTANCE Instance, PVOID Context,
@@ -133,6 +138,7 @@ static VOID irp_thread(WINPR_ATTR_UNUSED PTP_CALLBACK_INSTANCE Instance, PVOID C
ArrayList_Remove(scard->workObjects, Work);
}
WINPR_ATTR_NODISCARD
static BOOL start_irp_thread(pf_channel_client_context* scard,
const pf_channel_client_queue_element* e)
{
@@ -308,6 +314,8 @@ static void queue_free(void* obj)
free(element);
}
WINPR_ATTR_MALLOC(queue_free, 1)
WINPR_ATTR_NODISCARD
static void* queue_copy(const void* obj)
{
const pf_channel_client_queue_element* other = obj;

View File

@@ -26,14 +26,15 @@
typedef UINT (*pf_scard_send_fkt_t)(wLog* log, pClientContext*, wStream*);
BOOL pf_channel_smartcard_client_new(pClientContext* pc);
WINPR_ATTR_NODISCARD BOOL pf_channel_smartcard_client_new(pClientContext* pc);
void pf_channel_smartcard_client_free(pClientContext* pc);
BOOL pf_channel_smartcard_client_reset(pClientContext* pc);
BOOL pf_channel_smartcard_client_emulate(pClientContext* pc);
WINPR_ATTR_NODISCARD BOOL pf_channel_smartcard_client_emulate(pClientContext* pc);
BOOL pf_channel_smartcard_client_handle(wLog* log, pClientContext* pc, wStream* s, wStream* out,
pf_scard_send_fkt_t fkt);
BOOL pf_channel_smartcard_server_handle(pServerContext* ps, wStream* s);
WINPR_ATTR_NODISCARD BOOL pf_channel_smartcard_client_handle(wLog* log, pClientContext* pc,
wStream* s, wStream* out,
pf_scard_send_fkt_t fkt);
WINPR_ATTR_NODISCARD BOOL pf_channel_smartcard_server_handle(pServerContext* ps, wStream* s);
#endif /* FREERDP_SERVER_PROXY_SCARD_H */

View File

@@ -35,6 +35,7 @@
static proxyServer* server = NULL;
#if defined(_WIN32)
WINPR_ATTR_NODISCARD
static const char* strsignal(int signum)
{
switch (signum)
@@ -83,12 +84,14 @@ static int usage(const char* app)
return 0;
}
WINPR_ATTR_NODISCARD
static int version(const char* app)
{
printf("%s version %s", app, freerdp_get_version_string());
return 0;
}
WINPR_ATTR_NODISCARD
static int buildconfig(WINPR_ATTR_UNUSED const char* app)
{
printf("This is FreeRDP version %s (%s)\n", FREERDP_VERSION_FULL, FREERDP_GIT_REVISION);

View File

@@ -41,6 +41,7 @@ struct sChannelStateTracker
proxyData* pdata;
};
WINPR_ATTR_NODISCARD
static BOOL channelTracker_resetCurrentPacket(ChannelStateTracker* tracker)
{
WINPR_ASSERT(tracker);
@@ -224,6 +225,7 @@ PfChannelResult channelTracker_flushCurrent(ChannelStateTracker* t, BOOL first,
return r ? PF_CHANNEL_RESULT_DROP : PF_CHANNEL_RESULT_ERROR;
}
WINPR_ATTR_NODISCARD
static PfChannelResult pf_channel_generic_back_data(proxyData* pdata,
const pServerStaticChannelContext* channel,
const BYTE* xdata, size_t xsize, UINT32 flags,
@@ -258,6 +260,7 @@ static PfChannelResult pf_channel_generic_back_data(proxyData* pdata,
}
}
WINPR_ATTR_NODISCARD
static PfChannelResult pf_channel_generic_front_data(proxyData* pdata,
const pServerStaticChannelContext* channel,
const BYTE* xdata, size_t xsize, UINT32 flags,

View File

@@ -41,25 +41,26 @@ ChannelStateTracker* channelTracker_new(pServerStaticChannelContext* channel,
ChannelTrackerPeekFn fn, void* data);
BOOL channelTracker_setMode(ChannelStateTracker* tracker, ChannelTrackerMode mode);
ChannelTrackerMode channelTracker_getMode(ChannelStateTracker* tracker);
WINPR_ATTR_NODISCARD ChannelTrackerMode channelTracker_getMode(ChannelStateTracker* tracker);
BOOL channelTracker_setPData(ChannelStateTracker* tracker, proxyData* pdata);
proxyData* channelTracker_getPData(ChannelStateTracker* tracker);
WINPR_ATTR_NODISCARD BOOL channelTracker_setPData(ChannelStateTracker* tracker, proxyData* pdata);
WINPR_ATTR_NODISCARD proxyData* channelTracker_getPData(ChannelStateTracker* tracker);
BOOL channelTracker_setCustomData(ChannelStateTracker* tracker, void* data);
void* channelTracker_getCustomData(ChannelStateTracker* tracker);
WINPR_ATTR_NODISCARD BOOL channelTracker_setCustomData(ChannelStateTracker* tracker, void* data);
WINPR_ATTR_NODISCARD void* channelTracker_getCustomData(ChannelStateTracker* tracker);
wStream* channelTracker_getCurrentPacket(ChannelStateTracker* tracker);
WINPR_ATTR_NODISCARD wStream* channelTracker_getCurrentPacket(ChannelStateTracker* tracker);
size_t channelTracker_getCurrentPacketSize(ChannelStateTracker* tracker);
WINPR_ATTR_NODISCARD size_t channelTracker_getCurrentPacketSize(ChannelStateTracker* tracker);
BOOL channelTracker_setCurrentPacketSize(ChannelStateTracker* tracker, size_t size);
PfChannelResult channelTracker_update(ChannelStateTracker* tracker, const BYTE* xdata, size_t xsize,
UINT32 flags, size_t totalSize);
WINPR_ATTR_NODISCARD PfChannelResult channelTracker_update(ChannelStateTracker* tracker,
const BYTE* xdata, size_t xsize,
UINT32 flags, size_t totalSize);
PfChannelResult channelTracker_flushCurrent(ChannelStateTracker* t, BOOL first, BOOL last,
BOOL toBack);
WINPR_ATTR_NODISCARD PfChannelResult channelTracker_flushCurrent(ChannelStateTracker* t, BOOL first,
BOOL last, BOOL toBack);
BOOL pf_channel_setup_generic(pServerStaticChannelContext* channel);
WINPR_ATTR_NODISCARD BOOL pf_channel_setup_generic(pServerStaticChannelContext* channel);
#endif /* SERVER_PROXY_PF_CHANNEL_H_ */

View File

@@ -52,6 +52,8 @@
#define TAG PROXY_TAG("client")
static void channel_data_free(void* obj);
WINPR_ATTR_NODISCARD
static BOOL proxy_server_reactivate(rdpContext* ps, const rdpContext* pc)
{
WINPR_ASSERT(ps);
@@ -120,6 +122,7 @@ static void pf_client_on_activated(void* ctx, WINPR_ATTR_UNUSED const ActivatedE
pf_server_register_update_callbacks(peer->context->update);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_load_rdpsnd(pClientContext* pc)
{
rdpContext* context = (rdpContext*)pc;
@@ -141,6 +144,7 @@ static BOOL pf_client_load_rdpsnd(pClientContext* pc)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_use_peer_load_balance_info(pClientContext* pc)
{
pServerContext* ps = NULL;
@@ -163,6 +167,7 @@ static BOOL pf_client_use_peer_load_balance_info(pClientContext* pc)
lb_info_len);
}
WINPR_ATTR_NODISCARD
static BOOL str_is_empty(const char* str)
{
if (!str)
@@ -172,6 +177,7 @@ static BOOL str_is_empty(const char* str)
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_use_proxy_smartcard_auth(const rdpSettings* settings)
{
BOOL enable = freerdp_settings_get_bool(settings, FreeRDP_SmartcardLogon);
@@ -190,6 +196,7 @@ static BOOL pf_client_use_proxy_smartcard_auth(const rdpSettings* settings)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_pre_connect(freerdp* instance)
{
pClientContext* pc = NULL;
@@ -301,6 +308,7 @@ typedef struct
UINT32 backId;
} UpdateBackIdArgs;
WINPR_ATTR_NODISCARD
static BOOL updateBackIdFn(WINPR_ATTR_UNUSED const void* key, void* value, void* arg)
{
pServerStaticChannelContext* current = (pServerStaticChannelContext*)value;
@@ -317,6 +325,7 @@ static BOOL updateBackIdFn(WINPR_ATTR_UNUSED const void* key, void* value, void*
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_update_back_id(pServerContext* ps, const char* name, UINT32 backId)
{
UpdateBackIdArgs res = { ps, name, backId };
@@ -324,6 +333,7 @@ static BOOL pf_client_update_back_id(pServerContext* ps, const char* name, UINT3
return HashTable_Foreach(ps->channelsByFrontId, updateBackIdFn, &res) == FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_load_channels(freerdp* instance)
{
pClientContext* pc = NULL;
@@ -419,6 +429,7 @@ static BOOL pf_client_load_channels(freerdp* instance)
return pf_modules_run_hook(pc->pdata->module, HOOK_TYPE_CLIENT_LOAD_CHANNELS, pc->pdata, pc);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channelId,
const BYTE* xdata, size_t xsize, UINT32 flags,
size_t totalSize)
@@ -467,6 +478,7 @@ static BOOL pf_client_receive_channel_data_hook(freerdp* instance, UINT16 channe
}
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_on_server_heartbeat(freerdp* instance, BYTE period, BYTE count1, BYTE count2)
{
pClientContext* pc = NULL;
@@ -482,6 +494,7 @@ static BOOL pf_client_on_server_heartbeat(freerdp* instance, BYTE period, BYTE c
return freerdp_heartbeat_send_heartbeat_pdu(ps->context.peer, period, count1, count2);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_send_channel_data(pClientContext* pc, const proxyChannelDataEventInfo* ev)
{
WINPR_ASSERT(pc);
@@ -490,6 +503,7 @@ static BOOL pf_client_send_channel_data(pClientContext* pc, const proxyChannelDa
return Queue_Enqueue(pc->cached_server_channel_data, ev);
}
WINPR_ATTR_NODISCARD
static BOOL sendQueuedChannelData(pClientContext* pc)
{
BOOL rc = TRUE;
@@ -535,6 +549,7 @@ static BOOL sendQueuedChannelData(pClientContext* pc)
* If required, register pointer callbacks to change the local mouse cursor
* when hovering over the RDP window
*/
WINPR_ATTR_NODISCARD
static BOOL pf_client_post_connect(freerdp* instance)
{
WINPR_ASSERT(instance);
@@ -567,7 +582,8 @@ static BOOL pf_client_post_connect(freerdp* instance)
pc->connected = TRUE;
/* Send cached channel data */
sendQueuedChannelData(pc);
if (!sendQueuedChannelData(pc))
return FALSE;
/*
* after the connection fully established and settings were negotiated with target server,
@@ -603,7 +619,7 @@ static void pf_client_post_disconnect(freerdp* instance)
pf_channel_rdpdr_client_free(pc);
pc->connected = FALSE;
pf_modules_run_hook(pc->pdata->module, HOOK_TYPE_CLIENT_POST_DISCONNECT, pc->pdata, pc);
(void)pf_modules_run_hook(pc->pdata->module, HOOK_TYPE_CLIENT_POST_DISCONNECT, pc->pdata, pc);
PubSub_UnsubscribeErrorInfo(instance->context->pubSub, pf_client_on_error_info);
gdi_free(instance);
@@ -613,6 +629,7 @@ static void pf_client_post_disconnect(freerdp* instance)
proxy_data_abort_connect(pdata);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_redirect(freerdp* instance)
{
if (!instance)
@@ -638,6 +655,7 @@ static BOOL pf_client_redirect(freerdp* instance)
* returns TRUE if in case of connection failure, the client should try again without NLA.
* Otherwise, returns FALSE.
*/
WINPR_ATTR_NODISCARD
static BOOL pf_client_should_retry_without_nla(pClientContext* pc)
{
rdpSettings* settings = NULL;
@@ -657,6 +675,7 @@ static BOOL pf_client_should_retry_without_nla(pClientContext* pc)
return config->ClientTlsSecurity || config->ClientRdpSecurity;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_set_security_settings(pClientContext* pc)
{
WINPR_ASSERT(pc);
@@ -689,6 +708,7 @@ static BOOL pf_client_set_security_settings(pClientContext* pc)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_connect_without_nla(pClientContext* pc)
{
freerdp* instance = NULL;
@@ -717,6 +737,7 @@ static BOOL pf_client_connect_without_nla(pClientContext* pc)
return freerdp_connect(instance);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_connect(freerdp* instance)
{
pClientContext* pc = NULL;
@@ -772,6 +793,7 @@ out:
* Connects RDP, loops while running and handles event and dispatch, cleans up
* after the connection ends.
*/
WINPR_ATTR_NODISCARD
static DWORD WINAPI pf_client_thread_proc(pClientContext* pc)
{
freerdp* instance = NULL;
@@ -845,17 +867,19 @@ static DWORD WINAPI pf_client_thread_proc(pClientContext* pc)
break;
}
sendQueuedChannelData(pc);
if (!sendQueuedChannelData(pc))
break;
}
freerdp_disconnect(instance);
end:
pf_modules_run_hook(pdata->module, HOOK_TYPE_CLIENT_UNINIT_CONNECT, pdata, pc);
(void)pf_modules_run_hook(pdata->module, HOOK_TYPE_CLIENT_UNINIT_CONNECT, pdata, pc);
return 0;
}
WINPR_ATTR_NODISCARD
static int pf_logon_error_info(freerdp* instance, UINT32 data, UINT32 type)
{
const char* str_data = freerdp_get_logon_error_info_data(data);
@@ -884,6 +908,7 @@ static void pf_client_context_free(freerdp* instance, rdpContext* context)
HashTable_Free(pc->interceptContextMap);
}
WINPR_ATTR_NODISCARD
static int pf_client_verify_X509_certificate(freerdp* instance, const BYTE* data, size_t length,
const char* hostname, UINT16 port, DWORD flags)
{
@@ -937,6 +962,8 @@ void channel_data_free(void* obj)
}
}
WINPR_ATTR_MALLOC(channel_data_free, 1)
WINPR_ATTR_NODISCARD
static void* channel_data_copy(const void* obj)
{
union
@@ -973,6 +1000,7 @@ fail:
return NULL;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_client_new(freerdp* instance, rdpContext* context)
{
wObject* obj = NULL;
@@ -1016,6 +1044,7 @@ static BOOL pf_client_client_new(freerdp* instance, rdpContext* context)
return TRUE;
}
WINPR_ATTR_NODISCARD
static int pf_client_client_stop(rdpContext* context)
{
pClientContext* pc = (pClientContext*)context;

View File

@@ -26,6 +26,6 @@
#include <winpr/wtypes.h>
int RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
DWORD WINAPI pf_client_start(LPVOID arg);
WINPR_ATTR_NODISCARD DWORD WINAPI pf_client_start(LPVOID arg);
#endif /* FREERDP_SERVER_PROXY_PFCLIENT_H */

View File

@@ -59,6 +59,8 @@
static const char* bool_str_true = "true";
static const char* bool_str_false = "false";
WINPR_ATTR_NODISCARD
static const char* boolstr(BOOL rc)
{
return rc ? bool_str_true : bool_str_false;
@@ -129,6 +131,7 @@ static char** pf_config_parse_comma_separated_list(const char* list, size_t* cou
return CommandLineParseCommaSeparatedValues(list, count);
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_get_uint16(wIniFile* ini, const char* section, const char* key,
UINT16* result, BOOL required)
{
@@ -154,6 +157,7 @@ static BOOL pf_config_get_uint16(wIniFile* ini, const char* section, const char*
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_get_uint32(wIniFile* ini, const char* section, const char* key,
UINT32* result, BOOL required)
{
@@ -178,6 +182,7 @@ static BOOL pf_config_get_uint32(wIniFile* ini, const char* section, const char*
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_get_bool(wIniFile* ini, const char* section, const char* key, BOOL fallback)
{
int num_value = 0;
@@ -204,6 +209,7 @@ static BOOL pf_config_get_bool(wIniFile* ini, const char* section, const char* k
return FALSE;
}
WINPR_ATTR_NODISCARD
static const char* pf_config_get_str(wIniFile* ini, const char* section, const char* key,
BOOL required)
{
@@ -221,6 +227,7 @@ static const char* pf_config_get_str(wIniFile* ini, const char* section, const c
return value;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_load_server(wIniFile* ini, proxyConfig* config)
{
WINPR_ASSERT(config);
@@ -241,6 +248,7 @@ static BOOL pf_config_load_server(wIniFile* ini, proxyConfig* config)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_load_target(wIniFile* ini, proxyConfig* config)
{
const char* target_value = NULL;
@@ -298,6 +306,7 @@ static BOOL pf_config_load_target(wIniFile* ini, proxyConfig* config)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_load_channels(wIniFile* ini, proxyConfig* config)
{
WINPR_ASSERT(config);
@@ -323,6 +332,7 @@ static BOOL pf_config_load_channels(wIniFile* ini, proxyConfig* config)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_load_input(wIniFile* ini, proxyConfig* config)
{
WINPR_ASSERT(config);
@@ -332,6 +342,7 @@ static BOOL pf_config_load_input(wIniFile* ini, proxyConfig* config)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_load_security(wIniFile* ini, proxyConfig* config)
{
WINPR_ASSERT(config);
@@ -353,6 +364,7 @@ static BOOL pf_config_load_security(wIniFile* ini, proxyConfig* config)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_load_modules(wIniFile* ini, proxyConfig* config)
{
const char* modules_to_load = NULL;
@@ -369,6 +381,7 @@ static BOOL pf_config_load_modules(wIniFile* ini, proxyConfig* config)
return TRUE;
}
WINPR_ATTR_NODISCARD
static char* pf_config_decode_base64(const char* data, const char* name, size_t* pLength)
{
const char* headers[] = { "-----BEGIN PUBLIC KEY-----", "-----BEGIN RSA PUBLIC KEY-----",
@@ -439,6 +452,7 @@ static char* pf_config_decode_base64(const char* data, const char* name, size_t*
return decoded;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_load_certificates(wIniFile* ini, proxyConfig* config)
{
const char* tmp1 = NULL;
@@ -921,6 +935,7 @@ const char** pf_config_modules(const proxyConfig* config)
return cnv.cppc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_copy_string(char** dst, const char* src)
{
*dst = NULL;
@@ -929,6 +944,7 @@ static BOOL pf_config_copy_string(char** dst, const char* src)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_copy_string_n(char** dst, const char* src, size_t size)
{
*dst = NULL;
@@ -945,6 +961,7 @@ static BOOL pf_config_copy_string_n(char** dst, const char* src, size_t size)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_config_copy_string_list(char*** dst, size_t* size, char** src, size_t srcSize)
{
WINPR_ASSERT(dst);
@@ -1040,6 +1057,7 @@ static const char config_plugin_name[] = "config";
static const char config_plugin_desc[] =
"A plugin filtering according to proxy configuration file rules";
WINPR_ATTR_NODISCARD
static BOOL config_plugin_unload(proxyPlugin* plugin)
{
WINPR_ASSERT(plugin);
@@ -1054,6 +1072,7 @@ static BOOL config_plugin_unload(proxyPlugin* plugin)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL config_plugin_keyboard_event(proxyPlugin* plugin, WINPR_ATTR_UNUSED proxyData* pdata,
void* param)
{
@@ -1079,6 +1098,7 @@ static BOOL config_plugin_keyboard_event(proxyPlugin* plugin, WINPR_ATTR_UNUSED
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL config_plugin_unicode_event(proxyPlugin* plugin, WINPR_ATTR_UNUSED proxyData* pdata,
void* param)
{
@@ -1104,6 +1124,7 @@ static BOOL config_plugin_unicode_event(proxyPlugin* plugin, WINPR_ATTR_UNUSED p
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL config_plugin_mouse_event(proxyPlugin* plugin, WINPR_ATTR_UNUSED proxyData* pdata,
void* param)
{
@@ -1128,6 +1149,7 @@ static BOOL config_plugin_mouse_event(proxyPlugin* plugin, WINPR_ATTR_UNUSED pro
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL config_plugin_mouse_ex_event(proxyPlugin* plugin, WINPR_ATTR_UNUSED proxyData* pdata,
void* param)
{
@@ -1152,6 +1174,7 @@ static BOOL config_plugin_mouse_ex_event(proxyPlugin* plugin, WINPR_ATTR_UNUSED
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL config_plugin_client_channel_data(WINPR_ATTR_UNUSED proxyPlugin* plugin,
WINPR_ATTR_UNUSED proxyData* pdata, void* param)
{
@@ -1166,6 +1189,7 @@ static BOOL config_plugin_client_channel_data(WINPR_ATTR_UNUSED proxyPlugin* plu
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL config_plugin_server_channel_data(WINPR_ATTR_UNUSED proxyPlugin* plugin,
WINPR_ATTR_UNUSED proxyData* pdata, void* param)
{
@@ -1180,6 +1204,7 @@ static BOOL config_plugin_server_channel_data(WINPR_ATTR_UNUSED proxyPlugin* plu
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL config_plugin_dynamic_channel_create(proxyPlugin* plugin,
WINPR_ATTR_UNUSED proxyData* pdata, void* param)
{
@@ -1246,6 +1271,7 @@ static BOOL config_plugin_dynamic_channel_create(proxyPlugin* plugin,
return accept;
}
WINPR_ATTR_NODISCARD
static BOOL config_plugin_channel_create(proxyPlugin* plugin, WINPR_ATTR_UNUSED proxyData* pdata,
void* param)
{

View File

@@ -38,12 +38,14 @@
#define TAG PROXY_TAG("server")
WINPR_ATTR_NODISCARD
static UINT32 ChannelId_Hash(const void* key)
{
const UINT32* v = (const UINT32*)key;
return *v;
}
WINPR_ATTR_NODISCARD
static BOOL ChannelId_Compare(const void* pv1, const void* pv2)
{
const UINT32* v1 = pv1;
@@ -53,6 +55,7 @@ static BOOL ChannelId_Compare(const void* pv1, const void* pv2)
return (*v1 == *v2);
}
WINPR_ATTR_NODISCARD
static BOOL dyn_intercept(pServerContext* ps, const char* name)
{
if (strncmp(DRDYNVC_SVC_CHANNEL_NAME, name, sizeof(DRDYNVC_SVC_CHANNEL_NAME)) != 0)
@@ -129,6 +132,8 @@ static void HashStaticChannelContext_free(void* ptr)
/* Proxy context initialization callback */
static void client_to_proxy_context_free(freerdp_peer* client, rdpContext* ctx);
WINPR_ATTR_NODISCARD
static BOOL client_to_proxy_context_new(freerdp_peer* client, rdpContext* ctx)
{
wObject* obj = NULL;
@@ -222,6 +227,7 @@ BOOL pf_context_init_server_context(freerdp_peer* client)
return freerdp_peer_context_new(client);
}
WINPR_ATTR_NODISCARD
static BOOL pf_context_revert_str_settings(rdpSettings* dst, const rdpSettings* before, size_t nr,
const FreeRDP_Settings_Keys_String* ids)
{

View File

@@ -29,6 +29,7 @@
#include "proxy_modules.h"
WINPR_ATTR_NODISCARD
static BOOL pf_server_check_and_sync_input_state(pClientContext* pc)
{
WINPR_ASSERT(pc);
@@ -44,6 +45,7 @@ static BOOL pf_server_check_and_sync_input_state(pClientContext* pc)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_synchronize_event(rdpInput* input, UINT32 flags)
{
pServerContext* ps = NULL;
@@ -63,6 +65,7 @@ static BOOL pf_server_synchronize_event(rdpInput* input, UINT32 flags)
return pf_server_check_and_sync_input_state(pc);
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
{
const proxyConfig* config = NULL;
@@ -96,6 +99,7 @@ static BOOL pf_server_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
const proxyConfig* config = NULL;
@@ -127,6 +131,7 @@ static BOOL pf_server_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
proxyMouseEventInfo event = { 0 };
@@ -161,6 +166,7 @@ static BOOL pf_server_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT1
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
const proxyConfig* config = NULL;

View File

@@ -48,6 +48,7 @@ struct proxy_module
wArrayList* handles;
};
WINPR_ATTR_NODISCARD
static const char* pf_modules_get_filter_type_string(PF_FILTER_TYPE result)
{
switch (result)
@@ -85,6 +86,7 @@ static const char* pf_modules_get_filter_type_string(PF_FILTER_TYPE result)
}
}
WINPR_ATTR_NODISCARD
static const char* pf_modules_get_hook_type_string(PF_HOOK_TYPE result)
{
switch (result)
@@ -130,6 +132,7 @@ static const char* pf_modules_get_hook_type_string(PF_HOOK_TYPE result)
}
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_proxy_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
@@ -239,6 +242,7 @@ BOOL pf_modules_run_hook(proxyModule* module, PF_HOOK_TYPE type, proxyData* pdat
custom);
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
@@ -340,6 +344,7 @@ BOOL pf_modules_run_filter(proxyModule* module, PF_FILTER_TYPE type, proxyData*
* @context: current session server's rdpContext instance.
* @info: pointer to per-session data.
*/
WINPR_ATTR_NODISCARD
static BOOL pf_modules_set_plugin_data(WINPR_ATTR_UNUSED proxyPluginsManager* mgr,
const char* plugin_name, proxyData* pdata, void* data)
{
@@ -371,6 +376,7 @@ static BOOL pf_modules_set_plugin_data(WINPR_ATTR_UNUSED proxyPluginsManager* mg
* if there's no data related to `plugin_name` in `context` (current session), a NULL will be
* returned.
*/
WINPR_ATTR_NODISCARD
static void* pf_modules_get_plugin_data(WINPR_ATTR_UNUSED proxyPluginsManager* mgr,
const char* plugin_name, proxyData* pdata)
{
@@ -393,6 +399,7 @@ static void pf_modules_abort_connect(WINPR_ATTR_UNUSED proxyPluginsManager* mgr,
proxy_data_abort_connect(pdata);
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_register_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
@@ -408,6 +415,7 @@ static BOOL pf_modules_register_ArrayList_ForEachFkt(void* data, size_t index, v
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_register_plugin(proxyPluginsManager* mgr,
const proxyPlugin* plugin_to_register)
{
@@ -435,6 +443,7 @@ static BOOL pf_modules_register_plugin(proxyPluginsManager* mgr,
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_load_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
@@ -461,6 +470,7 @@ BOOL pf_modules_is_plugin_loaded(proxyModule* module, const char* plugin_name)
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_print_ArrayList_ForEachFkt(void* data, size_t index, va_list ap)
{
proxyPlugin* plugin = (proxyPlugin*)data;
@@ -488,6 +498,7 @@ void pf_modules_list_loaded_plugins(proxyModule* module)
ArrayList_ForEach(module->plugins, pf_modules_print_ArrayList_ForEachFkt);
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_load_static_module(const char* module_name, proxyModule* module,
void* userdata)
{
@@ -527,6 +538,7 @@ error:
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_load_dynamic_module(const char* module_path, proxyModule* module,
void* userdata)
{
@@ -563,6 +575,7 @@ error:
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_try_load_dynamic_module(const char* module_path, proxyModule* module,
void* userdata, size_t count, const char* names[])
{
@@ -582,6 +595,7 @@ static BOOL pf_modules_try_load_dynamic_module(const char* module_path, proxyMod
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_modules_load_module(const char* module_path, const char* module_name,
proxyModule* module, void* userdata)
{
@@ -628,6 +642,8 @@ static void free_plugin(void* obj)
free(plugin);
}
WINPR_ATTR_MALLOC(free_plugin, 1)
WINPR_ATTR_NODISCARD
static void* new_plugin(const void* obj)
{
const proxyPlugin* src = obj;

View File

@@ -63,6 +63,7 @@ typedef struct
freerdp_peer* client;
} peer_thread_args;
WINPR_ATTR_NODISCARD
static BOOL pf_server_parse_target_from_routing_token(rdpContext* context, rdpSettings* settings,
FreeRDP_Settings_Keys_String targetID,
FreeRDP_Settings_Keys_UInt32 portID)
@@ -108,6 +109,7 @@ static BOOL pf_server_parse_target_from_routing_token(rdpContext* context, rdpSe
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_get_target_info(rdpContext* context, rdpSettings* settings,
const proxyConfig* config)
{
@@ -204,6 +206,7 @@ static BOOL pf_server_get_target_info(rdpContext* context, rdpSettings* settings
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_setup_channels(freerdp_peer* peer)
{
BOOL rc = FALSE;
@@ -283,6 +286,7 @@ fail:
* The server may start sending graphics output and receiving keyboard/mouse
* input after this callback returns.
*/
WINPR_ATTR_NODISCARD
static BOOL pf_server_post_connect(freerdp_peer* peer)
{
pServerContext* ps = NULL;
@@ -345,6 +349,7 @@ static BOOL pf_server_post_connect(freerdp_peer* peer)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_activate(freerdp_peer* peer)
{
pServerContext* ps = NULL;
@@ -369,6 +374,7 @@ static BOOL pf_server_activate(freerdp_peer* peer)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_logon(freerdp_peer* peer, const SEC_WINNT_AUTH_IDENTITY* identity,
BOOL automatic)
{
@@ -392,6 +398,7 @@ static BOOL pf_server_logon(freerdp_peer* peer, const SEC_WINNT_AUTH_IDENTITY* i
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_adjust_monitor_layout(WINPR_ATTR_UNUSED freerdp_peer* peer)
{
WINPR_ASSERT(peer);
@@ -399,6 +406,7 @@ static BOOL pf_server_adjust_monitor_layout(WINPR_ATTR_UNUSED freerdp_peer* peer
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_receive_channel_data_hook(freerdp_peer* peer, UINT16 channelId,
const BYTE* data, size_t size, UINT32 flags,
size_t totalSize)
@@ -461,6 +469,7 @@ original_cb:
totalSize);
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_initialize_peer_connection(freerdp_peer* peer)
{
WINPR_ASSERT(peer);
@@ -572,6 +581,7 @@ static BOOL pf_server_initialize_peer_connection(freerdp_peer* peer)
*
* arg is a pointer to a freerdp_peer representing the client.
*/
WINPR_ATTR_NODISCARD
static DWORD WINAPI pf_server_handle_peer(LPVOID arg)
{
HANDLE eventHandles[MAXIMUM_WAIT_OBJECTS] = { 0 };
@@ -714,7 +724,7 @@ fail:
/* Abort the client. */
proxy_data_abort_connect(pdata);
pf_modules_run_hook(pdata->module, HOOK_TYPE_SERVER_SESSION_END, pdata, client);
(void)pf_modules_run_hook(pdata->module, HOOK_TYPE_SERVER_SESSION_END, pdata, client);
PROXY_LOG_INFO(TAG, ps, "freeing server's channels");
@@ -752,6 +762,7 @@ out_free_peer:
return 0;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_start_peer(freerdp_peer* client)
{
HANDLE hThread = NULL;
@@ -787,6 +798,7 @@ static BOOL pf_server_start_peer(freerdp_peer* client)
return ResumeThread(hThread) != (DWORD)-1;
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_peer_accepted(freerdp_listener* listener, freerdp_peer* client)
{
WINPR_ASSERT(listener);
@@ -910,6 +922,7 @@ fail:
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL are_all_required_modules_loaded(proxyModule* module, const proxyConfig* config)
{
for (size_t i = 0; i < pf_config_required_plugins_count(config); i++)

View File

@@ -35,6 +35,7 @@
#define TAG PROXY_TAG("update")
WINPR_ATTR_NODISCARD
static BOOL pf_server_refresh_rect(rdpContext* context, BYTE count, const RECTANGLE_16* areas)
{
pServerContext* ps = (pServerContext*)context;
@@ -48,6 +49,7 @@ static BOOL pf_server_refresh_rect(rdpContext* context, BYTE count, const RECTAN
return pc->update->RefreshRect(pc, count, areas);
}
WINPR_ATTR_NODISCARD
static BOOL pf_server_suppress_output(rdpContext* context, BYTE allow, const RECTANGLE_16* area)
{
pServerContext* ps = (pServerContext*)context;
@@ -67,6 +69,7 @@ static BOOL pf_server_suppress_output(rdpContext* context, BYTE allow, const REC
* This function is called whenever a new frame starts.
* It can be used to reset invalidated areas.
*/
WINPR_ATTR_NODISCARD
static BOOL pf_client_begin_paint(rdpContext* context)
{
pClientContext* pc = (pClientContext*)context;
@@ -88,6 +91,7 @@ static BOOL pf_client_begin_paint(rdpContext* context)
* frame. Read out the changed areas and blit them to your output device.
* The image buffer will have the format specified by gdi_init
*/
WINPR_ATTR_NODISCARD
static BOOL pf_client_end_paint(rdpContext* context)
{
pClientContext* pc = (pClientContext*)context;
@@ -113,6 +117,7 @@ static BOOL pf_client_end_paint(rdpContext* context)
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_bitmap_update(rdpContext* context, const BITMAP_UPDATE* bitmap)
{
pClientContext* pc = (pClientContext*)context;
@@ -129,6 +134,7 @@ static BOOL pf_client_bitmap_update(rdpContext* context, const BITMAP_UPDATE* bi
return ps->update->BitmapUpdate(ps, bitmap);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_desktop_resize(rdpContext* context)
{
pClientContext* pc = (pClientContext*)context;
@@ -151,6 +157,7 @@ static BOOL pf_client_desktop_resize(rdpContext* context)
return ps->update->DesktopResize(ps);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_remote_monitors(rdpContext* context, UINT32 count,
const MONITOR_DEF* monitors)
{
@@ -166,6 +173,7 @@ static BOOL pf_client_remote_monitors(rdpContext* context, UINT32 count,
return freerdp_display_send_monitor_layout(ps, count, monitors);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_send_pointer_system(rdpContext* context,
const POINTER_SYSTEM_UPDATE* pointer_system)
{
@@ -184,6 +192,7 @@ static BOOL pf_client_send_pointer_system(rdpContext* context,
return ps->update->pointer->PointerSystem(ps, pointer_system);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_send_pointer_position(rdpContext* context,
const POINTER_POSITION_UPDATE* pointerPosition)
{
@@ -202,6 +211,7 @@ static BOOL pf_client_send_pointer_position(rdpContext* context,
return ps->update->pointer->PointerPosition(ps, pointerPosition);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_send_pointer_color(rdpContext* context,
const POINTER_COLOR_UPDATE* pointer_color)
{
@@ -220,6 +230,7 @@ static BOOL pf_client_send_pointer_color(rdpContext* context,
return ps->update->pointer->PointerColor(ps, pointer_color);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_send_pointer_large(rdpContext* context,
const POINTER_LARGE_UPDATE* pointer_large)
{
@@ -238,6 +249,7 @@ static BOOL pf_client_send_pointer_large(rdpContext* context,
return ps->update->pointer->PointerLarge(ps, pointer_large);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_send_pointer_new(rdpContext* context, const POINTER_NEW_UPDATE* pointer_new)
{
pClientContext* pc = (pClientContext*)context;
@@ -255,6 +267,7 @@ static BOOL pf_client_send_pointer_new(rdpContext* context, const POINTER_NEW_UP
return ps->update->pointer->PointerNew(ps, pointer_new);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_send_pointer_cached(rdpContext* context,
const POINTER_CACHED_UPDATE* pointer_cached)
{
@@ -273,6 +286,7 @@ static BOOL pf_client_send_pointer_cached(rdpContext* context,
return ps->update->pointer->PointerCached(ps, pointer_cached);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_save_session_info(rdpContext* context, UINT32 type, void* data)
{
logon_info* logonInfo = NULL;
@@ -307,6 +321,7 @@ static BOOL pf_client_save_session_info(rdpContext* context, UINT32 type, void*
return ps->update->SaveSessionInfo(ps, type, data);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_server_status_info(rdpContext* context, UINT32 status)
{
pClientContext* pc = (pClientContext*)context;
@@ -324,6 +339,7 @@ static BOOL pf_client_server_status_info(rdpContext* context, UINT32 status)
return ps->update->ServerStatusInfo(ps, status);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_set_keyboard_indicators(rdpContext* context, UINT16 led_flags)
{
pClientContext* pc = (pClientContext*)context;
@@ -341,6 +357,7 @@ static BOOL pf_client_set_keyboard_indicators(rdpContext* context, UINT16 led_fl
return ps->update->SetKeyboardIndicators(ps, led_flags);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_set_keyboard_ime_status(rdpContext* context, UINT16 imeId, UINT32 imeState,
UINT32 imeConvMode)
{
@@ -359,6 +376,7 @@ static BOOL pf_client_set_keyboard_ime_status(rdpContext* context, UINT16 imeId,
return ps->update->SetKeyboardImeStatus(ps, imeId, imeState, imeConvMode);
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_window_create(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const WINDOW_STATE_ORDER* windowState)
{
@@ -382,6 +400,7 @@ static BOOL pf_client_window_create(rdpContext* context, const WINDOW_ORDER_INFO
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_window_update(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const WINDOW_STATE_ORDER* windowState)
{
@@ -405,6 +424,7 @@ static BOOL pf_client_window_update(rdpContext* context, const WINDOW_ORDER_INFO
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_window_icon(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const WINDOW_ICON_ORDER* windowIcon)
{
@@ -428,6 +448,7 @@ static BOOL pf_client_window_icon(rdpContext* context, const WINDOW_ORDER_INFO*
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_window_cached_icon(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const WINDOW_CACHED_ICON_ORDER* windowCachedIcon)
{
@@ -451,6 +472,7 @@ static BOOL pf_client_window_cached_icon(rdpContext* context, const WINDOW_ORDER
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_window_delete(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo)
{
BOOL rc = 0;
@@ -473,6 +495,7 @@ static BOOL pf_client_window_delete(rdpContext* context, const WINDOW_ORDER_INFO
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_notify_icon_create(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const NOTIFY_ICON_STATE_ORDER* notifyIconState)
{
@@ -496,6 +519,7 @@ static BOOL pf_client_notify_icon_create(rdpContext* context, const WINDOW_ORDER
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_notify_icon_update(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const NOTIFY_ICON_STATE_ORDER* notifyIconState)
{
@@ -519,6 +543,7 @@ static BOOL pf_client_notify_icon_update(rdpContext* context, const WINDOW_ORDER
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_notify_icon_delete(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo)
{
BOOL rc = 0;
@@ -542,6 +567,7 @@ static BOOL pf_client_notify_icon_delete(rdpContext* context, const WINDOW_ORDER
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_monitored_desktop(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,
const MONITORED_DESKTOP_ORDER* monitoredDesktop)
{
@@ -565,6 +591,7 @@ static BOOL pf_client_monitored_desktop(rdpContext* context, const WINDOW_ORDER_
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL pf_client_non_monitored_desktop(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo)
{
BOOL rc = 0;

View File

@@ -35,9 +35,10 @@
* e.g. proxy client and server are termination points and data passed
* between.
*/
pf_utils_channel_mode pf_utils_get_channel_mode(const proxyConfig* config, const char* name);
const char* pf_utils_channel_mode_string(pf_utils_channel_mode mode);
WINPR_ATTR_NODISCARD pf_utils_channel_mode pf_utils_get_channel_mode(const proxyConfig* config,
const char* name);
WINPR_ATTR_NODISCARD const char* pf_utils_channel_mode_string(pf_utils_channel_mode mode);
BOOL pf_utils_is_passthrough(const proxyConfig* config);
WINPR_ATTR_NODISCARD BOOL pf_utils_is_passthrough(const proxyConfig* config);
#endif /* FREERDP_SERVER_PROXY_PFUTILS_H */

View File

@@ -74,6 +74,10 @@ extern "C"
{
#endif
void pf_modules_free(proxyModule* module);
WINPR_ATTR_MALLOC(pf_modules_free, 1)
WINPR_ATTR_NODISCARD
proxyModule* pf_modules_new(const char* root_dir, const char** modules, size_t count);
/**
@@ -81,18 +85,20 @@ extern "C"
* @param ep A module entry point function, must NOT be NULL
* @return TRUE for success, FALSE otherwise
*/
BOOL pf_modules_add(proxyModule* module, proxyModuleEntryPoint ep, void* userdata);
WINPR_ATTR_NODISCARD BOOL pf_modules_add(proxyModule* module, proxyModuleEntryPoint ep,
void* userdata);
BOOL pf_modules_is_plugin_loaded(proxyModule* module, const char* plugin_name);
WINPR_ATTR_NODISCARD BOOL pf_modules_is_plugin_loaded(proxyModule* module,
const char* plugin_name);
void pf_modules_list_loaded_plugins(proxyModule* module);
BOOL pf_modules_run_filter(proxyModule* module, PF_FILTER_TYPE type, proxyData* pdata,
void* param);
WINPR_ATTR_NODISCARD BOOL pf_modules_run_filter(proxyModule* module, PF_FILTER_TYPE type,
proxyData* pdata, void* param);
WINPR_ATTR_NODISCARD
BOOL pf_modules_run_hook(proxyModule* module, PF_HOOK_TYPE type, proxyData* pdata,
void* custom);
void pf_modules_free(proxyModule* module);
#ifdef __cplusplus
}
#endif

View File

@@ -30,6 +30,7 @@
#define TAG SERVER_TAG("shadow.sample")
WINPR_ATTR_NODISCARD
static BOOL sample_shadow_input_synchronize_event(WINPR_ATTR_UNUSED rdpShadowSubsystem* subsystem,
WINPR_ATTR_UNUSED rdpShadowClient* client,
WINPR_ATTR_UNUSED UINT32 flags)
@@ -38,6 +39,7 @@ static BOOL sample_shadow_input_synchronize_event(WINPR_ATTR_UNUSED rdpShadowSub
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL sample_shadow_input_keyboard_event(WINPR_ATTR_UNUSED rdpShadowSubsystem* subsystem,
WINPR_ATTR_UNUSED rdpShadowClient* client,
WINPR_ATTR_UNUSED UINT16 flags,
@@ -47,6 +49,7 @@ static BOOL sample_shadow_input_keyboard_event(WINPR_ATTR_UNUSED rdpShadowSubsys
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL sample_shadow_input_unicode_keyboard_event(
WINPR_ATTR_UNUSED rdpShadowSubsystem* subsystem, WINPR_ATTR_UNUSED rdpShadowClient* client,
WINPR_ATTR_UNUSED UINT16 flags, WINPR_ATTR_UNUSED UINT16 code)
@@ -55,6 +58,7 @@ static BOOL sample_shadow_input_unicode_keyboard_event(
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL sample_shadow_input_mouse_event(WINPR_ATTR_UNUSED rdpShadowSubsystem* subsystem,
WINPR_ATTR_UNUSED rdpShadowClient* client,
WINPR_ATTR_UNUSED UINT16 flags,
@@ -64,6 +68,7 @@ static BOOL sample_shadow_input_mouse_event(WINPR_ATTR_UNUSED rdpShadowSubsystem
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL sample_shadow_input_extended_mouse_event(
WINPR_ATTR_UNUSED rdpShadowSubsystem* subsystem, WINPR_ATTR_UNUSED rdpShadowClient* client,
WINPR_ATTR_UNUSED UINT16 flags, WINPR_ATTR_UNUSED UINT16 x, WINPR_ATTR_UNUSED UINT16 y)
@@ -72,6 +77,7 @@ static BOOL sample_shadow_input_extended_mouse_event(
return TRUE;
}
WINPR_ATTR_NODISCARD
static UINT32 sample_shadow_enum_monitors(WINPR_ATTR_UNUSED MONITOR_DEF* monitors,
WINPR_ATTR_UNUSED UINT32 maxMonitors)
{
@@ -79,6 +85,7 @@ static UINT32 sample_shadow_enum_monitors(WINPR_ATTR_UNUSED MONITOR_DEF* monitor
return 0;
}
WINPR_ATTR_NODISCARD
static int sample_shadow_subsystem_init(rdpShadowSubsystem* arg)
{
sampleShadowSubsystem* subsystem = (sampleShadowSubsystem*)arg;
@@ -97,6 +104,7 @@ static int sample_shadow_subsystem_init(rdpShadowSubsystem* arg)
return 1;
}
WINPR_ATTR_NODISCARD
static int sample_shadow_subsystem_uninit(rdpShadowSubsystem* arg)
{
sampleShadowSubsystem* subsystem = (sampleShadowSubsystem*)arg;
@@ -108,6 +116,7 @@ static int sample_shadow_subsystem_uninit(rdpShadowSubsystem* arg)
return 1;
}
WINPR_ATTR_NODISCARD
static int sample_shadow_subsystem_start(rdpShadowSubsystem* arg)
{
sampleShadowSubsystem* subsystem = (sampleShadowSubsystem*)arg;
@@ -120,6 +129,7 @@ static int sample_shadow_subsystem_start(rdpShadowSubsystem* arg)
return 1;
}
WINPR_ATTR_NODISCARD
static int sample_shadow_subsystem_stop(rdpShadowSubsystem* arg)
{
sampleShadowSubsystem* subsystem = (sampleShadowSubsystem*)arg;
@@ -143,6 +153,8 @@ static void sample_shadow_subsystem_free(rdpShadowSubsystem* arg)
free(subsystem);
}
WINPR_ATTR_MALLOC(sample_shadow_subsystem_free, 1)
WINPR_ATTR_NODISCARD
static rdpShadowSubsystem* sample_shadow_subsystem_new(void)
{
sampleShadowSubsystem* subsystem =

View File

@@ -35,8 +35,9 @@ extern "C"
/* Additional platform specific stuff goes here */
};
FREERDP_API const char* ShadowSubsystemName(void);
FREERDP_API int ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
FREERDP_API WINPR_ATTR_NODISCARD const char* ShadowSubsystemName(void);
FREERDP_API WINPR_ATTR_NODISCARD int
ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints);
#ifdef __cplusplus
}

View File

@@ -43,14 +43,15 @@ extern "C"
#ifdef WITH_DXGI_1_2
int win_shadow_dxgi_init(winShadowSubsystem* subsystem);
int win_shadow_dxgi_uninit(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_dxgi_init(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_dxgi_uninit(winShadowSubsystem* subsystem);
int win_shadow_dxgi_fetch_frame_data(winShadowSubsystem* subsystem, BYTE** ppDstData,
int* pnDstStep, int x, int y, int width, int height);
WINPR_ATTR_NODISCARD int win_shadow_dxgi_fetch_frame_data(winShadowSubsystem* subsystem,
BYTE** ppDstData, int* pnDstStep,
int x, int y, int width, int height);
int win_shadow_dxgi_get_next_frame(winShadowSubsystem* subsystem);
int win_shadow_dxgi_get_invalid_region(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_dxgi_get_next_frame(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_dxgi_get_invalid_region(winShadowSubsystem* subsystem);
#endif

View File

@@ -43,11 +43,11 @@ extern "C"
{
#endif
int win_shadow_rdp_init(winShadowSubsystem* subsystem);
int win_shadow_rdp_uninit(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_rdp_init(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_rdp_uninit(winShadowSubsystem* subsystem);
int win_shadow_rdp_start(winShadowSubsystem* subsystem);
int win_shadow_rdp_stop(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_rdp_start(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_rdp_stop(winShadowSubsystem* subsystem);
#ifdef __cplusplus
}

View File

@@ -38,8 +38,8 @@ extern "C"
{
#endif
int win_shadow_wds_init(winShadowSubsystem* subsystem);
int win_shadow_wds_uninit(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_wds_init(winShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int win_shadow_wds_uninit(winShadowSubsystem* subsystem);
#ifdef __cplusplus
}

View File

@@ -1646,12 +1646,13 @@ static void x11_shadow_subsystem_free(rdpShadowSubsystem* subsystem)
free(subsystem);
}
FREERDP_ENTRY_POINT(FREERDP_API const char* ShadowSubsystemName(void))
FREERDP_ENTRY_POINT(FREERDP_API WINPR_ATTR_NODISCARD const char* ShadowSubsystemName(void))
{
return "X11";
}
FREERDP_ENTRY_POINT(FREERDP_API int ShadowSubsystemEntry(RDP_SHADOW_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(FREERDP_API WINPR_ATTR_NODISCARD int ShadowSubsystemEntry(
RDP_SHADOW_ENTRY_POINTS* pEntryPoints))
{
if (!pEntryPoints)
return -1;

View File

@@ -31,6 +31,7 @@
#if defined(CHANNEL_AUDIN_SERVER)
WINPR_ATTR_NODISCARD
static UINT AudinServerData(audin_server_context* audin, const SNDIN_DATA* data)
{
rdpShadowClient* client = NULL;

View File

@@ -29,7 +29,7 @@ extern "C"
{
#endif
BOOL shadow_client_audin_init(rdpShadowClient* client);
WINPR_ATTR_NODISCARD BOOL shadow_client_audin_init(rdpShadowClient* client);
void shadow_client_audin_uninit(rdpShadowClient* client);
#ifdef __cplusplus

View File

@@ -86,6 +86,7 @@ int shadow_capture_compare(const BYTE* WINPR_RESTRICT pData1, UINT32 nStep1, UIN
}
#endif
WINPR_ATTR_NODISCARD
static BOOL color_equal(UINT32 colorA, UINT32 formatA, UINT32 colorB, UINT32 formatB)
{
BYTE ar = 0;
@@ -110,6 +111,7 @@ static BOOL color_equal(UINT32 colorA, UINT32 formatA, UINT32 colorB, UINT32 for
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pixel_equal(const BYTE* WINPR_RESTRICT a, UINT32 formatA, const BYTE* WINPR_RESTRICT b,
UINT32 formatB, size_t count)
{
@@ -127,6 +129,7 @@ static BOOL pixel_equal(const BYTE* WINPR_RESTRICT a, UINT32 formatA, const BYTE
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL color_equal_no_alpha(UINT32 colorA, UINT32 formatA, UINT32 colorB, UINT32 formatB)
{
BYTE ar = 0;
@@ -147,6 +150,7 @@ static BOOL color_equal_no_alpha(UINT32 colorA, UINT32 formatA, UINT32 colorB, U
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pixel_equal_no_alpha(const BYTE* WINPR_RESTRICT a, UINT32 formatA,
const BYTE* WINPR_RESTRICT b, UINT32 formatB, size_t count)
{
@@ -164,6 +168,7 @@ static BOOL pixel_equal_no_alpha(const BYTE* WINPR_RESTRICT a, UINT32 formatA,
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL pixel_equal_same_format(const BYTE* WINPR_RESTRICT a, UINT32 formatA,
const BYTE* WINPR_RESTRICT b, UINT32 formatB, size_t count)
{
@@ -176,6 +181,7 @@ static BOOL pixel_equal_same_format(const BYTE* WINPR_RESTRICT a, UINT32 formatA
typedef BOOL (*pixel_equal_fn_t)(const BYTE* WINPR_RESTRICT a, UINT32 formatA,
const BYTE* WINPR_RESTRICT b, UINT32 formatB, size_t count);
WINPR_ATTR_NODISCARD
static pixel_equal_fn_t get_comparison_fn(DWORD format1, DWORD format2)
{

View File

@@ -26,22 +26,27 @@ UINT shadow_client_channels_post_connect(rdpShadowClient* client)
{
if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, ENCOMSP_SVC_CHANNEL_NAME))
{
shadow_client_encomsp_init(client);
if (shadow_client_encomsp_init(client) < 0)
return ERROR_NOT_READY;
}
if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, REMDESK_SVC_CHANNEL_NAME))
{
shadow_client_remdesk_init(client);
if (shadow_client_remdesk_init(client) < 0)
return ERROR_NOT_READY;
}
if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, RDPSND_CHANNEL_NAME))
{
shadow_client_rdpsnd_init(client);
if (shadow_client_rdpsnd_init(client) < 0)
return ERROR_NOT_READY;
}
shadow_client_audin_init(client);
if (!shadow_client_audin_init(client))
return ERROR_NOT_READY;
shadow_client_rdpgfx_init(client);
if (shadow_client_rdpgfx_init(client) < 0)
return ERROR_NOT_READY;
return CHANNEL_RC_OK;
}

View File

@@ -35,7 +35,7 @@ extern "C"
{
#endif
UINT shadow_client_channels_post_connect(rdpShadowClient* client);
WINPR_ATTR_NODISCARD UINT shadow_client_channels_post_connect(rdpShadowClient* client);
void shadow_client_channels_free(rdpShadowClient* client);
#ifdef __cplusplus

View File

@@ -52,6 +52,7 @@ typedef struct
*/
#define BitmapUpdateProxy(client, bitmap) \
BitmapUpdateProxyEx((client), (bitmap), __FILE__, __LINE__, __func__)
WINPR_ATTR_NODISCARD
static BOOL BitmapUpdateProxyEx(rdpShadowClient* client, const BITMAP_UPDATE* bitmap,
const char* file, size_t line, const char* fkt)
{
@@ -108,7 +109,7 @@ static BOOL BitmapUpdateProxyEx(rdpShadowClient* client, const BITMAP_UPDATE* bi
return TRUE;
}
static inline BOOL shadow_client_rdpgfx_new_surface(rdpShadowClient* client)
static inline WINPR_ATTR_NODISCARD BOOL shadow_client_rdpgfx_new_surface(rdpShadowClient* client)
{
UINT error = CHANNEL_RC_OK;
RDPGFX_CREATE_SURFACE_PDU createSurface;
@@ -151,7 +152,8 @@ static inline BOOL shadow_client_rdpgfx_new_surface(rdpShadowClient* client)
return TRUE;
}
static inline BOOL shadow_client_rdpgfx_release_surface(rdpShadowClient* client)
static inline WINPR_ATTR_NODISCARD BOOL
shadow_client_rdpgfx_release_surface(rdpShadowClient* client)
{
UINT error = CHANNEL_RC_OK;
RDPGFX_DELETE_SURFACE_PDU pdu;
@@ -174,7 +176,7 @@ static inline BOOL shadow_client_rdpgfx_release_surface(rdpShadowClient* client)
return TRUE;
}
static inline BOOL shadow_client_rdpgfx_reset_graphic(rdpShadowClient* client)
static inline WINPR_ATTR_NODISCARD BOOL shadow_client_rdpgfx_reset_graphic(rdpShadowClient* client)
{
UINT error = CHANNEL_RC_OK;
RDPGFX_RESET_GRAPHICS_PDU pdu = { 0 };
@@ -244,6 +246,7 @@ static void shadow_client_context_free(freerdp_peer* peer, rdpContext* context)
client->vcm = NULL;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_context_new(freerdp_peer* peer, rdpContext* context)
{
BOOL NSCodec = 0;
@@ -386,7 +389,7 @@ fail:
*
* @return TRUE if width/height changed.
*/
static inline BOOL shadow_client_recalc_desktop_size(rdpShadowClient* client)
static inline WINPR_ATTR_NODISCARD BOOL shadow_client_recalc_desktop_size(rdpShadowClient* client)
{
INT32 width = 0;
INT32 height = 0;
@@ -427,6 +430,7 @@ static inline BOOL shadow_client_recalc_desktop_size(rdpShadowClient* client)
return FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_capabilities(freerdp_peer* peer)
{
rdpShadowSubsystem* subsystem = NULL;
@@ -456,6 +460,7 @@ static void shadow_reset_desktop_resize(rdpShadowClient* client)
client->resizeRequested = FALSE;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_send_desktop_resize(rdpShadowClient* client)
{
BOOL rc = 0;
@@ -509,6 +514,7 @@ static BOOL shadow_send_desktop_resize(rdpShadowClient* client)
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_post_connect(freerdp_peer* peer)
{
int authStatus = 0;
@@ -625,6 +631,7 @@ static inline void shadow_client_convert_rects(rdpShadowClient* client, RECTANGL
}
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_refresh_request(rdpShadowClient* client)
{
wMessage message = { 0 };
@@ -644,6 +651,7 @@ static BOOL shadow_client_refresh_request(rdpShadowClient* client)
return MessageQueue_Dispatch(MsgPipe->In, &message);
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_refresh_rect(rdpContext* context, BYTE count, const RECTANGLE_16* areas)
{
rdpShadowClient* client = (rdpShadowClient*)context;
@@ -674,6 +682,7 @@ static BOOL shadow_client_refresh_rect(rdpContext* context, BYTE count, const RE
return shadow_client_refresh_request(client);
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_suppress_output(rdpContext* context, BYTE allow, const RECTANGLE_16* area)
{
rdpShadowClient* client = (rdpShadowClient*)context;
@@ -699,6 +708,7 @@ static BOOL shadow_client_suppress_output(rdpContext* context, BYTE allow, const
return shadow_client_refresh_request(client);
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_activate(freerdp_peer* peer)
{
WINPR_ASSERT(peer);
@@ -724,6 +734,7 @@ static BOOL shadow_client_activate(freerdp_peer* peer)
return shadow_client_refresh_rect(&client->context, 0, NULL);
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_logon(freerdp_peer* peer, const SEC_WINNT_AUTH_IDENTITY* identity,
BOOL automatic)
{
@@ -809,6 +820,7 @@ static inline void shadow_client_common_frame_acknowledge(rdpShadowClient* clien
client->encoder->lastAckframeId = frameId;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_surface_frame_acknowledge(rdpContext* context, UINT32 frameId)
{
rdpShadowClient* client = (rdpShadowClient*)context;
@@ -822,6 +834,7 @@ static BOOL shadow_client_surface_frame_acknowledge(rdpContext* context, UINT32
return TRUE;
}
WINPR_ATTR_NODISCARD
static UINT
shadow_client_rdpgfx_frame_acknowledge(RdpgfxServerContext* context,
const RDPGFX_FRAME_ACKNOWLEDGE_PDU* frameAcknowledge)
@@ -840,6 +853,7 @@ shadow_client_rdpgfx_frame_acknowledge(RdpgfxServerContext* context,
return CHANNEL_RC_OK;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_are_caps_filtered(const rdpSettings* settings, UINT32 caps)
{
const UINT32 capList[] = { RDPGFX_CAPVERSION_8, RDPGFX_CAPVERSION_81,
@@ -861,6 +875,7 @@ static BOOL shadow_are_caps_filtered(const rdpSettings* settings, UINT32 caps)
return TRUE;
}
WINPR_ATTR_NODISCARD
static UINT shadow_client_send_caps_confirm(RdpgfxServerContext* context, rdpShadowClient* client,
const RDPGFX_CAPS_CONFIRM_PDU* pdu)
{
@@ -874,6 +889,7 @@ static UINT shadow_client_send_caps_confirm(RdpgfxServerContext* context, rdpSha
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_caps_test_version(RdpgfxServerContext* context, rdpShadowClient* client,
BOOL h264, const RDPGFX_CAPSET* capsSets,
UINT32 capsSetCount, UINT32 capsVersion, UINT* rc)
@@ -964,6 +980,7 @@ static BOOL shadow_client_caps_test_version(RdpgfxServerContext* context, rdpSha
*
* @return 0 on success, otherwise a Win32 error code
*/
WINPR_ATTR_NODISCARD
static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
const RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise)
{
@@ -1130,7 +1147,8 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
return CHANNEL_RC_UNSUPPORTED_VERSION;
}
static inline UINT32 rdpgfx_estimate_h264_avc420(RDPGFX_AVC420_BITMAP_STREAM* havc420)
static inline WINPR_ATTR_NODISCARD UINT32
rdpgfx_estimate_h264_avc420(RDPGFX_AVC420_BITMAP_STREAM* havc420)
{
/* H264 metadata + H264 stream. See rdpgfx_write_h264_avc420 */
WINPR_ASSERT(havc420);
@@ -1145,6 +1163,7 @@ static inline UINT32 rdpgfx_estimate_h264_avc420(RDPGFX_AVC420_BITMAP_STREAM* ha
*
* @return TRUE on success
*/
WINPR_ATTR_NODISCARD
static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE* pSrcData,
UINT32 nSrcStep, UINT32 SrcFormat, UINT16 nXSrc,
UINT16 nYSrc, UINT16 nWidth, UINT16 nHeight)
@@ -1465,6 +1484,7 @@ static BOOL shadow_client_send_surface_gfx(rdpShadowClient* client, const BYTE*
return TRUE;
}
WINPR_ATTR_NODISCARD
static BOOL stream_surface_bits_supported(const rdpSettings* settings)
{
const UINT32 supported =
@@ -1472,6 +1492,7 @@ static BOOL stream_surface_bits_supported(const rdpSettings* settings)
return ((supported & SURFCMDS_STREAM_SURFACE_BITS) != 0);
}
WINPR_ATTR_NODISCARD
static BOOL set_surface_bits_supported(const rdpSettings* settings)
{
const UINT32 supported =
@@ -1479,6 +1500,7 @@ static BOOL set_surface_bits_supported(const rdpSettings* settings)
return ((supported & SURFCMDS_SET_SURFACE_BITS) != 0);
}
WINPR_ATTR_NODISCARD
static BOOL is_surface_command_supported(const rdpSettings* settings)
{
if (stream_surface_bits_supported(settings))
@@ -1503,6 +1525,7 @@ static BOOL is_surface_command_supported(const rdpSettings* settings)
*
* @return TRUE on success
*/
WINPR_ATTR_NODISCARD
static BOOL shadow_client_send_surface_bits(rdpShadowClient* client, BYTE* pSrcData,
UINT32 nSrcStep, UINT16 nXSrc, UINT16 nYSrc,
UINT16 nWidth, UINT16 nHeight)
@@ -1663,6 +1686,7 @@ static BOOL shadow_client_send_surface_bits(rdpShadowClient* client, BYTE* pSrcD
*
* @return TRUE on success
*/
WINPR_ATTR_NODISCARD
static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client, BYTE* pSrcData,
UINT32 nSrcStep, UINT16 nXSrc, UINT16 nYSrc,
UINT16 nWidth, UINT16 nHeight)
@@ -1877,6 +1901,7 @@ out:
*
* @return TRUE on success (or nothing need to be updated)
*/
WINPR_ATTR_NODISCARD
static BOOL shadow_client_send_surface_update(rdpShadowClient* client, SHADOW_GFX_STATUS* pStatus)
{
BOOL ret = TRUE;
@@ -2054,6 +2079,7 @@ out:
*
* @return TRUE on success
*/
WINPR_ATTR_NODISCARD
static BOOL shadow_client_send_resize(rdpShadowClient* client, SHADOW_GFX_STATUS* pStatus)
{
rdpContext* context = (rdpContext*)client;
@@ -2103,6 +2129,7 @@ static BOOL shadow_client_send_resize(rdpShadowClient* client, SHADOW_GFX_STATUS
*
* @return TRUE on success
*/
WINPR_ATTR_NODISCARD
static BOOL shadow_client_surface_update(rdpShadowClient* client, REGION16* region)
{
UINT32 numRects = 0;
@@ -2118,8 +2145,9 @@ static BOOL shadow_client_surface_update(rdpShadowClient* client, REGION16* regi
*
* @return TRUE on success
*/
static inline BOOL shadow_client_no_surface_update(rdpShadowClient* client,
SHADOW_GFX_STATUS* pStatus)
WINPR_ATTR_NODISCARD
static inline WINPR_ATTR_NODISCARD BOOL shadow_client_no_surface_update(rdpShadowClient* client,
SHADOW_GFX_STATUS* pStatus)
{
rdpShadowServer* server = NULL;
rdpShadowSurface* surface = NULL;
@@ -2134,14 +2162,15 @@ static inline BOOL shadow_client_no_surface_update(rdpShadowClient* client,
return rc;
}
WINPR_ATTR_NODISCARD
static int shadow_client_subsystem_process_message(rdpShadowClient* client, wMessage* message)
{
rdpContext* context = (rdpContext*)client;
rdpUpdate* update = NULL;
WINPR_ASSERT(message);
WINPR_ASSERT(context);
update = context->update;
rdpUpdate* update = context->update;
WINPR_ASSERT(update);
/* FIXME: the pointer updates appear to be broken when used with bulk compression and mstsc */
@@ -2270,6 +2299,7 @@ static int shadow_client_subsystem_process_message(rdpShadowClient* client, wMes
return 1;
}
WINPR_ATTR_NODISCARD
static DWORD WINAPI shadow_client_thread(LPVOID arg)
{
rdpShadowClient* client = (rdpShadowClient*)arg;
@@ -2551,7 +2581,8 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
break;
default:
shadow_client_subsystem_process_message(client, &message);
if (!shadow_client_subsystem_process_message(client, &message))
goto fail;
break;
}
}
@@ -2569,17 +2600,20 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
/* Process accumulated messages if needed */
if (pointerPositionMsg.id)
{
shadow_client_subsystem_process_message(client, &pointerPositionMsg);
if (!shadow_client_subsystem_process_message(client, &pointerPositionMsg))
goto fail;
}
if (pointerAlphaMsg.id)
{
shadow_client_subsystem_process_message(client, &pointerAlphaMsg);
if (!shadow_client_subsystem_process_message(client, &pointerAlphaMsg))
goto fail;
}
if (audioVolumeMsg.id)
{
shadow_client_subsystem_process_message(client, &audioVolumeMsg);
if (!shadow_client_subsystem_process_message(client, &audioVolumeMsg))
goto fail;
}
}
}
@@ -2696,6 +2730,7 @@ static void shadow_msg_out_release(wMessage* message)
}
}
WINPR_ATTR_NODISCARD
static BOOL shadow_client_dispatch_msg(rdpShadowClient* client, wMessage* message)
{
if (!client || !message)

View File

@@ -26,7 +26,8 @@ extern "C"
{
#endif
BOOL shadow_client_accepted(freerdp_listener* listener, freerdp_peer* peer);
WINPR_ATTR_NODISCARD BOOL shadow_client_accepted(freerdp_listener* listener,
freerdp_peer* peer);
#ifdef __cplusplus
}

View File

@@ -78,6 +78,7 @@ UINT32 shadow_encoder_create_frame_id(rdpShadowEncoder* encoder)
return frameId;
}
WINPR_ATTR_NODISCARD
static int shadow_encoder_init_grid(rdpShadowEncoder* encoder)
{
UINT32 tileSize = 0;
@@ -128,6 +129,7 @@ static int shadow_encoder_uninit_grid(rdpShadowEncoder* encoder)
return 0;
}
WINPR_ATTR_NODISCARD
static int shadow_encoder_init_rfx(rdpShadowEncoder* encoder)
{
if (!encoder->rfx)
@@ -154,6 +156,7 @@ fail:
return -1;
}
WINPR_ATTR_NODISCARD
static int shadow_encoder_init_nsc(rdpShadowEncoder* encoder)
{
rdpContext* context = (rdpContext*)encoder->client;
@@ -189,6 +192,7 @@ fail:
return -1;
}
WINPR_ATTR_NODISCARD
static int shadow_encoder_init_planar(rdpShadowEncoder* encoder)
{
DWORD planarFlags = 0;
@@ -220,6 +224,7 @@ fail:
return -1;
}
WINPR_ATTR_NODISCARD
static int shadow_encoder_init_interleaved(rdpShadowEncoder* encoder)
{
if (!encoder->interleaved)
@@ -238,6 +243,7 @@ fail:
return -1;
}
WINPR_ATTR_NODISCARD
static int shadow_encoder_init_h264(rdpShadowEncoder* encoder)
{
if (!encoder->h264)
@@ -268,6 +274,7 @@ fail:
return -1;
}
WINPR_ATTR_NODISCARD
static int shadow_encoder_init_progressive(rdpShadowEncoder* encoder)
{
WINPR_ASSERT(encoder);
@@ -287,13 +294,15 @@ fail:
return -1;
}
WINPR_ATTR_NODISCARD
static int shadow_encoder_init(rdpShadowEncoder* encoder)
{
encoder->width = encoder->server->screen->width;
encoder->height = encoder->server->screen->height;
encoder->maxTileWidth = 64;
encoder->maxTileHeight = 64;
shadow_encoder_init_grid(encoder);
if (shadow_encoder_init_grid(encoder) < 0)
return -1;
if (!encoder->bs)
encoder->bs = Stream_New(NULL, 4ULL * encoder->maxTileWidth * encoder->maxTileHeight);

View File

@@ -65,9 +65,9 @@ extern "C"
{
#endif
int shadow_encoder_reset(rdpShadowEncoder* encoder);
int shadow_encoder_prepare(rdpShadowEncoder* encoder, UINT32 codecs);
UINT32 shadow_encoder_create_frame_id(rdpShadowEncoder* encoder);
WINPR_ATTR_NODISCARD int shadow_encoder_reset(rdpShadowEncoder* encoder);
WINPR_ATTR_NODISCARD int shadow_encoder_prepare(rdpShadowEncoder* encoder, UINT32 codecs);
WINPR_ATTR_NODISCARD UINT32 shadow_encoder_create_frame_id(rdpShadowEncoder* encoder);
void shadow_encoder_free(rdpShadowEncoder* encoder);

View File

@@ -32,6 +32,7 @@
*
* @return 0 on success, otherwise a Win32 error code
*/
WINPR_ATTR_NODISCARD
static UINT
encomsp_change_participant_control_level(EncomspServerContext* context,
ENCOMSP_CHANGE_PARTICIPANT_CONTROL_LEVEL_PDU* pdu)
@@ -93,7 +94,8 @@ encomsp_change_participant_control_level(EncomspServerContext* context,
if (inLobby != client->inLobby)
{
shadow_encoder_reset(client->encoder);
if (shadow_encoder_reset(client->encoder) < 0)
return ERROR_NOT_READY;
client->inLobby = inLobby;
}

View File

@@ -29,7 +29,7 @@ extern "C"
{
#endif
int shadow_client_encomsp_init(rdpShadowClient* client);
WINPR_ATTR_NODISCARD int shadow_client_encomsp_init(rdpShadowClient* client);
void shadow_client_encomsp_uninit(rdpShadowClient* client);
#ifdef __cplusplus

View File

@@ -24,6 +24,7 @@
#define TAG SERVER_TAG("shadow.input")
WINPR_ATTR_NODISCARD
static BOOL shadow_input_synchronize_event(rdpInput* input, UINT32 flags)
{
WINPR_ASSERT(input);
@@ -40,6 +41,7 @@ static BOOL shadow_input_synchronize_event(rdpInput* input, UINT32 flags)
return IFCALLRESULT(TRUE, subsystem->SynchronizeEvent, subsystem, client, flags);
}
WINPR_ATTR_NODISCARD
static BOOL shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT8 code)
{
WINPR_ASSERT(input);
@@ -56,6 +58,7 @@ static BOOL shadow_input_keyboard_event(rdpInput* input, UINT16 flags, UINT8 cod
return IFCALLRESULT(TRUE, subsystem->KeyboardEvent, subsystem, client, flags, code);
}
WINPR_ATTR_NODISCARD
static BOOL shadow_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
{
WINPR_ASSERT(input);
@@ -72,6 +75,7 @@ static BOOL shadow_input_unicode_keyboard_event(rdpInput* input, UINT16 flags, U
return IFCALLRESULT(TRUE, subsystem->UnicodeKeyboardEvent, subsystem, client, flags, code);
}
WINPR_ATTR_NODISCARD
static BOOL shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
WINPR_ASSERT(input);
@@ -109,6 +113,7 @@ static BOOL shadow_input_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UI
return IFCALLRESULT(TRUE, subsystem->MouseEvent, subsystem, client, flags, x, y);
}
WINPR_ATTR_NODISCARD
static BOOL shadow_input_rel_mouse_event(rdpInput* input, UINT16 flags, INT16 xDelta, INT16 yDelta)
{
WINPR_ASSERT(input);
@@ -134,6 +139,7 @@ static BOOL shadow_input_rel_mouse_event(rdpInput* input, UINT16 flags, INT16 xD
return IFCALLRESULT(TRUE, subsystem->RelMouseEvent, subsystem, client, flags, xDelta, yDelta);
}
WINPR_ATTR_NODISCARD
static BOOL shadow_input_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
{
WINPR_ASSERT(input);

View File

@@ -29,7 +29,7 @@ extern "C"
{
#endif
BOOL shadow_client_init_lobby(rdpShadowServer* server);
WINPR_ATTR_NODISCARD BOOL shadow_client_init_lobby(rdpShadowServer* server);
#ifdef __cplusplus
}

View File

@@ -45,10 +45,10 @@ extern "C"
void shadow_multiclient_publish(rdpShadowMultiClientEvent* event);
void shadow_multiclient_wait(rdpShadowMultiClientEvent* event);
void shadow_multiclient_publish_and_wait(rdpShadowMultiClientEvent* event);
void* shadow_multiclient_get_subscriber(rdpShadowMultiClientEvent* event);
WINPR_ATTR_NODISCARD void* shadow_multiclient_get_subscriber(rdpShadowMultiClientEvent* event);
void shadow_multiclient_release_subscriber(void* subscriber);
BOOL shadow_multiclient_consume(void* subscriber);
HANDLE shadow_multiclient_getevent(void* subscriber);
WINPR_ATTR_NODISCARD HANDLE shadow_multiclient_getevent(void* subscriber);
#ifdef __cplusplus
}

View File

@@ -29,7 +29,7 @@ extern "C"
{
#endif
int shadow_client_rdpgfx_init(rdpShadowClient* client);
WINPR_ATTR_NODISCARD int shadow_client_rdpgfx_init(rdpShadowClient* client);
void shadow_client_rdpgfx_uninit(rdpShadowClient* client);
#ifdef __cplusplus

View File

@@ -29,7 +29,7 @@ extern "C"
{
#endif
int shadow_client_rdpsnd_init(rdpShadowClient* client);
WINPR_ATTR_NODISCARD int shadow_client_rdpsnd_init(rdpShadowClient* client);
void shadow_client_rdpsnd_uninit(rdpShadowClient* client);
#ifdef __cplusplus

View File

@@ -29,7 +29,7 @@ extern "C"
{
#endif
int shadow_client_remdesk_init(rdpShadowClient* client);
WINPR_ATTR_NODISCARD int shadow_client_remdesk_init(rdpShadowClient* client);
void shadow_client_remdesk_uninit(rdpShadowClient* client);
#ifdef __cplusplus

View File

@@ -159,7 +159,7 @@ BOOL shadow_screen_resize(rdpShadowScreen* screen)
/* screen size is changed. Store new size and reinit lobby */
screen->width = (UINT32)width;
screen->height = (UINT32)height;
shadow_client_init_lobby(screen->server);
return shadow_client_init_lobby(screen->server);
}
return TRUE;
}

View File

@@ -59,6 +59,7 @@ static int fail_at_(const COMMAND_LINE_ARGUMENT_A* arg, int rc, const char* file
return rc;
}
WINPR_ATTR_NODISCARD
static int command_line_compare(const void* pa, const void* pb)
{
const COMMAND_LINE_ARGUMENT_A* a = pa;
@@ -74,6 +75,7 @@ static int command_line_compare(const void* pa, const void* pb)
return strcmp(a->Name, b->Name);
}
WINPR_ATTR_NODISCARD
static int shadow_server_print_command_line_help(int argc, char** argv,
const COMMAND_LINE_ARGUMENT_A* largs)
{
@@ -612,13 +614,15 @@ int shadow_server_parse_command_line(rdpShadowServer* server, int argc, char** a
return status;
}
WINPR_ATTR_NODISCARD
static DWORD WINAPI shadow_server_thread(LPVOID arg)
{
rdpShadowServer* server = (rdpShadowServer*)arg;
BOOL running = TRUE;
DWORD status = 0;
freerdp_listener* listener = server->listener;
shadow_subsystem_start(server->subsystem);
if (shadow_subsystem_start(server->subsystem) < 0)
running = FALSE;
while (running)
{
@@ -677,6 +681,7 @@ static DWORD WINAPI shadow_server_thread(LPVOID arg)
return 0;
}
WINPR_ATTR_NODISCARD
static BOOL open_port(rdpShadowServer* server, char* address)
{
BOOL status = 0;
@@ -835,6 +840,7 @@ int shadow_server_stop(rdpShadowServer* server)
return 0;
}
WINPR_ATTR_NODISCARD
static int shadow_server_init_config_path(rdpShadowServer* server)
{
if (!server->ConfigPath)
@@ -860,6 +866,7 @@ static int shadow_server_init_config_path(rdpShadowServer* server)
return 1;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_server_create_certificate(rdpShadowServer* server, const char* filepath)
{
BOOL rc = FALSE;
@@ -897,6 +904,8 @@ out_fail:
makecert_context_free(makecert);
return rc;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_server_init_certificate(rdpShadowServer* server)
{
char* filepath = NULL;
@@ -970,6 +979,7 @@ out_fail:
return ret;
}
WINPR_ATTR_NODISCARD
static BOOL shadow_server_check_peer_restrictions(freerdp_listener* listener)
{
WINPR_ASSERT(listener);

View File

@@ -29,6 +29,7 @@ void shadow_subsystem_set_entry(pfnShadowSubsystemEntry pEntry)
pSubsystemEntry = pEntry;
}
WINPR_ATTR_NODISCARD
static int shadow_subsystem_load_entry_points(RDP_SHADOW_ENTRY_POINTS* pEntryPoints)
{
WINPR_ASSERT(pEntryPoints);
@@ -45,20 +46,20 @@ static int shadow_subsystem_load_entry_points(RDP_SHADOW_ENTRY_POINTS* pEntryPoi
rdpShadowSubsystem* shadow_subsystem_new(void)
{
RDP_SHADOW_ENTRY_POINTS ep;
rdpShadowSubsystem* subsystem = NULL;
RDP_SHADOW_ENTRY_POINTS ep = { 0 };
shadow_subsystem_load_entry_points(&ep);
if (shadow_subsystem_load_entry_points(&ep) < 0)
return NULL;
if (!ep.New)
return NULL;
subsystem = ep.New();
rdpShadowSubsystem* subsystem = ep.New();
if (!subsystem)
return NULL;
CopyMemory(&(subsystem->ep), &ep, sizeof(RDP_SHADOW_ENTRY_POINTS));
subsystem->ep = ep;
return subsystem;
}

View File

@@ -35,10 +35,11 @@ extern "C"
WINPR_ATTR_NODISCARD
rdpShadowSubsystem* shadow_subsystem_new(void);
int shadow_subsystem_init(rdpShadowSubsystem* subsystem, rdpShadowServer* server);
WINPR_ATTR_NODISCARD int shadow_subsystem_init(rdpShadowSubsystem* subsystem,
rdpShadowServer* server);
void shadow_subsystem_uninit(rdpShadowSubsystem* subsystem);
int shadow_subsystem_start(rdpShadowSubsystem* subsystem);
WINPR_ATTR_NODISCARD int shadow_subsystem_start(rdpShadowSubsystem* subsystem);
int shadow_subsystem_stop(rdpShadowSubsystem* subsystem);
#ifdef __cplusplus

View File

@@ -36,6 +36,7 @@ static const RDP_SHADOW_SUBSYSTEM g_Subsystems[] = {
static const size_t g_SubsystemCount = ARRAYSIZE(g_Subsystems);
WINPR_ATTR_NODISCARD
static pfnShadowSubsystemEntry shadow_subsystem_load_static_entry(const char* name)
{
if (!name)

View File

@@ -36,8 +36,8 @@ extern "C"
rdpShadowSurface* shadow_surface_new(rdpShadowServer* server, UINT16 x, UINT16 y, UINT32 width,
UINT32 height);
BOOL shadow_surface_resize(rdpShadowSurface* surface, UINT16 x, UINT16 y, UINT32 width,
UINT32 height);
WINPR_ATTR_NODISCARD BOOL shadow_surface_resize(rdpShadowSurface* surface, UINT16 x, UINT16 y,
UINT32 width, UINT32 height);
#ifdef __cplusplus
}