For Programmers: Free Programming Magazines  


Home > Archive > VC Language > November 2005 > Re: LoadLibrary("rsaenh.dll") succeeds in Debugger, fails otherwise (Win 20









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: LoadLibrary("rsaenh.dll") succeeds in Debugger, fails otherwise (Win 20
Oleg Starodumov

2005-11-24, 7:01 pm


>I call LoadLibrary("rsaenh.dll") from a huge MFC MDI application (which is
> done implicitly by CryptAcquireContext(), my actual target API call :)).
> On Windows 2003 Server it fails, GetLastError() yields
> 0x000003E6 == 998 == ERROR_NOACCESS ("Invalid access to memory location")
> which probably means an access violation during dll startup.
> But if I connect a remote debugger (msvcmon -anyuser -tcpip) just before the
> LoadLibrary() call, it succeeds.
> Also on WinXP and Win2000 Server the call succeeds (even without debugger).
>


If the exception is not reproducible under debugger, you can try to register (for debugging
purposes only) a vectored exception handler (see AddVectoredExceptionHandler function)
and use it to monitor exceptions and determine which exception is thrown in this case.
After you have recognized the exception, suspend the application while in the vectored handler
(I mean Sleep, MessageBox, etc.), and attach debugger to it. Then use the exception's
context record (passed to the handler in EXCEPTION_POINTERS parameter) to get
more information about the exception (you will get best results with WinDbg and .cxr
command - then it should be possible to see the call stack at the moment when
the exception was thrown).

Regards,
Oleg
[VC++ MVP]



Oleg Starodumov

2005-11-24, 7:01 pm


> After you have recognized the exception, suspend the application while in the vectored handler
> (I mean Sleep, MessageBox, etc.), and attach debugger to it.


And if the debugger fails to attach to the process (it can happen in this case),
use WinDbg in noninvasive mode.

Oleg


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com