Support Forums > WinFBX - Windows Framework for FreeBASIC

Warning in CAxHost_IServiceProvider.inc

(1/2) > >>

Paul Squires:
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: ---' ========================================================================================
' 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

--- End code ---

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.

Josť Roca:
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?

Paul Squires:
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)

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

Paul Squires:
The text is in the attachment in the first post of this thread.

Navigation

[0] Message Index

[#] Next page

Go to full version