dotnet / pinvoke

A library containing all P/Invoke code so you don't have to import it every time. Maintained and updated to support the latest Windows OS.
MIT License
2.12k stars 222 forks source link

LOADED_IMAGE is not marshaled correctly #398

Closed AntonLapounov closed 4 years ago

AntonLapounov commented 6 years ago

https://github.com/AArnott/pinvoke/blob/918b9e4cabcb29f151c79aae20233eeb5bd61bef/src/DbgHelp/DbgHelp%2BLOADED_IMAGE.cs#L65-L79

The fields fSystemImage, fDOSImage, and fReadOnly must be marshaled as 1-byte BOOLEAN values; please use UnmanagedType.U1 for them. At present they are marshaled as 4-byte BOOL values (UnmanagedType.Bool), which corrupts data in the LOADED_IMAGE structure. In addition, it would be better to change the type of the SizeOfImage field to uint.

AArnott commented 4 years ago

Thanks for your report, @AntonLapounov