码迷,mamicode.com
首页 > 其他好文 > 详细

ePass.CreateFile

时间:2014-07-31 13:00:36      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   java   io   cti   代码   ar   

javascript和vbscript中没有结构体Struct,ePass的ActiveX对象中把各个参数都展开了,官方文档只给出了对应的代码,没有给出相应的数字,示例代码中却都是数字,其VC代码中有对应的定义,如下

ePass.CreateFile(IFlags, ulID, ulFileSize, ucFileType, ucReadAccess, ucWriteAccess, ucCryptAccess, ucGrantedAccess);

 

////
/// EPAS_FILEINFO structure definition
//
typedef struct tagFILEINFO
{
unsigned long ulID; //File ID.
unsigned long ulFlags; //Reserved.MUST be zero
unsigned long ulFileSize;
unsigned char ucFileType;
unsigned char ucReadAccess;
unsigned char ucWriteAccess;
unsigned char ucCryptAccess;
unsigned char ucReserved1[12];
unsigned char ucGrantedAccess;
unsigned char ucReserved2[15];
}EPAS_FILEINFO, *PEPAS_FILEINFO;

/////
//// FILEINFO.FileType
/// File type definition
//
#define EPAS_FILETYPE_UNUSED 0x00
#define EPAS_FILETYPE_DIR 0x01
#define EPAS_FILETYPE_DATA 0x02
#define EPAS_FILETYPE_KEY 0x04
#define EPAS_FILETYPE_UNKNOWN 0xFF

/////
//// FILEINFO.ReadAccess,FILEINFO.WriteAccess,FILEINFO.CryptAccess
/// File access types
//
#define EPAS_ACCESS_ANYONE 0x00
#define EPAS_ACCESS_USER 0x01
#define EPAS_ACCESS_OFFICER 0x02
#define EPAS_ACCESS_NONE 0x07

////
/// FILEINFO.GrantedAccess
//
#define EPAS_ACCESS_READ 0x01
#define EPAS_ACCESS_WRITE 0x02
#define EPAS_ACCESS_CRYPT 0x04

 

javascript也可以用这种方式将对象解释为结构:

var FileType = {
            EPAS_FILETYPE_UNUSED: 0,
            EPAS_FILETYPE_DIR: 1,
            EPAS_FILETYPE_DATA: 2,
            EPAS_FILETYPE_KEY: 4,
            EPAS_FILETYPE_UNKNOWN: 0xFF
        };

        /////
        //// FILEINFO.ReadAccess,FILEINFO.WriteAccess,FILEINFO.CryptAccess
        /// File access types
        //
        var FileAccess = {
            EPAS_ACCESS_ANYONE: 0x00,
            EPAS_ACCESS_USER: 0x01,
            EPAS_ACCESS_OFFICER: 0x02,
            EPAS_ACCESS_NONE: 0x07
        }

        var GrantedAccess = {
            EPAS_ACCESS_READ: 0x01,
            EPAS_ACCESS_WRITE: 0x02,
            EPAS_ACCESS_CRYPT: 0x04
        }
这样调用:
ePass.CreateFile(0, 1, 16, FileType.EPAS_FILETYPE_KEY, FileAccess.EPAS_ACCESS_ANYONE, FileAccess.EPAS_ACCESS_ANYONE, FileAccess.EPAS_ACCESS_ANYONE, FileAccess.EPAS_ACCESS_ANYONE);

 

ePass.CreateFile,布布扣,bubuko.com

ePass.CreateFile

标签:style   blog   color   java   io   cti   代码   ar   

原文地址:http://www.cnblogs.com/Sabre/p/3880382.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!