向当前打开的文件中按文件类型,从指定位置写入数据。

参数
[in] hcontexthandle
一个已经成功打开的设备的句柄。
[in] uloffset
所要写入数据的起始位置。
[in] puchin
要写入的数据。
[in] uldatalen
要写入的数据长度。
[out] pulwritelen
实际写入的数据长度。
[in] ulflag
参数,其定义如下
esf_write_binary:向二进制文件中写入数据,此时accessmode中只有m_uloffset有效,表示要写入数据相对于文件头的偏移。
esf_write_symmetrykey:向对称密钥文件中写入密钥。
esf_write_md5hmac_key:向md5 hmac文件中写入密钥值。
要求
esfp_openfile
返回值
esf_success:成功
esf_rv_eeprom_error:读写存储区错误
esf_rv_not_find_file_error:文件或目录未找到
esf_rv_ac_error:安全状态不满足
其它:见“api返回码说明”。
示例代码
esf_handle hcontexthandle = null;
esf_rv irv;
unsigned char uchbuf[400];
unsigned long ullen = 0;
//向文件中写入密钥
memset(uchbuf, 0xb, 16);
irv = esfp_writefile(hcontexthandle, 0, uchbuf, 16, &ullen, esf_write_md5hmac_key);
if(irv != esf_rv_success)
参见
esfp_openfile, esfp_getfileinfo, esfp_readfile