CnPack Forum


 
Subject: [BUG报告]CnMD5有BUG
hbxfwjww (流星无语)
普通灌水员
Rank: 2



UID 14409
Digest Posts 0
Credits 87
Posts 36
点点分 87
Reading Access 10
Registered 2007-5-18
Status Offline
Post at 2007-5-18 10:07  Profile | Blog | P.M.  | QQ
[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.
我用的是最新版的,小文件测没有问题,请版主检查.
Top
mestars
新警察
Rank: 1



UID 585
Digest Posts 0
Credits 30
Posts 12
点点分 30
Reading Access 10
Registered 2004-11-29
Location 山东青岛
Status Offline
Post at 2007-8-24 11:39  Profile | Blog | P.M.  | QQ
我也发现,校验一个700M的文件会很慢,而且内存占用达到380多M.
Top
croslq
新警察
Rank: 1



UID 1152
Digest Posts 0
Credits 48
Posts 41
点点分 48
Reading Access 10
Registered 2005-10-10
Status Offline
Post at 2007-12-13 15:03  Profile | Site | Blog | P.M.  | QQ
MapViewOfFile 对于内存小的,不能一次性映射,多分多次映射
如一次性映射64M
多映射几次,不然内存小的,肯定都会出问题
Top
croslq
新警察
Rank: 1



UID 1152
Digest Posts 0
Credits 48
Posts 41
点点分 48
Reading Access 10
Registered 2005-10-10
Status Offline
Post at 2007-12-13 15:04  Profile | Site | Blog | P.M.  | QQ
可以参考我的贴子(前面是转贴,后面是我改写的delphi代码)
http://www.delphibbs.com/keylife/iblog_show.asp?xid=23544
Tony 用Windows的文件映射机制, 实现大批量数据的快速存储(转载) (后面附有我改写的delphi版)
Top
 




All times are GMT++8, the time now is 2024-11-24 13:03

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.007942 second(s), 7 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP