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