mirror of https://github.com/FreeRDP/FreeRDP
commit
6d8d4ddb1a
|
@ -54,7 +54,13 @@ static void* freerdp_channels_find_static_entry_in_table(const STATIC_ENTRY_TABL
|
|||
{
|
||||
if (strcmp(pEntry->name, identifier) == 0)
|
||||
{
|
||||
return (void*)pEntry->entry;
|
||||
union
|
||||
{
|
||||
void* pv;
|
||||
UINT (*entry)();
|
||||
} cnv;
|
||||
cnv.entry = pEntry->entry;
|
||||
return cnv.pv;
|
||||
}
|
||||
|
||||
pEntry = &table->table[index++];
|
||||
|
|
|
@ -162,7 +162,11 @@ static BOOL tsmf_ffmpeg_init_stream(ITSMFDecoder* decoder, const TS_AM_MEDIA_TYP
|
|||
UINT32 size = 0;
|
||||
const BYTE* s = NULL;
|
||||
TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*)decoder;
|
||||
|
||||
WINPR_PRAGMA_DIAG_PUSH
|
||||
WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS
|
||||
mdecoder->codec = avcodec_find_decoder(mdecoder->codec_id);
|
||||
WINPR_PRAGMA_DIAG_POP
|
||||
|
||||
if (!mdecoder->codec)
|
||||
{
|
||||
|
|
|
@ -28,13 +28,17 @@
|
|||
static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const char* device)
|
||||
{
|
||||
ITSMFAudioDevice* audio = NULL;
|
||||
TSMF_AUDIO_DEVICE_ENTRY entry =
|
||||
(TSMF_AUDIO_DEVICE_ENTRY)(void*)freerdp_load_channel_addin_entry("tsmf", name, "audio", 0);
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY pvce;
|
||||
TSMF_AUDIO_DEVICE_ENTRY entry;
|
||||
} cnv;
|
||||
cnv.pvce = freerdp_load_channel_addin_entry("tsmf", name, "audio", 0);
|
||||
|
||||
if (!entry)
|
||||
if (!cnv.entry)
|
||||
return NULL;
|
||||
|
||||
const UINT rc = entry(&audio);
|
||||
const UINT rc = cnv.entry(&audio);
|
||||
|
||||
if ((rc != CHANNEL_RC_OK) || !audio)
|
||||
{
|
||||
|
|
|
@ -33,13 +33,17 @@
|
|||
static ITSMFDecoder* tsmf_load_decoder_by_name(const char* name)
|
||||
{
|
||||
ITSMFDecoder* decoder = NULL;
|
||||
TSMF_DECODER_ENTRY entry =
|
||||
(TSMF_DECODER_ENTRY)(void*)freerdp_load_channel_addin_entry("tsmf", name, "decoder", 0);
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY pvce;
|
||||
TSMF_DECODER_ENTRY entry;
|
||||
} cnv;
|
||||
cnv.pvce = freerdp_load_channel_addin_entry("tsmf", name, "decoder", 0);
|
||||
|
||||
if (!entry)
|
||||
if (!cnv.entry)
|
||||
return NULL;
|
||||
|
||||
const UINT rc = entry(&decoder);
|
||||
const UINT rc = cnv.entry(&decoder);
|
||||
|
||||
if ((rc != CHANNEL_RC_OK) || !decoder)
|
||||
{
|
||||
|
|
|
@ -1306,11 +1306,19 @@ static DWORD WINAPI xf_handle_pipe(void* arg)
|
|||
winpr_strerror(errno, ebuffer, sizeof(ebuffer)), errno);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WINPR_PRAGMA_DIAG_PUSH
|
||||
WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS
|
||||
freerdp_add_signal_cleanup_handler(pipe, cleanup_pipe);
|
||||
WINPR_PRAGMA_DIAG_POP
|
||||
|
||||
xf_process_pipe(context, pipe);
|
||||
|
||||
WINPR_PRAGMA_DIAG_PUSH
|
||||
WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS
|
||||
freerdp_del_signal_cleanup_handler(pipe, cleanup_pipe);
|
||||
WINPR_PRAGMA_DIAG_POP
|
||||
|
||||
unlink(pipe);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -5716,17 +5716,22 @@ fail:
|
|||
static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpSettings* settings,
|
||||
const char* name, void* data)
|
||||
{
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY pvce;
|
||||
PVIRTUALCHANNELENTRYEX pvceex;
|
||||
} cnv;
|
||||
PVIRTUALCHANNELENTRY entry = NULL;
|
||||
PVIRTUALCHANNELENTRYEX entryEx =
|
||||
(PVIRTUALCHANNELENTRYEX)(void*)freerdp_load_channel_addin_entry(
|
||||
name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX);
|
||||
|
||||
if (!entryEx)
|
||||
cnv.pvce = freerdp_load_channel_addin_entry(
|
||||
name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX);
|
||||
|
||||
if (!cnv.pvceex)
|
||||
entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
|
||||
|
||||
if (entryEx)
|
||||
if (cnv.pvceex)
|
||||
{
|
||||
if (freerdp_channels_client_load_ex(channels, settings, entryEx, data) == 0)
|
||||
if (freerdp_channels_client_load_ex(channels, settings, cnv.pvceex, data) == 0)
|
||||
{
|
||||
WLog_DBG(TAG, "loading channelEx %s", name);
|
||||
return TRUE;
|
||||
|
|
|
@ -1233,7 +1233,8 @@ void freerdp_dsp_context_free(FREERDP_DSP_CONTEXT* context)
|
|||
|
||||
BOOL freerdp_dsp_encode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
||||
const AUDIO_FORMAT* WINPR_RESTRICT srcFormat,
|
||||
const BYTE* WINPR_RESTRICT data, size_t length, wStream* WINPR_RESTRICT out)
|
||||
const BYTE* WINPR_RESTRICT pdata, size_t length,
|
||||
wStream* WINPR_RESTRICT out)
|
||||
{
|
||||
#if defined(WITH_FDK_AAC)
|
||||
FREERDP_DSP_COMMON_CONTEXT* ctx = (FREERDP_DSP_COMMON_CONTEXT*)context;
|
||||
|
@ -1241,27 +1242,28 @@ BOOL freerdp_dsp_encode(FREERDP_DSP_CONTEXT* WINPR_RESTRICT context,
|
|||
switch (ctx->format.wFormatTag)
|
||||
{
|
||||
case WAVE_FORMAT_AAC_MS:
|
||||
return fdk_aac_dsp_encode(ctx, srcFormat, data, length, out);
|
||||
return fdk_aac_dsp_encode(ctx, srcFormat, pdata, length, out);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(WITH_DSP_FFMPEG)
|
||||
return freerdp_dsp_ffmpeg_encode(context, srcFormat, data, length, out);
|
||||
return freerdp_dsp_ffmpeg_encode(context, srcFormat, pdata, length, out);
|
||||
#else
|
||||
if (!context || !context->common.encoder || !srcFormat || !data || !out)
|
||||
if (!context || !context->common.encoder || !srcFormat || !pdata || !out)
|
||||
return FALSE;
|
||||
|
||||
AUDIO_FORMAT format = *srcFormat;
|
||||
const BYTE* resampleData = NULL;
|
||||
size_t resampleLength = 0;
|
||||
|
||||
if (!freerdp_dsp_channel_mix(context, data, length, srcFormat, &resampleData, &resampleLength))
|
||||
if (!freerdp_dsp_channel_mix(context, pdata, length, srcFormat, &resampleData, &resampleLength))
|
||||
return FALSE;
|
||||
|
||||
format.nChannels = context->common.format.nChannels;
|
||||
|
||||
const BYTE* data = NULL;
|
||||
if (!freerdp_dsp_resample(context, resampleData, resampleLength, &format, &data, &length))
|
||||
return FALSE;
|
||||
|
||||
|
@ -1435,10 +1437,12 @@ BOOL freerdp_dsp_supports_format(const AUDIO_FORMAT* WINPR_RESTRICT format, BOOL
|
|||
|
||||
#endif
|
||||
#if defined(WITH_OPUS)
|
||||
/* fallthrough */
|
||||
WINPR_FALLTHROUGH
|
||||
case WAVE_FORMAT_OPUS:
|
||||
return opus_is_valid_samplerate(format);
|
||||
#endif
|
||||
/* fallthrough */
|
||||
WINPR_FALLTHROUGH
|
||||
default:
|
||||
return FALSE;
|
||||
|
|
|
@ -444,7 +444,7 @@ static INLINE void write_pixel_16(BYTE* _buf, UINT16 _pix)
|
|||
#define RLEEXTRA
|
||||
#undef ENSURE_CAPACITY
|
||||
#define ENSURE_CAPACITY(_start, _end, _size) ensure_capacity(_start, _end, _size, 1)
|
||||
#include "include/bitmap.c"
|
||||
#include "include/bitmap.h"
|
||||
|
||||
#undef DESTWRITEPIXEL
|
||||
#undef DESTREADPIXEL
|
||||
|
@ -478,7 +478,7 @@ static INLINE void write_pixel_16(BYTE* _buf, UINT16 _pix)
|
|||
#define RLEEXTRA
|
||||
#undef ENSURE_CAPACITY
|
||||
#define ENSURE_CAPACITY(_start, _end, _size) ensure_capacity(_start, _end, _size, 2)
|
||||
#include "include/bitmap.c"
|
||||
#include "include/bitmap.h"
|
||||
|
||||
#undef DESTWRITEPIXEL
|
||||
#undef DESTREADPIXEL
|
||||
|
@ -513,7 +513,7 @@ static INLINE void write_pixel_16(BYTE* _buf, UINT16 _pix)
|
|||
#define RLEEXTRA
|
||||
#undef ENSURE_CAPACITY
|
||||
#define ENSURE_CAPACITY(_start, _end, _size) ensure_capacity(_start, _end, _size, 3)
|
||||
#include "include/bitmap.c"
|
||||
#include "include/bitmap.h"
|
||||
|
||||
struct S_BITMAP_INTERLEAVED_CONTEXT
|
||||
{
|
||||
|
|
|
@ -237,7 +237,13 @@ PVIRTUALCHANNELENTRY freerdp_load_dynamic_addin(LPCSTR pszFileName, LPCSTR pszPa
|
|||
if (!library)
|
||||
goto fail;
|
||||
|
||||
entry = (PVIRTUALCHANNELENTRY)GetProcAddress(library, pszEntryName);
|
||||
union
|
||||
{
|
||||
FARPROC fp;
|
||||
PVIRTUALCHANNELENTRY entry;
|
||||
} cnv;
|
||||
cnv.fp = GetProcAddress(library, pszEntryName);
|
||||
entry = cnv.entry;
|
||||
fail:
|
||||
free(pszRelativeFilePath);
|
||||
free(pszAddinFile);
|
||||
|
|
|
@ -1342,8 +1342,13 @@ BOOL freerdp_assistance_populate_settings_from_assistance_file(rdpAssistanceFile
|
|||
if (ports != addresses)
|
||||
return FALSE;
|
||||
|
||||
const UINT32 port = (UINT32)ArrayList_GetItem(file->MachinePorts, 0);
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_ServerPort, port))
|
||||
union
|
||||
{
|
||||
UINT32 port;
|
||||
void* data;
|
||||
} cnv;
|
||||
cnv.data = ArrayList_GetItem(file->MachinePorts, 0);
|
||||
if (!freerdp_settings_set_uint32(settings, FreeRDP_ServerPort, cnv.port))
|
||||
return FALSE;
|
||||
|
||||
if (!freerdp_target_net_adresses_reset(settings, ports))
|
||||
|
@ -1351,8 +1356,13 @@ BOOL freerdp_assistance_populate_settings_from_assistance_file(rdpAssistanceFile
|
|||
|
||||
for (size_t x = 0; x < ports; x++)
|
||||
{
|
||||
const UINT32 mport = (UINT32)ArrayList_GetItem(file->MachinePorts, x);
|
||||
if (!freerdp_settings_set_pointer_array(settings, FreeRDP_TargetNetPorts, x, &mport))
|
||||
union
|
||||
{
|
||||
UINT32 port;
|
||||
void* data;
|
||||
} cnv;
|
||||
cnv.data = ArrayList_GetItem(file->MachinePorts, x);
|
||||
if (!freerdp_settings_set_pointer_array(settings, FreeRDP_TargetNetPorts, x, &cnv.port))
|
||||
return FALSE;
|
||||
}
|
||||
for (size_t i = 0; i < addresses; i++)
|
||||
|
@ -1451,7 +1461,15 @@ void freerdp_assistance_print_file(rdpAssistanceFile* file, wLog* log, DWORD lev
|
|||
const char* uri = NULL;
|
||||
const char* addr = ArrayList_GetItem(file->MachineAddresses, x);
|
||||
if (x < ArrayList_Count(file->MachinePorts))
|
||||
port = (UINT32)ArrayList_GetItem(file->MachinePorts, x);
|
||||
{
|
||||
union
|
||||
{
|
||||
UINT32 port;
|
||||
void* data;
|
||||
} cnv;
|
||||
cnv.data = ArrayList_GetItem(file->MachinePorts, x);
|
||||
port = cnv.port;
|
||||
}
|
||||
if (x < ArrayList_Count(file->MachineUris))
|
||||
uri = ArrayList_GetItem(file->MachineUris, x);
|
||||
|
||||
|
|
|
@ -468,16 +468,19 @@ static BOOL createChildSessionTransport(HANDLE* pFile)
|
|||
WCHAR pipePath[0x80] = { 0 };
|
||||
char pipePathA[0x80] = { 0 };
|
||||
|
||||
WinStationCreateChildSessionTransportFn createChildSessionFn =
|
||||
(WinStationCreateChildSessionTransportFn)GetProcAddress(
|
||||
hModule, "WinStationCreateChildSessionTransport");
|
||||
if (!createChildSessionFn)
|
||||
union
|
||||
{
|
||||
FARPROC fp;
|
||||
WinStationCreateChildSessionTransportFn createChildSessionFn;
|
||||
} cnv;
|
||||
cnv.fp = GetProcAddress(hModule, "WinStationCreateChildSessionTransport");
|
||||
if (!cnv.createChildSessionFn)
|
||||
{
|
||||
WLog_ERR(TAG, "unable to retrieve WinStationCreateChildSessionTransport function");
|
||||
goto out;
|
||||
}
|
||||
|
||||
HRESULT hStatus = createChildSessionFn(pipePath, 0x80);
|
||||
HRESULT hStatus = cnv.createChildSessionFn(pipePath, 0x80);
|
||||
if (!SUCCEEDED(hStatus))
|
||||
{
|
||||
WLog_ERR(TAG, "error 0x%x when creating childSessionTransport", hStatus);
|
||||
|
|
|
@ -796,7 +796,6 @@ static SecurityFunctionTable* auth_resolve_sspi_table(const rdpSettings* setting
|
|||
|
||||
if (sspi_module || settings->SspiModule)
|
||||
{
|
||||
INIT_SECURITY_INTERFACE InitSecurityInterface_ptr = NULL;
|
||||
const char* module_name = sspi_module ? sspi_module : settings->SspiModule;
|
||||
#ifdef UNICODE
|
||||
const char* proc_name = "InitSecurityInterfaceW";
|
||||
|
@ -815,10 +814,20 @@ static SecurityFunctionTable* auth_resolve_sspi_table(const rdpSettings* setting
|
|||
|
||||
WLog_INFO(TAG, "Using SSPI Module: %s", module_name);
|
||||
|
||||
InitSecurityInterface_ptr = (INIT_SECURITY_INTERFACE)GetProcAddress(hSSPI, proc_name);
|
||||
|
||||
union
|
||||
{
|
||||
FARPROC fp;
|
||||
INIT_SECURITY_INTERFACE InitSecurityInterface_ptr;
|
||||
} cnv;
|
||||
cnv.fp = GetProcAddress(hSSPI, proc_name);
|
||||
if (!cnv.InitSecurityInterface_ptr)
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to load SSPI module: %s, no function %s", module_name, proc_name);
|
||||
free(sspi_module);
|
||||
return FALSE;
|
||||
}
|
||||
free(sspi_module);
|
||||
return InitSecurityInterface_ptr();
|
||||
return cnv.InitSecurityInterface_ptr();
|
||||
}
|
||||
|
||||
return InitSecurityInterfaceEx(0);
|
||||
|
|
|
@ -718,12 +718,15 @@ const char* freerdp_get_version_string(void)
|
|||
|
||||
const char* freerdp_get_build_config(void)
|
||||
{
|
||||
WINPR_PRAGMA_DIAG_PUSH
|
||||
WINPR_PRAGMA_DIAG_IGNORED_OVERLENGTH_STRINGS
|
||||
static const char build_config[] =
|
||||
"Build configuration: " FREERDP_BUILD_CONFIG "\n"
|
||||
"Build type: " FREERDP_BUILD_TYPE "\n"
|
||||
"CFLAGS: " FREERDP_CFLAGS "\n"
|
||||
"Compiler: " FREERDP_COMPILER_ID ", " FREERDP_COMPILER_VERSION "\n"
|
||||
"Target architecture: " FREERDP_TARGET_ARCH "\n";
|
||||
WINPR_PRAGMA_DIAG_POP
|
||||
return build_config;
|
||||
}
|
||||
|
||||
|
|
|
@ -2852,9 +2852,14 @@ static void log_build_warn(rdpRdp* rdp, const char* what, const char* msg,
|
|||
BOOL (*cmp)(wLog* log, const char* tok))
|
||||
{
|
||||
WINPR_ASSERT(rdp);
|
||||
WINPR_PRAGMA_DIAG_PUSH
|
||||
WINPR_PRAGMA_DIAG_IGNORED_OVERLENGTH_STRINGS
|
||||
|
||||
size_t len = sizeof(FREERDP_BUILD_CONFIG);
|
||||
char* list = calloc(len, sizeof(char));
|
||||
char* config = _strdup(FREERDP_BUILD_CONFIG);
|
||||
WINPR_PRAGMA_DIAG_POP
|
||||
|
||||
if (config && list)
|
||||
{
|
||||
char* tok = strtok(config, " ");
|
||||
|
|
|
@ -97,8 +97,10 @@ struct rdp_transport
|
|||
BOOL earlyUserAuth;
|
||||
};
|
||||
|
||||
static void transport_ssl_cb(SSL* ssl, int where, int ret)
|
||||
static int transport_ssl_cb(BIO* bio, int where, int ret)
|
||||
{
|
||||
SSL* ssl = (SSL*)bio;
|
||||
|
||||
if (where & SSL_CB_ALERT)
|
||||
{
|
||||
rdpTransport* transport = (rdpTransport*)SSL_get_app_data(ssl);
|
||||
|
@ -145,6 +147,7 @@ static void transport_ssl_cb(SSL* ssl, int where, int ret)
|
|||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
wStream* transport_send_stream_init(rdpTransport* transport, size_t size)
|
||||
|
@ -326,7 +329,7 @@ static BOOL transport_default_connect_tls(rdpTransport* transport)
|
|||
}
|
||||
|
||||
transport->frontBio = tls->bio;
|
||||
BIO_callback_ctrl(tls->bio, BIO_CTRL_SET_CALLBACK, (bio_info_cb*)(void*)transport_ssl_cb);
|
||||
BIO_callback_ctrl(tls->bio, BIO_CTRL_SET_CALLBACK, transport_ssl_cb);
|
||||
SSL_set_app_data(tls->ssl, transport);
|
||||
|
||||
if (!transport->frontBio)
|
||||
|
|
|
@ -517,12 +517,11 @@ static int bio_rdp_tls_free(BIO* bio)
|
|||
static long bio_rdp_tls_callback_ctrl(BIO* bio, int cmd, bio_info_cb* fp)
|
||||
{
|
||||
long status = 0;
|
||||
BIO_RDP_TLS* tls = NULL;
|
||||
|
||||
if (!bio)
|
||||
return 0;
|
||||
|
||||
tls = (BIO_RDP_TLS*)BIO_get_data(bio);
|
||||
BIO_RDP_TLS* tls = (BIO_RDP_TLS*)BIO_get_data(bio);
|
||||
|
||||
if (!tls)
|
||||
return 0;
|
||||
|
@ -535,8 +534,14 @@ static long bio_rdp_tls_callback_ctrl(BIO* bio, int cmd, bio_info_cb* fp)
|
|||
/* Documented since https://www.openssl.org/docs/man1.1.1/man3/BIO_set_callback.html
|
||||
* the argument is not really of type bio_info_cb* and must be cast
|
||||
* to the required type */
|
||||
fkt_t fkt = (fkt_t)(void*)fp;
|
||||
SSL_set_info_callback(tls->ssl, fkt);
|
||||
union
|
||||
{
|
||||
fkt_t fkt;
|
||||
bio_info_cb* fp;
|
||||
} cnv;
|
||||
|
||||
cnv.fp = fp;
|
||||
SSL_set_info_callback(tls->ssl, cnv.fkt);
|
||||
status = 1;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -194,16 +194,21 @@ static BOOL freerdp_client_load_static_channel_addin(rdpChannels* channels, rdpS
|
|||
const char* name, void* data)
|
||||
{
|
||||
PVIRTUALCHANNELENTRY entry = NULL;
|
||||
PVIRTUALCHANNELENTRYEX entryEx = NULL;
|
||||
entryEx = (PVIRTUALCHANNELENTRYEX)(void*)freerdp_load_channel_addin_entry(
|
||||
union
|
||||
{
|
||||
PVIRTUALCHANNELENTRY entry;
|
||||
PVIRTUALCHANNELENTRYEX entryEx;
|
||||
} cnv;
|
||||
|
||||
cnv.entry = freerdp_load_channel_addin_entry(
|
||||
name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC | FREERDP_ADDIN_CHANNEL_ENTRYEX);
|
||||
|
||||
if (!entryEx)
|
||||
if (!cnv.entryEx)
|
||||
entry = freerdp_load_channel_addin_entry(name, NULL, NULL, FREERDP_ADDIN_CHANNEL_STATIC);
|
||||
|
||||
if (entryEx)
|
||||
if (cnv.entryEx)
|
||||
{
|
||||
if (freerdp_channels_client_load_ex(channels, settings, entryEx, data) == 0)
|
||||
if (freerdp_channels_client_load_ex(channels, settings, cnv.entryEx, data) == 0)
|
||||
{
|
||||
WLog_INFO(TAG, "loading channelEx %s", name);
|
||||
return TRUE;
|
||||
|
|
|
@ -481,11 +481,9 @@ void pf_modules_list_loaded_plugins(proxyModule* module)
|
|||
|
||||
static BOOL pf_modules_load_module(const char* module_path, proxyModule* module, void* userdata)
|
||||
{
|
||||
HMODULE handle = NULL;
|
||||
proxyModuleEntryPoint pEntryPoint = NULL;
|
||||
WINPR_ASSERT(module);
|
||||
|
||||
handle = LoadLibraryX(module_path);
|
||||
HANDLE handle = LoadLibraryX(module_path);
|
||||
|
||||
if (handle == NULL)
|
||||
{
|
||||
|
@ -493,8 +491,13 @@ static BOOL pf_modules_load_module(const char* module_path, proxyModule* module,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
pEntryPoint = (proxyModuleEntryPoint)GetProcAddress(handle, MODULE_ENTRY_POINT);
|
||||
if (!pEntryPoint)
|
||||
union
|
||||
{
|
||||
FARPROC fp;
|
||||
proxyModuleEntryPoint pEntryPoint;
|
||||
} cnv;
|
||||
cnv.fp = GetProcAddress(handle, MODULE_ENTRY_POINT);
|
||||
if (!cnv.pEntryPoint)
|
||||
{
|
||||
WLog_ERR(TAG, "GetProcAddress failed while loading %s", module_path);
|
||||
goto error;
|
||||
|
@ -504,7 +507,7 @@ static BOOL pf_modules_load_module(const char* module_path, proxyModule* module,
|
|||
WLog_ERR(TAG, "ArrayList_Append failed!");
|
||||
goto error;
|
||||
}
|
||||
return pf_modules_add(module, pEntryPoint, userdata);
|
||||
return pf_modules_add(module, cnv.pEntryPoint, userdata);
|
||||
|
||||
error:
|
||||
FreeLibrary(handle);
|
||||
|
|
|
@ -25,18 +25,9 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define min(a, b) \
|
||||
({ \
|
||||
__typeof__(a) _a = (a); \
|
||||
__typeof__(b) _b = (b); \
|
||||
_a < _b ? _a : _b; \
|
||||
})
|
||||
#define min(a, b) (a) < (b) ? (a) : (b)
|
||||
|
||||
#define container_of(ptr, type, member) \
|
||||
({ \
|
||||
__typeof__(((type*)0)->member)* __mptr = (ptr); \
|
||||
(type*)((char*)__mptr - offsetof(type, member)); \
|
||||
})
|
||||
#define container_of(ptr, type, member) (type*)((char*)(ptr)-offsetof(type, member))
|
||||
|
||||
#define ARRAY_LENGTH(a) (sizeof(a) / sizeof(a)[0])
|
||||
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
|
||||
// C23 related macros
|
||||
#if defined(__STDC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
|
||||
#define WINPR_FALLTHROUGH [[fallthrough]];
|
||||
#define WINPR_FALLTHROUGH (void)0; [[fallthrough]];
|
||||
#elif defined(__clang__)
|
||||
#define WINPR_FALLTHROUGH __attribute__((fallthrough));
|
||||
#define WINPR_FALLTHROUGH (void)0; __attribute__((fallthrough));
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
#define WINPR_FALLTHROUGH __attribute__((fallthrough));
|
||||
#define WINPR_FALLTHROUGH (void)0; __attribute__((fallthrough));
|
||||
#else
|
||||
#define WINPR_FALLTHROUGH
|
||||
#define WINPR_FALLTHROUGH (void)0;
|
||||
#endif
|
||||
|
||||
/* Set by CMake during configuration */
|
||||
|
|
|
@ -24,6 +24,10 @@
|
|||
|
||||
#if defined(__clang__)
|
||||
#define WINPR_PRAGMA_DIAG_PUSH _Pragma("clang diagnostic push")
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_OVERLENGTH_STRINGS \
|
||||
_Pragma("clang diagnostic ignored \"-Woverlength-strings\"")
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS \
|
||||
_Pragma("clang diagnostic ignored \"-Wdiscarded-qualifiers\"")
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_PEDANTIC _Pragma("clang diagnostic ignored \"-Wpedantic\"")
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES \
|
||||
_Pragma("clang diagnostic ignored \"-Wmissing-prototypes\"")
|
||||
|
@ -43,6 +47,10 @@
|
|||
#define WINPR_PRAGMA_UNROLL_LOOP _Pragma("clang loop vectorize_width(8) interleave_count(8)")
|
||||
#elif defined(__GNUC__)
|
||||
#define WINPR_PRAGMA_DIAG_PUSH _Pragma("GCC diagnostic push")
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_OVERLENGTH_STRINGS \
|
||||
_Pragma("GCC diagnostic ignored \"-Woverlength-strings\"")
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS \
|
||||
_Pragma("GCC diagnostic ignored \"-Wdiscarded-qualifiers\"")
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_PEDANTIC _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES \
|
||||
_Pragma("GCC diagnostic ignored \"-Wmissing-prototypes\"")
|
||||
|
@ -64,6 +72,8 @@
|
|||
#else
|
||||
#define WINPR_PRAGMA_DIAG_PUSH
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_PEDANTIC
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_OVERLENGTH_STRINGS
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_STRICT_PROTOTYPES
|
||||
#define WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
|
||||
|
|
|
@ -446,7 +446,7 @@ WCHAR* wcstok_s(WCHAR* strToken, const WCHAR* strDelimit, WCHAR** context)
|
|||
* http://msdn.microsoft.com/en-us/library/hh802935/
|
||||
*/
|
||||
|
||||
#include "casing.c"
|
||||
#include "casing.h"
|
||||
|
||||
LPSTR CharUpperA(LPSTR lpsz)
|
||||
{
|
||||
|
|
|
@ -235,9 +235,12 @@ BOOL winpr_HMAC_Init(WINPR_HMAC_CTX* ctx, WINPR_MD_TYPE md, const void* key, siz
|
|||
if (!ctx->xhmac)
|
||||
return FALSE;
|
||||
|
||||
WINPR_PRAGMA_DIAG_PUSH
|
||||
WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS
|
||||
const char* param_name = OSSL_MAC_PARAM_DIGEST;
|
||||
const OSSL_PARAM param[] = { OSSL_PARAM_construct_utf8_string(param_name, hash, 0),
|
||||
OSSL_PARAM_construct_end() };
|
||||
WINPR_PRAGMA_DIAG_POP
|
||||
|
||||
if (EVP_MAC_init(ctx->xhmac, key, keylen, param) == 1)
|
||||
return TRUE;
|
||||
|
|
|
@ -1252,7 +1252,6 @@ SECURITY_STATUS NCryptOpenP11StorageProviderEx(NCRYPT_PROV_HANDLE* phProvider,
|
|||
const char* modulePath = *modulePaths++;
|
||||
HANDLE library = LoadLibrary(modulePath);
|
||||
typedef CK_RV (*c_get_function_list_t)(CK_FUNCTION_LIST_PTR_PTR);
|
||||
c_get_function_list_t c_get_function_list = NULL;
|
||||
NCryptP11ProviderHandle* provider = NULL;
|
||||
|
||||
WLog_DBG(TAG, "Trying pkcs11 module '%s'", modulePath);
|
||||
|
@ -1262,14 +1261,20 @@ SECURITY_STATUS NCryptOpenP11StorageProviderEx(NCRYPT_PROV_HANDLE* phProvider,
|
|||
goto out_load_library;
|
||||
}
|
||||
|
||||
c_get_function_list = (c_get_function_list_t)GetProcAddress(library, "C_GetFunctionList");
|
||||
if (!c_get_function_list)
|
||||
union
|
||||
{
|
||||
FARPROC fp;
|
||||
c_get_function_list_t c_get_function_list;
|
||||
} cnv;
|
||||
cnv.fp = GetProcAddress(library, "C_GetFunctionList");
|
||||
|
||||
if (!cnv.c_get_function_list)
|
||||
{
|
||||
status = NTE_PROV_TYPE_ENTRY_BAD;
|
||||
goto out_load_library;
|
||||
}
|
||||
|
||||
status = initialize_pkcs11(library, c_get_function_list, phProvider);
|
||||
status = initialize_pkcs11(library, cnv.c_get_function_list, phProvider);
|
||||
if (status != ERROR_SUCCESS)
|
||||
{
|
||||
status = NTE_PROVIDER_DLL_FAIL;
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
#define DEFINE_UNICODE FALSE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR PathCchAddBackslashA
|
||||
#include "include/PathCchAddSeparator.c"
|
||||
#include "include/PathCchAddSeparator.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR
|
||||
|
@ -87,7 +87,7 @@
|
|||
#define DEFINE_UNICODE TRUE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR PathCchAddBackslashW
|
||||
#include "include/PathCchAddSeparator.c"
|
||||
#include "include/PathCchAddSeparator.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR
|
||||
|
@ -97,7 +97,7 @@
|
|||
#define DEFINE_UNICODE FALSE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR PathCchAddSlashA
|
||||
#include "include/PathCchAddSeparator.c"
|
||||
#include "include/PathCchAddSeparator.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR
|
||||
|
@ -105,7 +105,7 @@
|
|||
#define DEFINE_UNICODE TRUE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR PathCchAddSlashW
|
||||
#include "include/PathCchAddSeparator.c"
|
||||
#include "include/PathCchAddSeparator.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR
|
||||
|
@ -115,7 +115,7 @@
|
|||
#define DEFINE_UNICODE FALSE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR PathCchAddSeparatorA
|
||||
#include "include/PathCchAddSeparator.c"
|
||||
#include "include/PathCchAddSeparator.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR
|
||||
|
@ -123,7 +123,7 @@
|
|||
#define DEFINE_UNICODE TRUE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR PathCchAddSeparatorW
|
||||
#include "include/PathCchAddSeparator.c"
|
||||
#include "include/PathCchAddSeparator.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR
|
||||
|
@ -153,7 +153,7 @@ HRESULT PathCchRemoveBackslashW(PWSTR pszPath, size_t cchPath)
|
|||
#define DEFINE_UNICODE FALSE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR_EX PathCchAddBackslashExA
|
||||
#include "include/PathCchAddSeparatorEx.c"
|
||||
#include "include/PathCchAddSeparatorEx.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR_EX
|
||||
|
@ -161,7 +161,7 @@ HRESULT PathCchRemoveBackslashW(PWSTR pszPath, size_t cchPath)
|
|||
#define DEFINE_UNICODE TRUE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR_EX PathCchAddBackslashExW
|
||||
#include "include/PathCchAddSeparatorEx.c"
|
||||
#include "include/PathCchAddSeparatorEx.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR_EX
|
||||
|
@ -171,7 +171,7 @@ HRESULT PathCchRemoveBackslashW(PWSTR pszPath, size_t cchPath)
|
|||
#define DEFINE_UNICODE FALSE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR_EX PathCchAddSlashExA
|
||||
#include "include/PathCchAddSeparatorEx.c"
|
||||
#include "include/PathCchAddSeparatorEx.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR_EX
|
||||
|
@ -179,7 +179,7 @@ HRESULT PathCchRemoveBackslashW(PWSTR pszPath, size_t cchPath)
|
|||
#define DEFINE_UNICODE TRUE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR_EX PathCchAddSlashExW
|
||||
#include "include/PathCchAddSeparatorEx.c"
|
||||
#include "include/PathCchAddSeparatorEx.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR_EX
|
||||
|
@ -189,7 +189,7 @@ HRESULT PathCchRemoveBackslashW(PWSTR pszPath, size_t cchPath)
|
|||
#define DEFINE_UNICODE FALSE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR_EX PathCchAddSeparatorExA
|
||||
#include "include/PathCchAddSeparatorEx.c"
|
||||
#include "include/PathCchAddSeparatorEx.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR_EX
|
||||
|
@ -197,7 +197,7 @@ HRESULT PathCchRemoveBackslashW(PWSTR pszPath, size_t cchPath)
|
|||
#define DEFINE_UNICODE TRUE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define PATH_CCH_ADD_SEPARATOR_EX PathCchAddSeparatorExW
|
||||
#include "include/PathCchAddSeparatorEx.c"
|
||||
#include "include/PathCchAddSeparatorEx.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_SEPARATOR_EX
|
||||
|
@ -225,7 +225,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define DEFINE_UNICODE FALSE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define PATH_CCH_ADD_EXTENSION PathCchAddExtensionA
|
||||
#include "include/PathCchAddExtension.c"
|
||||
#include "include/PathCchAddExtension.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_EXTENSION
|
||||
|
@ -233,7 +233,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define DEFINE_UNICODE TRUE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define PATH_CCH_ADD_EXTENSION PathCchAddExtensionW
|
||||
#include "include/PathCchAddExtension.c"
|
||||
#include "include/PathCchAddExtension.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_EXTENSION
|
||||
|
@ -243,7 +243,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define DEFINE_UNICODE FALSE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define PATH_CCH_ADD_EXTENSION UnixPathCchAddExtensionA
|
||||
#include "include/PathCchAddExtension.c"
|
||||
#include "include/PathCchAddExtension.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_EXTENSION
|
||||
|
@ -251,7 +251,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define DEFINE_UNICODE TRUE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define PATH_CCH_ADD_EXTENSION UnixPathCchAddExtensionW
|
||||
#include "include/PathCchAddExtension.c"
|
||||
#include "include/PathCchAddExtension.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_EXTENSION
|
||||
|
@ -261,7 +261,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define DEFINE_UNICODE FALSE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define PATH_CCH_ADD_EXTENSION NativePathCchAddExtensionA
|
||||
#include "include/PathCchAddExtension.c"
|
||||
#include "include/PathCchAddExtension.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_EXTENSION
|
||||
|
@ -269,7 +269,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define DEFINE_UNICODE TRUE
|
||||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define PATH_CCH_ADD_EXTENSION NativePathCchAddExtensionW
|
||||
#include "include/PathCchAddExtension.c"
|
||||
#include "include/PathCchAddExtension.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef PATH_CCH_ADD_EXTENSION
|
||||
|
@ -284,7 +284,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_BACKSLASH_STR
|
||||
#define PATH_CCH_APPEND PathCchAppendA
|
||||
#include "include/PathCchAppend.c"
|
||||
#include "include/PathCchAppend.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -294,7 +294,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_BACKSLASH_STR_W
|
||||
#define PATH_CCH_APPEND PathCchAppendW
|
||||
#include "include/PathCchAppend.c"
|
||||
#include "include/PathCchAppend.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -306,7 +306,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_SLASH_STR
|
||||
#define PATH_CCH_APPEND UnixPathCchAppendA
|
||||
#include "include/PathCchAppend.c"
|
||||
#include "include/PathCchAppend.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -316,7 +316,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_SLASH_STR_W
|
||||
#define PATH_CCH_APPEND UnixPathCchAppendW
|
||||
#include "include/PathCchAppend.c"
|
||||
#include "include/PathCchAppend.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -328,7 +328,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_SEPARATOR_STR
|
||||
#define PATH_CCH_APPEND NativePathCchAppendA
|
||||
#include "include/PathCchAppend.c"
|
||||
#include "include/PathCchAppend.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -338,7 +338,7 @@ HRESULT PathCchRemoveBackslashExW(PWSTR pszPath, size_t cchPath, PWSTR* ppszEnd,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_SEPARATOR_STR_W
|
||||
#define PATH_CCH_APPEND NativePathCchAppendW
|
||||
#include "include/PathCchAppend.c"
|
||||
#include "include/PathCchAppend.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -454,7 +454,7 @@ HRESULT PathCchCombineExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_BACKSLASH_STR
|
||||
#define PATH_ALLOC_COMBINE PathAllocCombineA
|
||||
#include "include/PathAllocCombine.c"
|
||||
#include "include/PathAllocCombine.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -464,7 +464,7 @@ HRESULT PathCchCombineExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_BACKSLASH_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_BACKSLASH_STR_W
|
||||
#define PATH_ALLOC_COMBINE PathAllocCombineW
|
||||
#include "include/PathAllocCombine.c"
|
||||
#include "include/PathAllocCombine.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -476,7 +476,7 @@ HRESULT PathCchCombineExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_SLASH_STR
|
||||
#define PATH_ALLOC_COMBINE UnixPathAllocCombineA
|
||||
#include "include/PathAllocCombine.c"
|
||||
#include "include/PathAllocCombine.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -486,7 +486,7 @@ HRESULT PathCchCombineExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_SLASH_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_SLASH_STR_W
|
||||
#define PATH_ALLOC_COMBINE UnixPathAllocCombineW
|
||||
#include "include/PathAllocCombine.c"
|
||||
#include "include/PathAllocCombine.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -498,7 +498,7 @@ HRESULT PathCchCombineExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_SEPARATOR_STR
|
||||
#define PATH_ALLOC_COMBINE NativePathAllocCombineA
|
||||
#include "include/PathAllocCombine.c"
|
||||
#include "include/PathAllocCombine.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
@ -508,7 +508,7 @@ HRESULT PathCchCombineExW(PWSTR pszPathOut, size_t cchPathOut, PCWSTR pszPathIn,
|
|||
#define CUR_PATH_SEPARATOR_CHR PATH_SEPARATOR_CHR
|
||||
#define CUR_PATH_SEPARATOR_STR PATH_SEPARATOR_STR_W
|
||||
#define PATH_ALLOC_COMBINE NativePathAllocCombineW
|
||||
#include "include/PathAllocCombine.c"
|
||||
#include "include/PathAllocCombine.h"
|
||||
#undef DEFINE_UNICODE
|
||||
#undef CUR_PATH_SEPARATOR_CHR
|
||||
#undef CUR_PATH_SEPARATOR_STR
|
||||
|
|
|
@ -875,7 +875,7 @@ static SECURITY_STATUS SEC_ENTRY kerberos_InitializeSecurityContextA(
|
|||
goto bad_token;
|
||||
|
||||
/* Continue to AP-REQ */
|
||||
/* fall through */
|
||||
/* fallthrough */
|
||||
WINPR_FALLTHROUGH
|
||||
|
||||
case KERBEROS_STATE_AP_REQ:
|
||||
|
|
|
@ -527,7 +527,13 @@ static void* thread_launcher(void* arg)
|
|||
|
||||
if (!(fkt = thread->lpStartAddress))
|
||||
{
|
||||
WLog_ERR(TAG, "Thread function argument is %p", (void*)fkt);
|
||||
union
|
||||
{
|
||||
LPTHREAD_START_ROUTINE fkt;
|
||||
void* pv;
|
||||
} cnv;
|
||||
cnv.fkt = fkt;
|
||||
WLog_ERR(TAG, "Thread function argument is %p", cnv.pv);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <winpr/config.h>
|
||||
|
||||
#define __STDC_WANT_LIB_EXT1__ 1 // NOLINT(bugprone-reserved-identifier)
|
||||
#define __STDC_WANT_LIB_EXT1__ 1 // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -36,10 +36,20 @@
|
|||
|
||||
#define TAG WINPR_TAG("utils.unwind")
|
||||
|
||||
#define UNWIND_MAX_LINE_SIZE 1024ULL
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uintptr_t pc;
|
||||
void* langSpecificData;
|
||||
union
|
||||
{
|
||||
uintptr_t uw;
|
||||
void* pv;
|
||||
} pc;
|
||||
union
|
||||
{
|
||||
uintptr_t uptr;
|
||||
void* pv;
|
||||
} langSpecificData;
|
||||
} unwind_info_t;
|
||||
|
||||
typedef struct
|
||||
|
@ -103,8 +113,13 @@ static _Unwind_Reason_Code unwind_backtrace_callback(struct _Unwind_Context* con
|
|||
if (ctx->pos < ctx->size)
|
||||
{
|
||||
unwind_info_t* info = &ctx->info[ctx->pos++];
|
||||
info->pc = _Unwind_GetIP(context);
|
||||
info->langSpecificData = _Unwind_GetLanguageSpecificData(context);
|
||||
info->pc.uw = _Unwind_GetIP(context);
|
||||
|
||||
/* _Unwind_GetLanguageSpecificData has various return value definitions,
|
||||
* cast to the type we expect and disable linter warnings
|
||||
*/
|
||||
// NOLINTNEXTLINE(google-readability-casting,readability-redundant-casting)
|
||||
info->langSpecificData.pv = (void*)_Unwind_GetLanguageSpecificData(context);
|
||||
}
|
||||
|
||||
return _URC_NO_REASON;
|
||||
|
@ -145,8 +160,6 @@ void winpr_unwind_backtrace_free(void* buffer)
|
|||
free(ctx);
|
||||
}
|
||||
|
||||
#define UNWIND_MAX_LINE_SIZE 1024
|
||||
|
||||
char** winpr_unwind_backtrace_symbols(void* buffer, size_t* used)
|
||||
{
|
||||
union
|
||||
|
@ -172,12 +185,12 @@ char** winpr_unwind_backtrace_symbols(void* buffer, size_t* used)
|
|||
char* msg = cnv.cp + ctx->pos * sizeof(char*) + x * UNWIND_MAX_LINE_SIZE;
|
||||
const unwind_info_t* info = &ctx->info[x];
|
||||
Dl_info dlinfo = { 0 };
|
||||
int rc = dladdr((void*)info->pc, &dlinfo);
|
||||
int rc = dladdr(info->pc.pv, &dlinfo);
|
||||
|
||||
cnv.cpp[x] = msg;
|
||||
|
||||
if (rc == 0)
|
||||
(void)_snprintf(msg, UNWIND_MAX_LINE_SIZE, "unresolvable, address=%p", (void*)info->pc);
|
||||
(void)_snprintf(msg, UNWIND_MAX_LINE_SIZE, "unresolvable, address=%p", info->pc.pv);
|
||||
else
|
||||
(void)_snprintf(msg, UNWIND_MAX_LINE_SIZE, "dli_fname=%s [%p], dli_sname=%s [%p]",
|
||||
dlinfo.dli_fname, dlinfo.dli_fbase, dlinfo.dli_sname, dlinfo.dli_saddr);
|
||||
|
|
|
@ -695,20 +695,22 @@ BOOL WTSRegisterWtsApiFunctionTable(const WtsApiFunctionTable* table)
|
|||
|
||||
static BOOL LoadAndInitialize(char* library)
|
||||
{
|
||||
INIT_WTSAPI_FN pInitWtsApi = NULL;
|
||||
g_WtsApiModule = LoadLibraryX(library);
|
||||
|
||||
if (!g_WtsApiModule)
|
||||
return FALSE;
|
||||
|
||||
pInitWtsApi = (INIT_WTSAPI_FN)GetProcAddress(g_WtsApiModule, "InitWtsApi");
|
||||
|
||||
if (!pInitWtsApi)
|
||||
union
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
FARPROC fp;
|
||||
INIT_WTSAPI_FN pInitWtsApi;
|
||||
} cnv;
|
||||
cnv.fp = GetProcAddress(g_WtsApiModule, "InitWtsApi");
|
||||
|
||||
g_WtsApi = pInitWtsApi();
|
||||
if (!cnv.pInitWtsApi)
|
||||
return FALSE;
|
||||
|
||||
g_WtsApi = cnv.pInitWtsApi();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue