PowerShell 7+ dependency on `user32.dll` on Windows. · Issue #27323 · PowerShell/PowerShell · GitHub
Skip to content

PowerShell 7+ dependency on user32.dll on Windows. #27323

@bbonaby

Description

@bbonaby

Prerequisites

Steps to reproduce

When attempting to launch pwsh.exe in an environment with the win32k subsystem disabled on Windows, it fails to launch. When inspecting the imports for pwsh.exe we see MessageBoxW being used from user32.dll which is imported as a direct dependency.

dumpbin.exe /imports (Get-Command pwsh).Source | Select-String -Context 0, 200 'user32.dll'
Image

Note:

  • Dumpbin.exe can be found in the Windows SDK.
  • This happens with v7.6.1 but I suspect it affects all of the previous open source versions too.
  • PowerShell 5.1 has this behavior too, but I expect this will stay as is.

Credit to : https://github.com/alexsnitkovskiy for finding this although we don't know if this is by design. That said it's weird that PowerShell needs user32.dll at all really especially to use MessageBoxW.

Expected behavior

PowerShell 7+ can be loaded without the win32k subsystem

Actual behavior

PowerShell 7+ requires win32k subsystem to load.

Error details

No error details, powershell simply does not load since it can't load user32.dll for example.

Environment data

none.

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-TriageThe issue is new and needs to be triaged by a work group.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions