w32: Allow Unicode filenames for iobuf_cancel.

* common/iobuf.c (iobuf_cancel): Use gnupg_remove
* common/mischelp.c (same_file_p): Allow for Unicode names.
--

Note that the second patch is used to handle Unicode filenames which
are symbolic links.
This commit is contained in:
Werner Koch 2022-06-03 10:54:35 +02:00
parent d2d7a2b128
commit 4ee2009083
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 24 additions and 6 deletions

View File

@ -1282,7 +1282,7 @@ iobuf_cancel (iobuf_t a)
{
/* Argg, MSDOS does not allow removing open files. So
* we have to do it here */
remove (remove_name);
gnupg_remove (remove_name);
xfree (remove_name);
}

View File

@ -80,13 +80,30 @@ same_file_p (const char *name1, const char *name2)
#ifdef HAVE_W32_SYSTEM
HANDLE file1, file2;
BY_HANDLE_FILE_INFORMATION info1, info2;
wchar_t *wname;
wname = gpgrt_fname_to_wchar (name1);
if (wname)
{
file1 = CreateFileW (wname, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
xfree (wname);
}
else
file1 = INVALID_HANDLE_VALUE;
file1 = CreateFile (name1, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
if (file1 == INVALID_HANDLE_VALUE)
yes = 0; /* If we can't open the file, it is not the same. */
else
{
file2 = CreateFile (name2, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
wname = gpgrt_fname_to_wchar (name2);
if (wname)
{
file2 = CreateFileW (wname, 0, 0, NULL, OPEN_EXISTING, 0, NULL);
xfree (wname);
}
else
file2 = INVALID_HANDLE_VALUE;
if (file2 == INVALID_HANDLE_VALUE)
yes = 0; /* If we can't open the file, it is not the same. */
else

View File

@ -236,9 +236,10 @@ this option only if you know what you are doing.
@item --pcsc-driver @var{library}
@opindex pcsc-driver
Use @var{library} to access the smartcard reader. The current default
is @file{libpcsclite.so}. Instead of using this option you might also
want to install a symbolic link to the default file name
(e.g. from @file{libpcsclite.so.1}).
on Unix is @file{libpcsclite.so} and on Windows @file{winscard.dll}.
Instead of using this option you might also want to install a symbolic
link to the default file name (e.g. from @file{libpcsclite.so.1}).
A Unicode file name may not be used on Windows.
@item --ctapi-driver @var{library}
@opindex ctapi-driver