At first you can test if you can do raw I/O operation under your host OS. you can install package `ioport`, then commands like `inb`, `inw`, `outb` and `outw` will be available (requiring `sudo`).
Write a simple program `ioperm` that sets the port access permission bits for the current thread (see `man ioperm`) and then executes the program file given in its parameter within its process (see `man execvp`);
Build the program under your host OS, place it in a location like `/usr/local/bin`, then `sudo setcap cap_sys_rawio=ep ioperm`;
Make sure you have a 32-bit wine prefix (built while `WINEARCH=win32`), and the Windows version is set to Windows 98, then install your program;
Find the location of the menu shortcut file created by Wine during installation of the program, insert `ioperm` before `wine` in the `Exec` parameter string in the menu shortcut file. Note that GUI menu editors like `kmenuedit` may save the modified shortcut under the wrong path (not in `wine` folder), so you have to modify the file by yourself. In my case is located in `~/.local/share/applications/wine/Programs/...`.
Done.
Inspired by: <https://wine-devel.winehq.narkive.com/a ... ns-of-wine>
The program `ioperm` is available here: <https://github.com/alexhenrie/ioperm>, by Alex Henrie. Its usage is just like `sudo`, allowing all I/O ports to be accessed by the program to be executed.
The source code is quite simple (licensed under GPL v2 or later):
```
#include <stdio.h>
#include <sys/io.h>
#include <unistd.h>
int main(int argc, char* argv[])
{
if (ioperm(0, 65536, 1) == -1)
{
perror("ioperm");
return 1;
}
if (execvp(argv[1], argv + 1) == -1)
{
perror("execvp");
return 1;
}
return 0;
}
```
A fork of the program, which can set the permitted I/O address range: <https://github.com/wuwbobo2021/ioperm>. For example, `WINEPREFIX="/home/username/wine32" ioperm -p 378-37f wine "C:\Program Files\dso29xxc\dso29xx.exe"`.
In case of your program have other problems, try to find its dependency DLLs and install the lacking one (`mfc42.dll` for example) by Winetricks.
Actually, I'm running the oscilloscope program for the old versions of Clock-link DSO29xx, without their unique USB converter. The LPT EPP performance is equal to the same program running in Windows 98 (with VESA/VBE display driver) on the same computer. In theory it is more effective than running it on NT-based Windows versions, porting it to WinIO or `ioperm` (Windows version, <https://github.com/eantcal/ioperm>) which depends on a kernel-mode driver. Am I wrong?
It is not so easy to figure out all this. Hope the WineHQ project will include such information in their documentation about running old programs, as long as Win9x versions of Windows can still be set by Wine.
Enabling raw I/O (parport etc.) for old Win9x based programs is possible
-
- Newbie
- Posts: 3
- Joined: Thu Jan 19, 2023 10:54 am
-
- Newbie
- Posts: 3
- Joined: Thu Jan 19, 2023 10:54 am
ioperm on Windows
Honestly, I'm wrong. Carefully reading through the README.md file of Windows ioperm, I realized that it is not like replacing IN/OUT instructions with WinIO library calls; it updates the I/O permission bitmap of calling process, the same thing as it does on Linux. Thus it wouldn't slow down the program.
This won't make Linux enthusiasts very happy, but I must not make people think that I'm lying (if so, then I'm going to be a shame of them). Windows is not so uncontrollable at least in this aspect.
This won't make Linux enthusiasts very happy, but I must not make people think that I'm lying (if so, then I'm going to be a shame of them). Windows is not so uncontrollable at least in this aspect.