Microsoft KB Archive/113533

{|
 * width="100%"|

FIX: SetNumProperty GP Faults with Some Property Array Types

 * }

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 kbMFC kbVBX kbVC

Issue type :

Technology : kbAudDeveloper kbMFC