// initialize all static entries public TrueCryptSWObj(ProgramData thisProg) { tCryptRegEntry = (string)Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TrueCryptVolume\Shell\open\command", "", ""); if (tCryptRegEntry != null) { tcProgramFQN = tCryptRegEntry.Substring(1, tCryptRegEntry.Length - 10); //registry entry has a leading quote that needs to go tcProgramDirectory = tcProgramFQN.Substring(0, tcProgramFQN.Length - 14); if (!File.Exists(tcProgramFQN)) { MessageBox.Show("Windows has registry entries for the TrueCrypt Program but no program exists. Please reinstall", thisProg.mbCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); } if (thisProg.removable == true && string.Compare(FileVersionInfo.GetVersionInfo(tcProgramFQN).FileVersion, tcSetupVersion) < 0) { // we have host version that needs upgrading MessageBox.Show("The TrueCrypt software version on this Flash Drive will not work with the version of TrueCrypt on this host system. The Tax-Aide TrueCrypt Utility will be started so that the Host's TrueCrypt can be upgraded. Then restart this Start Tax-Aide drive program", thisProg.mbCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); try { Process proc = Process.Start(thisProg.drvLetter + ":\\" + travDir + TAtcSetupProgramName); Environment.Exit(1); } catch (Exception e) { MessageBox.Show("Exception on starting Tax-Aide TrueCrypt Utility\r\n" + e.ToString(), thisProg.mbCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { if (thisProg.removable == true) { tcProgramFQN = thisProg.drvLetter + ":\\" + travDir + tcProgramName; tcProgramDirectory = thisProg.drvLetter + ":\\" + travDir; if (!File.Exists(tcProgramFQN)) { MessageBox.Show("The TrueCrypt Program does not exist on the Traveler drive. Please reinistall" + "\r" + tcProgramFQN, thisProg.mbCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); } } else { MessageBox.Show("The TrueCrypt program does not exist. Please run the Tax-Aide TrueCrypt Installer", thisProg.mbCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); } } if (thisProg.removable == true) { string tempFolder = Environment.GetEnvironmentVariable("temp"); File.Copy(thisProg.scriptExePath + stopTravDrv, tempFolder + stopTravDrv, true); File.Copy(thisProg.scriptExePath + "\\decryption.ico", tempFolder + "\\decryption.ico", true); ShellLink desktopShortcut = new ShellLink(); desktopShortcut.ShortCutFile = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Stop Traveler.lnk"; desktopShortcut.Target = tempFolder + stopTravDrv; desktopShortcut.IconPath = tempFolder + "\\" + "decryption.ico"; desktopShortcut.Save(); desktopShortcut.Dispose(); } }
private void CopyTAFilesFromThisAssembly(string destDir) { //CopyFileFromThisAssembly("decryption.ico", destDir); //CopyFileFromThisAssembly("encryption.ico", destDir); progOverall.Invoke(progUpdateLin2, new object[] { "Start Tax-Aide Drive Script Copying" }); CopyFileFromThisAssembly("Start_Tax-Aide_Drive.exe", destDir); progOverall.Invoke(progUpdateLin2, new object[] { "Tax-Aide Scripts Copying" }); CopyFileFromThisAssembly("Stop_Tax-Aide_Drive.exe", destDir); System.Reflection.Assembly assem = System.Reflection.Assembly.GetExecutingAssembly(); // to copy this file to folder string thisProgFilePath = assem.Location; File.Copy(thisProgFilePath, destDir + "\\" + programName, true); if (GetTasksHI.travUSBDrv.Exists(delegate(DrvInfo s) { return s.drvName.Equals(destDir.Substring(0, 2).ToUpper()); })) //tests whether this is a usb connected drive { Log.WritWTime("Copying unique traveler files from Assembly to Drive"); CopyFileFromThisAssembly("autorun.inf", destDir.Substring(0, 3)); CopyFileFromThisAssembly("Start Traveler.exe", destDir.Substring(0, 3)); } else { ShellLink desktopShortcut = new ShellLink(); desktopShortcut.ShortCutFile = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Start Tax-Aide Drive.lnk"; desktopShortcut.Target = destDir + "\\" + "Start_Tax-Aide_Drive.exe"; desktopShortcut.IconPath = destDir + "\\" + "Start_Tax-Aide_Drive.exe"; desktopShortcut.Save(); desktopShortcut.Dispose(); ShellLink desktopShortcut1 = new ShellLink(); desktopShortcut1.ShortCutFile = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\Stop Tax-Aide Drive.lnk"; desktopShortcut1.Target = destDir + "\\" + "Stop_Tax-Aide_Drive.exe"; desktopShortcut1.IconPath = destDir + "\\" + "Stop_Tax-Aide_Drive.exe"; desktopShortcut1.Save(); desktopShortcut1.Dispose(); } progOverall.Invoke(progUpdateLin2, new object[] { "Tax-Aide Scripts Copying" }); progOverall.Invoke(progUpdateLin2notVis); }