Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Possible access to class member with a zero pointer reference Collapse All
Subject Author Date
Adrian Ineichen Aug 26, 2014 - 7:33 AM

Hi


We encountered a possible access to class member with a zero pointer reference.


It happens in method BOOL CExtResizableDialog::PreTranslateMessage(MSG* pMsg) where you just access ::AfxGetThread()->m_nThreadID.


As Microsoft states, since C++ .NET this version can return zero (0) in case no thread was found (before it internally called ’AfxGettApp()’ in that case).


For the method GetKeyboardLayout, for which the thread ID is used in this case, accepts an ID of zero (0) as parameter value, we changed the code to the following:


                    DWORD threadID(0);

                    if(::AfxGetThread())

                    {

                        threadID = ::AfxGetThread()->m_nThreadID;

                    }

                    HKL hKeyboardLayout = ::GetKeyboardLayout(threadID);


The  last ProfUIS version we checked this with is: 3.0


Best regards and thank you for your attention.


Christian Herger

Art Wilkes Aug 26, 2014 - 9:31 AM

Prof-UIS Support
We are reviewing this.

Thanks for the post