TrueCrypt加密:TrueCrypt Mount加载加密卷(2)

1.TrueCrypt Mount加载加密卷
首先需要选择我们在上一步创建的加密卷,选择一个需要加载的分区,这其实就是在还没用到的分区卷标里选择一个,之后点击载入载入即可,这个时候就会找到加密卷进行加载,这时会需要用户输入创建加密卷时的设定的密码,加载成功后,就能看到新虚拟出来的磁盘了。

TrueCrypt项目中TCFormatVolume具体参数:

int MountVolume
(HWND hwndDlg,
 int driveNo, 
 char *volumePath,
 Password *password, 
 BOOL cachePassword,
 BOOL sharedAccess, 
 const MountOptions* const mountOptions, 
 BOOL quiet,
 BOOL bReportWrongPassword);
 参数 类型 含义 示例
 hwndDlg HWND 传入的窗口句柄 NULL
 driveNo int 加载的磁盘分区序号 8
 volumePath char * 用户选择的加密卷文件 C://1.txt
 password Password 用户输入的密码 123456
 cachePassword BOOL 是否采用缓存密码 FALSE
 sharedAccess BOOL  FALSE
 mountOptions MountOptions 加载选项 
 quiet BOOL  FALSE
 bReportWrongPassword BOOL 是否报告错误的密码 TRUE

2.实际调用

extern "C" __declspec(dllexport) int MountVolumeC(char *fileUrl,char *szPassword,int driveNo){
    DriverAttach();

    /*char * fileUrl = "C:\\Users\\Administrator\\Pictures\\新建文本文档.txt"; 
    char * szPassword = "123";*/
    Password VolumePassword;
    strcpy((char *)VolumePassword.Text,szPassword);
    VolumePassword.Length = strlen((char *)VolumePassword.Text);
    MountOptions mountOptions;  

    mountOptions.PreserveTimestamp = 1;  
    strcpy((char *)mountOptions.ProtectedHidVolPassword.Text, "");  
    mountOptions.ProtectedHidVolPassword.Length = 0;  
    mountOptions.ProtectHiddenVolume = 0;  
    mountOptions.ReadOnly = 0;  
    mountOptions.Removable = 0;  
    mountOptions.PartitionInInactiveSysEncScope = 0;  
    mountOptions.UseBackupHeader = 0;  
    mountOptions.RecoveryMode = 0;

    int i = MountVolume(NULL,driveNo,fileUrl,&VolumePassword,false,false,&mountOptions,false,true);
    return i;
};
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值