PeNet icon indicating copy to clipboard operation
PeNet copied to clipboard

is there a file size limit in penet

Open icbccxy opened this issue 5 months ago • 1 comments

If the file size is greater than 2GB, will PeNet encounter an exception? something like this: `

Unhandled exception. System.IO.IOException: The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size. at System.IO.File.ReadAllBytes(String path) at sample.CFileBasicAttr.CheckFileHeader(String filePath) at sample.CFileBasicAttr.GetFileClass(String filePath) at sample.CPackageFile.IsPackage(String path) at samleupload.SampleUpload.GetTargetFiles(String path, TargetFileType ftype) at samleupload.SampleUpload.Main(String[] args)

`

here is an another piece of code: ` private static FileClass CheckFileHeader(string filePath) {

 // checking an file is pe or not
 PeFile? peFile;
 if (PeFile.TryParse(filePath, out peFile) && peFile != null)
 {
     return FileClass.PE;
 }
...

`

icbccxy avatar Sep 05 '25 07:09 icbccxy

Hi! There is no hardcoded limit. The limitation seems to be from the ReadAllBytes API itself. Have a look at the different methods to load a PE file: https://secana.github.io/PeNet/articles/parseroptions.html

Maybe a stream or memory mapped file is the better option for very large files.

secana avatar Sep 05 '25 08:09 secana