|
|
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.14! root 86: extern int HiddenSectorDetectionStatus;
1.1.1.6 root 87: extern wchar_t *lpszTitle;
1.1 root 88: extern int nCurrentOS;
89: extern int CurrentOSMajor;
90: extern int CurrentOSMinor;
1.1.1.9 root 91: extern BOOL RemoteSession;
1.1 root 92: extern HANDLE hDriver;
93: extern HINSTANCE hInst;
1.1.1.12 root 94: extern HANDLE hSysEncMutex;
95: extern int SystemEncryptionStatus;
96: extern WipeAlgorithmId nWipeMode;
97: extern BOOL bSysPartitionSelected;
98: extern BOOL bSysDriveSelected;
99:
100: extern BOOL bHyperLinkBeingTracked;
1.1 root 101:
1.1.1.6 root 102: extern BOOL KeyFilesEnable;
103: extern KeyFile *FirstKeyFile;
104: extern KeyFilesDlgParam defaultKeyFilesParam;
1.1.1.10 root 105: extern BOOL UacElevated;
1.1.1.11 root 106: extern BOOL IgnoreWmDeviceChange;
1.1.1.6 root 107:
108: enum
109: {
110: WIN_UNKNOWN = 0,
111: WIN_31,
112: WIN_95,
113: WIN_98,
114: WIN_ME,
115: WIN_NT3,
116: WIN_NT4,
117: WIN_2000,
118: WIN_XP,
1.1.1.10 root 119: WIN_XP64,
120: WIN_SERVER_2003,
1.1.1.6 root 121: WIN_VISTA,
1.1.1.12 root 122: WIN_SERVER_2008,
1.1.1.10 root 123: WIN_VISTA_OR_LATER
1.1.1.6 root 124: };
1.1 root 125:
1.1.1.12 root 126: enum tc_app_msg_ids
127: {
128: /* WARNING: Changing these values or their meanings may cause incompatibility with other versions
129: (for example, if a new version of the TrueCrypt installer needed to shut down this version of
130: TrueCrypt during upgrade, it could fail or do something unwanted because the signal value would
131: be incorrect). When adding a new constant, verify that the value is unique within this block and
132: that it is less than WM_APP+16383. */
133:
134: // Common (inter-app)
135: TC_APPMSG_CLOSE_BKG_TASK = WM_APP + 4, // Changing this value will prevent smooth upgrades from pre-5.x versions
136: TC_APPMSG_SYSENC_CONFIG_UPDATE = WM_APP + 101,
137: TC_APPMSG_TASKBAR_ICON = WM_APP + 102,
138: TC_APPMSG_LOAD_TEXT_BOX_CONTENT = WM_APP + 103,
139: // Mount
140: TC_APPMSG_MOUNT_ENABLE_DISABLE_CONTROLS = WM_APP + 201,
141: TC_APPMSG_MOUNT_SHOW_WINDOW = WM_APP + 202,
1.1.1.13 root 142: TC_APPMSG_PREBOOT_PASSWORD_MODE = WM_APP + 203,
1.1.1.12 root 143: // Format
144: TC_APPMSG_FORMAT_THREAD_ENDED = WM_APP + 301,
145: TC_APPMSG_FORMAT_FINISHED = WM_APP + 302,
146: TC_APPMSG_FORMAT_USER_QUIT = WM_APP + 303,
147: TC_APPMSG_PERFORM_POST_WMINIT_TASKS = WM_APP + 304,
148: TC_APPMSG_PERFORM_POST_SYSENC_WMINIT_TASKS = WM_APP + 305,
149: // Setup
150: TC_APPMSG_INSTALL_SUCCESS = WM_APP + 401,
151: TC_APPMSG_UNINSTALL_SUCCESS = WM_APP + 402,
152: TC_APPMSG_EXTRACTION_SUCCESS = WM_APP + 403,
153: TC_APPMSG_INSTALL_FAILURE = WM_APP + 404,
154: TC_APPMSG_UNINSTALL_FAILURE = WM_APP + 405,
155: TC_APPMSG_EXTRACTION_FAILURE = WM_APP + 406,
156: TC_APPMSG_LOAD_LICENSE = WM_APP + 407
157: };
158:
159: enum SystemEncryptionStatus
160: {
161: /* WARNING: As these values are written to config files, if they or their meanings
162: are changed, incompatiblity with other versions may arise (upgrade, downgrade, etc.).
163: When adding a new constant, verify that the value is unique within this block. */
164: SYSENC_STATUS_NONE = 0,
165: SYSENC_STATUS_PRETEST = 200,
166: SYSENC_STATUS_ENCRYPTING = 400,
167: SYSENC_STATUS_DECRYPTING = 600
168: };
169:
170: enum vol_creation_wizard_modes
171: {
172: WIZARD_MODE_FILE_CONTAINER = 0,
173: WIZARD_MODE_NONSYS_DEVICE,
174: WIZARD_MODE_SYS_DEVICE
175: };
176:
177: #define DEFAULT_VOL_CREATION_WIZARD_MODE WIZARD_MODE_FILE_CONTAINER
178:
1.1 root 179: #define ICON_HAND MB_ICONHAND
180: #define YES_NO MB_YESNO
181:
182: #ifdef _UNICODE
183: #define WINMAIN wWinMain
184: #else
185: #define WINMAIN WinMain
186: #endif
187:
1.1.1.12 root 188: #define PRINT_TOOL "notepad"
1.1.1.6 root 189:
1.1 root 190: void cleanup ( void );
191: void LowerCaseCopy ( char *lpszDest , char *lpszSource );
192: void UpperCaseCopy ( char *lpszDest , char *lpszSource );
193: void CreateFullVolumePath ( char *lpszDiskFile , char *lpszFileName , BOOL *bDevice );
194: int FakeDosNameForDevice ( char *lpszDiskFile , char *lpszDosDevice , char *lpszCFDevice , BOOL bNameOnly );
195: int RemoveFakeDosName ( char *lpszDiskFile , char *lpszDosDevice );
1.1.1.6 root 196: void AbortProcess ( char *stringId );
1.1.1.4 root 197: void AbortProcessSilent ( void );
1.1 root 198: void *err_malloc ( size_t size );
199: char *err_strdup ( char *lpszText );
1.1.1.4 root 200: DWORD handleWin32Error ( HWND hwndDlg );
1.1.1.13 root 201: BOOL translateWin32Error ( wchar_t *lpszMsgBuf , int nWSizeOfBuf );
1.1.1.11 root 202: BOOL CALLBACK AboutDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
1.1 root 203: BOOL IsButtonChecked ( HWND hButton );
204: void CheckButton ( HWND hButton );
1.1.1.12 root 205: void LeftPadString (char *szTmp, int len, int targetLen, char filler);
1.1 root 206: void ToSBCS ( LPWSTR lpszText );
207: void ToUNICODE ( char *lpszText );
208: void InitDialog ( HWND hwndDlg );
209: HDC CreateMemBitmap ( HINSTANCE hInstance , HWND hwnd , char *resource );
1.1.1.11 root 210: HBITMAP RenderBitmap ( char *resource , HWND hwndDest , int x , int y , int nWidth , int nHeight , BOOL bDirectRender , BOOL bKeepAspectRatio);
1.1.1.6 root 211: LRESULT CALLBACK RedTick ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
212: BOOL RegisterRedTick ( HINSTANCE hInstance );
213: BOOL UnregisterRedTick ( HINSTANCE hInstance );
1.1 root 214: LRESULT CALLBACK SplashDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
215: void WaitCursor ( void );
216: void NormalCursor ( void );
217: void ArrowWaitCursor ( void );
1.1.1.10 root 218: void HandCursor ();
1.1.1.6 root 219: void AddComboPair (HWND hComboBox, char *lpszItem, int value);
220: void AddComboPairW (HWND hComboBox, wchar_t *lpszItem, int value);
221: void SelectAlgo ( HWND hComboBox , int *nCipher );
1.1.1.12 root 222: void PopulateWipeModeCombo (HWND hComboBox, BOOL bNA);
1.1 root 223: LRESULT CALLBACK CustomDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam );
1.1.1.13 root 224: BOOL TCCreateMutex (HANDLE *hMutex, char *name);
225: void TCCloseMutex (HANDLE *hMutex);
1.1.1.12 root 226: BOOL CreateSysEncMutex (void);
227: void CloseSysEncMutex (void);
1.1.1.13 root 228: BOOL CreateDriverSetupMutex (void);
229: void CloseDriverSetupMutex (void);
1.1.1.12 root 230: BOOL LoadSysEncSettings (HWND hwndDlg);
231: BOOL SysEncryptionOrDecryptionRequired (void);
1.1.1.10 root 232: void InitApp ( HINSTANCE hInstance, char *lpszCommandLine );
1.1.1.6 root 233: void InitHelpFileName (void);
1.1 root 234: BOOL OpenDevice ( char *lpszPath , OPEN_TEST_STRUCT *driver );
1.1.1.13 root 235: void NotifyDriverOfTravelerMode (void);
1.1 root 236: int GetAvailableFixedDisks ( HWND hComboBox , char *lpszRootPath );
237: int GetAvailableRemovables ( HWND hComboBox , char *lpszRootPath );
1.1.1.12 root 238: int IsSystemDevicePath (char *path, HWND hwndDlg, BOOL bReliableRequired);
1.1.1.11 root 239: BOOL CALLBACK RawDevicesDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam );
1.1.1.12 root 240: BOOL TextInfoDialogBox (int nID);
241: BOOL CALLBACK TextInfoDialogBoxDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
1.1.1.6 root 242: char * GetLegalNotices ();
1.1.1.11 root 243: BOOL CALLBACK BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
244: BOOL CALLBACK KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
1.1.1.10 root 245: BOOL CALLBACK MultiChoiceDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
1.1 root 246: int DriverAttach ( void );
1.1.1.4 root 247: BOOL SeekHiddenVolHeader (HFILE dev, unsigned __int64 volSize, BOOL deviceFlag);
1.1.1.6 root 248: BOOL CALLBACK CipherTestDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam );
249: void ResetCipherTest ( HWND hwndDlg , int idTestCipher );
1.1.1.7 root 250: BOOL BrowseFiles (HWND hwndDlg, char *stringId, char *lpszFileName, BOOL keepHistory, BOOL saveMode);
1.1.1.10 root 251: BOOL BrowseFilesInDir (HWND hwndDlg, char *stringId, char *initialDir, char *lpszFileName, BOOL keepHistory, BOOL saveMode);
1.1.1.6 root 252: BOOL BrowseDirectories (HWND hWnd, char *lpszTitle, char *dirName);
1.1 root 253: void handleError ( HWND hwndDlg , int code );
1.1.1.6 root 254: void LocalizeDialog ( HWND hwnd, char *stringId );
1.1.1.4 root 255: void OpenVolumeExplorerWindow (int driveNo);
256: static BOOL CALLBACK CloseVolumeExplorerWindowsEnum( HWND hwnd, LPARAM driveNo);
257: BOOL CloseVolumeExplorerWindows (HWND hwnd, int driveNo);
258: BOOL CheckCapsLock (HWND hwnd, BOOL quiet);
1.1.1.10 root 259: BOOL CheckFileExtension (char *fileName);
1.1.1.4 root 260: int GetFirstAvailableDrive ();
261: int GetLastAvailableDrive ();
262: BOOL IsDriveAvailable (int driveNo);
1.1.1.10 root 263: BOOL IsDeviceMounted (char *deviceName);
1.1.1.4 root 264: int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced);
1.1.1.5 root 265: void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap);
1.1.1.6 root 266: 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 267: BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount);
268: BOOL IsPasswordCacheEmpty (void);
269: BOOL IsMountedVolume (char *volname);
1.1.1.11 root 270: int GetMountedVolumeDriveNo (char *volname);
1.1.1.4 root 271: BOOL IsAdmin (void);
1.1.1.10 root 272: BOOL IsUacSupported ();
1.1.1.4 root 273: BOOL ResolveSymbolicLink (PWSTR symLinkName, PWSTR targetName);
274: int GetDiskDeviceDriveLetter (PWSTR deviceName);
1.1.1.10 root 275: HANDLE DismountDrive (char *devName);
1.1.1.12 root 276: BOOL FileExists (const char *filePathPtr);
277: __int64 FindStringInFile (char *filePath, char* str, int strLen);
1.1.1.5 root 278: BOOL TCCopyFile (char *sourceFileName, char *destinationFile);
1.1.1.12 root 279: BOOL SaveBufferToFile (char *inputBuffer, char *destinationFile, DWORD inputLength, BOOL bAppend);
280: BOOL PrintHardCopyTextUTF16 (wchar_t *text, char *title, int byteLen);
1.1.1.6 root 281: int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolume);
282: int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume);
283: void GetSpeedString (unsigned __int64 speed, wchar_t *str);
1.1.1.5 root 284: BOOL IsNonInstallMode ();
1.1.1.6 root 285: BOOL DriverUnload ();
286: LRESULT SetCheckBox (HWND hwndDlg, int dlgItem, BOOL state);
287: BOOL GetCheckBox (HWND hwndDlg, int dlgItem);
1.1.1.12 root 288: void ManageStartupSeq (void);
1.1.1.6 root 289: void CleanLastVisitedMRU (void);
1.1.1.10 root 290: void ClearHistory (HWND hwndDlgItem);
1.1.1.6 root 291: LRESULT ListItemAdd (HWND list, int index, char *string);
292: LRESULT ListItemAddW (HWND list, int index, wchar_t *string);
293: LRESULT ListSubItemSet (HWND list, int index, int subIndex, char *string);
294: LRESULT ListSubItemSetW (HWND list, int index, int subIndex, wchar_t *string);
295: BOOL GetMountList (MOUNT_LIST_STRUCT *list);
296: int GetDriverRefCount ();
297: void GetSizeString (unsigned __int64 size, wchar_t *str);
1.1.1.12 root 298: __int64 GetFileSize64 (char *path);
299: BOOL LoadInt16 (char *filePath, int *result, __int64 fileOffset);
300: BOOL LoadInt32 (char *filePath, unsigned __int32 *result, __int64 fileOffset);
1.1.1.6 root 301: char *LoadFile (char *fileName, DWORD *size);
1.1.1.12 root 302: char *LoadFileBlock (char *fileName, __int64 fileOffset, int count);
1.1.1.10 root 303: char *GetModPath (char *path, int maxSize);
1.1.1.6 root 304: char *GetConfigPath (char *fileName);
1.1.1.12 root 305: char GetSystemDriveLetter (void);
1.1.1.6 root 306: void OpenPageHelp (HWND hwndDlg, int nPage);
307: int Info (char *stringId);
308: int Warning (char *stringId);
309: int Error (char *stringId);
310: int AskYesNo (char *stringId);
311: int AskNoYes (char *stringId);
1.1.1.12 root 312: int AskOkCancel (char *stringId);
1.1.1.6 root 313: int AskWarnYesNo (char *stringId);
314: int AskWarnNoYes (char *stringId);
1.1.1.11 root 315: int AskWarnNoYesString (wchar_t *string);
1.1.1.6 root 316: int AskWarnCancelOk (char *stringId);
1.1.1.12 root 317: int AskErrYesNo (char *stringId);
318: int AskErrNoYes (char *stringId);
1.1.1.10 root 319: int AskMultiChoice (void *strings[]);
1.1.1.6 root 320: BOOL ConfigWriteBegin ();
321: BOOL ConfigWriteEnd ();
322: BOOL ConfigWriteString (char *configKey, char *configValue);
323: BOOL ConfigWriteInt (char *configKey, int configValue);
324: int ConfigReadInt (char *configKey, int defaultValue);
325: char *ConfigReadString (char *configKey, char *defaultValue, char *str, int maxLen);
326: void RestoreDefaultKeyFilesParam (void);
327: BOOL LoadDefaultKeyFilesParam (void);
328: void Debug (char *format, ...);
329: void DebugMsgBox (char *format, ...);
330: BOOL Is64BitOs ();
1.1.1.10 root 331: void Applink (char *dest, BOOL bSendOS, char *extraOutput);
1.1.1.6 root 332: char *RelativePath2Absolute (char *szFileName);
333: void CheckSystemAutoMount ();
334: BOOL CALLBACK CloseTCWindowsEnum( HWND hwnd, LPARAM lParam);
1.1.1.7 root 335: BOOL CALLBACK FindTCWindowEnum (HWND hwnd, LPARAM lParam);
1.1.1.6 root 336: BYTE *MapResource (char *resourceType, int resourceId, PDWORD size);
1.1.1.12 root 337: void InconsistencyResolved (char *msg);
1.1.1.8 root 338: BOOL SelectMultipleFiles (HWND hwndDlg, char *stringId, char *lpszFileName, BOOL keepHistory);
339: BOOL SelectMultipleFilesNext (char *lpszFileName);
1.1.1.9 root 340: void OpenOnlineHelp ();
1.1.1.10 root 341: BOOL GetPartitionInfo (char *deviceName, PPARTITION_INFORMATION rpartInfo);
342: BOOL GetDriveGeometry (char *deviceName, PDISK_GEOMETRY diskGeometry);
343: BOOL IsVolumeDeviceHosted (char *lpszDiskFile);
1.1.1.11 root 344: int CompensateXDPI (int val);
345: int CompensateYDPI (int val);
346: int CompensateDPIFont (int val);
1.1.1.10 root 347: int GetTextGfxWidth (HWND hwndDlgItem, wchar_t *text, HFONT hFont);
348: int GetTextGfxHeight (HWND hwndDlgItem, wchar_t *text, HFONT hFont);
349: BOOL ToHyperlink (HWND hwndDlg, UINT ctrlId);
1.1.1.12 root 350: void ToBootPwdField (HWND hwndDlg, UINT ctrlId);
1.1.1.11 root 351: void AccommodateTextField (HWND hwndDlg, UINT ctrlId, BOOL bFirstUpdate);
1.1.1.10 root 352: BOOL GetDriveLabel (int driveNo, wchar_t *label, int labelSize);
1.1.1.13 root 353: BOOL DoDriverInstall (HWND hwndDlg);
1.1.1.10 root 354:
355: #ifdef __cplusplus
356: }
1.1.1.12 root 357: #endif
358:
359: #endif // TC_HEADER_DLGCODE
360:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.