Archive: About firstheader error


About firstheader error
typedef struct
{
int flags; // FH_FLAGS_*
int siginfo; // FH_SIG

int nsinst[3]; // FH_INT1,FH_INT2,FH_INT3

// these point to the header+sections+entries+stringtable in the datablock
int length_of_header;

// this specifies the length of all the data (including the firstheader and CRC)
int length_of_all_following_data;
} firstheader;

Look at this struct,the firstheader->length_of_all_following_data's value is the length of data.Suppose headerPosition's value is the offset that firstheader in the file and filesize's value is the installer file's size, usually we can get "filesize - headerPosition >= firstheader->length_of_all_following_data".In fact,more often like this "filesize - headerPosition = firstheader->length_of_all_following_data".But I get some installer is not like this,"filesize - headerPosition < firstheader->length_of_all_following_data",when this condition occur,we can't extract files us 7z.exe.

1.Who can give me a *.nsi file which can generate a installer and the installer generate condition like "filesize - headerPosition < firstheader->length_of_all_following_data" ?

2.Why this condition(filesize - headerPosition > firstheader->length_of_all_following_data) can occur? If it's a error or someone change the installer data when this condition occur?

3.If the installer does not check this condition?Even if this condition occur,the installer can work correct?

4.When I extract file from installer,if I can ignore this condition?In fact I can extract some file use 7z.exe when I ignore this condition(7z.exe will return S_FALSE when "filesize - headerPosition < firstheader->length_of_all_following_data",yes,it's abort).


Maybe it's a defected installer or it's somehow modified. In exehead\fileform.c line 223 you can see this condition is verified. So if the installer works, it's probably based on modified source code.


Thank you very much.

You hints the installers("filesize - headerPosition < firstheader->length_of_all_following_data") are error or use the modify source code to generated.

Thanks again for your reply.I think I'll ignore this condition("filesize - headerPosition < firstheader->length_of_all_following_data") in order to get more extract ratio.