aboutsummaryrefslogtreecommitdiffstats
path: root/common/mischelp.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2022-06-03 08:54:35 +0000
committerWerner Koch <[email protected]>2022-06-03 08:54:35 +0000
commit4ee2009083cb6f279c6f8aa4397462e887d5818e (patch)
tree4261606111885061238ca6614ad7bceef505e187 /common/mischelp.c
parentRemove remaining support for WindowsCE (diff)
downloadgnupg-4ee2009083cb6f279c6f8aa4397462e887d5818e.tar.gz
gnupg-4ee2009083cb6f279c6f8aa4397462e887d5818e.zip
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.
Diffstat (limited to 'common/mischelp.c')
-rw-r--r--common/mischelp.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/common/mischelp.c b/common/mischelp.c
index 68fd2bc24..ee8500297 100644
--- a/common/mischelp.c
+++ b/common/mischelp.c
@@ -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