maxton/LibOrbisPkg

2 errors regarding open package file.

alpakeno opened this issue · 2 comments

When I tried to open some files using PkgEditor, I got these error.

After some digging, I found what causes it:

First error shows "Access to the path "....." is denied."
Caused when open a ReadOnly pkg file.

Second error shows "Error loading outer PFS: Access to the path is denied"
Caused when the fake pkg file size is missing some bytes at the end of the pkg.
also this one will not list Files, instead it will show "The package passcod is required...."

For the first issue, that's because I was not explicitly using read-only mode when mapping the file. It should be fixed now.

For the second issue, I'm not sure how to deal with that, as the PKG is technically corrupt if you are missing bytes.

Thanks for the quick fix :)

Yes, you are right, but at least it should partially open it, so I tried to debug the second issue and it happens in PkgView.cs line 48:

        using (var s = pkgFile.CreateViewStream((long)pkg.Header.pfs_image_offset, (long)pkg.Header.pfs_image_size, MemoryMappedFileAccess.Read))
          ObjectPreview(PfsHeader.ReadFromStream(s), pfsHeaderTreeView);

It gives this error: "System.UnauthorizedAccessException: 'Access to the path is denied.'"

If there is nothing to be done about it, then you can close this issue.