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

Application paths are treated as arguments #357

Closed
heystenner opened this Issue Mar 9, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@heystenner
Copy link

heystenner commented Mar 9, 2019

Describe the bug
When I launch an application with a recipe, the path I specified in recipies gets passed on to the application as an argument. I can see this especially in browsers, where the application path appears in the address bar.

To Reproduce
Steps to reproduce the behavior:

  • I specify an application path in a recipe, like C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
    grafik
  • I run the recipe with the specified shortcut (CTRL+ALT+M in my case, no other shortcuts for that on my system afik).
  • The app window opens.
  • There are two tab windows open: files/ and %28x86%29/Google/Chrome/Application/chrome.exe
    grafik
  • If I specify an argument, like http://trello.com - it will open the two tabs above mentioned + the domain I specified.
  • Same thing happens with other apps:
    grafik

Expected behavior
The application was supposed to open, nothing else.

System information:

  • Windows 10 Version 1803 build 17134.590
  • MaxTo version 2.0.0-rc2

Additional context

Log file:
2019-03-09 16:59:36 [Core@2.0.0.470] [Information] Executing recipe '"Grafikdesign"' with 1 ingredients 2019-03-09 16:59:36 [Core@2.0.0.470] [Information] Recipe '"Grafikdesign"' executed successfully.

SquirrelSetup.log: none

@vegardlarsen

This comment has been minimized.

Copy link
Member

vegardlarsen commented Mar 11, 2019

Thank you for the detailed error report. This error appears only in specific situations:

  1. MaxTo is running elevated
  2. The path to the executable contains spaces.

The issue is that we are using a method called CreateProcessWithTokenW to start the executable without elevation. That method accepts the program arguments in a somewhat special format: <executable path> <arguments> (the lpCommandLine parameter). Unfortunately the documentation we looked at when implementing this left out this important detail from the documentation:

If lpApplicationName is NULL, the first white space–delimited token of the command line specifies the module name. If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin (see the explanation for the lpApplicationName parameter).

We didn't catch this earlier, because we regularly use notepad as our test recipe target, which does not have a space in its path.

I have fixed this issue locally and it will be in the next build.

@vegardlarsen vegardlarsen self-assigned this Mar 11, 2019

@vegardlarsen vegardlarsen added the bug label Mar 11, 2019

@vegardlarsen vegardlarsen added this to the 2.0.0 milestone Mar 11, 2019

@heystenner

This comment has been minimized.

Copy link
Author

heystenner commented Mar 13, 2019

Glad I could be of help. Looking forward to the next version.

@vegardlarsen vegardlarsen modified the milestones: 2.0.0, 2.0.0-rc.3 Mar 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.