/* $Id: PKICheck.c $ */
/* A simple Windows program to display the CryptoSys PKI Details */
/* $Date: 2010-04-25 18:13:00 $ */
#define WIN32_LEAN_AND_MEAN
#define STRICT
#include <windows.h>
#include "diCrPKI.h"
/* Link to library in same dir as this source.
* This works in MSVC and Borland - you may need to do otherwise
* to link to the library.
*/
#if _MSC_VER >= 1400
/* This should work in MS VS2005 and above */
#if _WIN64
#if _DEBUG
#define MYLIBDIR "../x64/Debug/"
#else
#define MYLIBDIR "../x64/Release/"
#endif
#else
#if _DEBUG
#define MYLIBDIR "../Debug/"
#else
#define MYLIBDIR "../Release/"
#endif
#endif
#pragma comment(lib, MYLIBDIR "diCrPKI.lib")
#elif defined(_WIN32) || defined(WIN32)
/* Link to library in same dir as this source.
* This works in old MSVC++ and Borland.
*/
//#pragma comment(lib, ".\\diCrPKI.lib")
#endif
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{
char msg[2048];
char compiled[255];
char modname[MAX_PATH];
long ver, lic, iswin64;
/* Get details from PKI */
ver = PKI_Version(NULL, NULL);
PKI_CompileTime(compiled, sizeof(compiled)-1);
PKI_ModuleName(modname, sizeof(modname)-1, 0);
lic = PKI_LicenceType(0);
/* New in version 3.4: check if DLL is compiled for Win64 */
iswin64 = PKI_LicenceType(PKI_GEN_PLATFORM); /* Returns 1 if X64 or 0 if Win32 */
/* Compose into a string */
wsprintf(msg, "Version=%ld\r\nLicence Type=%c\r\nModule=%s\r\nPlatform=%s\r\nCompiled=%s",
ver, lic, modname, (iswin64 ? "X64" : "Win32"), compiled);
/* Display */
MessageBox(NULL, msg, "CryptoSys PKI Check", 0);
return 0;
}