~ubuntu-branches/ubuntu/jaunty/pcsc-lite/jaunty-security

« back to all changes in this revision

Viewing changes to src/dyn_win32.c

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Rousseau
  • Date: 2004-06-13 21:45:56 UTC
  • mfrom: (1.1.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20040613214556-zio7hrzkz9wwtffx
Tags: 1.2.9-beta2-2
* debian/rules: add -lpthread to LDFLAGS so that pthread_* symbols are
  included in the library (problem only seen on mips and mipsel).
  Closes: #253629
* debian/control: make libpcsclite-dev and libpcsclite1 at Priority:
  optional so that other packages at Priority: optional can use them.
  Closes: #249374

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * This abstracts dynamic library loading functions and timing.
 
3
 *
 
4
 * MUSCLE SmartCard Development ( http://www.linuxnet.com )
 
5
 *
 
6
 * Copyright (C) 1999
 
7
 *  David Corcoran <corcoran@linuxnet.com>
 
8
 *
 
9
 * $Id: dyn_win32.c,v 1.4 2004/05/11 13:50:18 rousseau Exp $
 
10
 */
 
11
 
 
12
#include "config.h"
 
13
#ifdef WIN32
 
14
#include <string.h>
 
15
 
 
16
#include "windows.h"
 
17
#include <winscard.h>
 
18
#include "dyn_generic.h"
 
19
#include "debuglog.h"
 
20
 
 
21
int DYN_LoadLibrary(void **pvLHandle, char *pcLibrary)
 
22
{
 
23
        *pvLHandle = NULL;
 
24
        *pvLHandle = LoadLibrary(pcLibrary);
 
25
 
 
26
        if (*pvLHandle == NULL)
 
27
        {
 
28
#if 0
 
29
                DebugLogB("DYN_LoadLibrary: dlerror() reports %s", dlerror());
 
30
#endif
 
31
                return SCARD_F_UNKNOWN_ERROR;
 
32
        }
 
33
 
 
34
        return SCARD_S_SUCCESS;
 
35
}
 
36
 
 
37
int DYN_CloseLibrary(void **pvLHandle)
 
38
{
 
39
        int ret;
 
40
 
 
41
        ret = FreeLibrary(*pvLHandle);
 
42
        *pvLHandle = NULL;
 
43
 
 
44
        /* If the function fails, the return value is zero. To get extended error
 
45
         * information, call GetLastError. */
 
46
        if (ret == 0)
 
47
        {
 
48
#if 0
 
49
                DebugLogB("DYN_CloseLibrary: dlerror() reports %s", dlerror());
 
50
#endif
 
51
                return SCARD_F_UNKNOWN_ERROR;
 
52
        }
 
53
 
 
54
        return SCARD_S_SUCCESS;
 
55
}
 
56
 
 
57
int DYN_GetAddress(void *pvLHandle, void **pvFHandle, char *pcFunction)
 
58
{
 
59
        int rv;
 
60
        char *pcFunctionName;
 
61
 
 
62
        /*
 
63
         * Zero out everything 
 
64
         */
 
65
        rv = 0;
 
66
        pcFunctionName = NULL;
 
67
 
 
68
        pcFunctionName = pcFunction;
 
69
 
 
70
        *pvFHandle = NULL;
 
71
        *pvFHandle = GetProcAddress(pvLHandle, pcFunctionName);
 
72
 
 
73
        if (*pvFHandle == NULL)
 
74
        {
 
75
#if 0
 
76
                DebugLogB("DYN_GetAddress: dlerror() reports %s", dlerror());
 
77
#endif
 
78
                rv = SCARD_F_UNKNOWN_ERROR;
 
79
        }
 
80
        else
 
81
                rv = SCARD_S_SUCCESS;
 
82
 
 
83
        return rv;
 
84
}
 
85
 
 
86
#endif  /* WIN32 */
 
87