Panzer general 2 on Ubuntu Hardy with Wine

Here is a list of things I had to do to try to get Panzer general 2 working with wine 0.9.59 on Ubuntu Hardy. However, in the end I could not get it to work and was told that this game has the same problems on Windows XP.

My last hope is to install Windows 98/95 in a virtual machine, but I think I might just have to mark this game as a victim of time.

If you find a solution or have anything else to add, feel free to comment on this post.

First of, to get the game to install with Wine, I needed to change the min_mmap_addr value of the kernel. This should solve the following error message:

preloader: Warning: failed to reserve range 00000000-60000000
err:dosmem:setup_dos_mem Cannot use first megabyte for DOS address space,
please report

The min_mmap_addr variable is describes as follows in the kernel documentation:

mmap_min_addr

This file indicates the amount of address space  which a user process will
be restricted from mmaping.  Since kernel null dereference bugs could
accidentally operate based on the information in the first couple of pages
of memory userspace processes should not be allowed to write to them.  By
default this value is set to 0 and no protections will be enforced by the
security module.  Setting this value to something like 64k will allow the
vast majority of applications to work correctly and provide defense in depth
against future potential kernel bugs.

So, having anything above 0 is a security feature. Not something you want to turn off by default (as some of the people on the internet are suggesting) but with a trusted program we can turn it of till the next boot. I found how to do this in the Wine Wiki:
sudo sysctl -w vm.mmap_min_addr=0

Now run the installer from the CD again, and everything should install correctly. Using the default directory, the game should just install in your local wine drive_c directory. You can find this by going to ~/.wine/drive_c/. I choose to allow it to install DirectX 5, but I'm not sure whether this is needed or not.

You can now run the game from by browsing the Wine menu (below Applications) or just start it from the console with wine ~/.wine/drive_c/panzer2/PANZER2.EXE. In game, there is a problem with drawing the game map. As soon as you start a scenario, everything but the main window will be written to, so the menus work but the most important part of the game doesn't show itself.

These are the errors on the console:

err:ntlm:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path.
err:ntlm:SECUR32_initNTLMSP Usually, you can find it in the winbind package of your distribution.
fixme:win:EnumDisplayDevicesW ((null),0,0x32f850,0x00000000), stub!
fixme:xrandr:X11DRV_XRandR_SetCurrentMode Cannot change screen BPP from 32 to 8
fixme:d3d:IWineD3DDeviceImpl_Release (0x138858) Device released with resources still bound, acceptable but unexpected
fixme:d3d:dumpResources Leftover resource 0x13ef20 with type 1,WINED3DRTYPE_SURFACE

The first error can just be fixed by installing winbind, as the error suggested: sudo aptitude install winbind. This does not solve the drawing problem.

If first thought it might be a problem with the color depth, but running a nested X server with lower color valus, like this:

sudo aptitude install Xephyr
Xephyr :1 -ac -screen 640x480x8

Adn then running the game from another terminal:
DISPLAY=:1 wine ~/.wine/drive_c/panzer2/PANZER2.EXE

will just make the game look really ugly and leave the main problem of drawing the main field of the game.