[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-cryptoapi
Subject:    CryptAcquireContext failed
From:       Stephan Wardell <wardell () NCSA ! UIUC ! EDU>
Date:       1998-12-07 23:22:36
[Download RAW message or body]


Hi,

I am also experiencing the following problem:

>In developping our own CSP  everything went OK with VisualC++ 5.0, CSP SDK
>2.0, and NT 4.0 SP3. After I have  installed VisulC++6.0 and recompiled the
>sources for the CSP,the test program failed at the first attempt to acquire
>a context: CryptAcquireContext returned NTE_PROVIDER_DLL_FAIL. I've tried
>couple of  times, but no success. The dll I got with VC++5.0 works perfect,
>the other one got with VC++6.0 doesn't work (same sources compiled, same
>conditions applied).

I've tried the given suggestions (copied below for reference), and when
stepping through the code, I found that my CSP's DllMain function was
called twice before CryptAcquireContext returned.

The first time DllMain was called from _DllMainCRTStartup with
DLL_PROCESS_ATTACH and returned TRUE. _DllMainCRTStartup then returned
TRUE, and when stepping through code from ADVAPI32, My DLLMain function was
called again with DLL_PROCESS_DETACH. It returned to _DllMainCRTStartup,
which returned TRUE, then back into NTDLL and ADVAPI32 before returning to
my source. CryptAcquireContext subsequently returned FALSE, and using
FormatMessage gave the response: "Provider DLL failed to initialize
correctly".

I would appreciate if anyone could give me any ideas on how to resolve this
problem; I cannot figure out why DllMain is being called twice. Thank you.

Stephan Wardell
wardell@ncsa.uiuc.edu


>  This indicates that your CSP failed to load, the call to LoadLibraryA from
>advapi32.dll on your DLL failed.  This typically happens because a DLL which
>your CSP is hard linked to cannot be found or cannot be loaded, but its
>possible your CSP is failing to load for some other reason.  You might try
>two things to figure out the problem, create a test program which links to
>your CSP and call CPAcquireContext in the test then run the test.  If a DLL
>can't be found then you should see a message box indicating this.  The other
>thing is to set a break point in your DLL entry point, step through the
>function to see if something is failing.
>Thanks Jeff

----------------------------------------------------------------
Users Guide http://www.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic