Author Topic: Old VB6 software can't find its libraries.. I think...  (Read 2425 times)

0 Members and 1 Guest are viewing this topic.

Offline PhaseseekerTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: it
Old VB6 software can't find its libraries.. I think...
« on: February 28, 2025, 07:01:34 pm »
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
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 2686
  • Country: au
    • Halestrom
Re: Old VB6 software can't find its libraries.. I think...
« Reply #1 on: February 28, 2025, 09:18:26 pm »
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.
 

Offline PhaseseekerTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: it
Re: Old VB6 software can't find its libraries.. I think...
« Reply #2 on: February 28, 2025, 09:33:32 pm »
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...
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 2686
  • Country: au
    • Halestrom
Re: Old VB6 software can't find its libraries.. I think...
« Reply #3 on: February 28, 2025, 10:32:03 pm »
Hmm.  Have you considered changing the OS language?  I've read stories about weird windows dll interface bugs that are language-dependent.
 

Offline mwb1100

  • Frequent Contributor
  • **
  • Posts: 729
  • Country: us
Re: Old VB6 software can't find its libraries.. I think...
« Reply #4 on: March 01, 2025, 12:22:59 am »
What Windows version are you running?

If lptclassex.dll has been registered but it still can't load that might be because a DLL that it depends on is missing.  You might be able to find out with something like Dependency 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 called OLE/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.
 

Offline PhaseseekerTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: it
Re: Old VB6 software can't find its libraries.. I think...
« Reply #5 on: March 01, 2025, 09:49:26 am »
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.
 
The following users thanked this post: Whales

Offline Whales

  • Super Contributor
  • ***
  • Posts: 2686
  • Country: au
    • Halestrom
Re: Old VB6 software can't find its libraries.. I think...
« Reply #6 on: March 01, 2025, 10:40:49 am »
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: [Select]
    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: [Select]
Public Function CE() As Boolean
BADDLL$ = "LptClass2"
LPT.Pin(3) = 1
CE = (LPT.Pin(15) = 0)
BADDLL$ = ""
End Function

Soo 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: [Select]
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.
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 2686
  • Country: au
    • Halestrom
Re: Old VB6 software can't find its libraries.. I think...
« Reply #7 on: March 01, 2025, 10:46:51 am »
A machine-translation (sorry) of the comment at the top of that file:
Quote
' This Class allows you to use through the NINOUT32 library
' The parallel port at any address it is located.
' Some special routines have been inserted to use
' also an output data stream at a certain speed and a system
' compatible with the most common SIPO and PISO to increase the inputs
' and outputs of the port.

Looks like NINOUT32 is from here:

https://web.archive.org/web/20111110081712/http://www.visual-basic.it/articoli/agvbhw3.htm

That 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?
 

Offline PhaseseekerTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: it
Re: Old VB6 software can't find its libraries.. I think...
« Reply #8 on: March 01, 2025, 12:51:49 pm »
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
 

Offline mwb1100

  • Frequent Contributor
  • **
  • Posts: 729
  • Country: us
Re: Old VB6 software can't find its libraries.. I think...
« Reply #9 on: March 02, 2025, 01:46:34 am »
Looks like NINOUT32 is from here:

https://web.archive.org/web/20111110081712/http://www.visual-basic.it/articoli/agvbhw3.htm

That 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?

At 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 @Whales is right about the actual LPT port being needed (as well as the driver on NT-based systems).
 

Offline PhaseseekerTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: it
Re: Old VB6 software can't find its libraries.. I think...
« Reply #10 on: March 05, 2025, 11:16:22 am »
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 instruction
Code: [Select]
ReDim ExtToken(15)Now, ExtToken is defined in VBP.bas as
Code: [Select]
Public Type ExtToken
    Ver     As Byte
    Use     As Boolean
    Parity  As Boolean
    NParity As Boolean
    Codid   As Integer
    Alfa(255) As Integer
    Nome As String * 16
    Padding As String * 16
    End Type
And in 32Bin.bas as
Code: [Select]
Global ExtToken() As New STMVBP.ExToken
Now, 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...
 

Offline Whales

  • Super Contributor
  • ***
  • Posts: 2686
  • Country: au
    • Halestrom
Re: Old VB6 software can't find its libraries.. I think...
« Reply #11 on: March 06, 2025, 05:36:09 am »
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.
 

Offline PhaseseekerTopic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: it
Re: Old VB6 software can't find its libraries.. I think...
« Reply #12 on: March 12, 2025, 05:26:51 pm »
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.
 
The following users thanked this post: Whales


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf