#include "stdafx.h"
#include <iostream>
#include "cryptoki.h"
#include "eTPkcs11.h"
#include <windows.h>
#include "stdlib.h"
using namespace std;
#define pkcs11_path "etpkcs11.DLL"
void init();
CK_FUNCTION_LIST_PTR pFunctionList=NULL;
CK_C_GetFunctionList pGFL = 0;
bool wasInit = false;
CK_SLOT_ID_PTR pSlotList;
CK_ULONG pulCount = 10;
CK_SLOT_INFO pInfo;
CK_RV rv;
void init()
{
HINSTANCE hLib = LoadLibrary((LPCWSTR) pkcs11_path);
if (hLib == NULL) {
printf("Error load library\n");
}
(FARPROC&)pGFL= GetProcAddress(hLib, "C_GetFunctionList");
if (pGFL == NULL) {
printf("Cannot find GetFunctionList().\n");
}
if (CKR_OK != pGFL(&pFunctionList)) {
printf("Can't get function list. \n");
}
if (CKR_OK != pFunctionList->C_Initialize (NULL_PTR)) {
printf("C_Initialize failed...\n");
}
}
int _tmain(int argc, _TCHAR* argv[])
{
init();
//CK_FUNCTION_LIST_PTR_PTR ppFL;
//C_GetFunctionList(ppFL);
//cout << ppFL;
cout << endl;
system("pause");
return 0;
}