So I was looking at the possibility of returning a block of memory to .NET from an assembler DLL (I’m in that kind of mood), and thought about using the GlobalAlloc function, because .NET has the built-in Marshal.AllocHGlobal and Marshal.FreeHGlobal functions that I could then use afterwards. I thought I’d better take a look at the documentation for those just in case there were any pitfalls I ought to know about and guess what? Despite their names, those functions use the LocalAlloc and LocalFree functions instead.
I decided not to do it that way in any case, but come on Microsoft! That’s just stupid!