Old VB6 software can't find its libraries.. I think... - Page 1
Forum section: electronics / general

author: Phaseseeker
author_rank: Regular Contributor
timestamp: February 28, 2025, 07:01:34 pm
content: I'm trying to use some old VB6 software (of which unfortunately only one copy survives, and it's broken), which promptly crashes after startup complaining about not being able to load some ActiveX control.I know next to nothing about VB6, but to me it sounds like it's missing some sort of library. Now, my question(s) are:1) I have the source (complete with the source for said DLL AFAIK, see the attached archive), but it's missing its .vbp Visual Studio project file, so I can't rebuild it. Is there any way I'm missing to load the thing in Visual Studio anyway?2) I found a LptClass2.lib file, which should be a library object file. Can I somehow produce a DLL or something out of this so that the SW can load it at runtime?3) Again, not familiar with VB6 and not being able to find much info online: is there anyway to attach a debugger to the running software to se where it's getting stuck?Thanks in advance

author: Whales
author_rank: Super Contributor
timestamp: February 28, 2025, 09:18:26 pm
content: Looks like it needs NINOUT32.dll and LPTCLASSEX.dll, do you have those in your system32 directory?If you have an old computer that this software used to work on then that would be a good place to collect these files from. Also it would tell you what version of windows to use (in a VM) to begin with, before trying to move to newer versions.

author: Phaseseeker
author_rank: Regular Contributor
timestamp: February 28, 2025, 09:33:32 pm
content: I registered ninout32.dll and lptclassex.dll using regsvr32.About the Windows version, the software Is from 2006, so I think It was made for XP, but I tried both XP, 2000 and 98 without success. Unfortunately I don't have the computer this run, in fact I suspect It probably ever worked on the developer's PC that had the right library...

author: Whales
author_rank: Super Contributor
timestamp: February 28, 2025, 10:32:03 pm
content: Hmm. Have you considered changing the OS language? I've read stories about weird windows dll interface bugs that are language-dependent.

author: mwb1100
author_rank: Frequent Contributor
timestamp: March 01, 2025, 12:22:59 am
content: What Windows version are you running?If lptclassex.dll has been registered but it still can't load that might be because a DLL thatitdepends on is missing. You might be able to find out with something likeDependency Walker, but I don't know how well it still works (it hasn't been updated since 2006! and I haven't used it for at least 5 years, probably more). I'm nearly certain it won't work on Win10+. Might work on Win7.A couple projects that are supposed to duplicate Dependency Walker (I have not tried either):-https://github.com/hfiref0x/WinDepends(activity as recent as today!)-https://github.com/lucasg/Dependencies(last activity about 4 years ago)I also recall a COM utility calledOLE/COM Object Viewer (oleview.exe)that might be helpful to track down COM object problems (if you can find it and if it works). It's supposed to be in the Windows SDK. There are multiple projects on github that claim to reproduce its functionality.

author: Phaseseeker
author_rank: Regular Contributor
timestamp: March 01, 2025, 09:49:26 am
content: Regarding Windows versions: currently running most tests on W2K in English, but I've also tried 9x, XP with no success. Doesn't work in Italian (which is the language this was developed on) either.@mwb1100: Dependency Walker only finds about the VB6 runtime in the dependency list unfortunately. oleview.exe does show LptClassEx as registered (see attachment) so no luck there either.

author: Whales
author_rank: Super Contributor
timestamp: March 01, 2025, 10:40:49 am
content: I'm a fool, you provided the full source, we don't have to dig at guesses. I can work backwards from the text in the error dialog box you posted a screenshot of.I started by searching for "Controllare la registrazione", that takes me to a subroutine called RTE1 in STMMain.bas. This subroutine is called when an error exception gets thrown. This line of code controls the text shown in the error dialog:Code:MsgBox Err.Source + ":" + vbCrLf + Err.Description + vbCrLf + "DllError: " + CStr(Err.LastDllError) + vbCrLf + "Numero: " + CStr(Err.Number) + vbCrLf + "Componente:" + BADDLL$ + vbCrLf + "Controllare la registrazione dei componenti di Magneto sui files OCX e DLL", vbExclamation, "Attenzione"The "Componente:x" string is set by the var BADDLL. In your screenshot it's "Componente:LptClass2".There is only one place in the entire codebase where BADDLL gets set to LptClass2. DLLLetttore.frm:Code:Public Function CE() As BooleanBADDLL$ = "LptClass2"LPT.Pin(3) = 1CE = (LPT.Pin(15) = 0)BADDLL$ = ""End FunctionSoo this means an exception is being thrown between the first BADDLL$ and second BADDLL$ lines.I think the file LPT.cls is the source for the LPT class. There are only 3 exception throw lines in there:Code:If N < 1 Or N > 17 Then Err.Raise 5, "LPTClass", "Pin " + CStr(N) + " not connected!"...Err.Raise 5, "LPTClass", "The pin " + CStr(N) + " is for input only"...If Mips = 0 Then Err.Raise 5, "LPTClass", "Stream not initialized"So to understand your problem you need to focus on the LPT.cls file. Read that, try and understand what it's doing.I have a sneaking suspicion that it's for talking over a parallel (LPT) port. Maybe this software will work if you add an old-fashioned LPT printer to your system? You should be able to add one without it being connected, but I'm not sure.Regardless, read that file, see if you can work out what it's trying to do.

