游戏加速器LSP/DLL导致WSL.EXE无法打开问题修复!

发布时间:2023年12月30日

解决办法:

https://github.com/microsoft/WSL/issues/4177#issuecomment-597736482

方法一:(管理员身份)

netsh winsock reset

方法二:

WSCSetApplicationCategory 函数设置LSP加载权限

                    bool NoLsp(const wchar_t* wszExePath) noexcept
                    {
                        if (NULL == wszExePath)
                        {
                            return false;
                        }

                        DWORD dwExePathLength = wcslen(wszExePath);
                        DWORD dwPrevCat = 0;
                        DWORD dwPermittedLspCategories = 0x80000000;
                        LPINT lpErrno = NULL;

                        int nErr = WSCSetApplicationCategory(wszExePath, dwExePathLength, NULL, 0, dwPermittedLspCategories, &dwPrevCat, lpErrno);
                        return nErr == ERROR_SUCCESS;
                    }

方法三:

下载:https://www.proxifier.com/tmp/Test20200228/NoLsp.exe

执行:.\NoLsp.exe "C:\Windows\System32\wsl.exe"

这些程序都须被?NoLSP:

                    bool ok = false;
                    char szExePath[1000 + 1];
                    xxx::::string username = xxx::::win32::Win32Native::GetLoginUser();

                    ok |= paper_airplane::NoLsp(LR"(C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_2.0.9.0_x64__8wekyb3d8bbwe\wsl.exe)");
                    ok |= paper_airplane::NoLsp(LR"(C:\Program Files\WSL\wsl.exe)");
                    ok |= paper_airplane::NoLsp(LR"(C:\Program Files\WSL\wslservice.exe)");

                    snprintf(szExePath, sizeof(szExePath), R"(C:\Users\%s\AppData\Local\Microsoft\WindowsApps\wsl.exe)", username.data());
                    ok |= paper_airplane::NoLsp(xxx::::text::Encoding::ascii_to_wstring(szExePath).data());

                    snprintf(szExePath, sizeof(szExePath), R"(C:\Users\%s\AppData\Local\Microsoft\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_8wekyb3d8bbwe\wsl.exe)", username.data());
                    ok |= paper_airplane::NoLsp(xxx::::text::Encoding::ascii_to_wstring(szExePath).data());

                    ok |= paper_airplane::NoLsp(LR"(C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.22621.2506_none_62c8e9f54a7fa6e6\wsl.exe)");
                    ok |= paper_airplane::NoLsp(LR"(C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.22621.2506_none_62c8e9f54a7fa6e6\f\wsl.exe)");
                    ok |= paper_airplane::NoLsp(LR"(C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.22621.2506_none_62c8e9f54a7fa6e6\r\wsl.exe)");

                    ok |= paper_airplane::NoLsp(LR"(C:\Windows\System32\wsl.exe)");
                    ok |= paper_airplane::NoLsp(LR"(C:\Windows\System32\vmwp.exe)");
                    ok |= paper_airplane::NoLsp(LR"(C:\Windows\System32\vmcompute.exe)");

注册表中查看添加上没有,路径在这里;

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog

文章来源:https://blog.csdn.net/liulilittle/article/details/135310900
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。