Jacek Caban : winex11: Directly use ntdll in uri_to_dos.
Alexandre Julliard
julliard at winehq.org
Tue Apr 26 16:25:27 CDT 2022
Module: wine
Branch: master
Commit: 1c01148696b164094b11624cee2985573744f83a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1c01148696b164094b11624cee2985573744f83a
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Apr 26 16:06:09 2022 +0100
winex11: Directly use ntdll in uri_to_dos.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winex11.drv/clipboard.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c
index ec0392f3ec8..eb357ed4643 100644
--- a/dlls/winex11.drv/clipboard.c
+++ b/dlls/winex11.drv/clipboard.c
@@ -569,6 +569,29 @@ static HGLOBAL create_dib_from_bitmap(HBITMAP hBmp)
}
+/* based on wine_get_dos_file_name */
+static WCHAR *get_dos_file_name( const char *path )
+{
+ ULONG len = strlen( path ) + 9; /* \??\unix prefix */
+ WCHAR *ret;
+
+ if (!(ret = malloc( len * sizeof(WCHAR) ))) return NULL;
+ if (wine_unix_to_nt_file_name( path, ret, &len ))
+ {
+ free( ret );
+ return NULL;
+ }
+
+ if (ret[5] == ':')
+ {
+ /* get rid of the \??\ prefix */
+ memmove( ret, ret + 4, (len - 4) * sizeof(WCHAR) );
+ }
+ else ret[1] = '\\';
+ return ret;
+}
+
+
/***********************************************************************
* uri_to_dos
*
@@ -616,7 +639,7 @@ static WCHAR* uri_to_dos(char *encodedURI)
if (uri[7] == '/')
{
/* file:///path/to/file (nautilus, thunar) */
- ret = wine_get_dos_file_name(&uri[7]);
+ ret = get_dos_file_name( &uri[7] );
}
else if (uri[7])
{
@@ -629,14 +652,14 @@ static WCHAR* uri_to_dos(char *encodedURI)
if (strcmp(&uri[7], "localhost") == 0)
{
*path = '/';
- ret = wine_get_dos_file_name(path);
+ ret = get_dos_file_name( path );
}
else if (gethostname(hostname, sizeof(hostname)) == 0)
{
if (strcmp(hostname, &uri[7]) == 0)
{
*path = '/';
- ret = wine_get_dos_file_name(path);
+ ret = get_dos_file_name( path );
}
}
}
@@ -645,7 +668,7 @@ static WCHAR* uri_to_dos(char *encodedURI)
else if (uri[6])
{
/* file:/path/to/file (konqueror) */
- ret = wine_get_dos_file_name(&uri[5]);
+ ret = get_dos_file_name( &uri[5] );
}
}
free( uri );
@@ -938,7 +961,7 @@ static HANDLE import_text_uri_list( Atom type, const void *data, size_t size )
memcpy(&out[total], path, pathSize * sizeof(WCHAR));
total += pathSize;
done:
- HeapFree( GetProcessHeap(), 0, path );
+ free( path );
if (out == NULL)
break;
}
More information about the wine-cvs
mailing list