需要下载的DLL和驱动
介于公司项目为C#项目进行的加密开发,用前几张文章所学到的TrueCrypt项目开启4个重要的入口点:
- 创建加密卷
- 加载加密卷
- 卸载加密卷
- 修改密码
- 加载驱动
- 安装驱动
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.ServiceProcess;
using System.Text;
namespace ICT.NetHandleLibrary
{
public class TrueCryptHelper
{
Logger<TrueCryptHelper> log = new Logger<TrueCryptHelper>();
[DllImport("TrueCryptFormat.dll", EntryPoint = "FormatVolumeC", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
private extern static int FormatVolumeC(string fileUrl, string pwd, Int64 size);
[DllImport("TrueCrypt.dll", EntryPoint = "MountVolumeC", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
private extern static int MountVolumeC(string fileUrl, string pwd, int driveNo);
[DllImport("TrueCrypt.dll", EntryPoint = "UnmountVolumeC", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
private extern static int UnmountVolumeC(int driveNo);
[DllImport("TrueCrypt.dll", EntryPoint = "ChangePasswordC", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
private extern static int ChangePasswordC(string szFile, string szoldPassword, string sznewPassowrd, IntPtr hwndDlg);
[DllImport("TrueCrypt.dll", EntryPoint = "DriverLoadC", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
private extern static int DriverLoadC();
[DllImport("TrueCrypt.dll", EntryPoint = "DriverInstallC", CharSet = CharSet.Ansi, CallingConvention = Cal