WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: galaara98 on December 27, 2017, 02:23:32 PM

Title: BUG! Issue with script crashing after running for years
Post by: galaara98 on December 27, 2017, 02:23:32 PM
I have a script that suddenly stopped working on Windows 10 and Windows 2016 (I assume after a Microsoft patch)
the script fails when run in Winbatch Studio or after compiled WHEN it is 64bit, but does not crash when it is 32bit (now i actually cant use it 32bit, but it doesnt crash)

It crashes when I bring up a Dialog that has a Internet Explorer or MSHTML ComObject in it (it might crash for any com object)

Take the sample script from Winbatch'es own tech support
http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/Dialog~Editor+Bitmaps~in~a~Dialog~Box.txt

;Simple Image File Viewer
image =  AskFilename( 'Choose Image File to Display', ShortCutDir("My Pictures" ,0 ,@TRUE ), 'All Files|*.*', '', 2 )
myvar = StrCat( `"MSHTML:<IMG SRC='`, image ,`'>"` )

ImagesFormat=`WWWDLGED,6.1`

ImagesCaption=`Image Viewer`
ImagesX=002
ImagesY=040
ImagesWidth=278
ImagesHeight=217
ImagesNumControls=003
ImagesProcedure=`DEFAULT`
ImagesFont=`DEFAULT`
ImagesTextColor=`DEFAULT`
ImagesBackground=`DEFAULT,DEFAULT`
ImagesConfig=0

Images001=`114,190,047,010,PUSHBUTTON,DEFAULT,"Done",1,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Images002= `018,025,240,153,COMCONTROL,DEFAULT, %myvar% ,DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
Images003=`018,009,242,011,VARYTEXT,image,"",DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT`

ButtonPushed=Dialog("Images")
Exit

This script fails for me on the latest Windows 10 in winbatch studio (when run or compile is set to x64)

with a standard Winbatch Crash Screen:
Error 3104: Dialog Box: Windows Creation Failed
     ButtonPushed=Dialog("Images")


in a compiled version I get a Microsoft Visual C++ Runtime Library Crash
Runtime Error!
Program %full path of my exe%
This application has requested the Runtime to terminate it in an unusual way
Please contact the application's support team for more information




there is a windows event in reference to mshtml.dll logged at the same time (this is when i ran within the Studio):
Faulting application name: WbsMon.exe, version: 2017.2.0.0, time stamp: 0x58ed0cbf
Faulting module name: mshtml.dll, version: 11.0.16299.15, time stamp: 0xc42aa4d7
Exception code: 0x40000015
Fault offset: 0x000000000051af84
Faulting process id: 0x1bf8
Faulting application start time: 0x01d37f5ecfaef747
Faulting application path: C:\Program Files\WinBatch\System\WbsMon.exe
Faulting module path: C:\Windows\System32\mshtml.dll
Report Id: 8687fd7e-aa77-4c05-a489-8be1b1d21872
Faulting package full name:
Faulting package-relative application ID:


None of this happens when in 32 bit Winbatch
I have tested the sample script on multiple computers.. older windows 10 and Windows 7 works both x64 and x86, new Windows 10 it only works 32 bit.

Aaron
Title: Re: BUG! Issue with script crashing after running for years
Post by: td on December 27, 2017, 04:19:37 PM
It's an MSFT bug that appeared in Windows 10 version 1709.   It occurs when the mshtml.dll module allocates garbage collection memory - javascript ??-  while initializing some COM interfaces or some graphics stuff.  Not quite sure which.   It only occurs when using the 64-bit version of mshtml.dll.

Your only option at this time is to use 32-bit WinBatch as this is a Windows problem and not a WinBatch problem.  There are no other known workarounds.

Did I mention that Windows 10 is known to be a bit buggy at times...
Title: Re: BUG! Issue with script crashing after running for years
Post by: Secondlaw on January 02, 2018, 11:15:05 AM
Possibly change this line:
Faulting module path: C:\Windows\System32\mshtml.dll

to this:

Faulting module path: C:\Windows\Syswow64\mshtml.dll

Might be a work around.
Title: Re: BUG! Issue with script crashing after running for years
Post by: td on January 02, 2018, 01:33:15 PM
The problem involves the 64-bit version of mshtml.dll being used by the 64-bit version of the browser COM control and 64-bit WinBatch.  The mshtml.dll in syswow64 is the 32-bit version which works just fine with the 32-bit version of the browser COM control and 32-bit WinBatch.   Furthermore,  you can't load a 32-bit dll into a 64-bit process.
Title: Re: BUG! Issue with script crashing after running for years
Post by: td on March 05, 2018, 09:38:28 PM
A workaround for the problem that is the subject of this topic will be included in the next version of WinBatch+Compiler.