Page 1 of 1

SC: Script feeding (/flg=2) blocked by attr:TitlebarTemplate

Posted: 24 Oct 2013 22:52
by Filehero
Hi Don,

well this one was really haunting me and costs me hours to track down.

I first reported it here and summarized my findings here.


Defect observed
In my case running

Code: Select all

run "<xy> /script=""::msg 'Hi!';"" /flg=2", , 0,0; 
always resulted in a 2nd XY instance coming up to execute the script passed.


After even the very competent and helpful community went of ideas I bit the bullet and injected every single differing entry from my 'broken' XY ini into a fresh one step by step with restarting XY over without saving.
Result: If you set the TitlebarTemplate to one of the following values, the self-feeding fails, and a second XY instance get used to run the script instead.

EVIL

Code: Select all

<xypath>:<app> @ <ver> | <ver>
<xypath>:<app> <ver> | <path>
<xypath>:<app> <ver> |
<xypath>:<app> <ver>
:<app> <ver>
:<app><ver>
<app><ver>
<ver><app>
AAAAAA<ver><app>BBBBBBB

In contrast, the following values are

Harmless

Code: Select all

<xypath>:<app> @ <ini> | <ver>
<xypath>:<app> <ini> | <path>
<xypath><ver>
:<ver>
<ver>
. :<ver>
<app> <ver>
<ver> <app>
<app>

Cheers,
Filehero

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Posted: 25 Oct 2013 20:59
by Filehero
Hi Don,

can you repro?


Cheers,
Filehero

PS: Sorry for bumping, but I do take this bug personally :mrgreen:

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Posted: 25 Oct 2013 21:06
by admin
Sorry, but no time tonight anymore. This stuff is very nasty to check. :|

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Posted: 25 Oct 2013 21:10
by Filehero
admin wrote:Sorry, but no time tonight anymore. This stuff is very nasty to check. :|
No worries, I don't expect a fix soon (how could I?), I was just after a confirmation.

Yeah, the nastiness I learned to know. :twisted:

Peace. :D

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Posted: 26 Oct 2013 08:49
by admin
To identify other XY instances the title bar is checked: Does it look like an XY title bar? So there is a somewhat involved heuristics for this. I changed it a bit so in the next version most of your evil stuff will be turned harmless. Let's see what remains.

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Posted: 26 Oct 2013 09:07
by Filehero
admin wrote:To identify other XY instances the title bar is checked: Does it look like an XY title bar?
:shock: Now, this explains everything - including me having absolutely no clue about programming with the Windows api/VB6. :whistle:

I really have thought the logic would stay within the current context, e.g. something like

Code: Select all

this.scEngine.runScript($scriptHandle);
is called on the instance the command is triggered.

Usually, I don't care about window titles, but with XY and your high rate releasecycles seeing the app folder and the version number is not just handy but rather a necessity. :wink:

Thanks for taking care, will report back then.


Cheers,
Filehero

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Posted: 26 Oct 2013 09:20
by admin
Filehero wrote:I really have thought the logic would stay within the current context, e.g. something like

Code: Select all

this.scEngine.runScript($scriptHandle);
is called on the instance the command is triggered.
When you are doing this, you are clearly calling another instance, not this instance:

Code: Select all

run "<xy> /script=""::msg 'Hi!';"" /flg=2", , 0,0; 
A new XYplorer.exe will invariably be opened. Then, depending on the command line, on its own INI file setting, and on the presence of probable other XYplorer instances, this instance will decide whether it will continue to load, or exit and pass the command line to one of the already existing instances.

Just got an idea to make this more controlled from the POV of the caller, pass the window handle!

Code: Select all

/hwnd=<hwnd>
Pass the calling window handle via command line. Then the called instance would not need to look for other instances, but simply pass it on to this window handle. But no time for it now.... bump me later. :)

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Posted: 26 Oct 2013 09:50
by Filehero
admin wrote:When you are doing this, you are clearly calling another instance, not this instance:

Code: Select all

run "<xy> /script=""::msg 'Hi!';"" /flg=2", , 0,0; 
Yes, you're right. Wer Lesen kann ...

admin wrote:Just got an idea to make this more controlled from the POV of the caller, pass the window handle!

Code: Select all

/hwnd=<hwnd>
Pass the calling window handle via command line. Then the called instance would not need to look for other instances, but simply pass it on to this window handle.
Sounds good, just a direct handle.

Bump has to wait until the revolution has settled. :wink:

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Posted: 26 Oct 2013 13:46
by admin
The dust is settling. I found the time to do it... :)

Re: SC: Script feeding (/flg=2) blocked by attr:TitlebarTemp

Posted: 26 Oct 2013 16:14
by Filehero
admin wrote:The dust is settling. I found the time to do it... :)
It works like charm, great and well done "fix".

Thanks a lot. :D


Cheers,
Filehero