Differences From Artifact [4a1f472039c28674]:
- File
LzhTool.cpp
- 2011-02-23 13:30:53 - part of checkin [5128eecc9f] on branch trunk - Copied from private svn repository. (user: kinaba) [annotate]
To Artifact [867fcb36cfe598b8]:
- File
LzhTool.cpp
- 2017-05-30 13:07:57 - part of checkin [36ad977839] on branch trunk - 1.22: Enlarged the header search range (for SFX skip) for new UNLHA. (user: kinaba) [annotate]
10 10
11 bool CLzhTool::Extract( const char* aname, const char* dll, kiPath& dll_rel_path 11 bool CLzhTool::Extract( const char* aname, const char* dll, kiPath& dll_rel_path
12 { 12 {
13 // 先頭の方を読み込み 13 // 先頭の方を読み込み
14 FILE* fp = fopen( aname,"rb" ); 14 FILE* fp = fopen( aname,"rb" );
15 if( !fp ) 15 if( !fp )
16 return false; 16 return false;
> 17 const int maxHeaderOffset = 1<<20; // 1MB
17 unsigned char* buff = new unsigned char[65536]; | 18 unsigned char* buff = new unsigned char[maxHeaderOffset];
18 DWORD siz = fread( buff, 1, 65536, fp ); | 19 DWORD siz = fread( buff, 1, maxHeaderOffset, fp );
19 fclose( fp ); 20 fclose( fp );
20 // ヘッダを探す 21 // ヘッダを探す
21 int ps = FindHeader( aname,buff,siz ); 22 int ps = FindHeader( aname,buff,siz );
22 // 書庫を開く 23 // 書庫を開く
23 if( ps==-1 || !(lzh = fopen( aname,"rb" )) ) 24 if( ps==-1 || !(lzh = fopen( aname,"rb" )) )
24 { 25 {
25 delete [] buff; 26 delete [] buff;