FIX: SetNumProperty GP Faults with Some Property Array Types

Last reviewed: September 18, 1997
Article ID: Q113533
1.00 WINDOWS kbprg kbfixlist kbbuglist

The information in this article applies to:

  • The Microsoft Foundation Classes (MFC) included with: Microsoft Visual C++ for Windows, version 1.0

SYMPTOMS

Using SetNumProperty or GetNumProperty on a property array that uses any of the following internal data types (internal to the VBX) causes a general protection (GP) fault or unexpected behavior:

   DT_BOOL, DT_XPOS, DT_XSIZE, DT_YPOS, DT_YSIZE

CAUSE

The VBX emulation layer used by the Microsoft Foundation Classes (MFC) incorrectly sets up the data structure pointer, which is passed to the VBX when any of these types are used for a property array.

STATUS

Microsoft has confirmed this to be a problem in MFC version 2.0. This problem was corrected in MFC version 2.5.

MORE INFORMATION

This problem might have a variety of effects depending on the VBX. The specific problem is that when these types are used, the lp parameter (also known as lParam) passed to the VBX control procedure is set to -1.

For property arrays, this parameter is supposed to be a pointer to a structure of type DATASTRUCT. Most VBXs will attempt to access this structure and when an attempt is made to dereference the pointer, a GP fault occurs.

As an example, consider the following property declaration in the implementation of a VBX:

   PROPINFO Property_TestBool =
     {
       "TestBool",
       DT_BOOL | PF_fPropArray | PF_fGetMsg | PF_fSetMsg | PF_fNoShow,
       OFFSETIN(CIRC,TestBool)
     };

If an MFC application has a CVBControl pointer that points to a VBX with this property, and tries to set one of the elements in this DT_BOOL property array, a GP fault probably will result:

...

CVBControl *pCtrl = (CVBControl *)GetDlgItem(IDC_CIRC1); pCtrl->SetNumProperty("TestBool",0,1); // This line will GP fault.

...


Additional reference words: 1.00 2.00 gpf gp-fault
KBCategory: kbprg kbfixlist kbbuglist
KBSubcategory: MfcVBX
Keywords : kb16bitonly MfcVBX kbbuglist kbfixlist kbprg
Technology : kbMfc
Version : 1.00
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.