PDA

View Full Version : SB10: "Detect Active Application" not working



NewsArchive
11-10-2022, 03:23 PM
Having an issue with setups not able to detect that an application is
running. Then, because of this, it proceeds with an update and tells
the user they have to re-start.

NOTE: This detection seems to WORK FINE in a VM.

If the user has the software on a non-VM, then it gives a 603 (fail)
instead of 1 (success).

If anybody is willing to check this out and/or tell me what I'm doing
wrong, I'd really appreciate it.

This zip file should have all you need to run "junk2" then run
"JunkIsRunning" to see if junk2 is running.

If it's detected, you should get a "1". If it fails, it's a 603.

I turned off requireAdmin because it was a PITB when testing and not
needed.

https://jssoftware.com/SBTest/junk2.zip

Jeff Slarve
www.github.com/jslarve

NewsArchive
11-10-2022, 03:24 PM
Dunno, Jeff.

I tried on three laptops (two Win 10 and one Win 8.1). The two Win 10
machines do have VMware installed, but I ran your stuff on the host.
The Win 8.1 has no VMware.

All three return 1 if junk2 is running, 603 if not.

Are your users running on single-user computers (not RDP or any kind
of shared environment?

I couldn't make it break. Sorry...

jf

NewsArchive
11-10-2022, 03:25 PM
Thanks Jane. Weird.

My work machine (brand new Dell with Windows 11) will not detect
junk2.

My personal dev machine (5 year old Dell Precision workstation) fails
too. But a Windows 10 VM finds it just fine.

Another dev is the one that discovered the VM thing. But I guess
that's a red herring.


Jeff Slarve
www.github.com/jslarve

NewsArchive
11-10-2022, 03:26 PM
I think I've discovered the actual issue.

If I had to guess, I'd say that Friedrich allocated an array of ~250
DWORDs for use in EnumProcesses. If the name of your desired process
isn't within those first 250, then it fails.

Try closing junk2.exe, then opening a bunch of apps until tasklist gets
more than 250 processes, then open junk2 and try the test app.

Jeff Slarve

NewsArchive
11-10-2022, 03:26 PM
I think you're right, Jeff.

I opened a gazillion Chrome and Firefox windows and your app returned
603. Then closed those and it returned 1.

It would be interesting to build a similar test with Capesoft's
OddJob.
I have a watchdog monitoring some web apps. If anything becomes
unresponsive, Oddjob tries to stop the service in question, then
searches for and kills any running instances showing in Task Manager.
Then restarts the service.

I haven't tried the "250 things" test with it but it's running on a
normal production server that has a fair bit of stuff going on.

jf

NewsArchive
11-10-2022, 03:26 PM
Hi Jeff,

I have created a small SetupBuilder 2019 project to start (from within a
Loop/End) a "dummy" JUNK.EXE Clarion executables 250 times. After that, I
started one instance of JUNK2.EXE and fired a "Detect Active Application"
action.

It returned 603. That means, JUNK2.EXE is not active. But this is WRONG
because JUNK2.EXE is definitely running!

Then I compiled the very same project with the internal version of
SetupBuilder 2023.

This time it returned 1.

So it seems to me I already fixed this. Checked my source code history and
see that I already worked with Capesoft on a similar issue. So it seems to
be related.

If you are interested, I can send you a small compiler library to check it
out.

Thank you for bringing this to my attention.

Friedrich

NewsArchive
11-10-2022, 03:27 PM
Hi Friedrich -

I am interested in your library update. Thank you very much. :)

Jeff Slarve

NewsArchive
11-10-2022, 03:28 PM
Hi Jeff,

did you receive it? I sent it 8 hours ago.

Friedrich

NewsArchive
11-10-2022, 03:28 PM
Thanks for the help, Jane

Jeff Slarve

NewsArchive
11-10-2022, 03:29 PM
BTW - CreateToolhelp32SnapShot() doesn't require pre-determining how
many PIDs to accommodate, unlike EnumProcesses.

Jeff Slarve

NewsArchive
11-10-2022, 03:29 PM
Hi Friedrich -

I did not. If it was an attachment, it probably got zapped. Is there a
link you can send me to retrieve the files?

Thank you.

Jeff Slarve

NewsArchive
11-10-2022, 03:30 PM
Hi Jeff,

attachement removed and re-sent with a direct link.

Friedrich

NewsArchive
11-10-2022, 03:30 PM
Looking Good, Friedrich. Thanks so much for your help.

Jeff Slarve

NewsArchive
11-10-2022, 03:31 PM
Will this fix be present in any future updates of this version and 2023?

Jeff Slarve

NewsArchive
04-11-2023, 08:28 AM
Hi Jeff,

> Will this fix be present in any future updates of this version and 2023?

It should work fine in SB2023 BETA-1 now. Could you please test this?

Thank you!

Friedrich