diff options
Diffstat (limited to 'src/Common/libzip/zip_source_file_win32_utf16.c')
-rw-r--r-- | src/Common/libzip/zip_source_file_win32_utf16.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/Common/libzip/zip_source_file_win32_utf16.c b/src/Common/libzip/zip_source_file_win32_utf16.c index 83786483..08443d3d 100644 --- a/src/Common/libzip/zip_source_file_win32_utf16.c +++ b/src/Common/libzip/zip_source_file_win32_utf16.c @@ -3,7 +3,7 @@ Copyright (C) 1999-2020 Dieter Baron and Thomas Klausner This file is part of libzip, a library to manipulate ZIP archives. - The authors can be contacted at <libzip@nih.at> + The authors can be contacted at <info@libzip.org> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -33,20 +33,13 @@ #include "zip_source_file_win32.h" -#define RtlGenRandom SystemFunction036 -BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength); - -bool zip_secure_random(zip_uint8_t *buffer, zip_uint16_t length) -{ - return RtlGenRandom (buffer, (ULONG) length); -} - - 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 void utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i); static char *utf16_strdup(const char *string); +/* clang-format off */ + zip_win32_file_operations_t ops_utf16 = { utf16_allocate_tempname, utf16_create_file, @@ -59,10 +52,12 @@ zip_win32_file_operations_t ops_utf16 = { utf16_strdup }; +/* clang-format on */ + ZIP_EXTERN zip_source_t * zip_source_win32w(zip_t *za, const wchar_t *fname, zip_uint64_t start, zip_int64_t len) { if (za == NULL) - return NULL; + return NULL; return zip_source_win32w_create(fname, start, len, &za->error); } @@ -71,8 +66,8 @@ zip_source_win32w(zip_t *za, const wchar_t *fname, zip_uint64_t start, zip_int64 ZIP_EXTERN zip_source_t * zip_source_win32w_create(const wchar_t *fname, zip_uint64_t start, zip_int64_t length, zip_error_t *error) { if (fname == NULL || length < -1) { - zip_error_set(error, ZIP_ER_INVAL, 0); - return NULL; + zip_error_set(error, ZIP_ER_INVAL, 0); + return NULL; } @@ -87,8 +82,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 char *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; @@ -97,7 +91,7 @@ utf16_create_file(const char *name, DWORD access, DWORD share_mode, PSECURITY_AT extParams.dwSize = sizeof(extParams); extParams.hTemplateFile = template_file; extParams.lpSecurityAttributes = security_attributes; - + return CreateFile2((const wchar_t *)name, access, share_mode, creation_disposition, &extParams); #else return CreateFileW((const wchar_t *)name, access, share_mode, security_attributes, creation_disposition, file_attributes, template_file); |