Retrieves the last error message set by the toolkit.
Public Declare Function PKI_LastError Lib "diCrPKI.dll"
(ByVal strErrMsg As String, ByVal nMaxMsgLen As Long) As Long
nRet = PKI_LastError(strErrMsg, nMaxMsgLen)
String to receive last error message.Long specifying the maximum length of the string to be copied.
long _stdcall PKI_LastError(char *szErrMsg, long nMsgLen);
Long: If the preceding function call before calling PKI_LastError
was successful, the return value is
zero indicating no error; otherwise it is the number of characters that have been set in strErrMsg.
If the function is called with nMaxMsgLen set to zero or strErrMsg as NULL, the return value is the number of characters
in the error message.
Not all functions set the error message string. The error message will never be longer than 511 characters.
These wrapper functions can be used to obtain the last error message.
Public Function pkiGetLastError() As String
Dim sErrMsg As String
Dim nLen As Long
nLen = 511
sErrMsg = String$(nLen, " ")
nLen = PKI_LastError(sErrMsg, nLen)
sErrMsg = Left$(sErrMsg, nLen)
pkiGetLastError = sErrMsg
End Function
void disp_error(long lRet)
{
char szErrMsg[512];
PKI_LastError(szErrMsg, sizeof(szErrMsg)-1);
printf("%ld %s\n", lRet, szErrMsg);
}
PKI_ErrorCode PKI_ErrorLookup Error codes