21#include <freerdp/config.h>
22#include <freerdp/version.h>
24#include "../settings.h"
26#include <winpr/assert.h>
29#include <winpr/synch.h>
30#include <winpr/print.h>
31#include <winpr/stream.h>
32#include <winpr/winsock.h>
33#include <winpr/cred.h>
34#include <winpr/bcrypt.h>
36#include <freerdp/log.h>
37#include <freerdp/error.h>
38#include <freerdp/crypto/certificate.h>
39#include <freerdp/utils/ringbuffer.h>
40#include <freerdp/utils/smartcardlogon.h>
41#include <freerdp/utils/aad.h>
47#include "../credssp_auth.h"
50#include "../../crypto/crypto.h"
51#include "../../crypto/certificate.h"
52#include "../../crypto/opensslcompat.h"
55#include "../redirection.h"
57#include <winpr/json.h>
71typedef struct rdp_arm rdpArm;
73#define TAG FREERDP_TAG("core.gateway.arm")
76static BOOL arm_tls_connect(rdpArm* arm, rdpTls* tls, UINT32 timeout)
82 BIO* socketBio = NULL;
83 BIO* bufferedBio = NULL;
84 rdpSettings* settings = arm->context->settings;
93 const char* proxyUsername = NULL;
94 const char* proxyPassword = NULL;
95 BOOL isProxyConnection =
96 proxy_prepare(settings, &peerHostname, &peerPort, &proxyUsername, &proxyPassword);
98 sockfd = freerdp_tcp_connect(arm->context, peerHostname, peerPort, timeout);
100 WLog_Print(arm->log, WLOG_DEBUG,
"connecting to %s %d", peerHostname, peerPort);
104 socketBio = BIO_new(BIO_s_simple_socket());
108 closesocket((SOCKET)sockfd);
112 BIO_set_fd(socketBio, sockfd, BIO_CLOSE);
113 bufferedBio = BIO_new(BIO_s_buffered_socket());
117 BIO_free_all(socketBio);
121 bufferedBio = BIO_push(bufferedBio, socketBio);
125 status = BIO_set_nonblock(bufferedBio, TRUE);
127 if (isProxyConnection)
129 if (!proxy_connect(arm->context, bufferedBio, proxyUsername, proxyPassword,
133 BIO_free_all(bufferedBio);
140 BIO_free_all(bufferedBio);
145 tls->port = MIN(UINT16_MAX, WINPR_ASSERTING_INT_CAST(int32_t, settings->GatewayPort));
146 tls->isGatewayTransport = TRUE;
147 status = freerdp_tls_connect(tls, bufferedBio);
150 rdpContext* context = arm->context;
152 freerdp_set_last_error_if_not(context, FREERDP_ERROR_TLS_CONNECT_FAILED);
154 freerdp_set_last_error_if_not(context, FREERDP_ERROR_CONNECT_CANCELLED);
158 return (status >= 1);
161static BOOL arm_fetch_wellknown(rdpArm* arm)
164 WINPR_ASSERT(arm->context);
165 WINPR_ASSERT(arm->context->rdp);
167 rdpRdp* rdp = arm->context->rdp;
173 const BOOL useTenant =
175 const char* tenantid =
"common";
180 rdp->wellknown = freerdp_utils_aad_get_wellknown(arm->log, base, tenantid);
181 return rdp->wellknown ? TRUE : FALSE;
184static wStream* arm_build_http_request(rdpArm* arm,
const char* method,
185 TRANSFER_ENCODING transferEncoding,
const char* content_type,
186 size_t content_length)
191 WINPR_ASSERT(method);
192 WINPR_ASSERT(content_type);
194 WINPR_ASSERT(arm->context);
195 WINPR_ASSERT(arm->context->rdp);
197 const char* uri = http_context_get_uri(arm->http);
198 HttpRequest* request = http_request_new();
203 rdpSettings* settings = arm->context->settings;
205 if (!http_request_set_method(request, method) || !http_request_set_uri(request, uri))
212 pGetCommonAccessToken GetCommonAccessToken = freerdp_get_common_access_token(arm->context);
213 if (!GetCommonAccessToken)
215 WLog_Print(arm->log, WLOG_ERROR,
"No authorization token provided");
219 if (!arm_fetch_wellknown(arm))
222 if (!GetCommonAccessToken(arm->context, ACCESS_TOKEN_TYPE_AVD, &token, 0))
224 WLog_Print(arm->log, WLOG_ERROR,
"Unable to obtain access token");
236 if (!http_request_set_auth_scheme(request,
"Bearer") ||
237 !http_request_set_auth_param(
241 if (!http_request_set_transfer_encoding(request, transferEncoding) ||
242 !http_request_set_content_length(request, content_length) ||
243 !http_request_set_content_type(request, content_type))
246 s = http_request_write(arm->http, request);
248 http_request_free(request);
251 Stream_SealLength(s);
256static BOOL arm_send_http_request(rdpArm* arm, rdpTls* tls,
const char* method,
257 const char* content_type,
const char* data,
size_t content_length)
261 arm_build_http_request(arm, method, TransferEncodingIdentity, content_type, content_length);
266 const size_t sz = Stream_Length(s);
267 WLog_Print(arm->log, WLOG_TRACE,
"header [%" PRIuz
"]: %s", sz, Stream_Buffer(s));
268 WLog_Print(arm->log, WLOG_TRACE,
"body [%" PRIuz
"]: %s", content_length, data);
269 status = freerdp_tls_write_all(tls, Stream_Buffer(s), sz);
271 Stream_Free(s, TRUE);
272 if (status >= 0 && content_length > 0 && data)
273 status = freerdp_tls_write_all(tls, (
const BYTE*)data, content_length);
275 return (status >= 0);
278static void arm_free(rdpArm* arm)
283 freerdp_tls_free(arm->tls);
284 http_context_free(arm->http);
289static rdpArm* arm_new(rdpContext* context)
291 WINPR_ASSERT(context);
293 rdpArm* arm = (rdpArm*)calloc(1,
sizeof(rdpArm));
297 arm->log = WLog_Get(TAG);
298 arm->context = context;
299 arm->tls = freerdp_tls_new(context);
303 arm->http = http_context_new();
315static char* arm_create_request_json(rdpArm* arm)
318 char* message = NULL;
324 goto arm_create_cleanup;
333 goto arm_create_cleanup;
368static WINPR_CIPHER_CTX* treatAuthBlob(wLog* log,
const BYTE* pbInput,
size_t cbInput,
371 WINPR_CIPHER_CTX* ret = NULL;
372 char algoName[100] = { 0 };
374 WINPR_ASSERT(pBlockSize);
375 SSIZE_T algoSz = ConvertWCharNToUtf8((
const WCHAR*)pbInput, cbInput /
sizeof(WCHAR), algoName,
376 sizeof(algoName) - 1);
379 WLog_Print(log, WLOG_ERROR,
"invalid algoName");
383 if (strcmp(algoName,
"AES") != 0)
385 WLog_Print(log, WLOG_ERROR,
"only AES is supported for now");
389 *pBlockSize = WINPR_AES_BLOCK_SIZE;
390 const size_t algoLen = WINPR_ASSERTING_INT_CAST(
size_t, (algoSz + 1)) *
sizeof(WCHAR);
391 if (cbInput < algoLen)
393 WLog_Print(log, WLOG_ERROR,
"invalid AuthBlob size");
401 wStream* s = Stream_StaticConstInit(&staticStream, &pbInput[algoLen], cbInput);
403 if (!Stream_CheckAndLogRequiredLengthWLog(log, s, 12))
406 const UINT32 dwMagic = Stream_Get_UINT32(s);
407 if (dwMagic != BCRYPT_KEY_DATA_BLOB_MAGIC)
409 WLog_Print(log, WLOG_ERROR,
"unsupported authBlob type");
413 const UINT32 dwVersion = Stream_Get_UINT32(s);
414 if (dwVersion != BCRYPT_KEY_DATA_BLOB_VERSION1)
416 WLog_Print(log, WLOG_ERROR,
"unsupported authBlob version %" PRIu32
", expecting %d",
417 dwVersion, BCRYPT_KEY_DATA_BLOB_VERSION1);
421 const UINT32 cbKeyData = Stream_Get_UINT32(s);
422 if (!Stream_CheckAndLogRequiredLengthWLog(log, s, cbKeyData))
424 WLog_Print(log, WLOG_ERROR,
"invalid authBlob size");
428 WINPR_CIPHER_TYPE cipherType = WINPR_CIPHER_NONE;
432 cipherType = WINPR_CIPHER_AES_128_CBC;
435 cipherType = WINPR_CIPHER_AES_192_CBC;
438 cipherType = WINPR_CIPHER_AES_256_CBC;
441 WLog_Print(log, WLOG_ERROR,
"invalid authBlob cipher size");
445 ret = winpr_Cipher_NewEx(cipherType, WINPR_ENCRYPT, Stream_Pointer(s), cbKeyData, NULL, 0);
448 WLog_Print(log, WLOG_ERROR,
"error creating cipher");
452 if (!winpr_Cipher_SetPadding(ret, TRUE))
454 WLog_Print(log, WLOG_ERROR,
"unable to enable padding on cipher");
455 winpr_Cipher_Free(ret);
462static BOOL arm_stringEncodeW(
const BYTE* pin,
size_t cbIn, BYTE** ppOut,
size_t* pcbOut)
468 char* b64encoded = crypto_base64_encode_ex(pin, cbIn, TRUE);
474 *ppOut = (BYTE*)ConvertUtf8NToWCharAlloc(b64encoded, strlen(b64encoded), &outSz);
480 *pcbOut = (outSz + 1) *
sizeof(WCHAR);
484static BOOL arm_encodeRedirectPasswd(wLog* log, rdpSettings* settings,
const rdpCertificate* cert,
485 WINPR_CIPHER_CTX* cipher,
size_t blockSize)
489 BYTE* finalOutput = NULL;
495 size_t wpasswdLen = 0;
499 WLog_Print(log, WLOG_ERROR,
"error when converting password to UTF16");
503 const size_t wpasswdBytes = (wpasswdLen + 1) *
sizeof(WCHAR);
504 BYTE* encryptedPass = calloc(1, wpasswdBytes + blockSize);
510 size_t encryptedPassLen = 0;
511 if (!winpr_Cipher_Update(cipher, wpasswd, wpasswdBytes, encryptedPass, &encryptedPassLen))
514 if (encryptedPassLen > wpasswdBytes)
519 if (!winpr_Cipher_Final(cipher, &encryptedPass[encryptedPassLen], &finalLen))
521 WLog_Print(log, WLOG_ERROR,
"error when ciphering password");
524 encryptedPassLen += finalLen;
529 size_t output_length = 0;
530 if (!freerdp_certificate_publickey_encrypt(cert, encryptedPass, encryptedPassLen,
531 &output, &output_length))
533 WLog_Print(log, WLOG_ERROR,
"unable to encrypt with the server's public key");
538 size_t finalOutputLen = 0;
539 if (!arm_stringEncodeW(output, output_length, &finalOutput, &finalOutputLen))
541 WLog_Print(log, WLOG_ERROR,
"unable to base64+utf16 final blob");
546 finalOutput, finalOutputLen))
548 WLog_Print(log, WLOG_ERROR,
549 "unable to set the redirection password in settings");
556 settings->RdstlsSecurity = TRUE;
557 settings->AadSecurity = FALSE;
558 settings->NlaSecurity = FALSE;
559 settings->RdpSecurity = FALSE;
560 settings->TlsSecurity = FALSE;
561 settings->RedirectionFlags = LB_PASSWORD_IS_PK_ENCRYPTED;
575static BOOL arm_pick_base64Utf16Field(wLog* log,
const WINPR_JSON* json,
const char* name,
576 BYTE** poutput,
size_t* plen)
589 BYTE* output1 = NULL;
591 crypto_base64_decode(nodeValue, strlen(nodeValue), &output1, &len1);
592 if (!output1 || !len1)
594 WLog_Print(log, WLOG_ERROR,
"error when first unbase64 for %s", name);
600 char* output2 = ConvertWCharNToUtf8Alloc((WCHAR*)output1, len1 /
sizeof(WCHAR), &len2);
602 if (!output2 || !len2)
604 WLog_Print(log, WLOG_ERROR,
"error when decode('utf-16') for %s", name);
610 crypto_base64_decode(output2, len2, &output, plen);
612 if (!output || !*plen)
614 WLog_Print(log, WLOG_ERROR,
"error when second unbase64 for %s", name);
643static size_t arm_parse_ipvx_count(WINPR_JSON* ipvX)
654static BOOL arm_parse_ipv6(rdpSettings* settings, WINPR_JSON* ipv6,
size_t* pAddressIdx)
656 WINPR_ASSERT(settings);
658 WINPR_ASSERT(pAddressIdx);
668 for (
size_t j = 0; j < naddresses; j++)
675 if (utils_str_is_empty(addr))
678 if (*pAddressIdx >= count)
680 WLog_ERR(TAG,
"Exceeded TargetNetAddresses, parsing failed");
684 if (!freerdp_settings_set_pointer_array(settings, FreeRDP_TargetNetAddresses,
685 (*pAddressIdx)++, addr))
691static BOOL arm_parse_ipv4(rdpSettings* settings, WINPR_JSON* ipv4,
size_t* pAddressIdx)
693 WINPR_ASSERT(settings);
695 WINPR_ASSERT(pAddressIdx);
703 for (
size_t j = 0; j < naddresses; j++)
709 WINPR_JSON* publicIpNode =
714 if (!utils_str_is_empty(publicIp))
716 if (*pAddressIdx >= count)
718 WLog_ERR(TAG,
"Exceeded TargetNetAddresses, parsing failed");
721 if (!freerdp_settings_set_pointer_array(settings, FreeRDP_TargetNetAddresses,
722 (*pAddressIdx)++, publicIp))
727 WINPR_JSON* privateIpNode =
732 if (!utils_str_is_empty(privateIp))
734 if (*pAddressIdx >= count)
736 WLog_ERR(TAG,
"Exceeded TargetNetAddresses, parsing failed");
739 if (!freerdp_settings_set_pointer_array(settings, FreeRDP_TargetNetAddresses,
740 (*pAddressIdx)++, privateIp))
748static BOOL arm_treat_azureInstanceNetworkMetadata(wLog* log,
const char* metadata,
749 rdpSettings* settings)
753 WINPR_ASSERT(settings);
755 if (!freerdp_target_net_adresses_reset(settings, 0))
761 WLog_Print(log, WLOG_ERROR,
"invalid azureInstanceNetworkMetadata");
774 WLog_Print(log, WLOG_ERROR,
"expecting interface to be an Array");
780 if (interfaceSz == 0)
782 WLog_WARN(TAG,
"no addresses in azure instance metadata");
789 for (
size_t i = 0; i < interfaceSz; i++)
797 count += arm_parse_ipvx_count(ipv6);
801 count += arm_parse_ipvx_count(ipv4);
804 if (!freerdp_target_net_adresses_reset(settings, count))
809 size_t addressIdx = 0;
810 for (
size_t i = 0; i < interfaceSz; i++)
819 if (!arm_parse_ipv6(settings, ipv6, &addressIdx))
826 if (!arm_parse_ipv4(settings, ipv4, &addressIdx))
830 if (addressIdx > UINT32_MAX)
837 ret = addressIdx > 0;
846static void zfree(
char* str)
857static BOOL arm_fill_rdstls(rdpArm* arm, rdpSettings* settings,
const WINPR_JSON* json,
858 const rdpCertificate* redirectedServerCert)
862 BYTE* authBlob = NULL;
891 WINPR_ASSERT(arm->context);
892 WINPR_ASSERT(arm->context->instance);
894 char* username = NULL;
895 char* password = NULL;
899 domain = _strdup(ddomain);
901 username = _strdup(duser);
904 IFCALLRESULT(FALSE, arm->context->instance->AuthenticateEx, arm->context->instance,
905 &username, &password, &domain, AUTH_RDSTLS);
913 if (!rc || !rc1 || !rc2 || !rc3)
920 WINPR_JSON* redirectedAuthGuidNode =
927 if (!redirectedAuthGuid)
931 size_t wGUID_len = 0;
932 wGUID = ConvertUtf8ToWCharAlloc(redirectedAuthGuid, &wGUID_len);
933 if (!wGUID || (wGUID_len == 0))
935 WLog_Print(arm->log, WLOG_ERROR,
936 "unable to allocate space for redirectedAuthGuid");
942 settings, FreeRDP_RedirectionGuid, wGUID, (wGUID_len + 1) *
sizeof(WCHAR));
946 WLog_Print(arm->log, WLOG_ERROR,
"unable to set RedirectionGuid");
956 size_t authBlobLen = 0;
957 if (!arm_pick_base64Utf16Field(arm->log, json,
"redirectedAuthBlob", &authBlob,
962 size_t blockSize = 0;
963 WINPR_CIPHER_CTX* cipher = treatAuthBlob(arm->log, authBlob, authBlobLen, &blockSize);
968 const BOOL rerp = arm_encodeRedirectPasswd(arm->log, settings, redirectedServerCert,
970 winpr_Cipher_Free(cipher);
985static BOOL arm_fill_gateway_parameters(rdpArm* arm,
const char* message,
size_t len)
988 WINPR_ASSERT(arm->context);
989 WINPR_ASSERT(message);
991 rdpCertificate* redirectedServerCert = NULL;
996 WLog_Print(arm->log, WLOG_ERROR,
"Response data is not valid JSON: %s",
1001 if (WLog_IsLevelActive(arm->log, WLOG_DEBUG))
1004 WLog_Print(arm->log, WLOG_DEBUG,
"Got HTTP Response data: %s", str);
1008 rdpSettings* settings = arm->context->settings;
1013 if (gwurlstr != NULL)
1015 WLog_Print(arm->log, WLOG_DEBUG,
"extracted target url %s", gwurlstr);
1021 WINPR_JSON* serverNameNode =
1035 const char key[] =
"redirectedUsername";
1038 const char* userName = NULL;
1048 WINPR_JSON* azureMeta =
1052 if (!arm_treat_azureInstanceNetworkMetadata(
1055 WLog_Print(arm->log, WLOG_ERROR,
1056 "error when treating azureInstanceNetworkMetadata");
1066 if (arm_pick_base64Utf16Field(arm->log, json,
"redirectedServerCert", &cert, &certLen))
1068 const BOOL rc = rdp_redirection_read_target_cert(&redirectedServerCert, cert, certLen);
1072 else if (!rdp_set_target_certificate(settings, redirectedServerCert))
1080 status = arm_fill_rdstls(arm, settings, json, redirectedServerCert);
1084 freerdp_certificate_free(redirectedServerCert);
1088static BOOL arm_handle_request_ok(rdpArm* arm,
const HttpResponse* response)
1090 const size_t len = http_response_get_body_length(response);
1091 const char* msg = http_response_get_body(response);
1092 const size_t alen = strnlen(msg, len + 1);
1095 WLog_Print(arm->log, WLOG_ERROR,
"Got HTTP Response data with invalid termination");
1099 return arm_fill_gateway_parameters(arm, msg, len);
1102static BOOL arm_handle_bad_request(rdpArm* arm,
const HttpResponse* response, BOOL* retry)
1104 WINPR_ASSERT(response);
1105 WINPR_ASSERT(retry);
1111 http_response_log_error_status(WLog_Get(TAG), WLOG_ERROR, response);
1113 const size_t len = http_response_get_body_length(response);
1114 const char* msg = http_response_get_body(response);
1115 if (msg && (strnlen(msg, len + 1) > len))
1117 WLog_Print(arm->log, WLOG_ERROR,
"Got HTTP Response data, but length is invalid");
1122 WLog_Print(arm->log, WLOG_DEBUG,
"Got HTTP Response data: %s", msg);
1128 WLog_Print(arm->log, WLOG_ERROR,
"WINPR_JSON_ParseWithLength: %s", error_ptr);
1136 if (gw_code_str == NULL)
1138 WLog_Print(arm->log, WLOG_ERROR,
"Response has no \"Code\" property");
1142 if (strcmp(gw_code_str,
"E_PROXY_ORCHESTRATION_LB_SESSIONHOST_DEALLOCATED") == 0)
1148 WLog_WARN(TAG,
"Starting your VM. It may take up to 5 minutes");
1150 WLog_WARN(TAG,
"%s", msgstr);
1151 freerdp_set_last_error_if_not(arm->context, FREERDP_ERROR_CONNECT_TARGET_BOOTING);
1165static BOOL arm_handle_request(rdpArm* arm, BOOL* retry, DWORD timeout)
1167 WINPR_ASSERT(retry);
1169 if (!arm_fetch_wellknown(arm))
1177 char* message = NULL;
1180 HttpResponse* response = NULL;
1181 long StatusCode = 0;
1183 const char* useragent =
1185 const char* msuseragent =
1187 if (!http_context_set_uri(arm->http,
"/api/arm/v2/connections") ||
1188 !http_context_set_accept(arm->http,
"*/*") ||
1189 !http_context_set_cache_control(arm->http,
"no-cache") ||
1190 !http_context_set_pragma(arm->http,
"no-cache") ||
1191 !http_context_set_connection(arm->http,
"Keep-Alive") ||
1192 !http_context_set_user_agent(arm->http, useragent) ||
1193 !http_context_set_x_ms_user_agent(arm->http, msuseragent) ||
1195 FreeRDP_GatewayHostname)))
1198 if (!arm_tls_connect(arm, arm->tls, timeout))
1201 message = arm_create_request_json(arm);
1205 if (!arm_send_http_request(arm, arm->tls,
"POST",
"application/json", message, strlen(message)))
1208 response = http_response_recv(arm->tls, TRUE);
1212 StatusCode = http_response_get_status_code(response);
1213 if (StatusCode == HTTP_STATUS_OK)
1215 if (!arm_handle_request_ok(arm, response))
1218 else if (StatusCode == HTTP_STATUS_BAD_REQUEST)
1220 if (!arm_handle_bad_request(arm, response, retry))
1225 http_response_log_error_status(WLog_Get(TAG), WLOG_ERROR, response);
1231 http_response_free(response);
1238BOOL arm_resolve_endpoint(wLog* log, rdpContext* context, DWORD timeout)
1241 WLog_Print(log, WLOG_ERROR,
"arm gateway support not compiled in");
1248 if (!context->settings)
1254 WLog_Print(log, WLOG_ERROR,
"loadBalanceInfo and RemoteApplicationProgram needed");
1258 rdpArm* arm = arm_new(context);
1268 freerdp* instance = context->instance;
1269 WINPR_ASSERT(instance);
1270 SSIZE_T delay = IFCALLRESULT(-1, instance->RetryDialog, instance,
"arm-transport",
1271 arm->gateway_retry, arm);
1272 arm->gateway_retry++;
1277 WLog_Print(arm->log, WLOG_DEBUG,
"Delay for %" PRIdz
"ms before next attempt",
1281 DWORD slp = (UINT32)delay;
1282 if (delay > UINT32_MAX)
1289 rc = arm_handle_request(arm, &retry, timeout);
1291 }
while (retry && rc);
WINPR_API BOOL WINPR_JSON_HasObjectItem(const WINPR_JSON *object, const char *string)
Check if JSON has an object matching the name.
WINPR_API BOOL WINPR_JSON_IsString(const WINPR_JSON *item)
Check if JSON item is of type String.
WINPR_API WINPR_JSON * WINPR_JSON_CreateObject(void)
WINPR_JSON_CreateObject.
WINPR_API WINPR_JSON * WINPR_JSON_GetArrayItem(const WINPR_JSON *array, size_t index)
Return a pointer to an item in the array.
WINPR_API WINPR_JSON * WINPR_JSON_GetObjectItemCaseSensitive(const WINPR_JSON *object, const char *string)
Same as WINPR_JSON_GetObjectItem but with case sensitive matching.
WINPR_API WINPR_JSON * WINPR_JSON_AddStringToObject(WINPR_JSON *object, const char *name, const char *string)
WINPR_JSON_AddStringToObject.
WINPR_API WINPR_JSON * WINPR_JSON_ParseWithLength(const char *value, size_t buffer_length)
Parse a JSON string.
WINPR_API char * WINPR_JSON_PrintUnformatted(WINPR_JSON *item)
Serialize a JSON instance to string without formatting for human readable formatted output see WINPR_...
WINPR_API const char * WINPR_JSON_GetStringValue(WINPR_JSON *item)
Return the String value of a JSON item.
WINPR_API WINPR_JSON * WINPR_JSON_AddNullToObject(WINPR_JSON *object, const char *name)
WINPR_JSON_AddNullToObject.
WINPR_API void WINPR_JSON_Delete(WINPR_JSON *item)
Delete a WinPR JSON wrapper object.
WINPR_API size_t WINPR_JSON_GetArraySize(const WINPR_JSON *array)
Get the number of arrayitems from an array.
WINPR_API BOOL WINPR_JSON_IsArray(const WINPR_JSON *item)
Check if JSON item is of type Array.
WINPR_API const char * WINPR_JSON_GetErrorPtr(void)
Return an error string.
WINPR_API WINPR_JSON * WINPR_JSON_Parse(const char *value)
Parse a '\0' terminated JSON string.
FREERDP_API UINT32 freerdp_settings_get_uint32(const rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id)
Returns a UINT32 settings value.
FREERDP_API BOOL freerdp_settings_set_string(rdpSettings *settings, FreeRDP_Settings_Keys_String id, const char *param)
Sets a string settings value. The param is copied.
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.
FREERDP_API BOOL freerdp_settings_set_pointer_len(rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id, const void *data, size_t len)
Set a pointer to value data.
FREERDP_API WCHAR * freerdp_settings_get_string_as_utf16(const rdpSettings *settings, FreeRDP_Settings_Keys_String id, size_t *pCharLen)
Return an allocated UTF16 string.
FREERDP_API const void * freerdp_settings_get_pointer(const rdpSettings *settings, FreeRDP_Settings_Keys_Pointer id)
Returns a immutable pointer settings value.
FREERDP_API BOOL freerdp_settings_set_uint32(rdpSettings *settings, FreeRDP_Settings_Keys_UInt32 id, UINT32 param)
Sets a UINT32 settings value.
FREERDP_API const char * freerdp_settings_get_string(const rdpSettings *settings, FreeRDP_Settings_Keys_String id)
Returns a immutable string settings value.