Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] - Debian 8.x DLL configuration help request

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
lkraemer
Posts: 209
Joined: 2011-02-09 05:02
Been thanked: 4 times

[SOLVED] - Debian 8.x DLL configuration help request

#1 Post by lkraemer »

I'm using Debian 8.x (32 Bit) and creating a Tutorial on how to get the KEE Willem PCB 6.0E LPT EPROM Programmer
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);
	}
}
It builds properly and the software runs if I start the execution with:

Code: Select all

sudo wine pcb60lpt.exe
But, I know that isn't the correct way to execute the software. I've searched with Google, and read for two days trying to get
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*
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 am a member of group lp and more information is in the previous URL for the Tutorial.

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
Last edited by lkraemer on 2017-11-21 02:19, edited 1 time in total.

lkraemer
Posts: 209
Joined: 2011-02-09 05:02
Been thanked: 4 times

Re: Debian 8.x DLL configuration help request

#2 Post by lkraemer »

Here are two URL's I found that describe what I am trying to do, without much luck.

https://stackoverflow.com/questions/283 ... ed-program
https://www.thegeekdiary.com/what-is-su ... ticky-bit/

My sda drive mount permissions are:
/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
/dev/sda3 on /home type ext4 (rw,relatime,data=ordered)

I finally found this URL in my Google searcing:
https://unix.stackexchange.com/question ... t-properly

It works properly.


Larry

Post Reply