From: Chris Shearer Cooper on
I am trying to debug a third-party library that is parsing an enhanced
metafile (EMF) and processing the commands listed therein. On XP
everything is fine, but I'm seeing some strange behavior when running
the exact same code on Windows Server 2003 and 2008.

The EMF starts by setting the mapping mode to MM_ISOTROPIC and then
sets the window origin to (0,0), the viewport origin to (48,48)
(that's correct, it's giving it a little margin in the output), and
the window and viewport extents to (96,96). The library then calls
GetWorldTransform() and uses the transform in its processing.

By the way, in all cases, the DC mode is set to GM_COMPATIBLE. The
Microsoft documentation is pretty clear about what happens if you call
SetWorldTransform while the DC is in GM_COMPATIBLE mode, but doesn't
say what GetWorldTransform() thinks.

So on XP, the transform is what you would expect, [1.0000, 0.0000,
0.0000, 1.0000, 48.0000, 48.0000] or if you prefer the array format
| 1.0 0.0 0 |
| 0.0 1.0 0 |
| 48 48 1 |

On Server 2003 and 2008, the transform is instead [0.9375, 0.0000,
0.0000, 1.0000, 48.0000, 48.0000] which makes no sense to me at all,
and is really screwing things up because everything is shrunk in one
direction.

One thing I tried, in the code that generates the EMF, is to set the
DC mode to GM_ADVANCED and then call SetWorldTransform() with a nice
identity transformation, and then reset the DC mode back to
GM_COMPATIBLE before creating the rest of the EMF. When I look in the
EMF, I see the EMR_SETWORLDTRANSFORM record followed by an
EMR_MODIFYWORLDTRANSFORM record (weird, I didn't call that function)
but since the DC is GM_COMPATIBLE, both of those records are ignored.
Apparently there isn't an EMR_SETGRAPHICSMODE record.

Are there known GDI differences between XP and Server 2003/2008?
Any other ideas how to solve this?

Thanks,
Chris