VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/libzip/zip_source_file_win32_utf16.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2025-01-01 10:37:56 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2025-01-01 10:37:56 +0100
commit138e5e7c1dfba4717a4e6d5abb1abb0f82d6f49f (patch)
treefd6bc3d389d162a9f555a415e410e84cd7988492 /src/Common/libzip/zip_source_file_win32_utf16.c
parentfcc6302e6139b5b4714c91fd91d215c77af7695c (diff)
downloadVeraCrypt-138e5e7c1dfba4717a4e6d5abb1abb0f82d6f49f.tar.gz
VeraCrypt-138e5e7c1dfba4717a4e6d5abb1abb0f82d6f49f.zip
Windows: Update libzip to version 1.11.2HEADmaster
Diffstat (limited to 'src/Common/libzip/zip_source_file_win32_utf16.c')
-rw-r--r--src/Common/libzip/zip_source_file_win32_utf16.c65
1 files changed, 52 insertions, 13 deletions
diff --git a/src/Common/libzip/zip_source_file_win32_utf16.c b/src/Common/libzip/zip_source_file_win32_utf16.c
index 8f07d021..73e25666 100644
--- a/src/Common/libzip/zip_source_file_win32_utf16.c
+++ b/src/Common/libzip/zip_source_file_win32_utf16.c
@@ -1,6 +1,6 @@
/*
zip_source_file_win32_utf16.c -- source for Windows file opened by UTF-16 name
- Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2024 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
The authors can be contacted at <info@libzip.org>
@@ -34,26 +34,30 @@
#include "zip_source_file_win32.h"
static char *utf16_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp);
-static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
+static HANDLE __stdcall utf16_create_file(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file);
+static BOOL __stdcall utf16_delete_file(const void *name);
+static DWORD __stdcall utf16_get_file_attributes(const void *name);
+static BOOL __stdcall utf16_get_file_attributes_ex(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information);
static void utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i);
+static BOOL __stdcall utf16_move_file(const void *from, const void *to, DWORD flags);
+static BOOL __stdcall utf16_set_file_attributes(const void *name, DWORD attributes);
static char *utf16_strdup(const char *string);
+static HANDLE __stdcall utf16_find_first_file(const void *name, void* data);
-/* clang-format off */
-DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN
+/* clang-format off */
zip_win32_file_operations_t ops_utf16 = {
utf16_allocate_tempname,
utf16_create_file,
- DeleteFileW,
- GetFileAttributesW,
- GetFileAttributesExW,
+ utf16_delete_file,
+ utf16_get_file_attributes,
+ utf16_get_file_attributes_ex,
utf16_make_tempname,
- MoveFileExW,
- SetFileAttributesW,
- utf16_strdup
+ utf16_move_file,
+ utf16_set_file_attributes,
+ utf16_strdup,
+ utf16_find_first_file
};
-
-DONT_WARN_INCOMPATIBLE_FN_PTR_END
/* clang-format on */
ZIP_EXTERN zip_source_t *
@@ -84,7 +88,7 @@ utf16_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp) {
}
-static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) {
+static HANDLE __stdcall utf16_create_file(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) {
#ifdef MS_UWP
CREATEFILE2_EXTENDED_PARAMETERS extParams = {0};
extParams.dwFileAttributes = file_attributes;
@@ -100,14 +104,49 @@ static HANDLE __stdcall utf16_create_file(const char *name, DWORD access, DWORD
#endif
}
+static BOOL __stdcall
+utf16_delete_file(const void *name)
+{
+ return DeleteFileW((const wchar_t *)name);
+}
+
+static DWORD __stdcall
+utf16_get_file_attributes(const void *name)
+{
+ return GetFileAttributesW((const wchar_t *)name);
+}
+
+static BOOL __stdcall
+utf16_get_file_attributes_ex(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information)
+{
+ return GetFileAttributesExW((const wchar_t *)name, info_level, information);
+}
static void
utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) {
_snwprintf_s((wchar_t *)buf, len, len, L"%s.%08x", (const wchar_t *)name, i);
}
+static BOOL __stdcall
+utf16_move_file(const void *from, const void *to, DWORD flags)
+{
+ return MoveFileExW((const wchar_t *)from, (const wchar_t *)to, flags);
+}
+
+static BOOL __stdcall
+utf16_set_file_attributes(const void *name, DWORD attributes)
+{
+ return SetFileAttributesW((const wchar_t *)name, attributes);
+}
static char *
utf16_strdup(const char *string) {
return (char *)_wcsdup((const wchar_t *)string);
}
+
+
+static HANDLE __stdcall
+utf16_find_first_file(const void *name, void* data)
+{
+ return FindFirstFileW((const wchar_t *)name, data);
+}