Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2004

Tip: Looking for answers? Try searching our database.

buggy vc7 code? HELP!!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mfcmohan - 08 Jun 2004 10:36 GMT
I've built wizard application in .NET 2003. In the CPropertyPage constructor,
last param is passed by default as sizeof(PROPSHEETPAGE). Since I have
defined _WIN32_WINNT as 0x0500, this size is passed in as 48 (which is fine).
AllocPSP() in the constructor is now allocating 48 bytes. When I stepped during runtime into constructor code and further, in the following function:
void CPropertyPage::CommonConstruct(LPCTSTR lpszTemplateName, UINT

nIDCaption, UINT nIDHeaderTitle, UINT nIDHeaderSubTitle

    CommonConstruct(lpszTemplateName, nIDCaption)

    if (nIDHeaderTitle != 0
   
        VERIFY(m_strHeaderTitle.LoadString(nIDHeaderTitle))
        m_psp.dwSize = sizeof(m_psp); //here the size is always 52 bytes
   
    if (nIDHeaderSubTitle != 0
   
        VERIFY(m_strHeaderSubTitle.LoadString(nIDHeaderSubTitle))
        m_psp.dwSize = sizeof(m_psp);//here the size is always 52 bytes
   

m_psp.dwSize is overwritten as 52, since sizeof(m_psp) is compiled in the lib
as 52 bytes. In the disassembly, you can clearly see it
Eventually my application is crashing because of corrupted memory.

So if I build my application with _WIN32_WINNT defined as 0x0500, I have
buffer read overrun problems. Maybe Microsoft people should check this and
verify

At the moment, how do I solve this problem?
David Lowndes - 08 Jun 2004 13:36 GMT
>I've built wizard application in .NET 2003. In the CPropertyPage constructor,
>last param is passed by default as sizeof(PROPSHEETPAGE). Since I have
[quoted text clipped - 7 lines]
>So if I build my application with _WIN32_WINNT defined as 0x0500, I have
>buffer read overrun problems.

Do you have a few lines of code that uses CPropertySheet that
illustrates the problem you're seeing?

Dave

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.