Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC
  New Posts New Posts RSS Feed - Application crash due to skin framework
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedApplication crash due to skin framework

 Post Reply Post Reply
Author
Message
varvaripavel View Drop Down
Newbie
Newbie
Avatar

Joined: 14 December 2009
Location: Romania
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote varvaripavel Quote  Post ReplyReply Direct Link To This Post Topic: Application crash due to skin framework
    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
Back to Top
varvaripavel View Drop Down
Newbie
Newbie
Avatar

Joined: 14 December 2009
Location: Romania
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote varvaripavel Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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/
Back to Top
varvaripavel View Drop Down
Newbie
Newbie
Avatar

Joined: 14 December 2009
Location: Romania
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote varvaripavel Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.