Jump to content
Alexander Halser

TEmbeddedWB in a 64 Bit application

Recommended Posts

I am using TEmbeddedWB (an extended version of TWebBrowser, the "latest" from GitHub from 2011) in a VCL application, where it works just fine. The very same code compiled with 64 bit, however, crashes on some pages/scripts. The crash comes from C:\Windows\System32\jscript9.dll and reads:
 

First chance exception at $00007FFF99D9840. Exception Class $C00000090 with message "c00000090 FLOAT_INVALID_OPERATION'

It can be duplicated with a very simple test app in Delphi 10.1 or 10.3. If I use a standard TWebBrowser instead of TEmbeddedWB, it runs fine both as 32 and 64 bit. So I assume it is some declaration issue in one of the old units of TEmbeddedWB, that are not compatible with 64 bit.

Any suggestions what to look for in the code?

Share this post


Link to post

Isn't this just the age old issue that Delphi's RTL unmasks floating point hardware exceptions, but most other tools (including the MS tools) mask them. So the ActiveX control that implements the embedded browser expects floating point hardware exceptions to be masked and is caught out by your host having unmasked them.

 

Resolve the problem in the traditional way by masking floating point hardware exceptions.  There are countless SO posts on this subject which will show you how to do this.

  • Like 4
  • Thanks 1

Share this post


Link to post
2 hours ago, Alexander Halser said:

Thank you! This has indeed solved the issue.

 


initialization
  {$IFDEF WIN64}
  System.Math.SetExceptionMask(exAllArithmeticExceptions);
  {$ENDIF}

 

Do this for both 32 and 64 bit. Just because you might get away with it in 32 bit for now, doesn't mean you always will. And if your app doesn't need floating point exceptions unmasked then mask them. Have consistency between 32 and 64 bit. 

 

  • Like 2

Share this post


Link to post
20 hours ago, Alexander Halser said:

If I use a standard TWebBrowser instead of TEmbeddedWB, it runs fine

TWebBrowser is in SHDocVw.pas which has FSetExceptMask(femALLEXCEPT); in the initialization section. I don't know ~WB.
 

Share this post


Link to post
Quote

TWebBrowser is in SHDocVw.pas which has FSetExceptMask(femALLEXCEPT);

That part was missing in the ~WB version. Must have been added in more recent versions of SHDocVw.pas.

Share this post


Link to post
23 hours ago, David Heffernan said:

Isn't this just the age old issue that Delphi's RTL unmasks floating point hardware exceptions, but most other tools (including the MS tools) mask them.

Damn, even floating points have to wear masks right now. :classic_sad:

  • Haha 3

Share this post


Link to post
On 4/22/2020 at 9:16 PM, Alexander Halser said:

Thank you! This has indeed solved the issue.

 


initialization
  {$IFDEF WIN64}
  System.Math.SetExceptionMask(exAllArithmeticExceptions);
  {$ENDIF}

 

Hi, Is this solution works on Delphi 12.2? Where should I add your code?

Share this post


Link to post
16 minutes ago, saeiddavoody said:

Thank you, I explained the problem in previous post.

I don't know the EmbeddedWB, so I cannot help you. Sorry.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×