[mingw] fix type incompatibilities

The integer types with MINGW do not always match. Ensure the correct
32bit interger base type is used when passing pointers
This commit is contained in:
akallabeth
2025-12-12 18:09:18 +01:00
parent 3faefca351
commit b160ea80e8
9 changed files with 22 additions and 11 deletions

View File

@@ -2341,9 +2341,17 @@ static UINT rdpdr_server_read_file_directory_information(wLog* log, wStream* s,
if (!Stream_CheckAndLogRequiredLengthWLog(log, s, fileNameLength))
return ERROR_INVALID_DATA;
if (fileNameLength / sizeof(WCHAR) > ARRAYSIZE(fdi->FileName))
return ERROR_INVALID_DATA;
#if defined(__MINGW32__)
if (Stream_Read_UTF16_String(s, fdi->FileName, fileNameLength / sizeof(WCHAR)))
return ERROR_INVALID_DATA;
#else
if (Stream_Read_UTF16_String_As_UTF8_Buffer(s, fileNameLength / sizeof(WCHAR), fdi->FileName,
ARRAYSIZE(fdi->FileName)) < 0)
return ERROR_INVALID_DATA;
#endif
return CHANNEL_RC_OK;
}

View File

@@ -281,7 +281,7 @@ static BOOL wf_pre_connect(freerdp* instance)
return FALSE;
}
uint32_t keyboardLayoutId = freerdp_settings_get_uint32(settings, FreeRDP_KeyboardLayout);
DWORD keyboardLayoutId = freerdp_settings_get_uint32(settings, FreeRDP_KeyboardLayout);
{
CHAR name[KL_NAMELENGTH + 1] = { 0 };

View File

@@ -2469,8 +2469,8 @@ static int parse_codec_cache_options(rdpSettings* settings, const COMMAND_LINE_A
static BOOL check_kbd_remap_valid(const char* token)
{
DWORD key = 0;
DWORD value = 0;
UINT32 key = 0;
UINT32 value = 0;
WINPR_ASSERT(token);
/* The remapping is only allowed for scancodes, so maximum is 999=999 */

View File

@@ -330,7 +330,7 @@ static char* guid2str(const GUID* guid, char* buffer, size_t len)
{
if (!guid)
return NULL;
char* strguid = NULL;
RPC_CSTR strguid = NULL;
RPC_STATUS rpcStatus = UuidToStringA(guid, &strguid);

View File

@@ -539,7 +539,7 @@ static int rpc_channel_rpch_init(RpcClient* client, RpcChannel* channel, const c
if (guid)
{
char* strguid = NULL;
RPC_CSTR strguid = NULL;
RPC_STATUS rpcStatus = UuidToStringA(guid, &strguid);
if (rpcStatus != RPC_S_OK)

View File

@@ -1515,7 +1515,8 @@ BOOL freerdp_tcp_set_nodelay(wLog* log, DWORD level, int sockfd)
int type = -1;
socklen_t typelen = sizeof(type);
const int rc = getsockopt(sockfd, SOL_SOCKET, SO_TYPE, &type, &typelen);
char* ptype = (char*)&type;
const int rc = getsockopt(sockfd, SOL_SOCKET, SO_TYPE, ptype, &typelen);
if (rc < 0)
{
char buffer[128] = { 0 };

View File

@@ -46,7 +46,7 @@
static BOOL cert_info_allocate(rdpCertInfo* info, size_t size);
BOOL read_bignum(BYTE** dst, UINT32* length, const BIGNUM* num, BOOL alloc)
BOOL read_bignum(BYTE** dst, DWORD* length, const BIGNUM* num, BOOL alloc)
{
WINPR_ASSERT(dst);
WINPR_ASSERT(length);
@@ -97,7 +97,7 @@ BOOL cert_info_create(rdpCertInfo* dst, const BIGNUM* rsa, const BIGNUM* rsa_e)
if (!read_bignum(&dst->Modulus, &dst->ModulusLength, rsa, TRUE))
goto fail;
UINT32 len = sizeof(dst->exponent);
DWORD len = sizeof(dst->exponent);
BYTE* ptr = &dst->exponent[0];
if (!read_bignum(&ptr, &len, rsa_e, FALSE))
goto fail;

View File

@@ -28,6 +28,8 @@
#include <freerdp/log.h>
#include <freerdp/api.h>
#include "opensslcompat.h"
#ifdef __cplusplus
extern "C"
{
@@ -40,7 +42,7 @@ extern "C"
FREERDP_LOCAL BOOL cert_info_read_modulus(rdpCertInfo* info, size_t size, wStream* s);
FREERDP_LOCAL BOOL cert_info_read_exponent(rdpCertInfo* info, size_t size, wStream* s);
FREERDP_LOCAL BOOL read_bignum(BYTE** dst, UINT32* length, const BIGNUM* num, BOOL alloc);
FREERDP_LOCAL BOOL read_bignum(BYTE** dst, DWORD* length, const BIGNUM* num, BOOL alloc);
#if !defined(OPENSSL_VERSION_MAJOR) || (OPENSSL_VERSION_MAJOR < 3)
FREERDP_LOCAL X509* x509_from_rsa(const RSA* rsa);

View File

@@ -382,8 +382,8 @@ FREERDP_REMAP_TABLE* freerdp_keyboard_remap_string_to_list(const char* list)
char* token = strtok_s(copy, ",", &context);
while (token)
{
DWORD key = 0;
DWORD value = 0;
UINT32 key = 0;
UINT32 value = 0;
if (!freerdp_extract_key_value(token, &key, &value))
goto fail;
if (key >= remap_table_size)