Subject:
[BUG报告]CnMD5有BUG
[Print This Page]
Author:
hbxfwjww
Time:
2007-5-18 10:07
Subject:
[BUG报告]CnMD5有BUG
CnMD5中计算大文件(我测试的是2G的)MD5的代码有BUG,运行代码至
------------------------------------------------------------------------------------------------------------------------
MD5Init(Context);
FileHandle := CreateFile(pChar(FileName), GENERIC_READ, FILE_SHARE_READ or
FILE_SHARE_WRITE, nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL or
FILE_FLAG_SEQUENTIAL_SCAN, 0);
if FileHandle <> INVALID_HANDLE_VALUE then
try
MapHandle := CreateFileMapping(FileHandle, nil, PAGE_READONLY, 0, 0, nil);
if MapHandle <> 0 then
try
ViewPointer := MapViewOfFile(MapHandle, FILE_MAP_READ, 0, 0, 0);
--------------------------------------------------------------------------------------------------------------------------
此处MapViewOfFile失败,返回为Nil.
我用的是最新版的,小文件测没有问题,请版主检查.
Author:
mestars
Time:
2007-8-24 11:39
我也发现,校验一个700M的文件会很慢,而且内存占用达到380多M.
Author:
croslq
Time:
2007-12-13 15:03
MapViewOfFile 对于内存小的,不能一次性映射,多分多次映射
如一次性映射64M
多映射几次,不然内存小的,肯定都会出问题
Author:
croslq
Time:
2007-12-13 15:04
可以参考我的贴子(前面是转贴,后面是我改写的delphi代码)
http://www.delphibbs.com/keylife/iblog_show.asp?xid=23544
Tony 用Windows的文件映射机制, 实现大批量数据的快速存储(转载) (后面附有我改写的delphi版)
Welcome to CnPack Forum (http://bbs.cnpack.org/)
Powered by Discuz! 5.0.0