Print Page | Close Window

Application crash due to skin framework

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Visual C++ MFC
Forum Description: Topics related to Codejock Visual C++ MFC products
URL: http://forum.codejock.com/forum_posts.asp?TID=17330
Printed Date: 26 April 2024 at 7:48am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Application crash due to skin framework
Posted By: varvaripavel
Subject: Application crash due to skin framework
Date Posted: 26 September 2010 at 10:46am
Hi,

I have an application which uses the skin framework:

    XTPSkinManager()->SetApplyOptions( ... );
    XTPSkinManager()->LoadSkin( ... );

Nothing special and everything works nice util I need to print something. Then, the application carshes (more exactley, the crash is in a thread related to the driver); somehow, the printer driver interfes with the skin manager.

The cause it's pretty obvious because the crash doesn't appear when the skin manager it's not activated.

I tried to disable the skins for the printing module - but the crashes appear again.

    XTPSkinManager()->SetAutoApplyNewWindows( FALSE );
    XTPSkinManager()->SetAutoApplyNewThreads( FALSE );

or even:

    XTPSkinManager()->RemoveAll();

The problem it's pretty bad since, at this point I have to decide wheather I keep the skin or the crashes.

Do you have any idea how I could fix (or avoid) this ?

Pavel Varvari
XISOFT SRL



Replies:
Posted By: varvaripavel
Date Posted: 28 September 2010 at 4:07pm
I figure out to make a fix (not the best) for the problem:

void CXTPSkinManagerApiHook::InitializeHookManagement()
{
   .........

        if (XTPSkinManager()->GetAutoApplyNewThreads() == TRUE )
        {
            ADDHOOK("KERNEL32.DLL", LoadLibraryA);
            ADDHOOK("KERNEL32.DLL", LoadLibraryW);
            ADDHOOK("KERNEL32.DLL", LoadLibraryExA);
            ADDHOOK("KERNEL32.DLL", LoadLibraryExW);
            ADDHOOK("KERNEL32.DLL", GetProcAddress);
            ADDHOOK("KERNEL32.DLL", GetModuleHandleA);

            ADDHOOK("KERNEL32.DLL", CreateThread);
        }

    ..................
}

So, the problem is due to one (or more from the hooks above)

You can reproduce it on Windows Vista or XP with the official drivers from HP LaserJet 1320 printers (I guess other HP drivers, too). Just try to repeat a few times the print preview / configure options in a default application with skins.



Posted By: znakeeye
Date Posted: 06 October 2010 at 3:25am
Probably, your exe loads a dll/ocx that is not compatible with the skinning hook. Look in your "Output window" and see if a suspicious DLL (presumably with GUI) is loaded when printing. Then do the following:
 
XTPSkinManager()->ExcludeModule("BadLib.dll");


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: varvaripavel
Date Posted: 06 October 2010 at 3:39am
That would be an idea but, you cannot know the "BadLib.dll"; I mean, I could exclude a certain DLL (like "HP_Driver.dll") but there could always be a new one (like "Canon_Driver.dll")

I posted a better solution but the comment was not approved yet :P



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net