Code Monkey home page Code Monkey logo

Comments (6)

 avatar commented on July 25, 2024

errno = 22 = EINVAL so whence (SEEK_END) is invalid according to the doc.

The code works on Linux last time I checked but I don't have a Mac to test it on but they both should support the same API.

Could you test replacing https://github.com/0xd4d/dnlib/blob/master/src/IO/MemoryMappedFileStreamCreator.cs#L119

with

off_t size = new off_t(new FileInfo(creator.theFileName).Length);

from dnlib.

swellfr avatar swellfr commented on July 25, 2024

Thanks for your quick response,

After replacing I have this exception:

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at dnlib.IO.UnmanagedMemoryImageStream.ReadUInt16 () [0x00000] in <filename unknown>:0 
  at dnlib.PE.ImageDosHeader..ctor (IImageStream reader, Boolean verify) [0x00000] in <filename unknown>:0 
  at dnlib.PE.PEInfo..ctor (IImageStream reader, Boolean verify) [0x00000] in <filename unknown>:0 
  at dnlib.PE.PEImage..ctor (IImageStreamCreator imageStreamCreator, ImageLayout imageLayout, Boolean verify) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at dnlib.IO.UnmanagedMemoryImageStream.ReadUInt16 () [0x00000] in <filename unknown>:0 
  at dnlib.PE.ImageDosHeader..ctor (IImageStream reader, Boolean verify) [0x00000] in <filename unknown>:0 
  at dnlib.PE.PEInfo..ctor (IImageStream reader, Boolean verify) [0x00000] in <filename unknown>:0 
  at dnlib.PE.PEImage..ctor (IImageStreamCreator imageStreamCreator, ImageLayout imageLayout, Boolean verify) [0x00000] in <filename unknown>:0 

from dnlib.

 avatar commented on July 25, 2024

Seems like mmap on Mac returns 0 on error. Linux returns -1. Since I don't have a Mac, I can't even try to figure out why lseek and mmap doesn't work as expected.

from dnlib.

 avatar commented on July 25, 2024

Try this commit: 8775c00

mmap'd IO gets disabled if those funcs fail.

from dnlib.

 avatar commented on July 25, 2024

BTW, if you manage to figure out why those funcs fail on MacOSX, let me know (or add a pull request).

from dnlib.

swellfr avatar swellfr commented on July 25, 2024

Thanks 0xd4d, dnlib is not throwing anymore.

I will investigate this issue and let you!

from dnlib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.