VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-09-08 01:07:09 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-09-08 01:08:24 +0200
commita36cf1f01e75930a2afbb3697e1ef6f9870f4028 (patch)
tree2094ef393c812f66b485eefb4b24657e5c86e81b /src/Common
parenta9882a66894cbc98bfda5c264bf4621f7004f909 (diff)
downloadVeraCrypt-a36cf1f01e75930a2afbb3697e1ef6f9870f4028.tar.gz
VeraCrypt-a36cf1f01e75930a2afbb3697e1ef6f9870f4028.zip
Windows Traveler Disk Setup: Include Volume Expander. Force selection of target directory through Browse button. Use Unicode functions for handling the creation files.
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Dlgcode.c68
-rw-r--r--src/Common/Dlgcode.h1
-rw-r--r--src/Common/Language.xml1
3 files changed, 51 insertions, 19 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 655d64d6..dc727ee9 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -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)
diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h
index dec482bf..5d8d7e29 100644
--- a/src/Common/Dlgcode.h
+++ b/src/Common/Dlgcode.h
@@ -358,6 +358,7 @@ int64 FindString (const char *buf, const char *str, int64 bufLen, int64 strLen,
BOOL FileExists (const char *filePathPtr);
__int64 FindStringInFile (const char *filePath, const char *str, int strLen);
BOOL TCCopyFile (char *sourceFileName, char *destinationFile);
+BOOL TCCopyFileW (wchar_t *sourceFileName, wchar_t *destinationFile);
BOOL SaveBufferToFile (const char *inputBuffer, const char *destinationFile, DWORD inputLength, BOOL bAppend, BOOL bRenameIfFailed);
BOOL TCFlushFile (FILE *f);
BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, size_t byteLen);
diff --git a/src/Common/Language.xml b/src/Common/Language.xml
index 53af2ed4..df2890e4 100644
--- a/src/Common/Language.xml
+++ b/src/Common/Language.xml
@@ -113,6 +113,7 @@
<control lang="en" key="IDC_CACHE">Cache passwords and keyfil&amp;es in memory</control>
<control lang="en" key="IDC_CLOSE_BKG_TASK_WHEN_NOVOL">Exit when there are no mounted volumes</control>
<control lang="en" key="IDC_CLOSE_TOKEN_SESSION_AFTER_MOUNT">&amp;Close token session (log out) after a volume is successfully mounted</control>
+ <control lang="en" key="IDC_COPY_EXPANDER">Include VeraCrypt Volume Expander</control>
<control lang="en" key="IDC_COPY_WIZARD">Include VeraCrypt Volume Creation Wizard</control>
<control lang="en" key="IDC_CREATE">Create</control>
<control lang="en" key="IDC_CREATE_VOLUME">&amp;Create Volume</control>