mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-13 11:58:26 -06:00
Update Libzip to latest 1.9.2 (#1071)
* Libzip 1.9.2 Updated Libzip to latest version 1.9.2 and changed version number in the config.h from 1.7.3 to 1.9.2. Not sure if anything else needs to be tweaked :) * Modified Libzip to work with Visual studio * Update README.md Update libzip copyright. * Added the missing files. I've added the missing files zipconf.h and config.h, I've missed those sorry for that!
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user