PlanetSquires Forums

Support Forums => José Roca Software => Topic started by: Paul Squires on November 10, 2018, 04:52:44 PM

Title: Warning in CAxHost_IServiceProvider.inc
Post by: Paul Squires on November 10, 2018, 04:52: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.


' ========================================================================================
' 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.
Title: Re: Warning in CAxHost_IServiceProvider.inc
Post by: José Roca on November 10, 2018, 05:17: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?
Title: Re: Warning in CAxHost_IServiceProvider.inc
Post by: Paul Squires on November 10, 2018, 05:25: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)
Title: Re: Warning in CAxHost_IServiceProvider.inc
Post by: José Roca on November 10, 2018, 05:50:01 PM
Even using -O 2, I don't get any error with my example. Which is the text of the warning?
Title: Re: Warning in CAxHost_IServiceProvider.inc
Post by: Paul Squires on November 10, 2018, 06:10:37 PM
The text is in the attachment in the first post of this thread.
Title: Re: Warning in CAxHost_IServiceProvider.inc
Post by: José Roca on November 10, 2018, 06:52: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.
Title: Re: Warning in CAxHost_IServiceProvider.inc
Post by: Paul Squires on November 10, 2018, 06:58: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.
Title: Re: Warning in CAxHost_IServiceProvider.inc
Post by: Paul Squires on December 30, 2018, 12:05:32 PM
Since I upgraded to the Nov 22, 2018 Nightly Build, this error/warning has now disappeared.
Title: Re: Warning in CAxHost_IServiceProvider.inc
Post by: José Roca on December 30, 2018, 01:36:30 PM
That warning did not make sense, since IID is just an alias for GUID. Therefore, if both parameters are GUIDs, they can't be of different sizes.