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

Running win32 application from shell "exits silently" but in reality crashes on load #31

Open
thlac opened this issue Oct 19, 2019 · 5 comments

Comments

@thlac
Copy link

thlac commented Oct 19, 2019

So I ran into an issue where an application unexpectedly would no longer launch when called directly from the shell, i.e. ".\appname.exe"

After troubleshooting for a bit with my trusty old friend Process Monitor, I could see the process opening and closing down again, looking at the Process Exit event, I saw the exit code of -1073741515 (aka. 0xC0000135, aka. STATUS_DLL_NOT_FOUND)

That was a quite easy fix, but it nagged me that I got no indication of the failure, in any other circumstance (running from cmd, double-clicking in explorer, run or even in powershell with Start-Process) a message would pop up stating a DLL was missing, and which one it was.

(I don't know if this issue extends to Linux/MacOS, or even if it can affect those platform)

Steps to reproduce


- First and foremost, a win32(native) application is needed with a linked library that's missing
- PS > .\path\to\executable.exe

Expected behavior

External System Error prompt

Actual behavior

No Output

Environment data

Name                           Value
----                           -----
PSVersion                      6.2.3
PSEdition                      Core
GitCommitId                    6.2.3
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@SteveL-MSFT
Copy link
Member

Need more info, is this ia native app or managed app?

@thlac
Copy link
Author

thlac commented Oct 19, 2019

Sorry, that's what I meant by win32, it's a fully native app. I've edited the original post to reflect this.

@thlac
Copy link
Author

thlac commented Oct 19, 2019

I can't share the program in question, but you can download something like quassel for win64(irc client), and delete qt5gui.dll to get the same effect.

@lzybkr
Copy link
Member

lzybkr commented Oct 20, 2019

If you run the same program from cmd.exe, I'm guessing you'll get a popup about a dll that can't be found.

Assuming so, the cause is this line of code.

You can use P/Invoke to enable popups - see the docs on SetErrorMode. Personally I think the error mode should be 0 instead of SEM_FAILCRITICALERRORS, but I can see reasonable people wanting the current behavior. At a minimum though, I think any interactive commands should display the popup.

@thlac
Copy link
Author

thlac commented Oct 20, 2019

Yep, that's exactly it, you get an error dialog if you run it in any other way.

I also agree that we probably only want the behaviour interactively, though I'm not sure how the behaviour would be while headless or in a Windows Nano Server setting.

@SteveL-MSFT SteveL-MSFT transferred this issue from PowerShell/PowerShell Oct 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants