Re: Microsoft's obfuscated typedefs considered harmful
Earnie Boyd <[email protected]> Tue, 28 May 2013 08:10:27 -0400
| Newsgroups | gmane.comp.gnu.mingw.devel |
|---|---|
| Message-ID | <CA+sc5mncvhkXviEMdRz0MCEbUScAbG_JoQOe=jkvMWzyjE3nSw@mail.gmail.com> |
On Tue, May 28, 2013 at 6:49 AM, Keith Marshall wrote: > > However, a more serious issue arose at runtime; the use of 'LONG' to > specify the type of the 'e_lfanew' field in the 'IMAGE_DOS_HEADER' > struct; since 'LONG' is > > typedef long LONG > > and 'long' is 64 bits on my 64-bit Debian box, the compiler interpreted > this as a 64-bit 'e_lfanew' field, (which is wrong -- it *must* be an > *explicit* 32-bit field), and the application blew up with a segment > violation fault at runtime, as soon as it tried to parse the DLL image > content, as referenced by the improperly sized e_lfanew offset value. > But why did your compiler DTWT? I am assuming you're using a cross compiler targeting MinGW? If so, then long should be 32 bits. > In summary: I'm not suggesting that we drop support for these Microsoft > obfuscated typedefs; rather, we have an opportunity to engineer them > better, (perhaps even better than Microsoft do themselves), and that we > should maybe consider doing so. I don't disagree with the idea, I'm hesitant because I fear that the community expects them to be defined as they are by MS. -- Earnie -- https://sites.google.com/site/earnieboyd ------------------------------------------------------------------------------ Try New Relic Now & We'll Send You this Cool Shirt New Relic is the only SaaS-based application performance monitoring service that delivers powerful full stack analytics. Optimize and monitor your browser, app, & servers with just a few lines of code. Try New Relic and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may