mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows Traveler Disk Setup: Include Volume Expander. Force selection of target directory through Browse button. Use Unicode functions for handling the creation files.
This commit is contained in:
@@ -7558,31 +7558,13 @@ fsif_end:
|
||||
|
||||
// System CopyFile() copies source file attributes (like FILE_ATTRIBUTE_ENCRYPTED)
|
||||
// so we need to use our own copy function
|
||||
BOOL TCCopyFile (char *sourceFileName, char *destinationFile)
|
||||
BOOL TCCopyFileBase (HANDLE src, HANDLE dst)
|
||||
{
|
||||
__int8 *buffer;
|
||||
HANDLE src, dst;
|
||||
FILETIME fileTime;
|
||||
DWORD bytesRead, bytesWritten;
|
||||
BOOL res;
|
||||
|
||||
src = CreateFile (sourceFileName,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
||||
if (src == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
dst = CreateFile (destinationFile,
|
||||
GENERIC_WRITE,
|
||||
0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
|
||||
if (dst == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle (src);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
buffer = (char *) malloc (64 * 1024);
|
||||
if (!buffer)
|
||||
{
|
||||
@@ -7617,6 +7599,54 @@ BOOL TCCopyFile (char *sourceFileName, char *destinationFile)
|
||||
return res != 0;
|
||||
}
|
||||
|
||||
BOOL TCCopyFile (char *sourceFileName, char *destinationFile)
|
||||
{
|
||||
HANDLE src, dst;
|
||||
|
||||
src = CreateFile (sourceFileName,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
||||
if (src == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
dst = CreateFile (destinationFile,
|
||||
GENERIC_WRITE,
|
||||
0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
|
||||
if (dst == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle (src);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TCCopyFileBase (src, dst);
|
||||
}
|
||||
|
||||
BOOL TCCopyFileW (wchar_t *sourceFileName, wchar_t *destinationFile)
|
||||
{
|
||||
HANDLE src, dst;
|
||||
|
||||
src = CreateFileW (sourceFileName,
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
|
||||
|
||||
if (src == INVALID_HANDLE_VALUE)
|
||||
return FALSE;
|
||||
|
||||
dst = CreateFileW (destinationFile,
|
||||
GENERIC_WRITE,
|
||||
0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||
|
||||
if (dst == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
CloseHandle (src);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TCCopyFileBase (src, dst);
|
||||
}
|
||||
|
||||
// If bAppend is TRUE, the buffer is appended to an existing file. If bAppend is FALSE, any existing file
|
||||
// is replaced. If an error occurs, the incomplete file is deleted (provided that bAppend is FALSE).
|
||||
BOOL SaveBufferToFile (const char *inputBuffer, const char *destinationFile, DWORD inputLength, BOOL bAppend, BOOL bRenameIfFailed)
|
||||
|
||||
Reference in New Issue
Block a user