otya128 / winevdm

16-bit Windows (Windows 1.x, 2.x, 3.0, 3.1, etc.) on 64-bit Windows
GNU General Public License v2.0
2.69k stars 154 forks source link

SEGV when loading Microsoft Network DLL (netapi) #1424

Closed jgdrg closed 4 months ago

jgdrg commented 4 months ago

Try the latest version first. Go here and click Environment: THIS_BUILD_IS_RECOMMENDED__VCXPROJ_BUILD=1-> Artifacts 1-> zip to download the latest version.

Describe the bug When using a legacy third-party Windows 3.1 application, we found it was crashing when starting. After investigation it was found that the crash was occurring when netapi.dll was being loaded by the application.

Expected behavior Application doesn't not crash when loading netapi.dll

Screenshots SEGV message with test app. image Working on XP image

Environment (please complete the following information):

Additional context To replicate the issue more easily. I created a simple test application that loads the offending DLL. Testapp.zip contains the test binary, source (for ref) and netapi DLL. Copy into a folder and launch with Winedebug C:\Testapp>otvdm.exe testapp.exe

Testapp.zip

It is very helpful to provide a trace file if possible. Please note that this file contains detailed information about the program.

  1. Upload trace.txt here. winedebug.log
cracyc commented 4 months ago

That netapi.dll tries to talk to a dos driver which doesn't work under winevdm. I think that a replacement netapi.dll would be needed that calls win32 apis directly. Unfortunately, upstream wine doesn't have one.

jgdrg commented 4 months ago

Thanks for your response. As the application only calls one netapi function, I made a replacement netapi dll that calls the required win32 netapi functions, with some help from the Microsoft LAN manager programmer's reference (1990) . This seems to have sorted the issue.

cracyc commented 4 months ago

Any chance you can share it?

jgdrg commented 4 months ago

I can, but beware its not my best work. How do you want me to share it?

cracyc commented 4 months ago

However you want. Making a pr would be best although it's not my decision about accepting it. It's useful in my opinion to have a working starting point for other programs which use netapi.

jgdrg commented 4 months ago

See https://github.com/otya128/winevdm/pull/1428