Page 1 of 1

Steamless under Linux/Mono

Posted: Mon Jun 05, 2017 9:35 am
by kornos
Hello At0m0s

I am trying to port Steamless under Linux/Mono. I am using Mono 5.0.1 (Roslyn compiler).
The (modified) source is compiling, however the program crashes under Mono.
I think it has to do something with the marshalling of the structure when using LayoutKind.Explicit.

I managed to reproduce the problem using this testcase: https://pastebin.com/8uZ1qG42
It compiles fine on win and linux , runs ok on win , but it crashes under linux.

Can you shed some light on this problem? It is a mono bug?
Can I replace Layout.Kind.Explicit with LayoutKind.Sequential,Pack=1 or the alignment will be compromised?

Thanks a lot.

Re: Steamless under Linux/Mono

Posted: Mon Jun 05, 2017 10:00 am
by atom0s
I can't assist with the Mono/Linux aspect of this since I don't use either of them. I do know Mono has its limitations on what it will and wont allow from the normal .NET framework. So this could be a limitation on that regard.

Mono has a page covering interop here:
http://www.mono-project.com/docs/advanced/pinvoke/

It may have something useful in it to determine what kind of bug you may be hitting.

As for changing the layout kind, you could try 'LayoutKind.Sequential, Pack = 1' as it should have a similar result to what the explicit version is doing with the field offsets. Another thing that could be done instead of using the structure is manually reading the information from the data since the offsets are considered 'well-known' and not going to change for Windows PE file format.