00001
00002
00003
00004
00005
00006
00007
00008
00009
00015 #include "config.h"
00016 #ifdef WIN32
00017 #include <string.h>
00018
00019 #include "windows.h"
00020 #include <winscard.h>
00021 #include "dyn_generic.h"
00022 #include "debug.h"
00023
00024 int DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
00025 {
00026 *pvLHandle = NULL;
00027 *pvLHandle = LoadLibrary(pcLibrary);
00028
00029 if (*pvLHandle == NULL)
00030 {
00031 #if 0
00032 Log2(PCSC_LOG_ERROR, "DYN_LoadLibrary: dlerror() reports %s", dlerror());
00033 #endif
00034 return SCARD_F_UNKNOWN_ERROR;
00035 }
00036
00037 return SCARD_S_SUCCESS;
00038 }
00039
00040 int DYN_CloseLibrary(void **pvLHandle)
00041 {
00042 int ret;
00043
00044 ret = FreeLibrary(*pvLHandle);
00045 *pvLHandle = NULL;
00046
00047
00048
00049 if (ret == 0)
00050 {
00051 #if 0
00052 Log2(PCSC_LOG_ERROR, "DYN_CloseLibrary: dlerror() reports %s", dlerror());
00053 #endif
00054 return SCARD_F_UNKNOWN_ERROR;
00055 }
00056
00057 return SCARD_S_SUCCESS;
00058 }
00059
00060 int DYN_GetAddress(void *pvLHandle, void **pvFHandle, char *pcFunction)
00061 {
00062 int rv;
00063 char *pcFunctionName;
00064
00065
00066
00067
00068 rv = 0;
00069 pcFunctionName = NULL;
00070
00071 pcFunctionName = pcFunction;
00072
00073 *pvFHandle = NULL;
00074 *pvFHandle = GetProcAddress(pvLHandle, pcFunctionName);
00075
00076 if (*pvFHandle == NULL)
00077 {
00078 #if 0
00079 Log2(PCSC_LOG_ERROR, "DYN_GetAddress: dlerror() reports %s", dlerror());
00080 #endif
00081 rv = SCARD_F_UNKNOWN_ERROR;
00082 }
00083 else
00084 rv = SCARD_S_SUCCESS;
00085
00086 return rv;
00087 }
00088
00089 #endif
00090