|
|
1.1.1.6 ! root 1: /* Legal Notice: The source code contained in this file has been derived from ! 2: the source code of Encryption for the Masses 2.02a, which is Copyright (c) ! 3: 1998-99 Paul Le Roux and which is covered by the 'License Agreement for ! 4: Encryption for the Masses'. Modifications and additions to that source code ! 5: contained in this file are Copyright (c) 2004-2005 TrueCrypt Foundation and ! 6: Copyright (c) 2004 TrueCrypt Team, and are covered by TrueCrypt License 2.0 ! 7: the full text of which is contained in the file License.txt included in ! 8: TrueCrypt binary and source code distribution archives. */ ! 9: ! 10: #include "Common.h" ! 11: #include "Apidrvr.h" ! 12: #include "Keyfiles.h" ! 13: ! 14: /* IDs for dynamically generated GUI elements */ ! 15: #define IDPM_CHECK_FILESYS 500001 ! 16: #define IDPM_REPAIR_FILESYS 500002 ! 17: #define IDPM_OPEN_VOLUME 500003 ! 18: #define IDM_SHOW_HIDE 500004 1.1.1.5 root 19: 1.1.1.4 root 20: #define IDC_ABOUT 0x7fff /* ID for AboutBox on system menu in wm_user range */ 21: 1.1.1.5 root 22: #define UNMOUNT_MAX_AUTO_RETRIES 5 23: #define UNMOUNT_AUTO_RETRY_DELAY 50 1.1 root 24: 1.1.1.6 ! root 25: #define FILE_DEFAULT_KEYFILES "Default Keyfiles.xml" ! 26: 1.1 root 27: extern char szHelpFile[TC_MAX_PATH]; 1.1.1.6 ! root 28: extern char szHelpFile2[TC_MAX_PATH]; ! 29: extern HFONT hFixedDigitFont; 1.1 root 30: extern HFONT hBoldFont; 31: extern HFONT hTitleFont; 32: extern HFONT hFixedFont; 33: extern HFONT hUserFont; 34: extern HFONT hUserUnderlineFont; 35: extern HFONT hUserBoldFont; 1.1.1.6 ! root 36: extern HWND MainDlg; ! 37: extern BOOL Silent; ! 38: extern BOOL bPreserveTimestamp; ! 39: extern wchar_t *lpszTitle; 1.1 root 40: extern int nCurrentOS; 41: extern int CurrentOSMajor; 42: extern int CurrentOSMinor; 43: extern HANDLE hDriver; 44: extern HINSTANCE hInst; 45: 1.1.1.6 ! root 46: extern BOOL KeyFilesEnable; ! 47: extern KeyFile *FirstKeyFile; ! 48: extern KeyFilesDlgParam defaultKeyFilesParam; ! 49: ! 50: enum ! 51: { ! 52: WIN_UNKNOWN = 0, ! 53: WIN_31, ! 54: WIN_95, ! 55: WIN_98, ! 56: WIN_ME, ! 57: WIN_NT3, ! 58: WIN_NT4, ! 59: WIN_2000, ! 60: WIN_XP, ! 61: WIN_XP64_OR_2003, ! 62: WIN_VISTA, ! 63: WIN_AFTER_VISTA ! 64: }; 1.1 root 65: 66: #define ICON_HAND MB_ICONHAND 67: #define YES_NO MB_YESNO 68: 69: #ifdef _UNICODE 70: #define WINMAIN wWinMain 71: #else 72: #define WINMAIN WinMain 73: #endif 74: 1.1.1.6 ! root 75: #define FILE_CONFIGURATION "Configuration.xml" ! 76: 1.1 root 77: void cleanup ( void ); 78: void LowerCaseCopy ( char *lpszDest , char *lpszSource ); 79: void UpperCaseCopy ( char *lpszDest , char *lpszSource ); 80: void CreateFullVolumePath ( char *lpszDiskFile , char *lpszFileName , BOOL *bDevice ); 81: int FakeDosNameForDevice ( char *lpszDiskFile , char *lpszDosDevice , char *lpszCFDevice , BOOL bNameOnly ); 82: int RemoveFakeDosName ( char *lpszDiskFile , char *lpszDosDevice ); 1.1.1.6 ! root 83: void AbortProcess ( char *stringId ); 1.1.1.4 root 84: void AbortProcessSilent ( void ); 1.1 root 85: void *err_malloc ( size_t size ); 86: char *err_strdup ( char *lpszText ); 1.1.1.4 root 87: DWORD handleWin32Error ( HWND hwndDlg ); 1.1.1.6 ! root 88: BOOL translateWin32Error ( wchar_t *lpszMsgBuf , int nSizeOfBuf ); 1.1 root 89: BOOL WINAPI AboutDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam ); 90: BOOL IsButtonChecked ( HWND hButton ); 91: void CheckButton ( HWND hButton ); 92: void ToSBCS ( LPWSTR lpszText ); 93: void ToUNICODE ( char *lpszText ); 94: void InitDialog ( HWND hwndDlg ); 95: HDC CreateMemBitmap ( HINSTANCE hInstance , HWND hwnd , char *resource ); 96: void PaintBitmap ( HDC pdcMem , int x , int y , int nWidth , int nHeight , HDC hDC ); 1.1.1.6 ! root 97: LRESULT CALLBACK RedTick ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam ); ! 98: BOOL RegisterRedTick ( HINSTANCE hInstance ); ! 99: BOOL UnregisterRedTick ( HINSTANCE hInstance ); 1.1 root 100: LRESULT CALLBACK SplashDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam ); 101: void WaitCursor ( void ); 102: void NormalCursor ( void ); 103: void ArrowWaitCursor ( void ); 1.1.1.6 ! root 104: void AddComboPair (HWND hComboBox, char *lpszItem, int value); ! 105: void AddComboPairW (HWND hComboBox, wchar_t *lpszItem, int value); ! 106: void SelectAlgo ( HWND hComboBox , int *nCipher ); 1.1 root 107: LRESULT CALLBACK CustomDlgProc ( HWND hwnd , UINT uMsg , WPARAM wParam , LPARAM lParam ); 108: void InitApp ( HINSTANCE hInstance ); 1.1.1.6 ! root 109: void InitHelpFileName (void); 1.1 root 110: BOOL OpenDevice ( char *lpszPath , OPEN_TEST_STRUCT *driver ); 111: int GetAvailableFixedDisks ( HWND hComboBox , char *lpszRootPath ); 112: int GetAvailableRemovables ( HWND hComboBox , char *lpszRootPath ); 113: BOOL WINAPI RawDevicesDlgProc ( HWND hwndDlg , UINT msg , WPARAM wParam , LPARAM lParam ); 1.1.1.6 ! root 114: BOOL WINAPI LegalNoticesDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); ! 115: char * GetLegalNotices (); 1.1.1.4 root 116: BOOL WINAPI BenchmarkDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); 1.1.1.6 ! root 117: BOOL WINAPI KeyfileGeneratorDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); 1.1 root 118: int DriverAttach ( void ); 1.1.1.4 root 119: BOOL SeekHiddenVolHeader (HFILE dev, unsigned __int64 volSize, BOOL deviceFlag); 1.1.1.6 ! root 120: BOOL CALLBACK CipherTestDialogProc ( HWND hwndDlg , UINT uMsg , WPARAM wParam , LPARAM lParam ); ! 121: void ResetCipherTest ( HWND hwndDlg , int idTestCipher ); ! 122: BOOL BrowseFiles ( HWND hwndDlg , char *stringId , char *lpszFileName, BOOL keepHistory ); ! 123: BOOL BrowseDirectories (HWND hWnd, char *lpszTitle, char *dirName); 1.1 root 124: void handleError ( HWND hwndDlg , int code ); 1.1.1.6 ! root 125: void LocalizeDialog ( HWND hwnd, char *stringId ); 1.1.1.4 root 126: void OpenVolumeExplorerWindow (int driveNo); 127: static BOOL CALLBACK CloseVolumeExplorerWindowsEnum( HWND hwnd, LPARAM driveNo); 128: BOOL CloseVolumeExplorerWindows (HWND hwnd, int driveNo); 129: BOOL CheckCapsLock (HWND hwnd, BOOL quiet); 130: int GetFirstAvailableDrive (); 131: int GetLastAvailableDrive (); 132: BOOL IsDriveAvailable (int driveNo); 133: int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced); 1.1.1.5 root 134: void BroadcastDeviceChange (WPARAM message, int nDosDriveNo, DWORD driveMap); 1.1.1.6 ! root 135: 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 136: BOOL UnmountVolume (HWND hwndDlg , int nDosDriveNo, BOOL forceUnmount); 137: BOOL IsPasswordCacheEmpty (void); 138: BOOL IsMountedVolume (char *volname); 139: BOOL IsAdmin (void); 140: BOOL ResolveSymbolicLink (PWSTR symLinkName, PWSTR targetName); 141: int GetDiskDeviceDriveLetter (PWSTR deviceName); 142: HANDLE DismountDrive (int driveNo); 1.1.1.5 root 143: BOOL TCCopyFile (char *sourceFileName, char *destinationFile); 1.1.1.6 ! root 144: int BackupVolumeHeader (HWND hwndDlg, BOOL bRequireConfirmation, char *lpszVolume); ! 145: int RestoreVolumeHeader (HWND hwndDlg, char *lpszVolume); ! 146: void GetSpeedString (unsigned __int64 speed, wchar_t *str); 1.1.1.5 root 147: BOOL IsNonInstallMode (); 1.1.1.6 ! root 148: BOOL DriverUnload (); ! 149: LRESULT SetCheckBox (HWND hwndDlg, int dlgItem, BOOL state); ! 150: BOOL GetCheckBox (HWND hwndDlg, int dlgItem); ! 151: void CleanLastVisitedMRU (void); ! 152: LRESULT ListItemAdd (HWND list, int index, char *string); ! 153: LRESULT ListItemAddW (HWND list, int index, wchar_t *string); ! 154: LRESULT ListSubItemSet (HWND list, int index, int subIndex, char *string); ! 155: LRESULT ListSubItemSetW (HWND list, int index, int subIndex, wchar_t *string); ! 156: BOOL GetMountList (MOUNT_LIST_STRUCT *list); ! 157: int GetDriverRefCount (); ! 158: void GetSizeString (unsigned __int64 size, wchar_t *str); ! 159: char *LoadFile (char *fileName, DWORD *size); ! 160: char *GetConfigPath (char *fileName); ! 161: void OpenPageHelp (HWND hwndDlg, int nPage); ! 162: int Info (char *stringId); ! 163: int Warning (char *stringId); ! 164: int Error (char *stringId); ! 165: int AskYesNo (char *stringId); ! 166: int AskNoYes (char *stringId); ! 167: int AskWarnYesNo (char *stringId); ! 168: int AskWarnNoYes (char *stringId); ! 169: int AskWarnCancelOk (char *stringId); ! 170: BOOL ConfigWriteBegin (); ! 171: BOOL ConfigWriteEnd (); ! 172: BOOL ConfigWriteString (char *configKey, char *configValue); ! 173: BOOL ConfigWriteInt (char *configKey, int configValue); ! 174: int ConfigReadInt (char *configKey, int defaultValue); ! 175: char *ConfigReadString (char *configKey, char *defaultValue, char *str, int maxLen); ! 176: void RestoreDefaultKeyFilesParam (void); ! 177: BOOL LoadDefaultKeyFilesParam (void); ! 178: void Debug (char *format, ...); ! 179: void DebugMsgBox (char *format, ...); ! 180: BOOL Is64BitOs (); ! 181: char *RelativePath2Absolute (char *szFileName); ! 182: void CheckSystemAutoMount (); ! 183: BOOL CALLBACK CloseTCWindowsEnum( HWND hwnd, LPARAM lParam); ! 184: BYTE *MapResource (char *resourceType, int resourceId, PDWORD size);
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.