From 1546a8b655078e34c27e22a6450f5bbb480ebcec Mon Sep 17 00:00:00 2001 From: akallabeth Date: Thu, 17 Sep 2020 15:21:45 +0200 Subject: [PATCH] Fixed naming of FILEDESCRIPTORW --- channels/cliprdr/client/cliprdr_format.c | 10 +++++----- client/X11/xf_cliprdr.c | 4 ++-- include/freerdp/channels/cliprdr.h | 4 ++-- winpr/include/winpr/shell.h | 5 +++-- winpr/libwinpr/clipboard/posix.c | 18 +++++++++--------- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/channels/cliprdr/client/cliprdr_format.c b/channels/cliprdr/client/cliprdr_format.c index 43b967e1a..e86b5cd3c 100644 --- a/channels/cliprdr/client/cliprdr_format.c +++ b/channels/cliprdr/client/cliprdr_format.c @@ -206,7 +206,7 @@ static FILETIME uint64_to_filetime(UINT64 value) * @returns 0 on success, otherwise a Win32 error code. */ UINT cliprdr_parse_file_list(const BYTE* format_data, UINT32 format_data_length, - FILEDESCRIPTOR** file_descriptor_array, UINT32* file_descriptor_count) + FILEDESCRIPTORW** file_descriptor_array, UINT32* file_descriptor_count) { UINT result = NO_ERROR; UINT32 i; @@ -240,7 +240,7 @@ UINT cliprdr_parse_file_list(const BYTE* format_data, UINT32 format_data_length, } *file_descriptor_count = count; - *file_descriptor_array = calloc(count, sizeof(FILEDESCRIPTOR)); + *file_descriptor_array = calloc(count, sizeof(FILEDESCRIPTORW)); if (!*file_descriptor_array) { result = ERROR_NOT_ENOUGH_MEMORY; @@ -251,7 +251,7 @@ UINT cliprdr_parse_file_list(const BYTE* format_data, UINT32 format_data_length, { int c; UINT64 lastWriteTime; - FILEDESCRIPTOR* file = &((*file_descriptor_array)[i]); + FILEDESCRIPTORW* file = &((*file_descriptor_array)[i]); Stream_Read_UINT32(s, file->dwFlags); /* flags (4 bytes) */ Stream_Seek(s, 32); /* reserved1 (32 bytes) */ @@ -288,7 +288,7 @@ out: * * @returns 0 on success, otherwise a Win32 error code. */ -UINT cliprdr_serialize_file_list(const FILEDESCRIPTOR* file_descriptor_array, +UINT cliprdr_serialize_file_list(const FILEDESCRIPTORW* file_descriptor_array, UINT32 file_descriptor_count, BYTE** format_data, UINT32* format_data_length) { @@ -309,7 +309,7 @@ UINT cliprdr_serialize_file_list(const FILEDESCRIPTOR* file_descriptor_array, { int c; UINT64 lastWriteTime; - const FILEDESCRIPTOR* file = &file_descriptor_array[i]; + const FILEDESCRIPTORW* file = &file_descriptor_array[i]; /* * There is a known issue with Windows server getting stuck in diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index 21017db00..1b238c3f0 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -619,8 +619,8 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa (dstFormatId == ClipboardGetFormatId(clipboard->system, "FileGroupDescriptorW"))) { UINT error = NO_ERROR; - FILEDESCRIPTOR* file_array = (FILEDESCRIPTOR*)pDstData; - UINT32 file_count = DstSize / sizeof(FILEDESCRIPTOR); + FILEDESCRIPTORW* file_array = (FILEDESCRIPTORW*)pDstData; + UINT32 file_count = DstSize / sizeof(FILEDESCRIPTORW); pDstData = NULL; DstSize = 0; error = cliprdr_serialize_file_list(file_array, file_count, &pDstData, &DstSize); diff --git a/include/freerdp/channels/cliprdr.h b/include/freerdp/channels/cliprdr.h index 24f91cde1..78dbec13a 100644 --- a/include/freerdp/channels/cliprdr.h +++ b/include/freerdp/channels/cliprdr.h @@ -93,9 +93,9 @@ extern "C" #endif FREERDP_API UINT cliprdr_parse_file_list(const BYTE* format_data, UINT32 format_data_length, - FILEDESCRIPTOR** file_descriptor_array, + FILEDESCRIPTORW** file_descriptor_array, UINT32* file_descriptor_count); - FREERDP_API UINT cliprdr_serialize_file_list(const FILEDESCRIPTOR* file_descriptor_array, + FREERDP_API UINT cliprdr_serialize_file_list(const FILEDESCRIPTORW* file_descriptor_array, UINT32 file_descriptor_count, BYTE** format_data, UINT32* format_data_length); diff --git a/winpr/include/winpr/shell.h b/winpr/include/winpr/shell.h index a4f794529..7d2903de6 100644 --- a/winpr/include/winpr/shell.h +++ b/winpr/include/winpr/shell.h @@ -36,7 +36,7 @@ /* Shell clipboard formats */ -struct _FILEDESCRIPTOR +struct _FILEDESCRIPTORW { DWORD dwFlags; BYTE clsid[16]; @@ -50,7 +50,8 @@ struct _FILEDESCRIPTOR DWORD nFileSizeLow; WCHAR cFileName[260]; }; -typedef struct _FILEDESCRIPTOR FILEDESCRIPTOR; +typedef struct _FILEDESCRIPTORW FILEDESCRIPTORW; +typedef struct _FILEDESCRIPTORW FILEDESCRIPTOR; /* FILEDESCRIPTOR.dwFlags */ #define FD_ATTRIBUTES 0x00000004 diff --git a/winpr/libwinpr/clipboard/posix.c b/winpr/libwinpr/clipboard/posix.c index 445baf1d3..aefe9d7e1 100644 --- a/winpr/libwinpr/clipboard/posix.c +++ b/winpr/libwinpr/clipboard/posix.c @@ -496,7 +496,7 @@ static BOOL process_uri_list(const char* data, size_t length, wArrayList* files) } static BOOL convert_local_file_to_filedescriptor(const struct posix_file* file, - FILEDESCRIPTOR* descriptor) + FILEDESCRIPTORW* descriptor) { size_t remote_len = 0; descriptor->dwFlags = FD_ATTRIBUTES | FD_FILESIZE | FD_SHOWPROGRESSUI; @@ -526,11 +526,11 @@ static BOOL convert_local_file_to_filedescriptor(const struct posix_file* file, return TRUE; } -static FILEDESCRIPTOR* convert_local_file_list_to_filedescriptors(wArrayList* files) +static FILEDESCRIPTORW* convert_local_file_list_to_filedescriptors(wArrayList* files) { int i; int count = 0; - FILEDESCRIPTOR* descriptors = NULL; + FILEDESCRIPTORW* descriptors = NULL; count = ArrayList_Count(files); descriptors = calloc(count, sizeof(descriptors[0])); @@ -554,7 +554,7 @@ error: static void* convert_uri_list_to_filedescriptors(wClipboard* clipboard, UINT32 formatId, const void* data, UINT32* pSize) { - FILEDESCRIPTOR* descriptors = NULL; + FILEDESCRIPTORW* descriptors = NULL; if (!clipboard || !data || !pSize) return NULL; @@ -570,7 +570,7 @@ static void* convert_uri_list_to_filedescriptors(wClipboard* clipboard, UINT32 f if (!descriptors) return NULL; - *pSize = ArrayList_Count(clipboard->localFiles) * sizeof(FILEDESCRIPTOR); + *pSize = ArrayList_Count(clipboard->localFiles) * sizeof(FILEDESCRIPTORW); clipboard->fileListSequenceNumber = clipboard->sequenceNumber; return descriptors; } @@ -578,7 +578,7 @@ static void* convert_uri_list_to_filedescriptors(wClipboard* clipboard, UINT32 f static void* convert_filedescriptors_to_uri_list(wClipboard* clipboard, UINT32 formatId, const void* data, UINT32* pSize) { - const FILEDESCRIPTOR* descriptors; + const FILEDESCRIPTORW* descriptors; UINT32 nrDescriptors = 0; size_t count, x, alloc, pos, baseLength = 0; const char* src = (const char*)data; @@ -600,12 +600,12 @@ static void* convert_filedescriptors_to_uri_list(wClipboard* clipboard, UINT32 f nrDescriptors = (UINT32)(src[3] << 24) | (UINT32)(src[2] << 16) | (UINT32)(src[1] << 8) | (src[0] & 0xFF); - count = (*pSize - 4) / sizeof(FILEDESCRIPTOR); + count = (*pSize - 4) / sizeof(FILEDESCRIPTORW); if ((count < 1) || (count != nrDescriptors)) return NULL; - descriptors = (const FILEDESCRIPTOR*)&src[4]; + descriptors = (const FILEDESCRIPTORW*)&src[4]; if (formatId != ClipboardGetFormatId(clipboard, "FileGroupDescriptorW")) return NULL; @@ -628,7 +628,7 @@ static void* convert_filedescriptors_to_uri_list(wClipboard* clipboard, UINT32 f for (x = 0; x < count; x++) { int rc; - const FILEDESCRIPTOR* cur = &descriptors[x]; + const FILEDESCRIPTORW* cur = &descriptors[x]; size_t curLen = _wcsnlen(cur->cFileName, ARRAYSIZE(cur->cFileName)); char* curName = NULL; rc = ConvertFromUnicode(CP_UTF8, 0, cur->cFileName, (int)curLen, &curName, 0, NULL, NULL);