I could suggest using the Crypto++ lib instead of the DLL, which is what I am doing... But I'll assume you have a reason not to.
Perhaps you could wrap the Windows kernel32.dll provided heap functions with your own 'new' and 'delete' and pass these to Crypto++? So that it will only be referencing a library which is guaranteed to be loaded even in DllMain? Or, as you mention, calling DoDllPowerUpSelfTest manually seems like a rather good workaround. Tim On Jan 16, 10:57 pm, Mihajlo Cvetanovic <[EMAIL PROTECTED]> wrote: > Hi Tim, > > Sorry for replying to you so late, I was checking the Google groups > but not my personal mail. I hope you don't mind me reposting this back > to the group. > > The thing is I'm not doing anything in DllMain, but the cryptopp.dll > does. And the whole post of mine is referring to the DllMain of > cryptopp.dll, and the function DoDllPowerUpSelfTest that is being > called from there. > > So, the question remains, should I call DoDllPowerUpSelfTest by > myself, or is there some other (proper) solution? > > On Jan 12, 2008 1:34 AM, Tim Lovell-Smith <[EMAIL PROTECTED]> wrote: > > At a guess, it is probably failing because you are in DllMain. See > these articles: > > "Some reasons not to do anything scary in your DllMain" > > http://blogs.msdn.com/oldnewthing/archive/2004/01/27/63401.aspx > > "Things you shouldn't do, Part 1: DllMain is special" > > http://blogs.msdn.com/larryosterman/archive/2004/04/23/118979.aspx > > Tim > > On Jan 11, 3:09 am, Mihajlo Cvetanovic <[EMAIL PROTECTED]> > wrote: > > Hi all, > > > > I'm newbie to Cryptopp but not to cryptography in general. I'm > using > > cryptopp.dll v5.2.3 with VC2003, and I'm building my own (non- > MFC) dll > > that is supposed to use cryptopp.dll. Main settings are /MTd > and /D > > "CRYPTOPP_DLL_ONLY". It seems that none of the three options in > the > > "DLL Memory Management" section of readme.txt is working for me. > All > > three cases fail in the call to DoDllPowerUpSelfTest from > DllMain: > > > > 1. If I use GetNewAndDeleteForCryptoPP then first called "new" > causes > > stack overflow because CRT is not loaded yet (trying to create > heap > > critical section ad infinitum). Bad idea to use CRT in DllMain > > anyway... > > > > 2. If I use SetNewAndDeleteFromCryptoPP then first test fails > when > > CryptAcquireContext is called from MicrosoftCryptoProvider > > constructor. > > > > 3. If I don't use anything then "new" from msvcrt.dll is used > > (accidentally found in advapi32.dll), but first call to it > fails. > > > > In all three cases execution ends up in catch(...) in > > DoDllPowerUpSelfTest (thanks to VC treat-OS-exceptions-as-CPP- > > exceptions "feature") and the function fails. > > > > So, what am I doing wrong? If I use option 2 and call > > DoDllPowerUpSelfTest on my own then it seems to work, but this > looks > > to me as a workaround. Is there a proper solution? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [EMAIL PROTECTED] More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
