salvadorbs / Asuite

ASuite is a simple open source portable launcher for Microsoft Windows.
http://www.salvadorsoftware.com/asuite
GNU General Public License v3.0
98 stars 14 forks source link

Option to execute as admin #134

Closed megabugman closed 2 years ago

megabugman commented 3 years ago

some applications do not start, they crash immediately. These applications work if "run as admin". Please add an option in properties to run application always as admin. image

salvadorbs commented 3 years ago

Can you give me some example of application, so as I can replicate the issue?

megabugman commented 3 years ago

Sure. How can I send you a private message/file? I've uploaded a sample file here: https://easyupload.io/aqjg8f plz use download134 and OptionToExecuteAsAdmin#134

megabugman commented 2 years ago

FYI, in version 2.1.0.1568 the crash no longer occurs when running applications.

salvadorbs commented 2 years ago

Strangely enough, the crash was solved by itself (!?), but the issue remains. ASuite can't run executable that needs admin permissions (UAC).

This is because ASuite no longer uses the Windows ShellExecute method directly, but CreateProcessW (via FreePascal library) and the latter CANNOT run executables that require admin permissions.

So I'll have to insert code to be able to execute the ShellExecute method in these cases, as a fallback. And if the latter still fails, report the error by message.

megabugman commented 2 years ago

I was too quick, as you have stated the issue persists. this is the screenshot: image

image

salvadorbs commented 2 years ago

With the commit ab830727080ea4675d740002a0e33f2efc8f2aeb I added the fallback code and now ASuite should be able to run all executables without problems as before.

Please test it and if there are still problems reopen this issue without problems. Thank you very much

megabugman commented 2 years ago

issue persists in 2.1.0.1591, see test file there seems to be an issue with the icon as well: bug2

Edit: actually the issue is fixed as the application starts normally, but you should remove the two MessageBoxex: image

megabugman commented 2 years ago

I did more tests in 2.1.0.1588, apps run as expected, in 2.1.0.1591 not! From what I can tell the culprit seems to be Installer: Nullsoft Scriptable Install System

salvadorbs commented 2 years ago

@megabugman Another test with commit 71442117192800a3775655174ae61fd605d28ee3 (https://github.com/salvadorbs/Asuite/actions/runs/1405098581). Please test it. I hope it's the right time. Thank you very much. 😄

megabugman commented 2 years ago

OK, thanks it works now. I'll open a new issue regarding the icon display problem.

megabugman commented 2 years ago

sorry, it worked yesterday. today not, I'm using 2.1.0.1600. I hope you can reproduce the issue: crash

Why not use an apimonitor and spy on other program launchers? You may want to add some sort of logging in case a thread has existed immediately. My 2 cents.

salvadorbs commented 2 years ago

Why not use an apimonitor and spy on other program launchers? You may want to add some sort of logging in case a thread has existed immediately. My 2 cents.

It's a great idea, but I'm having trouble detecting which api are used in other launchers (eg pstart).

megabugman commented 2 years ago

Which function are you using? Try https://docs.microsoft.com/en-us/windows/win32/api/shellapi/nf-shellapi-shellexecutew image

salvadorbs commented 2 years ago

Great, I had assumed that PStart used the ShellExecuteW API. ASuite uses freepascal TProcess (so internally CreateProcessW in Windows) to have shared code between Windows and Linux.

With this PR https://github.com/salvadorbs/Asuite/pull/146, I decided to go back to having two different codes. In Windows I will use ShellExecuteEx, while in Linux I will use TProcess. This PR is not yet complete, as there is still no support for custom environment variables in Windows. But I believe you can already start testing.

megabugman commented 2 years ago

All applications start so far in 2.1.0.1611. I keep testing...

megabugman commented 2 years ago

Works as expected also 2.1.0.1613, closing report