diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2025-01-01 10:37:56 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2025-01-01 10:37:56 +0100 |
commit | 138e5e7c1dfba4717a4e6d5abb1abb0f82d6f49f (patch) | |
tree | fd6bc3d389d162a9f555a415e410e84cd7988492 /src/Common/libzip/zip_source_file_win32_ansi.c | |
parent | fcc6302e6139b5b4714c91fd91d215c77af7695c (diff) | |
download | VeraCrypt-138e5e7c1dfba4717a4e6d5abb1abb0f82d6f49f.tar.gz VeraCrypt-138e5e7c1dfba4717a4e6d5abb1abb0f82d6f49f.zip |
Diffstat (limited to 'src/Common/libzip/zip_source_file_win32_ansi.c')
-rw-r--r-- | src/Common/libzip/zip_source_file_win32_ansi.c | 69 |
1 files changed, 57 insertions, 12 deletions
diff --git a/src/Common/libzip/zip_source_file_win32_ansi.c b/src/Common/libzip/zip_source_file_win32_ansi.c index 58034cc2..f10f8ae3 100644 --- a/src/Common/libzip/zip_source_file_win32_ansi.c +++ b/src/Common/libzip/zip_source_file_win32_ansi.c @@ -1,6 +1,6 @@ /* zip_source_file_win32_ansi.c -- source for Windows file opened by ANSI 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,24 +34,28 @@ #include "zip_source_file_win32.h" static char *ansi_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp); +static HANDLE __stdcall ansi_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 ansi_delete_file(const void *name); +static DWORD __stdcall ansi_get_file_attributes(const void *name); +static BOOL __stdcall ansi_get_file_attributes_ex(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information); static void ansi_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i); +static BOOL __stdcall ansi_move_file(const void *from, const void *to, DWORD flags); +static BOOL __stdcall ansi_set_file_attributes(const void *name, DWORD attributes); +static HANDLE __stdcall ansi_find_first_file(const void *name, void* data); /* clang-format off */ -DONT_WARN_INCOMPATIBLE_FN_PTR_BEGIN - zip_win32_file_operations_t ops_ansi = { ansi_allocate_tempname, - CreateFileA, - DeleteFileA, - GetFileAttributesA, - GetFileAttributesExA, + ansi_create_file, + ansi_delete_file, + ansi_get_file_attributes, + ansi_get_file_attributes_ex, ansi_make_tempname, - MoveFileExA, - SetFileAttributesA, - strdup + ansi_move_file, + ansi_set_file_attributes, + strdup, + ansi_find_first_file, }; - -DONT_WARN_INCOMPATIBLE_FN_PTR_END /* clang-format on */ ZIP_EXTERN zip_source_t * @@ -80,8 +84,49 @@ ansi_allocate_tempname(const char *name, size_t extra_chars, size_t *lengthp) { return (char *)malloc(*lengthp); } +static HANDLE __stdcall +ansi_create_file(const void *name, DWORD access, DWORD share_mode, PSECURITY_ATTRIBUTES security_attributes, DWORD creation_disposition, DWORD file_attributes, HANDLE template_file) +{ + return CreateFileA((const char *)name, access, share_mode, security_attributes, creation_disposition, file_attributes, template_file); +} + +static BOOL __stdcall +ansi_delete_file(const void *name) +{ + return DeleteFileA((const char *)name); +} + +static DWORD __stdcall +ansi_get_file_attributes(const void *name) +{ + return GetFileAttributesA((const char *)name); +} + +static BOOL __stdcall +ansi_get_file_attributes_ex(const void *name, GET_FILEEX_INFO_LEVELS info_level, void *information) +{ + return GetFileAttributesExA((const char *)name, info_level, information); +} static void ansi_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) { snprintf_s(buf, len, "%s.%08x", name, i); } + +static BOOL __stdcall +ansi_move_file(const void *from, const void *to, DWORD flags) +{ + return MoveFileExA((const char *)from, (const char *)to, flags); +} + +static BOOL __stdcall +ansi_set_file_attributes(const void *name, DWORD attributes) +{ + return SetFileAttributesA((const char *)name, attributes); +} + +static HANDLE __stdcall +ansi_find_first_file(const void *name, void *data) +{ + return FindFirstFileA((const char *)name, data); +} |