otya128 / winevdm

16-bit Windows (Windows 1.x, 2.x, 3.0, 3.1, etc.) on 64-bit Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when displaying images, LoadImage16

chross opened this issue · comments

Describe the bug
The software I'm running (genetics pedigree program Cyrillic2) will display images, but upon clicking on the user interface, all images will become blank. Upon clicking on individual images, the LoadImage16 error messages will appear (see log below) and each individual image will be displayed.

5c38:err:winevdm:set_peb_compatible_flag user32.dll has already been loaded. (Anti-virus software may be the cause.)
5c38:err:winevdm:set_peb_compatible_flag Some compatibility flags can not be applied.
version: 2494
5c38:err:winevdm:main Spawn a child process to apply compatible flags.
5c38:err:winevdm:fix_compatible child pid = 22868
45a8:err:winevdm:set_peb_compatible_flag user32.dll has already been loaded. (Anti-virus software may be the cause.)
45a8:err:winevdm:set_peb_compatible_flag Some compatibility flags can not be applied.
version: 2494
45a8:err:winevdm:main parent pid = 13704
1408:err:user:LoadImage16 LoadImageA(0, 12454, 2, 0, 0, 32832)
1408:err:user:LoadImage16 LoadImageA(0, 12454, 2, 0, 0, 32832)
1408:err:user:LoadImage16 LoadImageA(0, 12454, 2, 0, 0, 32832)
1408:err:user:LoadImage16 LoadImageA(0, 12454, 2, 0, 0, 32832)
1408:err:user:LoadImage16 LoadImageA(0, 12454, 2, 0, 0, 32832)

Expected behavior
Display images correctly.

Screenshots
cyrerr
cyrerr_ok

Environment (please complete the following information):

  • OS: Windows 10 Education 19042.2965
  • Version: 2494

Additional context
I did not install otvdm as I am running a single exe file. I start the software with otvdm cyrillic.exe from a batch file.
I have already applied a variety of settings in otvdm.ini, to no avail.

Trace
Note: trace is redacted for personal information
trace.txt

I found a demo of this at https://www.apbenson.com/cyrillic-downloads but I can't reliably repo this problem. It doesn't happen at all when I load the examples and happened only once when creating a new file. I do get the loadimage error but I think it's unrealated. I could be missing something because I don't know how to use this program. I do get a crash at exit every time though.

I'm getting the crash, too, however only when using the demo version.
In the regular software, especially when resizing the window to full screen, the icons will disappear.

cracyc I've shared a repo with you, please have a look.

So far I've found that they disappear if the window is larger than about 2075px width or 915px height. It's likely a bug in the program as very few win16 developers expected to support displays that large. The demo version has the width program but not the height oddly. Print preview doesn't show the icons in either version no matter the size and although printing works (as long as you don't use the adjustdpi option).

The bug triggers as well when having the window resized to smaller dimensions by using the zoom function.
When using this software in a VM on XP I never get those bugs.

It also works in winevdm without the issues in an xp vm but the bug is still in the program itself. Specifially, it uses MM_TWIPS which on large resolution and physical displays can overflow (the vm reports a smaller physical display size which is why it works there.

Sadly, the new gdi.exe didn't help and the problem prevails.
What could be done to make the program run smoothly? Could it somehow be patched?

By the way, i see from the trace that you have a 1920x1080 display but how large is it?

This gdi.exe does still not work. Even if I leave the program window at a normal size (not maximized), when zooming inside the program, the images will disappear at certain zoom levels (too large but also too small).

My PC has three screens attached:
1: middle 19201080 - 100% scaling
2: right 1920
1080 - 100% scaling
3: left 1080*1920 - 100% scaling (numbers inverted as it set up vertically)

I found a fix that works for me that is safer. You can get it to try from https://ci.appveyor.com/project/otya128/winevdm/builds/49450326/job/mqtgdyr60425wo00/artifacts .

Wow! It seems to work flawlessly. How did you do that? What was the reason for this bug, do you care to expain it in a bit more detail?

Thanks anyway. I am very happy and will be testing this build thoroughly.

Well, it uses windows coordinate transformations, https://learn.microsoft.com/en-us/windows/win32/gdi/coordinate-spaces-and-transformations, to simplify zooming but in some cases, mostly with larger physical displays, the output overflows a 16bit int as win32 uses 32bits for the coordinates. In the other gdi.dlls I tried changing the mapping mode to reduce the size of the multiplier but the last change just clamps the output to [-32768, 32767].