By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,275 Members | 920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,275 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.