|
|
1.1.1.10 root 1: /*
1.1.1.12 root 2: Legal Notice: Some portions of the source code contained in this file were
3: derived from the source code of Encryption for the Masses 2.02a, which is
4: Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License
5: Agreement for Encryption for the Masses'. Modifications and additions to
6: the original source code (contained in this file) and all other portions of
7: this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed
8: by the TrueCrypt License 2.4 the full text of which is contained in the
9: file License.txt included in TrueCrypt binary and source code distribution
1.1.1.10 root 10: packages. */
1.1.1.6 root 11:
1.1.1.12 root 12: #ifndef TC_HEADER_DLGCODE
13: #define TC_HEADER_DLGCODE
14:
1.1.1.6 root 15: #include "Common.h"
16: #include "Apidrvr.h"
17: #include "Keyfiles.h"
1.1.1.12 root 18: #include "Wipe.h"
1.1.1.6 root 19:
1.1.1.10 root 20: #ifdef __cplusplus
21: extern "C" {
22: #endif
23:
1.1.1.6 root 24: /* IDs for dynamically generated GUI elements */
1.1.1.12 root 25: enum dynamic_gui_element_ids
26: {
27: IDPM_CHECK_FILESYS = 500001,
28: IDPM_REPAIR_FILESYS,
29: IDPM_OPEN_VOLUME,
30: IDM_SHOW_HIDE,
31: IDM_HOMEPAGE_SYSTRAY
32: };
33:
34: enum
35: {
36: TC_TBXID_LEGAL_NOTICES,
37: TC_TBXID_SYS_ENCRYPTION_PRETEST,
38: TC_TBXID_SYS_ENC_RESCUE_DISK
39: };
1.1.1.5 root 40:
1.1.1.4 root 41: #define IDC_ABOUT 0x7fff /* ID for AboutBox on system menu in wm_user range */
42:
1.1.1.10 root 43: #define SELDEVFLAG_CONTAINS_PARTITIONS 0x00000001L
44: #define SELDEVFLAG_VIRTUAL_PARTITION 0x00000002L
1.1.1.11 root 45: #define SELDEVFLAG_REMOVABLE_HOST_DEVICE 0x00000004L
1.1.1.12 root 46: #define SELDEVFLAG_SYSTEM_PARTITION 0x00000008L
47: #define SELDEVFLAG_SYSTEM_DRIVE 0x00000010L
1.1.1.10 root 48:
1.1.1.11 root 49: #define UNMOUNT_MAX_AUTO_RETRIES 10
1.1.1.5 root 50: #define UNMOUNT_AUTO_RETRY_DELAY 50
1.1 root 51:
1.1.1.10 root 52: #define MAX_MULTI_CHOICES 10 /* Maximum number of options for mutliple-choice dialog */
53:
1.1.1.12 root 54: #define FILE_CONFIGURATION "Configuration.xml"
55: #define FILE_SYSTEM_ENCRYPTION_CFG "System Encryption.xml"
1.1.1.6 root 56: #define FILE_DEFAULT_KEYFILES "Default Keyfiles.xml"
57:
1.1.1.11 root 58: #ifndef USER_DEFAULT_SCREEN_DPI
59: #define USER_DEFAULT_SCREEN_DPI 96
60: #endif
61:
62: #if (USER_DEFAULT_SCREEN_DPI != 96)
63: #error Revision of GUI and graphics necessary, since everything assumes default screen DPI as 96 (note that 96 is the default on Windows 2000, XP, and Vista).
64: #endif
65:
1.1.1.9 root 66: extern char *LastDialogId;
1.1.1.12 root 67: extern char *ConfigBuffer;
1.1 root 68: extern char szHelpFile[TC_MAX_PATH];
1.1.1.6 root 69: extern char szHelpFile2[TC_MAX_PATH];
70: extern HFONT hFixedDigitFont;
1.1 root 71: extern HFONT hBoldFont;
72: extern HFONT hTitleFont;
73: extern HFONT hFixedFont;
74: extern HFONT hUserFont;
75: extern HFONT hUserUnderlineFont;
76: extern HFONT hUserBoldFont;
1.1.1.11 root 77: extern int ScreenDPI;
78: extern double DlgAspectRatio;
1.1.1.6 root 79: extern HWND MainDlg;
80: extern BOOL Silent;
1.1.1.9 root 81: extern BOOL bHistory;
1.1.1.6 root 82: extern BOOL bPreserveTimestamp;
1.1.1.12 root 83: extern BOOL bStartOnLogon;
84: extern BOOL bMountDevicesOnLogon;
85: extern BOOL bMountFavoritesOnLogon;
1.1.1.6 root 86: extern wchar_t *lpszTitle;
1.1 root 87: extern int nCurrentOS;
88: extern int CurrentOSMajor;
89: extern int CurrentOSMinor;
1.1.1.9 root 90: extern BOOL RemoteSession;
1.1 root 91: extern HANDLE hDriver;
92: extern HINSTANCE hInst;
1.1.1.12 root 93: extern HANDLE hSysEncMutex;
94: extern int SystemEncryptionStatus;
95: extern WipeAlgorithmId nWipeMode;
96: extern BOOL bSysPartitionSelected;
97: extern BOOL bSysDriveSelected;
98:
99: extern BOOL bHyperLinkBeingTracked;
1.1 root 100:
1.1.1.6 root 101: extern BOOL KeyFilesEnable;
102: extern KeyFile *FirstKeyFile;
103: extern KeyFilesDlgParam defaultKeyFilesParam;
1.1.1.10 root 104: extern BOOL UacElevated;
1.1.1.11 root 105: extern BOOL IgnoreWmDeviceChange;
1.1.1.6 root 106:
107: enum
108: {
109: WIN_UNKNOWN = 0,
110: WIN_31,
111: WIN_95,
112: WIN_98,
113: WIN_ME,
114: WIN_NT3,
115: WIN_NT4,
116: WIN_2000,
117: WIN_XP,
1.1.1.10 root 118: WIN_XP64,
119: WIN_SERVER_2003,
1.1.1.6 root 120: WIN_VISTA,
1.1.1.12 root 121: WIN_SERVER_2008,
1.1.1.10 root 122: WIN_VISTA_OR_LATER
1.1.1.6 root 123: };
1.1 root 124:
1.1.1.12 root 125: enum tc_app_msg_ids
126: {
127: /* WARNING: Changing these values or their meanings may cause incompatibility with other versions
128: (for example, if a new version of the TrueCrypt installer needed to shut down this version of
129: TrueCrypt during upgrade, it could fail or do something unwanted because the signal value would
130: be incorrect). When adding a new constant, verify that the value is unique within this block and
131: that it is less than WM_APP+16383. */
132:
133: // Common (inter-app)
134: TC_APPMSG_CLOSE_BKG_TASK = WM_APP + 4, // Changing this value will prevent smooth upgrades from pre-5.x versions
135: TC_APPMSG_SYSENC_CONFIG_UPDATE = WM_APP + 101,
136: TC_APPMSG_TASKBAR_ICON = WM_APP + 102,
137: TC_APPMSG_LOAD_TEXT_BOX_CONTENT = WM_APP + 103,
138: // Mount
139: TC_APPMSG_MOUNT_ENABLE_DISABLE_CONTROLS = WM_APP + 201,
140: TC_APPMSG_MOUNT_SHOW_WINDOW = WM_APP + 202,
1.1.1.13! root 141: TC_APPMSG_PREBOOT_PASSWORD_MODE = WM_APP + 203,
1.1.1.12 root 142: // Format
143: TC_APPMSG_FORMAT_THREAD_ENDED = WM_APP + 301,
144: TC_APPMSG_FORMAT_FINISHED = WM_APP + 302,
145: TC_APPMSG_FORMAT_USER_QUIT = WM_APP + 303,
146: TC_APPMSG_PERFORM_POST_WMINIT_TASKS = WM_APP + 304,
147: TC_APPMSG_PERFORM_POST_SYSENC_WMINIT_TASKS = WM_APP + 305,
148: // Setup
149: TC_APPMSG_INSTALL_SUCCESS = WM_APP + 401,
150: TC_APPMSG_UNINSTALL_SUCCESS = WM_APP + 402,
151: TC_APPMSG_EXTRACTION_SUCCESS = WM_APP + 403,
152: TC_APPMSG_INSTALL_FAILURE = WM_APP + 404,
153: TC_APPMSG_UNINSTALL_FAILURE = WM_APP + 405,
154: TC_APPMSG_EXTRACTION_FAILURE = WM_APP + 406,
155: TC_APPMSG_LOAD_LICENSE = WM_APP + 407
156: };
157:
158: enum SystemEncryptionStatus
159: {
160: /* WARNING: As these values are written to config files, if they or their meanings
161: are changed, incompatiblity with other versions may arise (upgrade, downgrade, etc.).
162: When adding a new constant, verify that the value is unique within this block. */
163: SYSENC_STATUS_NONE = 0,
164: SYSENC_STATUS_PRETEST = 200,
165: SYSENC_STATUS_ENCRYPTING = 400,
166: SYSENC_STATUS_DECRYPTING = 600
167: };
168:
169: enum vol_creation_wizard_modes
170: {
171: WIZARD_MODE_FILE_CONTAINER = 0,
172: WIZARD_MODE_NONSYS_DEVICE,
173: WIZARD_MODE_SYS_DEVICE
174: };
175:
176: #define DEFAULT_VOL_CREATION_WIZARD_MODE WIZARD_MODE_FILE_CONTAINER
177:
1.1 root 178: #define ICON_HAND MB_ICONHAND
179: #define YES_NO MB_YESNO
180:
181: #ifdef _UNICODE
182: #define WINMAIN wWinMain
183: #else
184: #define WINMAIN WinMain
185: #endif
186:
1.1.1.12 root 187: #define PRINT_TOOL "notepad"
1.1.1.6 root 188:
1.1 root 189: void cleanup ( void );
190: void LowerCaseCopy ( char *lpszDest , char *lpszSource );
191: void UpperCaseCopy ( char *lpszDest , char *lpszSource );
192: void CreateFullVolumePath ( char *lpszDiskFile , char *lpszFileName , BOOL *bDevice );
193: int FakeDosNameForDevice ( char *lpszDiskFile , char *lpszDosDevice , char *lpszCFDevice , BOOL bNameOnly );
194: int RemoveFakeDosName ( char *lpszDiskFile , char *lpszDosDevice );
1.1.1.6 root 195: void AbortProcess ( char *stringId );
1.1.1.4 root 196: void AbortProcessSilent ( void );
1.1 root 197: void *err_malloc ( size_t size );
198: char *err_strdup ( char *lpszText );
1.1.1.4 root 199: DWORD handleWin32Error ( HWND hwndDlg );
1.1.1.13! root 200: BOOL translateWin32Error ( wchar_t *lpszMsgBuf , int nWSizeOfBuf );
1.1.1.11 root 201: BOOL CALLBACK AboutDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
1.1 root 202: BOOL IsButtonChecked ( HWND hButton );
203: void CheckButton ( HWND hButton );
1.1.1.12 root 204: void LeftPadString (char *szTmp, int len, int targetLen, char filler);
1.1 root 205: void ToSBCS ( LPWSTR lpszText );
206: void ToUNICODE ( char *lpszText );
207: void InitDialog ( HWND hwndDlg );
208: HDC CreateMemBitmap ( HINSTANCE hInstance , HWND hwnd , char *resource );
1.1.1.11 root 209: HBITMAP RenderBitmap ( char *resource , HWND hwndDest , int x , int y , int nWidth , int nHeight , BOOL bDirectRender , BOOL bKeepAspectRatio);
1.1.1.6 root 210: LRESULT CALLBACK RedTick ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
211: BOOL RegisterRedTick ( HINSTANCE hInstance );
212: BOOL UnregisterRedTick ( HINSTANCE hInstance );
1.1 root 213: LRESULT CALLBACK SplashDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
214: void WaitCursor ( void );
215: void NormalCursor ( void );
216: void ArrowWaitCursor ( void );
1.1.1.10 root 217: void HandCursor ();
1.1.1.6 root 218: void AddComboPair (HWND hComboBox, char *lpszItem, int value);
219: void AddComboPairW (HWND hComboBox, wchar_t *lpszItem, int value);
220: void SelectAlgo ( HWND hComboBox , int *nCipher );
1.1.1.12 root 221: void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA);
1.1 root 222: LRESULT CALLBACK CustomDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
1.1.1.13! root 223: BOOL TCCreateMutex (HANDLE *hMutex, char *name);
! 224: void TCCloseMutex (HANDLE *hMutex);
1.1.1.12 root 225: BOOL CreateSysEncMutex (void);
226: void CloseSysEncMutex (void);
1.1.1.13! root 227: BOOL CreateDriverSetupMutex (void);
! 228: void CloseDriverSetupMutex (void);
1.1.1.12 root 229: BOOL LoadSysEncSettings (HWND hwndDlg);
230: BOOL SysEncryptionOrDecryptionRequired (void);
1.1.1.10 root 231: void InitApp ( HINSTANCE hInstance, char *lpszCommandLine );
1.1.1.6 root 232: void InitHelpFileName (void);
1.1 root 233: BOOL OpenDevice ( char *lpszPath , OPEN_TEST_STRUCT *driver );
1.1.1.13! root 234: void NotifyDriverOfTravelerMode (void);
1.1 root 235: int GetAvailableFixedDisks ( HWND hComboBox , char *lpszRootPath );
236: int GetAvailableRemovables ( HWND hComboBox , char *lpszRootPath );
1.1.1.12 root 237: int IsSystemDevicePath (char *path, HWND hwndDlg, BOOL bReliableRequired);
1.1.1.11 root 238: BOOL CALLBACK RawDevicesDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
1.1.1.12 root 239: BOOL TextInfoDialogBox (int nID);
240: BOOL CALLBACK TextInfoDialogBoxDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
1.1.1.6 root 241: char * GetLegalNotices ();
1.1.1.11 root 242: BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
243: BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
1.1.1.10 root 244: BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
1.1 root 245: int DriverAttach ( void );
1.1.1.4 root 246: BOOL SeekHiddenVolHeader (HFILE dev, unsigned __int64 volSize, BOOL deviceFlag);
1.1.1.6 root 247: BOOL CALLBACK CipherTestDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
248: void ResetCipherTest ( HWND hwndDlg , int idTestCipher );
1.1.1.7 root 249: BOOL BrowseFiles (HWND hwndDlg, char *stringId, char *lpszFileName, BOOL keepHistory, BOOL saveMode);
1.1.1.10 root 250: BOOL BrowseFilesInDir (HWND hwndDlg, char *stringId, char *initialDir, char *lpszFileName, BOOL keepHistory, BOOL saveMode);
1.1.1.6 root 251: BOOL BrowseDirectories (HWND hWnd, char *lpszTitle, char *dirName);
1.1 root 252: void handleError ( HWND hwndDlg , int code );
1.1.1.6 root 253: void LocalizeDialog ( HWND hwnd, char *stringId );
1.1.1.4 root 254: void OpenVolumeExplorerWindow (int driveNo);
255: static BOOL CALLBACK CloseVolumeExplorerWindowsEnum( HWND hwnd, LPARAM driveNo);
256: BOOL CloseVolumeExplorerWindows (HWND hwnd, int driveNo);
257: BOOL CheckCapsLock (HWND hwnd, BOOL quiet);
1.1.1.10 root 258: BOOL CheckFileExtension (char *fileName);
1.1.1.4 root 259: int GetFirstAvailableDrive ();
260: int GetLastAvailableDrive ();
261: BOOL IsDriveAvailable (int driveNo);
1.1.1.10 root 262: BOOL IsDeviceMounted (char *deviceName);
1.1.1.4 root 263: int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced);
1.1.1.5 root 264: void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap);
1.1.1.6 root 265: int MountVolume (HWND hwndDlg, int driveNo, char *volumePath, Password *password, BOOL cachePassword, BOOL sharedAccess, MountOptions *mountOptions, BOOL quiet, BOOL bReportWrongPassword);
1.1.1.4 root 266: BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount);
267: BOOL IsPasswordCacheEmpty (void);
268: BOOL IsMountedVolume (char *volname);
1.1.1.11 root 269: int GetMountedVolumeDriveNo (char *volname);
1.1.1.4 root 270: BOOL IsAdmin (void);
1.1.1.10 root 271: BOOL IsUacSupported ();
1.1.1.4 root 272: BOOL ResolveSymbolicLink (PWSTR symLinkName, PWSTR targetName);
273: int GetDiskDeviceDriveLetter (PWSTR deviceName);
1.1.1.10 root 274: HANDLE DismountDrive (char *devName);
1.1.1.12 root 275: BOOL FileExists (const char *filePathPtr);
276: __int64 FindStringInFile (char *filePath, char* str, int strLen);
1.1.1.5 root 277: BOOL TCCopyFile (char *sourceFileName, char *destinationFile);
1.1.1.12 root 278: BOOL SaveBufferToFile (char *inputBuffer, char *destinationFile, DWORD inputLength, BOOL bAppend);
279: BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, int byteLen);
1.1.1.6 root 280: int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolume);
281: int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume);
282: void GetSpeedString (unsigned __int64 speed, wchar_t *str);
1.1.1.5 root 283: BOOL IsNonInstallMode ();
1.1.1.6 root 284: BOOL DriverUnload ();
285: LRESULT SetCheckBox (HWND hwndDlg, int dlgItem, BOOL state);
286: BOOL GetCheckBox (HWND hwndDlg, int dlgItem);
1.1.1.12 root 287: void ManageStartupSeq (void);
1.1.1.6 root 288: void CleanLastVisitedMRU (void);
1.1.1.10 root 289: void ClearHistory (HWND hwndDlgItem);
1.1.1.6 root 290: LRESULT ListItemAdd (HWND list, int index, char *string);
291: LRESULT ListItemAddW (HWND list, int index, wchar_t *string);
292: LRESULT ListSubItemSet (HWND list, int index, int subIndex, char *string);
293: LRESULT ListSubItemSetW (HWND list, int index, int subIndex, wchar_t *string);
294: BOOL GetMountList (MOUNT_LIST_STRUCT *list);
295: int GetDriverRefCount ();
296: void GetSizeString (unsigned __int64 size, wchar_t *str);
1.1.1.12 root 297: __int64 GetFileSize64 (char *path);
298: BOOL LoadInt16 (char *filePath, int *result, __int64 fileOffset);
299: BOOL LoadInt32 (char *filePath, unsigned __int32 *result, __int64 fileOffset);
1.1.1.6 root 300: char *LoadFile (char *fileName, DWORD *size);
1.1.1.12 root 301: char *LoadFileBlock (char *fileName, __int64 fileOffset, int count);
1.1.1.10 root 302: char *GetModPath (char *path, int maxSize);
1.1.1.6 root 303: char *GetConfigPath (char *fileName);
1.1.1.12 root 304: char GetSystemDriveLetter (void);
1.1.1.6 root 305: void OpenPageHelp (HWND hwndDlg, int nPage);
306: int Info (char *stringId);
307: int Warning (char *stringId);
308: int Error (char *stringId);
309: int AskYesNo (char *stringId);
310: int AskNoYes (char *stringId);
1.1.1.12 root 311: int AskOkCancel (char *stringId);
1.1.1.6 root 312: int AskWarnYesNo (char *stringId);
313: int AskWarnNoYes (char *stringId);
1.1.1.11 root 314: int AskWarnNoYesString (wchar_t *string);
1.1.1.6 root 315: int AskWarnCancelOk (char *stringId);
1.1.1.12 root 316: int AskErrYesNo (char *stringId);
317: int AskErrNoYes (char *stringId);
1.1.1.10 root 318: int AskMultiChoice (void *strings[]);
1.1.1.6 root 319: BOOL ConfigWriteBegin ();
320: BOOL ConfigWriteEnd ();
321: BOOL ConfigWriteString (char *configKey, char *configValue);
322: BOOL ConfigWriteInt (char *configKey, int configValue);
323: int ConfigReadInt (char *configKey, int defaultValue);
324: char *ConfigReadString (char *configKey, char *defaultValue, char *str, int maxLen);
325: void RestoreDefaultKeyFilesParam (void);
326: BOOL LoadDefaultKeyFilesParam (void);
327: void Debug (char *format, ...);
328: void DebugMsgBox (char *format, ...);
329: BOOL Is64BitOs ();
1.1.1.10 root 330: void Applink (char *dest, BOOL bSendOS, char *extraOutput);
1.1.1.6 root 331: char *RelativePath2Absolute (char *szFileName);
332: void CheckSystemAutoMount ();
333: BOOL CALLBACK CloseTCWindowsEnum( HWND hwnd, LPARAM lParam);
1.1.1.7 root 334: BOOL CALLBACK FindTCWindowEnum (HWND hwnd, LPARAM lParam);
1.1.1.6 root 335: BYTE *MapResource (char *resourceType, int resourceId, PDWORD size);
1.1.1.12 root 336: void InconsistencyResolved (char *msg);
1.1.1.8 root 337: BOOL SelectMultipleFiles (HWND hwndDlg, char *stringId, char *lpszFileName, BOOL keepHistory);
338: BOOL SelectMultipleFilesNext (char *lpszFileName);
1.1.1.9 root 339: void OpenOnlineHelp ();
1.1.1.10 root 340: BOOL GetPartitionInfo (char *deviceName, PPARTITION_INFORMATION rpartInfo);
341: BOOL GetDriveGeometry (char *deviceName, PDISK_GEOMETRY diskGeometry);
342: BOOL IsVolumeDeviceHosted (char *lpszDiskFile);
1.1.1.11 root 343: int CompensateXDPI (int val);
344: int CompensateYDPI (int val);
345: int CompensateDPIFont (int val);
1.1.1.10 root 346: int GetTextGfxWidth (HWND hwndDlgItem, wchar_t *text, HFONT hFont);
347: int GetTextGfxHeight (HWND hwndDlgItem, wchar_t *text, HFONT hFont);
348: BOOL ToHyperlink (HWND hwndDlg, UINT ctrlId);
1.1.1.12 root 349: void ToBootPwdField (HWND hwndDlg, UINT ctrlId);
1.1.1.11 root 350: void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate);
1.1.1.10 root 351: BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize);
1.1.1.13! root 352: BOOL DoDriverInstall (HWND hwndDlg);
1.1.1.10 root 353:
354: #ifdef __cplusplus
355: }
1.1.1.12 root 356: #endif
357:
358: #endif // TC_HEADER_DLGCODE
359:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.