ReactOS  0.4.14-dev-317-g96040ec
winscard.c
Go to the documentation of this file.
1 /*
2  * Copyright 2007 Mounir IDRASSI (mounir.idrassi@idrix.fr, for IDRIX)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 
19 #include "config.h"
20 #include <stdarg.h>
21 #include "windef.h"
22 #include "winbase.h"
23 #include "wine/debug.h"
24 #include "winscard.h"
25 #include "winternl.h"
26 
28 
30 
34 
35 
37 {
38  TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
39 
40  switch (fdwReason)
41  {
42  case DLL_PROCESS_ATTACH:
43  DisableThreadLibraryCalls(hinstDLL);
44  /* FIXME: for now, we act as if the pcsc daemon is always started */
46  break;
47  case DLL_PROCESS_DETACH:
48  if (lpvReserved) break;
50  break;
51  }
52 
53  return TRUE;
54 }
55 
57 {
58  return g_startedEvent;
59 }
60 
62 {
63  LONG retval;
64  UNICODE_STRING readerW, groupW;
65 
67  else readerW.Buffer = NULL;
69  else groupW.Buffer = NULL;
70 
71  retval = SCardAddReaderToGroupW(context, readerW.Buffer, groupW.Buffer);
72 
73  RtlFreeUnicodeString(&readerW);
74  RtlFreeUnicodeString(&groupW);
75 
76  return retval;
77 }
78 
80 {
81  FIXME("%x %s %s\n", (unsigned int) context, debugstr_w(reader), debugstr_w(group));
82  return SCARD_S_SUCCESS;
83 }
84 
86  LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
87 {
88  FIXME("(%x,%p,%p,%p) stub\n", dwScope, pvReserved1, pvReserved2, phContext);
91 }
92 
94 {
95  FIXME("(%lx) stub\n", context);
98 }
99 
100 LONG WINAPI SCardListCardsA(SCARDCONTEXT hContext, LPCBYTE pbAtr, LPCGUID rgguidInterfaces, DWORD cguidInterfaceCount, LPSTR mszCards, LPDWORD pcchCards)
101 {
102  FIXME(": stub\n");
104  return SCARD_F_INTERNAL_ERROR;
105 }
106 
108 {
109  FIXME("(%lx) stub\n", context);
111  return SCARD_F_INTERNAL_ERROR;
112 }
113 
114 LONG WINAPI SCardStatusA(SCARDHANDLE context, LPSTR szReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
115 {
116  FIXME("(%lx) stub\n", context);
118  return SCARD_F_INTERNAL_ERROR;
119 }
120 
121 LONG WINAPI SCardStatusW(SCARDHANDLE context, LPWSTR szReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState,LPDWORD pdwProtocol,LPBYTE pbAtr,LPDWORD pcbArtLen)
122 {
123  FIXME("(%lx) stub\n", context);
125  return SCARD_F_INTERNAL_ERROR;
126 }
127 
129 {
130  FIXME("stub\n");
131 }
132 
134 {
135  FIXME("(%lx, %s, %p, %p) stub\n", context, debugstr_a(groups), readers, buflen);
137 }
138 
140 {
141  FIXME("(%lx, %s, %p, %p) stub\n", context, debugstr_w(groups), readers, buflen);
143 }
LONG WINAPI SCardListReadersA(SCARDCONTEXT context, const CHAR *groups, CHAR *readers, DWORD *buflen)
Definition: winscard.c:133
#define SCARD_PROTOCOL_T0
Definition: winsmcrd.h:72
LONG WINAPI SCardReleaseContext(SCARDCONTEXT context)
Definition: winscard.c:107
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
Definition: http.c:6587
void WINAPI SCardReleaseStartedEvent(void)
Definition: winscard.c:128
char CHAR
Definition: xmlstorage.h:175
ULONG_PTR SCARDCONTEXT
Definition: winscard.h:37
LONG WINAPI SCardListReadersW(SCARDCONTEXT context, const WCHAR *groups, WCHAR *readers, DWORD *buflen)
Definition: winscard.c:139
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
LONG WINAPI SCardListCardsA(SCARDCONTEXT hContext, LPCBYTE pbAtr, LPCGUID rgguidInterfaces, DWORD cguidInterfaceCount, LPSTR mszCards, LPDWORD pcchCards)
Definition: winscard.c:100
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
LONG WINAPI SCardStatusA(SCARDHANDLE context, LPSTR szReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
Definition: winscard.c:114
char * LPSTR
Definition: xmlstorage.h:182
#define SCARD_PROTOCOL_T1
Definition: winsmcrd.h:73
static IN DWORD IN LPVOID lpvReserved
LONG WINAPI SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1, LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
Definition: winscard.c:85
ULONG_PTR * LPSCARDCONTEXT
Definition: winscard.h:37
unsigned char * LPBYTE
Definition: typedefs.h:52
#define SCARD_F_INTERNAL_ERROR
Definition: scarderr.h:32
GLsizei GLuint * groups
Definition: glext.h:11113
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
const SCARD_IO_REQUEST g_rgSCardRawPci
Definition: winscard.c:33
#define SCARD_PROTOCOL_RAW
Definition: winsmcrd.h:74
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz(_Out_ PUNICODE_STRING Destination, _In_ PCSZ Source)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:637
const char * LPCSTR
Definition: xmlstorage.h:183
LONG WINAPI SCardStatusW(SCARDHANDLE context, LPWSTR szReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbArtLen)
Definition: winscard.c:121
LONG WINAPI SCardAddReaderToGroupA(SCARDCONTEXT context, LPCSTR reader, LPCSTR group)
Definition: winscard.c:61
HANDLE WINAPI SCardAccessStartedEvent(void)
Definition: winscard.c:56
#define DLL_PROCESS_DETACH
Definition: compat.h:119
GLboolean GLuint group
Definition: glext.h:11120
#define TRACE(s)
Definition: solgame.cpp:4
#define SCARD_S_SUCCESS
Definition: scarderr.h:31
__wchar_t WCHAR
Definition: xmlstorage.h:180
static struct reader readers[]
Definition: readers.c:908
#define debugstr_a
Definition: kernel32.h:31
const SCARD_IO_REQUEST g_rgSCardT1Pci
Definition: winscard.c:32
ULONG_PTR SCARDHANDLE
Definition: winscard.h:38
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define SetLastError(x)
Definition: compat.h:409
static HANDLE g_startedEvent
Definition: winscard.c:29
LONG WINAPI SCardIsValidContext(SCARDCONTEXT context)
Definition: winscard.c:93
const SCARD_IO_REQUEST g_rgSCardT0Pci
Definition: winscard.c:31
#define SCARD_E_NO_READERS_AVAILABLE
Definition: scarderr.h:77
Definition: reader.h:83
CONST void * LPCVOID
Definition: windef.h:191
uint32_t * LPDWORD
Definition: typedefs.h:57
const BYTE * LPCBYTE
Definition: winscard.h:34
WINE_DEFAULT_DEBUG_CHANNEL(winscard)
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG WINAPI SCardAddReaderToGroupW(SCARDCONTEXT context, LPCWSTR reader, LPCWSTR group)
Definition: winscard.c:79
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: winscard.c:36