Turns out .NET will insert empty bytes in any "managed" structure at its own leisure (read: at random)and if you want it out in a fixed position, you need to go through these interop thingies.
It's actually not at random - it's to get the individual entries in the structure to line up on a particular Word or Byte boundary. This happened a lot in the old Win16 days, and the way to get around it is to define your structure in decreasing byte size.. QuadWord (64bit) values first, then DoubleWord (32bit) values next (includes pointers), then Word (16bit) values, and lastly, fixed-length strings and variable-length strings.
Things have changed a bit with .NET (of course!), especially the strings - they would be lumped in with the DoubleWord values, as they are now objects in their own right. But the same technique has value in (a) reducing the memory impact of structures, and (b) preventing wasted bytes from being inserted to get the values lined up on the correct Word/Byte boundaries.
Chip H.
If you want to get the best response to a question, please check out FAQ222-2244 first