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:
Mounir IDRASSI 2015-09-08 01:07:09 +02:00
parent a9882a6689
commit a36cf1f01e
5 changed files with 183 additions and 99 deletions

View File

@ -7558,31 +7558,13 @@ __int64 FindStringInFile (const char *filePath, const char* str, int strLen)
// System CopyFile() copies source file attributes (like FILE_ATTRIBUTE_ENCRYPTED) // System CopyFile() copies source file attributes (like FILE_ATTRIBUTE_ENCRYPTED)
// so we need to use our own copy function // so we need to use our own copy function
BOOL TCCopyFile (char *sourceFileName, char *destinationFile) BOOL TCCopyFileBase (HANDLE src, HANDLE dst)
{ {
__int8 *buffer; __int8 *buffer;
HANDLE src, dst;
FILETIME fileTime; FILETIME fileTime;
DWORD bytesRead, bytesWritten; DWORD bytesRead, bytesWritten;
BOOL res; 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); buffer = (char *) malloc (64 * 1024);
if (!buffer) if (!buffer)
{ {
@ -7617,6 +7599,54 @@ BOOL TCCopyFile (char *sourceFileName, char *destinationFile)
return res != 0; 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 // 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). // 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) BOOL SaveBufferToFile (const char *inputBuffer, const char *destinationFile, DWORD inputLength, BOOL bAppend, BOOL bRenameIfFailed)

View File

@ -358,6 +358,7 @@ int64 FindString (const char *buf, const char *str, int64 bufLen, int64 strLen,
BOOL FileExists (const char *filePathPtr); BOOL FileExists (const char *filePathPtr);
__int64 FindStringInFile (const char *filePath, const char *str, int strLen); __int64 FindStringInFile (const char *filePath, const char *str, int strLen);
BOOL TCCopyFile (char *sourceFileName, char *destinationFile); 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 SaveBufferToFile (const char *inputBuffer, const char *destinationFile, DWORD inputLength, BOOL bAppend, BOOL bRenameIfFailed);
BOOL TCFlushFile (FILE *f); BOOL TCFlushFile (FILE *f);
BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, size_t byteLen); BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, size_t byteLen);

View File

@ -113,6 +113,7 @@
<control lang="en" key="IDC_CACHE">Cache passwords and keyfil&amp;es in memory</control> <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_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_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_COPY_WIZARD">Include VeraCrypt Volume Creation Wizard</control>
<control lang="en" key="IDC_CREATE">Create</control> <control lang="en" key="IDC_CREATE">Create</control>
<control lang="en" key="IDC_CREATE_VOLUME">&amp;Create Volume</control> <control lang="en" key="IDC_CREATE_VOLUME">&amp;Create Volume</control>

View File

@ -3844,15 +3844,18 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
char i; WCHAR i;
int index; int index;
char drive[] = { 0, ':', 0 }; WCHAR drive[] = { 0, L':', 0 };
LocalizeDialog (hwndDlg, "IDD_TRAVELER_DLG"); LocalizeDialog (hwndDlg, "IDD_TRAVELER_DLG");
SendDlgItemMessage (hwndDlg, IDC_COPY_WIZARD, BM_SETCHECK, SendDlgItemMessage (hwndDlg, IDC_COPY_WIZARD, BM_SETCHECK,
BST_CHECKED, 0); BST_CHECKED, 0);
SendDlgItemMessage (hwndDlg, IDC_COPY_EXPANDER, BM_SETCHECK,
BST_CHECKED, 0);
SendDlgItemMessage (hwndDlg, IDC_TRAVEL_OPEN_EXPLORER, BM_SETCHECK, SendDlgItemMessage (hwndDlg, IDC_TRAVEL_OPEN_EXPLORER, BM_SETCHECK,
BST_CHECKED, 0); BST_CHECKED, 0);
@ -3864,18 +3867,33 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
index = (int) SendDlgItemMessageW (hwndDlg, IDC_DRIVELIST, CB_ADDSTRING, 0, (LPARAM) GetString ("FIRST_AVAILABLE")); index = (int) SendDlgItemMessageW (hwndDlg, IDC_DRIVELIST, CB_ADDSTRING, 0, (LPARAM) GetString ("FIRST_AVAILABLE"));
SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_SETITEMDATA, index, (LPARAM) 0); SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_SETITEMDATA, index, (LPARAM) 0);
for (i = 'D'; i <= 'Z'; i++) for (i = L'A'; i <= L'Z'; i++)
{ {
if (i == L'C')
continue;
drive[0] = i; drive[0] = i;
index = (int) SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_ADDSTRING, 0, (LPARAM) drive); index = (int) SendDlgItemMessageW (hwndDlg, IDC_DRIVELIST, CB_ADDSTRING, 0, (LPARAM) drive);
SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_SETITEMDATA, index, (LPARAM) i); SendDlgItemMessageW (hwndDlg, IDC_DRIVELIST, CB_SETITEMDATA, index, (LPARAM) i);
} }
SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_SETCURSEL, 0, 0); SendDlgItemMessageW (hwndDlg, IDC_DRIVELIST, CB_SETCURSEL, 0, 0);
return 0; return 0;
} }
case WM_CTLCOLORSTATIC:
{
HDC hdc = (HDC) wParam;
HWND hw = (HWND) lParam;
if (hw == GetDlgItem(hwndDlg, IDC_DIRECTORY))
{
// This the directory field. Make its background like normal edit
HBRUSH hbr = GetSysColorBrush (COLOR_WINDOW);
::SelectObject(hdc, hbr);
return (BOOL) hbr;
}
}
return 0;
case WM_COMMAND: case WM_COMMAND:
@ -3937,24 +3955,24 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (lw == IDC_CREATE) if (lw == IDC_CREATE)
{ {
BOOL copyWizard, bExplore, bCacheInDriver, bAutoRun, bAutoMount, bMountReadOnly; BOOL copyWizard, copyExpander, bExplore, bCacheInDriver, bAutoRun, bAutoMount, bMountReadOnly;
char dstDir[MAX_PATH]; WCHAR dstDir[MAX_PATH + 1];
char srcPath[MAX_PATH * 2]; WCHAR srcPath[1024 + MAX_PATH + 1];
char dstPath[MAX_PATH * 2]; WCHAR dstPath[2*MAX_PATH + 1];
char appDir[MAX_PATH]; WCHAR appDir[1024];
char sysDir[MAX_PATH]; WCHAR volName[MAX_PATH + 2];
char volName[MAX_PATH];
int drive; int drive;
char* ptr; WCHAR* ptr;
GetDlgItemText (hwndDlg, IDC_DIRECTORY, dstDir, sizeof dstDir); GetDlgItemTextW (hwndDlg, IDC_DIRECTORY, dstDir, array_capacity (dstDir));
volName[0] = 0; volName[0] = 0;
GetDlgItemText (hwndDlg, IDC_VOLUME_NAME, volName + 1, (sizeof volName) - 1); GetDlgItemTextW (hwndDlg, IDC_VOLUME_NAME, volName + 1, (array_capacity (volName)) - 1);
drive = (int) SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_GETCURSEL, 0, 0); drive = (int) SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_GETCURSEL, 0, 0);
drive = (int) SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_GETITEMDATA, drive, 0); drive = (int) SendDlgItemMessage (hwndDlg, IDC_DRIVELIST, CB_GETITEMDATA, drive, 0);
copyWizard = IsButtonChecked (GetDlgItem (hwndDlg, IDC_COPY_WIZARD)); copyWizard = IsButtonChecked (GetDlgItem (hwndDlg, IDC_COPY_WIZARD));
copyExpander = IsButtonChecked (GetDlgItem (hwndDlg, IDC_COPY_EXPANDER));
bExplore = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAVEL_OPEN_EXPLORER)); bExplore = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAVEL_OPEN_EXPLORER));
bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAV_CACHE_PASSWORDS)); bCacheInDriver = IsButtonChecked (GetDlgItem (hwndDlg, IDC_TRAV_CACHE_PASSWORDS));
bMountReadOnly = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY)); bMountReadOnly = IsButtonChecked (GetDlgItem (hwndDlg, IDC_MOUNT_READONLY));
@ -3978,27 +3996,30 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (volName[1] != 0) if (volName[1] != 0)
{ {
volName[0] = '"'; volName[0] = L'"';
StringCbCatA (volName, sizeof(volName), "\""); StringCbCatW (volName, sizeof(volName), L"\"");
} }
GetModuleFileName (NULL, appDir, sizeof (appDir)); GetModuleFileNameW (NULL, appDir, array_capacity (appDir));
if (ptr = strrchr (appDir, '\\')) if (ptr = wcsrchr (appDir, L'\\'))
ptr[0] = 0; ptr[0] = 0;
WaitCursor (); WaitCursor ();
GetSystemDirectory (sysDir, sizeof (sysDir));
StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt", dstDir); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt", dstDir);
CreateDirectory (dstPath, NULL); if (!CreateDirectoryW (dstPath, NULL))
{
handleWin32Error (hwndDlg, SRC_POS);
goto stop;
}
// Main app 32-bit // Main app 32-bit
if (Is64BitOs ()) if (Is64BitOs ())
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt-x86.exe", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt-x86.exe", appDir);
else else
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt.exe", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt.exe", appDir);
StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\VeraCrypt.exe", dstDir); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt.exe", dstDir);
if (!TCCopyFile (srcPath, dstPath)) if (!TCCopyFileW (srcPath, dstPath))
{ {
handleWin32Error (hwndDlg, SRC_POS); handleWin32Error (hwndDlg, SRC_POS);
goto stop; goto stop;
@ -4006,11 +4027,11 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
// Main app 64-bit // Main app 64-bit
if (Is64BitOs ()) if (Is64BitOs ())
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt.exe", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt.exe", appDir);
else else
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt-x64.exe", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt-x64.exe", appDir);
StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\VeraCrypt-x64.exe", dstDir); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt-x64.exe", dstDir);
if (!TCCopyFile (srcPath, dstPath)) if (!TCCopyFileW (srcPath, dstPath))
{ {
handleWin32Error (hwndDlg, SRC_POS); handleWin32Error (hwndDlg, SRC_POS);
goto stop; goto stop;
@ -4021,11 +4042,11 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
{ {
// Wizard 32-bit // Wizard 32-bit
if (Is64BitOs ()) if (Is64BitOs ())
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt Format-x86.exe", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format-x86.exe", appDir);
else else
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt Format.exe", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format.exe", appDir);
StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format.exe", dstDir);
if (!TCCopyFile (srcPath, dstPath)) if (!TCCopyFileW (srcPath, dstPath))
{ {
handleWin32Error (hwndDlg, SRC_POS); handleWin32Error (hwndDlg, SRC_POS);
goto stop; goto stop;
@ -4033,11 +4054,39 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
// Wizard 64-bit // Wizard 64-bit
if (Is64BitOs ()) if (Is64BitOs ())
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt Format.exe", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format.exe", appDir);
else else
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\VeraCrypt Format-x64.exe", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCrypt Format-x64.exe", appDir);
StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\VeraCrypt Format-x64.exe", dstDir); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCrypt Format-x64.exe", dstDir);
if (!TCCopyFile (srcPath, dstPath)) if (!TCCopyFileW (srcPath, dstPath))
{
handleWin32Error (hwndDlg, SRC_POS);
goto stop;
}
}
// Expander
if (copyExpander)
{
// Expander 32-bit
if (Is64BitOs ())
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander-x86.exe", appDir);
else
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander.exe", appDir);
StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander.exe", dstDir);
if (!TCCopyFileW (srcPath, dstPath))
{
handleWin32Error (hwndDlg, SRC_POS);
goto stop;
}
// Expander 64-bit
if (Is64BitOs ())
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander.exe", appDir);
else
StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\VeraCryptExpander-x64.exe", appDir);
StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\VeraCryptExpander-x64.exe", dstDir);
if (!TCCopyFileW (srcPath, dstPath))
{ {
handleWin32Error (hwndDlg, SRC_POS); handleWin32Error (hwndDlg, SRC_POS);
goto stop; goto stop;
@ -4045,18 +4094,18 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
} }
// Driver // Driver
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\veracrypt.sys", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\veracrypt.sys", appDir);
StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\veracrypt.sys", dstDir); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt.sys", dstDir);
if (!TCCopyFile (srcPath, dstPath)) if (!TCCopyFileW (srcPath, dstPath))
{ {
handleWin32Error (hwndDlg, SRC_POS); handleWin32Error (hwndDlg, SRC_POS);
goto stop; goto stop;
} }
// Driver x64 // Driver x64
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\veracrypt-x64.sys", appDir); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\veracrypt-x64.sys", appDir);
StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\veracrypt-x64.sys", dstDir); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\veracrypt-x64.sys", dstDir);
if (!TCCopyFile (srcPath, dstPath)) if (!TCCopyFileW (srcPath, dstPath))
{ {
handleWin32Error (hwndDlg, SRC_POS); handleWin32Error (hwndDlg, SRC_POS);
goto stop; goto stop;
@ -4065,21 +4114,21 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (GetPreferredLangId () && strcmp (GetPreferredLangId (), "en") != 0) if (GetPreferredLangId () && strcmp (GetPreferredLangId (), "en") != 0)
{ {
// Language pack // Language pack
StringCbPrintfA (srcPath, sizeof(srcPath), "%s\\Language.%s.xml", appDir, GetPreferredLangId ()); StringCbPrintfW (srcPath, sizeof(srcPath), L"%s\\Language.%s.xml", appDir, GetPreferredLangId ());
StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\VeraCrypt\\Language.%s.xml", dstDir, GetPreferredLangId ()); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\VeraCrypt\\Language.%s.xml", dstDir, GetPreferredLangId ());
TCCopyFile (srcPath, dstPath); TCCopyFileW (srcPath, dstPath);
} }
// AutoRun // AutoRun
StringCbPrintfA (dstPath, sizeof(dstPath), "%s\\autorun.inf", dstDir); StringCbPrintfW (dstPath, sizeof(dstPath), L"%s\\autorun.inf", dstDir);
DeleteFile (dstPath); DeleteFileW (dstPath);
if (bAutoRun) if (bAutoRun)
{ {
FILE *af; FILE *af;
char autoMount[100]; wchar_t autoMount[2*MAX_PATH + 2];
char driveLetter[] = { ' ', '/', 'l', (char) drive, 0 }; wchar_t driveLetter[] = { L' ', L'/', L'l', L' ', (wchar_t) drive, 0 };
af = fopen (dstPath, "w,ccs=UNICODE"); af = _wfopen (dstPath, L"w,ccs=UNICODE");
if (af == NULL) if (af == NULL)
{ {
@ -4087,20 +4136,21 @@ BOOL CALLBACK TravelerDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
goto stop; goto stop;
} }
StringCbPrintfA (autoMount, sizeof(autoMount), "VeraCrypt\\VeraCrypt.exe /q background%s%s%s%s /m rm /v %s", StringCbPrintfW (autoMount, sizeof(autoMount), L"VeraCrypt\\VeraCrypt.exe /q background%s%s%s%s /m rm /v %s",
drive > 0 ? driveLetter : "", drive > 0 ? driveLetter : L"",
bExplore ? " /e" : "", bExplore ? L" /e" : L"",
bCacheInDriver ? " /c y" : "", bCacheInDriver ? L" /c y" : L"",
bMountReadOnly ? " /m ro" : "", bMountReadOnly ? L" /m ro" : L"",
volName); volName);
fwprintf (af, L"[autorun]\nlabel=%s\nicon=VeraCrypt\\VeraCrypt.exe\n", GetString ("TC_TRAVELER_DISK")); fwprintf (af, L"[autorun]\nlabel=%s\nicon=VeraCrypt\\VeraCrypt.exe\n", GetString ("TC_TRAVELER_DISK"));
fwprintf (af, L"action=%s\n", bAutoMount ? GetString ("MOUNT_TC_VOLUME") : GetString ("IDC_PREF_LOGON_START")); fwprintf (af, L"action=%s\n", bAutoMount ? GetString ("MOUNT_TC_VOLUME") : GetString ("IDC_PREF_LOGON_START"));
fwprintf (af, L"open=%hs\n", bAutoMount ? autoMount : "VeraCrypt\\VeraCrypt.exe"); fwprintf (af, L"open=%s\n", bAutoMount ? autoMount : L"VeraCrypt\\VeraCrypt.exe");
fwprintf (af, L"shell\\start=%s\nshell\\start\\command=VeraCrypt\\VeraCrypt.exe\n", GetString ("IDC_PREF_LOGON_START")); fwprintf (af, L"shell\\start=%s\nshell\\start\\command=VeraCrypt\\VeraCrypt.exe\n", GetString ("IDC_PREF_LOGON_START"));
fwprintf (af, L"shell\\dismount=%s\nshell\\dismount\\command=VeraCrypt\\VeraCrypt.exe /q /d\n", GetString ("DISMOUNT_ALL_TC_VOLUMES")); fwprintf (af, L"shell\\dismount=%s\nshell\\dismount\\command=VeraCrypt\\VeraCrypt.exe /q /d\n", GetString ("DISMOUNT_ALL_TC_VOLUMES"));
CheckFileStreamWriteErrors (hwndDlg, af, dstPath); ToSBCS (dstPath, sizeof (dstPath));
CheckFileStreamWriteErrors (hwndDlg, af, (char*) dstPath);
fclose (af); fclose (af);
} }
MessageBoxW (hwndDlg, GetString ("TRAVELER_DISK_CREATED"), lpszTitle, MB_ICONINFORMATION); MessageBoxW (hwndDlg, GetString ("TRAVELER_DISK_CREATED"), lpszTitle, MB_ICONINFORMATION);

View File

@ -198,36 +198,38 @@ BEGIN
RTEXT "Volume PIM:",IDT_PIM,0,46,65,8,NOT WS_VISIBLE RTEXT "Volume PIM:",IDT_PIM,0,46,65,8,NOT WS_VISIBLE
END END
IDD_TRAVELER_DLG DIALOGEX 0, 0, 300, 269 IDD_TRAVELER_DLG DIALOGEX 0, 0, 300, 287
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "VeraCrypt Traveler Disk Setup" CAPTION "VeraCrypt Traveler Disk Setup"
FONT 8, "MS Shell Dlg", 400, 0, 0x1 FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN BEGIN
EDITTEXT IDC_DIRECTORY,17,29,205,13,ES_AUTOHSCROLL EDITTEXT IDC_DIRECTORY,17,29,205,13,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "Browse...",IDC_BROWSE_DIRS,228,28,57,14 PUSHBUTTON "Browse...",IDC_BROWSE_DIRS,228,28,57,14
CONTROL "Include VeraCrypt Volume Creation Wizard",IDC_COPY_WIZARD, CONTROL "Include VeraCrypt Volume Creation Wizard",IDC_COPY_WIZARD,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,48,258,10 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,48,258,10
CONTROL "Do nothing",IDC_AUTORUN_DISABLE,"Button",BS_AUTORADIOBUTTON,15,97,262,10 CONTROL "Do nothing",IDC_AUTORUN_DISABLE,"Button",BS_AUTORADIOBUTTON,15,115,262,10
CONTROL "&Start VeraCrypt",IDC_AUTORUN_START,"Button",BS_AUTORADIOBUTTON,15,108,262,11 CONTROL "&Start VeraCrypt",IDC_AUTORUN_START,"Button",BS_AUTORADIOBUTTON,15,126,262,11
CONTROL "&Auto-mount VeraCrypt volume (specified below)",IDC_AUTORUN_MOUNT, CONTROL "&Auto-mount VeraCrypt volume (specified below)",IDC_AUTORUN_MOUNT,
"Button",BS_AUTORADIOBUTTON,15,120,262,11 "Button",BS_AUTORADIOBUTTON,15,138,262,11
EDITTEXT IDC_VOLUME_NAME,21,157,194,13,ES_AUTOHSCROLL | WS_DISABLED EDITTEXT IDC_VOLUME_NAME,21,175,194,13,ES_AUTOHSCROLL | WS_DISABLED
PUSHBUTTON "Browse...",IDC_BROWSE_FILES,221,156,57,14,WS_DISABLED PUSHBUTTON "Browse...",IDC_BROWSE_FILES,221,174,57,14,WS_DISABLED
COMBOBOX IDC_DRIVELIST,120,175,96,69,CBS_DROPDOWNLIST | WS_DISABLED | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DRIVELIST,120,193,96,69,CBS_DROPDOWNLIST | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
CONTROL "Open &Explorer window for mounted volume",IDC_TRAVEL_OPEN_EXPLORER, CONTROL "Open &Explorer window for mounted volume",IDC_TRAVEL_OPEN_EXPLORER,
"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,22,193,256,10 "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,22,211,256,10
CONTROL "Mount volume as read-&only",IDC_MOUNT_READONLY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,22,206,256,10 CONTROL "Mount volume as read-&only",IDC_MOUNT_READONLY,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,22,224,256,10
CONTROL "&Cache password in driver memory",IDC_TRAV_CACHE_PASSWORDS, CONTROL "&Cache password in driver memory",IDC_TRAV_CACHE_PASSWORDS,
"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,22,219,256,10 "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,22,237,256,10
DEFPUSHBUTTON "Create",IDC_CREATE,173,249,57,14 DEFPUSHBUTTON "Create",IDC_CREATE,173,267,57,14
PUSHBUTTON "Close",IDCLOSE,236,249,57,14 PUSHBUTTON "Close",IDCLOSE,236,267,57,14
GROUPBOX "File Settings",IDT_FILE_SETTINGS,6,7,287,59 GROUPBOX "File Settings",IDT_FILE_SETTINGS,6,7,287,71
GROUPBOX "AutoRun Configuration (autorun.inf)",IDT_AUTORUN,5,70,288,172 GROUPBOX "AutoRun Configuration (autorun.inf)",IDT_AUTORUN,5,88,288,172
LTEXT "VeraCrypt volume to mount (relative to traveler disk root):",IDT_TRAVELER_MOUNT,21,147,248,8,WS_DISABLED LTEXT "VeraCrypt volume to mount (relative to traveler disk root):",IDT_TRAVELER_MOUNT,21,165,248,8,WS_DISABLED
RTEXT "Mount volume as drive letter:",IDT_MOUNT_LETTER,18,177,99,8,WS_DISABLED RTEXT "Mount volume as drive letter:",IDT_MOUNT_LETTER,18,195,99,8,WS_DISABLED
LTEXT "Create traveler disk files at (traveler disk root directory):",IDT_TRAVEL_ROOT,18,19,259,8 LTEXT "Create traveler disk files at (traveler disk root directory):",IDT_TRAVEL_ROOT,18,19,259,8
GROUPBOX "Mount Settings",IDT_MOUNT_SETTINGS,13,134,272,100,WS_DISABLED GROUPBOX "Mount Settings",IDT_MOUNT_SETTINGS,13,152,272,100,WS_DISABLED
LTEXT "Upon insertion of traveler disk: ",IDT_TRAVEL_INSERTION,13,84,263,8 LTEXT "Upon insertion of traveler disk: ",IDT_TRAVEL_INSERTION,13,102,263,8
CONTROL "Include VeraCrypt Volume Expander",IDC_COPY_EXPANDER,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,62,258,10
END END
IDD_HOTKEYS_DLG DIALOGEX 0, 0, 389, 257 IDD_HOTKEYS_DLG DIALOGEX 0, 0, 389, 257
@ -413,7 +415,7 @@ BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 293 RIGHTMARGIN, 293
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 262 BOTTOMMARGIN, 280
END END
IDD_HOTKEYS_DLG, DIALOG IDD_HOTKEYS_DLG, DIALOG