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