Inpoutx64 and VB.Net 2010

My x64 port of InpOut32
Post Reply
PaulT
New User
Posts: 11
Joined: Thu Mar 10, 2011 9:48 pm

Inpoutx64 and VB.Net 2010

Post by PaulT »

I am trying to access my parallel port (genuine on-board LPT1 at &H378) using Inpoutx64 with VB.Net 2010 on a Windows 7, 64-bit PC. I am getting the following error when I attempt to output data to the port:

"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

I am not sure I have the dll in the correct location - currently trying the bin/debug folder in the VB project. I have tried adding a reference to the dll but that fails. Where am I going wrong?

Thanks.
User avatar
phil
Site Admin
Posts: 7660
Joined: Sun Apr 06, 2003 11:12 pm

Re: Inpoutx64 and VB.Net 2010

Post by phil »

That exception means your trying to use a 64bit dll in a 32bit process or the other way round.

If your in 32bit application you must use the 32bit DLL (inpout32.dll)
If your in 64bit application, you must use the 64bit DLL (inpoutx64.dll)

Visual Studio 2010 by default compiles in 32bit mode. Prior to 2010 the default was "Any CPU" which means if the CPU & OS can run x64, the app will run in x64 mode, otherwise 32bit mode (which made it diffuclt because you never knew at runtime what "bitness" your app would be.

The .NET samples on my website work out, at runtime, which DLL to use - this is the safest thing to do in .NET. The alternate is to specify the bitness (target CPU) in your project settings. As said, the default for VS2010 is 32bit)

EDIT: the dll(s) should be in the same folder as the EXE (or in the system path somewhere).

I hope that helps (and is clear?) :)
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)
PaulT
New User
Posts: 11
Joined: Thu Mar 10, 2011 9:48 pm

Re: Inpoutx64 and VB.Net 2010

Post by PaulT »

Thanks Phil. That was quick. I'll go check that now.

Can you also point me to "The .NET samples on my website".

Many thanks,

Paul.
User avatar
phil
Site Admin
Posts: 7660
Joined: Sun Apr 06, 2003 11:12 pm

Re: Inpoutx64 and VB.Net 2010

Post by phil »

The page is here:
http://www.highrez.co.uk/Downloads/InpOut32/default.htm

The link is labeled .NET 2.0 (2005) Example code.
They should work in VS 2005, 2008 and 2010.

The links to the latest binaries are also on that page. I suggest you use at least v1.2.0.0 because it contains signed drivers (required for windows vista and later).

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)
PaulT
New User
Posts: 11
Joined: Thu Mar 10, 2011 9:48 pm

Re: Inpoutx64 and VB.Net 2010

Post by PaulT »

Thanks Phil. I downloaded your example and after changing the m_bX64 boolean to "true" it runs with no errors but does not seem to write anything to the port. I am checking with a multimeter and I'm 99% sure I have the correct pins ;-)

I'm not missing anything silly am I? Print spooler service doesn't need to be stopped? Does port mode matter? I'm currently using ECP mode as I hope to use some handshaking eventually. The port is a "genuine" on-board parallel port (not a PCI card) and is at the default address of &H378.

Thanks.
User avatar
phil
Site Admin
Posts: 7660
Joined: Sun Apr 06, 2003 11:12 pm

Re: Inpoutx64 and VB.Net 2010

Post by phil »

Urm, not sure why it isnt working - but I thought m_bX64 was set dynamically depending on the runtime environment.

Does the PC speaker example button work (should make a noise)?
NOTE: If the VB example does not have a pc speaker test button, then there is a newer version somewhere (let me know).

The parallel port is more difficult for me to answer because my knowledge there is >10 years old and very rusty. Whats worse, I dont have a parallel port on my board to test it.

If I recall correctly some parallel ports require driver resistors to tie them but usually its to tie them "low" or off so I would expect you to see something with your multimeter. Have you tried all 8 output pins? Is the port in 8bit output mode? I dont know how much ECP/EPP etc makes a difference, but I seem to recall having issues with those modes - I htink you have more work and to mess arround with other regiesters. Its probably worth putting the port in standard mode just to test if it makes any difference)

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)
PaulT
New User
Posts: 11
Joined: Thu Mar 10, 2011 9:48 pm

Re: Inpoutx64 and VB.Net 2010

Post by PaulT »

Thanks Phil. I will work on it some more over the weekend.
sadilza
New User
Posts: 1
Joined: Tue Jan 29, 2013 1:39 pm

Re: Inpoutx64 and VB.Net 2010

Post by sadilza »

Hi,


I build a CM in vb .net that works fine in 'interactive' mode.
When running as service the login failed.

Specific the ValidateUser method. It hangs without an error message.
The service is launched with teh same user when running in interactive mode(also administrator from the pc)


User profiles are NOT activated.

Any ideas ?
User avatar
phil
Site Admin
Posts: 7660
Joined: Sun Apr 06, 2003 11:12 pm

Re: Inpoutx64 and VB.Net 2010

Post by phil »

Sorry but what has this got to do with InpOut32/x64 or this thread??
Please don't hijack threads or forums for that matter.

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