diff options
Diffstat (limited to 'libfreerdp/core/test')
-rw-r--r-- | libfreerdp/core/test/CMakeLists.txt | 54 | ||||
-rw-r--r-- | libfreerdp/core/test/TestConnect.c | 338 | ||||
-rw-r--r-- | libfreerdp/core/test/TestFuzzCryptoCertificateDataSetPEM.c | 22 | ||||
-rw-r--r-- | libfreerdp/core/test/TestSettings.c | 1159 | ||||
-rw-r--r-- | libfreerdp/core/test/TestStreamDump.c | 104 | ||||
-rw-r--r-- | libfreerdp/core/test/TestVersion.c | 44 | ||||
-rw-r--r-- | libfreerdp/core/test/settings_property_lists.h | 489 |
7 files changed, 2210 insertions, 0 deletions
diff --git a/libfreerdp/core/test/CMakeLists.txt b/libfreerdp/core/test/CMakeLists.txt new file mode 100644 index 0000000..3e0a652 --- /dev/null +++ b/libfreerdp/core/test/CMakeLists.txt @@ -0,0 +1,54 @@ + +set(MODULE_NAME "TestCore") +set(MODULE_PREFIX "TEST_CORE") + +set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c) + +set(${MODULE_PREFIX}_TESTS + TestVersion.c + TestStreamDump.c + TestSettings.c) + +set(${MODULE_PREFIX}_FUZZERS + TestFuzzCryptoCertificateDataSetPEM.c) + +if(WITH_SAMPLE AND WITH_SERVER AND NOT WIN32) + add_definitions(-DCMAKE_EXECUTABLE_SUFFIX="${CMAKE_EXECUTABLE_SUFFIX}") + set(${MODULE_PREFIX}_TESTS + ${${MODULE_PREFIX}_TESTS} + TestConnect.c) +else() + message("Skipping connection tests, requires WITH_SAMPLE and WITH_SERVER set!") +endif() + +create_test_sourcelist(${MODULE_PREFIX}_SRCS + ${${MODULE_PREFIX}_DRIVER} + ${${MODULE_PREFIX}_TESTS}) + +add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) + +add_definitions(-DTESTING_OUTPUT_DIRECTORY="${PROJECT_BINARY_DIR}") +add_definitions(-DTESTING_SRC_DIRECTORY="${PROJECT_SOURCE_DIR}") + +target_link_libraries(${MODULE_NAME} freerdp winpr freerdp-client) + +if (BUILD_FUZZERS) + foreach(test ${${MODULE_PREFIX}_FUZZERS}) + get_filename_component(TestName ${test} NAME_WE) + add_executable(${TestName} ${test}) + target_link_libraries(${TestName} freerdp winpr freerdp-client fuzzer_config) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) + set_target_properties(${TestName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") + add_dependencies(fuzzers ${TestName}) + endforeach() +endif (BUILD_FUZZERS) + +set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}") + +foreach(test ${${MODULE_PREFIX}_TESTS}) + get_filename_component(TestName ${test} NAME_WE) + add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName}) +endforeach() + +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Core/Test") + diff --git a/libfreerdp/core/test/TestConnect.c b/libfreerdp/core/test/TestConnect.c new file mode 100644 index 0000000..4a3b89a --- /dev/null +++ b/libfreerdp/core/test/TestConnect.c @@ -0,0 +1,338 @@ +#include <winpr/sysinfo.h> +#include <winpr/path.h> +#include <winpr/crypto.h> +#include <winpr/pipe.h> + +#include <freerdp/freerdp.h> +#include <freerdp/gdi/gdi.h> +#include <freerdp/client/cmdline.h> + +static HANDLE s_sync = NULL; + +static int runInstance(int argc, char* argv[], freerdp** inst, DWORD timeout) +{ + int rc = -1; + RDP_CLIENT_ENTRY_POINTS clientEntryPoints = { 0 }; + rdpContext* context = NULL; + + clientEntryPoints.Size = sizeof(RDP_CLIENT_ENTRY_POINTS); + clientEntryPoints.Version = RDP_CLIENT_INTERFACE_VERSION; + clientEntryPoints.ContextSize = sizeof(rdpContext); + context = freerdp_client_context_new(&clientEntryPoints); + + if (!context) + goto finish; + + if (inst) + *inst = context->instance; + + context->instance->ChooseSmartcard = NULL; + context->instance->PresentGatewayMessage = NULL; + context->instance->LogonErrorInfo = NULL; + context->instance->AuthenticateEx = NULL; + context->instance->VerifyCertificateEx = NULL; + context->instance->VerifyChangedCertificateEx = NULL; + + if (!freerdp_settings_set_bool(context->settings, FreeRDP_DeactivateClientDecoding, TRUE)) + return FALSE; + + if (freerdp_client_settings_parse_command_line(context->settings, argc, argv, FALSE) < 0) + goto finish; + + if (!freerdp_settings_set_uint32(context->settings, FreeRDP_TcpConnectTimeout, timeout)) + goto finish; + + if (!freerdp_client_load_addins(context->channels, context->settings)) + goto finish; + + if (s_sync) + { + if (!SetEvent(s_sync)) + goto finish; + } + + rc = 1; + + if (!freerdp_connect(context->instance)) + goto finish; + + rc = 2; + + if (!freerdp_disconnect(context->instance)) + goto finish; + + rc = 0; +finish: + freerdp_client_context_free(context); + if (inst) + *inst = NULL; + return rc; +} + +static int testTimeout(int port) +{ + const DWORD timeout = 200; + DWORD start = 0; + DWORD end = 0; + DWORD diff = 0; + char arg1[] = "/v:192.0.2.1:XXXXX"; + char* argv[] = { "test", "/v:192.0.2.1:XXXXX" }; + int rc = 0; + _snprintf(arg1, 18, "/v:192.0.2.1:%d", port); + argv[1] = arg1; + start = GetTickCount(); + rc = runInstance(ARRAYSIZE(argv), argv, NULL, timeout); + end = GetTickCount(); + + if (rc != 1) + return -1; + + diff = end - start; + + if (diff > 4 * timeout) + return -1; + + if (diff < timeout) + return -1; + + printf("%s: Success!\n", __func__); + return 0; +} + +struct testThreadArgs +{ + int port; + freerdp** arg; +}; + +static DWORD WINAPI testThread(LPVOID arg) +{ + char arg1[] = "/v:192.0.2.1:XXXXX"; + char* argv[] = { "test", "/v:192.0.2.1:XXXXX" }; + int rc = 0; + struct testThreadArgs* args = arg; + _snprintf(arg1, 18, "/v:192.0.2.1:%d", args->port); + argv[1] = arg1; + rc = runInstance(ARRAYSIZE(argv), argv, args->arg, 5000); + + if (rc != 1) + ExitThread(-1); + + ExitThread(0); + return 0; +} + +static int testAbort(int port) +{ + DWORD status = 0; + DWORD start = 0; + DWORD end = 0; + DWORD diff = 0; + HANDLE thread = NULL; + struct testThreadArgs args; + freerdp* instance = NULL; + s_sync = CreateEvent(NULL, TRUE, FALSE, NULL); + + if (!s_sync) + return -1; + + args.port = port; + args.arg = &instance; + start = GetTickCount(); + thread = CreateThread(NULL, 0, testThread, &args, 0, NULL); + + if (!thread) + { + CloseHandle(s_sync); + s_sync = NULL; + return -1; + } + + WaitForSingleObject(s_sync, INFINITE); + Sleep(100); /* Wait until freerdp_connect has been called */ + if (instance) + { + freerdp_abort_connect_context(instance->context); + + if (!freerdp_shall_disconnect_context(instance->context)) + { + CloseHandle(s_sync); + CloseHandle(thread); + s_sync = NULL; + return -1; + } + } + + status = WaitForSingleObject(thread, 20000); + end = GetTickCount(); + CloseHandle(s_sync); + CloseHandle(thread); + s_sync = NULL; + diff = end - start; + + if (diff > 5000) + { + printf("%s required %" PRIu32 "ms for the test\n", __func__, diff); + return -1; + } + + if (WAIT_OBJECT_0 != status) + return -1; + + printf("%s: Success!\n", __func__); + return 0; +} + +static char* concatenate(size_t count, ...) +{ + char* rc = NULL; + va_list ap; + va_start(ap, count); + rc = _strdup(va_arg(ap, char*)); + for (size_t x = 1; x < count; x++) + { + const char* cur = va_arg(ap, const char*); + char* tmp = GetCombinedPath(rc, cur); + free(rc); + rc = tmp; + } + va_end(ap); + return rc; +} + +static BOOL prepare_certificates(const char* path) +{ + BOOL rc = FALSE; + char* exe = NULL; + DWORD status = 0; + STARTUPINFOA si = { 0 }; + PROCESS_INFORMATION process = { 0 }; + char commandLine[8192] = { 0 }; + + if (!path) + return FALSE; + + exe = concatenate(5, TESTING_OUTPUT_DIRECTORY, "winpr", "tools", "makecert-cli", + "winpr-makecert" CMAKE_EXECUTABLE_SUFFIX); + if (!exe) + return FALSE; + _snprintf(commandLine, sizeof(commandLine), "%s -format crt -path . -n server", exe); + + rc = CreateProcessA(exe, commandLine, NULL, NULL, TRUE, 0, NULL, path, &si, &process); + free(exe); + if (!rc) + goto fail; + status = WaitForSingleObject(process.hProcess, 30000); + if (status != WAIT_OBJECT_0) + goto fail; + rc = TRUE; +fail: + CloseHandle(process.hProcess); + CloseHandle(process.hThread); + return rc; +} + +static int testSuccess(int port) +{ + int r = 0; + int rc = -2; + STARTUPINFOA si = { 0 }; + PROCESS_INFORMATION process = { 0 }; + char arg1[] = "/v:127.0.0.1:XXXXX"; + char* clientArgs[] = { "test", "/v:127.0.0.1:XXXXX", "/cert:ignore", "/rfx", NULL }; + char* commandLine = NULL; + size_t commandLineLen = 0; + int argc = 4; + char* path = NULL; + char* wpath = NULL; + char* exe = GetCombinedPath(TESTING_OUTPUT_DIRECTORY, "server"); + _snprintf(arg1, 18, "/v:127.0.0.1:%d", port); + clientArgs[1] = arg1; + + if (!exe) + goto fail; + + path = GetCombinedPath(exe, "Sample"); + wpath = GetCombinedPath(exe, "Sample"); + free(exe); + exe = NULL; + + if (!path || !wpath) + goto fail; + + exe = GetCombinedPath(path, "sfreerdp-server" CMAKE_EXECUTABLE_SUFFIX); + + if (!exe) + goto fail; + + printf("Sample Server: %s\n", exe); + printf("Workspace: %s\n", wpath); + + if (!winpr_PathFileExists(exe)) + goto fail; + + if (!prepare_certificates(wpath)) + goto fail; + + // Start sample server locally. + commandLineLen = strlen(exe) + strlen("--port=XXXXX") + 1; + commandLine = malloc(commandLineLen); + + if (!commandLine) + goto fail; + + _snprintf(commandLine, commandLineLen, "%s --port=%d", exe, port); + si.cb = sizeof(si); + + if (!CreateProcessA(NULL, commandLine, NULL, NULL, FALSE, 0, NULL, wpath, &si, &process)) + goto fail; + + Sleep(5000); /* let the server start */ + r = runInstance(argc, clientArgs, NULL, 10000); + + if (!TerminateProcess(process.hProcess, 0)) + goto fail; + + WaitForSingleObject(process.hProcess, INFINITE); + CloseHandle(process.hProcess); + CloseHandle(process.hThread); + printf("%s: returned %d!\n", __func__, r); + rc = r; + + if (rc == 0) + printf("%s: Success!\n", __func__); + +fail: + free(exe); + free(path); + free(wpath); + free(commandLine); + return rc; +} + +int TestConnect(int argc, char* argv[]) +{ + int randomPort = 0; + int random = 0; + WINPR_UNUSED(argc); + WINPR_UNUSED(argv); + winpr_RAND(&random, sizeof(random)); + randomPort = 3389 + (random % 200); + + /* Test connect to not existing server, + * check if timeout is honored. */ + if (testTimeout(randomPort)) + return -1; + + /* Test connect to not existing server, + * check if connection abort is working. */ + if (testAbort(randomPort)) + return -1; + + /* Test connect to existing server, + * check if connection is working. */ + if (testSuccess(randomPort)) + return -1; + + return 0; +} diff --git a/libfreerdp/core/test/TestFuzzCryptoCertificateDataSetPEM.c b/libfreerdp/core/test/TestFuzzCryptoCertificateDataSetPEM.c new file mode 100644 index 0000000..2032715 --- /dev/null +++ b/libfreerdp/core/test/TestFuzzCryptoCertificateDataSetPEM.c @@ -0,0 +1,22 @@ +#include <stddef.h> +#include <stdint.h> +#include <freerdp/crypto/certificate_store.h> + +int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) +{ + rdpCertificateData* data = NULL; + char* pem = calloc(Size + 1, sizeof(char)); + if (pem == NULL) + goto cleanup; + memcpy(pem, Data, Size); + + data = freerdp_certificate_data_new_from_pem("somehost", 1234, pem, Size); + if (!data) + goto cleanup; + +cleanup: + freerdp_certificate_data_free(data); + free(pem); + + return 0; +} diff --git a/libfreerdp/core/test/TestSettings.c b/libfreerdp/core/test/TestSettings.c new file mode 100644 index 0000000..ea21cb3 --- /dev/null +++ b/libfreerdp/core/test/TestSettings.c @@ -0,0 +1,1159 @@ +#include <stdio.h> + +#include <winpr/crypto.h> + +#include <freerdp/settings.h> +#include <freerdp/codecs.h> + +#include "settings_property_lists.h" + +static BOOL log_result(BOOL value, const char* fkt) +{ + fprintf(stderr, "TestSettings [%s] returned %s\n", fkt, value ? "TRUE" : "FALSE"); + return value; +} + +static BOOL compare(const ADDIN_ARGV* got, const ADDIN_ARGV* expect) +{ + BOOL rc = TRUE; + if (!got && !expect) + return FALSE; + if (!got && expect) + return FALSE; + if (got && !expect) + return FALSE; + if (got->argc != expect->argc) + return FALSE; + + for (int x = 0; x < expect->argc; x++) + { + if (strcmp(got->argv[x], expect->argv[x]) != 0) + rc = FALSE; + } + return log_result(rc, __func__); +} + +static BOOL test_dyn_channels(void) +{ + BOOL rc = FALSE; + BOOL test = 0; + UINT32 u32 = 0; + rdpSettings* settings = freerdp_settings_new(0); + const char* argv1[] = { "foobar" }; + ADDIN_ARGV* args1 = NULL; + const ADDIN_ARGV* cmp1 = NULL; + const char* argv2[] = { "gaga", "abba", "foo" }; + ADDIN_ARGV* args2 = NULL; + const ADDIN_ARGV* cmp2 = NULL; + const ADDIN_ARGV* got = NULL; + + if (!settings) + goto fail; + + u32 = freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelCount); + if (u32 != 0) + goto fail; + + /* Test the function return an error for unknown channels */ + test = freerdp_dynamic_channel_collection_del(settings, "foobar"); + if (test) + goto fail; + got = freerdp_dynamic_channel_collection_find(settings, "foobar"); + if (got) + goto fail; + + /* Add the channel */ + cmp1 = args1 = freerdp_addin_argv_new(ARRAYSIZE(argv1), argv1); + test = freerdp_dynamic_channel_collection_add(settings, args1); + if (!test) + goto fail; + args1 = NULL; /* settings have taken ownership */ + + u32 = freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelCount); + if (u32 != 1) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelArraySize); + if (u32 < 1) + goto fail; + + cmp2 = args2 = freerdp_addin_argv_new(ARRAYSIZE(argv2), argv2); + test = freerdp_dynamic_channel_collection_add(settings, args2); + if (!test) + goto fail; + args2 = NULL; /* settings have taken ownership */ + + u32 = freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelCount); + if (u32 != 2) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelArraySize); + if (u32 < 2) + goto fail; + + /* Test the function return success for known channels */ + got = freerdp_dynamic_channel_collection_find(settings, "foobar"); + if (!compare(got, cmp1)) + goto fail; + got = freerdp_dynamic_channel_collection_find(settings, "gaga"); + if (!compare(got, cmp2)) + goto fail; + test = freerdp_dynamic_channel_collection_del(settings, "foobar"); + if (!test) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelCount); + if (u32 != 1) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelArraySize); + if (u32 < 1) + goto fail; + got = freerdp_dynamic_channel_collection_find(settings, "foobar"); + if (compare(got, cmp1)) + goto fail; + got = freerdp_dynamic_channel_collection_find(settings, "gaga"); + if (!compare(got, cmp2)) + goto fail; + test = freerdp_dynamic_channel_collection_del(settings, "gaga"); + if (!test) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_DynamicChannelCount); + if (u32 != 0) + goto fail; + got = freerdp_dynamic_channel_collection_find(settings, "foobar"); + if (compare(got, cmp1)) + goto fail; + got = freerdp_dynamic_channel_collection_find(settings, "gaga"); + if (compare(got, cmp2)) + goto fail; + + rc = TRUE; + +fail: + freerdp_settings_free(settings); + freerdp_addin_argv_free(args1); + freerdp_addin_argv_free(args2); + return log_result(rc, __func__); +} + +static BOOL test_static_channels(void) +{ + BOOL rc = FALSE; + BOOL test = 0; + UINT32 u32 = 0; + rdpSettings* settings = freerdp_settings_new(0); + const char* argv1[] = { "foobar" }; + ADDIN_ARGV* args1 = NULL; + const ADDIN_ARGV* cmp1 = NULL; + const char* argv2[] = { "gaga", "abba", "foo" }; + ADDIN_ARGV* args2 = NULL; + const ADDIN_ARGV* cmp2 = NULL; + const ADDIN_ARGV* got = NULL; + + if (!settings) + goto fail; + + u32 = freerdp_settings_get_uint32(settings, FreeRDP_StaticChannelCount); + if (u32 != 0) + goto fail; + + /* Test the function return an error for unknown channels */ + test = freerdp_static_channel_collection_del(settings, "foobar"); + if (test) + goto fail; + got = freerdp_static_channel_collection_find(settings, "foobar"); + if (got) + goto fail; + + /* Add the channel */ + cmp1 = args1 = freerdp_addin_argv_new(ARRAYSIZE(argv1), argv1); + test = freerdp_static_channel_collection_add(settings, args1); + if (!test) + goto fail; + args1 = NULL; /* settings have taken ownership */ + + u32 = freerdp_settings_get_uint32(settings, FreeRDP_StaticChannelCount); + if (u32 != 1) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_StaticChannelArraySize); + if (u32 < 1) + goto fail; + + cmp2 = args2 = freerdp_addin_argv_new(ARRAYSIZE(argv2), argv2); + test = freerdp_static_channel_collection_add(settings, args2); + if (!test) + goto fail; + args2 = NULL; /* settings have taken ownership */ + + u32 = freerdp_settings_get_uint32(settings, FreeRDP_StaticChannelCount); + if (u32 != 2) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_StaticChannelArraySize); + if (u32 < 2) + goto fail; + + /* Test the function return success for known channels */ + got = freerdp_static_channel_collection_find(settings, "foobar"); + if (!compare(got, cmp1)) + goto fail; + got = freerdp_static_channel_collection_find(settings, "gaga"); + if (!compare(got, cmp2)) + goto fail; + test = freerdp_static_channel_collection_del(settings, "foobar"); + if (!test) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_StaticChannelCount); + if (u32 != 1) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_StaticChannelArraySize); + if (u32 < 1) + goto fail; + got = freerdp_static_channel_collection_find(settings, "foobar"); + if (compare(got, cmp1)) + goto fail; + got = freerdp_static_channel_collection_find(settings, "gaga"); + if (!compare(got, cmp2)) + goto fail; + test = freerdp_static_channel_collection_del(settings, "gaga"); + if (!test) + goto fail; + u32 = freerdp_settings_get_uint32(settings, FreeRDP_StaticChannelCount); + if (u32 != 0) + goto fail; + got = freerdp_static_channel_collection_find(settings, "foobar"); + if (compare(got, cmp1)) + goto fail; + got = freerdp_static_channel_collection_find(settings, "gaga"); + if (compare(got, cmp2)) + goto fail; + + rc = TRUE; + +fail: + freerdp_settings_free(settings); + freerdp_addin_argv_free(args1); + freerdp_addin_argv_free(args2); + return log_result(rc, __func__); +} + +static BOOL test_copy(void) +{ + BOOL rc = FALSE; + wLog* log = WLog_Get(__func__); + rdpSettings* settings = freerdp_settings_new(0); + rdpSettings* copy = freerdp_settings_clone(settings); + rdpSettings* modified = freerdp_settings_clone(settings); + + if (!settings || !copy || !modified) + goto fail; + if (!freerdp_settings_set_string(modified, FreeRDP_ServerHostname, "somerandomname")) + goto fail; + if (freerdp_settings_print_diff(log, WLOG_WARN, settings, copy)) + goto fail; + if (!freerdp_settings_print_diff(log, WLOG_WARN, settings, modified)) + goto fail; + + rc = TRUE; + +fail: + freerdp_settings_free(settings); + freerdp_settings_free(copy); + freerdp_settings_free(modified); + return log_result(rc, __func__); +} + +static BOOL test_helpers(void) +{ + BOOL rc = FALSE; + UINT32 flags = 0; + rdpSettings* settings = freerdp_settings_new(0); + if (!settings) + goto fail; + if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec, TRUE)) + goto fail; + if (!freerdp_settings_set_bool(settings, FreeRDP_NSCodec, TRUE)) + goto fail; + flags = freerdp_settings_get_codecs_flags(settings); + if (flags != FREERDP_CODEC_ALL) + goto fail; + + if (!freerdp_settings_set_bool(settings, FreeRDP_NSCodec, FALSE)) + goto fail; + flags = freerdp_settings_get_codecs_flags(settings); + if (flags != (FREERDP_CODEC_ALL & ~FREERDP_CODEC_NSCODEC)) + goto fail; + + if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec, FALSE)) + goto fail; + flags = freerdp_settings_get_codecs_flags(settings); + if (flags != (FREERDP_CODEC_ALL & ~(FREERDP_CODEC_NSCODEC | FREERDP_CODEC_REMOTEFX))) + goto fail; + + if (!freerdp_settings_set_bool(settings, FreeRDP_NSCodec, TRUE)) + goto fail; + flags = freerdp_settings_get_codecs_flags(settings); + if (flags != (FREERDP_CODEC_ALL & ~FREERDP_CODEC_REMOTEFX)) + goto fail; + + rc = TRUE; +fail: + freerdp_settings_free(settings); + return log_result(rc, __func__); +} + +static BOOL format_uint(char* buffer, size_t size, UINT64 value, UINT16 intType, UINT64 max) +{ + const UINT64 lvalue = value > max ? max : value; + intType = intType % 3; + switch (intType) + { + case 0: + _snprintf(buffer, size, "%" PRIu64, lvalue); + return TRUE; + case 1: + _snprintf(buffer, size, "0x%" PRIx64, lvalue); + return TRUE; + case 2: + if (max < UINT64_MAX) + _snprintf(buffer, size, "%" PRIu64, max + 1); + else + _snprintf(buffer, size, "too large a number"); + return FALSE; + default: + _snprintf(buffer, size, "not a number value"); + return FALSE; + } +} + +static BOOL print_negative(char* buffer, size_t size, INT64 value, INT64 min) +{ + switch (min) + { + case INT16_MIN: + _snprintf(buffer, size, "%" PRId16, (INT16)value); + return FALSE; + case INT32_MIN: + _snprintf(buffer, size, "%" PRId32, (INT32)value); + return FALSE; + case INT64_MIN: + _snprintf(buffer, size, "%" PRId64, (INT64)value); + return FALSE; + default: + _snprintf(buffer, size, "too small a number"); + return FALSE; + } +} + +static BOOL print_xpositive(char* buffer, size_t size, INT64 value, INT64 max) +{ + if (value < 0) + { + _snprintf(buffer, size, "%" PRId64, value); + return TRUE; + } + + switch (max) + { + case INT16_MAX: + _snprintf(buffer, size, "%" PRIx16, (INT16)value); + return FALSE; + case INT32_MAX: + _snprintf(buffer, size, "%" PRIx32, (INT32)value); + return FALSE; + case INT64_MAX: + _snprintf(buffer, size, "%" PRIx64, (INT64)value); + return FALSE; + default: + _snprintf(buffer, size, "too small a number"); + return FALSE; + } +} + +static BOOL format_int(char* buffer, size_t size, INT64 value, UINT16 intType, INT64 max, INT64 min) +{ + const INT64 lvalue = (value > max) ? max : ((value < min) ? min : value); + intType = intType % 4; + + switch (intType) + { + case 0: + _snprintf(buffer, size, "%" PRId64, lvalue); + return TRUE; + case 1: + print_xpositive(buffer, size, lvalue, max); + return TRUE; + case 2: + if (max < INT64_MAX) + _snprintf(buffer, size, "%" PRId64, max + 1); + else + _snprintf(buffer, size, "too large a number"); + return FALSE; + case 3: + if (min < INT64_MIN) + print_negative(buffer, size, min - 1, INT64_MIN); + else + _snprintf(buffer, size, "too small a number"); + return FALSE; + default: + _snprintf(buffer, size, "not a number value"); + return FALSE; + } +} + +static BOOL format_bool(char* buffer, size_t size, UINT16 intType) +{ + intType = intType % 10; + switch (intType) + { + case 0: + _snprintf(buffer, size, "FALSE"); + return TRUE; + case 1: + _snprintf(buffer, size, "FaLsE"); + return TRUE; + case 2: + _snprintf(buffer, size, "False"); + return TRUE; + case 3: + _snprintf(buffer, size, "false"); + return TRUE; + case 4: + _snprintf(buffer, size, "falseentry"); + return FALSE; + case 5: + _snprintf(buffer, size, "TRUE"); + return TRUE; + case 6: + _snprintf(buffer, size, "TrUe"); + return TRUE; + case 7: + _snprintf(buffer, size, "True"); + return TRUE; + case 8: + _snprintf(buffer, size, "true"); + return TRUE; + case 9: + _snprintf(buffer, size, "someentry"); + return FALSE; + default: + _snprintf(buffer, size, "ok"); + return FALSE; + } +} + +static BOOL check_key_helpers(size_t key, const char* stype) +{ + int test_rounds = 100; + BOOL res = FALSE; + rdpSettings* settings = NULL; + SSIZE_T rc = 0; + SSIZE_T tkey = 0; + SSIZE_T type = 0; + const size_t clear_keys[] = { FreeRDP_RdpServerCertificate, + FreeRDP_RdpServerRsaKey, + FreeRDP_RedirectionPassword, + FreeRDP_RedirectionTsvUrl, + FreeRDP_LoadBalanceInfo, + FreeRDP_ServerRandom, + FreeRDP_ClientRandom, + FreeRDP_ServerCertificate, + FreeRDP_TargetNetAddresses, + FreeRDP_ReceivedCapabilities, + FreeRDP_ServerLicenseProductIssuers, + FreeRDP_TargetNetPorts, + FreeRDP_DeviceArray, + FreeRDP_ChannelDefArray, + FreeRDP_MonitorDefArray, + FreeRDP_ClientAutoReconnectCookie, + FreeRDP_ServerAutoReconnectCookie, + FreeRDP_ClientTimeZone, + FreeRDP_BitmapCacheV2CellInfo, + FreeRDP_GlyphCache, + FreeRDP_FragCache, + FreeRDP_StaticChannelArray, + FreeRDP_DynamicChannelArray, + FreeRDP_ReceivedCapabilities, + FreeRDP_OrderSupport, + FreeRDP_MonitorIds }; + const char* name = freerdp_settings_get_name_for_key(key); + if (!name) + { + printf("[%s] missing name for key %" PRIuz "\n", stype, key); + return FALSE; + } + tkey = freerdp_settings_get_key_for_name(name); + if (tkey < 0) + { + printf("[%s] missing reverse name for key %s [%" PRIuz "]\n", stype, name, key); + return FALSE; + } + if ((size_t)tkey != key) + { + printf("[%s] mismatch reverse name for key %s [%" PRIuz "]: %" PRIdz "\n", stype, name, key, + tkey); + return FALSE; + } + type = freerdp_settings_get_type_for_name(name); + if (type < 0) + { + printf("[%s] missing reverse type for key %s [%" PRIuz "]\n", stype, name, key); + return FALSE; + } + rc = freerdp_settings_get_type_for_key(key); + if (rc < 0) + { + printf("[%s] missing reverse name for key %s [%" PRIuz "]\n", stype, name, key); + return FALSE; + } + + if (rc != type) + { + printf("[%s] mismatch reverse type for key %s [%" PRIuz "]: %" PRIdz " <--> %" PRIdz "\n", + stype, name, key, rc, type); + return FALSE; + } + + settings = freerdp_settings_new(0); + if (!settings) + { + printf("[%s] freerdp_settings_new failed\n", stype); + goto fail; + } + for (size_t x = 0; x < ARRAYSIZE(clear_keys); x++) + { + const size_t id = clear_keys[x]; + const char* foo = freerdp_settings_get_name_for_key(id); + if (!freerdp_settings_set_pointer_len(settings, id, NULL, 0)) + { + printf("[%s] freerdp_settings_set_pointer_len(%s, NULL, 0) failed\n", stype, foo); + goto fail; + } + } + do + { + UINT16 intEntryType = 0; + BOOL expect = 0; + BOOL have = 0; + char value[8192] = { 0 }; + union + { + UINT64 u64; + INT64 i64; + UINT32 u32; + INT32 i32; + UINT16 u16; + INT16 i16; + void* pv; + } val; + + winpr_RAND(&intEntryType, sizeof(intEntryType)); + winpr_RAND(&val.u64, sizeof(val.u64)); + + switch (type) + { + case RDP_SETTINGS_TYPE_BOOL: + expect = format_bool(value, sizeof(value), intEntryType); + break; + case RDP_SETTINGS_TYPE_UINT16: + expect = format_uint(value, sizeof(value), val.u64, intEntryType, UINT16_MAX); + break; + case RDP_SETTINGS_TYPE_INT16: + expect = + format_int(value, sizeof(value), val.i64, intEntryType, INT16_MAX, INT16_MIN); + break; + case RDP_SETTINGS_TYPE_UINT32: + expect = format_uint(value, sizeof(value), val.u64, intEntryType, UINT32_MAX); + break; + case RDP_SETTINGS_TYPE_INT32: + expect = + format_int(value, sizeof(value), val.i64, intEntryType, INT32_MAX, INT32_MIN); + break; + case RDP_SETTINGS_TYPE_UINT64: + expect = format_uint(value, sizeof(value), val.u64, intEntryType, UINT64_MAX); + break; + case RDP_SETTINGS_TYPE_INT64: + expect = + format_int(value, sizeof(value), val.i64, intEntryType, INT64_MAX, INT64_MIN); + break; + case RDP_SETTINGS_TYPE_STRING: + expect = TRUE; + _snprintf(value, sizeof(value), "somerandomstring"); + break; + case RDP_SETTINGS_TYPE_POINTER: + expect = FALSE; + break; + + default: + printf("[%s] invalid type for key %s [%" PRIuz "]: %" PRIdz " <--> %" PRIdz "\n", + stype, name, key, rc, type); + goto fail; + } + + have = freerdp_settings_set_value_for_name(settings, name, value); + if (have != expect) + { + printf("[%s] have[%s] != expect[%s]\n", stype, have ? "TRUE" : "FALSE", + expect ? "TRUE" : "FALSE"); + goto fail; + } + + } while (test_rounds-- > 0); + + res = TRUE; +fail: + freerdp_settings_free(settings); + return log_result(res, __func__); +} + +static BOOL check_args(const RDPDR_DEVICE* what, size_t count, const char* args[]) +{ + WINPR_ASSERT(what); + + if (count > 0) + { + if (strcmp(what->Name, args[0]) != 0) + return FALSE; + } + + switch (what->Type) + { + case RDPDR_DTYP_PRINT: + { + const RDPDR_PRINTER* a = (const RDPDR_PRINTER*)what; + if (count <= 1) + return TRUE; + if (!a->DriverName) + return FALSE; + return strcmp(a->DriverName, args[1]) == 0; + } + + case RDPDR_DTYP_SERIAL: + { + const RDPDR_SERIAL* a = (const RDPDR_SERIAL*)what; + + if (count > 1) + { + if (!a->Path) + return FALSE; + if (strcmp(a->Path, args[1]) != 0) + return FALSE; + } + + if (count > 2) + { + if (!a->Driver) + return FALSE; + if (strcmp(a->Driver, args[2]) != 0) + return FALSE; + } + + if (count > 3) + { + if (!a->Permissive) + return FALSE; + if (strcmp(a->Permissive, args[3]) != 0) + return FALSE; + } + return TRUE; + } + + case RDPDR_DTYP_PARALLEL: + { + const RDPDR_PARALLEL* a = (const RDPDR_PARALLEL*)what; + if (count <= 1) + return TRUE; + if (!a->Path) + return FALSE; + return strcmp(a->Path, args[1]) == 0; + } + + case RDPDR_DTYP_SMARTCARD: + return TRUE; + + case RDPDR_DTYP_FILESYSTEM: + { + const RDPDR_DRIVE* a = (const RDPDR_DRIVE*)what; + if (count > 1) + { + if (!a->Path) + return FALSE; + if (strcmp(a->Path, args[1]) != 0) + return FALSE; + } + if (count > 2) + { + return a->automount == (args[2] == NULL) ? TRUE : FALSE; + } + else + return !a->automount; + } + + default: + return FALSE; + } +} + +static int check_device_type_arg(UINT32 Type, size_t count, const char* args[]) +{ + int rc = -3; + RDPDR_DEVICE* device = freerdp_device_new(Type, count, args); + RDPDR_DEVICE* clone = freerdp_device_clone(device); + + if (!device) + goto fail; + + rc++; + if (!clone) + goto fail; + + rc++; + if (!check_args(device, count, args)) + goto fail; + + rc++; + if (!freerdp_device_equal(clone, device)) + goto fail; + rc++; + +fail: + freerdp_device_free(device); + freerdp_device_free(clone); + return log_result(rc, __func__); +} + +static BOOL check_device_type(void) +{ + struct test_entry + { + int expect; + UINT32 type; + size_t count; + const char** args; + }; + const char* args[] = { "somename", "anothername", "3rdname", "4thname" }; + const struct test_entry tests[] = { + { 1, RDPDR_DTYP_SERIAL, 0, NULL }, + { 1, RDPDR_DTYP_SERIAL, 0, args }, + { 1, RDPDR_DTYP_SERIAL, 1, args }, + { 1, RDPDR_DTYP_SERIAL, 2, args }, + { 1, RDPDR_DTYP_SERIAL, 3, args }, + { 1, RDPDR_DTYP_SERIAL, 4, args }, + { 1, RDPDR_DTYP_PARALLEL, 0, NULL }, + { 1, RDPDR_DTYP_PARALLEL, 0, args }, + { 1, RDPDR_DTYP_PARALLEL, 1, args }, + { 1, RDPDR_DTYP_PARALLEL, 2, args }, + { 1, RDPDR_DTYP_PARALLEL, 3, args }, + { 1, RDPDR_DTYP_PARALLEL, 4, args }, + { 1, RDPDR_DTYP_PRINT, 0, NULL }, + { 1, RDPDR_DTYP_PRINT, 0, args }, + { 1, RDPDR_DTYP_PRINT, 1, args }, + { 1, RDPDR_DTYP_PRINT, 2, args }, + { 1, RDPDR_DTYP_PRINT, 3, args }, + { 1, RDPDR_DTYP_PRINT, 4, args }, + { 1, RDPDR_DTYP_FILESYSTEM, 0, NULL }, + { 1, RDPDR_DTYP_FILESYSTEM, 0, args }, + { 1, RDPDR_DTYP_FILESYSTEM, 1, args }, + { 1, RDPDR_DTYP_FILESYSTEM, 2, args }, + { 1, RDPDR_DTYP_FILESYSTEM, 3, args }, + { 1, RDPDR_DTYP_FILESYSTEM, 4, args }, + { 1, RDPDR_DTYP_SMARTCARD, 0, NULL }, + { 1, RDPDR_DTYP_SMARTCARD, 0, args }, + { 1, RDPDR_DTYP_SMARTCARD, 1, args }, + { 1, RDPDR_DTYP_SMARTCARD, 2, args }, + { 1, RDPDR_DTYP_SMARTCARD, 3, args }, + { 1, RDPDR_DTYP_SMARTCARD, 4, args }, + { -3, 0x123, 0, NULL }, + { -3, 0x123, 0, args }, + { -3, 0x123, 1, args }, + { -3, 0x123, 2, args }, + { -3, 0x123, 3, args }, + { -3, 0x123, 4, args }, + }; + BOOL rc = TRUE; + for (size_t x = 0; x < ARRAYSIZE(tests); x++) + { + const struct test_entry* cur = &tests[x]; + int got = check_device_type_arg(cur->type, cur->count, cur->args); + if (got != cur->expect) + rc = FALSE; + } + return log_result(rc, __func__); +} + +static BOOL check_offsets(rdpSettings* settings, size_t id, size_t min, size_t max, BOOL checkPtr) +{ + BOOL rc = TRUE; + + WINPR_ASSERT(settings); + + if (!freerdp_settings_get_pointer(settings, id)) + return FALSE; + + for (size_t x = min; x < max; x++) + { + const void* ptr = freerdp_settings_get_pointer_array(settings, id, x); + if (!ptr && checkPtr) + rc = FALSE; + } + return log_result(rc, __func__); +} + +static BOOL test_write_offsets(rdpSettings* settings, size_t id, size_t elementSize, size_t min, + size_t max) +{ + WINPR_ASSERT(settings); + + for (size_t x = min; x < max; x++) + { + const void* ptr = NULL; + char buffer[8192] = { 0 }; + + winpr_RAND(buffer, sizeof(buffer)); + if (!freerdp_settings_set_pointer_array(settings, id, x, buffer)) + return FALSE; + ptr = freerdp_settings_get_pointer_array(settings, id, x); + if (!ptr) + return FALSE; + if (memcmp(ptr, buffer, elementSize) != 0) + return FALSE; + } + return TRUE; +} + +static BOOL test_pointer_array(void) +{ + struct pointer_test_case + { + BOOL checkPtr; + BOOL write; + size_t id; + SSIZE_T sizeId; + size_t size; + size_t elementSize; + }; + const struct pointer_test_case tests[] = { + { FALSE, FALSE, FreeRDP_DeviceArray, FreeRDP_DeviceArraySize, 32, sizeof(RDPDR_DEVICE*) }, + { FALSE, FALSE, FreeRDP_StaticChannelArray, FreeRDP_StaticChannelArraySize, 32, + sizeof(ADDIN_ARGV*) }, + { FALSE, FALSE, FreeRDP_DynamicChannelArray, FreeRDP_DynamicChannelArraySize, 33, + sizeof(ADDIN_ARGV*) }, + { TRUE, TRUE, FreeRDP_BitmapCacheV2CellInfo, FreeRDP_BitmapCacheV2NumCells, 5, + sizeof(BITMAP_CACHE_V2_CELL_INFO) }, + { FALSE, FALSE, FreeRDP_OrderSupport, -1, 32, sizeof(BYTE) }, + { FALSE, FALSE, FreeRDP_ReceivedCapabilities, -1, 32, sizeof(BYTE) }, + { TRUE, TRUE, FreeRDP_GlyphCache, -1, 10, sizeof(GLYPH_CACHE_DEFINITION) }, + { TRUE, TRUE, FreeRDP_FragCache, -1, 1, sizeof(GLYPH_CACHE_DEFINITION) }, + { TRUE, TRUE, FreeRDP_MonitorIds, FreeRDP_NumMonitorIds, 33, sizeof(UINT32) }, + { TRUE, TRUE, FreeRDP_ChannelDefArray, FreeRDP_ChannelDefArraySize, 42, + sizeof(CHANNEL_DEF) }, + { TRUE, TRUE, FreeRDP_MonitorDefArray, FreeRDP_MonitorDefArraySize, 33, + sizeof(rdpMonitor) }, + { TRUE, TRUE, FreeRDP_ClientTimeZone, -1, 1, sizeof(TIME_ZONE_INFORMATION) }, + { FALSE, FALSE, FreeRDP_RdpServerCertificate, -1, 1, sizeof(rdpCertificate*) }, + //{ FALSE, FALSE, FreeRDP_RdpServerRsaKey, -1, 1, sizeof(rdpPrivateKey*) }, + { TRUE, TRUE, FreeRDP_RedirectionPassword, FreeRDP_RedirectionPasswordLength, 42, + sizeof(char) }, + { TRUE, TRUE, FreeRDP_RedirectionTsvUrl, FreeRDP_RedirectionTsvUrlLength, 42, + sizeof(char) }, + { TRUE, TRUE, FreeRDP_LoadBalanceInfo, FreeRDP_LoadBalanceInfoLength, 42, sizeof(char) }, + { TRUE, TRUE, FreeRDP_ServerRandom, FreeRDP_ServerRandomLength, 42, sizeof(char) }, + { TRUE, TRUE, FreeRDP_ClientRandom, FreeRDP_ClientRandomLength, 42, sizeof(char) }, + { TRUE, TRUE, FreeRDP_ServerCertificate, FreeRDP_ServerCertificateLength, 42, + sizeof(char) }, + { TRUE, TRUE, FreeRDP_ClientAutoReconnectCookie, -1, 1, sizeof(ARC_CS_PRIVATE_PACKET) }, + { TRUE, TRUE, FreeRDP_ServerAutoReconnectCookie, -1, 1, sizeof(ARC_SC_PRIVATE_PACKET) } + }; + BOOL rc = FALSE; + rdpSettings* settings = freerdp_settings_new(0); + if (!settings) + goto fail; + + for (size_t x = 0; x < ARRAYSIZE(tests); x++) + { + const struct pointer_test_case* cur = &tests[x]; + if (!freerdp_settings_set_pointer_len(settings, cur->id, NULL, cur->size)) + goto fail; + if (cur->sizeId >= 0) + { + const UINT32 s = freerdp_settings_get_uint32(settings, (size_t)cur->sizeId); + if (s != cur->size) + goto fail; + } + if (!check_offsets(settings, cur->id, 0, cur->size, cur->checkPtr)) + goto fail; + if (check_offsets(settings, cur->id, cur->size, cur->size + 5, TRUE)) + goto fail; + if (cur->write) + { + if (!test_write_offsets(settings, cur->id, cur->elementSize, 0, cur->size)) + goto fail; + if (test_write_offsets(settings, cur->id, cur->elementSize, cur->size, cur->size + 5)) + goto fail; + } + if (!freerdp_settings_set_pointer_len(settings, cur->id, NULL, 0)) + goto fail; + if (cur->sizeId >= 0) + { + const UINT32 s = freerdp_settings_get_uint32(settings, (size_t)cur->sizeId); + if (s != 0) + goto fail; + } + if (check_offsets(settings, cur->id, 0, cur->size, cur->checkPtr)) + goto fail; + if (cur->write) + { + if (test_write_offsets(settings, cur->id, cur->elementSize, 0, cur->size)) + goto fail; + } + if (!freerdp_settings_set_pointer_len(settings, cur->id, NULL, cur->size)) + goto fail; + if (cur->sizeId >= 0) + { + const UINT32 s = freerdp_settings_get_uint32(settings, (size_t)cur->sizeId); + if (s != cur->size) + goto fail; + } + if (!check_offsets(settings, cur->id, 0, cur->size, cur->checkPtr)) + goto fail; + if (check_offsets(settings, cur->id, cur->size + 1, cur->size + 5, TRUE)) + goto fail; + if (cur->write) + { + if (!test_write_offsets(settings, cur->id, cur->elementSize, 0, cur->size)) + goto fail; + if (test_write_offsets(settings, cur->id, cur->elementSize, cur->size, cur->size + 5)) + goto fail; + } + } + + rc = TRUE; + +fail: + freerdp_settings_free(settings); + return log_result(rc, __func__); +} +int TestSettings(int argc, char* argv[]) +{ + int rc = -1; + rdpSettings* settings = NULL; + rdpSettings* cloned = NULL; + rdpSettings* cloned2 = NULL; + WINPR_UNUSED(argc); + WINPR_UNUSED(argv); + + if (!test_dyn_channels()) + goto fail; + if (!test_static_channels()) + goto fail; + if (!test_copy()) + goto fail; + if (!test_helpers()) + goto fail; + if (!check_device_type()) + goto fail; + if (!test_pointer_array()) + goto fail; + + settings = freerdp_settings_new(0); + + if (!settings) + { + printf("Couldn't create settings\n"); + return -1; + } + + if (!freerdp_settings_set_string(settings, FreeRDP_Username, "abcdefg")) + goto fail; + if (!freerdp_settings_set_string(settings, FreeRDP_Password, "xyz")) + goto fail; + + cloned = freerdp_settings_clone(settings); + + if (!cloned) + goto fail; + +#if defined(have_bool_list_indices) + + for (size_t x = 0; x < ARRAYSIZE(bool_list_indices); x++) + { + const size_t key = bool_list_indices[x]; + const char* name = freerdp_settings_get_name_for_key(key); + const BOOL val = freerdp_settings_get_bool(settings, key); + const BOOL cval = freerdp_settings_get_bool(cloned, key); + if (val != cval) + { + printf("mismatch for key %s: %u -> copy %u\n", name, val, cval); + goto fail; + } + if (!freerdp_settings_set_bool(settings, key, val)) + goto fail; + if (!check_key_helpers(key, "bool")) + goto fail; + } + +#endif +#if defined(have_int16_list_indices) + + for (size_t x = 0; x < ARRAYSIZE(int16_list_indices); x++) + { + const size_t key = int16_list_indices[x]; + const char* name = freerdp_settings_get_name_for_key(key); + const INT16 val = freerdp_settings_get_int16(settings, key); + const INT16 cval = freerdp_settings_get_int16(cloned, key); + if (val != cval) + { + printf("mismatch for key %s: %" PRId16 " -> copy %" PRId16 "\n", name, val, cval); + goto fail; + } + if (!freerdp_settings_set_int16(settings, key, val)) + goto fail; + if (!check_key_helpers(key, "int16")) + goto fail; + } + +#endif +#if defined(have_uint16_list_indices) + + for (size_t x = 0; x < ARRAYSIZE(uint16_list_indices); x++) + { + const size_t key = uint16_list_indices[x]; + const char* name = freerdp_settings_get_name_for_key(key); + const UINT16 val = freerdp_settings_get_uint16(settings, key); + const UINT16 cval = freerdp_settings_get_uint16(cloned, key); + if (val != cval) + { + printf("mismatch for key %s: %" PRIu16 " -> copy %" PRIu16 "\n", name, val, cval); + goto fail; + } + if (!freerdp_settings_set_uint16(settings, key, val)) + goto fail; + if (!check_key_helpers(key, "uint16")) + goto fail; + } + +#endif +#if defined(have_uint32_list_indices) + + for (size_t x = 0; x < ARRAYSIZE(uint32_list_indices); x++) + { + const size_t key = uint32_list_indices[x]; + const char* name = freerdp_settings_get_name_for_key(key); + const UINT32 val = freerdp_settings_get_uint32(settings, key); + const UINT32 cval = freerdp_settings_get_uint32(cloned, key); + if (val != cval) + { + printf("mismatch for key %s: %" PRIu32 " -> copy %" PRIu32 "\n", name, val, cval); + goto fail; + } + if (!freerdp_settings_set_uint32(settings, key, val)) + goto fail; + if (!check_key_helpers(key, "uint32")) + goto fail; + } + +#endif +#if defined(have_int32_list_indices) + + for (size_t x = 0; x < ARRAYSIZE(int32_list_indices); x++) + { + const size_t key = int32_list_indices[x]; + const char* name = freerdp_settings_get_name_for_key(key); + const INT32 val = freerdp_settings_get_int32(settings, key); + const INT32 cval = freerdp_settings_get_int32(cloned, key); + if (val != cval) + { + printf("mismatch for key %s: %" PRId32 " -> copy %" PRId32 "\n", name, val, cval); + goto fail; + } + if (!freerdp_settings_set_int32(settings, key, val)) + goto fail; + if (!check_key_helpers(key, "int32")) + goto fail; + } + +#endif +#if defined(have_uint64_list_indices) + + for (size_t x = 0; x < ARRAYSIZE(uint64_list_indices); x++) + { + const size_t key = uint64_list_indices[x]; + const char* name = freerdp_settings_get_name_for_key(key); + const UINT64 val = freerdp_settings_get_uint64(settings, key); + const UINT64 cval = freerdp_settings_get_uint64(cloned, key); + if (val != cval) + { + printf("mismatch for key %s: %" PRIu64 " -> copy %" PRIu64 "\n", name, val, cval); + goto fail; + } + if (!freerdp_settings_set_uint64(settings, key, val)) + goto fail; + if (!check_key_helpers(key, "uint64")) + goto fail; + } + +#endif +#if defined(have_int64_list_indices) + + for (size_t x = 0; x < ARRAYSIZE(int64_list_indices); x++) + { + const size_t key = int64_list_indices[x]; + const char* name = freerdp_settings_get_name_for_key(key); + const INT64 val = freerdp_settings_get_int64(settings, key); + const INT64 cval = freerdp_settings_get_int64(cloned, key); + if (val != cval) + { + printf("mismatch for key %s: %" PRId64 " -> copy %" PRId64 "\n", name, val, cval); + goto fail; + } + if (!freerdp_settings_set_int64(settings, key, val)) + goto fail; + if (!check_key_helpers(key, "int64")) + goto fail; + } + +#endif +#if defined(have_string_list_indices) + + for (size_t x = 0; x < ARRAYSIZE(string_list_indices); x++) + { + const size_t key = string_list_indices[x]; + const char val[] = "test-string"; + const char* res = NULL; + const char* name = freerdp_settings_get_name_for_key(key); + const char* oval = freerdp_settings_get_string(settings, key); + const char* cval = freerdp_settings_get_string(cloned, key); + if ((oval != cval) && (strcmp(oval, cval) != 0)) + { + printf("mismatch for key %s: %s -> copy %s\n", name, oval, cval); + goto fail; + } + if (!freerdp_settings_set_string(settings, key, val)) + goto fail; + + res = freerdp_settings_get_string(settings, key); + + if (strncmp(val, res, sizeof(val)) != 0) + goto fail; + } + +#endif +#if defined(have_pointer_list_indices) + + for (size_t x = 0; x < ARRAYSIZE(pointer_list_indices); x++) + { + const size_t key = pointer_list_indices[x]; + const void* val = freerdp_settings_get_pointer(settings, key); + WINPR_UNUSED(val); + } + +#endif + cloned2 = freerdp_settings_clone(settings); + if (!cloned2) + goto fail; + if (!freerdp_settings_copy(cloned2, cloned)) + goto fail; + + rc = 0; +fail: + freerdp_settings_free(cloned); + freerdp_settings_free(cloned2); + freerdp_settings_free(settings); + return rc; +} diff --git a/libfreerdp/core/test/TestStreamDump.c b/libfreerdp/core/test/TestStreamDump.c new file mode 100644 index 0000000..9124a84 --- /dev/null +++ b/libfreerdp/core/test/TestStreamDump.c @@ -0,0 +1,104 @@ +#include <stdio.h> + +#include <winpr/stream.h> +#include <winpr/path.h> +#include <winpr/crypto.h> + +#include <freerdp/freerdp.h> +#include <freerdp/streamdump.h> + +#include "../streamdump.h" + +static BOOL test_entry_read_write(void) +{ + BOOL rc = FALSE; + FILE* fp = NULL; + wStream* sw = NULL; + wStream* sr = NULL; + size_t offset = 0; + UINT64 ts = 0; + UINT32 flags = 0; + BYTE tmp[16] = { 0 }; + char tmp2[64] = { 0 }; + char* name = NULL; + size_t entrysize = sizeof(UINT64) /* timestamp */ + sizeof(BYTE) /* direction */ + + sizeof(UINT32) /* CRC */ + sizeof(UINT64) /* size */; + + winpr_RAND(tmp, sizeof(tmp)); + + for (size_t x = 0; x < sizeof(tmp); x++) + _snprintf(&tmp2[x * 2], sizeof(tmp2) - 2 * x, "%02" PRIx8, tmp[x]); + name = GetKnownSubPath(KNOWN_PATH_TEMP, tmp2); + if (!name) + { + fprintf(stderr, "[%s] Could not create temporary path\n", __func__); + goto fail; + } + + sw = Stream_New(NULL, 8123); + sr = Stream_New(NULL, 1024); + if (!sr || !sw) + { + fprintf(stderr, "[%s] Could not create iostreams sw=%p, sr=%p\n", __func__, (void*)sw, + (void*)sr); + goto fail; + } + + winpr_RAND(Stream_Buffer(sw), Stream_Capacity(sw)); + entrysize += Stream_Capacity(sw); + Stream_SetLength(sw, Stream_Capacity(sw)); + + fp = fopen(name, "wb"); + if (!fp) + goto fail; + if (!stream_dump_write_line(fp, 0, sw)) + goto fail; + fclose(fp); + + fp = fopen(name, "rb"); + if (!fp) + goto fail; + if (!stream_dump_read_line(fp, sr, &ts, &offset, &flags)) + goto fail; + + if (entrysize != offset) + { + fprintf(stderr, "[%s] offset %" PRIuz " bytes, entrysize %" PRIuz " bytes\n", __func__, + offset, entrysize); + goto fail; + } + + if (Stream_Length(sr) != Stream_Capacity(sw)) + { + fprintf(stderr, "[%s] Written %" PRIuz " bytes, read %" PRIuz " bytes\n", __func__, + Stream_Length(sr), Stream_Capacity(sw)); + goto fail; + } + + if (memcmp(Stream_Buffer(sw), Stream_Buffer(sr), Stream_Capacity(sw)) != 0) + { + fprintf(stderr, "[%s] Written data does not match data read back\n", __func__); + goto fail; + } + rc = TRUE; +fail: + Stream_Free(sr, TRUE); + Stream_Free(sw, TRUE); + if (fp) + fclose(fp); + if (name) + DeleteFileA(name); + free(name); + fprintf(stderr, "xxxxxxxxxxxxx %d\n", rc); + return rc; +} + +int TestStreamDump(int argc, char* argv[]) +{ + WINPR_UNUSED(argc); + WINPR_UNUSED(argv); + + if (!test_entry_read_write()) + return -1; + return 0; +} diff --git a/libfreerdp/core/test/TestVersion.c b/libfreerdp/core/test/TestVersion.c new file mode 100644 index 0000000..5910c48 --- /dev/null +++ b/libfreerdp/core/test/TestVersion.c @@ -0,0 +1,44 @@ +#include <freerdp/version.h> +#include <freerdp/freerdp.h> + +int TestVersion(int argc, char* argv[]) +{ + const char* version = NULL; + const char* git = NULL; + const char* build = NULL; + int major = 0; + int minor = 0; + int revision = 0; + WINPR_UNUSED(argc); + WINPR_UNUSED(argv); + freerdp_get_version(&major, &minor, &revision); + + if (major != FREERDP_VERSION_MAJOR) + return -1; + + if (minor != FREERDP_VERSION_MINOR) + return -1; + + if (revision != FREERDP_VERSION_REVISION) + return -1; + + version = freerdp_get_version_string(); + + if (!version) + return -1; + + git = freerdp_get_build_revision(); + + if (!git) + return -1; + + if (strncmp(git, FREERDP_GIT_REVISION, sizeof(FREERDP_GIT_REVISION))) + return -1; + + build = freerdp_get_build_config(); + + if (!build) + return -1; + + return 0; +} diff --git a/libfreerdp/core/test/settings_property_lists.h b/libfreerdp/core/test/settings_property_lists.h new file mode 100644 index 0000000..fb280e6 --- /dev/null +++ b/libfreerdp/core/test/settings_property_lists.h @@ -0,0 +1,489 @@ +#ifndef TEST_SETTINGS_PROPERTY_LISTS +#define TEST_SETTINGS_PROPERTY_LISTS + +#define have_bool_list_indices +static const size_t bool_list_indices[] = { + FreeRDP_AadSecurity, + FreeRDP_AllowCacheWaitingList, + FreeRDP_AllowDesktopComposition, + FreeRDP_AllowFontSmoothing, + FreeRDP_AllowUnanouncedOrdersFromServer, + FreeRDP_AltSecFrameMarkerSupport, + FreeRDP_AsyncChannels, + FreeRDP_AsyncUpdate, + FreeRDP_AudioCapture, + FreeRDP_AudioPlayback, + FreeRDP_Authentication, + FreeRDP_AuthenticationOnly, + FreeRDP_AutoAcceptCertificate, + FreeRDP_AutoDenyCertificate, + FreeRDP_AutoLogonEnabled, + FreeRDP_AutoReconnectionEnabled, + FreeRDP_BitmapCacheEnabled, + FreeRDP_BitmapCachePersistEnabled, + FreeRDP_BitmapCacheV3Enabled, + FreeRDP_BitmapCompressionDisabled, + FreeRDP_CertificateCallbackPreferPEM, + FreeRDP_CompressionEnabled, + FreeRDP_ConnectChildSession, + FreeRDP_ConsoleSession, + FreeRDP_CredentialsFromStdin, + FreeRDP_DeactivateClientDecoding, + FreeRDP_Decorations, + FreeRDP_DesktopResize, + FreeRDP_DeviceRedirection, + FreeRDP_DisableCredentialsDelegation, + FreeRDP_DisableCtrlAltDel, + FreeRDP_DisableCursorBlinking, + FreeRDP_DisableCursorShadow, + FreeRDP_DisableFullWindowDrag, + FreeRDP_DisableMenuAnims, + FreeRDP_DisableRemoteAppCapsCheck, + FreeRDP_DisableThemes, + FreeRDP_DisableWallpaper, + FreeRDP_DrawAllowColorSubsampling, + FreeRDP_DrawAllowDynamicColorFidelity, + FreeRDP_DrawAllowSkipAlpha, + FreeRDP_DrawGdiPlusCacheEnabled, + FreeRDP_DrawGdiPlusEnabled, + FreeRDP_DrawNineGridEnabled, + FreeRDP_DumpRemoteFx, + FreeRDP_DynamicDaylightTimeDisabled, + FreeRDP_DynamicResolutionUpdate, + FreeRDP_EmbeddedWindow, + FreeRDP_EnableWindowsKey, + FreeRDP_EncomspVirtualChannel, + FreeRDP_ExtSecurity, + FreeRDP_ExternalCertificateManagement, + FreeRDP_FIPSMode, + FreeRDP_FastPathInput, + FreeRDP_FastPathOutput, + FreeRDP_ForceEncryptedCsPdu, + FreeRDP_ForceMultimon, + FreeRDP_FrameMarkerCommandEnabled, + FreeRDP_Fullscreen, + FreeRDP_GatewayArmTransport, + FreeRDP_GatewayBypassLocal, + FreeRDP_GatewayEnabled, + FreeRDP_GatewayHttpExtAuthSspiNtlm, + FreeRDP_GatewayHttpTransport, + FreeRDP_GatewayHttpUseWebsockets, + FreeRDP_GatewayRpcTransport, + FreeRDP_GatewayUdpTransport, + FreeRDP_GatewayUseSameCredentials, + FreeRDP_GfxAVC444, + FreeRDP_GfxAVC444v2, + FreeRDP_GfxH264, + FreeRDP_GfxPlanar, + FreeRDP_GfxProgressive, + FreeRDP_GfxProgressiveV2, + FreeRDP_GfxSendQoeAck, + FreeRDP_GfxSmallCache, + FreeRDP_GfxThinClient, + FreeRDP_GrabKeyboard, + FreeRDP_GrabMouse, + FreeRDP_HasExtendedMouseEvent, + FreeRDP_HasHorizontalWheel, + FreeRDP_HasMonitorAttributes, + FreeRDP_HasQoeEvent, + FreeRDP_HasRelativeMouseEvent, + FreeRDP_HiDefRemoteApp, + FreeRDP_IPv6Enabled, + FreeRDP_IgnoreCertificate, + FreeRDP_IgnoreInvalidDevices, + FreeRDP_JpegCodec, + FreeRDP_KerberosRdgIsProxy, + FreeRDP_ListMonitors, + FreeRDP_LocalConnection, + FreeRDP_LogonErrors, + FreeRDP_LogonNotify, + FreeRDP_LongCredentialsSupported, + FreeRDP_LyncRdpMode, + FreeRDP_MaximizeShell, + FreeRDP_MouseAttached, + FreeRDP_MouseHasWheel, + FreeRDP_MouseMotion, + FreeRDP_MouseUseRelativeMove, + FreeRDP_MstscCookieMode, + FreeRDP_MultiTouchGestures, + FreeRDP_MultiTouchInput, + FreeRDP_NSCodec, + FreeRDP_NSCodecAllowDynamicColorFidelity, + FreeRDP_NSCodecAllowSubsampling, + FreeRDP_NegotiateSecurityLayer, + FreeRDP_NetworkAutoDetect, + FreeRDP_NlaSecurity, + FreeRDP_NoBitmapCompressionHeader, + FreeRDP_OldLicenseBehaviour, + FreeRDP_PasswordIsSmartcardPin, + FreeRDP_PercentScreenUseHeight, + FreeRDP_PercentScreenUseWidth, + FreeRDP_PlayRemoteFx, + FreeRDP_PreferIPv6OverIPv4, + FreeRDP_PrintReconnectCookie, + FreeRDP_PromptForCredentials, + FreeRDP_RdpSecurity, + FreeRDP_RdstlsSecurity, + FreeRDP_RedirectClipboard, + FreeRDP_RedirectDrives, + FreeRDP_RedirectHomeDrive, + FreeRDP_RedirectParallelPorts, + FreeRDP_RedirectPrinters, + FreeRDP_RedirectSerialPorts, + FreeRDP_RedirectSmartCards, + FreeRDP_RedirectWebAuthN, + FreeRDP_RefreshRect, + FreeRDP_RemdeskVirtualChannel, + FreeRDP_RemoteAppLanguageBarSupported, + FreeRDP_RemoteApplicationMode, + FreeRDP_RemoteAssistanceMode, + FreeRDP_RemoteAssistanceRequestControl, + FreeRDP_RemoteConsoleAudio, + FreeRDP_RemoteCredentialGuard, + FreeRDP_RemoteFxCodec, + FreeRDP_RemoteFxImageCodec, + FreeRDP_RemoteFxOnly, + FreeRDP_RestrictedAdminModeRequired, + FreeRDP_SaltedChecksum, + FreeRDP_SendPreconnectionPdu, + FreeRDP_ServerLicenseRequired, + FreeRDP_ServerMode, + FreeRDP_SmartSizing, + FreeRDP_SmartcardEmulation, + FreeRDP_SmartcardLogon, + FreeRDP_SoftwareGdi, + FreeRDP_SoundBeepsEnabled, + FreeRDP_SpanMonitors, + FreeRDP_SupportAsymetricKeys, + FreeRDP_SupportDisplayControl, + FreeRDP_SupportDynamicChannels, + FreeRDP_SupportDynamicTimeZone, + FreeRDP_SupportEchoChannel, + FreeRDP_SupportEdgeActionV1, + FreeRDP_SupportEdgeActionV2, + FreeRDP_SupportErrorInfoPdu, + FreeRDP_SupportGeometryTracking, + FreeRDP_SupportGraphicsPipeline, + FreeRDP_SupportHeartbeatPdu, + FreeRDP_SupportMonitorLayoutPdu, + FreeRDP_SupportMultitransport, + FreeRDP_SupportSSHAgentChannel, + FreeRDP_SupportSkipChannelJoin, + FreeRDP_SupportStatusInfoPdu, + FreeRDP_SupportVideoOptimized, + FreeRDP_SuppressOutput, + FreeRDP_SurfaceCommandsEnabled, + FreeRDP_SurfaceFrameMarkerEnabled, + FreeRDP_SuspendInput, + FreeRDP_SynchronousDynamicChannels, + FreeRDP_SynchronousStaticChannels, + FreeRDP_TcpKeepAlive, + FreeRDP_TlsSecurity, + FreeRDP_ToggleFullscreen, + FreeRDP_TransportDump, + FreeRDP_TransportDumpReplay, + FreeRDP_UnicodeInput, + FreeRDP_UnmapButtons, + FreeRDP_UseCommonStdioCallbacks, + FreeRDP_UseMultimon, + FreeRDP_UseRdpSecurityLayer, + FreeRDP_UsingSavedCredentials, + FreeRDP_VideoDisable, + FreeRDP_VmConnectMode, + FreeRDP_WaitForOutputBufferFlush, + FreeRDP_Workarea, +}; + +#define have_uint16_list_indices +static const size_t uint16_list_indices[] = { + FreeRDP_CapsGeneralCompressionLevel, + FreeRDP_CapsGeneralCompressionTypes, + FreeRDP_CapsProtocolVersion, + FreeRDP_CapsRemoteUnshareFlag, + FreeRDP_CapsUpdateCapabilityFlag, + FreeRDP_DesktopOrientation, + FreeRDP_OrderSupportFlags, + FreeRDP_OrderSupportFlagsEx, + FreeRDP_ProxyPort, + FreeRDP_SupportedColorDepths, + FreeRDP_TLSMaxVersion, + FreeRDP_TLSMinVersion, + FreeRDP_TextANSICodePage, +}; + +#define have_uint32_list_indices +static const size_t uint32_list_indices[] = { + FreeRDP_AcceptedCertLength, + FreeRDP_AuthenticationLevel, + FreeRDP_AutoReconnectMaxRetries, + FreeRDP_BitmapCacheV2NumCells, + FreeRDP_BitmapCacheV3CodecId, + FreeRDP_BitmapCacheVersion, + FreeRDP_BrushSupportLevel, + FreeRDP_ChannelCount, + FreeRDP_ChannelDefArraySize, + FreeRDP_ClientBuild, + FreeRDP_ClientRandomLength, + FreeRDP_ClientSessionId, + FreeRDP_ClipboardFeatureMask, + FreeRDP_ClusterInfoFlags, + FreeRDP_ColorDepth, + FreeRDP_ColorPointerCacheSize, + FreeRDP_CompDeskSupportLevel, + FreeRDP_CompressionLevel, + FreeRDP_ConnectionType, + FreeRDP_CookieMaxLength, + FreeRDP_DesktopHeight, + FreeRDP_DesktopPhysicalHeight, + FreeRDP_DesktopPhysicalWidth, + FreeRDP_DesktopPosX, + FreeRDP_DesktopPosY, + FreeRDP_DesktopScaleFactor, + FreeRDP_DesktopWidth, + FreeRDP_DeviceArraySize, + FreeRDP_DeviceCount, + FreeRDP_DeviceScaleFactor, + FreeRDP_DrawNineGridCacheEntries, + FreeRDP_DrawNineGridCacheSize, + FreeRDP_DynamicChannelArraySize, + FreeRDP_DynamicChannelCount, + FreeRDP_EarlyCapabilityFlags, + FreeRDP_EncryptionLevel, + FreeRDP_EncryptionMethods, + FreeRDP_ExtEncryptionMethods, + FreeRDP_FakeMouseMotionInterval, + FreeRDP_Floatbar, + FreeRDP_FrameAcknowledge, + FreeRDP_GatewayAcceptedCertLength, + FreeRDP_GatewayCredentialsSource, + FreeRDP_GatewayPort, + FreeRDP_GatewayUsageMethod, + FreeRDP_GfxCapsFilter, + FreeRDP_GlyphSupportLevel, + FreeRDP_JpegCodecId, + FreeRDP_JpegQuality, + FreeRDP_KeySpec, + FreeRDP_KeyboardCodePage, + FreeRDP_KeyboardFunctionKey, + FreeRDP_KeyboardHook, + FreeRDP_KeyboardLayout, + FreeRDP_KeyboardSubType, + FreeRDP_KeyboardType, + FreeRDP_LargePointerFlag, + FreeRDP_LoadBalanceInfoLength, + FreeRDP_MonitorAttributeFlags, + FreeRDP_MonitorCount, + FreeRDP_MonitorDefArraySize, + FreeRDP_MonitorFlags, + FreeRDP_MonitorLocalShiftX, + FreeRDP_MonitorLocalShiftY, + FreeRDP_MultifragMaxRequestSize, + FreeRDP_MultitransportFlags, + FreeRDP_NSCodecColorLossLevel, + FreeRDP_NSCodecId, + FreeRDP_NegotiationFlags, + FreeRDP_NumMonitorIds, + FreeRDP_OffscreenCacheEntries, + FreeRDP_OffscreenCacheSize, + FreeRDP_OffscreenSupportLevel, + FreeRDP_OsMajorType, + FreeRDP_OsMinorType, + FreeRDP_Password51Length, + FreeRDP_PduSource, + FreeRDP_PercentScreen, + FreeRDP_PerformanceFlags, + FreeRDP_PointerCacheSize, + FreeRDP_PreconnectionId, + FreeRDP_ProxyType, + FreeRDP_RdpVersion, + FreeRDP_ReceivedCapabilitiesSize, + FreeRDP_RedirectedSessionId, + FreeRDP_RedirectionAcceptedCertLength, + FreeRDP_RedirectionFlags, + FreeRDP_RedirectionGuidLength, + FreeRDP_RedirectionPasswordLength, + FreeRDP_RedirectionPreferType, + FreeRDP_RedirectionTsvUrlLength, + FreeRDP_RemoteAppNumIconCacheEntries, + FreeRDP_RemoteAppNumIconCaches, + FreeRDP_RemoteApplicationExpandCmdLine, + FreeRDP_RemoteApplicationExpandWorkingDir, + FreeRDP_RemoteApplicationSupportLevel, + FreeRDP_RemoteApplicationSupportMask, + FreeRDP_RemoteFxCaptureFlags, + FreeRDP_RemoteFxCodecId, + FreeRDP_RemoteFxCodecMode, + FreeRDP_RemoteWndSupportLevel, + FreeRDP_RequestedProtocols, + FreeRDP_SelectedProtocol, + FreeRDP_ServerCertificateLength, + FreeRDP_ServerLicenseProductIssuersCount, + FreeRDP_ServerLicenseProductVersion, + FreeRDP_ServerPort, + FreeRDP_ServerRandomLength, + FreeRDP_ShareId, + FreeRDP_SmartSizingHeight, + FreeRDP_SmartSizingWidth, + FreeRDP_StaticChannelArraySize, + FreeRDP_StaticChannelCount, + FreeRDP_TargetNetAddressCount, + FreeRDP_TcpAckTimeout, + FreeRDP_TcpConnectTimeout, + FreeRDP_TcpKeepAliveDelay, + FreeRDP_TcpKeepAliveInterval, + FreeRDP_TcpKeepAliveRetries, + FreeRDP_ThreadingFlags, + FreeRDP_TlsSecLevel, + FreeRDP_VCChunkSize, + FreeRDP_VCFlags, +}; + +#define have_int32_list_indices +static const size_t int32_list_indices[] = { + FreeRDP_XPan, + FreeRDP_YPan, +}; + +#define have_uint64_list_indices +static const size_t uint64_list_indices[] = { + FreeRDP_ParentWindowId, +}; + +#define have_string_list_indices +static const size_t string_list_indices[] = { + FreeRDP_AadServerHostname, + FreeRDP_AcceptedCert, + FreeRDP_ActionScript, + FreeRDP_AllowedTlsCiphers, + FreeRDP_AlternateShell, + FreeRDP_AssistanceFile, + FreeRDP_AuthenticationPackageList, + FreeRDP_AuthenticationServiceClass, + FreeRDP_BitmapCachePersistFile, + FreeRDP_CardName, + FreeRDP_CertificateAcceptedFingerprints, + FreeRDP_CertificateName, + FreeRDP_ClientAddress, + FreeRDP_ClientDir, + FreeRDP_ClientHostname, + FreeRDP_ClientProductId, + FreeRDP_ClipboardUseSelection, + FreeRDP_ComputerName, + FreeRDP_ConfigPath, + FreeRDP_ConnectionFile, + FreeRDP_ContainerName, + FreeRDP_CspName, + FreeRDP_CurrentPath, + FreeRDP_Domain, + FreeRDP_DrivesToRedirect, + FreeRDP_DumpRemoteFxFile, + FreeRDP_DynamicDSTTimeZoneKeyName, + FreeRDP_GatewayAcceptedCert, + FreeRDP_GatewayAccessToken, + FreeRDP_GatewayAvdAadtenantid, + FreeRDP_GatewayAvdActivityhint, + FreeRDP_GatewayAvdArmpath, + FreeRDP_GatewayAvdDiagnosticserviceurl, + FreeRDP_GatewayAvdGeo, + FreeRDP_GatewayAvdHubdiscoverygeourl, + FreeRDP_GatewayAvdWvdEndpointPool, + FreeRDP_GatewayDomain, + FreeRDP_GatewayHostname, + FreeRDP_GatewayHttpExtAuthBearer, + FreeRDP_GatewayPassword, + FreeRDP_GatewayUrl, + FreeRDP_GatewayUsername, + FreeRDP_HomePath, + FreeRDP_ImeFileName, + FreeRDP_KerberosArmor, + FreeRDP_KerberosCache, + FreeRDP_KerberosKdcUrl, + FreeRDP_KerberosKeytab, + FreeRDP_KerberosLifeTime, + FreeRDP_KerberosRealm, + FreeRDP_KerberosRenewableLifeTime, + FreeRDP_KerberosStartTime, + FreeRDP_KeyboardPipeName, + FreeRDP_KeyboardRemappingList, + FreeRDP_NtlmSamFile, + FreeRDP_Password, + FreeRDP_PasswordHash, + FreeRDP_Pkcs11Module, + FreeRDP_PkinitAnchors, + FreeRDP_PlayRemoteFxFile, + FreeRDP_PreconnectionBlob, + FreeRDP_ProxyHostname, + FreeRDP_ProxyPassword, + FreeRDP_ProxyUsername, + FreeRDP_RDP2TCPArgs, + FreeRDP_ReaderName, + FreeRDP_RedirectionAcceptedCert, + FreeRDP_RedirectionDomain, + FreeRDP_RedirectionTargetFQDN, + FreeRDP_RedirectionTargetNetBiosName, + FreeRDP_RedirectionUsername, + FreeRDP_RemoteApplicationCmdLine, + FreeRDP_RemoteApplicationFile, + FreeRDP_RemoteApplicationGuid, + FreeRDP_RemoteApplicationIcon, + FreeRDP_RemoteApplicationName, + FreeRDP_RemoteApplicationProgram, + FreeRDP_RemoteApplicationWorkingDir, + FreeRDP_RemoteAssistancePassStub, + FreeRDP_RemoteAssistancePassword, + FreeRDP_RemoteAssistanceRCTicket, + FreeRDP_RemoteAssistanceSessionId, + FreeRDP_ServerHostname, + FreeRDP_ServerLicenseCompanyName, + FreeRDP_ServerLicenseProductName, + FreeRDP_ShellWorkingDirectory, + FreeRDP_SmartcardCertificate, + FreeRDP_SmartcardPrivateKey, + FreeRDP_SspiModule, + FreeRDP_TargetNetAddress, + FreeRDP_TerminalDescriptor, + FreeRDP_TlsSecretsFile, + FreeRDP_TransportDumpFile, + FreeRDP_UserSpecifiedServerName, + FreeRDP_Username, + FreeRDP_WinSCardModule, + FreeRDP_WindowTitle, + FreeRDP_WmClass, +}; + +#define have_pointer_list_indices +static const size_t pointer_list_indices[] = { + FreeRDP_BitmapCacheV2CellInfo, + FreeRDP_ChannelDefArray, + FreeRDP_ClientAutoReconnectCookie, + FreeRDP_ClientRandom, + FreeRDP_ClientTimeZone, + FreeRDP_DeviceArray, + FreeRDP_DynamicChannelArray, + FreeRDP_FragCache, + FreeRDP_GlyphCache, + FreeRDP_LoadBalanceInfo, + FreeRDP_MonitorDefArray, + FreeRDP_MonitorIds, + FreeRDP_OrderSupport, + FreeRDP_Password51, + FreeRDP_RdpServerCertificate, + FreeRDP_RdpServerRsaKey, + FreeRDP_ReceivedCapabilities, + FreeRDP_ReceivedCapabilityData, + FreeRDP_ReceivedCapabilityDataSizes, + FreeRDP_RedirectionGuid, + FreeRDP_RedirectionPassword, + FreeRDP_RedirectionTargetCertificate, + FreeRDP_RedirectionTsvUrl, + FreeRDP_ServerAutoReconnectCookie, + FreeRDP_ServerCertificate, + FreeRDP_ServerLicenseProductIssuers, + FreeRDP_ServerRandom, + FreeRDP_StaticChannelArray, + FreeRDP_TargetNetAddresses, + FreeRDP_TargetNetPorts, + FreeRDP_instance, +}; + +#endif /* TEST_SETTINGS_PROPERTY_LISTS */ |