#pragma once

#include <Windows.h>

#include "./pkcs11_v2.2/cryptoki.h"


#define ERROR_THROW(r) {if(r != 0) goto END_OF_FUN;}
#define ERROR_RETURN(r) {if(r != 0) return r;}

#define countof(a) (sizeof(a)/ sizeof(CK_ATTRIBUTE))


class pkcs11_wrapper
{
public:
	pkcs11_wrapper(void);
	~pkcs11_wrapper(void);

public:
	long pkcs11_initialize(char * libName);
	long pkcs11_finalize();

	CK_FUNCTION_LIST_PTR GetFunctionsPtr() { return m_pFunctions; }
public:

private:
	HMODULE m_hLibModule;

	CK_FUNCTION_LIST_PTR m_pFunctions;

};