New upstream version 2.4.0+dfsg1
This commit is contained in:
parent
3685742385
commit
68e1ca324f
@ -74,6 +74,10 @@ include(InstallFreeRDPMan)
|
||||
include(GetGitRevisionDescription)
|
||||
include(SetFreeRDPCMakeInstallDir)
|
||||
|
||||
if (DEFINE_NO_DEPRECATED)
|
||||
add_definitions(-DDEFINE_NO_DEPRECATED)
|
||||
endif()
|
||||
|
||||
# Soname versioning
|
||||
set(BUILD_NUMBER 0)
|
||||
if ($ENV{BUILD_NUMBER})
|
||||
@ -81,7 +85,7 @@ if ($ENV{BUILD_NUMBER})
|
||||
endif()
|
||||
set(WITH_LIBRARY_VERSIONING "ON")
|
||||
|
||||
set(RAW_VERSION_STRING "2.3.0")
|
||||
set(RAW_VERSION_STRING "2.4.0")
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.source_tag")
|
||||
file(READ ${CMAKE_SOURCE_DIR}/.source_tag RAW_VERSION_STRING)
|
||||
elseif(USE_VERSION_FROM_GIT_TAG)
|
||||
@ -705,7 +709,7 @@ set(FFMPEG_FEATURE_DESCRIPTION "multimedia redirection, audio and video playback
|
||||
|
||||
set(VAAPI_FEATURE_TYPE "OPTIONAL")
|
||||
set(VAAPI_FEATURE_PURPOSE "multimedia")
|
||||
set(VAAPI_FEATURE_DESCRIPTION "VA-API hardware acceleration for video playback")
|
||||
set(VAAPI_FEATURE_DESCRIPTION "[experimental] VA-API hardware acceleration for video playback")
|
||||
|
||||
set(IPP_FEATURE_TYPE "OPTIONAL")
|
||||
set(IPP_FEATURE_PURPOSE "performance")
|
||||
@ -725,7 +729,7 @@ set(OPENH264_FEATURE_DESCRIPTION "use OpenH264 library")
|
||||
|
||||
set(OPENCL_FEATURE_TYPE "OPTIONAL")
|
||||
set(OPENCL_FEATURE_PURPOSE "codec")
|
||||
set(OPENCL_FEATURE_DESCRIPTION "use OpenCL library")
|
||||
set(OPENCL_FEATURE_DESCRIPTION "[experimental] use OpenCL library")
|
||||
|
||||
set(GSM_FEATURE_TYPE "OPTIONAL")
|
||||
set(GSM_FEATURE_PURPOSE "codec")
|
||||
@ -741,7 +745,7 @@ set(FAAD2_FEATURE_DESCRIPTION "FAAD2 AAC audio codec library")
|
||||
|
||||
set(FAAC_FEATURE_TYPE "OPTIONAL")
|
||||
set(FAAC_FEATURE_PURPOSE "codec")
|
||||
set(FAAC_FEATURE_DESCRIPTION "FAAC AAC audio codec library")
|
||||
set(FAAC_FEATURE_DESCRIPTION "[experimental] FAAC AAC audio codec library")
|
||||
|
||||
set(SOXR_FEATURE_TYPE "OPTIONAL")
|
||||
set(SOXR_FEATURE_PURPOSE "codec")
|
||||
@ -749,7 +753,7 @@ set(SOXR_FEATURE_DESCRIPTION "SOX audio resample library")
|
||||
|
||||
set(GSSAPI_FEATURE_TYPE "OPTIONAL")
|
||||
set(GSSAPI_FEATURE_PURPOSE "auth")
|
||||
set(GSSAPI_FEATURE_DESCRIPTION "add kerberos support")
|
||||
set(GSSAPI_FEATURE_DESCRIPTION "[experimental] add kerberos support")
|
||||
|
||||
if(WIN32)
|
||||
set(X11_FEATURE_TYPE "DISABLED")
|
||||
|
||||
53
ChangeLog
53
ChangeLog
@ -1,3 +1,56 @@
|
||||
# 2021-07-27 Version 2.4.0
|
||||
|
||||
Noteworthy changes:
|
||||
* Backported multithreadded progressive decoder (#7036)
|
||||
* Backported clipboard fixes (#6924)
|
||||
* Fixed remote file read (#7185)
|
||||
|
||||
Fixed issues:
|
||||
* #6938: RAILS clipboard remote -> local
|
||||
* #6985: Support newer FFMPEG builds
|
||||
* #6989: Use OpenSSL default certificate store settings
|
||||
* #7073: Planar alignment fixes
|
||||
|
||||
# 2021-03-15 Version 2.3.2
|
||||
|
||||
For a complete and detailed change log since the last release run:
|
||||
git log 2.3.2..2.4.0
|
||||
|
||||
Noteworthy changes:
|
||||
* Fixed autoreconnect printer backend loading
|
||||
* Fixed compilation on older mac os versions < 10.14
|
||||
* Fixed mouse pointer move with smart-sizing
|
||||
* Added command line option to disable websocket gateway support
|
||||
* Fixed drive hotplugging issues with windows
|
||||
* Fixed smartcard issues on mac
|
||||
|
||||
Fixed issues:
|
||||
* #6900: Transparency issues with aFreeRDP
|
||||
* #6848: Invalid format string in smartcard trace
|
||||
* #6846: Fixed static builds
|
||||
* #6888: Crash due to missing bounds checks
|
||||
* #6882: Use default sound devoce on mac
|
||||
|
||||
For a complete and detailed change log since the last release run:
|
||||
git log 2.3.1..2.3.2
|
||||
|
||||
# 2021-03-01 Version 2.3.1
|
||||
|
||||
Noteworthy changes:
|
||||
* This is a compatibility bugfix release readding some (deprecated)
|
||||
symbols/defines
|
||||
* Also add some more EXPERIMENTAL warnings to CMake flags as some were not
|
||||
clear enough.
|
||||
* Fixed a memory leak in xfreerdp (mouse pointer updates)
|
||||
* No longer activating some compile time debug options with -DWITH_DEBUG_ALL=ON
|
||||
which might leak sensitive information.
|
||||
* Added -DDEFINE_NO_DEPRECATED for developers to detect use of deprecated
|
||||
symbols
|
||||
|
||||
For a complete and detailed change log since the last release run:
|
||||
git log 2.3.0..2.3.1
|
||||
|
||||
|
||||
# 2021-02-24 Version 2.3.0
|
||||
|
||||
Important notes:
|
||||
|
||||
@ -420,33 +420,38 @@ UINT freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEn
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
AVAuthorizationStatus status =
|
||||
[AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
|
||||
switch (status)
|
||||
#if defined(MAC_OS_X_VERSION_10_14)
|
||||
if (@available(macOS 10.14, *))
|
||||
{
|
||||
case AVAuthorizationStatusAuthorized:
|
||||
mac->isAuthorized = TRUE;
|
||||
break;
|
||||
case AVAuthorizationStatusNotDetermined:
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio
|
||||
completionHandler:^(BOOL granted) {
|
||||
if (granted == YES)
|
||||
{
|
||||
mac->isAuthorized = TRUE;
|
||||
}
|
||||
else
|
||||
WLog_WARN(TAG, "Microphone access denied by user");
|
||||
}];
|
||||
break;
|
||||
case AVAuthorizationStatusRestricted:
|
||||
WLog_WARN(TAG, "Microphone access restricted by policy");
|
||||
break;
|
||||
case AVAuthorizationStatusDenied:
|
||||
WLog_WARN(TAG, "Microphone access denied by policy");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
AVAuthorizationStatus status =
|
||||
[AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio];
|
||||
switch (status)
|
||||
{
|
||||
case AVAuthorizationStatusAuthorized:
|
||||
mac->isAuthorized = TRUE;
|
||||
break;
|
||||
case AVAuthorizationStatusNotDetermined:
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio
|
||||
completionHandler:^(BOOL granted) {
|
||||
if (granted == YES)
|
||||
{
|
||||
mac->isAuthorized = TRUE;
|
||||
}
|
||||
else
|
||||
WLog_WARN(TAG, "Microphone access denied by user");
|
||||
}];
|
||||
break;
|
||||
case AVAuthorizationStatusRestricted:
|
||||
WLog_WARN(TAG, "Microphone access restricted by policy");
|
||||
break;
|
||||
case AVAuthorizationStatusDenied:
|
||||
WLog_WARN(TAG, "Microphone access denied by policy");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
error_out:
|
||||
|
||||
@ -110,27 +110,74 @@ static void CALLBACK waveInProc(HWAVEIN hWaveIn, UINT uMsg, DWORD_PTR dwInstance
|
||||
setChannelError(winmm->rdpcontext, error, "waveInProc reported an error");
|
||||
}
|
||||
|
||||
static BOOL log_mmresult(AudinWinmmDevice* winmm, const char* what, MMRESULT result)
|
||||
{
|
||||
if (result != MMSYSERR_NOERROR)
|
||||
{
|
||||
CHAR buffer[8192] = { 0 };
|
||||
CHAR msg[8192] = { 0 };
|
||||
CHAR cmsg[8192] = { 0 };
|
||||
waveInGetErrorTextA(result, buffer, sizeof(buffer));
|
||||
|
||||
_snprintf(msg, sizeof(msg) - 1, "%s failed. %" PRIu32 " [%s]", what, result, buffer);
|
||||
_snprintf(cmsg, sizeof(cmsg) - 1, "audin_winmm_thread_func reported an error '%s'", msg);
|
||||
WLog_Print(winmm->log, WLOG_DEBUG, "%s", msg);
|
||||
if (winmm->rdpcontext)
|
||||
setChannelError(winmm->rdpcontext, ERROR_INTERNAL_ERROR, cmsg);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL test_format_supported(const PWAVEFORMATEX pwfx)
|
||||
{
|
||||
MMRESULT rc;
|
||||
WAVEINCAPSA caps = { 0 };
|
||||
|
||||
rc = waveInGetDevCapsA(WAVE_MAPPER, &caps, sizeof(caps));
|
||||
if (rc != MMSYSERR_NOERROR)
|
||||
return FALSE;
|
||||
|
||||
switch (pwfx->nChannels)
|
||||
{
|
||||
case 1:
|
||||
if ((caps.dwFormats &
|
||||
(WAVE_FORMAT_1M08 | WAVE_FORMAT_2M08 | WAVE_FORMAT_4M08 | WAVE_FORMAT_96M08 |
|
||||
WAVE_FORMAT_1M16 | WAVE_FORMAT_2M16 | WAVE_FORMAT_4M16 | WAVE_FORMAT_96M16)) == 0)
|
||||
return FALSE;
|
||||
break;
|
||||
case 2:
|
||||
if ((caps.dwFormats &
|
||||
(WAVE_FORMAT_1S08 | WAVE_FORMAT_2S08 | WAVE_FORMAT_4S08 | WAVE_FORMAT_96S08 |
|
||||
WAVE_FORMAT_1S16 | WAVE_FORMAT_2S16 | WAVE_FORMAT_4S16 | WAVE_FORMAT_96S16)) == 0)
|
||||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rc = waveInOpen(NULL, WAVE_MAPPER, pwfx, 0, 0,
|
||||
WAVE_FORMAT_QUERY | WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE);
|
||||
return (rc == MMSYSERR_NOERROR);
|
||||
}
|
||||
|
||||
static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
|
||||
{
|
||||
AudinWinmmDevice* winmm = (AudinWinmmDevice*)arg;
|
||||
char* buffer;
|
||||
int size, i;
|
||||
WAVEHDR waveHdr[4];
|
||||
WAVEHDR waveHdr[4] = { 0 };
|
||||
DWORD status;
|
||||
MMRESULT rc;
|
||||
|
||||
if (!winmm->hWaveIn)
|
||||
{
|
||||
if (MMSYSERR_NOERROR != waveInOpen(&winmm->hWaveIn, WAVE_MAPPER, winmm->pwfx_cur,
|
||||
(DWORD_PTR)waveInProc, (DWORD_PTR)winmm,
|
||||
CALLBACK_FUNCTION))
|
||||
{
|
||||
if (winmm->rdpcontext)
|
||||
setChannelError(winmm->rdpcontext, ERROR_INTERNAL_ERROR,
|
||||
"audin_winmm_thread_func reported an error");
|
||||
|
||||
MMRESULT rc;
|
||||
rc = waveInOpen(&winmm->hWaveIn, WAVE_MAPPER, winmm->pwfx_cur, (DWORD_PTR)waveInProc,
|
||||
(DWORD_PTR)winmm,
|
||||
CALLBACK_FUNCTION | WAVE_MAPPED_DEFAULT_COMMUNICATION_DEVICE);
|
||||
if (!log_mmresult(winmm, "waveInOpen", rc))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
size =
|
||||
@ -150,36 +197,22 @@ static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
|
||||
waveHdr[i].lpData = buffer;
|
||||
rc = waveInPrepareHeader(winmm->hWaveIn, &waveHdr[i], sizeof(waveHdr[i]));
|
||||
|
||||
if (MMSYSERR_NOERROR != rc)
|
||||
if (!log_mmresult(winmm, "waveInPrepareHeader", rc))
|
||||
{
|
||||
WLog_Print(winmm->log, WLOG_DEBUG, "waveInPrepareHeader failed. %" PRIu32 "", rc);
|
||||
|
||||
if (winmm->rdpcontext)
|
||||
setChannelError(winmm->rdpcontext, ERROR_INTERNAL_ERROR,
|
||||
"audin_winmm_thread_func reported an error");
|
||||
}
|
||||
|
||||
rc = waveInAddBuffer(winmm->hWaveIn, &waveHdr[i], sizeof(waveHdr[i]));
|
||||
|
||||
if (MMSYSERR_NOERROR != rc)
|
||||
if (!log_mmresult(winmm, "waveInAddBuffer", rc))
|
||||
{
|
||||
WLog_Print(winmm->log, WLOG_DEBUG, "waveInAddBuffer failed. %" PRIu32 "", rc);
|
||||
|
||||
if (winmm->rdpcontext)
|
||||
setChannelError(winmm->rdpcontext, ERROR_INTERNAL_ERROR,
|
||||
"audin_winmm_thread_func reported an error");
|
||||
}
|
||||
}
|
||||
|
||||
rc = waveInStart(winmm->hWaveIn);
|
||||
|
||||
if (MMSYSERR_NOERROR != rc)
|
||||
if (!log_mmresult(winmm, "waveInStart", rc))
|
||||
{
|
||||
WLog_Print(winmm->log, WLOG_DEBUG, "waveInStart failed. %" PRIu32 "", rc);
|
||||
|
||||
if (winmm->rdpcontext)
|
||||
setChannelError(winmm->rdpcontext, ERROR_INTERNAL_ERROR,
|
||||
"audin_winmm_thread_func reported an error");
|
||||
}
|
||||
|
||||
status = WaitForSingleObject(winmm->stopEvent, INFINITE);
|
||||
@ -195,26 +228,17 @@ static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
|
||||
|
||||
rc = waveInReset(winmm->hWaveIn);
|
||||
|
||||
if (MMSYSERR_NOERROR != rc)
|
||||
if (!log_mmresult(winmm, "waveInReset", rc))
|
||||
{
|
||||
WLog_Print(winmm->log, WLOG_DEBUG, "waveInReset failed. %" PRIu32 "", rc);
|
||||
|
||||
if (winmm->rdpcontext)
|
||||
setChannelError(winmm->rdpcontext, ERROR_INTERNAL_ERROR,
|
||||
"audin_winmm_thread_func reported an error");
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
rc = waveInUnprepareHeader(winmm->hWaveIn, &waveHdr[i], sizeof(waveHdr[i]));
|
||||
|
||||
if (MMSYSERR_NOERROR != rc)
|
||||
if (!log_mmresult(winmm, "waveInUnprepareHeader", rc))
|
||||
{
|
||||
WLog_Print(winmm->log, WLOG_DEBUG, "waveInUnprepareHeader failed. %" PRIu32 "", rc);
|
||||
|
||||
if (winmm->rdpcontext)
|
||||
setChannelError(winmm->rdpcontext, ERROR_INTERNAL_ERROR,
|
||||
"audin_winmm_thread_func reported an error");
|
||||
}
|
||||
|
||||
free(waveHdr[i].lpData);
|
||||
@ -222,13 +246,8 @@ static DWORD WINAPI audin_winmm_thread_func(LPVOID arg)
|
||||
|
||||
rc = waveInClose(winmm->hWaveIn);
|
||||
|
||||
if (MMSYSERR_NOERROR != rc)
|
||||
if (!log_mmresult(winmm, "waveInClose", rc))
|
||||
{
|
||||
WLog_Print(winmm->log, WLOG_DEBUG, "waveInClose failed. %" PRIu32 "", rc);
|
||||
|
||||
if (winmm->rdpcontext)
|
||||
setChannelError(winmm->rdpcontext, ERROR_INTERNAL_ERROR,
|
||||
"audin_winmm_thread_func reported an error");
|
||||
}
|
||||
|
||||
winmm->hWaveIn = NULL;
|
||||
@ -311,16 +330,30 @@ static UINT audin_winmm_set_format(IAudinDevice* device, const AUDIO_FORMAT* for
|
||||
|
||||
for (i = 0; i < winmm->cFormats; i++)
|
||||
{
|
||||
if (winmm->ppwfx[i]->wFormatTag == format->wFormatTag &&
|
||||
winmm->ppwfx[i]->nChannels == format->nChannels &&
|
||||
winmm->ppwfx[i]->wBitsPerSample == format->wBitsPerSample)
|
||||
const PWAVEFORMATEX ppwfx = winmm->ppwfx[i];
|
||||
if ((ppwfx->wFormatTag == format->wFormatTag) && (ppwfx->nChannels == format->nChannels) &&
|
||||
(ppwfx->wBitsPerSample == format->wBitsPerSample) &&
|
||||
(ppwfx->nSamplesPerSec == format->nSamplesPerSec))
|
||||
{
|
||||
winmm->pwfx_cur = winmm->ppwfx[i];
|
||||
break;
|
||||
/* BUG: Many devices report to support stereo recording but fail here.
|
||||
* Ensure we always use mono. */
|
||||
if (ppwfx->nChannels > 1)
|
||||
{
|
||||
ppwfx->nChannels = 1;
|
||||
}
|
||||
|
||||
if (ppwfx->nBlockAlign != 2)
|
||||
{
|
||||
ppwfx->nBlockAlign = 2;
|
||||
}
|
||||
if (!test_format_supported(ppwfx))
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
winmm->pwfx_cur = ppwfx;
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
return ERROR_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
static BOOL audin_winmm_format_supported(IAudinDevice* device, const AUDIO_FORMAT* format)
|
||||
@ -332,6 +365,9 @@ static BOOL audin_winmm_format_supported(IAudinDevice* device, const AUDIO_FORMA
|
||||
if (!winmm || !format)
|
||||
return FALSE;
|
||||
|
||||
if (format->wFormatTag != WAVE_FORMAT_PCM)
|
||||
return FALSE;
|
||||
|
||||
pwfx = (PWAVEFORMATEX)malloc(sizeof(WAVEFORMATEX) + format->cbSize);
|
||||
|
||||
if (!pwfx)
|
||||
@ -346,29 +382,27 @@ static BOOL audin_winmm_format_supported(IAudinDevice* device, const AUDIO_FORMA
|
||||
data = (BYTE*)pwfx + sizeof(WAVEFORMATEX);
|
||||
memcpy(data, format->data, format->cbSize);
|
||||
|
||||
if (pwfx->wFormatTag == WAVE_FORMAT_PCM)
|
||||
pwfx->nAvgBytesPerSec = pwfx->nSamplesPerSec * pwfx->nBlockAlign;
|
||||
|
||||
if (!test_format_supported(pwfx))
|
||||
goto fail;
|
||||
|
||||
if (winmm->cFormats >= winmm->ppwfx_size)
|
||||
{
|
||||
pwfx->nAvgBytesPerSec = pwfx->nSamplesPerSec * pwfx->nBlockAlign;
|
||||
PWAVEFORMATEX* tmp_ppwfx;
|
||||
tmp_ppwfx = realloc(winmm->ppwfx, sizeof(PWAVEFORMATEX) * winmm->ppwfx_size * 2);
|
||||
|
||||
if (MMSYSERR_NOERROR == waveInOpen(NULL, WAVE_MAPPER, pwfx, 0, 0, WAVE_FORMAT_QUERY))
|
||||
{
|
||||
if (winmm->cFormats >= winmm->ppwfx_size)
|
||||
{
|
||||
PWAVEFORMATEX* tmp_ppwfx;
|
||||
tmp_ppwfx = realloc(winmm->ppwfx, sizeof(PWAVEFORMATEX) * winmm->ppwfx_size * 2);
|
||||
if (!tmp_ppwfx)
|
||||
goto fail;
|
||||
|
||||
if (!tmp_ppwfx)
|
||||
return FALSE;
|
||||
|
||||
winmm->ppwfx_size *= 2;
|
||||
winmm->ppwfx = tmp_ppwfx;
|
||||
}
|
||||
|
||||
winmm->ppwfx[winmm->cFormats++] = pwfx;
|
||||
return TRUE;
|
||||
}
|
||||
winmm->ppwfx_size *= 2;
|
||||
winmm->ppwfx = tmp_ppwfx;
|
||||
}
|
||||
|
||||
winmm->ppwfx[winmm->cFormats++] = pwfx;
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
free(pwfx);
|
||||
return FALSE;
|
||||
}
|
||||
@ -507,7 +541,7 @@ UINT freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEn
|
||||
}
|
||||
|
||||
winmm->ppwfx_size = 10;
|
||||
winmm->ppwfx = malloc(sizeof(PWAVEFORMATEX) * winmm->ppwfx_size);
|
||||
winmm->ppwfx = calloc(winmm->ppwfx_size, sizeof(PWAVEFORMATEX));
|
||||
|
||||
if (!winmm->ppwfx)
|
||||
{
|
||||
@ -516,7 +550,7 @@ UINT freerdp_audin_client_subsystem_entry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEn
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
if ((error = pEntryPoints->pRegisterAudinDevice(pEntryPoints->plugin, (IAudinDevice*)winmm)))
|
||||
if ((error = pEntryPoints->pRegisterAudinDevice(pEntryPoints->plugin, &winmm->iface)))
|
||||
{
|
||||
WLog_Print(winmm->log, WLOG_ERROR, "RegisterAudinDevice failed with error %" PRIu32 "!",
|
||||
error);
|
||||
|
||||
@ -25,9 +25,10 @@ include_directories(..)
|
||||
|
||||
add_channel_client_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} TRUE "DVCPluginEntry")
|
||||
|
||||
|
||||
|
||||
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} winpr)
|
||||
if (NOT BUILTIN_CHANNELS OR NOT BUILD_SHARED_LIBS)
|
||||
set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} freerdp-client)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
#include <cups/cups.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/file.h>
|
||||
#include <winpr/string.h>
|
||||
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
@ -92,7 +93,7 @@ static UINT printer_cups_write_printjob(rdpPrintJob* printjob, const BYTE* data,
|
||||
{
|
||||
FILE* fp;
|
||||
|
||||
fp = fopen((const char*)cups_printjob->printjob_object, "a+b");
|
||||
fp = winpr_fopen((const char*)cups_printjob->printjob_object, "a+b");
|
||||
|
||||
if (!fp)
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
@ -82,9 +82,9 @@ static char* get_printer_config_path(const rdpSettings* settings, const WCHAR* n
|
||||
char* bname = crypto_base64_encode((const BYTE*)name, (int)length);
|
||||
char* config = GetCombinedPath(dir, bname);
|
||||
|
||||
if (config && !PathFileExistsA(config))
|
||||
if (config && !winpr_PathFileExists(config))
|
||||
{
|
||||
if (!PathMakePathA(config, NULL))
|
||||
if (!winpr_PathMakePath(config, NULL))
|
||||
{
|
||||
free(config);
|
||||
config = NULL;
|
||||
@ -145,7 +145,7 @@ static BOOL printer_config_valid(const char* path)
|
||||
if (!path)
|
||||
return FALSE;
|
||||
|
||||
if (!PathFileExistsA(path))
|
||||
if (!winpr_PathFileExists(path))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
@ -261,7 +261,7 @@ static BOOL printer_remove_config(const rdpSettings* settings, const WCHAR* name
|
||||
if (!printer_config_valid(path))
|
||||
goto fail;
|
||||
|
||||
rc = RemoveDirectoryA(path);
|
||||
rc = winpr_RemoveDirectory(path);
|
||||
fail:
|
||||
free(path);
|
||||
return rc;
|
||||
@ -275,7 +275,7 @@ static BOOL printer_move_config(const rdpSettings* settings, const WCHAR* oldNam
|
||||
char* newPath = get_printer_config_path(settings, newName, newLength);
|
||||
|
||||
if (printer_config_valid(oldPath))
|
||||
rc = MoveFileA(oldPath, newPath);
|
||||
rc = winpr_MoveFile(oldPath, newPath);
|
||||
|
||||
free(oldPath);
|
||||
free(newPath);
|
||||
@ -979,7 +979,7 @@ printer_DeviceServiceEntry
|
||||
|
||||
device = (RDPDR_PRINTER*)pEntryPoints->device;
|
||||
name = device->Name;
|
||||
driver_name = device->DriverName;
|
||||
driver_name = _strdup(device->DriverName);
|
||||
|
||||
/* Secondary argument is one of the following:
|
||||
*
|
||||
@ -1016,7 +1016,8 @@ printer_DeviceServiceEntry
|
||||
if (!driver)
|
||||
{
|
||||
WLog_ERR(TAG, "Could not get a printer driver!");
|
||||
return CHANNEL_RC_INITIALIZATION_ERROR;
|
||||
error = CHANNEL_RC_INITIALIZATION_ERROR;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (name && name[0])
|
||||
@ -1064,7 +1065,9 @@ printer_DeviceServiceEntry
|
||||
}
|
||||
|
||||
fail:
|
||||
driver->ReleaseRef(driver);
|
||||
free(driver_name);
|
||||
if (driver)
|
||||
driver->ReleaseRef(driver);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ static UINT drive_hotplug_thread_terminate(rdpdrPlugin* rdpdr)
|
||||
|
||||
#elif _WIN32
|
||||
|
||||
BOOL check_path(char* path)
|
||||
BOOL check_path(const char* path)
|
||||
{
|
||||
UINT type = GetDriveTypeA(path);
|
||||
|
||||
@ -244,6 +244,9 @@ LRESULT CALLBACK hotplug_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
device_ext = (DEVICE_DRIVE_EXT*)ListDictionary_GetItemValue(
|
||||
rdpdr->devman->devices, (void*)keys[j]);
|
||||
|
||||
if (device_ext->device.type != RDPDR_DTYP_FILESYSTEM)
|
||||
continue;
|
||||
|
||||
if (device_ext->path[0] == drive_name_upper ||
|
||||
device_ext->path[0] == drive_name_lower)
|
||||
{
|
||||
|
||||
@ -999,6 +999,19 @@ static UINT rdpgfx_recv_wire_to_surface_1_pdu(RDPGFX_CHANNEL_CALLBACK* callback,
|
||||
cmd.data = pdu.bitmapData;
|
||||
cmd.extra = NULL;
|
||||
|
||||
if (cmd.right < cmd.left)
|
||||
{
|
||||
WLog_Print(gfx->log, WLOG_ERROR, "RecvWireToSurface1Pdu right=%" PRIu32 " < left=%" PRIu32,
|
||||
cmd.right, cmd.left);
|
||||
return ERROR_INVALID_DATA;
|
||||
}
|
||||
if (cmd.bottom < cmd.top)
|
||||
{
|
||||
WLog_Print(gfx->log, WLOG_ERROR, "RecvWireToSurface1Pdu bottom=%" PRIu32 " < top=%" PRIu32,
|
||||
cmd.bottom, cmd.top);
|
||||
return ERROR_INVALID_DATA;
|
||||
}
|
||||
|
||||
if ((error = rdpgfx_decode(gfx, &cmd)))
|
||||
WLog_Print(gfx->log, WLOG_ERROR, "rdpgfx_decode failed with error %" PRIu32 "!", error);
|
||||
|
||||
|
||||
@ -144,7 +144,7 @@ static BOOL rdpsnd_mac_open(rdpsndDevicePlugin *device, const AUDIO_FORMAT *form
|
||||
OSStatus err;
|
||||
NSError *error;
|
||||
rdpsndMacPlugin *mac = (rdpsndMacPlugin *)device;
|
||||
AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyDefaultSystemOutputDevice,
|
||||
AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyDefaultOutputDevice,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster };
|
||||
|
||||
|
||||
@ -422,7 +422,7 @@ static UINT rdpsnd_server_send_wave_pdu(RdpsndServerContext* context, UINT16 wTi
|
||||
Stream_Seek(s, 3); /* bPad */
|
||||
start = Stream_GetPosition(s);
|
||||
src = context->priv->out_buffer;
|
||||
length = context->priv->out_pending_frames * context->priv->src_bytes_per_frame;
|
||||
length = context->priv->out_pending_frames * context->priv->src_bytes_per_frame * 1ULL;
|
||||
|
||||
if (!freerdp_dsp_encode(context->priv->dsp_context, context->src_format, src, length, s))
|
||||
return ERROR_INTERNAL_ERROR;
|
||||
|
||||
@ -180,6 +180,7 @@ void smartcard_context_free(void* pCtx)
|
||||
|
||||
/* cancel blocking calls like SCardGetStatusChange */
|
||||
SCardCancel(pContext->hContext);
|
||||
SCardReleaseContext(pContext->hContext);
|
||||
|
||||
if (MessageQueue_PostQuit(pContext->IrpQueue, 0) &&
|
||||
(WaitForSingleObject(pContext->thread, INFINITE) == WAIT_FAILED))
|
||||
@ -237,7 +238,7 @@ static void smartcard_release_all_contexts(SMARTCARD_DEVICE* smartcard)
|
||||
|
||||
/* Put thread to sleep so that PC/SC can process the cancel requests. This fixes a race
|
||||
* condition that sometimes caused the pc/sc daemon to crash on MacOS (_xpc_api_misuse) */
|
||||
Sleep(100);
|
||||
SleepEx(100, FALSE);
|
||||
|
||||
/**
|
||||
* Call SCardReleaseContext on remaining contexts and remove them from rgSCardContextList.
|
||||
@ -251,27 +252,7 @@ static void smartcard_release_all_contexts(SMARTCARD_DEVICE* smartcard)
|
||||
|
||||
for (index = 0; index < keyCount; index++)
|
||||
{
|
||||
pContext = (SMARTCARD_CONTEXT*)ListDictionary_Remove(smartcard->rgSCardContextList,
|
||||
(void*)pKeys[index]);
|
||||
|
||||
if (!pContext)
|
||||
continue;
|
||||
|
||||
hContext = pContext->hContext;
|
||||
|
||||
if (SCardIsValidContext(hContext) == SCARD_S_SUCCESS)
|
||||
{
|
||||
SCardReleaseContext(hContext);
|
||||
|
||||
if (MessageQueue_PostQuit(pContext->IrpQueue, 0) &&
|
||||
(WaitForSingleObject(pContext->thread, INFINITE) == WAIT_FAILED))
|
||||
WLog_ERR(TAG, "WaitForSingleObject failed with error %" PRIu32 "!",
|
||||
GetLastError());
|
||||
|
||||
CloseHandle(pContext->thread);
|
||||
MessageQueue_Free(pContext->IrpQueue);
|
||||
free(pContext);
|
||||
}
|
||||
ListDictionary_SetItemValue(smartcard->rgSCardContextList, (void*)pKeys[index], NULL);
|
||||
}
|
||||
|
||||
free(pKeys);
|
||||
|
||||
@ -349,10 +349,16 @@ static char* smartcard_convert_string_list(const void* in, size_t bytes, BOOL un
|
||||
if (bytes < 1)
|
||||
return NULL;
|
||||
|
||||
if (in == NULL)
|
||||
return NULL;
|
||||
|
||||
if (unicode)
|
||||
{
|
||||
length = (bytes / 2);
|
||||
if (ConvertFromUnicode(CP_UTF8, 0, string.wz, (int)length, &mszA, 0, NULL, NULL) !=
|
||||
length = (bytes / sizeof(WCHAR)) - 1;
|
||||
mszA = (char*)calloc(length + 1, sizeof(WCHAR));
|
||||
if (!mszA)
|
||||
return NULL;
|
||||
if (ConvertFromUnicode(CP_UTF8, 0, string.wz, (int)length, &mszA, length + 1, NULL, NULL) !=
|
||||
(int)length)
|
||||
{
|
||||
free(mszA);
|
||||
@ -362,10 +368,11 @@ static char* smartcard_convert_string_list(const void* in, size_t bytes, BOOL un
|
||||
else
|
||||
{
|
||||
length = bytes;
|
||||
mszA = (char*)malloc(length);
|
||||
mszA = (char*)calloc(length, sizeof(char));
|
||||
if (!mszA)
|
||||
return NULL;
|
||||
CopyMemory(mszA, string.sz, length);
|
||||
CopyMemory(mszA, string.sz, length - 1);
|
||||
mszA[length - 1] = '\0';
|
||||
}
|
||||
|
||||
for (index = 0; index < length - 1; index++)
|
||||
@ -1307,21 +1314,24 @@ static void smartcard_trace_status_return(SMARTCARD_DEVICE* smartcard, const Sta
|
||||
static void smartcard_trace_state_return(SMARTCARD_DEVICE* smartcard, const State_Return* ret)
|
||||
{
|
||||
char buffer[1024];
|
||||
|
||||
char* state;
|
||||
WINPR_UNUSED(smartcard);
|
||||
|
||||
if (!WLog_IsLevelActive(WLog_Get(TAG), g_LogLevel))
|
||||
return;
|
||||
|
||||
state = SCardGetReaderStateString(ret->dwState);
|
||||
WLog_LVL(TAG, g_LogLevel, "Reconnect_Return {");
|
||||
WLog_LVL(TAG, g_LogLevel, " ReturnCode: %s (0x%08" PRIX32 ")",
|
||||
SCardGetErrorString(ret->ReturnCode), ret->ReturnCode);
|
||||
WLog_LVL(TAG, g_LogLevel, " dwState: %s (0x%08" PRIX32 ")", ret->dwState);
|
||||
WLog_LVL(TAG, g_LogLevel, " dwProtocol: %s (0x%08" PRIX32 ")", ret->dwProtocol);
|
||||
WLog_LVL(TAG, g_LogLevel, " cbAtrLen: %s (0x%08" PRIX32 ")", ret->cbAtrLen);
|
||||
WLog_LVL(TAG, g_LogLevel, " dwState: %s (0x%08" PRIX32 ")", state, ret->dwState);
|
||||
WLog_LVL(TAG, g_LogLevel, " dwProtocol: %s (0x%08" PRIX32 ")",
|
||||
SCardGetProtocolString(ret->dwProtocol), ret->dwProtocol);
|
||||
WLog_LVL(TAG, g_LogLevel, " cbAtrLen: (0x%08" PRIX32 ")", ret->cbAtrLen);
|
||||
WLog_LVL(TAG, g_LogLevel, " rgAtr: %s",
|
||||
smartcard_array_dump(ret->rgAtr, sizeof(ret->rgAtr), buffer, sizeof(buffer)));
|
||||
WLog_LVL(TAG, g_LogLevel, "}");
|
||||
free(state);
|
||||
}
|
||||
|
||||
static void smartcard_trace_reconnect_return(SMARTCARD_DEVICE* smartcard,
|
||||
|
||||
@ -536,7 +536,7 @@ static BOOL device_is_filtered(struct libusb_device* dev,
|
||||
|
||||
for (x = 0; x < config->bNumInterfaces; x++)
|
||||
{
|
||||
uint8_t y;
|
||||
int y;
|
||||
const struct libusb_interface* ifc = &config->interface[x];
|
||||
for (y = 0; y < ifc->num_altsetting; y++)
|
||||
{
|
||||
|
||||
@ -666,7 +666,7 @@ static void video_timer(VideoClientContext* video, UINT64 now)
|
||||
presentation = frame->presentation;
|
||||
|
||||
priv->publishedFrames++;
|
||||
memcpy(presentation->surfaceData, frame->surfaceData, frame->w * frame->h * 4);
|
||||
memcpy(presentation->surfaceData, frame->surfaceData, frame->w * frame->h * 4ULL);
|
||||
|
||||
video->showSurface(video, presentation->surface);
|
||||
|
||||
@ -848,7 +848,7 @@ static UINT video_VideoData(VideoClientContext* context, TSMM_VIDEO_DATA* data)
|
||||
frame->w = presentation->SourceWidth;
|
||||
frame->h = presentation->SourceHeight;
|
||||
|
||||
frame->surfaceData = BufferPool_Take(priv->surfacePool, frame->w * frame->h * 4);
|
||||
frame->surfaceData = BufferPool_Take(priv->surfacePool, frame->w * frame->h * 4ULL);
|
||||
if (!frame->surfaceData)
|
||||
{
|
||||
WLog_ERR(TAG, "unable to allocate frame data");
|
||||
|
||||
@ -42,7 +42,7 @@ static BOOL wlf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
if (!ptr)
|
||||
return FALSE;
|
||||
|
||||
ptr->size = pointer->width * pointer->height * 4;
|
||||
ptr->size = pointer->width * pointer->height * 4ULL;
|
||||
ptr->data = _aligned_malloc(ptr->size, 16);
|
||||
|
||||
if (!ptr->data)
|
||||
@ -92,7 +92,7 @@ static BOOL wlf_Pointer_Set(rdpContext* context, const rdpPointer* pointer)
|
||||
!wlf_scale_coordinates(context, &w, &h, FALSE))
|
||||
return FALSE;
|
||||
|
||||
size = w * h * 4;
|
||||
size = w * h * 4ULL;
|
||||
data = malloc(size);
|
||||
|
||||
if (!data)
|
||||
|
||||
@ -59,11 +59,9 @@ int main(int argc, char* argv[])
|
||||
status = freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE);
|
||||
if (status)
|
||||
{
|
||||
BOOL list = settings->ListMonitors;
|
||||
|
||||
rc = freerdp_client_settings_command_line_status_print(settings, status, argc, argv);
|
||||
|
||||
if (list)
|
||||
if (settings->ListMonitors)
|
||||
xf_list_monitors(xfc);
|
||||
|
||||
goto out;
|
||||
|
||||
@ -1034,7 +1034,8 @@ static BOOL xf_cliprdr_process_selection_request(xfClipboard* clipboard,
|
||||
|
||||
if (!delayRespond)
|
||||
{
|
||||
union {
|
||||
union
|
||||
{
|
||||
XEvent* ev;
|
||||
XSelectionEvent* sev;
|
||||
} conv;
|
||||
@ -1423,7 +1424,10 @@ static UINT xf_cliprdr_server_format_list(CliprdrClientContext* context,
|
||||
}
|
||||
|
||||
ret = xf_cliprdr_send_client_format_list_response(clipboard, TRUE);
|
||||
xf_cliprdr_prepare_to_set_selection_owner(xfc, clipboard);
|
||||
if (xfc->remote_app)
|
||||
xf_cliprdr_set_selection_owner(xfc, clipboard, CurrentTime);
|
||||
else
|
||||
xf_cliprdr_prepare_to_set_selection_owner(xfc, clipboard);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1611,7 +1615,8 @@ xf_cliprdr_server_format_data_response(CliprdrClientContext* context,
|
||||
|
||||
xf_cliprdr_provide_data(clipboard, clipboard->respond, pDstData, DstSize);
|
||||
{
|
||||
union {
|
||||
union
|
||||
{
|
||||
XEvent* ev;
|
||||
XSelectionEvent* sev;
|
||||
} conv;
|
||||
|
||||
@ -262,6 +262,37 @@ static BOOL xf_event_execute_action_script(xfContext* xfc, const XEvent* event)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y)
|
||||
{
|
||||
rdpSettings* settings;
|
||||
INT64 tx, ty;
|
||||
|
||||
if (!xfc || !xfc->context.settings || !y || !x)
|
||||
return;
|
||||
|
||||
settings = xfc->context.settings;
|
||||
tx = *x;
|
||||
ty = *y;
|
||||
if (!xfc->remote_app)
|
||||
{
|
||||
#ifdef WITH_XRENDER
|
||||
|
||||
if (xf_picture_transform_required(xfc))
|
||||
{
|
||||
double xScalingFactor = xfc->scaledWidth / (double)settings->DesktopWidth;
|
||||
double yScalingFactor = xfc->scaledHeight / (double)settings->DesktopHeight;
|
||||
tx = ((tx + xfc->offset_x) * xScalingFactor);
|
||||
ty = ((ty + xfc->offset_y) * yScalingFactor);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
CLAMP_COORDINATES(tx, ty);
|
||||
*x = tx;
|
||||
*y = ty;
|
||||
}
|
||||
|
||||
void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y)
|
||||
{
|
||||
rdpSettings* settings;
|
||||
|
||||
@ -33,6 +33,7 @@ void xf_event_SendClientEvent(xfContext* xfc, xfWindow* window, Atom atom, unsig
|
||||
...);
|
||||
|
||||
void xf_event_adjust_coordinates(xfContext* xfc, int* x, int* y);
|
||||
void xf_adjust_coordinates_to_screen(xfContext* xfc, UINT32* x, UINT32* y);
|
||||
|
||||
BOOL xf_generic_MotionNotify(xfContext* xfc, int x, int y, int state, Window window, BOOL app);
|
||||
BOOL xf_generic_ButtonPress(xfContext* xfc, int x, int y, int button, Window window, BOOL app);
|
||||
|
||||
@ -231,7 +231,7 @@ static Pixmap xf_brush_new(xfContext* xfc, UINT32 width, UINT32 height, UINT32 b
|
||||
if (data)
|
||||
{
|
||||
brushFormat = gdi_get_pixel_format(bpp);
|
||||
cdata = (BYTE*)_aligned_malloc(width * height * 4, 16);
|
||||
cdata = (BYTE*)_aligned_malloc(width * height * 4ULL, 16);
|
||||
freerdp_image_copy(cdata, gdi->dstFormat, 0, 0, 0, width, height, data, brushFormat, 0, 0,
|
||||
0, &xfc->context.gdi->palette, FREERDP_FLIP_NONE);
|
||||
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0, (char*)cdata, width,
|
||||
@ -1066,7 +1066,7 @@ static BOOL xf_gdi_surface_bits(rdpContext* context, const SURFACE_BITS_COMMAND*
|
||||
case RDP_CODEC_ID_NONE:
|
||||
pSrcData = cmd->bmp.bitmapData;
|
||||
format = gdi_get_pixel_format(cmd->bmp.bpp);
|
||||
size = cmd->bmp.width * cmd->bmp.height * GetBytesPerPixel(format);
|
||||
size = cmd->bmp.width * cmd->bmp.height * GetBytesPerPixel(format) * 1ULL;
|
||||
if (size > cmd->bmp.bitmapDataLength)
|
||||
{
|
||||
WLog_ERR(TAG, "Short nocodec message: got %" PRIu32 " bytes, require %" PRIuz,
|
||||
|
||||
@ -288,7 +288,7 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
||||
|
||||
surface->gdi.scanline = surface->gdi.width * GetBytesPerPixel(surface->gdi.format);
|
||||
surface->gdi.scanline = x11_pad_scanline(surface->gdi.scanline, xfc->scanline_pad);
|
||||
size = surface->gdi.scanline * surface->gdi.height;
|
||||
size = surface->gdi.scanline * surface->gdi.height * 1ULL;
|
||||
surface->gdi.data = (BYTE*)_aligned_malloc(size, 16);
|
||||
|
||||
if (!surface->gdi.data)
|
||||
@ -312,7 +312,7 @@ static UINT xf_CreateSurface(RdpgfxClientContext* context,
|
||||
UINT32 bytes = GetBytesPerPixel(gdi->dstFormat);
|
||||
surface->stageScanline = width * bytes;
|
||||
surface->stageScanline = x11_pad_scanline(surface->stageScanline, xfc->scanline_pad);
|
||||
size = surface->stageScanline * surface->gdi.height;
|
||||
size = surface->stageScanline * surface->gdi.height * 1ULL;
|
||||
surface->stage = (BYTE*)_aligned_malloc(size, 16);
|
||||
|
||||
if (!surface->stage)
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
|
||||
#include "xf_graphics.h"
|
||||
#include "xf_gdi.h"
|
||||
#include "xf_event.h"
|
||||
|
||||
#include <freerdp/log.h>
|
||||
#define TAG CLIENT_TAG("x11")
|
||||
@ -124,7 +125,7 @@ static BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
|
||||
|
||||
if ((INT64)depth != xfc->depth)
|
||||
{
|
||||
if (!(data = _aligned_malloc(bitmap->width * bitmap->height * 4, 16)))
|
||||
if (!(data = _aligned_malloc(bitmap->width * bitmap->height * 4ULL, 16)))
|
||||
goto unlock;
|
||||
|
||||
if (!freerdp_image_copy(data, gdi->dstFormat, 0, 0, 0, bitmap->width, bitmap->height,
|
||||
@ -303,16 +304,16 @@ static BOOL _xf_Pointer_GetCursorForCurrentScale(rdpContext* context, const rdpP
|
||||
ci.height = yTargetSize;
|
||||
ci.xhot = pointer->xPos * xscale;
|
||||
ci.yhot = pointer->yPos * yscale;
|
||||
size = ci.height * ci.width * GetBytesPerPixel(CursorFormat);
|
||||
|
||||
if (!(ci.pixels = (XcursorPixel*)_aligned_malloc(size, 16)))
|
||||
{
|
||||
xf_unlock_x11(xfc);
|
||||
return FALSE;
|
||||
}
|
||||
size = ci.height * ci.width * GetBytesPerPixel(CursorFormat) * 1ULL;
|
||||
|
||||
if (xscale != 1 || yscale != 1)
|
||||
{
|
||||
if (!(ci.pixels = (XcursorPixel*)_aligned_malloc(size, 16)))
|
||||
{
|
||||
xf_unlock_x11(xfc);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!freerdp_image_scale((BYTE*)ci.pixels, CursorFormat, 0, 0, 0, ci.width, ci.height,
|
||||
(BYTE*)xpointer->cursorPixels, CursorFormat, 0, 0, 0,
|
||||
pointer->width, pointer->height))
|
||||
@ -390,7 +391,7 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
xpointer->nCursors = 0;
|
||||
xpointer->mCursors = 0;
|
||||
|
||||
size = pointer->height * pointer->width * GetBytesPerPixel(CursorFormat);
|
||||
size = pointer->height * pointer->width * GetBytesPerPixel(CursorFormat) * 1ULL;
|
||||
|
||||
if (!(xpointer->cursorPixels = (XcursorPixel*)_aligned_malloc(size, 16)))
|
||||
return FALSE;
|
||||
@ -521,6 +522,8 @@ static BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
|
||||
if (xfc->remote_app && !xfc->focused)
|
||||
return TRUE;
|
||||
|
||||
xf_adjust_coordinates_to_screen(xfc, &x, &y);
|
||||
|
||||
xf_lock_x11(xfc);
|
||||
|
||||
rc = XGetWindowAttributes(xfc->display, handle, ¤t);
|
||||
@ -541,7 +544,7 @@ static BOOL xf_Pointer_SetPosition(rdpContext* context, UINT32 x, UINT32 y)
|
||||
|
||||
rc = XWarpPointer(xfc->display, None, handle, 0, 0, 0, 0, x, y);
|
||||
if (rc == 0)
|
||||
WLog_WARN(TAG, "xf_Pointer_SetPosition: XWrapPointer==%d", rc);
|
||||
WLog_WARN(TAG, "xf_Pointer_SetPosition: XWarpPointer==%d", rc);
|
||||
tmp.event_mask = current.your_event_mask;
|
||||
rc = XChangeWindowAttributes(xfc->display, handle, CWEventMask, &tmp);
|
||||
if (rc == 0)
|
||||
|
||||
@ -60,7 +60,7 @@ static BOOL xf_keyboard_action_script_init(xfContext* xfc)
|
||||
char* keyCombination;
|
||||
char buffer[1024] = { 0 };
|
||||
char command[1024] = { 0 };
|
||||
xfc->actionScriptExists = PathFileExistsA(xfc->context.settings->ActionScript);
|
||||
xfc->actionScriptExists = winpr_PathFileExists(xfc->context.settings->ActionScript);
|
||||
|
||||
if (!xfc->actionScriptExists)
|
||||
return FALSE;
|
||||
|
||||
@ -532,7 +532,7 @@ static xfRailIconCache* RailIconCache_New(rdpSettings* settings)
|
||||
|
||||
cache->numCaches = settings->RemoteAppNumIconCaches;
|
||||
cache->numCacheEntries = settings->RemoteAppNumIconCacheEntries;
|
||||
cache->entries = calloc(cache->numCaches * cache->numCacheEntries, sizeof(xfRailIcon));
|
||||
cache->entries = calloc(cache->numCaches * cache->numCacheEntries * 1ULL, sizeof(xfRailIcon));
|
||||
|
||||
if (!cache->entries)
|
||||
{
|
||||
@ -602,7 +602,7 @@ static BOOL convert_rail_icon(const ICON_INFO* iconInfo, xfRailIcon* railIcon)
|
||||
long* pixels;
|
||||
int i;
|
||||
int nelements;
|
||||
argbPixels = calloc(iconInfo->width * iconInfo->height, 4);
|
||||
argbPixels = calloc(iconInfo->width * iconInfo->height * 1ULL, 4);
|
||||
|
||||
if (!argbPixels)
|
||||
goto error;
|
||||
|
||||
@ -28,11 +28,15 @@ endif()
|
||||
set(${MODULE_PREFIX}_SRCS
|
||||
client.c
|
||||
cmdline.c
|
||||
compatibility.c
|
||||
compatibility.h
|
||||
file.c
|
||||
geometry.c)
|
||||
|
||||
if(NOT DEFINE_NO_DEPRECATED)
|
||||
list(APPEND ${MODULE_PREFIX}_SRCS
|
||||
compatibility.c
|
||||
compatibility.h)
|
||||
endif()
|
||||
|
||||
foreach(FREERDP_CHANNELS_CLIENT_SRC ${FREERDP_CHANNELS_CLIENT_SRCS})
|
||||
get_filename_component(NINC ${FREERDP_CHANNELS_CLIENT_SRC} PATH)
|
||||
include_directories(${NINC})
|
||||
|
||||
@ -93,7 +93,7 @@ static BOOL freerdp_path_valid(const char* path, BOOL* special)
|
||||
? TRUE
|
||||
: FALSE;
|
||||
if (!isSpecial)
|
||||
isPath = PathFileExistsA(path);
|
||||
isPath = winpr_PathFileExists(path);
|
||||
|
||||
if (special)
|
||||
*special = isSpecial;
|
||||
@ -120,6 +120,23 @@ static BOOL freerdp_sanitize_drive_name(char* name, const char* invalid, const c
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static char* name_from_path(const char* path)
|
||||
{
|
||||
const char* name = "NULL";
|
||||
if (path)
|
||||
{
|
||||
if (_strnicmp(path, "%", 2) == 0)
|
||||
name = "home";
|
||||
else if (_strnicmp(path, "*", 2) == 0)
|
||||
name = "hotplug-all";
|
||||
else if (_strnicmp(path, "DynamicDrives", 2) == 0)
|
||||
name = "hotplug";
|
||||
else
|
||||
name = path;
|
||||
}
|
||||
return _strdup(name);
|
||||
}
|
||||
|
||||
static BOOL freerdp_client_add_drive(rdpSettings* settings, const char* path, const char* name)
|
||||
{
|
||||
RDPDR_DRIVE* drive;
|
||||
@ -134,9 +151,9 @@ static BOOL freerdp_client_add_drive(rdpSettings* settings, const char* path, co
|
||||
if (name)
|
||||
{
|
||||
/* Path was entered as secondary argument, swap */
|
||||
if (PathFileExistsA(name))
|
||||
if (winpr_PathFileExists(name))
|
||||
{
|
||||
if (!PathFileExistsA(path) || (!PathIsRelativeA(name) && PathIsRelativeA(path)))
|
||||
if (!winpr_PathFileExists(path) || (!PathIsRelativeA(name) && PathIsRelativeA(path)))
|
||||
{
|
||||
const char* tmp = path;
|
||||
path = name;
|
||||
@ -151,8 +168,10 @@ static BOOL freerdp_client_add_drive(rdpSettings* settings, const char* path, co
|
||||
goto fail;
|
||||
}
|
||||
else /* We need a name to send to the server. */
|
||||
if (!(drive->Name = _strdup(path)))
|
||||
goto fail;
|
||||
{
|
||||
if (!(drive->Name = name_from_path(path)))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!path || !freerdp_sanitize_drive_name(drive->Name, "\\/", "__"))
|
||||
goto fail;
|
||||
@ -1341,8 +1360,10 @@ static int freerdp_detect_posix_style_command_line_syntax(int argc, char** argv,
|
||||
|
||||
static BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* flags)
|
||||
{
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
int old_cli_status;
|
||||
size_t old_cli_count;
|
||||
#endif
|
||||
int posix_cli_status;
|
||||
size_t posix_cli_count;
|
||||
int windows_cli_status;
|
||||
@ -1353,7 +1374,10 @@ static BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* fla
|
||||
argc, argv, &windows_cli_count, ignoreUnknown);
|
||||
posix_cli_status =
|
||||
freerdp_detect_posix_style_command_line_syntax(argc, argv, &posix_cli_count, ignoreUnknown);
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
old_cli_status = freerdp_detect_old_command_line_syntax(argc, argv, &old_cli_count);
|
||||
#endif
|
||||
|
||||
/* Default is POSIX syntax */
|
||||
*flags = COMMAND_LINE_SEPARATOR_SPACE;
|
||||
*flags |= COMMAND_LINE_SIGIL_DASH | COMMAND_LINE_SIGIL_DOUBLE_DASH;
|
||||
@ -1370,6 +1394,7 @@ static BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* fla
|
||||
*flags = COMMAND_LINE_SEPARATOR_COLON;
|
||||
*flags |= COMMAND_LINE_SIGIL_SLASH | COMMAND_LINE_SIGIL_PLUS_MINUS;
|
||||
}
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
else if (old_cli_status >= 0)
|
||||
{
|
||||
/* Ignore legacy parsing in case there is an error in the command line. */
|
||||
@ -1380,9 +1405,13 @@ static BOOL freerdp_client_detect_command_line(int argc, char** argv, DWORD* fla
|
||||
compatibility = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
WLog_DBG(TAG, "windows: %d/%d posix: %d/%d compat: %d/%d", windows_cli_status,
|
||||
windows_cli_count, posix_cli_status, posix_cli_count, old_cli_status, old_cli_count);
|
||||
#else
|
||||
WLog_DBG(TAG, "windows: %d/%d posix: %d/%d", windows_cli_status, windows_cli_count,
|
||||
posix_cli_status, posix_cli_count);
|
||||
#endif
|
||||
|
||||
return compatibility;
|
||||
}
|
||||
|
||||
@ -1574,12 +1603,14 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
freerdp_settings_set_string(settings, FreeRDP_ProxyUsername, NULL);
|
||||
freerdp_settings_set_string(settings, FreeRDP_ProxyPassword, NULL);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
if (compatibility)
|
||||
{
|
||||
WLog_WARN(TAG, "Using deprecated command-line interface!");
|
||||
return freerdp_client_parse_old_command_line_arguments(argc, argv, settings);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (allowUnknown)
|
||||
flags |= COMMAND_LINE_IGN_UNKNOWN_KEYWORD;
|
||||
@ -2234,15 +2265,29 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
settings->GatewayRpcTransport = TRUE;
|
||||
settings->GatewayHttpTransport = FALSE;
|
||||
}
|
||||
else if (_stricmp(arg->Value, "http") == 0)
|
||||
else
|
||||
{
|
||||
settings->GatewayRpcTransport = FALSE;
|
||||
settings->GatewayHttpTransport = TRUE;
|
||||
}
|
||||
else if (_stricmp(arg->Value, "auto") == 0)
|
||||
{
|
||||
settings->GatewayRpcTransport = TRUE;
|
||||
settings->GatewayHttpTransport = TRUE;
|
||||
char* c = strchr(arg->Value, ',');
|
||||
if (c)
|
||||
{
|
||||
*c++ = '\0';
|
||||
if (_stricmp(c, "no-websockets") != 0)
|
||||
{
|
||||
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
|
||||
}
|
||||
freerdp_settings_set_bool(settings, FreeRDP_GatewayHttpUseWebsockets, FALSE);
|
||||
}
|
||||
|
||||
if (_stricmp(arg->Value, "http") == 0)
|
||||
{
|
||||
settings->GatewayRpcTransport = FALSE;
|
||||
settings->GatewayHttpTransport = TRUE;
|
||||
}
|
||||
else if (_stricmp(arg->Value, "auto") == 0)
|
||||
{
|
||||
settings->GatewayRpcTransport = TRUE;
|
||||
settings->GatewayHttpTransport = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
CommandLineSwitchCase(arg, "gat")
|
||||
@ -2582,6 +2627,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
if (enable)
|
||||
settings->SupportGraphicsPipeline = TRUE;
|
||||
}
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
#ifdef WITH_GFX_H264
|
||||
CommandLineSwitchCase(arg, "gfx-h264")
|
||||
{
|
||||
@ -2631,6 +2677,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
CommandLineSwitchCase(arg, "rfx")
|
||||
{
|
||||
@ -2875,6 +2922,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
CommandLineSwitchCase(arg, "cert-name")
|
||||
{
|
||||
if (!copy_value(arg->Value, &settings->CertificateName))
|
||||
@ -2892,6 +2940,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
{
|
||||
settings->AutoDenyCertificate = enable;
|
||||
}
|
||||
#endif
|
||||
CommandLineSwitchCase(arg, "authentication")
|
||||
{
|
||||
settings->Authentication = enable;
|
||||
@ -3543,6 +3592,7 @@ BOOL freerdp_client_load_addins(rdpChannels* channels, rdpSettings* settings)
|
||||
/* Syntax: Comma seperated list of the following entries:
|
||||
* '*' ... Redirect all drives, including hotplug
|
||||
* 'DynamicDrives' ... hotplug
|
||||
* '%' ... user home directory
|
||||
* <label>(<path>) ... One or more paths to redirect.
|
||||
* <path>(<label>) ... One or more paths to redirect.
|
||||
* <path> ... One or more paths to redirect.
|
||||
|
||||
@ -89,6 +89,7 @@ static const COMMAND_LINE_ARGUMENT_A args[] = {
|
||||
"subsequent connections if the certificate does not match"
|
||||
" * fingerprints ... A list of certificate hashes that are accepted unconditionally for a "
|
||||
"connection" },
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
{ "cert-deny", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL,
|
||||
"[deprecated, use /cert:deny] Automatically abort connection for any certificate that can "
|
||||
"not be validated." },
|
||||
@ -98,6 +99,7 @@ static const COMMAND_LINE_ARGUMENT_A args[] = {
|
||||
"[deprecated, use /cert:name:<name>] Certificate name" },
|
||||
{ "cert-tofu", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL,
|
||||
"[deprecated, use /cert:tofu] Automatically accept certificate on first connect" },
|
||||
#endif
|
||||
{ "client-build-number", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL,
|
||||
"Client Build Number sent to server (influences smartcard behaviour, see [MS-RDPESC])" },
|
||||
{ "client-hostname", COMMAND_LINE_VALUE_REQUIRED, "<name>", NULL, NULL, -1, NULL,
|
||||
@ -163,9 +165,11 @@ static const COMMAND_LINE_ARGUMENT_A args[] = {
|
||||
#ifdef WITH_GFX_H264
|
||||
{ "gfx", COMMAND_LINE_VALUE_OPTIONAL, "[[RFX|AVC420|AVC444],mask:<value>]", NULL, NULL, -1,
|
||||
NULL, "RDP8 graphics pipeline" },
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
{ "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL,
|
||||
"[[AVC420|AVC444],mask:<value>] [DEPRECATED] use /gfx:avc420 instead", NULL, NULL, -1, NULL,
|
||||
"RDP8.1 graphics pipeline using H264 codec" },
|
||||
#endif
|
||||
#else
|
||||
{ "gfx", COMMAND_LINE_VALUE_OPTIONAL, "RFX", NULL, NULL, -1, NULL, "RDP8 graphics pipeline" },
|
||||
#endif
|
||||
@ -180,8 +184,8 @@ static const COMMAND_LINE_ARGUMENT_A args[] = {
|
||||
{ "gp", COMMAND_LINE_VALUE_REQUIRED, "<password>", NULL, NULL, -1, NULL, "Gateway password" },
|
||||
{ "grab-keyboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL,
|
||||
"Grab keyboard" },
|
||||
{ "gt", COMMAND_LINE_VALUE_REQUIRED, "[rpc|http|auto]", NULL, NULL, -1, NULL,
|
||||
"Gateway transport type" },
|
||||
{ "gt", COMMAND_LINE_VALUE_REQUIRED, "[rpc|http[,no-websockets]|auto[,no-websockets]]", NULL,
|
||||
NULL, -1, NULL, "Gateway transport type" },
|
||||
{ "gu", COMMAND_LINE_VALUE_REQUIRED, "[[<domain>\\]<user>|<user>[@<domain>]]", NULL, NULL, -1,
|
||||
NULL, "Gateway username" },
|
||||
{ "gat", COMMAND_LINE_VALUE_REQUIRED, "<access token>", NULL, NULL, -1, NULL,
|
||||
|
||||
@ -23,8 +23,12 @@
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
|
||||
FREERDP_LOCAL int freerdp_detect_old_command_line_syntax(int argc, char** argv, size_t* count);
|
||||
FREERDP_LOCAL int freerdp_client_parse_old_command_line_arguments(int argc, char** argv,
|
||||
rdpSettings* settings);
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
FREERDP_LOCAL WINPR_DEPRECATED(int freerdp_detect_old_command_line_syntax(int argc, char** argv,
|
||||
size_t* count));
|
||||
FREERDP_LOCAL
|
||||
WINPR_DEPRECATED(int freerdp_client_parse_old_command_line_arguments(int argc, char** argv,
|
||||
rdpSettings* settings));
|
||||
#endif
|
||||
|
||||
#endif /* FREERDP_CLIENT_COMMON_COMPATIBILITY_H */
|
||||
|
||||
@ -24,6 +24,8 @@
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <winpr/file.h>
|
||||
|
||||
#include <freerdp/client/file.h>
|
||||
#include <freerdp/client/cmdline.h>
|
||||
|
||||
@ -791,7 +793,7 @@ BOOL freerdp_client_parse_rdp_file_ex(rdpFile* file, const char* name, rdp_file_
|
||||
FILE* fp = NULL;
|
||||
size_t read_size;
|
||||
INT64 file_size;
|
||||
fp = fopen(name, "r");
|
||||
fp = winpr_fopen(name, "r");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
@ -944,7 +946,7 @@ BOOL freerdp_client_write_rdp_file(const rdpFile* file, const char* name, BOOL u
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fp = fopen(name, "w+b");
|
||||
fp = winpr_fopen(name, "w+b");
|
||||
|
||||
if (fp)
|
||||
{
|
||||
|
||||
@ -420,11 +420,11 @@ int TestClientRdpFile(int argc, char* argv[])
|
||||
rc = 0;
|
||||
fail:
|
||||
if (utfname)
|
||||
DeleteFileA(utfname);
|
||||
winpr_DeleteFile(utfname);
|
||||
if (uniname)
|
||||
DeleteFileA(uniname);
|
||||
winpr_DeleteFile(uniname);
|
||||
if (base)
|
||||
RemoveDirectoryA(base);
|
||||
winpr_RemoveDirectory(base);
|
||||
free(utfname);
|
||||
free(uniname);
|
||||
free(base);
|
||||
|
||||
@ -114,23 +114,23 @@ option(WITH_DEBUG_CLIPRDR "Print clipboard redirection debug messages" ${DEFAULT
|
||||
option(WITH_DEBUG_RDPGFX "Print RDPGFX debug messages" ${DEFAULT_DEBUG_OPTION})
|
||||
option(WITH_DEBUG_DVC "Print dynamic virtual channel debug messages." ${DEFAULT_DEBUG_OPTION})
|
||||
CMAKE_DEPENDENT_OPTION(WITH_DEBUG_TSMF "Print TSMF virtual channel debug messages." ${DEFAULT_DEBUG_OPTION} "CHANNEL_TSMF" OFF)
|
||||
option(WITH_DEBUG_KBD "Print keyboard related debug messages." ${DEFAULT_DEBUG_OPTION})
|
||||
option(WITH_DEBUG_KBD "Print keyboard related debug messages." OFF)
|
||||
if(WITH_DEBUG_KBD)
|
||||
message(WARNING "WITH_DEBUG_KBD=ON, the build might leak sensitive information, do not use with release builds!")
|
||||
endif()
|
||||
option(WITH_DEBUG_LICENSE "Print license debug messages." ${DEFAULT_DEBUG_OPTION})
|
||||
option(WITH_DEBUG_LICENSE "Print license debug messages." OFF)
|
||||
if(WITH_DEBUG_LICENSE)
|
||||
message(WARNING "WITH_DEBUG_LICENSE=ON, the build might leak sensitive information, do not use with release builds!")
|
||||
endif()
|
||||
option(WITH_DEBUG_NEGO "Print negotiation related debug messages." ${DEFAULT_DEBUG_OPTION})
|
||||
option(WITH_DEBUG_NEGO "Print negotiation related debug messages." OFF)
|
||||
if(WITH_DEBUG_NEGO)
|
||||
message(WARNING "WITH_DEBUG_NEGO=ON, the build might leak sensitive information, do not use with release builds!")
|
||||
endif()
|
||||
option(WITH_DEBUG_NLA "Print authentication related debug messages." ${DEFAULT_DEBUG_OPTION})
|
||||
option(WITH_DEBUG_NLA "Print authentication related debug messages." OFF)
|
||||
if(WITH_DEBUG_NLA)
|
||||
message(WARNING "WITH_DEBUG_NLA=ON, the build might leak sensitive information, do not use with release builds!")
|
||||
endif()
|
||||
option(WITH_DEBUG_NTLM "Print NTLM debug messages" ${DEFAULT_DEBUG_OPTION})
|
||||
option(WITH_DEBUG_NTLM "Print NTLM debug messages" OFF)
|
||||
if(WITH_DEBUG_NTLM)
|
||||
message(WARNING "WITH_DEBUG_NTLM=ON, the build might leak sensitive information, do not use with release builds!")
|
||||
endif()
|
||||
@ -164,7 +164,7 @@ option(WITH_GSSAPI "Compile support for kerberos authentication. (EXPERIMENTAL)"
|
||||
option(WITH_DSP_EXPERIMENTAL "Enable experimental sound encoder/decoder formats" OFF)
|
||||
if (WITH_FFMPEG)
|
||||
option(WITH_DSP_FFMPEG "Use FFMPEG for audio encoding/decoding" OFF)
|
||||
option(WITH_VAAPI "Use FFMPEG VAAPI" OFF)
|
||||
option(WITH_VAAPI "Use FFMPEG VAAPI (EXPERIMENTAL)" OFF)
|
||||
endif(WITH_FFMPEG)
|
||||
|
||||
option(USE_VERSION_FROM_GIT_TAG "Extract FreeRDP version from git tag." OFF)
|
||||
@ -172,6 +172,8 @@ option(USE_VERSION_FROM_GIT_TAG "Extract FreeRDP version from git tag." OFF)
|
||||
option(WITH_CAIRO "Use CAIRO image library for screen resizing" OFF)
|
||||
option(WITH_SWSCALE "Use SWScale image library for screen resizing" OFF)
|
||||
|
||||
option(DEFINE_NO_DEPRECATED "Compile without legacy functions and symbols" OFF)
|
||||
|
||||
if (ANDROID)
|
||||
include(ConfigOptionsAndroid)
|
||||
endif(ANDROID)
|
||||
|
||||
@ -38,8 +38,10 @@ enum
|
||||
};
|
||||
|
||||
/* Client Ready Flags */
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
#define READY_FLAGS_SHOW_TOUCH_VISUALS 0x00000001 /* Deprecated */
|
||||
#define READY_FLAGS_DISABLE_TIMESTAMP_INJECTION 0x00000002 /* Deprecated */
|
||||
#endif
|
||||
|
||||
#define CS_READY_FLAGS_SHOW_TOUCH_VISUALS 0x00000001
|
||||
#define CS_READY_FLAGS_DISABLE_TIMESTAMP_INJECTION 0x00000002
|
||||
|
||||
@ -104,21 +104,21 @@ extern "C"
|
||||
char** domain);
|
||||
FREERDP_API BOOL client_cli_gw_authenticate(freerdp* instance, char** username, char** password,
|
||||
char** domain);
|
||||
|
||||
FREERDP_API DWORD client_cli_verify_certificate(freerdp* instance, const char* common_name,
|
||||
const char* subject, const char* issuer,
|
||||
const char* fingerprint, BOOL host_mismatch);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
FREERDP_API WINPR_DEPRECATED(DWORD client_cli_verify_certificate(
|
||||
freerdp* instance, const char* common_name, const char* subject, const char* issuer,
|
||||
const char* fingerprint, BOOL host_mismatch));
|
||||
#endif
|
||||
FREERDP_API DWORD client_cli_verify_certificate_ex(freerdp* instance, const char* host,
|
||||
UINT16 port, const char* common_name,
|
||||
const char* subject, const char* issuer,
|
||||
const char* fingerprint, DWORD flags);
|
||||
|
||||
FREERDP_API DWORD client_cli_verify_changed_certificate(
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
FREERDP_API WINPR_DEPRECATED(DWORD client_cli_verify_changed_certificate(
|
||||
freerdp* instance, const char* common_name, const char* subject, const char* issuer,
|
||||
const char* fingerprint, const char* old_subject, const char* old_issuer,
|
||||
const char* old_fingerprint);
|
||||
|
||||
const char* old_fingerprint));
|
||||
#endif
|
||||
FREERDP_API DWORD client_cli_verify_changed_certificate_ex(
|
||||
freerdp* instance, const char* host, UINT16 port, const char* common_name,
|
||||
const char* subject, const char* issuer, const char* fingerprint, const char* old_subject,
|
||||
|
||||
@ -52,7 +52,9 @@ struct rdpsnd_device_plugin
|
||||
pcGetVolume GetVolume;
|
||||
pcSetVolume SetVolume;
|
||||
pcPlay Play;
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
pcStart Start; /* Deprecated, unused. */
|
||||
#endif
|
||||
pcClose Close;
|
||||
pcFree Free;
|
||||
pcDefaultFormat DefaultFormat;
|
||||
|
||||
@ -44,8 +44,11 @@ extern "C"
|
||||
|
||||
typedef struct _NSC_CONTEXT NSC_CONTEXT;
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
FREERDP_API WINPR_DEPRECATED(BOOL nsc_context_set_pixel_format(NSC_CONTEXT* context,
|
||||
UINT32 pixel_format));
|
||||
#endif
|
||||
|
||||
FREERDP_API BOOL nsc_context_set_parameters(NSC_CONTEXT* context, NSC_PARAMETER what,
|
||||
UINT32 value);
|
||||
|
||||
|
||||
@ -37,20 +37,23 @@ extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
FREERDP_API WINPR_DEPRECATED(int progressive_compress(PROGRESSIVE_CONTEXT* progressive,
|
||||
const BYTE* pSrcData, UINT32 SrcSize,
|
||||
BYTE** ppDstData, UINT32* pDstSize));
|
||||
#endif
|
||||
|
||||
FREERDP_API int progressive_compress_ex(PROGRESSIVE_CONTEXT* progressive, const BYTE* pSrcData,
|
||||
UINT32 SrcSize, UINT32 SrcFormat, UINT32 Width,
|
||||
UINT32 Height, UINT32 ScanLine,
|
||||
const REGION16* invalidRegion, BYTE** ppDstData,
|
||||
UINT32* pDstSize);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
FREERDP_API WINPR_DEPRECATED(INT32 progressive_decompress(
|
||||
PROGRESSIVE_CONTEXT* progressive, const BYTE* pSrcData, UINT32 SrcSize, BYTE* pDstData,
|
||||
UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst, REGION16* invalidRegion,
|
||||
UINT16 surfaceId));
|
||||
#endif
|
||||
|
||||
FREERDP_API INT32 progressive_decompress_ex(PROGRESSIVE_CONTEXT* progressive,
|
||||
const BYTE* pSrcData, UINT32 SrcSize,
|
||||
|
||||
@ -190,9 +190,11 @@ extern "C"
|
||||
size_t numRects, const BYTE* data, UINT32 width,
|
||||
UINT32 height, size_t scanline);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
FREERDP_API WINPR_DEPRECATED(RFX_MESSAGE* rfx_encode_messages(
|
||||
RFX_CONTEXT* context, const RFX_RECT* rects, int numRects, const BYTE* data, int width,
|
||||
int height, int scanline, int* numMessages, int maxDataSize));
|
||||
#endif
|
||||
|
||||
FREERDP_API RFX_MESSAGE* rfx_encode_messages_ex(RFX_CONTEXT* context, const RFX_RECT* rects,
|
||||
size_t numRects, const BYTE* data, UINT32 width,
|
||||
|
||||
@ -67,6 +67,7 @@ extern "C"
|
||||
FREERDP_API void crypto_cert_print_info(X509* xcert);
|
||||
FREERDP_API void crypto_cert_free(CryptoCert cert);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/*
|
||||
Deprecated function names: crypto_cert_subject_alt_name and crypto_cert_subject_alt_name_free.
|
||||
Use crypto_cert_get_dns_names and crypto_cert_dns_names_free instead.
|
||||
@ -74,8 +75,11 @@ extern "C"
|
||||
Note: email and upn amongst others are also alt_names,
|
||||
but the old crypto_cert_get_alt_names returned only the dns_names
|
||||
*/
|
||||
FREERDP_API char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths);
|
||||
FREERDP_API void crypto_cert_subject_alt_name_free(int count, int* lengths, char** alt_names);
|
||||
FREERDP_API WINPR_DEPRECATED(char** crypto_cert_subject_alt_name(X509* xcert, int* count,
|
||||
int** lengths));
|
||||
FREERDP_API WINPR_DEPRECATED(void crypto_cert_subject_alt_name_free(int count, int* lengths,
|
||||
char** alt_names));
|
||||
#endif
|
||||
|
||||
FREERDP_API BOOL x509_verify_certificate(CryptoCert cert, const char* certificate_store_path);
|
||||
FREERDP_API rdpCertificateData* crypto_get_certificate_data(X509* xcert, const char* hostname,
|
||||
|
||||
@ -177,6 +177,33 @@ extern "C"
|
||||
FREERDP_API const char* freerdp_get_error_info_name(UINT32 code);
|
||||
FREERDP_API const char* freerdp_get_error_info_category(UINT32 code);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/**
|
||||
* DEPRECATED!
|
||||
* This static variable holds an error code if the return value from connect is FALSE.
|
||||
* This variable is always set to 0 in the beginning of the connect sequence.
|
||||
* The returned code can be used to inform the user of the detailed connect error.
|
||||
* The value can hold one of the defined error codes below OR an error according to errno
|
||||
*/
|
||||
|
||||
FREERDP_API WINPR_DEPRECATED(extern int connectErrorCode);
|
||||
|
||||
#define ERRORSTART 10000
|
||||
#define PREECONNECTERROR ERRORSTART + 1
|
||||
#define UNDEFINEDCONNECTERROR ERRORSTART + 2
|
||||
#define POSTCONNECTERROR ERRORSTART + 3
|
||||
#define DNSERROR ERRORSTART + 4 /* general DNS ERROR */
|
||||
#define DNSNAMENOTFOUND ERRORSTART + 5 /* EAI_NONAME */
|
||||
#define CONNECTERROR \
|
||||
ERRORSTART + 6 /* a connect error if errno is not define during tcp connect \
|
||||
*/
|
||||
#define MCSCONNECTINITIALERROR ERRORSTART + 7
|
||||
#define TLSCONNECTERROR ERRORSTART + 8
|
||||
#define AUTHENTICATIONERROR ERRORSTART + 9
|
||||
#define INSUFFICIENTPRIVILEGESERROR ERRORSTART + 10
|
||||
#define CANCELEDBYUSER ERRORSTART + 11
|
||||
#endif
|
||||
|
||||
/**
|
||||
* FreeRDP Context Error Codes
|
||||
*/
|
||||
|
||||
@ -83,6 +83,7 @@ extern "C"
|
||||
typedef BOOL (*pAuthenticate)(freerdp* instance, char** username, char** password,
|
||||
char** domain);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/** @brief Callback used if user interaction is required to accept
|
||||
* an unknown certificate.
|
||||
*
|
||||
@ -100,7 +101,7 @@ extern "C"
|
||||
typedef DWORD (*pVerifyCertificate)(freerdp* instance, const char* common_name,
|
||||
const char* subject, const char* issuer,
|
||||
const char* fingerprint, BOOL host_mismatch);
|
||||
|
||||
#endif
|
||||
/** @brief Callback used if user interaction is required to accept
|
||||
* an unknown certificate.
|
||||
*
|
||||
@ -119,6 +120,7 @@ extern "C"
|
||||
const char* common_name, const char* subject,
|
||||
const char* issuer, const char* fingerprint, DWORD flags);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/** @brief Callback used if user interaction is required to accept
|
||||
* a changed certificate.
|
||||
*
|
||||
@ -139,6 +141,7 @@ extern "C"
|
||||
const char* subject, const char* issuer,
|
||||
const char* new_fingerprint, const char* old_subject,
|
||||
const char* old_issuer, const char* old_fingerprint);
|
||||
#endif
|
||||
|
||||
/** @brief Callback used if user interaction is required to accept
|
||||
* a changed certificate.
|
||||
@ -361,14 +364,17 @@ extern "C"
|
||||
Callback for authentication.
|
||||
It is used to get the username/password when it was not
|
||||
provided at connection time. */
|
||||
ALIGN64 pVerifyCertificate VerifyCertificate; /**< (offset 51)
|
||||
Callback for certificate validation.
|
||||
Used to verify that an unknown certificate is
|
||||
trusted. DEPRECATED: Use VerifyChangedCertificateEx*/
|
||||
ALIGN64 pVerifyChangedCertificate VerifyChangedCertificate; /**< (offset 52)
|
||||
Callback for changed certificate
|
||||
validation. Used when a certificate differs from stored fingerprint.
|
||||
DEPRECATED: Use VerifyChangedCertificateEx */
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
WINPR_DEPRECATED(ALIGN64 pVerifyCertificate VerifyCertificate); /**< (offset 51)
|
||||
Callback for certificate validation.
|
||||
Used to verify that an unknown certificate is
|
||||
trusted. DEPRECATED: Use VerifyChangedCertificateEx*/
|
||||
WINPR_DEPRECATED(
|
||||
ALIGN64 pVerifyChangedCertificate VerifyChangedCertificate); /**< (offset 52)
|
||||
Callback for changed certificate
|
||||
validation. Used when a certificate differs from stored fingerprint.
|
||||
DEPRECATED: Use VerifyChangedCertificateEx */
|
||||
#endif
|
||||
|
||||
ALIGN64 pVerifyX509Certificate
|
||||
VerifyX509Certificate; /**< (offset 53) Callback for X509 certificate verification (PEM
|
||||
|
||||
@ -517,7 +517,9 @@ struct rdp_gdi
|
||||
void (*free)(void*);
|
||||
|
||||
BOOL inGfxFrame;
|
||||
BOOL graphicsReset; /* deprecated, remove with FreeRDP v3 */
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
WINPR_DEPRECATED(BOOL graphicsReset); /* deprecated, remove with FreeRDP v3 */
|
||||
#endif
|
||||
BOOL suppressOutput;
|
||||
UINT16 outputSurfaceId;
|
||||
RdpgfxClientContext* gfx;
|
||||
|
||||
@ -28,11 +28,13 @@
|
||||
|
||||
#define RAIL_SVC_CHANNEL_NAME "rail"
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/* DEPRECATED: RAIL PDU flags use the spec conformant naming with TS_ prefix */
|
||||
#define RAIL_EXEC_FLAG_EXPAND_WORKINGDIRECTORY 0x0001
|
||||
#define RAIL_EXEC_FLAG_TRANSLATE_FILES 0x0002
|
||||
#define RAIL_EXEC_FLAG_FILE 0x0004
|
||||
#define RAIL_EXEC_FLAG_EXPAND_ARGUMENTS 0x0008
|
||||
#endif
|
||||
|
||||
/* RAIL PDU flags */
|
||||
#define TS_RAIL_EXEC_FLAG_EXPAND_WORKINGDIRECTORY 0x0001
|
||||
@ -124,11 +126,13 @@ enum SPI_MASK
|
||||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/* DEPRECATED: Client Information PDU
|
||||
* use the spec conformant naming scheme TS_ below
|
||||
*/
|
||||
#define RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE 0x00000001
|
||||
#define RAIL_CLIENTSTATUS_AUTORECONNECT 0x00000002
|
||||
#endif
|
||||
|
||||
/* Client Information PDU */
|
||||
#define TS_RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE 0x00000001
|
||||
@ -167,12 +171,14 @@ enum SPI_MASK
|
||||
#define TF_SFT_NOEXTRAICONSONMINIMIZED 0x00000400
|
||||
#define TF_SFT_DESKBAND 0x00000800
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/* DEPRECATED: Extended Handshake Flags
|
||||
* use the spec conformant naming scheme TS_ below
|
||||
*/
|
||||
#define RAIL_ORDER_HANDSHAKEEX_FLAGS_HIDEF 0x00000001
|
||||
#define RAIL_ORDER_HANDSHAKE_EX_FLAGS_EXTENDED_SPI_SUPPORTED 0x00000002
|
||||
#define RAIL_ORDER_HANDSHAKE_EX_FLAGS_SNAP_ARRANGE_SUPPORTED 0x00000004
|
||||
#endif
|
||||
|
||||
/* Extended Handshake Flags */
|
||||
#define TS_RAIL_ORDER_HANDSHAKEEX_FLAGS_HIDEF 0x00000001
|
||||
@ -521,6 +527,7 @@ struct _RAIL_GET_APPID_RESP_EX
|
||||
};
|
||||
typedef struct _RAIL_GET_APPID_RESP_EX RAIL_GET_APPID_RESP_EX;
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/* DEPRECATED: RAIL Constants
|
||||
* use the spec conformant naming scheme TS_ below
|
||||
*/
|
||||
@ -548,6 +555,7 @@ typedef struct _RAIL_GET_APPID_RESP_EX RAIL_GET_APPID_RESP_EX;
|
||||
#define RDP_RAIL_ORDER_POWER_DISPLAY_REQUEST 0x0016
|
||||
#define RDP_RAIL_ORDER_SNAP_ARRANGE 0x0017
|
||||
#define RDP_RAIL_ORDER_GET_APPID_RESP_EX 0x0018
|
||||
#endif
|
||||
|
||||
/* RAIL Constants */
|
||||
|
||||
|
||||
@ -61,8 +61,10 @@ extern "C"
|
||||
FREERDP_API UINT rdpei_server_init(RdpeiServerContext* context);
|
||||
FREERDP_API UINT rdpei_server_handle_messages(RdpeiServerContext* context);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
FREERDP_API WINPR_DEPRECATED(UINT rdpei_server_send_sc_ready(RdpeiServerContext* context,
|
||||
UINT32 version));
|
||||
#endif
|
||||
|
||||
FREERDP_API UINT rdpei_server_send_sc_ready_ex(RdpeiServerContext* context, UINT32 version,
|
||||
UINT32 features);
|
||||
|
||||
@ -120,7 +120,9 @@ typedef enum
|
||||
#define RNS_UD_CS_STRONG_ASYMMETRIC_KEYS 0x0008
|
||||
#define RNS_UD_CS_VALID_CONNECTION_TYPE 0x0020
|
||||
#define RNS_UD_CS_SUPPORT_MONITOR_LAYOUT_PDU 0x0040
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
#define RNS_UD_CS_SUPPORT_NETWORK_AUTODETECT 0x0080 /* DEPRECATED: Compatibility define */
|
||||
#endif
|
||||
#define RNS_UD_CS_SUPPORT_NETCHAR_AUTODETECT 0x0080
|
||||
#define RNS_UD_CS_SUPPORT_DYNVC_GFX_PROTOCOL 0x0100
|
||||
#define RNS_UD_CS_SUPPORT_DYNAMIC_TIME_ZONE 0x0200
|
||||
@ -751,6 +753,7 @@ typedef struct _RDPDR_PARALLEL RDPDR_PARALLEL;
|
||||
#define FreeRDP_GatewayAccessToken (1997)
|
||||
#define FreeRDP_GatewayAcceptedCert (1998)
|
||||
#define FreeRDP_GatewayAcceptedCertLength (1999)
|
||||
#define FreeRDP_GatewayHttpUseWebsockets (2000)
|
||||
#define FreeRDP_ProxyType (2015)
|
||||
#define FreeRDP_ProxyHostname (2016)
|
||||
#define FreeRDP_ProxyPort (2017)
|
||||
@ -1252,7 +1255,8 @@ struct rdp_settings
|
||||
ALIGN64 char* GatewayAccessToken; /* 1997 */
|
||||
ALIGN64 char* GatewayAcceptedCert; /* 1998 */
|
||||
ALIGN64 UINT32 GatewayAcceptedCertLength; /* 1999 */
|
||||
UINT64 padding2015[2015 - 2000]; /* 2000 */
|
||||
ALIGN64 BOOL GatewayHttpUseWebsockets; /* 2000 */
|
||||
UINT64 padding2015[2015 - 2001]; /* 2001 */
|
||||
|
||||
/* Proxy */
|
||||
ALIGN64 UINT32 ProxyType; /* 2015 */
|
||||
@ -1634,6 +1638,7 @@ extern "C"
|
||||
UINT32 GatewayEnabled,
|
||||
UINT32 GatewayBypassLocal);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/* DEPRECATED:
|
||||
* the functions freerdp_get_param_* and freerdp_set_param_* are deprecated.
|
||||
* use freerdp_settings_get_* and freerdp_settings_set_* as a replacement!
|
||||
@ -1660,6 +1665,7 @@ extern "C"
|
||||
int id));
|
||||
FREERDP_API WINPR_DEPRECATED(int freerdp_set_param_string(rdpSettings* settings, int id,
|
||||
const char* param));
|
||||
#endif
|
||||
|
||||
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id);
|
||||
FREERDP_API BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL param);
|
||||
|
||||
@ -566,7 +566,7 @@ static BOOL resize_vbar_entry(CLEAR_CONTEXT* clear, CLEAR_VBAR_ENTRY* vBarEntry)
|
||||
const UINT32 diffSize = (vBarEntry->count - vBarEntry->size) * bpp;
|
||||
BYTE* tmp;
|
||||
vBarEntry->size = vBarEntry->count;
|
||||
tmp = (BYTE*)realloc(vBarEntry->pixels, vBarEntry->count * bpp);
|
||||
tmp = (BYTE*)realloc(vBarEntry->pixels, vBarEntry->count * bpp * 1ULL);
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
@ -980,7 +980,7 @@ static BOOL clear_decompress_glyph_data(CLEAR_CONTEXT* clear, wStream* s, UINT32
|
||||
if (glyphEntry->count > glyphEntry->size)
|
||||
{
|
||||
BYTE* tmp;
|
||||
tmp = realloc(glyphEntry->pixels, glyphEntry->count * bpp);
|
||||
tmp = realloc(glyphEntry->pixels, glyphEntry->count * bpp * 1ULL);
|
||||
|
||||
if (!tmp)
|
||||
{
|
||||
|
||||
@ -56,7 +56,7 @@ BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height, const BYTE* data)
|
||||
* means of accessing individual pixels in blitting operations
|
||||
*/
|
||||
scanline = (width + 7) / 8;
|
||||
dstData = (BYTE*)_aligned_malloc(width * height, 16);
|
||||
dstData = (BYTE*)_aligned_malloc(width * height * 1ULL, 16);
|
||||
|
||||
if (!dstData)
|
||||
return NULL;
|
||||
@ -545,7 +545,7 @@ BOOL freerdp_image_copy_from_pointer_data(BYTE* pDstData, UINT32 DstFormat, UINT
|
||||
for (y = nYDst; y < nHeight; y++)
|
||||
{
|
||||
BYTE* pDstLine = &pDstData[y * nDstStep + nXDst * dstBytesPerPixel];
|
||||
memset(pDstLine, 0, dstBytesPerPixel * (nWidth - nXDst));
|
||||
memset(pDstLine, 0, dstBytesPerPixel * (nWidth - nXDst) * 1ULL);
|
||||
}
|
||||
|
||||
switch (xorBpp)
|
||||
@ -742,7 +742,7 @@ BOOL freerdp_image_fill(BYTE* pDstData, DWORD DstFormat, UINT32 nDstStep, UINT32
|
||||
for (y = 1; y < nHeight; y++)
|
||||
{
|
||||
BYTE* pDstLine = &pDstData[(y + nYDst) * nDstStep + nXDst * bpp];
|
||||
memcpy(pDstLine, pFirstDstLineXOffset, nWidth * bpp);
|
||||
memcpy(pDstLine, pFirstDstLineXOffset, nWidth * bpp * 1ULL);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
@ -63,9 +63,9 @@ BOOL avc420_ensure_buffer(H264_CONTEXT* h264, UINT32 stride, UINT32 width, UINT3
|
||||
_aligned_free(h264->pYUVData[0]);
|
||||
_aligned_free(h264->pYUVData[1]);
|
||||
_aligned_free(h264->pYUVData[2]);
|
||||
h264->pYUVData[0] = _aligned_malloc(h264->iStride[0] * height, 16);
|
||||
h264->pYUVData[1] = _aligned_malloc(h264->iStride[1] * height, 16);
|
||||
h264->pYUVData[2] = _aligned_malloc(h264->iStride[2] * height, 16);
|
||||
h264->pYUVData[0] = _aligned_malloc(h264->iStride[0] * height * 1ULL, 16);
|
||||
h264->pYUVData[1] = _aligned_malloc(h264->iStride[1] * height * 1ULL, 16);
|
||||
h264->pYUVData[2] = _aligned_malloc(h264->iStride[2] * height * 1ULL, 16);
|
||||
|
||||
if (!h264->pYUVData[0] || !h264->pYUVData[1] || !h264->pYUVData[2])
|
||||
return FALSE;
|
||||
|
||||
@ -506,7 +506,10 @@ static BOOL libavcodec_init(H264_CONTEXT* h264)
|
||||
}
|
||||
|
||||
h264->pSystemData = (void*)sys;
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 137, 100)
|
||||
avcodec_register_all();
|
||||
#endif
|
||||
|
||||
if (!h264->Compressor)
|
||||
{
|
||||
|
||||
@ -273,8 +273,7 @@ static BOOL nsc_encode_argb_to_aycocg(NSC_CONTEXT* context, const BYTE* data, UI
|
||||
|
||||
static BOOL nsc_encode_subsampling(NSC_CONTEXT* context)
|
||||
{
|
||||
UINT16 x;
|
||||
UINT16 y;
|
||||
UINT32 y;
|
||||
UINT32 tempWidth;
|
||||
UINT32 tempHeight;
|
||||
|
||||
@ -292,6 +291,7 @@ static BOOL nsc_encode_subsampling(NSC_CONTEXT* context)
|
||||
|
||||
for (y = 0; y<tempHeight>> 1; y++)
|
||||
{
|
||||
UINT32 x;
|
||||
BYTE* co_dst = context->priv->PlaneBuffers[1] + y * (tempWidth >> 1);
|
||||
BYTE* cg_dst = context->priv->PlaneBuffers[2] + y * (tempWidth >> 1);
|
||||
const INT8* co_src0 = (INT8*)context->priv->PlaneBuffers[1] + (y << 1) * tempWidth;
|
||||
|
||||
@ -320,8 +320,7 @@ static BOOL nsc_encode_argb_to_aycocg_sse2(NSC_CONTEXT* context, const BYTE* dat
|
||||
|
||||
static void nsc_encode_subsampling_sse2(NSC_CONTEXT* context)
|
||||
{
|
||||
UINT16 x;
|
||||
UINT16 y;
|
||||
UINT32 y;
|
||||
BYTE* co_dst;
|
||||
BYTE* cg_dst;
|
||||
INT8* co_src0;
|
||||
@ -338,6 +337,7 @@ static void nsc_encode_subsampling_sse2(NSC_CONTEXT* context)
|
||||
|
||||
for (y = 0; y<tempHeight>> 1; y++)
|
||||
{
|
||||
UINT32 x;
|
||||
co_dst = context->priv->PlaneBuffers[1] + y * (tempWidth >> 1);
|
||||
cg_dst = context->priv->PlaneBuffers[2] + y * (tempWidth >> 1);
|
||||
co_src0 = (INT8*)context->priv->PlaneBuffers[1] + (y << 1) * tempWidth;
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
|
||||
#define TAG FREERDP_TAG("codec")
|
||||
|
||||
#define ALIGN(val, align) ((val) % (align) == 0) ? (val) : ((val) + (align) - (val) % (align))
|
||||
|
||||
static INLINE UINT32 planar_invert_format(BITMAP_PLANAR_CONTEXT* planar, BOOL alpha,
|
||||
UINT32 DstFormat)
|
||||
{
|
||||
@ -508,7 +510,7 @@ static INLINE BOOL writeLine(BYTE** ppRgba, UINT32 DstFormat, UINT32 width, cons
|
||||
static INLINE BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4], BYTE* pDstData,
|
||||
UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,
|
||||
UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
|
||||
BOOL vFlip)
|
||||
BOOL vFlip, UINT32 totalHeight)
|
||||
{
|
||||
INT32 y;
|
||||
INT32 beg, end, inc;
|
||||
@ -516,6 +518,7 @@ static INLINE BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4], BYTE* p
|
||||
const BYTE* pG = pSrcData[1];
|
||||
const BYTE* pB = pSrcData[2];
|
||||
const BYTE* pA = pSrcData[3];
|
||||
const UINT32 bpp = GetBytesPerPixel(DstFormat);
|
||||
|
||||
if (vFlip)
|
||||
{
|
||||
@ -530,9 +533,20 @@ static INLINE BOOL planar_decompress_planes_raw(const BYTE* pSrcData[4], BYTE* p
|
||||
inc = 1;
|
||||
}
|
||||
|
||||
if (nYDst + nHeight > totalHeight)
|
||||
return FALSE;
|
||||
|
||||
if ((nXDst + nWidth) * bpp > nDstStep)
|
||||
return FALSE;
|
||||
|
||||
for (y = beg; y != end; y += inc)
|
||||
{
|
||||
BYTE* pRGB = &pDstData[((nYDst + y) * nDstStep) + (nXDst * GetBytesPerPixel(DstFormat))];
|
||||
BYTE* pRGB;
|
||||
|
||||
if (y > (INT64)nHeight)
|
||||
return FALSE;
|
||||
|
||||
pRGB = &pDstData[((nYDst + y) * nDstStep) + (nXDst * bpp)];
|
||||
|
||||
if (!writeLine(&pRGB, DstFormat, nWidth, &pR, &pG, &pB, &pA))
|
||||
return FALSE;
|
||||
@ -739,6 +753,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar, const BYTE* pSrcData, UINT
|
||||
UINT32 TempFormat;
|
||||
BYTE* pTempData = pDstData;
|
||||
UINT32 nTempStep = nDstStep;
|
||||
UINT32 nTotalHeight = nYDst + nDstHeight;
|
||||
|
||||
if (useAlpha)
|
||||
TempFormat = PIXEL_FORMAT_BGRA32;
|
||||
@ -749,12 +764,13 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar, const BYTE* pSrcData, UINT
|
||||
{
|
||||
pTempData = planar->pTempData;
|
||||
nTempStep = planar->nTempStep;
|
||||
nTotalHeight = planar->maxHeight;
|
||||
}
|
||||
|
||||
if (!rle) /* RAW */
|
||||
{
|
||||
if (!planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep, nXDst,
|
||||
nYDst, nSrcWidth, nSrcHeight, vFlip))
|
||||
nYDst, nSrcWidth, nSrcHeight, vFlip, nTotalHeight))
|
||||
return FALSE;
|
||||
|
||||
if (alpha)
|
||||
@ -819,6 +835,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar, const BYTE* pSrcData, UINT
|
||||
UINT32 TempFormat;
|
||||
BYTE* pTempData = planar->pTempData;
|
||||
UINT32 nTempStep = planar->nTempStep;
|
||||
UINT32 nTotalHeight = planar->maxHeight;
|
||||
|
||||
if (useAlpha)
|
||||
TempFormat = PIXEL_FORMAT_BGRA32;
|
||||
@ -901,7 +918,7 @@ BOOL planar_decompress(BITMAP_PLANAR_CONTEXT* planar, const BYTE* pSrcData, UINT
|
||||
}
|
||||
|
||||
if (!planar_decompress_planes_raw(planes, pTempData, TempFormat, nTempStep, nXDst,
|
||||
nYDst, nSrcWidth, nSrcHeight, vFlip))
|
||||
nYDst, nSrcWidth, nSrcHeight, vFlip, nTotalHeight))
|
||||
return FALSE;
|
||||
|
||||
if (alpha)
|
||||
@ -1467,8 +1484,8 @@ BOOL freerdp_bitmap_planar_context_reset(BITMAP_PLANAR_CONTEXT* context, UINT32
|
||||
return FALSE;
|
||||
|
||||
context->bgr = FALSE;
|
||||
context->maxWidth = width;
|
||||
context->maxHeight = height;
|
||||
context->maxWidth = ALIGN(width, 4);
|
||||
context->maxHeight = ALIGN(height, 4);
|
||||
context->maxPlaneSize = context->maxWidth * context->maxHeight;
|
||||
context->nTempStep = context->maxWidth * 4;
|
||||
free(context->planesBuffer);
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
#include "rfx_quantization.h"
|
||||
#include "rfx_dwt.h"
|
||||
#include "rfx_rlgr.h"
|
||||
#include "rfx_types.h"
|
||||
#include "progressive.h"
|
||||
|
||||
#define TAG FREERDP_TAG("codec.progressive")
|
||||
@ -411,7 +412,7 @@ static INLINE BOOL progressive_tile_allocate(RFX_PROGRESSIVE_TILE* tile)
|
||||
tile->stride = 4 * tile->width;
|
||||
|
||||
{
|
||||
size_t dataLen = tile->stride * tile->height;
|
||||
size_t dataLen = tile->stride * tile->height * 1ULL;
|
||||
tile->data = (BYTE*)_aligned_malloc(dataLen, 16);
|
||||
}
|
||||
|
||||
@ -454,6 +455,8 @@ static PROGRESSIVE_SURFACE_CONTEXT* progressive_surface_context_new(UINT16 surfa
|
||||
|
||||
if (!surface->tiles || !surface->updatedTileIndices)
|
||||
{
|
||||
free(surface->updatedTileIndices);
|
||||
free(surface->tiles);
|
||||
free(surface);
|
||||
return NULL;
|
||||
}
|
||||
@ -1619,18 +1622,55 @@ static INLINE BOOL progressive_tile_read(PROGRESSIVE_CONTEXT* progressive, BOOL
|
||||
return progressive_surface_tile_replace(surface, region, &tile, FALSE);
|
||||
}
|
||||
|
||||
struct _PROGRESSIVE_TILE_PROCESS_WORK_PARAM
|
||||
{
|
||||
PROGRESSIVE_CONTEXT* progressive;
|
||||
PROGRESSIVE_BLOCK_REGION* region;
|
||||
PROGRESSIVE_BLOCK_CONTEXT* context;
|
||||
RFX_PROGRESSIVE_TILE* tile;
|
||||
};
|
||||
typedef struct _PROGRESSIVE_TILE_PROCESS_WORK_PARAM PROGRESSIVE_TILE_PROCESS_WORK_PARAM;
|
||||
|
||||
static void CALLBACK progressive_process_tiles_tile_work_callback(PTP_CALLBACK_INSTANCE instance,
|
||||
void* context, PTP_WORK work)
|
||||
{
|
||||
PROGRESSIVE_TILE_PROCESS_WORK_PARAM* param = (PROGRESSIVE_TILE_PROCESS_WORK_PARAM*)context;
|
||||
|
||||
switch (param->tile->blockType)
|
||||
{
|
||||
case PROGRESSIVE_WBT_TILE_SIMPLE:
|
||||
case PROGRESSIVE_WBT_TILE_FIRST:
|
||||
progressive_decompress_tile_first(param->progressive, param->tile, param->region,
|
||||
param->context);
|
||||
break;
|
||||
|
||||
case PROGRESSIVE_WBT_TILE_UPGRADE:
|
||||
progressive_decompress_tile_upgrade(param->progressive, param->tile, param->region,
|
||||
param->context);
|
||||
break;
|
||||
default:
|
||||
WLog_Print(param->progressive->log, WLOG_ERROR, "Invalid block type %04 (%s)" PRIx16,
|
||||
param->tile->blockType,
|
||||
progressive_get_block_type_string(param->tile->blockType));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE int progressive_process_tiles(PROGRESSIVE_CONTEXT* progressive, wStream* s,
|
||||
PROGRESSIVE_BLOCK_REGION* region,
|
||||
PROGRESSIVE_SURFACE_CONTEXT* surface,
|
||||
const PROGRESSIVE_BLOCK_CONTEXT* context)
|
||||
{
|
||||
int status = -1;
|
||||
int status = 0;
|
||||
size_t end;
|
||||
const size_t start = Stream_GetPosition(s);
|
||||
UINT16 index;
|
||||
UINT16 blockType;
|
||||
UINT32 blockLen;
|
||||
UINT32 count = 0;
|
||||
PTP_WORK* work_objects = NULL;
|
||||
PROGRESSIVE_TILE_PROCESS_WORK_PARAM* params = NULL;
|
||||
UINT16 close_cnt = 0;
|
||||
|
||||
if (Stream_GetRemainingLength(s) < region->tileDataSize)
|
||||
{
|
||||
@ -1712,24 +1752,46 @@ static INLINE int progressive_process_tiles(PROGRESSIVE_CONTEXT* progressive, wS
|
||||
return -1044;
|
||||
}
|
||||
|
||||
if (progressive->rfx_context->priv->UseThreads)
|
||||
{
|
||||
work_objects = (PTP_WORK*)calloc(region->numTiles, sizeof(PTP_WORK));
|
||||
if (!work_objects)
|
||||
return -1;
|
||||
|
||||
params = (PROGRESSIVE_TILE_PROCESS_WORK_PARAM*)calloc(
|
||||
region->numTiles, sizeof(PROGRESSIVE_TILE_PROCESS_WORK_PARAM));
|
||||
if (!params)
|
||||
{
|
||||
free(work_objects);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
for (index = 0; index < region->numTiles; index++)
|
||||
{
|
||||
RFX_PROGRESSIVE_TILE* tile = region->tiles[index];
|
||||
params[index].progressive = progressive;
|
||||
params[index].region = region;
|
||||
params[index].context = context;
|
||||
params[index].tile = tile;
|
||||
|
||||
switch (tile->blockType)
|
||||
if (progressive->rfx_context->priv->UseThreads)
|
||||
{
|
||||
case PROGRESSIVE_WBT_TILE_SIMPLE:
|
||||
case PROGRESSIVE_WBT_TILE_FIRST:
|
||||
status = progressive_decompress_tile_first(progressive, tile, region, context);
|
||||
if (!(work_objects[index] = CreateThreadpoolWork(
|
||||
progressive_process_tiles_tile_work_callback, (void*)¶ms[index],
|
||||
&progressive->rfx_context->priv->ThreadPoolEnv)))
|
||||
{
|
||||
WLog_ERR(TAG, "CreateThreadpoolWork failed.");
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
case PROGRESSIVE_WBT_TILE_UPGRADE:
|
||||
status = progressive_decompress_tile_upgrade(progressive, tile, region, context);
|
||||
break;
|
||||
default:
|
||||
WLog_Print(progressive->log, WLOG_ERROR, "Invalid block type %04 (%s)" PRIx16,
|
||||
tile->blockType, progressive_get_block_type_string(tile->blockType));
|
||||
return -42;
|
||||
SubmitThreadpoolWork(work_objects[index]);
|
||||
close_cnt = index + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
progressive_process_tiles_tile_work_callback(0, ¶ms[index], 0);
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
@ -1740,6 +1802,25 @@ static INLINE int progressive_process_tiles(PROGRESSIVE_CONTEXT* progressive, wS
|
||||
}
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
WLog_Print(progressive->log, WLOG_ERROR,
|
||||
"Failed to create ThreadpoolWork for tile %" PRIu16, index);
|
||||
|
||||
if (progressive->rfx_context->priv->UseThreads)
|
||||
{
|
||||
for (index = 0; index < close_cnt; index++)
|
||||
{
|
||||
WaitForThreadpoolWorkCallbacks(work_objects[index], FALSE);
|
||||
CloseThreadpoolWork(work_objects[index]);
|
||||
}
|
||||
}
|
||||
|
||||
free(work_objects);
|
||||
free(params);
|
||||
|
||||
if (status < 0)
|
||||
return -1;
|
||||
|
||||
return (int)(end - start);
|
||||
}
|
||||
|
||||
@ -2299,7 +2380,7 @@ INT32 progressive_decompress_ex(PROGRESSIVE_CONTEXT* progressive, const BYTE* pS
|
||||
|
||||
for (i = 0; i < surface->numUpdatedTiles; i++)
|
||||
{
|
||||
UINT32 nbUpdateRects;
|
||||
UINT32 nbUpdateRects, j;
|
||||
const RECTANGLE_16* updateRects;
|
||||
RECTANGLE_16 updateRect;
|
||||
RFX_PROGRESSIVE_TILE* tile = &surface->tiles[surface->updatedTileIndices[i]];
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/crypto.h>
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/codec/color.h>
|
||||
@ -5650,12 +5651,127 @@ fail:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static UINT32 prand(UINT32 max)
|
||||
{
|
||||
UINT32 tmp;
|
||||
if (max <= 1)
|
||||
return 1;
|
||||
winpr_RAND((BYTE*)&tmp, sizeof(tmp));
|
||||
return tmp % (max - 1) + 1;
|
||||
}
|
||||
|
||||
static BOOL FuzzPlanar(void)
|
||||
{
|
||||
UINT32 x;
|
||||
BOOL rc = FALSE;
|
||||
const DWORD planarFlags = PLANAR_FORMAT_HEADER_NA | PLANAR_FORMAT_HEADER_RLE;
|
||||
BITMAP_PLANAR_CONTEXT* planar = freerdp_bitmap_planar_context_new(planarFlags, 64, 64);
|
||||
|
||||
if (!planar)
|
||||
goto fail;
|
||||
|
||||
for (x = 0; x < 10000; x++)
|
||||
{
|
||||
BYTE data[0x10000] = { 0 };
|
||||
size_t dataSize = 0x10000;
|
||||
BYTE dstData[0x10000] = { 0 };
|
||||
|
||||
UINT32 DstFormat;
|
||||
UINT32 nDstStep;
|
||||
UINT32 nXDst;
|
||||
UINT32 nYDst;
|
||||
UINT32 nDstWidth;
|
||||
UINT32 nDstHeight;
|
||||
BOOL invalid = TRUE;
|
||||
do
|
||||
{
|
||||
switch (prand(17) - 1)
|
||||
{
|
||||
case 0:
|
||||
DstFormat = PIXEL_FORMAT_RGB8;
|
||||
break;
|
||||
case 1:
|
||||
DstFormat = PIXEL_FORMAT_BGR15;
|
||||
break;
|
||||
case 2:
|
||||
DstFormat = PIXEL_FORMAT_RGB15;
|
||||
break;
|
||||
case 3:
|
||||
DstFormat = PIXEL_FORMAT_ABGR15;
|
||||
break;
|
||||
case 4:
|
||||
DstFormat = PIXEL_FORMAT_ABGR15;
|
||||
break;
|
||||
case 5:
|
||||
DstFormat = PIXEL_FORMAT_BGR16;
|
||||
break;
|
||||
case 6:
|
||||
DstFormat = PIXEL_FORMAT_RGB16;
|
||||
break;
|
||||
case 7:
|
||||
DstFormat = PIXEL_FORMAT_BGR24;
|
||||
break;
|
||||
case 8:
|
||||
DstFormat = PIXEL_FORMAT_RGB24;
|
||||
break;
|
||||
case 9:
|
||||
DstFormat = PIXEL_FORMAT_BGRA32;
|
||||
break;
|
||||
case 10:
|
||||
DstFormat = PIXEL_FORMAT_BGRX32;
|
||||
break;
|
||||
case 11:
|
||||
DstFormat = PIXEL_FORMAT_RGBA32;
|
||||
break;
|
||||
case 12:
|
||||
DstFormat = PIXEL_FORMAT_RGBX32;
|
||||
break;
|
||||
case 13:
|
||||
DstFormat = PIXEL_FORMAT_ABGR32;
|
||||
break;
|
||||
case 14:
|
||||
DstFormat = PIXEL_FORMAT_XBGR32;
|
||||
break;
|
||||
case 15:
|
||||
DstFormat = PIXEL_FORMAT_ARGB32;
|
||||
break;
|
||||
case 16:
|
||||
DstFormat = PIXEL_FORMAT_XRGB32;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
nDstStep = prand(sizeof(dstData));
|
||||
nXDst = prand(nDstStep);
|
||||
nYDst = prand(sizeof(dstData) / nDstStep);
|
||||
nDstWidth = prand(nDstStep / GetBytesPerPixel(DstFormat));
|
||||
nDstHeight = prand(sizeof(dstData) / nDstStep);
|
||||
invalid = nXDst * GetBytesPerPixel(DstFormat) + (nYDst + nDstHeight) * nDstStep >
|
||||
sizeof(dstData);
|
||||
} while (invalid);
|
||||
printf("DstFormat=%s, nXDst=%" PRIu32 ", nYDst=%" PRIu32 ", nDstWidth=%" PRIu32
|
||||
", nDstHeight=%" PRIu32 ", nDstStep=%" PRIu32 ", total size=%" PRIuz "\n",
|
||||
FreeRDPGetColorFormatName(DstFormat), nXDst, nYDst, nDstWidth, nDstHeight, nDstStep,
|
||||
sizeof(dstData));
|
||||
planar_decompress(planar, data, dataSize, prand(4096), prand(4096), dstData, DstFormat,
|
||||
nDstStep, nXDst, nYDst, nDstWidth, nDstHeight, prand(2));
|
||||
}
|
||||
|
||||
rc = TRUE;
|
||||
fail:
|
||||
freerdp_bitmap_planar_context_free(planar);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int TestFreeRDPCodecPlanar(int argc, char* argv[])
|
||||
{
|
||||
UINT32 x;
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
if (!FuzzPlanar())
|
||||
return -2;
|
||||
|
||||
for (x = 0; x < colorFormatCount; x++)
|
||||
{
|
||||
if (!TestPlanar(colorFormatList[x]))
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include <winpr/wlog.h>
|
||||
#include <winpr/image.h>
|
||||
#include <winpr/sysinfo.h>
|
||||
#include <winpr/file.h>
|
||||
|
||||
#include <freerdp/codec/region.h>
|
||||
|
||||
@ -278,7 +279,7 @@ static BYTE* test_progressive_load_file(const char* path, const char* file, size
|
||||
if (!filename)
|
||||
return NULL;
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
fp = winpr_fopen(filename, "r");
|
||||
free(filename);
|
||||
|
||||
if (!fp)
|
||||
@ -1142,7 +1143,7 @@ int TestFreeRDPCodecProgressive(int argc, char* argv[])
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (PathFileExistsA(ms_sample_path))
|
||||
if (winpr_PathFileExists(ms_sample_path))
|
||||
{
|
||||
/*
|
||||
if (test_progressive_ms_sample(ms_sample_path) < 0)
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/windows.h>
|
||||
#include <winpr/ssl.h>
|
||||
#include <winpr/file.h>
|
||||
|
||||
#include <freerdp/log.h>
|
||||
#include <freerdp/client/file.h>
|
||||
@ -1177,7 +1178,7 @@ int freerdp_assistance_parse_file(rdpAssistanceFile* file, const char* name, con
|
||||
|
||||
free(file->filename);
|
||||
file->filename = _strdup(name);
|
||||
fp = fopen(name, "r");
|
||||
fp = winpr_fopen(name, "r");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
|
||||
@ -192,6 +192,9 @@ BOOL freerdp_settings_get_bool(const rdpSettings* settings, size_t id)
|
||||
case FreeRDP_GatewayHttpTransport:
|
||||
return settings->GatewayHttpTransport;
|
||||
|
||||
case FreeRDP_GatewayHttpUseWebsockets:
|
||||
return settings->GatewayHttpUseWebsockets;
|
||||
|
||||
case FreeRDP_GatewayRpcTransport:
|
||||
return settings->GatewayRpcTransport;
|
||||
|
||||
@ -754,6 +757,10 @@ BOOL freerdp_settings_set_bool(rdpSettings* settings, size_t id, BOOL val)
|
||||
settings->GatewayHttpTransport = val;
|
||||
break;
|
||||
|
||||
case FreeRDP_GatewayHttpUseWebsockets:
|
||||
settings->GatewayHttpUseWebsockets = val;
|
||||
break;
|
||||
|
||||
case FreeRDP_GatewayRpcTransport:
|
||||
settings->GatewayRpcTransport = val;
|
||||
break;
|
||||
|
||||
@ -74,6 +74,7 @@ static const struct settings_str_entry settings_map[] = {
|
||||
{ FreeRDP_GatewayBypassLocal, 0, "FreeRDP_GatewayBypassLocal" },
|
||||
{ FreeRDP_GatewayEnabled, 0, "FreeRDP_GatewayEnabled" },
|
||||
{ FreeRDP_GatewayHttpTransport, 0, "FreeRDP_GatewayHttpTransport" },
|
||||
{ FreeRDP_GatewayHttpUseWebsockets, 0, "FreeRDP_GatewayHttpUseWebsockets" },
|
||||
{ FreeRDP_GatewayRpcTransport, 0, "FreeRDP_GatewayRpcTransport" },
|
||||
{ FreeRDP_GatewayUdpTransport, 0, "FreeRDP_GatewayUdpTransport" },
|
||||
{ FreeRDP_GatewayUseSameCredentials, 0, "FreeRDP_GatewayUseSameCredentials" },
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/file.h>
|
||||
#include <winpr/crypto.h>
|
||||
|
||||
#include <openssl/pem.h>
|
||||
@ -789,7 +790,7 @@ rdpRsaKey* key_new(const char* keyfile)
|
||||
INT64 length;
|
||||
char* buffer = NULL;
|
||||
rdpRsaKey* key = NULL;
|
||||
fp = fopen(keyfile, "rb");
|
||||
fp = winpr_fopen(keyfile, "rb");
|
||||
|
||||
if (!fp)
|
||||
{
|
||||
|
||||
@ -34,6 +34,10 @@
|
||||
ERRINFO_##_code, "ERRINFO_" #_code, ERRINFO_##_code##_STRING, category \
|
||||
}
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
int connectErrorCode;
|
||||
#endif
|
||||
|
||||
/* Protocol-independent codes */
|
||||
|
||||
#define ERRINFO_RPC_INITIATED_DISCONNECT_STRING \
|
||||
|
||||
@ -55,6 +55,8 @@
|
||||
|
||||
#define TAG FREERDP_TAG("core")
|
||||
|
||||
/* connectErrorCode is 'extern' in error.h. See comment there.*/
|
||||
|
||||
UINT freerdp_channel_add_init_handle_data(rdpChannelHandles* handles, void* pInitHandle,
|
||||
void* pUserData)
|
||||
{
|
||||
@ -161,6 +163,9 @@ BOOL freerdp_connect(freerdp* instance)
|
||||
|
||||
/* We always set the return code to 0 before we start the connect sequence*/
|
||||
instance->ConnectionCallbackState = CLIENT_STATE_INITIAL;
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
connectErrorCode = 0;
|
||||
#endif
|
||||
freerdp_set_last_error_log(instance->context, FREERDP_ERROR_SUCCESS);
|
||||
clearChannelError(instance->context);
|
||||
ResetEvent(instance->context->abortEvent);
|
||||
@ -890,6 +895,63 @@ void freerdp_set_last_error_ex(rdpContext* context, UINT32 lastError, const char
|
||||
}
|
||||
|
||||
context->LastError = lastError;
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
switch (lastError)
|
||||
{
|
||||
case FREERDP_ERROR_PRE_CONNECT_FAILED:
|
||||
connectErrorCode = PREECONNECTERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_CONNECT_UNDEFINED:
|
||||
connectErrorCode = UNDEFINEDCONNECTERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_POST_CONNECT_FAILED:
|
||||
connectErrorCode = POSTCONNECTERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_DNS_ERROR:
|
||||
connectErrorCode = DNSERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_DNS_NAME_NOT_FOUND:
|
||||
connectErrorCode = DNSNAMENOTFOUND;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_CONNECT_FAILED:
|
||||
connectErrorCode = CONNECTERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_MCS_CONNECT_INITIAL_ERROR:
|
||||
connectErrorCode = MCSCONNECTINITIALERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_TLS_CONNECT_FAILED:
|
||||
connectErrorCode = TLSCONNECTERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_AUTHENTICATION_FAILED:
|
||||
connectErrorCode = AUTHENTICATIONERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_INSUFFICIENT_PRIVILEGES:
|
||||
connectErrorCode = INSUFFICIENTPRIVILEGESERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_CONNECT_CANCELLED:
|
||||
connectErrorCode = CANCELEDBYUSER;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_SECURITY_NEGO_CONNECT_FAILED:
|
||||
connectErrorCode = CONNECTERROR;
|
||||
break;
|
||||
|
||||
case FREERDP_ERROR_CONNECT_TRANSPORT_FAILED:
|
||||
connectErrorCode = CONNECTERROR;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const char* freerdp_get_logon_error_info_type(UINT32 type)
|
||||
|
||||
@ -308,10 +308,14 @@ static BOOL rdg_read_http_unicode_string(wStream* s, const WCHAR** string, UINT1
|
||||
{
|
||||
WCHAR* str;
|
||||
UINT16 strLenBytes;
|
||||
size_t rem = Stream_GetRemainingLength(s);
|
||||
|
||||
/* Read length of the string */
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
if (rem < 4)
|
||||
{
|
||||
WLog_ERR(TAG, "[%s]: Could not read stream length, only have % " PRIuz " bytes", rem);
|
||||
return FALSE;
|
||||
}
|
||||
Stream_Read_UINT16(s, strLenBytes);
|
||||
|
||||
/* Remember position of our string */
|
||||
@ -319,7 +323,12 @@ static BOOL rdg_read_http_unicode_string(wStream* s, const WCHAR** string, UINT1
|
||||
|
||||
/* seek past the string - if this fails something is wrong */
|
||||
if (!Stream_SafeSeek(s, strLenBytes))
|
||||
{
|
||||
WLog_ERR(TAG,
|
||||
"[%s]: Could not read stream data, only have % " PRIuz " bytes, expected %" PRIu16,
|
||||
rem - 4, strLenBytes);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* return the string data (if wanted) */
|
||||
if (string)
|
||||
@ -1295,7 +1304,7 @@ static BOOL rdg_process_tunnel_response_optional(rdpRdg* rdg, wStream* s, UINT16
|
||||
/* Seek over tunnelId (4 bytes) */
|
||||
if (!Stream_SafeSeek(s, 4))
|
||||
{
|
||||
WLog_ERR(TAG, "[%s] Short packet %" PRIuz ", expected 4", __FUNCTION__,
|
||||
WLog_ERR(TAG, "[%s] Short tunnelId, got %" PRIuz ", expected 4", __FUNCTION__,
|
||||
Stream_GetRemainingLength(s));
|
||||
return FALSE;
|
||||
}
|
||||
@ -1306,7 +1315,7 @@ static BOOL rdg_process_tunnel_response_optional(rdpRdg* rdg, wStream* s, UINT16
|
||||
UINT32 caps;
|
||||
if (Stream_GetRemainingLength(s) < 4)
|
||||
{
|
||||
WLog_ERR(TAG, "[%s] Short packet %" PRIuz ", expected 4", __FUNCTION__,
|
||||
WLog_ERR(TAG, "[%s] Short capsFlags, got %" PRIuz ", expected 4", __FUNCTION__,
|
||||
Stream_GetRemainingLength(s));
|
||||
return FALSE;
|
||||
}
|
||||
@ -1320,7 +1329,7 @@ static BOOL rdg_process_tunnel_response_optional(rdpRdg* rdg, wStream* s, UINT16
|
||||
/* Seek over nonce (20 bytes) */
|
||||
if (!Stream_SafeSeek(s, 20))
|
||||
{
|
||||
WLog_ERR(TAG, "[%s] Short packet %" PRIuz ", expected 20", __FUNCTION__,
|
||||
WLog_ERR(TAG, "[%s] Short nonce, got %" PRIuz ", expected 20", __FUNCTION__,
|
||||
Stream_GetRemainingLength(s));
|
||||
return FALSE;
|
||||
}
|
||||
@ -1328,7 +1337,7 @@ static BOOL rdg_process_tunnel_response_optional(rdpRdg* rdg, wStream* s, UINT16
|
||||
/* Read serverCert */
|
||||
if (!rdg_read_http_unicode_string(s, NULL, NULL))
|
||||
{
|
||||
WLog_ERR(TAG, "[%s] Failed to read string", __FUNCTION__);
|
||||
WLog_ERR(TAG, "[%s] Failed to read server certificate", __FUNCTION__);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@ -1345,7 +1354,7 @@ static BOOL rdg_process_tunnel_response_optional(rdpRdg* rdg, wStream* s, UINT16
|
||||
/* Read message string and invoke callback */
|
||||
if (!rdg_read_http_unicode_string(s, &msg, &msgLenBytes))
|
||||
{
|
||||
WLog_ERR(TAG, "[%s] Failed to read string", __FUNCTION__);
|
||||
WLog_ERR(TAG, "[%s] Failed to read consent message", __FUNCTION__);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1537,7 +1546,7 @@ DWORD rdg_get_event_handles(rdpRdg* rdg, HANDLE* events, DWORD count)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (rdg->tlsIn && rdg->tlsIn->bio)
|
||||
if (!rdg->transferEncoding.isWebsocketTransport && rdg->tlsIn && rdg->tlsIn->bio)
|
||||
{
|
||||
if (events && (nCount < count))
|
||||
{
|
||||
@ -2403,7 +2412,8 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
if (cmd == BIO_CTRL_FLUSH)
|
||||
{
|
||||
(void)BIO_flush(tlsOut->bio);
|
||||
(void)BIO_flush(tlsIn->bio);
|
||||
if (!rdg->transferEncoding.isWebsocketTransport)
|
||||
(void)BIO_flush(tlsIn->bio);
|
||||
status = 1;
|
||||
}
|
||||
else if (cmd == BIO_C_SET_NONBLOCK)
|
||||
@ -2418,6 +2428,10 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
else if (cmd == BIO_C_WRITE_BLOCKED)
|
||||
{
|
||||
BIO* bio = tlsIn->bio;
|
||||
|
||||
if (rdg->transferEncoding.isWebsocketTransport)
|
||||
bio = tlsOut->bio;
|
||||
|
||||
status = BIO_write_blocked(bio);
|
||||
}
|
||||
else if (cmd == BIO_C_WAIT_READ)
|
||||
@ -2437,6 +2451,9 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
|
||||
int timeout = (int)arg1;
|
||||
BIO* bio = tlsIn->bio;
|
||||
|
||||
if (rdg->transferEncoding.isWebsocketTransport)
|
||||
bio = tlsOut->bio;
|
||||
|
||||
if (BIO_write_blocked(bio))
|
||||
status = BIO_wait_write(bio, timeout);
|
||||
else if (BIO_read_blocked(bio))
|
||||
@ -2547,7 +2564,9 @@ rdpRdg* rdg_new(rdpContext* context)
|
||||
!http_context_set_user_agent(rdg->http, "MS-RDGateway/1.0") ||
|
||||
!http_context_set_host(rdg->http, rdg->settings->GatewayHostname) ||
|
||||
!http_context_set_rdg_connection_id(rdg->http, bracedUuid) ||
|
||||
!http_context_enable_websocket_upgrade(rdg->http, TRUE))
|
||||
!http_context_enable_websocket_upgrade(
|
||||
rdg->http,
|
||||
freerdp_settings_get_bool(rdg->settings, FreeRDP_GatewayHttpUseWebsockets)))
|
||||
{
|
||||
goto rdg_alloc_error;
|
||||
}
|
||||
|
||||
@ -35,8 +35,8 @@
|
||||
|
||||
static BOOL gcc_read_client_cluster_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
|
||||
static BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength);
|
||||
static BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length);
|
||||
static BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, int length);
|
||||
static BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, UINT16 length);
|
||||
static BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, UINT16 length);
|
||||
static BOOL gcc_read_user_data_header(wStream* s, UINT16* type, UINT16* length);
|
||||
static void gcc_write_user_data_header(wStream* s, UINT16 type, UINT16 length);
|
||||
|
||||
@ -379,7 +379,7 @@ void gcc_write_conference_create_response(wStream* s, wStream* userData)
|
||||
0); /* array of server data blocks */
|
||||
}
|
||||
|
||||
BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, int length)
|
||||
BOOL gcc_read_client_data_blocks(wStream* s, rdpMcs* mcs, UINT16 length)
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 blockLength;
|
||||
@ -518,7 +518,7 @@ BOOL gcc_write_client_data_blocks(wStream* s, rdpMcs* mcs)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, int length)
|
||||
BOOL gcc_read_server_data_blocks(wStream* s, rdpMcs* mcs, UINT16 length)
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 offset = 0;
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include <winpr/crypto.h>
|
||||
#include <winpr/shell.h>
|
||||
#include <winpr/path.h>
|
||||
#include <winpr/file.h>
|
||||
|
||||
#include <freerdp/log.h>
|
||||
|
||||
@ -188,19 +189,21 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL saveCal(rdpSettings* settings, const BYTE* data, int length, char* hostname)
|
||||
static BOOL saveCal(rdpSettings* settings, const BYTE* data, size_t length, const char* hostname)
|
||||
{
|
||||
char hash[41];
|
||||
FILE* fp;
|
||||
char* licenseStorePath = NULL;
|
||||
char filename[MAX_PATH], filenameNew[MAX_PATH];
|
||||
char *filepath = NULL, *filepathNew = NULL;
|
||||
WCHAR* wFilepathNew = NULL;
|
||||
WCHAR* wFilepath = NULL;
|
||||
size_t written;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (!PathFileExistsA(settings->ConfigPath))
|
||||
if (!winpr_PathFileExists(settings->ConfigPath))
|
||||
{
|
||||
if (!PathMakePathA(settings->ConfigPath, 0))
|
||||
if (!winpr_PathMakePath(settings->ConfigPath, 0))
|
||||
{
|
||||
WLog_ERR(TAG, "error creating directory '%s'", settings->ConfigPath);
|
||||
goto out;
|
||||
@ -211,9 +214,9 @@ static BOOL saveCal(rdpSettings* settings, const BYTE* data, int length, char* h
|
||||
if (!(licenseStorePath = GetCombinedPath(settings->ConfigPath, licenseStore)))
|
||||
goto out;
|
||||
|
||||
if (!PathFileExistsA(licenseStorePath))
|
||||
if (!winpr_PathFileExists(licenseStorePath))
|
||||
{
|
||||
if (!PathMakePathA(licenseStorePath, 0))
|
||||
if (!winpr_PathMakePath(licenseStorePath, 0))
|
||||
{
|
||||
WLog_ERR(TAG, "error creating directory '%s'", licenseStorePath);
|
||||
goto out;
|
||||
@ -231,8 +234,12 @@ static BOOL saveCal(rdpSettings* settings, const BYTE* data, int length, char* h
|
||||
|
||||
if (!(filepathNew = GetCombinedPath(licenseStorePath, filenameNew)))
|
||||
goto out;
|
||||
if (ConvertToUnicode(CP_UTF8, 0, filepathNew, -1, &wFilepathNew, 0) <= 0)
|
||||
goto out;
|
||||
if (ConvertToUnicode(CP_UTF8, 0, filepath, -1, &wFilepath, 0) <= 0)
|
||||
goto out;
|
||||
|
||||
fp = fopen(filepathNew, "wb");
|
||||
fp = winpr_fopen(filepathNew, "wb");
|
||||
if (!fp)
|
||||
goto out;
|
||||
|
||||
@ -241,25 +248,28 @@ static BOOL saveCal(rdpSettings* settings, const BYTE* data, int length, char* h
|
||||
|
||||
if (written != 1)
|
||||
{
|
||||
DeleteFile(filepathNew);
|
||||
DeleteFileW(wFilepathNew);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = MoveFileEx(filepathNew, filepath, MOVEFILE_REPLACE_EXISTING);
|
||||
ret = MoveFileExW(wFilepathNew, wFilepath, MOVEFILE_REPLACE_EXISTING);
|
||||
|
||||
out:
|
||||
free(wFilepathNew);
|
||||
free(filepathNew);
|
||||
free(wFilepath);
|
||||
free(filepath);
|
||||
free(licenseStorePath);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BYTE* loadCalFile(rdpSettings* settings, const char* hostname, int* dataLen)
|
||||
static BYTE* loadCalFile(rdpSettings* settings, const char* hostname, size_t* dataLen)
|
||||
{
|
||||
char *licenseStorePath = NULL, *calPath = NULL;
|
||||
char calFilename[MAX_PATH];
|
||||
char hash[41];
|
||||
int length, status;
|
||||
size_t length;
|
||||
int status;
|
||||
FILE* fp;
|
||||
BYTE* ret = NULL;
|
||||
|
||||
@ -277,7 +287,7 @@ static BYTE* loadCalFile(rdpSettings* settings, const char* hostname, int* dataL
|
||||
if (!(calPath = GetCombinedPath(licenseStorePath, calFilename)))
|
||||
goto error_path;
|
||||
|
||||
fp = fopen(calPath, "rb");
|
||||
fp = winpr_fopen(calPath, "rb");
|
||||
if (!fp)
|
||||
goto error_open;
|
||||
|
||||
@ -683,9 +693,14 @@ BOOL license_encrypt_premaster_secret(rdpLicense* license)
|
||||
license->EncryptedPremasterSecret->type = BB_RANDOM_BLOB;
|
||||
license->EncryptedPremasterSecret->length = PREMASTER_SECRET_LENGTH;
|
||||
#ifndef LICENSE_NULL_PREMASTER_SECRET
|
||||
license->EncryptedPremasterSecret->length = crypto_rsa_public_encrypt(
|
||||
license->PremasterSecret, PREMASTER_SECRET_LENGTH, license->ModulusLength, license->Modulus,
|
||||
license->Exponent, EncryptedPremasterSecret);
|
||||
{
|
||||
SSIZE_T length = crypto_rsa_public_encrypt(
|
||||
license->PremasterSecret, PREMASTER_SECRET_LENGTH, license->ModulusLength,
|
||||
license->Modulus, license->Exponent, EncryptedPremasterSecret);
|
||||
if ((length < 0) || (length > UINT16_MAX))
|
||||
return FALSE;
|
||||
license->EncryptedPremasterSecret->length = (UINT16)length;
|
||||
}
|
||||
#endif
|
||||
license->EncryptedPremasterSecret->data = EncryptedPremasterSecret;
|
||||
return TRUE;
|
||||
@ -1417,7 +1432,7 @@ BOOL license_answer_license_request(rdpLicense* license)
|
||||
{
|
||||
wStream* s;
|
||||
BYTE* license_data = NULL;
|
||||
int license_size = 0;
|
||||
size_t license_size = 0;
|
||||
BOOL status;
|
||||
char* username;
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ static int testSuccess(int port)
|
||||
printf("Sample Server: %s\n", exe);
|
||||
printf("Workspace: %s\n", wpath);
|
||||
|
||||
if (!PathFileExistsA(exe))
|
||||
if (!winpr_PathFileExists(exe))
|
||||
goto fail;
|
||||
|
||||
// Start sample server locally.
|
||||
|
||||
@ -63,6 +63,7 @@ static const size_t bool_list_indices[] = {
|
||||
FreeRDP_GatewayBypassLocal,
|
||||
FreeRDP_GatewayEnabled,
|
||||
FreeRDP_GatewayHttpTransport,
|
||||
FreeRDP_GatewayHttpUseWebsockets,
|
||||
FreeRDP_GatewayRpcTransport,
|
||||
FreeRDP_GatewayUdpTransport,
|
||||
FreeRDP_GatewayUseSameCredentials,
|
||||
|
||||
@ -725,11 +725,13 @@ char* crypto_cert_get_upn(X509* x509)
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/* Deprecated name.*/
|
||||
void crypto_cert_subject_alt_name_free(int count, int* lengths, char** alt_names)
|
||||
{
|
||||
crypto_cert_dns_names_free(count, lengths, alt_names);
|
||||
}
|
||||
#endif
|
||||
|
||||
void crypto_cert_dns_names_free(int count, int* lengths, char** dns_names)
|
||||
{
|
||||
@ -751,11 +753,13 @@ void crypto_cert_dns_names_free(int count, int* lengths, char** dns_names)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/* Deprecated name.*/
|
||||
char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths)
|
||||
{
|
||||
return crypto_cert_get_dns_names(xcert, count, lengths);
|
||||
}
|
||||
#endif
|
||||
|
||||
char** crypto_cert_get_dns_names(X509* x509, int* count, int** lengths)
|
||||
{
|
||||
@ -842,9 +846,7 @@ BOOL x509_verify_certificate(CryptoCert cert, const char* certificate_store_path
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
|
||||
|
||||
if (lookup == NULL)
|
||||
if (X509_STORE_set_default_paths(cert_ctx) != 1)
|
||||
goto end;
|
||||
|
||||
lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
|
||||
|
||||
@ -17,8 +17,7 @@ include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} TEST_PATH)
|
||||
string(REGEX REPLACE "\\\\" "\\\\\\\\" TEST_PATH ${TEST_PATH})
|
||||
set(TEST_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_definitions(-DTEST_SOURCE_DIR="${TEST_PATH}")
|
||||
target_link_libraries(${MODULE_NAME} freerdp winpr ${OPENSSL_LIBRARIES})
|
||||
|
||||
@ -34,12 +34,12 @@ static int prepare(const char* currentFileV2, const char* legacyFileV2, const ch
|
||||
FILE* fl = NULL;
|
||||
FILE* fc = NULL;
|
||||
size_t i;
|
||||
fc = fopen(currentFileV2, "w+");
|
||||
fc = winpr_fopen(currentFileV2, "w+");
|
||||
|
||||
if (!fc)
|
||||
goto finish;
|
||||
|
||||
fl = fopen(legacyFileV2, "w+");
|
||||
fl = winpr_fopen(legacyFileV2, "w+");
|
||||
|
||||
if (!fl)
|
||||
goto finish;
|
||||
@ -55,7 +55,7 @@ static int prepare(const char* currentFileV2, const char* legacyFileV2, const ch
|
||||
fc = NULL;
|
||||
fclose(fl);
|
||||
fl = NULL;
|
||||
fl = fopen(legacyFile, "w+");
|
||||
fl = winpr_fopen(legacyFile, "w+");
|
||||
|
||||
if (!fl)
|
||||
goto finish;
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#include <winpr/file.h>
|
||||
#include <freerdp/crypto/crypto.h>
|
||||
|
||||
typedef char* (*get_field_pr)(X509*);
|
||||
@ -27,11 +28,7 @@ static char* certificate_path(void)
|
||||
where the tests are run. (ie. no chdir occurs between compilation and test running, or __FILE__
|
||||
is an absolute path).
|
||||
*/
|
||||
#if defined(_WIN32)
|
||||
static const char dirsep = '\\';
|
||||
#else
|
||||
static const char dirsep = '/';
|
||||
#endif
|
||||
static const char filename[] = "Test_x509_cert_info.pem";
|
||||
#ifdef TEST_SOURCE_DIR
|
||||
const char* file = TEST_SOURCE_DIR;
|
||||
@ -91,7 +88,7 @@ static int TestCertificateFile(const char* certificate_path,
|
||||
const certificate_test_t* certificate_tests, int count)
|
||||
{
|
||||
X509* certificate;
|
||||
FILE* certificate_file = fopen(certificate_path, "r");
|
||||
FILE* certificate_file = winpr_fopen(certificate_path, "r");
|
||||
int success = 0;
|
||||
int i;
|
||||
|
||||
|
||||
@ -1548,6 +1548,7 @@ int tls_verify_certificate(rdpTls* tls, CryptoCert cert, const char* hostname, U
|
||||
accept_certificate = instance->VerifyCertificateEx(
|
||||
instance, hostname, port, common_name, subject, issuer, fingerprint, flags);
|
||||
}
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
else if (instance->VerifyCertificate)
|
||||
{
|
||||
WLog_WARN(TAG, "The VerifyCertificate callback is deprecated, migrate your "
|
||||
@ -1555,6 +1556,7 @@ int tls_verify_certificate(rdpTls* tls, CryptoCert cert, const char* hostname, U
|
||||
accept_certificate = instance->VerifyCertificate(
|
||||
instance, common_name, subject, issuer, fingerprint, !hostname_match);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (match == -1)
|
||||
{
|
||||
@ -1594,6 +1596,7 @@ int tls_verify_certificate(rdpTls* tls, CryptoCert cert, const char* hostname, U
|
||||
instance, hostname, port, common_name, subject, issuer, fingerprint,
|
||||
old_subject, old_issuer, old_fingerprint, flags | VERIFY_CERT_FLAG_CHANGED);
|
||||
}
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
else if (instance->VerifyChangedCertificate)
|
||||
{
|
||||
WLog_WARN(TAG, "The VerifyChangedCertificate callback is deprecated, migrate "
|
||||
@ -1602,6 +1605,7 @@ int tls_verify_certificate(rdpTls* tls, CryptoCert cert, const char* hostname, U
|
||||
instance, common_name, subject, issuer, fingerprint, old_subject,
|
||||
old_issuer, old_fingerprint);
|
||||
}
|
||||
#endif
|
||||
|
||||
free(old_subject);
|
||||
free(old_issuer);
|
||||
|
||||
@ -147,7 +147,8 @@ HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, UINT32 nWidth, UINT32 nHeigh
|
||||
hBitmap->format = hdc->format;
|
||||
hBitmap->width = nWidth;
|
||||
hBitmap->height = nHeight;
|
||||
hBitmap->data = _aligned_malloc(nWidth * nHeight * GetBytesPerPixel(hBitmap->format), 16);
|
||||
hBitmap->data =
|
||||
_aligned_malloc(nWidth * nHeight * GetBytesPerPixel(hBitmap->format) * 1ULL, 16);
|
||||
hBitmap->free = _aligned_free;
|
||||
|
||||
if (!hBitmap->data)
|
||||
|
||||
@ -1057,7 +1057,7 @@ static BOOL gdi_surface_bits(rdpContext* context, const SURFACE_BITS_COMMAND* cm
|
||||
|
||||
case RDP_CODEC_ID_NONE:
|
||||
format = gdi_get_pixel_format(cmd->bmp.bpp);
|
||||
size = cmd->bmp.width * cmd->bmp.height * GetBytesPerPixel(format);
|
||||
size = cmd->bmp.width * cmd->bmp.height * GetBytesPerPixel(format) * 1ULL;
|
||||
if (size > cmd->bmp.bitmapDataLength)
|
||||
{
|
||||
WLog_ERR(TAG, "Short nocodec message: got %" PRIu32 " bytes, require %" PRIuz,
|
||||
|
||||
@ -42,6 +42,27 @@ static BOOL is_rect_valid(const RECTANGLE_16* rect, size_t width, size_t height)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL is_within_surface(const gdiGfxSurface* surface, const RDPGFX_SURFACE_COMMAND* cmd)
|
||||
{
|
||||
RECTANGLE_16 rect;
|
||||
if (!surface || !cmd)
|
||||
return FALSE;
|
||||
rect.left = cmd->left;
|
||||
rect.top = cmd->top;
|
||||
rect.right = cmd->right;
|
||||
rect.bottom = cmd->bottom;
|
||||
if (!is_rect_valid(&rect, surface->width, surface->height))
|
||||
{
|
||||
WLog_ERR(TAG,
|
||||
"%s: Command rect %" PRIu32 "x" PRIu32 "-" PRIu32 "x" PRIu32
|
||||
" not within bounds of " PRIu32 "x" PRIu32,
|
||||
__FUNCTION__, rect.left, rect.top, cmd->width, cmd->height, surface->width,
|
||||
surface->height);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static DWORD gfx_align_scanline(DWORD widthInBytes, DWORD alignment)
|
||||
{
|
||||
const UINT32 align = alignment;
|
||||
@ -259,6 +280,9 @@ static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi, RdpgfxClientContext* co
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (!is_within_surface(surface, cmd))
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
if (!freerdp_image_copy(surface->data, surface->format, surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, cmd->data, cmd->format, 0, 0, 0, NULL,
|
||||
FREERDP_FLIP_NONE))
|
||||
@ -414,6 +438,9 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
|
||||
DstData = surface->data;
|
||||
|
||||
if (!is_within_surface(surface, cmd))
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
if (!planar_decompress(surface->codecs->planar, cmd->data, cmd->length, cmd->width, cmd->height,
|
||||
DstData, surface->format, surface->scanline, cmd->left, cmd->top,
|
||||
cmd->width, cmd->height, FALSE))
|
||||
@ -686,6 +713,9 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (!is_within_surface(surface, cmd))
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
Stream_Read_UINT16(&s, alphaSig);
|
||||
Stream_Read_UINT16(&s, compressed);
|
||||
|
||||
@ -696,7 +726,7 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
|
||||
{
|
||||
UINT32 x, y;
|
||||
|
||||
if (Stream_GetRemainingLength(&s) < cmd->height * cmd->width)
|
||||
if (Stream_GetRemainingLength(&s) < cmd->height * cmd->width * 1ULL)
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
for (y = cmd->top; y < cmd->top + cmd->height; y++)
|
||||
@ -815,6 +845,9 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi, RdpgfxClientContext* con
|
||||
return ERROR_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (!is_within_surface(surface, cmd))
|
||||
return ERROR_INVALID_DATA;
|
||||
|
||||
rc = progressive_create_surface_context(surface->codecs->progressive, cmd->surfaceId,
|
||||
surface->width, surface->height);
|
||||
|
||||
@ -991,8 +1024,8 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
surface->scanline = gfx_align_scanline(surface->width * 4, 16);
|
||||
surface->data = (BYTE*)_aligned_malloc(surface->scanline * surface->height, 16);
|
||||
surface->scanline = gfx_align_scanline(surface->width * 4UL, 16);
|
||||
surface->data = (BYTE*)_aligned_malloc(surface->scanline * surface->height * 1ULL, 16);
|
||||
|
||||
if (!surface->data)
|
||||
{
|
||||
@ -1502,6 +1535,7 @@ BOOL gdi_graphics_pipeline_init_ex(rdpGdi* gdi, RdpgfxClientContext* gfx,
|
||||
InitializeCriticalSection(&gfx->mux);
|
||||
PROFILER_CREATE(gfx->SurfaceProfiler, "GFX-PROFILER");
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/**
|
||||
* gdi->graphicsReset will be removed in FreeRDP v3 from public headers,
|
||||
* since the EGFX Reset Graphics PDU seems to be optional.
|
||||
@ -1509,6 +1543,7 @@ BOOL gdi_graphics_pipeline_init_ex(rdpGdi* gdi, RdpgfxClientContext* gfx,
|
||||
* we simply initialize it with TRUE here for now.
|
||||
*/
|
||||
gdi->graphicsReset = TRUE;
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, UINT32 nWidth, UINT32 nHeight, UINT32
|
||||
return NULL;
|
||||
|
||||
nDstStep = nWidth * GetBytesPerPixel(gdi->dstFormat);
|
||||
pDstData = _aligned_malloc(nHeight * nDstStep, 16);
|
||||
pDstData = _aligned_malloc(nHeight * nDstStep * 1ULL, 16);
|
||||
|
||||
if (!pDstData)
|
||||
return NULL;
|
||||
|
||||
@ -158,7 +158,7 @@ BOOL gdi_FillRect(HGDI_DC hdc, const HGDI_RECT rect, HGDI_BRUSH hbr)
|
||||
for (y = 1; y < nHeight; y++)
|
||||
{
|
||||
BYTE* dstp = gdi_get_bitmap_pointer(hdc, nXDest, nYDest + y);
|
||||
memcpy(dstp, srcp, nWidth * formatSize);
|
||||
memcpy(dstp, srcp, nWidth * formatSize * 1ULL);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@ -66,7 +66,7 @@ static VideoSurface* gdiVideoCreateSurface(VideoClientContext* video, BYTE* data
|
||||
ret->base.w = width;
|
||||
ret->base.h = height;
|
||||
ret->scanline = width * bpp;
|
||||
ret->image = _aligned_malloc(ret->scanline * height, 16);
|
||||
ret->image = _aligned_malloc(ret->scanline * height * 1ULL, 16);
|
||||
|
||||
if (!ret->image)
|
||||
{
|
||||
|
||||
@ -60,14 +60,14 @@ static BOOL memory_regions_overlap_2d(const BYTE* p1, int p1Step, int p1Size, co
|
||||
|
||||
if (p1m <= p2m)
|
||||
{
|
||||
ULONG_PTR p1mEnd = p1m + (height - 1) * p1Step + width * p1Size;
|
||||
ULONG_PTR p1mEnd = p1m + (height - 1) * p1Step * 1ULL + width * p1Size * 1ULL;
|
||||
|
||||
if (p1mEnd > p2m)
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ULONG_PTR p2mEnd = p2m + (height - 1) * p2Step + width * p2Size;
|
||||
ULONG_PTR p2mEnd = p2m + (height - 1) * p2Step * 1ULL + width * p2Size * 1ULL;
|
||||
|
||||
if (p2mEnd > p1m)
|
||||
return TRUE;
|
||||
|
||||
@ -157,7 +157,7 @@ static primitives_YUV_benchmark* primitives_YUV_benchmark_init(primitives_YUV_be
|
||||
if (!buf)
|
||||
goto fail;
|
||||
|
||||
winpr_RAND(buf, roi->width * roi->height);
|
||||
winpr_RAND(buf, roi->width * roi->height * 1ULL);
|
||||
ret->steps[i] = roi->width;
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/file.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <freerdp/log.h>
|
||||
|
||||
@ -177,7 +178,7 @@ rdpPcap* pcap_open(char* name, BOOL write)
|
||||
pcap->name = name;
|
||||
pcap->write = write;
|
||||
pcap->record_count = 0;
|
||||
pcap->fp = fopen(name, write ? "w+b" : "rb");
|
||||
pcap->fp = winpr_fopen(name, write ? "w+b" : "rb");
|
||||
|
||||
if (pcap->fp == NULL)
|
||||
goto fail;
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/path.h>
|
||||
#include <winpr/file.h>
|
||||
#include <winpr/print.h>
|
||||
|
||||
#include "rdtk_engine.h"
|
||||
@ -154,7 +155,7 @@ static char* rdtk_font_load_descriptor_file(const char* filename, int* pSize)
|
||||
FILE* fp = NULL;
|
||||
size_t readSize;
|
||||
size_t fileSize;
|
||||
fp = fopen(filename, "r");
|
||||
fp = winpr_fopen(filename, "r");
|
||||
|
||||
if (!fp)
|
||||
return NULL;
|
||||
@ -611,10 +612,10 @@ rdtkFont* rdtk_font_new(rdtkEngine* engine, const char* path, const char* file)
|
||||
|
||||
sprintf_s(fontDescriptorFile, length + 8, "%s.xml", fontBaseFile);
|
||||
|
||||
if (!PathFileExistsA(fontImageFile))
|
||||
if (!winpr_PathFileExists(fontImageFile))
|
||||
goto cleanup;
|
||||
|
||||
if (!PathFileExistsA(fontDescriptorFile))
|
||||
if (!winpr_PathFileExists(fontDescriptorFile))
|
||||
goto cleanup;
|
||||
|
||||
font = (rdtkFont*)calloc(1, sizeof(rdtkFont));
|
||||
|
||||
@ -18,7 +18,7 @@ NDK_TARGET=21
|
||||
|
||||
JPEG_TAG=master
|
||||
OPENH264_TAG=v1.8.0 # NOTE: NDK r15c or earlier needed in --openh624-ndk for v1.8.0
|
||||
OPENSSL_TAG=OpenSSL_1_1_1h
|
||||
OPENSSL_TAG=OpenSSL_1_1_1j
|
||||
|
||||
SRC_DIR=$SCRIPT_PATH/..
|
||||
BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs
|
||||
|
||||
@ -18,7 +18,7 @@ NDK_TARGET=21
|
||||
|
||||
JPEG_TAG=master
|
||||
OPENH264_TAG=v1.8.0 # NOTE: NDK r15c or earlier needed in --openh624-ndk for v1.8.0
|
||||
OPENSSL_TAG=OpenSSL_1_1_1h
|
||||
OPENSSL_TAG=OpenSSL_1_1_1j
|
||||
|
||||
SRC_DIR=$SCRIPT_PATH/..
|
||||
BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs
|
||||
|
||||
@ -18,7 +18,7 @@ NDK_TARGET=26
|
||||
|
||||
JPEG_TAG=master
|
||||
OPENH264_TAG=v1.8.0 # NOTE: NDK r15c or earlier needed in --openh624-ndk for v1.8.0
|
||||
OPENSSL_TAG=OpenSSL_1_1_1h
|
||||
OPENSSL_TAG=OpenSSL_1_1_1j
|
||||
|
||||
SRC_DIR=$SCRIPT_PATH/..
|
||||
BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/ssl.h>
|
||||
#include <winpr/synch.h>
|
||||
#include <winpr/file.h>
|
||||
#include <winpr/string.h>
|
||||
#include <winpr/path.h>
|
||||
#include <winpr/winsock.h>
|
||||
@ -254,7 +255,7 @@ static BOOL test_peer_load_icon(freerdp_peer* client)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((fp = fopen("test_icon.ppm", "r")) == NULL)
|
||||
if ((fp = winpr_fopen("test_icon.ppm", "r")) == NULL)
|
||||
{
|
||||
WLog_ERR(TAG, "Unable to open test icon");
|
||||
return FALSE;
|
||||
|
||||
@ -140,7 +140,7 @@ static BOOL x11_shadow_pam_get_service_name(SHADOW_PAM_AUTH_INFO* info)
|
||||
const char* hint = hints[x];
|
||||
|
||||
_snprintf(path, sizeof(path), "%s/%s", base, hint);
|
||||
if (PathFileExistsA(path))
|
||||
if (winpr_PathFileExists(path))
|
||||
{
|
||||
|
||||
info->service_name = _strdup(hint);
|
||||
|
||||
@ -680,7 +680,7 @@ static int shadow_server_init_config_path(rdpShadowServer* server)
|
||||
|
||||
if (userLibraryPath)
|
||||
{
|
||||
if (!PathFileExistsA(userLibraryPath) && !PathMakePathA(userLibraryPath, 0))
|
||||
if (!winpr_PathFileExists(userLibraryPath) && !winpr_PathMakePath(userLibraryPath, 0))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to create directory '%s'", userLibraryPath);
|
||||
free(userLibraryPath);
|
||||
@ -691,8 +691,8 @@ static int shadow_server_init_config_path(rdpShadowServer* server)
|
||||
|
||||
if (userApplicationSupportPath)
|
||||
{
|
||||
if (!PathFileExistsA(userApplicationSupportPath) &&
|
||||
!PathMakePathA(userApplicationSupportPath, 0))
|
||||
if (!winpr_PathFileExists(userApplicationSupportPath) &&
|
||||
!winpr_PathMakePath(userApplicationSupportPath, 0))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to create directory '%s'", userApplicationSupportPath);
|
||||
free(userLibraryPath);
|
||||
@ -717,7 +717,7 @@ static int shadow_server_init_config_path(rdpShadowServer* server)
|
||||
|
||||
if (configHome)
|
||||
{
|
||||
if (!PathFileExistsA(configHome) && !PathMakePathA(configHome, 0))
|
||||
if (!winpr_PathFileExists(configHome) && !winpr_PathMakePath(configHome, 0))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to create directory '%s'", configHome);
|
||||
free(configHome);
|
||||
@ -743,7 +743,7 @@ static BOOL shadow_server_init_certificate(rdpShadowServer* server)
|
||||
const char* makecert_argv[6] = { "makecert", "-rdp", "-live", "-silent", "-y", "5" };
|
||||
int makecert_argc = (sizeof(makecert_argv) / sizeof(char*));
|
||||
|
||||
if (!PathFileExistsA(server->ConfigPath) && !PathMakePathA(server->ConfigPath, 0))
|
||||
if (!winpr_PathFileExists(server->ConfigPath) && !winpr_PathMakePath(server->ConfigPath, 0))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to create directory '%s'", server->ConfigPath);
|
||||
return FALSE;
|
||||
@ -752,7 +752,7 @@ static BOOL shadow_server_init_certificate(rdpShadowServer* server)
|
||||
if (!(filepath = GetCombinedPath(server->ConfigPath, "shadow")))
|
||||
return FALSE;
|
||||
|
||||
if (!PathFileExistsA(filepath) && !PathMakePathA(filepath, 0))
|
||||
if (!winpr_PathFileExists(filepath) && !winpr_PathMakePath(filepath, 0))
|
||||
{
|
||||
if (!CreateDirectoryA(filepath, 0))
|
||||
{
|
||||
@ -767,7 +767,8 @@ static BOOL shadow_server_init_certificate(rdpShadowServer* server)
|
||||
if (!server->CertificateFile || !server->PrivateKeyFile)
|
||||
goto out_fail;
|
||||
|
||||
if ((!PathFileExistsA(server->CertificateFile)) || (!PathFileExistsA(server->PrivateKeyFile)))
|
||||
if ((!winpr_PathFileExists(server->CertificateFile)) ||
|
||||
(!winpr_PathFileExists(server->PrivateKeyFile)))
|
||||
{
|
||||
makecert = makecert_context_new();
|
||||
|
||||
@ -780,13 +781,13 @@ static BOOL shadow_server_init_certificate(rdpShadowServer* server)
|
||||
if (makecert_context_set_output_file_name(makecert, "shadow") != 1)
|
||||
goto out_fail;
|
||||
|
||||
if (!PathFileExistsA(server->CertificateFile))
|
||||
if (!winpr_PathFileExists(server->CertificateFile))
|
||||
{
|
||||
if (makecert_context_output_certificate_file(makecert, filepath) != 1)
|
||||
goto out_fail;
|
||||
}
|
||||
|
||||
if (!PathFileExistsA(server->PrivateKeyFile))
|
||||
if (!winpr_PathFileExists(server->PrivateKeyFile))
|
||||
{
|
||||
if (makecert_context_output_private_key_file(makecert, filepath) != 1)
|
||||
goto out_fail;
|
||||
|
||||
@ -316,14 +316,14 @@ int UwacWindowShmAllocBuffers(UwacWindow* w, int nbuffers, int allocSize, uint32
|
||||
|
||||
w->buffers = newBuffers;
|
||||
memset(w->buffers + w->nbuffers, 0, sizeof(UwacBuffer) * nbuffers);
|
||||
fd = uwac_create_anonymous_file(allocSize * nbuffers);
|
||||
fd = uwac_create_anonymous_file(allocSize * nbuffers * 1ULL);
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
return UWAC_ERROR_INTERNAL;
|
||||
}
|
||||
|
||||
data = mmap(NULL, allocSize * nbuffers, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
data = mmap(NULL, allocSize * nbuffers * 1ULL, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
|
||||
if (data == MAP_FAILED)
|
||||
{
|
||||
@ -335,7 +335,7 @@ int UwacWindowShmAllocBuffers(UwacWindow* w, int nbuffers, int allocSize, uint32
|
||||
|
||||
if (!pool)
|
||||
{
|
||||
munmap(data, allocSize * nbuffers);
|
||||
munmap(data, allocSize * nbuffers * 1ULL);
|
||||
ret = UWAC_ERROR_NOMEMORY;
|
||||
goto error_mmap;
|
||||
}
|
||||
@ -755,7 +755,8 @@ UwacReturnCode UwacWindowSubmitBuffer(UwacWindow* window, bool copyContentForNex
|
||||
return UWAC_ERROR_NOMEMORY;
|
||||
|
||||
if (copyContentForNextFrame)
|
||||
memcpy(nextDrawingBuffer->data, pendingBuffer->data, window->stride * window->height);
|
||||
memcpy(nextDrawingBuffer->data, pendingBuffer->data,
|
||||
window->stride * window->height * 1ULL);
|
||||
|
||||
UwacSubmitBufferPtr(window, pendingBuffer);
|
||||
return UWAC_SUCCESS;
|
||||
|
||||
@ -51,7 +51,7 @@ if (NOT WIN32)
|
||||
endif()
|
||||
|
||||
# Soname versioning
|
||||
set(RAW_VERSION_STRING "2.3.0")
|
||||
set(RAW_VERSION_STRING "2.4.0")
|
||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.source_tag")
|
||||
file(READ ${CMAKE_SOURCE_DIR}/.source_tag RAW_VERSION_STRING)
|
||||
elseif(USE_VERSION_FROM_GIT_TAG)
|
||||
|
||||
@ -521,6 +521,8 @@ extern "C"
|
||||
WINPR_API int GetNamePipeFileDescriptor(HANDLE hNamedPipe);
|
||||
WINPR_API HANDLE GetFileHandleForFileDescriptor(int fd);
|
||||
|
||||
WINPR_API FILE* winpr_fopen(const char* path, const char* mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -334,6 +334,12 @@ extern "C"
|
||||
|
||||
#endif
|
||||
|
||||
WINPR_API BOOL winpr_MoveFile(LPCSTR lpExistingFileName, LPCSTR lpNewFileName);
|
||||
WINPR_API BOOL winpr_DeleteFile(const char* lpFileName);
|
||||
WINPR_API BOOL winpr_RemoveDirectory(LPCSTR lpPathName);
|
||||
WINPR_API BOOL winpr_PathFileExists(const char* pszPath);
|
||||
WINPR_API BOOL winpr_PathMakePath(const char* path, LPSECURITY_ATTRIBUTES lpAttributes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -52,6 +52,7 @@ struct _FILEDESCRIPTORW
|
||||
};
|
||||
typedef struct _FILEDESCRIPTORW FILEDESCRIPTORW;
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/* Legacy definition, some types do not match the windows equivalent. */
|
||||
struct _FILEDESCRIPTOR
|
||||
{
|
||||
@ -68,6 +69,7 @@ struct _FILEDESCRIPTOR
|
||||
WCHAR cFileName[260];
|
||||
};
|
||||
typedef struct _FILEDESCRIPTOR FILEDESCRIPTOR;
|
||||
#endif
|
||||
|
||||
/* FILEDESCRIPTOR.dwFlags */
|
||||
typedef enum
|
||||
@ -84,8 +86,11 @@ typedef enum
|
||||
FD_UNICODE = 0x80000000
|
||||
} FD_FLAGS;
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/* Deprecated, here for compatibility */
|
||||
#define FD_SHOWPROGRESSUI FD_PROGRESSUI
|
||||
#define FD_WRITESTIME FD_WRITETIME
|
||||
#endif
|
||||
|
||||
/* FILEDESCRIPTOR.dwFileAttributes */
|
||||
#define FILE_ATTRIBUTE_READONLY 0x00000001
|
||||
|
||||
@ -174,6 +174,7 @@ extern "C"
|
||||
|
||||
#define WAIT_OBJECT_0 0x00000000L
|
||||
#define WAIT_ABANDONED 0x00000080L
|
||||
#define WAIT_IO_COMPLETION 0x000000C0L
|
||||
|
||||
#ifndef WAIT_TIMEOUT
|
||||
#define WAIT_TIMEOUT 0x00000102L
|
||||
@ -202,7 +203,8 @@ extern "C"
|
||||
ULONG Version;
|
||||
DWORD Flags;
|
||||
|
||||
union {
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
HMODULE LocalizedReasonModule;
|
||||
|
||||
@ -213,6 +213,9 @@ extern "C"
|
||||
WINPR_API HANDLE _GetCurrentThread(void);
|
||||
WINPR_API DWORD GetCurrentThreadId(void);
|
||||
|
||||
typedef void (*PAPCFUNC)(ULONG_PTR Parameter);
|
||||
WINPR_API DWORD QueueUserAPC(PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData);
|
||||
|
||||
WINPR_API DWORD ResumeThread(HANDLE hThread);
|
||||
WINPR_API DWORD SuspendThread(HANDLE hThread);
|
||||
WINPR_API BOOL SwitchToThread(void);
|
||||
|
||||
@ -195,10 +195,12 @@ extern "C"
|
||||
WINPR_API wLogLayout* WLog_GetLogLayout(wLog* log);
|
||||
WINPR_API BOOL WLog_Layout_SetPrefixFormat(wLog* log, wLogLayout* layout, const char* format);
|
||||
|
||||
#if !defined(DEFINE_NO_DEPRECATED)
|
||||
/** Deprecated */
|
||||
WINPR_API WINPR_DEPRECATED(BOOL WLog_Init(void));
|
||||
/** Deprecated */
|
||||
WINPR_API WINPR_DEPRECATED(BOOL WLog_Uninit(void));
|
||||
#endif
|
||||
|
||||
typedef BOOL (*wLogCallbackMessage_t)(const wLogMessage* msg);
|
||||
typedef BOOL (*wLogCallbackData_t)(const wLogMessage* msg);
|
||||
|
||||
@ -94,6 +94,7 @@ error:
|
||||
free(file);
|
||||
return NULL;
|
||||
}
|
||||
static UINT posix_file_read_close(struct posix_file* file, BOOL force);
|
||||
|
||||
static void free_posix_file(void* the_file)
|
||||
{
|
||||
@ -102,14 +103,7 @@ static void free_posix_file(void* the_file)
|
||||
if (!file)
|
||||
return;
|
||||
|
||||
if (file->fd >= 0)
|
||||
{
|
||||
if (close(file->fd) < 0)
|
||||
{
|
||||
int err = errno;
|
||||
WLog_WARN(TAG, "failed to close fd %d: %s", file->fd, strerror(err));
|
||||
}
|
||||
}
|
||||
posix_file_read_close(file, TRUE);
|
||||
|
||||
free(file->local_name);
|
||||
free(file->remote_name);
|
||||
@ -836,12 +830,14 @@ error:
|
||||
return ERROR_READ_FAULT;
|
||||
}
|
||||
|
||||
static UINT posix_file_read_close(struct posix_file* file)
|
||||
UINT posix_file_read_close(struct posix_file* file, BOOL force)
|
||||
{
|
||||
if (file->fd < 0)
|
||||
return NO_ERROR;
|
||||
|
||||
if (file->offset == file->size)
|
||||
/* Always force close the file. Clipboard might open hundreds of files
|
||||
* so avoid caching to prevent running out of available file descriptors */
|
||||
if ((file->offset >= file->size) || force || TRUE)
|
||||
{
|
||||
WLog_VRB(TAG, "close file %d", file->fd);
|
||||
|
||||
@ -876,12 +872,9 @@ static UINT posix_file_get_range(struct posix_file* file, UINT64 offset, UINT32
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
error = posix_file_read_close(file);
|
||||
|
||||
if (error)
|
||||
goto out;
|
||||
|
||||
out:
|
||||
|
||||
posix_file_read_close(file, (error != NO_ERROR) && (size > 0));
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ DWORD GetLastError(VOID)
|
||||
PTEB pt = NtCurrentTeb();
|
||||
if (pt)
|
||||
{
|
||||
return NtCurrentTeb()->LastErrorValue;
|
||||
return pt->LastErrorValue;
|
||||
}
|
||||
return ERROR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
@ -766,7 +766,7 @@ static HANDLE FileCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dw
|
||||
}
|
||||
}
|
||||
|
||||
fp = fopen(pFile->lpFileName, "ab");
|
||||
fp = winpr_fopen(pFile->lpFileName, "ab");
|
||||
if (!fp)
|
||||
{
|
||||
SetLastError(map_posix_err(errno));
|
||||
@ -800,7 +800,7 @@ static HANDLE FileCreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dw
|
||||
}
|
||||
|
||||
if (NULL == fp)
|
||||
fp = fopen(pFile->lpFileName, mode);
|
||||
fp = winpr_fopen(pFile->lpFileName, mode);
|
||||
|
||||
pFile->fp = fp;
|
||||
if (!pFile->fp)
|
||||
@ -1358,3 +1358,30 @@ HANDLE GetFileHandleForFileDescriptor(int fd)
|
||||
return (HANDLE)pFile;
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
FILE* winpr_fopen(const char* path, const char* mode)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
return fopen(path, mode);
|
||||
#else
|
||||
LPWSTR lpPathW = NULL;
|
||||
LPWSTR lpModeW = NULL;
|
||||
FILE* result = NULL;
|
||||
|
||||
if (!path || !mode)
|
||||
return NULL;
|
||||
|
||||
if (ConvertToUnicode(CP_UTF8, 0, path, -1, &lpPathW, 0) < 1)
|
||||
goto cleanup;
|
||||
|
||||
if (ConvertToUnicode(CP_UTF8, 0, mode, -1, &lpModeW, 0) < 1)
|
||||
goto cleanup;
|
||||
|
||||
result = _wfopen(lpPathW, lpModeW);
|
||||
|
||||
cleanup:
|
||||
free(lpPathW);
|
||||
free(lpModeW);
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ int TestFileCreateFile(int argc, char* argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!PathFileExistsA(name))
|
||||
if (!winpr_PathFileExists(name))
|
||||
rc = -1;
|
||||
|
||||
if (!WriteFile(handle, buffer, sizeof(buffer), &written, NULL))
|
||||
@ -81,10 +81,10 @@ int TestFileCreateFile(int argc, char* argv[])
|
||||
if (!CloseHandle(handle))
|
||||
rc = -1;
|
||||
|
||||
if (!DeleteFileA(name))
|
||||
if (!winpr_DeleteFile(name))
|
||||
rc = -1;
|
||||
|
||||
if (PathFileExistsA(name))
|
||||
if (winpr_PathFileExists(name))
|
||||
rc = -1;
|
||||
|
||||
free(name);
|
||||
|
||||
@ -135,7 +135,7 @@ NTSTATUS _IoCreateDeviceEx(PDRIVER_OBJECT_EX DriverObject, ULONG DeviceExtension
|
||||
if (!DeviceBasePath)
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
if (!PathFileExistsA(DeviceBasePath))
|
||||
if (!winpr_PathFileExists(DeviceBasePath))
|
||||
{
|
||||
if (mkdir(DeviceBasePath, S_IRUSR | S_IWUSR | S_IXUSR) != 0)
|
||||
{
|
||||
@ -169,7 +169,7 @@ NTSTATUS _IoCreateDeviceEx(PDRIVER_OBJECT_EX DriverObject, ULONG DeviceExtension
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (PathFileExistsA(pDeviceObjectEx->DeviceFileName))
|
||||
if (winpr_PathFileExists(pDeviceObjectEx->DeviceFileName))
|
||||
{
|
||||
if (unlink(pDeviceObjectEx->DeviceFileName) == -1)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user