microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
10.25k stars 307 forks source link

`C:\Windows\System32\wslg.exe` cannot be called from programs via Python and C++ #1143

Open ncaq opened 1 year ago

ncaq commented 1 year ago

Windows build number:

22621.0

Your Distribution version:

22.04

Your WSL versions:

WSL バージョン: 2.0.9.0 カーネル バージョン: 5.15.133.1-1 WSLg バージョン: 1.0.59 MSRDC バージョン: 1.2.4677 Direct3D バージョン: 1.611.1-81528511 DXCore バージョン: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows バージョン: 10.0.22621.2715

Steps to reproduce:

I am use Keyhac to call wslg.exe. I had configured it as follows.

https://github.com/ncaq/keyhac-config/blob/f6dc088b28f1a0b6ae90c42f963900a6b940c915/config.py#L262C1-L267C6

However, after applying the Windows Update of November 14, 2023, wslg.exe can no longer be called. I got the following error.

Traceback (most recent call last):
  File "../ckit\ckit_threadutil.py", line 231, in run
  File ".\keyhac_keymap.py", line 2161, in jobShellExecute
FileNotFoundError: [WinError 2] 指定されたファイルが見つかりません。

I found the real wslg.exe location changed by looking at the following PR.

Update the path of wslg.exe for the new MSI package. by benhillis · Pull Request #1124 · microsoft/wslg

So. I found that the real wslg.exe had changed location and called the wslg.exe that was not PATHed, and it worked.

fix: use real wslg.exe by ncaq · Pull Request #1 · ncaq/keyhac-config

WSL logs:

No response

WSL dumps:

No response

Expected behavior:

Calling wslg.exe, which has PATH, should work no differently.

Actual behavior:

When I start wslg.exe with PATH in System32, it does not work or behaves strangely depending on how I invoke it.