473,385 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

vc++8.0 bug: access violtation upon any call of any CImageList methods

I have sucessfully imported and compiled a complex MFC 6.0 project from
vc++6.0 (MFC6.0) into vc++ 8.0 (MFC 8.0). It contains several
subprojects (libs and dlls). In vc++ 6.0 those project linked MFC6.0
statically and after I imported it to vc++ 8.0 I set the linkage of
MFC8.0 to "shared". However when I try to compile and link the project
in vc++ 8.0 in release mode (debugmode works fine) I get an acess
violation in afxcomctl32.inl. This happnes whenever I call any of the
CImageList methods. When I comment out all lines that call mehtods of
CImageList everything work fine in release mode too.

When I look at the disassembly the crash pattern is always the same. The
access violation always happens after a call of AfxGetModuleState and
before a call to CComCtlWrapper::_ImageList_XXX

disassembly:

004DE7F5 call AfxGetModuleState (49CE2Ah)
004DE7FA mov eax,dword ptr [eax+90h] // it is always 90h added
004DE800 mov ecx,dword ptr [eax] <------------ access
violation !!!!
004DE802 call CComCtlWrapper::_ImageList_GetIcon (49E158h)
( the last line can be interchanged by
CComCtlWrapper::_ImageList_GetImageCount (49A805h) or any other call to
CImageList mehtods )

registers:

EAX = 00000004 EBX = 00180940 ECX = 781FF81B EDX = 782BA9DC
ESI = 7821A936 EDI = 00000000 EIP = 004DE800 ESP = 0012BB04
EBP = 0012BB5C EFL = 00000206

Can any explain what is going on here and give me hints how to solve
this problem? What does AfxGetModuleState do? What is afxcomctl32.inl ?
What could be obvious places to look for ? Is this a know bug in vc++ 8?
I have found a bug in vc++ 8.0 that is STILL UNRESOLVED that somehow
looks a little similar to mine:
http://forums.microsoft.com/MSDN/Sho...2410&SiteID=1*
*Nevertheless the problem described there and the workaround suggested
does not fit here, since all of my projects have the allignment set to
default and nowhere in my project I see any #pragma pack directives.

Also I wonder what the purpose of the addition of 90h in this line is:
004DE7FA mov eax,dword ptr [eax+90h]
Dec 14 '05 #1
1 2568
"Robert Ludewig" <rl******@gmx.de> wrote in message
news:Oz**************@tk2msftngp13.phx.gbl...
I have sucessfully imported and compiled a complex MFC 6.0 project from
vc++6.0 (MFC6.0) into vc++ 8.0 (MFC 8.0). It contains several subprojects
(libs and dlls). In vc++ 6.0 those project linked MFC6.0 statically and
after I imported it to vc++ 8.0 I set the linkage of MFC8.0 to "shared".
However when I try to compile and link the project in vc++ 8.0 in release
mode (debugmode works fine) I get an acess violation in afxcomctl32.inl.
This happnes whenever I call any of the CImageList methods. When I comment
out all lines that call mehtods of CImageList everything work fine in
release mode too.

When I look at the disassembly the crash pattern is always the same. The
access violation always happens after a call of AfxGetModuleState and
before a call to CComCtlWrapper::_ImageList_XXX

disassembly:

004DE7F5 call AfxGetModuleState (49CE2Ah)
004DE7FA mov eax,dword ptr [eax+90h] // it is always 90h added
004DE800 mov ecx,dword ptr [eax] <------------ access violation
!!!!
004DE802 call CComCtlWrapper::_ImageList_GetIcon (49E158h)
( the last line can be interchanged by
CComCtlWrapper::_ImageList_GetImageCount (49A805h) or any other call to
CImageList mehtods )

registers:

EAX = 00000004 EBX = 00180940 ECX = 781FF81B EDX = 782BA9DC
ESI = 7821A936 EDI = 00000000 EIP = 004DE800 ESP = 0012BB04
EBP = 0012BB5C EFL = 00000206

Can any explain what is going on here and give me hints how to solve this
problem? What does AfxGetModuleState do? What is afxcomctl32.inl ? What
could be obvious places to look for ? Is this a know bug in vc++ 8? I have
found a bug in vc++ 8.0 that is STILL UNRESOLVED that somehow looks a
little similar to mine:
http://forums.microsoft.com/MSDN/Sho...2410&SiteID=1*
*Nevertheless the problem described there and the workaround suggested
does not fit here, since all of my projects have the allignment set to
default and nowhere in my project I see any #pragma pack directives.

Also I wonder what the purpose of the addition of 90h in this line is:
004DE7FA mov eax,dword ptr [eax+90h]


That probably may be the bug of a compiler.
When you invoke function it stores the resulting value in EAX register. The
ECX register is used to store the offset on a class object, so when you
invoke CComCtlWrapper::_ImageList_GetIcon it uses ECX inside to get an
access to the data of a class.
mov eax,dword ptr [eax+90h] ;
also seems strange to me. That probably not a bug of CImageList . Try to
rewrite that part of code using _asm keyword.

// pseudocode, I don't have VC8 over here..
__asm {
; make pushes if necessary
call AfxGetModuleState
mov ecx,eax
; make pushes if necessary
call CComCtlWrapper::_ImageList_GetIcon }

--
Vladimir
Dec 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
8
by: Paul | last post by:
Hi all may I know how to use C# DLL inside my VC++ Project ? Thanks in advance.
1
by: | last post by:
Serious bug discovered in VC .NET (2002) compiler. Example below should work if I understand the Microsoft documentation correctly. Hopfelly there is some compiler upgrade that fixes this bug?...
2
by: vemulakiran | last post by:
Hi all, I have doubt regarding .NET. I have a tool which was developed on VC++ 6.0(Win32 Application ). The application communicates with library (API) which was developed on VC++ 6.0 called core...
1
by: Steve | last post by:
We are considering the ways to migrate our VC++ 6.0 applications to .NET platform. It would be nice to rewrite them completely in C#, but due to the time constraints this option is out of...
5
by: Felix I. Wyss | last post by:
Good Afternoon, I recently noticed that some very simple methods of a template declared and used in a DLL library get inlined when used by the DLL itself, but not by other DLLs and EXEs. After...
6
by: Felix I. Wyss | last post by:
It appears that VC++2003 has a code generator bug related to template parameters that are a pointer-to-member type: If the actual template argument is a virtual method, VC generates code that...
1
by: Bern McCarty | last post by:
What do you make of this? I cannot tell for sure but it almost seems as the the transition thunk to get back from the native bool method to the managed caller is looking at eax and, if any bit is...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.