author: Whales
author_rank: Super Contributor
timestamp: March 01, 2025, 10:46:51 am
content: A machine-translation (sorry) of the comment at the top of that file:QuoteLooks like NINOUT32 is from here:https://web.archive.org/web/20111110081712/http://www.visual-basic.it/articoli/agvbhw3.htmThat page reinforces my belief that it wants an LPT port on an old motherboard. Not sure if setting it up as a printer or not will help. Perhaps simply running this code on a computer with a parallel port might fix up the issue?

author: Phaseseeker
author_rank: Regular Contributor
timestamp: March 01, 2025, 12:51:49 pm
content: First of all, thanks for going through the effort of going through the source code... I can't imagine having all the comments in Italian helps...Anyway, the software can indeed interface to a parallel port; however, I tried simulating a parallel port through QEMU and it doesn't seem to change anything. If only I could attach a debugger to this to find out what exception it's actually throwing, that'd be helpful. Also, searching through the files, the only place where "LptClass2" is mentioned is in DLLLettore.frm as you said.Also, the frustrating thing is that I don't even need the LPT functionality of this software to work (it's only used for interfacing with some external devices I don't have anyway) so I'd happily rip it out of the code but again, either the source is missing some files or I just can't understand how to make the VB6 IDE compile the code

author: mwb1100
author_rank: Frequent Contributor
timestamp: March 02, 2025, 01:46:34 am
content: Quote from: Whales on March 01, 2025, 10:46:51 amAt the very least it requires a device driver (INOUT32D.SYS ) to be installed on Win2k/XP. I don't see that driver in the zip archive.However not having that driver shouldn't pose a problem on Win9x according to the article, so I suspect that@Whalesis right about the actual LPT port being needed (as well as the driver on NT-based systems).

author: Phaseseeker
author_rank: Regular Contributor
timestamp: March 05, 2025, 11:16:22 am
content: So, I've done some more testing using VMWare, which lets me simulate a parallel port (unfortunately I have no working motherboard with a parallel port on hand), and there's no difference. INOUT32.sys is installed and registered, and the install script for the software does indeed install the driver on the system.Also, I've discovered that manually adding the .bas and .frm files into a VB6 project I can kind of get the thing to compile the software, however now it's complaining about "name is not unique" on the instructionCode:ReDim ExtToken(15)Now, ExtToken is defined in VBP.bas asCode:Public Type ExtTokenVer As ByteUse As BooleanParity As BooleanNParity As BooleanCodid As IntegerAlfa(255) As IntegerNome As String * 16Padding As String * 16End TypeAnd in 32Bin.bas asCode:Global ExtToken() As New STMVBP.ExTokenNow, I kind of get why it is complaining, but I'm not sure how to get around this, especially since this should be the source the sw was compiled from...

author: Whales
author_rank: Super Contributor
timestamp: March 06, 2025, 05:36:09 am
content: Could you accidentally have the same source files included in the project twice? Or included in places it shouldn't be or an order that it shouldn't' be? Not too familiar with the VB6 compiler, sorry.

author: Phaseseeker
author_rank: Regular Contributor
timestamp: March 12, 2025, 05:26:51 pm
content: In the end I managed to get an older, incomplete version of the software to run by copying the older executable to the newer version's folder, which is a bit of a hack, but at least it's running now. As for the older one, it's very likely it could be made to run if I figured out how the VB6 IDE/compiler handles the source files, but so far I haven't been able to get anything useful out of it (meaningful error messages much?)Anyway, thanks to both of you for your help.