working under Wine (Ver 1.62). I've started the Tutorial at the following URL:
http://forums.debian.net/viewtopic.php?f=16&t=135301
I have the software installed and working, but I've been having trouble getting the "io.dll.so" to execute like it has root permissions.
The source for io.dll.so is as follows:
Code: Select all
/*
* io.dll
*
* Generated from io.dll by winedump.
*
* DO NOT SUBMIT GENERATED DLLS FOR INCLUSION INTO WINE!
*
*/
//#include "config.h"
#include <stdarg.h>
#include <sys/io.h>
#include <stdbool.h>
#include "windef.h"
#include "winbase.h"
#include "io_dll.h"
#include "/usr/include/wine-development/debug.h"
// Customize this base address if your PCI parallel port is at a nonstandard address
#define LPT_BASE_ADDR 0x9400
// These are standard defines that shouldn't need to be changed
#define STANDARD_LPT_BASE_ADDR 0x378
#define LPT_BASE_LEN 4
WINE_DEFAULT_DEBUG_CHANNEL(io);
// Keeps track of whether we successfully initialized the driver
static bool initialized = false;
BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{
switch (reason)
{
case DLL_WINE_PREATTACH:
return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
// Get permission to use the parallel port
if (ioperm(LPT_BASE_ADDR, LPT_BASE_LEN, 1) < 0)
{
perror("io permission error for LPTx");
}
else
{
// As long as we got permission, we're good to go.
initialized = true;
}
DisableThreadLibraryCalls(instance);
break;
}
return TRUE;
}
/******************************************************************
* IsDriverInstalled (IO.1)
*
*
*/
int __stdcall IO_IsDriverInstalled(void)
{
return initialized;
}
/******************************************************************
* PortIn (IO.11)
*
*
*/
char __stdcall IO_PortIn(short Port)
{
// If we're initialized and it's in the parallel port I/O range,
// do the read.
if (initialized &&
(Port >= STANDARD_LPT_BASE_ADDR) &&
(Port < STANDARD_LPT_BASE_ADDR + LPT_BASE_LEN))
{
return inb(Port - STANDARD_LPT_BASE_ADDR + LPT_BASE_ADDR);
}
else
{
return 0;
}
}
/******************************************************************
* PortOut (IO.14)
*
*
*/
void __stdcall IO_PortOut(short Port, char Data)
{
// If we're initialized and it's in the parallel port I/O range,
// do the write.
if (initialized &&
(Port >= STANDARD_LPT_BASE_ADDR) &&
(Port < STANDARD_LPT_BASE_ADDR + LPT_BASE_LEN))
{
outb(Data, Port - STANDARD_LPT_BASE_ADDR + LPT_BASE_ADDR);
}
}
Code: Select all
sudo wine pcb60lpt.exe
setuid to allow me to execute the ioperm() function to get the Parallel Port Permissions. I know it has to be run as "root".
Without running as "sudo" or "root" I get an error that the "IO PERMISSIONS ARE INCORRECT" for io.dll.so
My PCI SYBA Parallel Port is located as follows:
Code: Select all
ls -alt /dev/lp* /dev/parp*
I am a member of group lp and more information is in the previous URL for the Tutorial.crw-rw---- 1 root lp 6, 0 Nov 18 00:23 /dev/lp0
crw-rw-r-- 1 root lp 99, 0 Nov 18 00:23 /dev/parport0
I've tried using WINEPATH=/home/larry/Downloads/Willem-Programmer/ver6/PCB6.0LPTsoftware/
That didn't work as the io.dll.so wasn't located, and it was in the same subdirectory.
I've copied io.dll.so to the /usr/lib/i386-linux-gnu/wine/wine/ subdirectory, and it gets executed ONLY if I am root or with sudo.
What do I need to do to be able to execute the io.dll.so as root, but not use the "sudo wine pcb60lpt.exe" command.
Everything I've tried for setuid doesn't appear to work, because I continue to get the error message that the
"IO PERMISSIONS ARE INCORRECT". I've tried almost every possible setuid and it just doesn't execute as root.
Any help would be very much appreciated, so I can continue with the tutorial.
Thanks.
Larry