资源简介
C# 能调用的6个重要功能 1. 创建加密卷 2. 加载加密卷 3. 卸载加密卷 4. 修改密码 5. 加载驱动 6. 安装驱动
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading;
using Microsoft.Win32;
using System.IO;
using System.ServiceProcess;
namespace TestForms
{
public class TrueCryptHelpt
{
[DllImport(“TrueCryptFormat.dll“ EntryPoint = “FormatVolumeC“ CharSet = CharSet.Ansi CallingConvention = CallingConvention.Cdecl)]
private extern static int FormatVolumeC(string fileUrlstring pwdint size);
[DllImport(“TrueCrypt.dll“ EntryPoint = “MountVolumeC“ CharSet = CharSet.Ansi CallingConvention = CallingConvention.Cdecl)]
private extern static int MountVolumeC(string fileUrlstring pwdint 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 = CallingConvention.Cdecl)]
private extern static bool DriverInstallC();
public static int Format(string fileUrlstring pwdint size)
{
return FormatVolumeC(fileUrlpwdsize);
}
public static int Mount(string fileUrl string pwd int driveNo)
{
return MountVolumeC(fileUrlpwddriveNo);
}
public static int Unmount(int driveNo)
{
return UnmountVolumeC(driveNo);
}
public static int ChangePwd(string szFile string szoldPassword string sznewPassword IntPtr intPtr)
{
return ChangePasswordC(szFile szoldPassword sznewPassword intPtr);
}
public static int StartDrvice()
{
return DriverLoadC();
}
public static bool InstallDrvice()
{
return DriverInstallC();
}
public static bool CheckRegedit()
{
string isUrl = @“SYSTEM\CurrentControlSet\Services“;
string itemName = “truecrypt“;
RegistryKey subKey = Registry.LocalMachine.OpenSubKey(isUrl);
string[] keyNames = subKey.GetSubKeyNames();
subKey.Close();
bool result = false;
foreach (var keyName in keyNames)
{
if (itemName.Equals(keyName))
{
result = true;
break;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 8448 2018-02-23 11:33 TrueCryptHelpt.cs
文件 2522624 2018-02-07 15:40 TrueCryptFormat.dll
文件 231376 2018-02-08 15:16 truecrypt-x64.sys
文件 231376 2018-02-08 15:01 truecrypt.sys
文件 2485248 2018-02-07 16:51 TrueCrypt.dll
评论
共有 条评论