diff --git a/channels/encomsp/server/encomsp_main.c b/channels/encomsp/server/encomsp_main.c index 2ff7eb3a0..eced67f75 100644 --- a/channels/encomsp/server/encomsp_main.c +++ b/channels/encomsp/server/encomsp_main.c @@ -104,10 +104,10 @@ static UINT encomsp_recv_change_participant_control_level_pdu(EncomspServerConte static UINT encomsp_server_receive_pdu(EncomspServerContext* context, wStream* s) { UINT error = CHANNEL_RC_OK; + ENCOMSP_ORDER_HEADER header; while (Stream_GetRemainingLength(s) > 0) { - ENCOMSP_ORDER_HEADER header = { 0 }; if ((error = encomsp_read_header(s, &header))) { WLog_ERR(TAG, "encomsp_read_header failed with error %" PRIu32 "!", error); diff --git a/channels/rdpear/common/rdpear_common.c b/channels/rdpear/common/rdpear_common.c index 8811ceeb3..6f80270ba 100644 --- a/channels/rdpear/common/rdpear_common.c +++ b/channels/rdpear/common/rdpear_common.c @@ -204,24 +204,16 @@ static BOOL ndr_descr_read_RPC_UNICODE_STRING(NdrContext* context, wStream* s, c return ndr_read_RPC_UNICODE_STRING(context, s, hints, res); } +#if 0 BOOL ndr_write_RPC_UNICODE_STRING(NdrContext* context, wStream* s, const void* hints, const RPC_UNICODE_STRING* res) { - WINPR_ASSERT(res); - if (!ndr_write_uint32(context, s, res->lenHints.length)) - return FALSE; - - if (!ndr_write_uint32(context, s, res->lenHints.maxLength)) - return FALSE; - - const BYTE* ptr = WINPR_CXX_COMPAT_CAST(const BYTE*, res->Buffer); - for (size_t x = 0; x < res->strLength; x++) - { - if (!ndr_write_uint8(context, s, ptr[x])) - return FALSE; - } - return TRUE; + return ndr_write_uint32(context, s, res->lenHints.length) && + ndr_write_uint32(context, s, res->lenHints.maxLength) /*&& + ndr_write_BYTE_ptr(context, s, (BYTE*)res->Buffer, res->Length)*/ + ; } +#endif void ndr_dump_RPC_UNICODE_STRING(wLog* logger, UINT32 lvl, size_t indentLevel, const RPC_UNICODE_STRING* obj) @@ -256,7 +248,7 @@ static void ndr_descr_destroy_RPC_UNICODE_STRING(NdrContext* context, const void static const NdrMessageDescr RPC_UNICODE_STRING_descr_s = { NDR_ARITY_SIMPLE, sizeof(RPC_UNICODE_STRING), ndr_descr_read_RPC_UNICODE_STRING, - NULL, + /*ndr_write_RPC_UNICODE_STRING*/ NULL, ndr_descr_destroy_RPC_UNICODE_STRING, ndr_descr_dump_RPC_UNICODE_STRING }; diff --git a/channels/rdpei/client/rdpei_main.c b/channels/rdpei/client/rdpei_main.c index 5c3ad0ba3..db5a80c95 100644 --- a/channels/rdpei/client/rdpei_main.c +++ b/channels/rdpei/client/rdpei_main.c @@ -785,13 +785,15 @@ static UINT rdpei_recv_sc_ready_pdu(GENERIC_CHANNEL_CALLBACK* callback, wStream* if (rdpei->version > protocolVersion) rdpei->version = protocolVersion; rdpei->features = features; +#if 0 - if (protocolVersion > RDPINPUT_PROTOCOL_V300) + if (protocolVersion != RDPINPUT_PROTOCOL_V10) { - WLog_Print(rdpei->base.log, WLOG_WARN, - "Unknown [MS-RDPEI] protocolVersion: 0x%08" PRIX32 "", protocolVersion); + WLog_Print(rdpei->base.log, WLOG_ERROR, "Unknown [MS-RDPEI] protocolVersion: 0x%08"PRIX32"", protocolVersion); + return -1; } +#endif return CHANNEL_RC_OK; } diff --git a/client/SDL/SDL2/sdl_kbd.cpp b/client/SDL/SDL2/sdl_kbd.cpp index a80e37c1c..7648a4dd0 100644 --- a/client/SDL/SDL2/sdl_kbd.cpp +++ b/client/SDL/SDL2/sdl_kbd.cpp @@ -24,7 +24,6 @@ #include "sdl_freerdp.hpp" #include "sdl_utils.hpp" #include "sdl_prefs.hpp" -#include "sdl_touch.hpp" #include @@ -330,24 +329,20 @@ BOOL sdlInput::keyboard_focus_in() freerdp_input_send_focus_in_event(input, WINPR_ASSERTING_INT_CAST(UINT16, syncFlags)); /* finish with a mouse pointer position like mstsc.exe if required */ - // TODO: fullscreen/remote app - int x = 0; - int y = 0; - if (_sdl->fullscreen) - { - SDL_GetGlobalMouseState(&x, &y); - } - else - { - SDL_GetMouseState(&x, &y); - } - auto w = SDL_GetMouseFocus(); - if (w) - { - auto id = SDL_GetWindowID(w); - sdl_scale_coordinates(_sdl, id, &x, &y, TRUE, TRUE); - } - return freerdp_client_send_button_event(_sdl->common(), FALSE, PTR_FLAGS_MOVE, x, y); +#if 0 + if (xfc->remote_app) + return; + + if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state)) + { + if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height)) + { + xf_event_adjust_coordinates(xfc, &x, &y); + freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y); + } + } +#endif + return TRUE; } /* This function is called to update the keyboard indicator LED */ diff --git a/client/SDL/SDL3/sdl_kbd.cpp b/client/SDL/SDL3/sdl_kbd.cpp index 25f4a7965..edd99784a 100644 --- a/client/SDL/SDL3/sdl_kbd.cpp +++ b/client/SDL/SDL3/sdl_kbd.cpp @@ -22,7 +22,6 @@ #include "sdl_freerdp.hpp" #include "sdl_utils.hpp" #include "sdl_prefs.hpp" -#include "sdl_touch.hpp" #include @@ -314,26 +313,20 @@ BOOL sdlInput::keyboard_focus_in() freerdp_input_send_focus_in_event(input, WINPR_ASSERTING_INT_CAST(uint16_t, syncFlags)); /* finish with a mouse pointer position like mstsc.exe if required */ - // TODO: fullscreen/remote app - float fx = 0.0f; - float fy = 0.0f; - if (_sdl->fullscreen) - { - SDL_GetGlobalMouseState(&fx, &fy); - } - else - { - SDL_GetMouseState(&fx, &fy); - } - auto x = static_cast(fx); - auto y = static_cast(fy); - auto w = SDL_GetMouseFocus(); - if (w) - { - auto id = SDL_GetWindowID(w); - sdl_scale_coordinates(_sdl, id, &x, &y, TRUE, TRUE); - } - return freerdp_client_send_button_event(_sdl->common(), FALSE, PTR_FLAGS_MOVE, x, y); +#if 0 + if (xfc->remote_app) + return; + + if (XQueryPointer(xfc->display, xfc->window->handle, &w, &w, &d, &d, &x, &y, &state)) + { + if ((x >= 0) && (x < xfc->window->width) && (y >= 0) && (y < xfc->window->height)) + { + xf_event_adjust_coordinates(xfc, &x, &y); + freerdp_client_send_button_event(&xfc->common, FALSE, PTR_FLAGS_MOVE, x, y); + } + } +#endif + return TRUE; } /* This function is called to update the keyboard indicator LED */ diff --git a/include/freerdp/api.h b/include/freerdp/api.h index 07003bc40..b7655cf20 100644 --- a/include/freerdp/api.h +++ b/include/freerdp/api.h @@ -90,14 +90,13 @@ WLog_VRB("com.freerdp.api", "IFCALLRET(" #_cb ") == NULL"); \ } while (0) -#if defined(__GNUC__) || defined(__clang__) +#if 0 // defined(__GNUC__) #define IFCALLRESULT(_default_return, _cb, ...) \ - __extension__({ \ - if (_cb == NULL) \ - { \ + ({ \ + (_cb != NULL) ? _cb(__VA_ARGS__) : ({ \ WLog_VRB("com.freerdp.api", "IFCALLRESULT(" #_cb ") == NULL"); \ - } \ - ((_cb != NULL) ? _cb(__VA_ARGS__) : (_default_return)); \ + (_default_return); \ + }); \ }) #else #define IFCALLRESULT(_default_return, _cb, ...) \ diff --git a/include/freerdp/codec/color.h b/include/freerdp/codec/color.h index 3b8708179..78f2d43d0 100644 --- a/include/freerdp/codec/color.h +++ b/include/freerdp/codec/color.h @@ -432,7 +432,7 @@ typedef struct gdi_palette gdiPalette; UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc, UINT32 nSrcWidth, UINT32 nSrcHeight); - /** @brief fill an area with the color provided. + /*** * * @param pDstData destination buffer * @param DstFormat destination buffer format @@ -450,31 +450,6 @@ typedef struct gdi_palette gdiPalette; UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, UINT32 color); -#define FREERDP_IMAGE_FILL_IGNORE_ALPHA 1 /** @since version 3.13.0 */ - - /** @brief fill an area with the color provided. If flag \b FREERDP_IMAGE_FILL_IGNORE_ALPHA is - * set the destination alpha value will be kept. - * - * @param pDstData destination buffer - * @param DstFormat destination buffer format - * @param nDstStep destination buffer stride (line in bytes) 0 for default - * @param nXDst destination buffer offset x - * @param nYDst destination buffer offset y - * @param nWidth width to copy in pixels - * @param nHeight height to copy in pixels - * @param color Pixel color in DstFormat (internal representation format, - * use FreeRDPGetColor to create) - * @param flags \b FREERDP_IMAGE_FILL_* flags - * - * @return TRUE if success, FALSE otherwise - * - * @since version 3.13.0 - */ - FREERDP_API BOOL freerdp_image_fill_ex(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, - UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, - UINT32 nWidth, UINT32 nHeight, UINT32 color, - UINT32 flags); - #ifdef __cplusplus } #endif diff --git a/libfreerdp/codec/color.c b/libfreerdp/codec/color.c index 99f9d9602..37eb9f09a 100644 --- a/libfreerdp/codec/color.c +++ b/libfreerdp/codec/color.c @@ -1127,37 +1127,6 @@ BOOL freerdp_image_fill(BYTE* WINPR_RESTRICT pDstData, DWORD DstFormat, UINT32 n return TRUE; } -BOOL freerdp_image_fill_ex(BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32 nXDst, - UINT32 nYDst, UINT32 nWidth, UINT32 nHeight, UINT32 color, UINT32 flags) -{ - if (FreeRDPColorHasAlpha(DstFormat) && ((flags & FREERDP_IMAGE_FILL_IGNORE_ALPHA) != 0)) - { - const UINT32 bpp = FreeRDPGetBytesPerPixel(DstFormat); - BYTE r = 0; - BYTE g = 0; - BYTE b = 0; - FreeRDPSplitColor(color, DstFormat, &r, &g, &b, NULL, NULL); - - for (size_t y = 0; y < nHeight; y++) - { - BYTE* WINPR_RESTRICT line = &pDstData[(y + nYDst) * nDstStep]; - - for (size_t x = 0; x < nWidth; x++) - { - BYTE* WINPR_RESTRICT dst = &line[x * bpp]; - const UINT32 dcolor = FreeRDPReadColor_int(dst, DstFormat); - BYTE a = 0; - FreeRDPSplitColor(dcolor, DstFormat, NULL, NULL, NULL, &a, NULL); - const UINT32 scolor = FreeRDPGetColor(DstFormat, r, g, b, a); - if (!FreeRDPWriteColor_int(dst, DstFormat, scolor)) - return FALSE; - } - } - return TRUE; - } - return freerdp_image_fill(pDstData, DstFormat, nDstStep, nXDst, nYDst, nWidth, nHeight, color); -} - #if defined(WITH_SWSCALE) static int av_format_for_buffer(UINT32 format) { diff --git a/libfreerdp/gdi/gfx.c b/libfreerdp/gdi/gfx.c index fef85cd80..4a0a2ede8 100644 --- a/libfreerdp/gdi/gfx.c +++ b/libfreerdp/gdi/gfx.c @@ -1303,9 +1303,8 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context, const RDPGFX_SOLID_FILL_ const UINT32 nWidth = invalidRect.right - invalidRect.left; const UINT32 nHeight = invalidRect.bottom - invalidRect.top; - if (!freerdp_image_fill_ex(surface->data, surface->format, surface->scanline, - invalidRect.left, invalidRect.top, nWidth, nHeight, color, - FREERDP_IMAGE_FILL_IGNORE_ALPHA)) + if (!freerdp_image_fill(surface->data, surface->format, surface->scanline, invalidRect.left, + invalidRect.top, nWidth, nHeight, color)) goto fail; region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion), &invalidRect); diff --git a/libfreerdp/utils/pcap.c b/libfreerdp/utils/pcap.c index 8c93601ab..c18ae96f5 100644 --- a/libfreerdp/utils/pcap.c +++ b/libfreerdp/utils/pcap.c @@ -192,9 +192,11 @@ BOOL pcap_get_next_record(rdpPcap* pcap, pcap_record* record) rdpPcap* pcap_open(const char* name, BOOL write) { + rdpPcap* pcap = NULL; + WINPR_ASSERT(name); - rdpPcap* pcap = (rdpPcap*)calloc(1, sizeof(rdpPcap)); + pcap = (rdpPcap*)calloc(1, sizeof(rdpPcap)); if (!pcap) goto fail; @@ -240,7 +242,7 @@ void pcap_flush(rdpPcap* pcap) while (pcap->record != NULL) { - (void)pcap_write_record(pcap, pcap->record); + pcap_write_record(pcap, pcap->record); pcap->record = pcap->record->next; } diff --git a/winpr/libwinpr/nt/ntstatus.c b/winpr/libwinpr/nt/ntstatus.c index cb593da2e..9abc42de6 100644 --- a/winpr/libwinpr/nt/ntstatus.c +++ b/winpr/libwinpr/nt/ntstatus.c @@ -23,8 +23,6 @@ #include #include -#define HAVE_SORTED_STRUCT 1 - struct ntstatus_map { DWORD code; @@ -4618,7 +4616,7 @@ static int ntstatus_compare(const void* pKey, const void* pValue) const char* NtStatus2Tag(NTSTATUS ntstatus) { -#if defined(HAVE_SORTED_STRUCT) /* Requires sorted struct */ +#if 1 /* Requires sorted struct */ size_t count = ARRAYSIZE(ntstatusmap); size_t base = sizeof(ntstatusmap[0]); const struct ntstatus_map* found = @@ -4640,7 +4638,7 @@ const char* NtStatus2Tag(NTSTATUS ntstatus) const char* Win32ErrorCode2Tag(UINT16 code) { -#if defined(HAVE_SORTED_STRUCT) /* Requires sorted struct */ +#if 1 /* Requires sorted struct */ DWORD ntstatus = code; size_t count = ARRAYSIZE(win32errmap); size_t base = sizeof(win32errmap[0]); diff --git a/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateProcesses.c b/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateProcesses.c index e48c0a394..4e0702f97 100644 --- a/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateProcesses.c +++ b/winpr/libwinpr/wtsapi/test/TestWtsApiEnumerateProcesses.c @@ -35,19 +35,15 @@ int TestWtsApiEnumerateProcesses(int argc, char* argv[]) return -1; } - int rc = 0; +#if 0 { printf("WTSEnumerateProcesses enumerated %"PRIu32" process:\n", count); for (DWORD i = 0; i < count; i++) - { - const WTS_PROCESS_INFOA* cur = &pProcessInfo[i]; - if (!cur->pProcessName) - rc = -1; - printf("\t[%" PRIu32 "]: %s (%" PRIu32 ")\n", i, cur->pProcessName, cur->ProcessId); - } + printf("\t[%"PRIu32"]: %s (%"PRIu32")\n", i, pProcessInfo[i].pProcessName, pProcessInfo[i].ProcessId); } +#endif WTSFreeMemory(pProcessInfo); - return rc; + return 0; }