Inpout32.dll port from XP to Win7

My x64 port of InpOut32
Post Reply
retrotecchie
New User
Posts: 1
Joined: Thu Nov 15, 2012 11:40 am

Inpout32.dll port from XP to Win7

Post by retrotecchie »

I'm trying to port an existing legacy VB6 application from an old P4 box to a newer i7 machine.

The old system is running XPSP3 and the new box has Windows 7 32 bit. Having copied my existing code and libraries to the new machine, I just need to open up the VB6 source and change some addresses because the old box had a legacy parallel port at &H378 and the new box has the parallel port on a PCI card. I've not had any problems in the past porting to new hardware, so long as both machines are running 9x, 2k or XP so I know that calling port addresses in the PCI 16 bit address space isn't an issue. Open up old code, change port base address from &h378 to &DF00 or whatever, no problem.

But I'm having a hell of a job running the code on a Win7 32 bit box. Every time I try to access the inpout32.dll in my program, I get an error 47 Bad DLL calling convention. I've installed the full version of VB6 SP6 on the Win 7 box (found the howto on the web) and everything works perfectly. All aspects of my app, the look and feel and everything else works perfectly. Except calling the inpout32.dll. I renamed the file to .bak and the error message changes to 'library not found', so it's not a problem with the path or file location. Rename it back to DLL and I go back to the Bad DLL Calling convention error. Both programs are identical....both sets of declarations are the same and works no problem on the XP box, or any other XP box. Even works ok on Server 2003. But not Windows 7!

I am using the original inpout32.dll from logix4u, and I am wondering if this newer version will solve my problem? I shall try it and see, but was wondering why a call to a DLL from a VB6 app under XP sees the DLL properly and works just fine, but doing exactly the same with the same source, same IDE and same libraries causes this error under Win7. Not tried it under Vista...why would I?!!

Thing is, in a perfect world I would just rewrite the whole package in .NET, but I have three days to do a "1 to 1" port of old software onto a new box andf need a 'quick fix' :twisted:
User avatar
phil
Site Admin
Posts: 7664
Joined: Sun Apr 06, 2003 11:12 pm

Re: Inpout32.dll port from XP to Win7

Post by phil »

There should be no difference in code terms between XP and 7 (32bit).
All I can assume, is that the DLL depends on something that is not there (a MFC dll for example) that was there on Windows XP?

Normally "bad calling convention" would suggest to me that the interface is not the same but you said your using the same DLL. As long as your on 32bit windows 7, then the old Logix4u DLL should be OK. However it might be failing to run because, when you load the DLL, it tries to install the driver (if it not already installed). To do this, your account must have permission to install and driver, and IF you have UAC enabled, you must be running in the elevated security context (run as administrator). So try running your program (or VB6) as administrator and see if it makes any difference.

I try and avoid VB6 these days because there are so many problems. At work we still have some legacy code that has not yet been replaced so I haven't managed to avoid it completely there. I have to confess that installing VB6 on Windows 8 was far from easy/pleasant but I managed to get it to work enough to build my legacy code!!!

I can't remember if "my" port of Inpout32 is statically linked or not (i.e. any runtime dependencies are included in the DLL. That is normally the best thing for little DLL interfaces such as this so it probably is. You should be able to just drop in my DLL over the top of the Logix4u one (for 32bit operation on x86 and x64 editions of windows 7. Obviously VB6 will never be able to call the x64 DLL but that should not matter, my 32bit (x86) dll has both x86 and x64 drivers and chooses the appropriate one to install at runtime.


I'm not so sure about the higher port ranges though. Many PCI cards are not compatible with InpOut32 according to Logix4u and lots of people here (there are some that work though)!

Thanks,
Phil
--[ Phil ]--
--[ Administrator & XMBC Author ]--
Logitech G9/G604/M720/MX518, Microsoft Intellimouse, Trust 16341 BT Mouse
Windows 10 x64, AMD Ryzen 5900x, MSI x570 Tomahawk, 32GB DDR4,
nVidia RTX 2070s, Evo 970 1Tb NVME, 2x2TB WD Black (RAID1)
Post Reply