[prev in list] [next in list] [prev in thread] [next in thread]
List: ms-cryptoapi
Subject: Re: VB and the CryptoAPI
From: Nathan Spande <nathan () EPICSYS ! COM>
Date: 1998-02-18 15:04:58
[Download RAW message or body]
Ah, that explains it. I'm using some code I "borrowed" from the
Microsoft sample VB code, which has all of that error handling in a
function. So I'm always calling the function, in which the first line
of code is the Err.LastDLLError. Maybe I should make the error number a
function parameter. I'm not surprised that the MS code doesn't do the
right thing. That particular piece of VB is one of the ugliest I've
seen. *sigh* I guess nobody in MS develops in VB.
> -----Original Message-----
> From: Douglas Marquardt [SMTP:Douglas_Marquardt@EMAIL.MSN.COM]
> Sent: Tuesday, February 17, 1998 9:10 PM
> To: CryptoAPI@DISCUSS.MICROSOFT.COM
> Subject: Re: VB and the CryptoAPI
>
> Hi Nathan:
>
> >Third: don't count on Err.LastDLLError (or whatever the exact name
> is, I
> >forget) actually returning anything.
>
> I use this all the time when working with CAPI -- I have had no
> problems
> with it, it always returns the proper (one of the expected) error
> codes.
> The only thing I know of that you must do, is check this value
> *immediately*
> after the CAPI function returns, i.e.
>
> If Not CBool(CryptAcquireContext(hCryptProv, m_Container,
> m_Provider,
> PROV_RSA_FULL, 0)) Then
> 'Store in module level variable in case you need to reference the
> value
> later
> m_LastError = Err.LastDllError
> Select Case m_LastError
> Case NTE_KEYSET_NOT_DEF, NTE_BAD_KEYSET
> 'Couldn't get handle to existing container, so create default
> key
> container.
> If Not CBool(CryptAcquireContext(hCryptProv, m_Container,
> m_Provider,
> PROV_RSA_FULL, CRYPT_NEWKEYSET)) Then
> m_LastError = Err.LastDllError
> End If
> End Select
> End If
>
> Doug.
>
> ----------------------------------------------------------------
> Users Guide http://www.microsoft.com/sitebuilder/resource/mailfaq.asp
> contains important info including how to unsubscribe. Save time,
> search
> the archives at http://microsoft.ease.lsoft.com/archives/index.html
----------------------------------------------------------------
Users Guide http://www.microsoft.com/sitebuilder/resource/mailfaq.asp
contains important info including how to unsubscribe. Save time, search
the archives at http://microsoft.ease.lsoft.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