PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Warning in CAxHost_IServiceProvider.inc  (Read 149 times)

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8635
  • Windows 10
    • PlanetSquires Software
Warning in CAxHost_IServiceProvider.inc
« on: November 10, 2018, 04:22:44 PM »

Hi Jose,

When compiling WinFBE 64 bit I get a warning. I preserved the generated C code and tracked down the warning to the CAxHost_IServiceProvider.inc file. Specifically, to the function below.

Code: [Select]
' ========================================================================================
' Acts as the factory method for any services exposed through an implementation of
' IServiceProvider.
' ========================================================================================
FUNCTION CAxHost_IServiceProvider.QueryService (BYVAL guidService AS const GUID const PTR, BYVAL riid AS const IID const PTR, BYVAL ppvObject AS ANY PTR PTR) AS HRESULT
   DIM pwsz AS WSTRING PTR
   StringFromIID(guidService, CAST(LPOLESTR PTR, @pwsz))
   DIM s AS STRING : IF pwsz THEN s = *pwsz : CoTaskMemFree(pwsz)
   StringFromIID(riid, CAST(LPOLESTR PTR, @pwsz))
   DIM s2 AS STRING : IF pwsz THEN s2 = *pwsz : CoTaskMemFree(pwsz)
'   CAXH_DP("CAxHost_IServiceProvider QueryService SID = " & s & " - IID = " & s2)
   CAXH_DP("QueryService SID = " & s)
   CAXH_DP("QueryService IID = " & s2)
   ' // Handle SID_SInPlaceBrowser (needed to enable the filesystem object to navigate
   ' // in-place within the WebBrowser control when running on Windows 7+)
   IF IsEqualIID(@guidService, @SID_SInPlaceBrowser) THEN
      RETURN AfxAxHostQueryService(CAST(IUnknown PTR, m_pAxHost->m_pOcx), @SID_SShellBrowser, riid, @ppvObject)
   END IF
   RETURN E_NOINTERFACE
END FUNCTION

From the C code, the warning line appears to be this one:

   IF IsEqualIID(@guidService, @SID_SInPlaceBrowser) THEN

It appears that the parameters in this IsEqualIID macro are of different sizes and there is a potential of reading past allocated memory. I have attached a copy of the actual warning message. You might be in a better position to eliminate the warning or ensure that the warning is not harmful.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • Moderator
  • Master Member
  • *****
  • Posts: 3109
    • Jos
Re: Warning in CAxHost_IServiceProvider.inc
« Reply #1 on: November 10, 2018, 04:47:22 PM »

I'm not getting any warning compiling one of my web browser examples.

IID is an alias for GUID and it is defined as type IID as GUID in guiddef.bi.

Maybe a problem with "const" of a recent build of the compiler?
« Last Edit: November 10, 2018, 04:49:52 PM by Josť Roca »
Logged

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8635
  • Windows 10
    • PlanetSquires Software
Re: Warning in CAxHost_IServiceProvider.inc
« Reply #2 on: November 10, 2018, 04:55:55 PM »

You may be right although I think that I haven't been using the very latest compilers with the Const changes. This is the command line I am using (only the -O 2 optimization is out of the ordinary).

fbc64 WinFBE.bas -x ..\WinFBE64.exe -O 2 WinFBE.rc -s gui

(Later: I removed the -O 2 and now it compiles without warning but the exe is 350K larger)
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • Moderator
  • Master Member
  • *****
  • Posts: 3109
    • Jos
Re: Warning in CAxHost_IServiceProvider.inc
« Reply #3 on: November 10, 2018, 05:20:01 PM »

Even using -O 2, I don't get any error with my example. Which is the text of the warning?

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8635
  • Windows 10
    • PlanetSquires Software
Re: Warning in CAxHost_IServiceProvider.inc
« Reply #4 on: November 10, 2018, 05:40:37 PM »

The text is in the attachment in the first post of this thread.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor

Josť Roca

  • Moderator
  • Master Member
  • *****
  • Posts: 3109
    • Jos
Re: Warning in CAxHost_IServiceProvider.inc
« Reply #5 on: November 10, 2018, 06:22:19 PM »

I will have to try with the source code of the editor (is it up to date in GitHub?). A priori, the warning does not make sense, since both are GUIs with a size of 16 bytes, and my web browser examples compile fine.

Paul Squires

  • Administrator
  • Master Member
  • *****
  • Posts: 8635
  • Windows 10
    • PlanetSquires Software
Re: Warning in CAxHost_IServiceProvider.inc
« Reply #6 on: November 10, 2018, 06:28:57 PM »

Yes, the source is up to date. I wouldn't worry too much about it. I expect maybe the -O 2 optimization may be playing with the structures too much. It might even be a false warning from GCC.
Logged
Paul Squires
PlanetSquires Software
FireFly Visual Designer, WinFBE Editor