libfreerdp-utils: purge deprecated freerdp_UnicodeToAsciiAlloc util in favor of WinPR ConvertFromUnicode
This commit is contained in:
parent
a02090c09b
commit
af9be28000
@ -145,7 +145,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT3
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
format_name->length = freerdp_UnicodeToAsciiAlloc((WCHAR*) s->p, &format_name->name, 32 / 2);
|
format_name->length = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) s->p, 32 / 2, &format_name->name, 0, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
stream_seek(s, 32);
|
stream_seek(s, 32);
|
||||||
@ -188,7 +188,8 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, UINT32
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
format_name->length = freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &format_name->name, name_len / 2);
|
format_name->length = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), name_len / 2, &format_name->name, 0, NULL, NULL);
|
||||||
|
|
||||||
stream_seek(s, name_len + 2);
|
stream_seek(s, name_len + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,9 +432,9 @@ BOOL drive_file_query_information(DRIVE_FILE* file, UINT32 FsInformationClass, S
|
|||||||
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, STREAM* input)
|
BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, STREAM* input)
|
||||||
{
|
{
|
||||||
char* s;
|
char* s;
|
||||||
|
|
||||||
mode_t m;
|
mode_t m;
|
||||||
UINT64 size;
|
UINT64 size;
|
||||||
|
int status;
|
||||||
char* fullpath;
|
char* fullpath;
|
||||||
struct STAT st;
|
struct STAT st;
|
||||||
struct timeval tv[2];
|
struct timeval tv[2];
|
||||||
@ -502,7 +502,11 @@ BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UIN
|
|||||||
stream_seek_BYTE(input); /* RootDirectory */
|
stream_seek_BYTE(input); /* RootDirectory */
|
||||||
stream_read_UINT32(input, FileNameLength);
|
stream_read_UINT32(input, FileNameLength);
|
||||||
|
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(input), &s, FileNameLength / 2);
|
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(input),
|
||||||
|
FileNameLength / 2, &s, 0, NULL, NULL);
|
||||||
|
|
||||||
|
if (status < 1)
|
||||||
|
s = (char*) calloc(1, 1);
|
||||||
|
|
||||||
fullpath = drive_file_combine_fullpath(file->basepath, s);
|
fullpath = drive_file_combine_fullpath(file->basepath, s);
|
||||||
free(s);
|
free(s);
|
||||||
|
@ -119,6 +119,7 @@ static DRIVE_FILE* drive_get_file_by_id(DRIVE_DEVICE* disk, UINT32 id)
|
|||||||
static void drive_process_irp_create(DRIVE_DEVICE* disk, IRP* irp)
|
static void drive_process_irp_create(DRIVE_DEVICE* disk, IRP* irp)
|
||||||
{
|
{
|
||||||
char* path;
|
char* path;
|
||||||
|
int status;
|
||||||
UINT32 FileId;
|
UINT32 FileId;
|
||||||
DRIVE_FILE* file;
|
DRIVE_FILE* file;
|
||||||
BYTE Information;
|
BYTE Information;
|
||||||
@ -133,7 +134,11 @@ static void drive_process_irp_create(DRIVE_DEVICE* disk, IRP* irp)
|
|||||||
stream_read_UINT32(irp->input, CreateOptions);
|
stream_read_UINT32(irp->input, CreateOptions);
|
||||||
stream_read_UINT32(irp->input, PathLength);
|
stream_read_UINT32(irp->input, PathLength);
|
||||||
|
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
|
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(irp->input),
|
||||||
|
PathLength / 2, &path, 0, NULL, NULL);
|
||||||
|
|
||||||
|
if (status < 1)
|
||||||
|
path = (char*) calloc(1, 1);
|
||||||
|
|
||||||
FileId = irp->devman->id_sequence++;
|
FileId = irp->devman->id_sequence++;
|
||||||
|
|
||||||
@ -468,6 +473,7 @@ static void drive_process_irp_query_volume_information(DRIVE_DEVICE* disk, IRP*
|
|||||||
static void drive_process_irp_query_directory(DRIVE_DEVICE* disk, IRP* irp)
|
static void drive_process_irp_query_directory(DRIVE_DEVICE* disk, IRP* irp)
|
||||||
{
|
{
|
||||||
char* path;
|
char* path;
|
||||||
|
int status;
|
||||||
DRIVE_FILE* file;
|
DRIVE_FILE* file;
|
||||||
BYTE InitialQuery;
|
BYTE InitialQuery;
|
||||||
UINT32 PathLength;
|
UINT32 PathLength;
|
||||||
@ -478,7 +484,11 @@ static void drive_process_irp_query_directory(DRIVE_DEVICE* disk, IRP* irp)
|
|||||||
stream_read_UINT32(irp->input, PathLength);
|
stream_read_UINT32(irp->input, PathLength);
|
||||||
stream_seek(irp->input, 23); /* Padding */
|
stream_seek(irp->input, 23); /* Padding */
|
||||||
|
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
|
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(irp->input),
|
||||||
|
PathLength / 2, &path, 0, NULL, NULL);
|
||||||
|
|
||||||
|
if (status < 1)
|
||||||
|
path = (char*) calloc(1, 1);
|
||||||
|
|
||||||
file = drive_get_file_by_id(disk, irp->FileId);
|
file = drive_get_file_by_id(disk, irp->FileId);
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ typedef struct _PARALLEL_DEVICE PARALLEL_DEVICE;
|
|||||||
static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
|
static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
|
||||||
{
|
{
|
||||||
char* path;
|
char* path;
|
||||||
|
int status;
|
||||||
UINT32 PathLength;
|
UINT32 PathLength;
|
||||||
|
|
||||||
stream_seek(irp->input, 28);
|
stream_seek(irp->input, 28);
|
||||||
@ -81,7 +82,11 @@ static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
|
|||||||
/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
|
/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
|
||||||
stream_read_UINT32(irp->input, PathLength);
|
stream_read_UINT32(irp->input, PathLength);
|
||||||
|
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
|
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(irp->input),
|
||||||
|
PathLength / 2, &path, 0, NULL, NULL);
|
||||||
|
|
||||||
|
if (status < 1)
|
||||||
|
path = (char*) calloc(1, 1);
|
||||||
|
|
||||||
parallel->id = irp->devman->id_sequence++;
|
parallel->id = irp->devman->id_sequence++;
|
||||||
parallel->file = open(parallel->path, O_RDWR);
|
parallel->file = open(parallel->path, O_RDWR);
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#include "serial_tty.h"
|
#include "serial_tty.h"
|
||||||
#include "serial_constants.h"
|
#include "serial_constants.h"
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/thread.h>
|
#include <freerdp/utils/thread.h>
|
||||||
@ -79,6 +81,7 @@ static BOOL serial_check_fds(SERIAL_DEVICE* serial);
|
|||||||
static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
|
static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
|
||||||
{
|
{
|
||||||
char* path;
|
char* path;
|
||||||
|
int status;
|
||||||
SERIAL_TTY* tty;
|
SERIAL_TTY* tty;
|
||||||
UINT32 PathLength;
|
UINT32 PathLength;
|
||||||
UINT32 FileId;
|
UINT32 FileId;
|
||||||
@ -87,7 +90,11 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
|
|||||||
/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
|
/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */
|
||||||
stream_read_UINT32(irp->input, PathLength);
|
stream_read_UINT32(irp->input, PathLength);
|
||||||
|
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(irp->input), &path, PathLength / 2);
|
status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(irp->input),
|
||||||
|
PathLength / 2, &path, 0, NULL, NULL);
|
||||||
|
|
||||||
|
if (status < 1)
|
||||||
|
path = (char*) calloc(1, 1);
|
||||||
|
|
||||||
FileId = irp->devman->id_sequence++;
|
FileId = irp->devman->id_sequence++;
|
||||||
|
|
||||||
|
@ -593,7 +593,8 @@ static BYTE* xf_cliprdr_process_requested_html(BYTE* data, int* size)
|
|||||||
|
|
||||||
if ((BYTE) data[0] == 0xFF && (BYTE) data[1] == 0xFE)
|
if ((BYTE) data[0] == 0xFF && (BYTE) data[1] == 0xFE)
|
||||||
{
|
{
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) (data + 2), &inbuf, (*size - 2) / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) (data + 2),
|
||||||
|
(*size - 2) / 2, &inbuf, 0, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -891,7 +892,7 @@ static void xf_cliprdr_process_text(clipboardContext* cb, BYTE* data, int size)
|
|||||||
|
|
||||||
static void xf_cliprdr_process_unicodetext(clipboardContext* cb, BYTE* data, int size)
|
static void xf_cliprdr_process_unicodetext(clipboardContext* cb, BYTE* data, int size)
|
||||||
{
|
{
|
||||||
cb->data_length = freerdp_UnicodeToAsciiAlloc((WCHAR*) data, (CHAR**) &(cb->data), size / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) data, size / 2, (CHAR**) &(cb->data), 0, NULL, NULL);
|
||||||
crlf2lf(cb->data, &cb->data_length);
|
crlf2lf(cb->data, &cb->data_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,6 +27,5 @@
|
|||||||
#include <freerdp/types.h>
|
#include <freerdp/types.h>
|
||||||
|
|
||||||
FREERDP_API int freerdp_AsciiToUnicodeAlloc(const CHAR* str, WCHAR** wstr, int length);
|
FREERDP_API int freerdp_AsciiToUnicodeAlloc(const CHAR* str, WCHAR** wstr, int length);
|
||||||
FREERDP_API int freerdp_UnicodeToAsciiAlloc(const WCHAR* wstr, CHAR** str, int length);
|
|
||||||
|
|
||||||
#endif /* FREERDP_UTILS_UNICODE_H */
|
#endif /* FREERDP_UTILS_UNICODE_H */
|
||||||
|
@ -513,7 +513,7 @@ BOOL gcc_read_client_core_data(STREAM* s, rdpSettings* settings, UINT16 blockLen
|
|||||||
stream_read_UINT32(s, settings->ClientBuild); /* ClientBuild */
|
stream_read_UINT32(s, settings->ClientBuild); /* ClientBuild */
|
||||||
|
|
||||||
/* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */
|
/* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 32 / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), 32 / 2, &str, 0, NULL, NULL);
|
||||||
stream_seek(s, 32);
|
stream_seek(s, 32);
|
||||||
sprintf_s(settings->ClientHostname, 31, "%s", str);
|
sprintf_s(settings->ClientHostname, 31, "%s", str);
|
||||||
settings->ClientHostname[31] = 0;
|
settings->ClientHostname[31] = 0;
|
||||||
@ -569,7 +569,7 @@ BOOL gcc_read_client_core_data(STREAM* s, rdpSettings* settings, UINT16 blockLen
|
|||||||
if (blockLength < 64)
|
if (blockLength < 64)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), 64 / 2, &str, 0, NULL, NULL);
|
||||||
stream_seek(s, 64);
|
stream_seek(s, 64);
|
||||||
sprintf_s(settings->ClientProductId, 32, "%s", str);
|
sprintf_s(settings->ClientProductId, 32, "%s", str);
|
||||||
free(str);
|
free(str);
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/utils/unicode.h>
|
#include <freerdp/utils/unicode.h>
|
||||||
|
|
||||||
#include "timezone.h"
|
#include "timezone.h"
|
||||||
@ -123,7 +125,7 @@ BOOL rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings)
|
|||||||
if (stream_get_left(s) < cbClientAddress)
|
if (stream_get_left(s) < cbClientAddress)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->ClientAddress, cbClientAddress / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), cbClientAddress / 2, &settings->ClientAddress, 0, NULL, NULL);
|
||||||
stream_seek(s, cbClientAddress);
|
stream_seek(s, cbClientAddress);
|
||||||
|
|
||||||
stream_read_UINT16(s, cbClientDir); /* cbClientDir */
|
stream_read_UINT16(s, cbClientDir); /* cbClientDir */
|
||||||
@ -134,7 +136,7 @@ BOOL rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings)
|
|||||||
if (settings->ClientDir)
|
if (settings->ClientDir)
|
||||||
free(settings->ClientDir);
|
free(settings->ClientDir);
|
||||||
|
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->ClientDir, cbClientDir / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), cbClientDir / 2, &settings->ClientDir, 0, NULL, NULL);
|
||||||
stream_seek(s, cbClientDir);
|
stream_seek(s, cbClientDir);
|
||||||
|
|
||||||
if (!rdp_read_client_time_zone(s, settings))
|
if (!rdp_read_client_time_zone(s, settings))
|
||||||
@ -244,7 +246,7 @@ BOOL rdp_read_info_packet(STREAM* s, rdpSettings* settings)
|
|||||||
|
|
||||||
if (cbDomain > 0)
|
if (cbDomain > 0)
|
||||||
{
|
{
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->Domain, cbDomain / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), cbDomain / 2, &settings->Domain, 0, NULL, NULL);
|
||||||
stream_seek(s, cbDomain);
|
stream_seek(s, cbDomain);
|
||||||
}
|
}
|
||||||
stream_seek(s, 2);
|
stream_seek(s, 2);
|
||||||
@ -254,7 +256,7 @@ BOOL rdp_read_info_packet(STREAM* s, rdpSettings* settings)
|
|||||||
|
|
||||||
if (cbUserName > 0)
|
if (cbUserName > 0)
|
||||||
{
|
{
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->Username, cbUserName / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), cbUserName / 2, &settings->Username, 0, NULL, NULL);
|
||||||
stream_seek(s, cbUserName);
|
stream_seek(s, cbUserName);
|
||||||
}
|
}
|
||||||
stream_seek(s, 2);
|
stream_seek(s, 2);
|
||||||
@ -264,7 +266,7 @@ BOOL rdp_read_info_packet(STREAM* s, rdpSettings* settings)
|
|||||||
|
|
||||||
if (cbPassword > 0)
|
if (cbPassword > 0)
|
||||||
{
|
{
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->Password, cbPassword / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), cbPassword / 2, &settings->Password, 0, NULL, NULL);
|
||||||
stream_seek(s, cbPassword);
|
stream_seek(s, cbPassword);
|
||||||
}
|
}
|
||||||
stream_seek(s, 2);
|
stream_seek(s, 2);
|
||||||
@ -274,7 +276,7 @@ BOOL rdp_read_info_packet(STREAM* s, rdpSettings* settings)
|
|||||||
|
|
||||||
if (cbAlternateShell > 0)
|
if (cbAlternateShell > 0)
|
||||||
{
|
{
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->AlternateShell, cbAlternateShell / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), cbAlternateShell / 2, &settings->AlternateShell, 0, NULL, NULL);
|
||||||
stream_seek(s, cbAlternateShell);
|
stream_seek(s, cbAlternateShell);
|
||||||
}
|
}
|
||||||
stream_seek(s, 2);
|
stream_seek(s, 2);
|
||||||
@ -284,7 +286,7 @@ BOOL rdp_read_info_packet(STREAM* s, rdpSettings* settings)
|
|||||||
|
|
||||||
if (cbWorkingDir > 0)
|
if (cbWorkingDir > 0)
|
||||||
{
|
{
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->ShellWorkingDirectory, cbWorkingDir / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), cbWorkingDir / 2, &settings->ShellWorkingDirectory, 0, NULL, NULL);
|
||||||
stream_seek(s, cbWorkingDir);
|
stream_seek(s, cbWorkingDir);
|
||||||
}
|
}
|
||||||
stream_seek(s, 2);
|
stream_seek(s, 2);
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/utils/unicode.h>
|
#include <freerdp/utils/unicode.h>
|
||||||
|
|
||||||
#include "timezone.h"
|
#include "timezone.h"
|
||||||
@ -87,7 +89,7 @@ BOOL rdp_read_client_time_zone(STREAM* s, rdpSettings* settings)
|
|||||||
stream_read_UINT32(s, clientTimeZone->bias); /* Bias */
|
stream_read_UINT32(s, clientTimeZone->bias); /* Bias */
|
||||||
|
|
||||||
/* standardName (64 bytes) */
|
/* standardName (64 bytes) */
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), 64 / 2, &str, 0, NULL, NULL);
|
||||||
stream_seek(s, 64);
|
stream_seek(s, 64);
|
||||||
strncpy(clientTimeZone->standardName, str, sizeof(clientTimeZone->standardName));
|
strncpy(clientTimeZone->standardName, str, sizeof(clientTimeZone->standardName));
|
||||||
free(str);
|
free(str);
|
||||||
@ -96,7 +98,7 @@ BOOL rdp_read_client_time_zone(STREAM* s, rdpSettings* settings)
|
|||||||
stream_read_UINT32(s, clientTimeZone->standardBias); /* StandardBias */
|
stream_read_UINT32(s, clientTimeZone->standardBias); /* StandardBias */
|
||||||
|
|
||||||
/* daylightName (64 bytes) */
|
/* daylightName (64 bytes) */
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(s), 64 / 2, &str, 0, NULL, NULL);
|
||||||
stream_seek(s, 64);
|
stream_seek(s, 64);
|
||||||
strncpy(clientTimeZone->daylightName, str, sizeof(clientTimeZone->daylightName));
|
strncpy(clientTimeZone->daylightName, str, sizeof(clientTimeZone->daylightName));
|
||||||
free(str);
|
free(str);
|
||||||
|
@ -285,7 +285,8 @@ void rail_CreateWindow(rdpRail* rail, rdpWindow* window)
|
|||||||
{
|
{
|
||||||
if (window->titleInfo.length > 0)
|
if (window->titleInfo.length > 0)
|
||||||
{
|
{
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) window->titleInfo.string, &window->title, window->titleInfo.length / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) window->titleInfo.string, window->titleInfo.length / 2,
|
||||||
|
&window->title, 0, NULL, NULL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -327,7 +328,8 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window)
|
|||||||
if (window->title != NULL)
|
if (window->title != NULL)
|
||||||
free(window->title);
|
free(window->title);
|
||||||
|
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) window->titleInfo.string, &window->title, window->titleInfo.length / 2);
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) window->titleInfo.string, window->titleInfo.length / 2,
|
||||||
|
&window->title, 0, NULL, NULL);
|
||||||
|
|
||||||
IFCALL(rail->rail_SetWindowText, rail, window);
|
IFCALL(rail->rail_SetWindowText, rail, window);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <freerdp/utils/unicode.h>
|
#include <winpr/crt.h>
|
||||||
|
|
||||||
#include <freerdp/utils/string.h>
|
#include <freerdp/utils/string.h>
|
||||||
|
|
||||||
@ -34,7 +34,8 @@ void freerdp_string_read_length32(STREAM* s, rdpString* string)
|
|||||||
stream_read_UINT32(s, string->length);
|
stream_read_UINT32(s, string->length);
|
||||||
string->unicode = (char*) malloc(string->length);
|
string->unicode = (char*) malloc(string->length);
|
||||||
stream_read(s, string->unicode, string->length);
|
stream_read(s, string->unicode, string->length);
|
||||||
freerdp_UnicodeToAsciiAlloc((WCHAR*) string->unicode, &string->ascii, string->length / 2);
|
|
||||||
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) string->unicode, string->length / 2, &string->ascii, 0, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void freerdp_string_free(rdpString* string)
|
void freerdp_string_free(rdpString* string)
|
||||||
|
@ -46,19 +46,3 @@ int freerdp_AsciiToUnicodeAlloc(const CHAR* str, WCHAR** wstr, int length)
|
|||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int freerdp_UnicodeToAsciiAlloc(const WCHAR* wstr, CHAR** str, int length)
|
|
||||||
{
|
|
||||||
int status;
|
|
||||||
|
|
||||||
if (length < 1)
|
|
||||||
{
|
|
||||||
*str = malloc(1);
|
|
||||||
(*str)[0] = '\0';
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = ConvertFromUnicode(CP_UTF8, 0, wstr, -1, str, 0, NULL, NULL);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user