VBScript compiled EXE crashes on startup

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 7 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
bpayton
Posts: 2
Last visit: Wed Oct 12, 2016 12:52 pm

VBScript compiled EXE crashes on startup

Post by bpayton »

Product, version and build: PrimalSCript 2016, 7.2.94
32 or 64 bit version of product: 64-bit
Operating system: Windows 7 SP1
32 or 64 bit OS: 64-bit

I have a VBScript that was written to run as a machine startup script, however, I'm having the same problem when running the script interactively.

When I start the compiled EXE it crashes (StartupXXXXXXXXX has stopped working), and this event is logged in the application event log:

Faulting application name: StartupXXXXXXXXX.exe, version: 1.0.0.1, time stamp: 0x572e1f9e
Faulting module name: StartupXXXXXXX.exe, version: 1.0.0.1, time stamp: 0x572e1f9e
Exception code: 0xc0000417
Fault offset: 0x00005ca1
Faulting process id: 0x15b8

I am compiling the script with elevated privileges and I've tried WScript, CScript and Sapien engines and get the same results with each.

I'm sure it's probably something I'm doing wrong, but can't think of anything else to try.

Anyone have any suggestions?
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 20
Been upvoted: 37 times

Re: VBScript compiled EXE crashes on startup

Post by Alexander Riedel »

Can you verify if all scripts packaged on your machine exhibit this behavior or just this one?
The exception code means 'unknown software exception' which is not really helpful.

If this ONLY occurs with this one script, I would like to check the script's encoding, make sure it is ASCII or Unicode LE.
Check that your version information does not contain any illegal characters.

Last but not least, I am assuming the 'StartupXXXXXXXXX' is not the real name you use for the file.
Try a different file name and see if that has an impact.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
bpayton
Posts: 2
Last visit: Wed Oct 12, 2016 12:52 pm

Re: VBScript compiled EXE crashes on startup

Post by bpayton »

I hadn't tried to compile anything else with this version of PrimalScript, so I created a very simple script (posted below):

Option Explicit
MsgBox "Hello world!"
WScript.Quit

After compiling and trying to run I noticed something interesting. It seems to run okay as long as it is started from a mapped drive, but fails if it is run from a UNC path. I'm beginning to wonder if it might be getting blocked by AV/HIPS policy somehow. This is the first time I'm trying to compile something to run across the organization -- in a relatively new position -- so still learning some of the infrastructure gotchas. I'm going to go check with the security folks and see if I can get any more information, but please feel free to provide any other insight anyone might have.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 20
Been upvoted: 37 times

Re: VBScript compiled EXE crashes on startup

Post by Alexander Riedel »

Ah, thanks for the additional info. That can have two reasons. It is not compiled, but packaged. That means the application needs to have read access to its own executable file to extract the script code and run it. It also contains a COM object that is basically a clone for what is inside WScript/JScript. Registering that COM object even temporarily needs sufficient right.
It could be that you have execute only access on that folder. It could also be because you are elevating that you do not have access to that path. Elevation, depending on where you elevate from, can make your app run under a completely different security context.
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 7 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.