Merge pull request #10546 from akallabeth/sign-compare-fix

Sign compare fix
This commit is contained in:
akallabeth 2024-09-04 09:11:50 +02:00 committed by GitHub
commit c851dfcb7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
76 changed files with 242 additions and 199 deletions

View File

@ -48,6 +48,7 @@ Checks: >
-llvm-else-after-return,
-readability-else-after-return,
-modernize-use-trailing-return-type,
-modernize-return-braced-init-list,
-modernize-macro-to-enum,
-readability-braces-around-statements,
-readability-function-cognitive-complexity,

View File

@ -175,7 +175,7 @@ static const IWTSVirtualChannelCallback ainput_functions = { ainput_on_data_rece
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT ainput_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE ainput_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, AINPUT_DVC_CHANNEL_NAME,
sizeof(AINPUT_PLUGIN), sizeof(GENERIC_CHANNEL_CALLBACK),

View File

@ -392,8 +392,8 @@ static UINT audin_alsa_parse_addin_args(AudinALSADevice* device, const ADDIN_ARG
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(
UINT alsa_freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE alsa_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;
AudinALSADevice* alsa = NULL;

View File

@ -810,11 +810,15 @@ static UINT audin_load_device_plugin(AUDIN_PLUGIN* audin, const char* name, cons
FREERDP_AUDIN_DEVICE_ENTRY_POINTS entryPoints = { 0 };
UINT error = ERROR_INTERNAL_ERROR;
const PFREERDP_AUDIN_DEVICE_ENTRY entry =
(const PFREERDP_AUDIN_DEVICE_ENTRY)freerdp_load_channel_addin_entry(AUDIN_CHANNEL_NAME,
name, NULL, 0);
if (entry == NULL)
union
{
PVIRTUALCHANNELENTRY pvce;
PFREERDP_AUDIN_DEVICE_ENTRY entry;
} cnv;
cnv.pvce = freerdp_load_channel_addin_entry(AUDIN_CHANNEL_NAME, name, NULL, 0);
if (cnv.entry == NULL)
{
WLog_Print(audin->log, WLOG_ERROR,
"freerdp_load_channel_addin_entry did not return any function pointers for %s ",
@ -827,7 +831,8 @@ static UINT audin_load_device_plugin(AUDIN_PLUGIN* audin, const char* name, cons
entryPoints.args = args;
entryPoints.rdpcontext = audin->rdpcontext;
if ((error = entry(&entryPoints)))
error = cnv.entry(&entryPoints);
if (error)
{
WLog_Print(audin->log, WLOG_ERROR, "%s entry returned error %" PRIu32 ".", name, error);
return error;
@ -968,7 +973,7 @@ BOOL audin_process_addin_args(AUDIN_PLUGIN* audin, const ADDIN_ARGV* args)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT audin_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE audin_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
struct SubsystemEntry
{

View File

@ -295,8 +295,8 @@ static UINT audin_ios_free(IAudinDevice *device)
return CHANNEL_RC_OK;
}
FREERDP_ENTRY_POINT(
UINT ios_freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE ios_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
DWORD errCode;
char errString[1024];

View File

@ -380,8 +380,8 @@ static UINT audin_mac_parse_addin_args(AudinMacDevice *device, const ADDIN_ARGV
return CHANNEL_RC_OK;
}
FREERDP_ENTRY_POINT(
UINT mac_freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE mac_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
DWORD errCode;
char errString[1024];

View File

@ -292,7 +292,7 @@ static UINT audin_opensles_parse_addin_args(AudinOpenSLESDevice* device, const A
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT opensles_freerdp_audin_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE opensles_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args;

View File

@ -445,8 +445,8 @@ static UINT audin_oss_parse_addin_args(AudinOSSDevice* device, const ADDIN_ARGV*
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(
UINT oss_freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE oss_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;
AudinOSSDevice* oss = NULL;

View File

@ -490,7 +490,7 @@ static UINT audin_pulse_parse_addin_args(AudinPulseDevice* device, const ADDIN_A
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT pulse_freerdp_audin_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE pulse_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;

View File

@ -309,7 +309,7 @@ static UINT audin_sndio_parse_addin_args(AudinSndioDevice* device, ADDIN_ARGV* a
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT sndio_freerdp_audin_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE sndio_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
ADDIN_ARGV* args;

View File

@ -29,6 +29,7 @@
#include <mmsystem.h>
#include <winpr/crt.h>
#include <winpr/wtsapi.h>
#include <winpr/cmdline.h>
#include <freerdp/freerdp.h>
#include <freerdp/addin.h>
@ -491,7 +492,7 @@ static UINT audin_winmm_parse_addin_args(AudinWinmmDevice* device, const ADDIN_A
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT winmm_freerdp_audin_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE winmm_freerdp_audin_client_subsystem_entry(
PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args;

View File

@ -2,6 +2,8 @@
# FreeRDP cmake build script
#
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
# Copyright 2024 Armin Novak <anovak@thincast.com>
# Copyright 2024 Thincast Technologies GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -29,23 +31,13 @@ if(CHANNEL_STATIC_CLIENT_ENTRIES)
list(REMOVE_DUPLICATES CHANNEL_STATIC_CLIENT_ENTRIES)
endif()
set(CLIENT_STATIC_TYPEDEFS "#if __GNUC__\n")
set(CLIENT_STATIC_TYPEDEFS "${CLIENT_STATIC_TYPEDEFS}#pragma GCC diagnostic push\n")
set(CLIENT_STATIC_TYPEDEFS "${CLIENT_STATIC_TYPEDEFS}#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"\n")
set(CLIENT_STATIC_TYPEDEFS "${CLIENT_STATIC_TYPEDEFS}#endif\n")
set(CLIENT_STATIC_TYPEDEFS "${CLIENT_STATIC_TYPEDEFS}typedef UINT (*static_entry_fkt)();\n")
set(CLIENT_STATIC_TYPEDEFS "${CLIENT_STATIC_TYPEDEFS}typedef UINT (*static_addin_fkt)();\n")
set(CLIENT_STATIC_TYPEDEFS "${CLIENT_STATIC_TYPEDEFS}#if __GNUC__\n")
set(CLIENT_STATIC_TYPEDEFS "${CLIENT_STATIC_TYPEDEFS}#pragma GCC diagnostic pop\n")
set(CLIENT_STATIC_TYPEDEFS "${CLIENT_STATIC_TYPEDEFS}#endif\n")
foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES})
foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES})
foreach(ENTRY ${${STATIC_MODULE}_CLIENT_ENTRY})
if(${ENTRY} STREQUAL ${STATIC_ENTRY})
set(STATIC_MODULE_NAME ${${STATIC_MODULE}_CLIENT_NAME})
set(STATIC_MODULE_CHANNEL ${${STATIC_MODULE}_CLIENT_CHANNEL})
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ${STATIC_MODULE_NAME})
list(APPEND ${MODULE_PREFIX}_LIBS ${STATIC_MODULE_NAME})
set(ENTRY_POINT_NAME "${STATIC_MODULE_CHANNEL}_${ENTRY}")
if(${ENTRY} STREQUAL "VirtualChannelEntry")
@ -53,14 +45,15 @@ foreach(STATIC_ENTRY ${CHANNEL_STATIC_CLIENT_ENTRIES})
elseif(${ENTRY} STREQUAL "VirtualChannelEntryEx")
set(ENTRY_POINT_IMPORT "extern BOOL VCAPITYPE ${ENTRY_POINT_NAME}(PCHANNEL_ENTRY_POINTS,PVOID);")
elseif(${ENTRY} MATCHES "DVCPluginEntry$")
set(ENTRY_POINT_IMPORT "extern UINT ${ENTRY_POINT_NAME}(IDRDYNVC_ENTRY_POINTS* pEntryPoints);")
set(ENTRY_POINT_IMPORT "extern UINT VCAPITYPE ${ENTRY_POINT_NAME}(IDRDYNVC_ENTRY_POINTS* pEntryPoints);")
elseif(${ENTRY} MATCHES "DeviceServiceEntry$")
set(ENTRY_POINT_IMPORT "extern UINT ${ENTRY_POINT_NAME}(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints);")
set(ENTRY_POINT_IMPORT "extern UINT VCAPITYPE ${ENTRY_POINT_NAME}(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints);")
else()
set(ENTRY_POINT_IMPORT "extern UINT ${ENTRY_POINT_NAME}(void);")
set(ENTRY_POINT_IMPORT "extern UINT VCAPITYPE ${ENTRY_POINT_NAME}(void);")
endif()
set(${STATIC_ENTRY}_IMPORTS "${${STATIC_ENTRY}_IMPORTS}\n${ENTRY_POINT_IMPORT}")
set(${STATIC_ENTRY}_TABLE "${${STATIC_ENTRY}_TABLE}\n\t{ \"${STATIC_MODULE_CHANNEL}\", (static_entry_fkt)${ENTRY_POINT_NAME} },")
string(APPEND ${STATIC_ENTRY}_IMPORTS "\n${ENTRY_POINT_IMPORT}")
string(APPEND ${STATIC_ENTRY}_TABLE "\n\t{ \"${STATIC_MODULE_CHANNEL}\", ${ENTRY_POINT_NAME} },")
endif()
endforeach()
endforeach()
@ -105,14 +98,14 @@ foreach(STATIC_MODULE ${CHANNEL_STATIC_CLIENT_MODULES})
set(STATIC_SUBSYSTEM_ENTRY "${STATIC_SUBSYSTEM_NAME}_freerdp_${STATIC_MODULE_CHANNEL}_client_subsystem_entry")
endif()
set(SUBSYSTEM_TABLE "${SUBSYSTEM_TABLE}\n\t{ \"${STATIC_SUBSYSTEM_NAME}\", \"${STATIC_SUBSYSTEM_TYPE}\", ${STATIC_SUBSYSTEM_ENTRY} },")
set(SUBSYSTEM_IMPORT "extern UINT ${STATIC_SUBSYSTEM_ENTRY}(void*);")
set(SUBSYSTEM_IMPORT "extern UINT VCAPITYPE ${STATIC_SUBSYSTEM_ENTRY}(void*);")
set(CLIENT_STATIC_SUBSYSTEM_IMPORTS "${CLIENT_STATIC_SUBSYSTEM_IMPORTS}\n${SUBSYSTEM_IMPORT}")
endforeach()
set(SUBSYSTEM_TABLE "${SUBSYSTEM_TABLE}\n\t{ NULL, NULL, NULL }\n};")
set(CLIENT_STATIC_SUBSYSTEM_TABLES "${CLIENT_STATIC_SUBSYSTEM_TABLES}\n${SUBSYSTEM_TABLE}")
foreach(ENTRY ${${STATIC_MODULE}_CLIENT_ENTRY})
set (ENTRY_POINT_NAME ${STATIC_MODULE_CHANNEL}_${ENTRY})
set(CLIENT_STATIC_ADDIN_TABLE "${CLIENT_STATIC_ADDIN_TABLE}\n\t{ \"${STATIC_MODULE_CHANNEL}\", \"${ENTRY}\", (static_addin_fkt)${ENTRY_POINT_NAME}, ${SUBSYSTEM_TABLE_NAME} },")
set(CLIENT_STATIC_ADDIN_TABLE "${CLIENT_STATIC_ADDIN_TABLE}\n\t{ \"${STATIC_MODULE_CHANNEL}\", \"${ENTRY}\", ${ENTRY_POINT_NAME}, ${SUBSYSTEM_TABLE_NAME} },")
endforeach()
endforeach()
set(CLIENT_STATIC_ADDIN_TABLE "${CLIENT_STATIC_ADDIN_TABLE}\n\t{ NULL, NULL, NULL, NULL }\n};")

View File

@ -57,7 +57,7 @@ static void* freerdp_channels_find_static_entry_in_table(const STATIC_ENTRY_TABL
union
{
void* pv;
UINT (*entry)();
static_entry_fn_t entry;
} cnv;
cnv.entry = pEntry->entry;
return cnv.pv;

View File

@ -25,9 +25,9 @@
${CLIENT_STATIC_TYPEDEFS}
${CLIENT_STATIC_ENTRY_IMPORTS}
${CLIENT_STATIC_SUBSYSTEM_IMPORTS}
${CLIENT_STATIC_ENTRY_TABLES}
${CLIENT_STATIC_ENTRY_TABLES_LIST}
${CLIENT_STATIC_SUBSYSTEM_IMPORTS}
${CLIENT_STATIC_SUBSYSTEM_TABLES}
${CLIENT_STATIC_ADDIN_TABLE}

View File

@ -18,16 +18,18 @@
*/
#include <winpr/platform.h>
#include <winpr/wtsapi.h>
#include <freerdp/svc.h>
/* The 'entry' function pointers have variable arguments. */
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_STRICT_PROTOTYPES
typedef UINT(VCAPITYPE* static_entry_fn_t)();
typedef struct
{
const char* name;
UINT (*entry)();
static_entry_fn_t entry;
} STATIC_ENTRY;
typedef struct
@ -36,18 +38,20 @@ typedef struct
const STATIC_ENTRY* table;
} STATIC_ENTRY_TABLE;
typedef UINT(VCAPITYPE* static_subsystem_entry_fn_t)();
typedef struct
{
const char* name;
const char* type;
UINT (*entry)();
static_subsystem_entry_fn_t entry;
} STATIC_SUBSYSTEM_ENTRY;
typedef UINT(VCAPITYPE* static_addin_entry_fn_t)();
typedef struct
{
const char* name;
const char* type;
UINT (*entry)();
static_addin_entry_fn_t entry;
const STATIC_SUBSYSTEM_ENTRY* table;
} STATIC_ADDIN_TABLE;

View File

@ -314,7 +314,7 @@ static const IWTSVirtualChannelCallback disp_callbacks = { disp_on_data_received
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT disp_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE disp_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, DISP_DVC_CHANNEL_NAME,
sizeof(DISP_PLUGIN), sizeof(GENERIC_CHANNEL_CALLBACK),

View File

@ -352,18 +352,22 @@ fail:
static UINT dvcman_load_addin(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager* pChannelMgr,
const ADDIN_ARGV* args, rdpContext* context)
{
PDVC_PLUGIN_ENTRY pDVCPluginEntry = NULL;
WINPR_ASSERT(drdynvc);
WINPR_ASSERT(pChannelMgr);
WINPR_ASSERT(args);
WINPR_ASSERT(context);
WLog_Print(drdynvc->log, WLOG_INFO, "Loading Dynamic Virtual Channel %s", args->argv[0]);
pDVCPluginEntry = (PDVC_PLUGIN_ENTRY)freerdp_load_channel_addin_entry(
args->argv[0], NULL, NULL, FREERDP_ADDIN_CHANNEL_DYNAMIC);
if (pDVCPluginEntry)
union
{
PVIRTUALCHANNELENTRY pvce;
PDVC_PLUGIN_ENTRY pDVCPluginEntry;
} cnv;
cnv.pvce =
freerdp_load_channel_addin_entry(args->argv[0], NULL, NULL, FREERDP_ADDIN_CHANNEL_DYNAMIC);
if (cnv.pDVCPluginEntry)
{
DVCMAN_ENTRY_POINTS entryPoints = { 0 };
@ -375,7 +379,7 @@ static UINT dvcman_load_addin(drdynvcPlugin* drdynvc, IWTSVirtualChannelManager*
entryPoints.dvcman = (DVCMAN*)pChannelMgr;
entryPoints.args = args;
entryPoints.context = context;
return pDVCPluginEntry(&entryPoints.iface);
return cnv.pDVCPluginEntry(&entryPoints.iface);
}
return ERROR_INVALID_FUNCTION;

View File

@ -1009,7 +1009,8 @@ out_error:
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT drive_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
FREERDP_ENTRY_POINT(
UINT VCAPITYPE drive_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
{
RDPDR_DRIVE* drive = NULL;
UINT error = 0;

View File

@ -84,7 +84,7 @@ static const IWTSVirtualChannelCallback echo_callbacks = { echo_on_data_received
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT echo_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE echo_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, ECHO_DVC_CHANNEL_NAME,
sizeof(ECHO_PLUGIN), sizeof(GENERIC_CHANNEL_CALLBACK),

View File

@ -394,7 +394,7 @@ static void terminate_plugin_cb(GENERIC_DYNVC_PLUGIN* base)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT geometry_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE geometry_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, GEOMETRY_DVC_CHANNEL_NAME,
sizeof(GEOMETRY_PLUGIN), sizeof(GENERIC_CHANNEL_CALLBACK),

View File

@ -465,7 +465,7 @@ static const IWTSVirtualChannelCallback location_callbacks = { location_on_data_
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT location_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE location_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, LOCATION_DVC_CHANNEL_NAME,
sizeof(LOCATION_PLUGIN), sizeof(LOCATION_CALLBACK),

View File

@ -430,7 +430,8 @@ static void parallel_message_free(void* obj)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT parallel_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
FREERDP_ENTRY_POINT(
UINT VCAPITYPE parallel_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
{
PARALLEL_DEVICE* parallel = NULL;
UINT error = 0;

View File

@ -366,7 +366,7 @@ static rdpPrinter** printer_cups_enum_printers(rdpPrinterDriver* driver)
if (!printers)
return NULL;
for (size_t i = 0; i < num_dests; i++)
for (size_t i = 0; i < (size_t)num_dests; i++)
{
const cups_dest_t* dest = &dests[i];
if (dest->instance == NULL)
@ -432,7 +432,7 @@ static void printer_cups_release_ref_driver(rdpPrinterDriver* driver)
cups_driver->references--;
}
FREERDP_ENTRY_POINT(UINT cups_freerdp_printer_client_subsystem_entry(void* arg))
FREERDP_ENTRY_POINT(UINT VCAPITYPE cups_freerdp_printer_client_subsystem_entry(void* arg))
{
rdpPrinterDriver** ppPrinter = (rdpPrinterDriver**)arg;
if (!ppPrinter)

View File

@ -1072,7 +1072,8 @@ static rdpPrinterDriver* printer_load_backend(const char* backend)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT printer_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
FREERDP_ENTRY_POINT(
UINT VCAPITYPE printer_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
{
char* name = NULL;
char* driver_name = NULL;

View File

@ -23,6 +23,7 @@
#include <freerdp/config.h>
#include <winpr/crt.h>
#include <winpr/wtsapi.h>
#include <winpr/string.h>
#include <winpr/windows.h>
@ -436,7 +437,7 @@ static void printer_win_release_ref_driver(rdpPrinterDriver* driver)
win->references--;
}
FREERDP_ENTRY_POINT(UINT win_freerdp_printer_client_subsystem_entry(void* arg))
FREERDP_ENTRY_POINT(UINT VCAPITYPE win_freerdp_printer_client_subsystem_entry(void* arg))
{
rdpPrinterDriver** ppPrinter = (rdpPrinterDriver**)arg;
if (!ppPrinter)

View File

@ -185,8 +185,12 @@ static const char PARALLEL_SERVICE_NAME[] = "parallel";
UINT devman_load_device_service(DEVMAN* devman, const RDPDR_DEVICE* device, rdpContext* rdpcontext)
{
const char* ServiceName = NULL;
DEVICE_SERVICE_ENTRY_POINTS ep;
PDEVICE_SERVICE_ENTRY entry = NULL;
DEVICE_SERVICE_ENTRY_POINTS ep = { 0 };
union
{
PVIRTUALCHANNELENTRY pvce;
PDEVICE_SERVICE_ENTRY entry;
} cnv;
union
{
const RDPDR_DEVICE* cdp;
@ -219,10 +223,9 @@ UINT devman_load_device_service(DEVMAN* devman, const RDPDR_DEVICE* device, rdpC
else
WLog_INFO(TAG, "Loading device service %s (static)", ServiceName);
entry = (PDEVICE_SERVICE_ENTRY)freerdp_load_channel_addin_entry(ServiceName, NULL,
"DeviceServiceEntry", 0);
cnv.pvce = freerdp_load_channel_addin_entry(ServiceName, NULL, "DeviceServiceEntry", 0);
if (!entry)
if (!cnv.entry)
{
WLog_INFO(TAG, "freerdp_load_channel_addin_entry failed!");
return ERROR_INTERNAL_ERROR;
@ -232,5 +235,5 @@ UINT devman_load_device_service(DEVMAN* devman, const RDPDR_DEVICE* device, rdpC
ep.RegisterDevice = devman_register_device;
ep.device = devconv.dp;
ep.rdpcontext = rdpcontext;
return entry(&ep);
return cnv.entry(&ep);
}

View File

@ -468,11 +468,14 @@ static UINT ecam_load_hal_plugin(CameraPlugin* ecam, const char* name, const ADD
FREERDP_CAMERA_HAL_ENTRY_POINTS entryPoints = { 0 };
UINT error = ERROR_INTERNAL_ERROR;
const PFREERDP_CAMERA_HAL_ENTRY entry =
(const PFREERDP_CAMERA_HAL_ENTRY)freerdp_load_channel_addin_entry(RDPECAM_CHANNEL_NAME,
name, NULL, 0);
union
{
PVIRTUALCHANNELENTRY pvce;
const PFREERDP_CAMERA_HAL_ENTRY entry;
} cnv;
cnv.pvce = freerdp_load_channel_addin_entry(RDPECAM_CHANNEL_NAME, name, NULL, 0);
if (entry == NULL)
if (cnv.entry == NULL)
{
WLog_ERR(TAG,
"freerdp_load_channel_addin_entry did not return any function pointers for %s ",
@ -485,7 +488,8 @@ static UINT ecam_load_hal_plugin(CameraPlugin* ecam, const char* name, const ADD
entryPoints.args = args;
entryPoints.ecam = ecam;
if ((error = entry(&entryPoints)))
error = cnv.entry(&entryPoints);
if (error)
{
WLog_ERR(TAG, "%s entry returned error %" PRIu32 ".", name, error);
return error;
@ -500,7 +504,7 @@ static UINT ecam_load_hal_plugin(CameraPlugin* ecam, const char* name, const ADD
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT rdpecam_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE rdpecam_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
UINT error = CHANNEL_RC_INITIALIZATION_ERROR;

View File

@ -734,8 +734,8 @@ static UINT cam_v4l_free(ICamHal* ihal)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(
UINT v4l_freerdp_rdpecam_client_subsystem_entry(PFREERDP_CAMERA_HAL_ENTRY_POINTS pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE v4l_freerdp_rdpecam_client_subsystem_entry(
PFREERDP_CAMERA_HAL_ENTRY_POINTS pEntryPoints))
{
UINT ret = CHANNEL_RC_OK;
WINPR_ASSERT(pEntryPoints);

View File

@ -1466,7 +1466,7 @@ static const IWTSVirtualChannelCallback geometry_callbacks = { rdpei_on_data_rec
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT rdpei_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE rdpei_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, RDPEI_DVC_CHANNEL_NAME,
sizeof(RDPEI_PLUGIN), sizeof(GENERIC_CHANNEL_CALLBACK),

View File

@ -2424,7 +2424,7 @@ static const IWTSVirtualChannelCallback rdpgfx_callbacks = { rdpgfx_on_data_rece
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT rdpgfx_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE rdpgfx_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
return freerdp_generic_DVCPluginEntry(pEntryPoints, TAG, RDPGFX_DVC_CHANNEL_NAME,
sizeof(RDPGFX_PLUGIN), sizeof(GENERIC_CHANNEL_CALLBACK),

View File

@ -511,7 +511,7 @@ static UINT rdpsnd_alsa_parse_addin_args(rdpsndDevicePlugin* device, const ADDIN
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT alsa_freerdp_rdpsnd_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE alsa_freerdp_rdpsnd_client_subsystem_entry(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;

View File

@ -109,7 +109,7 @@ static UINT rdpsnd_fake_parse_addin_args(rdpsndFakePlugin* fake, const ADDIN_ARG
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT fake_freerdp_rdpsnd_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE fake_freerdp_rdpsnd_client_subsystem_entry(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;

View File

@ -262,7 +262,7 @@ static void rdpsnd_ios_free(rdpsndDevicePlugin* device)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT ios_freerdp_rdpsnd_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE ios_freerdp_rdpsnd_client_subsystem_entry(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints))
{
rdpsndIOSPlugin* p = (rdpsndIOSPlugin*)calloc(1, sizeof(rdpsndIOSPlugin));

View File

@ -382,7 +382,7 @@ static UINT rdpsnd_mac_play(rdpsndDevicePlugin *device, const BYTE *data, size_t
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT mac_freerdp_rdpsnd_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE mac_freerdp_rdpsnd_client_subsystem_entry(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints))
{
rdpsndMacPlugin *mac;

View File

@ -332,7 +332,7 @@ static int rdpsnd_opensles_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_AR
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT opensles_freerdp_rdpsnd_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE opensles_freerdp_rdpsnd_client_subsystem_entry(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints))
{
ADDIN_ARGV* args;

View File

@ -443,7 +443,7 @@ static int rdpsnd_oss_parse_addin_args(rdpsndDevicePlugin* device, const ADDIN_A
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT oss_freerdp_rdpsnd_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE oss_freerdp_rdpsnd_client_subsystem_entry(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;

View File

@ -704,7 +704,7 @@ static UINT rdpsnd_pulse_parse_addin_args(rdpsndDevicePlugin* device, const ADDI
return CHANNEL_RC_OK;
}
FREERDP_ENTRY_POINT(UINT pulse_freerdp_rdpsnd_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE pulse_freerdp_rdpsnd_client_subsystem_entry(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args = NULL;

View File

@ -848,23 +848,28 @@ static void rdpsnd_register_device_plugin(rdpsndPlugin* rdpsnd, rdpsndDevicePlug
static UINT rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name,
const ADDIN_ARGV* args)
{
PFREERDP_RDPSND_DEVICE_ENTRY entry = NULL;
FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints;
union
{
PVIRTUALCHANNELENTRY pvce;
PFREERDP_RDPSND_DEVICE_ENTRY entry;
} cnv;
FREERDP_RDPSND_DEVICE_ENTRY_POINTS entryPoints = { 0 };
UINT error = 0;
DWORD flags = FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX;
if (rdpsnd->dynamic)
flags = FREERDP_ADDIN_CHANNEL_DYNAMIC;
entry = (PFREERDP_RDPSND_DEVICE_ENTRY)freerdp_load_channel_addin_entry(RDPSND_CHANNEL_NAME,
name, NULL, flags);
cnv.pvce = freerdp_load_channel_addin_entry(RDPSND_CHANNEL_NAME, name, NULL, flags);
if (!entry)
if (!cnv.entry)
return ERROR_INTERNAL_ERROR;
entryPoints.rdpsnd = rdpsnd;
entryPoints.pRegisterRdpsndDevice = rdpsnd_register_device_plugin;
entryPoints.args = args;
if ((error = entry(&entryPoints)))
error = cnv.entry(&entryPoints);
if (error)
WLog_ERR(TAG, "%s %s entry returns error %" PRIu32 "", rdpsnd_is_dyn_str(rdpsnd->dynamic),
name, error);
@ -1795,7 +1800,7 @@ static UINT rdpsnd_plugin_terminated(IWTSPlugin* pPlugin)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT rdpsnd_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE rdpsnd_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
UINT error = CHANNEL_RC_OK;
rdpsndPlugin* rdpsnd = NULL;

View File

@ -179,7 +179,7 @@ static UINT rdpsnd_sndio_parse_addin_args(rdpsndDevicePlugin* device, ADDIN_ARGV
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT sndio_freerdp_rdpsnd_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE sndio_freerdp_rdpsnd_client_subsystem_entry(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints))
{
ADDIN_ARGV* args;

View File

@ -31,6 +31,7 @@
#include <mmsystem.h>
#include <winpr/crt.h>
#include <winpr/wtsapi.h>
#include <winpr/cmdline.h>
#include <winpr/sysinfo.h>
@ -313,7 +314,7 @@ static void rdpsnd_winmm_parse_addin_args(rdpsndDevicePlugin* device, const ADDI
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT winmm_freerdp_rdpsnd_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE winmm_freerdp_rdpsnd_client_subsystem_entry(
PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints))
{
const ADDIN_ARGV* args;

View File

@ -837,7 +837,8 @@ static void irp_thread_close(void* arg)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT serial_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
FREERDP_ENTRY_POINT(
UINT VCAPITYPE serial_DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
{
size_t len = 0;
SERIAL_DEVICE* serial = NULL;

View File

@ -625,8 +625,7 @@ static void smartcard_free_irp(void* obj)
*
* @return 0 on success, otherwise a Win32 error code
*/
extern UINT DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints);
UINT DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
FREERDP_ENTRY_POINT(UINT VCAPITYPE DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints))
{
SMARTCARD_DEVICE* smartcard = NULL;
size_t length = 0;

View File

@ -345,7 +345,7 @@ static UINT sshagent_plugin_terminated(IWTSPlugin* pPlugin)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT sshagent_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE sshagent_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
UINT status = CHANNEL_RC_OK;
SSHAGENT_PLUGIN* sshagent;

View File

@ -221,7 +221,7 @@ static void tsmf_alsa_free(ITSMFAudioDevice* audio)
free(alsa);
}
FREERDP_ENTRY_POINT(UINT alsa_freerdp_tsmf_client_audio_subsystem_entry(void* ptr))
FREERDP_ENTRY_POINT(UINT VCAPITYPE alsa_freerdp_tsmf_client_audio_subsystem_entry(void* ptr))
{
ITSMFAudioDevice** sptr = (ITSMFAudioDevice**)ptr;
WINPR_ASSERT(sptr);

View File

@ -693,7 +693,7 @@ static BOOL CALLBACK InitializeAvCodecs(PINIT_ONCE once, PVOID param, PVOID* con
return TRUE;
}
FREERDP_ENTRY_POINT(UINT ffmpeg_freerdp_tsmf_client_decoder_subsystem_entry(void* ptr))
FREERDP_ENTRY_POINT(UINT VCAPITYPE ffmpeg_freerdp_tsmf_client_decoder_subsystem_entry(void* ptr))
{
ITSMFDecoder** sptr = (ITSMFDecoder**)ptr;
WINPR_ASSERT(sptr);

View File

@ -1003,7 +1003,7 @@ static BOOL tsmf_gstreamer_sync(ITSMFDecoder* decoder, void (*cb)(void*), void*
return TRUE;
}
FREERDP_ENTRY_POINT(UINT gstreamer_freerdp_tsmf_client_decoder_subsystem_entry(void* ptr))
FREERDP_ENTRY_POINT(UINT VCAPITYPE gstreamer_freerdp_tsmf_client_decoder_subsystem_entry(void* ptr))
{
ITSMFDecoder** sptr = (ITSMFDecoder**)ptr;
WINPR_ASSERT(sptr);

View File

@ -231,7 +231,7 @@ static void tsmf_oss_free(ITSMFAudioDevice* audio)
free(oss);
}
FREERDP_ENTRY_POINT(UINT oss_freerdp_tsmf_client_audio_subsystem_entry(void* ptr))
FREERDP_ENTRY_POINT(UINT VCAPITYPE oss_freerdp_tsmf_client_audio_subsystem_entry(void* ptr))
{
ITSMFAudioDevice** sptr = (ITSMFAudioDevice**)ptr;
WINPR_ASSERT(sptr);

View File

@ -396,7 +396,7 @@ static void tsmf_pulse_free(ITSMFAudioDevice* audio)
free(pulse);
}
FREERDP_ENTRY_POINT(UINT pulse_freerdp_tsmf_client_audio_subsystem_entry(void* ptr))
FREERDP_ENTRY_POINT(UINT VCAPITYPE pulse_freerdp_tsmf_client_audio_subsystem_entry(void* ptr))
{
ITSMFAudioDevice** sptr = (ITSMFAudioDevice**)ptr;
WINPR_ASSERT(sptr);

View File

@ -552,7 +552,7 @@ static UINT tsmf_process_addin_args(IWTSPlugin* pPlugin, const ADDIN_ARGV* args)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT tsmf_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE tsmf_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
UINT status = 0;
TSMF_PLUGIN* tsmf = NULL;

View File

@ -864,7 +864,7 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT
msg, ret, devDescriptor->iProduct);
len = MIN(sizeof(strDesc), inSize);
for (ssize_t i = 0; i < len; i++)
for (size_t i = 0; i < len; i++)
text[i] = (WCHAR)strDesc[i];
*BufferSize = (BYTE)(len * 2);
@ -899,7 +899,7 @@ static UINT32 libusb_udev_control_query_device_text(IUDEVICE* idev, UINT32 TextT
len = strnlen(deviceLocation,
MIN(sizeof(deviceLocation), (inSize > 0) ? inSize - 1U : 0));
for (ssize_t i = 0; i < len; i++)
for (size_t i = 0; i < len; i++)
text[i] = (WCHAR)deviceLocation[i];
text[len++] = '\0';
*BufferSize = (UINT8)(len * sizeof(WCHAR));

View File

@ -894,7 +894,7 @@ static DWORD WINAPI poll_thread(LPVOID lpThreadParameter)
return 0;
}
FREERDP_ENTRY_POINT(UINT libusb_freerdp_urbdrc_client_subsystem_entry(
FREERDP_ENTRY_POINT(UINT VCAPITYPE libusb_freerdp_urbdrc_client_subsystem_entry(
PFREERDP_URBDRC_SERVICE_ENTRY_POINTS pEntryPoints))
{
wObject* obj = NULL;

View File

@ -769,22 +769,26 @@ static BOOL urbdrc_register_udevman_addin(IWTSPlugin* pPlugin, IUDEVMAN* udevman
static UINT urbdrc_load_udevman_addin(IWTSPlugin* pPlugin, LPCSTR name, const ADDIN_ARGV* args)
{
URBDRC_PLUGIN* urbdrc = (URBDRC_PLUGIN*)pPlugin;
PFREERDP_URBDRC_DEVICE_ENTRY entry = NULL;
FREERDP_URBDRC_SERVICE_ENTRY_POINTS entryPoints;
entry = (PFREERDP_URBDRC_DEVICE_ENTRY)freerdp_load_channel_addin_entry(URBDRC_CHANNEL_NAME,
name, NULL, 0);
FREERDP_URBDRC_SERVICE_ENTRY_POINTS entryPoints = { 0 };
union
{
PVIRTUALCHANNELENTRY pvce;
PFREERDP_URBDRC_DEVICE_ENTRY entry;
} cnv;
cnv.pvce = freerdp_load_channel_addin_entry(URBDRC_CHANNEL_NAME, name, NULL, 0);
if (!entry)
if (!cnv.entry)
return ERROR_INVALID_OPERATION;
entryPoints.plugin = pPlugin;
entryPoints.pRegisterUDEVMAN = urbdrc_register_udevman_addin;
entryPoints.args = args;
if (entry(&entryPoints) != 0)
const UINT error = cnv.entry(&entryPoints);
if (error)
{
WLog_Print(urbdrc->log, WLOG_ERROR, "%s entry returns error.", name);
return ERROR_INVALID_OPERATION;
return error;
}
return CHANNEL_RC_OK;
@ -950,7 +954,7 @@ BOOL del_device(IUDEVMAN* idevman, UINT32 flags, BYTE busnum, BYTE devnum, UINT1
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT urbdrc_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE urbdrc_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
UINT status = 0;
const ADDIN_ARGV* args = NULL;

View File

@ -1170,7 +1170,7 @@ static UINT video_plugin_terminated(IWTSPlugin* pPlugin)
*
* @return 0 on success, otherwise a Win32 error code
*/
FREERDP_ENTRY_POINT(UINT video_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
FREERDP_ENTRY_POINT(UINT VCAPITYPE video_DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints))
{
UINT error = CHANNEL_RC_OK;
VIDEO_PLUGIN* videoPlugin = NULL;

View File

@ -458,7 +458,7 @@ std::string SDLConnectionDialog::print(const char* fmt, va_list ap)
size = vsnprintf(res.data(), res.size(), fmt, copy);
va_end(copy);
} while ((size > 0) && (size > res.size()));
} while ((size > 0) && (static_cast<size_t>(size) > res.size()));
return res;
}

View File

@ -326,9 +326,13 @@ BOOL sdl_detect_monitors(SdlContext* sdl, UINT32* pMaxWidth, UINT32* pMaxHeight)
const int numDisplays = SDL_GetNumVideoDisplays();
auto nr = freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds);
if (numDisplays < 0)
return FALSE;
if (nr == 0)
{
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorIds, nullptr, numDisplays))
if (!freerdp_settings_set_pointer_len(settings, FreeRDP_MonitorIds, nullptr,
static_cast<size_t>(numDisplays)))
return FALSE;
for (size_t x = 0; x < numDisplays; x++)
{
@ -340,7 +344,7 @@ BOOL sdl_detect_monitors(SdlContext* sdl, UINT32* pMaxWidth, UINT32* pMaxHeight)
{
/* There were more IDs supplied than there are monitors */
if (nr > numDisplays)
if (nr > static_cast<UINT32>(numDisplays))
{
WLog_ERR(TAG,
"Found %" PRIu32 " monitor IDs, but only have %" PRIu32 " monitors connected",

View File

@ -456,7 +456,7 @@ std::string SDLConnectionDialog::print(const char* fmt, va_list ap)
size = vsnprintf(res.data(), res.size(), fmt, copy);
va_end(copy);
} while ((size > 0) && (size > res.size()));
} while ((size > 0) && (static_cast<size_t>(size) > res.size()));
return res;
}

View File

@ -323,8 +323,11 @@ BOOL sdl_detect_monitors(SdlContext* sdl, UINT32* pMaxWidth, UINT32* pMaxHeight)
{
int numDisplays = 0;
auto sids = SDL_GetDisplays(&numDisplays);
ids = std::vector<SDL_DisplayID>(sids, sids + numDisplays);
if (sids && (numDisplays > 0))
ids = std::vector<SDL_DisplayID>(sids, sids + numDisplays);
SDL_free(sids);
if (numDisplays < 0)
return FALSE;
}
auto nr = freerdp_settings_get_uint32(settings, FreeRDP_NumMonitorIds);

View File

@ -94,7 +94,7 @@ std::vector<std::string> SdlPref::get_array(const std::string& key,
return fallback;
std::vector<std::string> values;
for (int x = 0; x < WINPR_JSON_GetArraySize(item); x++)
for (size_t x = 0; x < WINPR_JSON_GetArraySize(item); x++)
{
auto cur = WINPR_JSON_GetArrayItem(item, x);
values.push_back(item_to_str(cur));

View File

@ -186,15 +186,17 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
if (XRRQueryExtension(xfc->display, &major, &minor) &&
(XRRQueryVersion(xfc->display, &major, &minor) == True) && (major * 100 + minor >= 105))
{
rrmonitors =
XRRGetMonitors(xfc->display, DefaultRootWindow(xfc->display), 1, &vscreen->nmonitors);
int nmonitors = 0;
rrmonitors = XRRGetMonitors(xfc->display, DefaultRootWindow(xfc->display), 1, &nmonitors);
if (vscreen->nmonitors > 16)
if ((nmonitors < 0) || (nmonitors > 16))
vscreen->nmonitors = 0;
else
vscreen->nmonitors = (UINT32)nmonitors;
if (vscreen->nmonitors)
{
for (int i = 0; i < vscreen->nmonitors; i++)
for (UINT32 i = 0; i < vscreen->nmonitors; i++)
{
MONITOR_INFO* cur_vscreen = &vscreen->monitors[i];
const XRRMonitorInfo* cur_monitor = &rrmonitors[i];
@ -213,14 +215,17 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
#ifdef WITH_XINERAMA
if (XineramaQueryExtension(xfc->display, &major, &minor) && XineramaIsActive(xfc->display))
{
XineramaScreenInfo* screenInfo = XineramaQueryScreens(xfc->display, &vscreen->nmonitors);
int nmonitors = 0;
XineramaScreenInfo* screenInfo = XineramaQueryScreens(xfc->display, &nmonitors);
if (vscreen->nmonitors > 16)
if ((nmonitors < 0) || (nmonitors > 16))
vscreen->nmonitors = 0;
else
vscreen->nmonitors = (UINT32)nmonitors;
if (vscreen->nmonitors)
{
for (int i = 0; i < vscreen->nmonitors; i++)
for (UINT32 i = 0; i < vscreen->nmonitors; i++)
{
MONITOR_INFO* monitor = &vscreen->monitors[i];
monitor->area.left = screenInfo[i].x_org;
@ -240,7 +245,7 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight)
/* Determine which monitor that the mouse cursor is on */
if (vscreen->monitors)
{
for (int i = 0; i < vscreen->nmonitors; i++)
for (UINT32 i = 0; i < vscreen->nmonitors; i++)
{
const MONITOR_INFO* monitor = &vscreen->monitors[i];

View File

@ -32,7 +32,7 @@ typedef struct
typedef struct
{
int nmonitors;
UINT32 nmonitors;
RECTANGLE_16 area;
RECTANGLE_16 workarea;
MONITOR_INFO* monitors;

View File

@ -320,7 +320,7 @@ static CliprdrFuseClipDataEntry* clip_data_entry_new(CliprdrFileContext* file_co
}
static BOOL should_remove_fuse_file(CliprdrFuseFile* fuse_file, BOOL all_files,
BOOL has_clip_data_id, BOOL clip_data_id)
BOOL has_clip_data_id, UINT32 clip_data_id)
{
if (all_files)
return TRUE;
@ -329,7 +329,8 @@ static BOOL should_remove_fuse_file(CliprdrFuseFile* fuse_file, BOOL all_files,
return FALSE;
if (!fuse_file->has_clip_data_id && !has_clip_data_id)
return TRUE;
if (fuse_file->has_clip_data_id && has_clip_data_id && fuse_file->clip_data_id == clip_data_id)
if (fuse_file->has_clip_data_id && has_clip_data_id &&
(fuse_file->clip_data_id == clip_data_id))
return TRUE;
return FALSE;
@ -972,7 +973,7 @@ static void cliprdr_file_fuse_read(fuse_req_t fuse_req, fuse_ino_t fuse_ino, siz
fuse_reply_err(fuse_req, EISDIR);
return;
}
if (!fuse_file->has_size || offset > fuse_file->size)
if (!fuse_file->has_size || (offset < 0) || (offset > fuse_file->size))
{
HashTable_Unlock(file_context->inode_table);
fuse_reply_err(fuse_req, EINVAL);
@ -1051,7 +1052,7 @@ static void cliprdr_file_fuse_readdir(fuse_req_t fuse_req, fuse_ino_t fuse_ino,
DEBUG_CLIPRDR(file_context->log, "Reading directory \"%s\" at offset %lu",
fuse_file->filename_with_root, offset);
if (offset >= ArrayList_Count(fuse_file->children))
if ((offset < 0) || ((size_t)offset >= ArrayList_Count(fuse_file->children)))
{
HashTable_Unlock(file_context->inode_table);
fuse_reply_buf(fuse_req, NULL, 0);
@ -1100,7 +1101,7 @@ static void cliprdr_file_fuse_readdir(fuse_req_t fuse_req, fuse_ino_t fuse_ino,
for (size_t j = 0, i = 2; j < ArrayList_Count(fuse_file->children); ++j, ++i)
{
if (i < offset)
if (i < (size_t)offset)
continue;
child = ArrayList_GetItem(fuse_file->children, j);

View File

@ -38,7 +38,7 @@ static INLINE void rfx_differential_decode(INT16* WINPR_RESTRICT buffer, size_t
static INLINE void rfx_differential_encode(INT16* WINPR_RESTRICT buffer, size_t size)
{
INT16 n1 = buffer[0];
for (int x = 0; x < size - 1; x++)
for (size_t x = 0; x < size - 1; x++)
{
INT16* dst = &buffer[x + 1];
const INT16 n2 = *dst;

View File

@ -561,7 +561,7 @@ int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* WINPR_RESTRICT pSrcData, UINT32
offset = (pOutput - pDstData);
if (offset != DstSize)
if ((DstSize < 0) || (offset != (size_t)DstSize))
return -1;
return 1;

View File

@ -334,7 +334,6 @@ static int xcrush_find_next_matching_chunk(XCRUSH_CONTEXT* WINPR_RESTRICT xcrush
XCRUSH_CHUNK* WINPR_RESTRICT chunk,
XCRUSH_CHUNK** WINPR_RESTRICT pNextChunk)
{
UINT32 index = 0;
XCRUSH_CHUNK* next = NULL;
WINPR_ASSERT(xcrush);
@ -344,7 +343,7 @@ static int xcrush_find_next_matching_chunk(XCRUSH_CONTEXT* WINPR_RESTRICT xcrush
if (chunk->next)
{
index = (chunk - xcrush->Chunks) / sizeof(XCRUSH_CHUNK);
UINT32 index = (chunk - xcrush->Chunks) / sizeof(XCRUSH_CHUNK);
if (index >= 65534)
return -4002; /* error */

View File

@ -423,7 +423,7 @@ static BOOL freerdp_assistance_parse_attr(const char** opt, size_t* plength, con
char bkey[128] = { 0 };
const int rc = _snprintf(bkey, sizeof(bkey), "%s=\"", key);
WINPR_ASSERT(rc > 0);
WINPR_ASSERT(rc < sizeof(bkey));
WINPR_ASSERT((size_t)rc < sizeof(bkey));
char* p = strstr(tag, bkey);
if (!p)
@ -523,7 +523,7 @@ static char* freerdp_assistance_contains_element(char* input, size_t ilen, const
char bkey[128] = { 0 };
const int rc = _snprintf(bkey, sizeof(bkey), "<%s", key);
WINPR_ASSERT(rc > 0);
WINPR_ASSERT(rc < sizeof(bkey));
WINPR_ASSERT((size_t)rc < sizeof(bkey));
char* tag = strstr(input, bkey);
if (!tag || (tag > input + ilen))
@ -562,7 +562,7 @@ static char* freerdp_assistance_contains_element(char* input, size_t ilen, const
char ekey[128] = { 0 };
const int erc = _snprintf(ekey, sizeof(ekey), "</%s>", key);
WINPR_ASSERT(erc > 0);
WINPR_ASSERT(erc < sizeof(ekey));
WINPR_ASSERT((size_t)erc < sizeof(ekey));
const size_t offset = start - tag;
dend = end = strrstr(start, ilen - offset, ekey);
if (end)

View File

@ -211,10 +211,16 @@ static int transport_bio_named_read(BIO* bio, char* buf, int size)
}
}
int ret = MIN(size, ringbuffer_used(&ptr->readBuffer));
if (ret)
SSIZE_T ret = -1;
if (size >= 0)
{
DataChunk chunks[2];
size_t rsize = ringbuffer_used(&ptr->readBuffer);
if (rsize <= SSIZE_MAX)
ret = MIN(size, (SSIZE_T)rsize);
}
if ((size >= 0) && ret)
{
DataChunk chunks[2] = { 0 };
int nchunks = ringbuffer_peek(&ptr->readBuffer, chunks, ret);
for (int i = 0; i < nchunks; i++)
{
@ -226,10 +232,6 @@ static int transport_bio_named_read(BIO* bio, char* buf, int size)
WLog_VRB(TAG, "(%d)=%d nchunks=%d", size, ret, nchunks);
}
else
{
ret = -1;
}
if (!ringbuffer_used(&ptr->readBuffer))
{

View File

@ -511,7 +511,7 @@ BOOL freerdp_channels_data(freerdp* instance, UINT16 channelId, const BYTE* cdat
return FALSE;
}
for (int index = 0; index < mcs->channelCount; index++)
for (UINT32 index = 0; index < mcs->channelCount; index++)
{
rdpMcsChannel* cur = &mcs->channels[index];

View File

@ -758,8 +758,11 @@ static BOOL rdp_client_establish_keys(rdpRdp* rdp)
crypto_rsa_public_encrypt(settings->ClientRandom, settings->ClientRandomLength, info,
crypt_client_random, info->ModulusLength);
/* send crypt client random to server */
const size_t length =
RDP_PACKET_HEADER_MAX_LENGTH + RDP_SECURITY_HEADER_LENGTH + 4 + info->ModulusLength + 8;
const size_t length = RDP_PACKET_HEADER_MAX_LENGTH + RDP_SECURITY_HEADER_LENGTH + 4ULL +
info->ModulusLength + 8ULL;
if (length > UINT16_MAX)
return FALSE;
s = Stream_New(NULL, length);
if (!s)

View File

@ -1925,7 +1925,7 @@ static BOOL rdg_process_control_packet(rdpRdg* rdg, int type, size_t packetLengt
static int rdg_read_data_packet(rdpRdg* rdg, BYTE* buffer, int size)
{
RdgPacketHeader header;
RdgPacketHeader header = { 0 };
size_t readCount = 0;
size_t readSize = 0;
int status = 0;

View File

@ -161,9 +161,9 @@ const char* data_pdu_type_to_string(UINT8 type)
}
static BOOL rdp_read_flow_control_pdu(rdpRdp* rdp, wStream* s, UINT16* type, UINT16* channel_id);
static BOOL rdp_write_share_control_header(rdpRdp* rdp, wStream* s, UINT16 length, UINT16 type,
static BOOL rdp_write_share_control_header(rdpRdp* rdp, wStream* s, size_t length, UINT16 type,
UINT16 channel_id);
static BOOL rdp_write_share_data_header(rdpRdp* rdp, wStream* s, UINT16 length, BYTE type,
static BOOL rdp_write_share_data_header(rdpRdp* rdp, wStream* s, size_t length, BYTE type,
UINT32 share_id);
/**
@ -301,11 +301,13 @@ BOOL rdp_read_share_control_header(rdpRdp* rdp, wStream* s, UINT16* tpktLength,
return Stream_CheckAndLogRequiredLengthWLog(rdp->log, s, remLen);
}
BOOL rdp_write_share_control_header(rdpRdp* rdp, wStream* s, UINT16 length, UINT16 type,
BOOL rdp_write_share_control_header(rdpRdp* rdp, wStream* s, size_t length, UINT16 type,
UINT16 channel_id)
{
WINPR_ASSERT(s);
WINPR_ASSERT(rdp);
if (length > UINT16_MAX)
return FALSE;
if (length < RDP_PACKET_HEADER_MAX_LENGTH)
return FALSE;
@ -339,13 +341,15 @@ BOOL rdp_read_share_data_header(rdpRdp* rdp, wStream* s, UINT16* length, BYTE* t
return TRUE;
}
BOOL rdp_write_share_data_header(rdpRdp* rdp, wStream* s, UINT16 length, BYTE type, UINT32 share_id)
BOOL rdp_write_share_data_header(rdpRdp* rdp, wStream* s, size_t length, BYTE type, UINT32 share_id)
{
const size_t headerLen = RDP_PACKET_HEADER_MAX_LENGTH + RDP_SHARE_CONTROL_HEADER_LENGTH +
RDP_SHARE_DATA_HEADER_LENGTH;
WINPR_ASSERT(s);
WINPR_ASSERT(rdp);
if (length > UINT16_MAX)
return FALSE;
if (length < headerLen)
return FALSE;
@ -647,12 +651,14 @@ BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channelId)
* @return \b TRUE for success, \b FALSE otherwise
*/
BOOL rdp_write_header(rdpRdp* rdp, wStream* s, UINT16 length, UINT16 channelId)
BOOL rdp_write_header(rdpRdp* rdp, wStream* s, size_t length, UINT16 channelId)
{
WINPR_ASSERT(rdp);
WINPR_ASSERT(rdp->settings);
WINPR_ASSERT(s);
WINPR_ASSERT(length >= RDP_PACKET_HEADER_MAX_LENGTH);
if (length > UINT16_MAX)
return FALSE;
DomainMCSPDU MCSPDU = (rdp->settings->ServerMode) ? DomainMCSPDU_SendDataIndication
: DomainMCSPDU_SendDataRequest;
@ -687,12 +693,13 @@ BOOL rdp_write_header(rdpRdp* rdp, wStream* s, UINT16 length, UINT16 channelId)
return TRUE;
}
static BOOL rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length, UINT32 sec_flags,
static BOOL rdp_security_stream_out(rdpRdp* rdp, wStream* s, size_t length, UINT32 sec_flags,
UINT32* pad)
{
BOOL status = 0;
WINPR_ASSERT(rdp);
WINPR_ASSERT(length >= 0);
if (length > UINT16_MAX)
return FALSE;
sec_flags |= rdp->sec_flags;
*pad = 0;
@ -715,7 +722,7 @@ static BOOL rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length, UINT32
if (size > length)
goto unlock;
length -= (int)size;
length -= size;
Stream_Write_UINT16(s, 0x10); /* length */
Stream_Write_UINT8(s, 0x1); /* TSFIPS_VERSION 1*/
@ -742,7 +749,10 @@ static BOOL rdp_security_stream_out(rdpRdp* rdp, wStream* s, int length, UINT32
else
{
const BYTE* data = Stream_PointerAs(s, const BYTE) + 8;
length = length - (data - Stream_Buffer(s));
const size_t diff = Stream_GetPosition(s) + 8ULL;
if (diff > length)
goto unlock;
length -= diff;
if (!Stream_CheckAndLogRequiredCapacityWLog(rdp->log, s, 8))
goto unlock;
@ -811,7 +821,6 @@ BOOL rdp_send(rdpRdp* rdp, wStream* s, UINT16 channel_id)
{
BOOL rc = FALSE;
UINT32 pad = 0;
UINT16 length = 0;
if (!s)
return FALSE;
@ -819,7 +828,7 @@ BOOL rdp_send(rdpRdp* rdp, wStream* s, UINT16 channel_id)
if (!rdp)
goto fail;
length = Stream_GetPosition(s);
size_t length = Stream_GetPosition(s);
Stream_SetPosition(s, 0);
if (!rdp_write_header(rdp, s, length, channel_id))
goto fail;
@ -842,7 +851,6 @@ fail:
BOOL rdp_send_pdu(rdpRdp* rdp, wStream* s, UINT16 type, UINT16 channel_id)
{
UINT16 length = 0;
UINT32 sec_bytes = 0;
size_t sec_hold = 0;
UINT32 pad = 0;
@ -850,7 +858,7 @@ BOOL rdp_send_pdu(rdpRdp* rdp, wStream* s, UINT16 type, UINT16 channel_id)
if (!rdp || !s)
return FALSE;
length = Stream_GetPosition(s);
size_t length = Stream_GetPosition(s);
Stream_SetPosition(s, 0);
if (!rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID))
return FALSE;
@ -877,7 +885,6 @@ BOOL rdp_send_pdu(rdpRdp* rdp, wStream* s, UINT16 type, UINT16 channel_id)
BOOL rdp_send_data_pdu(rdpRdp* rdp, wStream* s, BYTE type, UINT16 channel_id)
{
BOOL rc = FALSE;
size_t length = 0;
UINT32 sec_bytes = 0;
size_t sec_hold = 0;
UINT32 pad = 0;
@ -888,7 +895,7 @@ BOOL rdp_send_data_pdu(rdpRdp* rdp, wStream* s, BYTE type, UINT16 channel_id)
if (!rdp)
goto fail;
length = Stream_GetPosition(s);
size_t length = Stream_GetPosition(s);
Stream_SetPosition(s, 0);
if (!rdp_write_header(rdp, s, length, MCS_GLOBAL_CHANNEL_ID))
goto fail;
@ -924,13 +931,12 @@ fail:
BOOL rdp_send_message_channel_pdu(rdpRdp* rdp, wStream* s, UINT16 sec_flags)
{
BOOL rc = FALSE;
UINT16 length = 0;
UINT32 pad = 0;
WINPR_ASSERT(rdp);
WINPR_ASSERT(s);
length = Stream_GetPosition(s);
size_t length = Stream_GetPosition(s);
Stream_SetPosition(s, 0);
if (!rdp_write_header(rdp, s, length, rdp->mcs->messageChannelId))
goto fail;

View File

@ -223,7 +223,7 @@ FREERDP_LOCAL wStream* rdp_send_stream_init(rdpRdp* rdp);
FREERDP_LOCAL wStream* rdp_send_stream_pdu_init(rdpRdp* rdp);
FREERDP_LOCAL BOOL rdp_read_header(rdpRdp* rdp, wStream* s, UINT16* length, UINT16* channel_id);
FREERDP_LOCAL BOOL rdp_write_header(rdpRdp* rdp, wStream* s, UINT16 length, UINT16 channel_id);
FREERDP_LOCAL BOOL rdp_write_header(rdpRdp* rdp, wStream* s, size_t length, UINT16 channel_id);
FREERDP_LOCAL BOOL rdp_send_pdu(rdpRdp* rdp, wStream* s, UINT16 type, UINT16 channel_id);

View File

@ -160,7 +160,7 @@ BOOL tpkt_ensure_stream_consumed_(wStream* s, size_t length, const char* fkt)
* @return \b TRUE for success, \b FALSE otherwise
*/
BOOL tpkt_write_header(wStream* s, UINT16 length)
BOOL tpkt_write_header(wStream* s, size_t length)
{
if (!Stream_CheckAndLogRequiredCapacity(TAG, (s), 4))
return FALSE;

View File

@ -30,7 +30,7 @@
FREERDP_LOCAL int tpkt_verify_header(wStream* s);
FREERDP_LOCAL BOOL tpkt_read_header(wStream* s, UINT16* length);
FREERDP_LOCAL BOOL tpkt_write_header(wStream* s, UINT16 length);
FREERDP_LOCAL BOOL tpkt_write_header(wStream* s, size_t length);
#define tpkt_ensure_stream_consumed(s, length) tpkt_ensure_stream_consumed_((s), (length), __func__)
FREERDP_LOCAL BOOL tpkt_ensure_stream_consumed_(wStream* s, size_t length, const char* fkt);

View File

@ -929,7 +929,7 @@ static BOOL update_read_desktop_actively_monitored_order(wStream* s, WINDOW_ORDE
monitored_desktop->windowIds = newid;
/* windowIds */
for (UINT32 i = 0; i < (int)monitored_desktop->numWindowIds; i++)
for (UINT32 i = 0; i < monitored_desktop->numWindowIds; i++)
{
Stream_Read_UINT32(s, monitored_desktop->windowIds[i]);
}

View File

@ -1687,10 +1687,10 @@ static BOOL shadow_client_send_bitmap_update(rdpShadowClient* client, BYTE* pSrc
bitmap->destLeft = nXSrc + (xIdx * 64);
bitmap->destTop = nYSrc + (yIdx * 64);
if ((INT64)(bitmap->destLeft + bitmap->width) > (nXSrc + nWidth))
if (((INT64)bitmap->destLeft + bitmap->width) > (nXSrc + nWidth))
bitmap->width = (UINT32)(nXSrc + nWidth) - bitmap->destLeft;
if ((INT64)(bitmap->destTop + bitmap->height) > (nYSrc + nHeight))
if (((INT64)bitmap->destTop + bitmap->height) > (nYSrc + nHeight))
bitmap->height = (UINT32)(nYSrc + nHeight) - bitmap->destTop;
bitmap->destRight = bitmap->destLeft + bitmap->width - 1;

View File

@ -987,7 +987,7 @@ void sspi_GlobalFinish(void)
static const SecurityFunctionTableA* sspi_GetSecurityFunctionTableAByNameA(const SEC_CHAR* Name)
{
size_t cPackages = sizeof(SecPkgInfoA_LIST) / sizeof(*(SecPkgInfoA_LIST));
size_t cPackages = ARRAYSIZE(SecPkgInfoA_LIST);
for (size_t index = 0; index < cPackages; index++)
{
@ -1002,7 +1002,7 @@ static const SecurityFunctionTableA* sspi_GetSecurityFunctionTableAByNameA(const
static const SecurityFunctionTableW* sspi_GetSecurityFunctionTableWByNameW(const SEC_WCHAR* Name)
{
size_t cPackages = sizeof(SecPkgInfoW_LIST) / sizeof(*(SecPkgInfoW_LIST));
size_t cPackages = ARRAYSIZE(SecPkgInfoW_LIST);
for (size_t index = 0; index < cPackages; index++)
{
@ -1073,12 +1073,10 @@ static void sspi_ContextBufferFree(void* contextBuffer)
static SECURITY_STATUS SEC_ENTRY winpr_EnumerateSecurityPackagesW(ULONG* pcPackages,
PSecPkgInfoW* ppPackageInfo)
{
size_t size = 0;
UINT32 cPackages = 0;
SecPkgInfoW* pPackageInfo = NULL;
cPackages = sizeof(SecPkgInfoW_LIST) / sizeof(*(SecPkgInfoW_LIST));
size = sizeof(SecPkgInfoW) * cPackages;
pPackageInfo = (SecPkgInfoW*)sspi_ContextBufferAlloc(EnumerateSecurityPackagesIndex, size);
size_t cPackages = ARRAYSIZE(SecPkgInfoW_LIST);
size_t size = sizeof(SecPkgInfoW) * cPackages;
SecPkgInfoW* pPackageInfo =
(SecPkgInfoW*)sspi_ContextBufferAlloc(EnumerateSecurityPackagesIndex, size);
if (!pPackageInfo)
return SEC_E_INSUFFICIENT_MEMORY;
@ -1101,12 +1099,10 @@ static SECURITY_STATUS SEC_ENTRY winpr_EnumerateSecurityPackagesW(ULONG* pcPacka
static SECURITY_STATUS SEC_ENTRY winpr_EnumerateSecurityPackagesA(ULONG* pcPackages,
PSecPkgInfoA* ppPackageInfo)
{
size_t size = 0;
UINT32 cPackages = 0;
SecPkgInfoA* pPackageInfo = NULL;
cPackages = sizeof(SecPkgInfoA_LIST) / sizeof(*(SecPkgInfoA_LIST));
size = sizeof(SecPkgInfoA) * cPackages;
pPackageInfo = (SecPkgInfoA*)sspi_ContextBufferAlloc(EnumerateSecurityPackagesIndex, size);
size_t cPackages = ARRAYSIZE(SecPkgInfoA_LIST);
size_t size = sizeof(SecPkgInfoA) * cPackages;
SecPkgInfoA* pPackageInfo =
(SecPkgInfoA*)sspi_ContextBufferAlloc(EnumerateSecurityPackagesIndex, size);
if (!pPackageInfo)
return SEC_E_INSUFFICIENT_MEMORY;
@ -1134,9 +1130,8 @@ static SECURITY_STATUS SEC_ENTRY winpr_EnumerateSecurityPackagesA(ULONG* pcPacka
static void FreeContextBuffer_EnumerateSecurityPackages(void* contextBuffer)
{
UINT32 cPackages = 0;
SecPkgInfoA* pPackageInfo = (SecPkgInfoA*)contextBuffer;
cPackages = sizeof(SecPkgInfoA_LIST) / sizeof(*(SecPkgInfoA_LIST));
size_t cPackages = ARRAYSIZE(SecPkgInfoA_LIST);
if (!pPackageInfo)
return;
@ -1163,16 +1158,14 @@ SecurityFunctionTableA* SEC_ENTRY winpr_InitSecurityInterfaceA(void)
static SECURITY_STATUS SEC_ENTRY winpr_QuerySecurityPackageInfoW(SEC_WCHAR* pszPackageName,
PSecPkgInfoW* ppPackageInfo)
{
size_t size = 0;
SecPkgInfoW* pPackageInfo = NULL;
size_t cPackages = sizeof(SecPkgInfoW_LIST) / sizeof(*(SecPkgInfoW_LIST));
size_t cPackages = ARRAYSIZE(SecPkgInfoW_LIST);
for (size_t index = 0; index < cPackages; index++)
{
if (_wcscmp(pszPackageName, SecPkgInfoW_LIST[index]->Name) == 0)
{
size = sizeof(SecPkgInfoW);
pPackageInfo =
size_t size = sizeof(SecPkgInfoW);
SecPkgInfoW* pPackageInfo =
(SecPkgInfoW*)sspi_ContextBufferAlloc(QuerySecurityPackageInfoIndex, size);
if (!pPackageInfo)
@ -1196,16 +1189,14 @@ static SECURITY_STATUS SEC_ENTRY winpr_QuerySecurityPackageInfoW(SEC_WCHAR* pszP
static SECURITY_STATUS SEC_ENTRY winpr_QuerySecurityPackageInfoA(SEC_CHAR* pszPackageName,
PSecPkgInfoA* ppPackageInfo)
{
size_t size = 0;
SecPkgInfoA* pPackageInfo = NULL;
size_t cPackages = sizeof(SecPkgInfoA_LIST) / sizeof(*(SecPkgInfoA_LIST));
size_t cPackages = ARRAYSIZE(SecPkgInfoA_LIST);
for (size_t index = 0; index < cPackages; index++)
{
if (strcmp(pszPackageName, SecPkgInfoA_LIST[index]->Name) == 0)
{
size = sizeof(SecPkgInfoA);
pPackageInfo =
size_t size = sizeof(SecPkgInfoA);
SecPkgInfoA* pPackageInfo =
(SecPkgInfoA*)sspi_ContextBufferAlloc(QuerySecurityPackageInfoIndex, size);
if (!pPackageInfo)