Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Wine] NtQuerySystemInformation(SystemProcessIdInformation) not implemented before Wine 9.8 #2492

Open
klightspeed opened this issue Dec 31, 2024 · 0 comments · May be fixed by #2493
Open

Comments

@klightspeed
Copy link

klightspeed commented Dec 31, 2024

Summary

  • OS: Ubuntu 24.04.1 / wine-9.0 (Ubuntu 9.0~repack-4build3)
  • Architecture: x86-64
  • Psutil version: 6.1.1
  • Python version: 3.12.8
  • Type: core

Description

Wine versions older than 9.8 (wine-mirror/wine@deb273a) and Proton versions older than 9.0-1 (ValveSoftware/wine@9ec33e7) do not support the SystemProcessIdInformation system information class in NtQuerySystemInformation. CrossOver has not backported this support to the wine 9.0 bundled in CrossOver 24.0, and so also does not support this information class.

A fix / workaround for this might be to fall back to QueryFullProcessImageNameW when NtQuerySystemInformation returns STATUS_INVALID_INFO_CLASS in psutil_proc_exe.

$ cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
$ wine --version
wine-9.0 (Ubuntu 9.0~repack-4build3)
$ cd ~/.wine/drive_c
$ wine cmd
Microsoft Windows 10.0.19043

C:\>python --version
Python 3.12.8

C:\>mkdir test-psutil

C:\>cd test-psutil

C:\test-psutil>python -m venv .

C:\test-psutil>Scripts/activate.bat

(test-psutil) C:\test-psutil>pip install psutil
Collecting psutil
  Using cached psutil-6.1.1-cp37-abi3-win_amd64.whl.metadata (23 kB)
Using cached psutil-6.1.1-cp37-abi3-win_amd64.whl (254 kB)
Installing collected packages: psutil
Successfully installed psutil-6.1.1

(test-psutil) C:\test-psutil>python
Python 3.12.8 (tags/v3.12.8:2dc476b, Dec  3 2024, 19:30:04) [MSC v.1942 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.pids()
[32, 56, 68, 76, 112, 168, 192, 224, 260, 268, 392, 400]
>>> psutil.Process(400)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\test-psutil\Lib\site-packages\psutil\__init__.py", line 408, in __str__
    info["name"] = self.name()
                   ^^^^^^^^^^^
  File "C:\test-psutil\Lib\site-packages\psutil\__init__.py", line 677, in name
    name = self._proc.name()
           ^^^^^^^^^^^^^^^^^
  File "C:\test-psutil\Lib\site-packages\psutil\_pswindows.py", line 800, in name
    return os.path.basename(self.exe())
                            ^^^^^^^^^^
  File "C:\test-psutil\Lib\site-packages\psutil\_pswindows.py", line 728, in wrapper
    raise convert_oserror(err, pid=self.pid, name=self._name)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\test-psutil\Lib\site-packages\psutil\_pswindows.py", line 717, in convert_oserror
    raise exc
  File "C:\test-psutil\Lib\site-packages\psutil\_pswindows.py", line 726, in wrapper
    return fun(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\test-psutil\Lib\site-packages\psutil\_common.py", line 515, in wrapper
    raise raise_from(err, None)
          ^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 3, in raise_from
  File "C:\test-psutil\Lib\site-packages\psutil\_common.py", line 513, in wrapper
    ret = fun(self)
          ^^^^^^^^^
  File "C:\test-psutil\Lib\site-packages\psutil\_pswindows.py", line 816, in exe
    exe = cext.proc_exe(self.pid)
          ^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 87] Invalid parameter: '(originated from NtQuerySystemInformation)'
>>> quit()

Similar issues can be found with the search "OSError: [WinError 87]" "'(originated from NtQuerySystemInformation)'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant