Send data to parallel port

Hi,
I need to send data to the parallel port in a game for windows 32 and 64 bits.
I am working in a Windows 10 64 bits and using Unity 5.5.2f1 free.

Following some messages I found in this forum, I:

  • download InpOutBinaries_1501 (inpOut32 and inpOutx64.dll) from http://www.highrez.co.uk/downloads/inpout32/

  • in wXP 32 bits run the InstallDLL inside de x32 directory, and the message was “ok, loaded”,
    in W10 64 bits copied x32 dll to windows\sysWOW64 and x64 dll to windows\system32 (it is strange, but it is on File System Redirector - Win32 apps | Microsoft Learn) and run regsvr32 as administrator on each directory, but I received the message "
    was loaded but the entry-point DllRegisterServer was not found".

  • copied inpout32.dll and inpoutx64.dll to assets/plugins/x86 and x86_64 respectively;
    on Inspector associated the plataform settings for each one (x86 and x86_64 respectively)

  • copied too to project root directory

  • made a test program in my environment (W10 64bits):
    […]
    [DllImport(“inpout32”)]
    private static extern UInt32 IsInpOutDriverOpen();
    [DllImport(“inpout32”)]
    private static extern void Out32(short PortAddress, short Data);
    [DllImport(“inpout32”)]
    private static extern char Inp32(short PortAddress);
    [DllImport(“inpoutx64”, EntryPoint = “IsInpOutDriverOpen”)]
    private static extern UInt32 IsInpOutDriverOpen_x64();

[DllImport(“inpoutx64”, EntryPoint = “Out32”)]
private static extern void Out32_x64(short PortAddress, short Data);

[DllImport(“inpoutx64”, EntryPoint = “Inp32”)]
private static extern char Inp32_x64(short PortAddress);
void Start ()
{
definePortAccess(0x378);

Debug.Log (“inpOut imprimir 1”);
Write (1);
Debug.Log ("status LPT: " + Read ());

Debug.Log (“inpOut imprimir 2”);
Write (2);
Debug.Log ("status LPT: " + Read ());
}

[…]
private bool _X64;
private short _PortAddress;
public void definePortAccess(short PortAddress)
{
_X64 = false;
_PortAddress = PortAddress;

uint nResult = 0;
if (SystemInfo.operatingSystem.Contains(“64”)) {
nResult = IsInpOutDriverOpen_x64();
_X64 = true;
}
else {
nResult = IsInpOutDriverOpen();
_X64 = false;
}

if (nResult == 0) {
throw new ArgumentException(“Unable to open inpOut32 or inpOutx64 DLL”);
}
}

public void Write(short Data)
{
if (_X64) {
Out32_x64(_PortAddress, Data);
}
else {
Out32(_PortAddress, Data);
}
}

public byte Read()
{
if (_X64) {
return (byte)Inp32_x64(_PortAddress);
}
else {
return (byte)Inp32(_PortAddress);
}
}

When I run in editor, IsInpOutDriverOpen_x64() returns true (1), even considering that my machine do not have a parallel port or a “NET USE LPT1” command associated.

When I run a buil for Windows 32 bits and execute, copying inpOut32.dll for project_Data\Managed, Plugins and Mono
I can read in the output.log:

  • inputout32.dll do not appear in the loading DLL’s list
  • “failed to load OVRPlugin.dll”
  • “failed to load Mono\inpoutx64.dll, expected x86 architecture, but was x64”
  • and return status as the same data sended.

When I run a build for Windows x64 and execute, the output.log shows the inverse:

  • Fallback handler could not load library Mono\inpout32
  • idem to libinpout32
  • and return status 255

What I am doing wrong?
Thanks for every piece of advice or idea to send to parallel port.

Hi @josiperez , have you had any luck on making it work? I am trying to to do the same in Unity 2017.

Replacing every [DllImport(“inpout32”)] with [DllImport(“inpout32.dll”)]
and [DllImport(“inpoutx64”, …] with [DllImport(“inpoutx64.dll”, …] fixed the incorrect architecture problem for me.
I’m using a x64 laptop.

Have you had any luck ? As Most of the post are older…