mirror of https://github.com/FreeRDP/FreeRDP
libfreerdp-utils: remove deprecrated unicode utils in favor of WinPR
This commit is contained in:
parent
af9be28000
commit
d19e2042c3
|
@ -27,11 +27,10 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <winpr/print.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/client/cliprdr.h>
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/client/cliprdr.h>
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include <winpr/file.h>
|
||||
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
|
@ -603,7 +602,7 @@ BOOL drive_file_query_directory(DRIVE_FILE* file, UINT32 FsInformationClass, BYT
|
|||
DEBUG_SVC(" pattern %s matched %s", file->pattern, ent_path);
|
||||
free(ent_path);
|
||||
|
||||
length = freerdp_AsciiToUnicodeAlloc(ent->d_name, &ent_path, 0) * 2;
|
||||
length = ConvertToUnicode(CP_UTF8, 0, ent->d_name, -1, &ent_path, 0) * 2;
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
|
|
|
@ -35,17 +35,16 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/list.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/synch.h>
|
||||
#include <winpr/thread.h>
|
||||
#include <winpr/interlocked.h>
|
||||
|
||||
#include <freerdp/utils/list.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
#include "drive_file.h"
|
||||
|
||||
typedef struct _DRIVE_DEVICE DRIVE_DEVICE;
|
||||
|
@ -404,7 +403,7 @@ static void drive_process_irp_query_volume_information(DRIVE_DEVICE* disk, IRP*
|
|||
{
|
||||
case FileFsVolumeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232108.aspx */
|
||||
length = freerdp_AsciiToUnicodeAlloc(volumeLabel, &outStr, 0) * 2;
|
||||
length = ConvertToUnicode(CP_UTF8, 0, volumeLabel, -1, &outStr, 0) * 2;
|
||||
stream_write_UINT32(output, 17 + length); /* Length */
|
||||
stream_check_size(output, 17 + length);
|
||||
stream_write_UINT64(output, FILE_TIME_SYSTEM_TO_RDP(st.st_ctime)); /* VolumeCreationTime */
|
||||
|
@ -428,7 +427,7 @@ static void drive_process_irp_query_volume_information(DRIVE_DEVICE* disk, IRP*
|
|||
|
||||
case FileFsAttributeInformation:
|
||||
/* http://msdn.microsoft.com/en-us/library/cc232101.aspx */
|
||||
length = freerdp_AsciiToUnicodeAlloc(diskType, &outStr, 0) * 2;
|
||||
length = ConvertToUnicode(CP_UTF8, 0, diskType, -1, &outStr, 0) * 2;
|
||||
stream_write_UINT32(output, 12 + length); /* Length */
|
||||
stream_check_size(output, 12 + length);
|
||||
stream_write_UINT32(output,
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
#include <freerdp/utils/list.h>
|
||||
#include <freerdp/utils/thread.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <winpr/interlocked.h>
|
||||
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/thread.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
@ -266,8 +265,8 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
|
|||
if (printer->is_default)
|
||||
Flags |= RDPDR_PRINTER_ANNOUNCE_FLAG_DEFAULTPRINTER;
|
||||
|
||||
DriverNameLen = freerdp_AsciiToUnicodeAlloc(printer->driver, &DriverName, 0) * 2;
|
||||
PrintNameLen = freerdp_AsciiToUnicodeAlloc(printer->name, &PrintName, 0) * 2;
|
||||
DriverNameLen = ConvertToUnicode(CP_UTF8, 0, printer->driver, -1, &DriverName, 0) * 2;
|
||||
PrintNameLen = ConvertToUnicode(CP_UTF8, 0, printer->name, -1, &PrintName, 0) * 2;
|
||||
|
||||
printer_dev->device.data = stream_new(28 + DriverNameLen + PrintNameLen + CachedFieldsLen);
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/utils/rail.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include "rail_orders.h"
|
||||
|
||||
|
@ -83,7 +82,7 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_
|
|||
if (string == NULL || strlen(string) < 1)
|
||||
return;
|
||||
|
||||
length = freerdp_AsciiToUnicodeAlloc(string, &buffer, 0) * 2;
|
||||
length = ConvertToUnicode(CP_UTF8, 0, string, -1, &buffer, 0) * 2;
|
||||
|
||||
unicode_string->string = (BYTE*) buffer;
|
||||
unicode_string->length = (UINT16) length;
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <freerdp/types.h>
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
|
||||
|
@ -99,7 +98,7 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
|
|||
if (!rdpdr->computerName[0])
|
||||
gethostname(rdpdr->computerName, sizeof(rdpdr->computerName) - 1);
|
||||
|
||||
computerNameLenW = freerdp_AsciiToUnicodeAlloc(rdpdr->computerName, &computerNameW, 0) * 2;
|
||||
computerNameLenW = ConvertToUnicode(CP_UTF8, 0, rdpdr->computerName, -1, &computerNameW, 0) * 2;
|
||||
|
||||
data_out = stream_new(16 + computerNameLenW + 2);
|
||||
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/thread.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
typedef struct _SERIAL_DEVICE SERIAL_DEVICE;
|
||||
|
|
|
@ -27,13 +27,12 @@
|
|||
#include <string.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/utils/list.h>
|
||||
#include <freerdp/utils/thread.h>
|
||||
#include <freerdp/utils/svc_plugin.h>
|
||||
#include <winpr/print.h>
|
||||
#include <freerdp/channels/rdpdr.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
|
|
|
@ -21,9 +21,10 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/utils/event.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/client/cliprdr.h>
|
||||
|
||||
#include "wf_cliprdr.h"
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include <freerdp/utils/event.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
#include <freerdp/client/cliprdr.h>
|
||||
|
||||
#include "xf_cliprdr.h"
|
||||
|
@ -538,7 +537,7 @@ static BYTE* xf_cliprdr_process_requested_unicodetext(BYTE* data, int* size)
|
|||
int out_size;
|
||||
|
||||
inbuf = (char*) lf2crlf(data, size);
|
||||
out_size = freerdp_AsciiToUnicodeAlloc(inbuf, &outbuf, 0);
|
||||
out_size = ConvertToUnicode(CP_UTF8, 0, inbuf, -1, &outbuf, 0);
|
||||
free(inbuf);
|
||||
|
||||
*size = (int) ((out_size + 1) * 2);
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Unicode Utils
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef FREERDP_UTILS_UNICODE_H
|
||||
#define FREERDP_UTILS_UNICODE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/types.h>
|
||||
|
||||
FREERDP_API int freerdp_AsciiToUnicodeAlloc(const CHAR* str, WCHAR** wstr, int length);
|
||||
|
||||
#endif /* FREERDP_UTILS_UNICODE_H */
|
|
@ -26,8 +26,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/ndr.h>
|
||||
#include <winpr/error.h>
|
||||
|
@ -1070,8 +1068,8 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
|
|||
rdpSettings* settings = rpc->settings;
|
||||
|
||||
tsg->Port = port;
|
||||
freerdp_AsciiToUnicodeAlloc(hostname, &tsg->Hostname, 0);
|
||||
freerdp_AsciiToUnicodeAlloc(settings->ComputerName, &tsg->MachineName, 0);
|
||||
ConvertToUnicode(CP_UTF8, 0, hostname, -1, &tsg->Hostname, 0);
|
||||
ConvertToUnicode(CP_UTF8, 0, settings->ComputerName, -1, &tsg->MachineName, 0);
|
||||
|
||||
if (!rpc_connect(rpc))
|
||||
{
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#endif
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include "gcc.h"
|
||||
#include "certificate.h"
|
||||
|
@ -669,8 +668,8 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings* settings)
|
|||
|
||||
version = settings->RdpVersion >= 5 ? RDP_VERSION_5_PLUS : RDP_VERSION_4;
|
||||
|
||||
clientNameLength = freerdp_AsciiToUnicodeAlloc(settings->ClientHostname, &clientName, 0);
|
||||
clientDigProductIdLength = freerdp_AsciiToUnicodeAlloc(settings->ClientProductId, &clientDigProductId, 0);
|
||||
clientNameLength = ConvertToUnicode(CP_UTF8, 0, settings->ClientHostname, -1, &clientName, 0);
|
||||
clientDigProductIdLength = ConvertToUnicode(CP_UTF8, 0, settings->ClientProductId, -1, &clientDigProductId, 0);
|
||||
|
||||
stream_write_UINT32(s, version); /* Version */
|
||||
stream_write_UINT16(s, settings->DesktopWidth); /* DesktopWidth */
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include "timezone.h"
|
||||
|
||||
#include "info.h"
|
||||
|
@ -174,9 +172,9 @@ void rdp_write_extended_info_packet(STREAM* s, rdpSettings* settings)
|
|||
|
||||
clientAddressFamily = settings->IPv6Enabled ? ADDRESS_FAMILY_INET6 : ADDRESS_FAMILY_INET;
|
||||
|
||||
cbClientAddress = freerdp_AsciiToUnicodeAlloc(settings->ClientAddress, &clientAddress, 0) * 2;
|
||||
cbClientAddress = ConvertToUnicode(CP_UTF8, 0, settings->ClientAddress, -1, &clientAddress, 0) * 2;
|
||||
|
||||
cbClientDir = freerdp_AsciiToUnicodeAlloc(settings->ClientDir, &clientDir, 0) * 2;
|
||||
cbClientDir = ConvertToUnicode(CP_UTF8, 0, settings->ClientDir, -1, &clientDir, 0) * 2;
|
||||
|
||||
cbAutoReconnectLen = (int) settings->ClientAutoReconnectCookie->cbLen;
|
||||
|
||||
|
@ -307,16 +305,16 @@ BOOL rdp_read_info_packet(STREAM* s, rdpSettings* settings)
|
|||
void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
|
||||
{
|
||||
UINT32 flags;
|
||||
WCHAR* domain;
|
||||
int cbDomain;
|
||||
WCHAR* userName;
|
||||
int cbUserName;
|
||||
WCHAR* password;
|
||||
int cbPassword;
|
||||
WCHAR* alternateShell;
|
||||
int cbAlternateShell;
|
||||
WCHAR* workingDir;
|
||||
int cbWorkingDir;
|
||||
WCHAR* domain = NULL;
|
||||
int cbDomain = 0;
|
||||
WCHAR* userName = NULL;
|
||||
int cbUserName = 0;
|
||||
WCHAR* password = NULL;
|
||||
int cbPassword = 0;
|
||||
WCHAR* alternateShell = NULL;
|
||||
int cbAlternateShell = 0;
|
||||
WCHAR* workingDir = NULL;
|
||||
int cbWorkingDir = 0;
|
||||
BOOL usedPasswordCookie = FALSE;
|
||||
|
||||
flags = INFO_MOUSE |
|
||||
|
@ -347,7 +345,7 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
|
|||
|
||||
if (settings->Domain)
|
||||
{
|
||||
cbDomain = freerdp_AsciiToUnicodeAlloc(settings->Domain, &domain, 0) * 2;
|
||||
cbDomain = ConvertToUnicode(CP_UTF8, 0, settings->Domain, -1, &domain, 0) * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -355,7 +353,7 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
|
|||
cbDomain = 0;
|
||||
}
|
||||
|
||||
cbUserName = freerdp_AsciiToUnicodeAlloc(settings->Username, &userName, 0) * 2;
|
||||
cbUserName = ConvertToUnicode(CP_UTF8, 0, settings->Username, -1, &userName, 0) * 2;
|
||||
|
||||
if (settings->RedirectionPassword && settings->RedirectionPasswordLength > 0)
|
||||
{
|
||||
|
@ -365,12 +363,12 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
|
|||
}
|
||||
else
|
||||
{
|
||||
cbPassword = freerdp_AsciiToUnicodeAlloc(settings->Password, &password, 0) * 2;
|
||||
cbPassword = ConvertToUnicode(CP_UTF8, 0, settings->Password, -1, &password, 0) * 2;
|
||||
}
|
||||
|
||||
cbAlternateShell = freerdp_AsciiToUnicodeAlloc(settings->AlternateShell, &alternateShell, 0) * 2;
|
||||
cbAlternateShell = ConvertToUnicode(CP_UTF8, 0, settings->AlternateShell, -1, &alternateShell, 0) * 2;
|
||||
|
||||
cbWorkingDir = freerdp_AsciiToUnicodeAlloc(settings->ShellWorkingDirectory, &workingDir, 0) * 2;
|
||||
cbWorkingDir = ConvertToUnicode(CP_UTF8, 0, settings->ShellWorkingDirectory, -1, &workingDir, 0) * 2;
|
||||
|
||||
stream_write_UINT32(s, 0); /* CodePage */
|
||||
stream_write_UINT32(s, flags); /* flags */
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/constants.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include "tpkt.h"
|
||||
|
||||
#include "nego.h"
|
||||
|
@ -274,7 +271,7 @@ BOOL nego_send_preconnection_pdu(rdpNego* nego)
|
|||
|
||||
if (nego->preconnection_blob)
|
||||
{
|
||||
cchPCB = (UINT16) freerdp_AsciiToUnicodeAlloc(nego->preconnection_blob, &wszPCB, 0);
|
||||
cchPCB = (UINT16) ConvertToUnicode(CP_UTF8, 0, nego->preconnection_blob, -1, &wszPCB, 0);
|
||||
cchPCB += 1; /* zero-termination */
|
||||
cbSize += cchPCB * 2;
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include "timezone.h"
|
||||
|
||||
/**
|
||||
|
@ -130,8 +128,8 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings)
|
|||
clientTimeZone = settings->ClientTimeZone;
|
||||
freerdp_time_zone_detect(clientTimeZone);
|
||||
|
||||
standardNameLength = freerdp_AsciiToUnicodeAlloc(clientTimeZone->standardName, &standardName, 0) * 2;
|
||||
daylightNameLength = freerdp_AsciiToUnicodeAlloc(clientTimeZone->daylightName, &daylightName, 0) * 2;
|
||||
standardNameLength = ConvertToUnicode(CP_UTF8, 0, clientTimeZone->standardName, -1, &standardName, 0) * 2;
|
||||
daylightNameLength = ConvertToUnicode(CP_UTF8, 0, clientTimeZone->daylightName, -1, &daylightName, 0) * 2;
|
||||
|
||||
if (standardNameLength > 62)
|
||||
standardNameLength = 62;
|
||||
|
|
|
@ -22,10 +22,9 @@
|
|||
#endif
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <winpr/print.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include <freerdp/rail/icon.h>
|
||||
|
||||
|
|
|
@ -22,11 +22,10 @@
|
|||
#endif
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/windows.h>
|
||||
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <winpr/print.h>
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include "librail.h"
|
||||
|
||||
|
|
|
@ -36,8 +36,7 @@ set(${MODULE_PREFIX}_SRCS
|
|||
tcp.c
|
||||
thread.c
|
||||
time.c
|
||||
uds.c
|
||||
unicode.c)
|
||||
uds.c)
|
||||
|
||||
if(NOT WIN32)
|
||||
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} msusb.c)
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Implementation
|
||||
* Unicode Utils
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <wctype.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <winpr/print.h>
|
||||
|
||||
#include <freerdp/utils/unicode.h>
|
||||
|
||||
#include <winpr/crt.h>
|
||||
|
||||
int freerdp_AsciiToUnicodeAlloc(const CHAR* str, WCHAR** wstr, int length)
|
||||
{
|
||||
int status;
|
||||
|
||||
*wstr = NULL;
|
||||
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
if (length < 1)
|
||||
length = -1;
|
||||
|
||||
status = ConvertToUnicode(CP_UTF8, 0, str, length, wstr, 0);
|
||||
|
||||
return status;
|
||||
}
|
Loading…
Reference in New Issue