Fixed GDI locking in GetDeviceCaps.