I was trying to run Visual Basic 4 (16-bit) in Windows 3.1 running within DosBox. However it failed to launch with error:
SHARE.exe must be installed in order to run Visual Basic
Some old MS-DOS applications just check for existence of the EXE and it's presence in autoexec.bat, but in this case the EXE exists, but the error still occurs.
Running on Windows 7 32-bit and using a debugger attached to NTVDM.exe I found the following process is used:
- A Temp file is created with GetTempFilename
- Call to LockFile API
- Call to UnlockFile API
When I set a breakpoint at return of LockFile API and faked a faliure (returned false) On Windows 7 I got the same error message "SHARE.exe must be installed in order to run Visual Basic"
However within the VB.exe I can't find any reference to LOCKFILE API, so I suspect NTVDM.exe is translating it somehow.
The APIs that seem potentially related in the import table of VB.exe are:
- Kernel!OPENFILE
- Kernel!_LWRITE
- Kernel!_LREAD
- Kernel!_LOPEN
- Kernel!_LLSEEK
- Kernel!_LCREAT
- Kernel!_LCLOSE
- OLE2!OLELOCKRUNNING
- Kernel!LOCKRESOURCE
- Kernel!LOCKSEGMENT
I am trying to work out how the lock / unlock file test is done so I can try to remediate within DosBox and create my own test program to replicate in C or VB.