ReactOS  0.4.15-dev-326-g1c504f4
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 <stdarg.h>
20 #include "windef.h"
21 #include "winbase.h"
22 #include "wine/debug.h"
23 #include "winscard.h"
24 #include "winternl.h"
25 
27 
29 
33 
34 
36 {
37  TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
38 
39  switch (fdwReason)
40  {
41  case DLL_PROCESS_ATTACH:
42  DisableThreadLibraryCalls(hinstDLL);
43  /* FIXME: for now, we act as if the pcsc daemon is always started */
45  break;
46  case DLL_PROCESS_DETACH:
47  if (lpvReserved) break;
49  break;
50  }
51 
52  return TRUE;
53 }
54 
56 {
57  return g_startedEvent;
58 }
59 
61 {
62  LONG retval;
63  UNICODE_STRING readerW, groupW;
64 
66  else readerW.Buffer = NULL;
68  else groupW.Buffer = NULL;
69 
70  retval = SCardAddReaderToGroupW(context, readerW.Buffer, groupW.Buffer);
71 
72  RtlFreeUnicodeString(&readerW);
73  RtlFreeUnicodeString(&groupW);
74 
75  return retval;
76 }
77 
79 {
80  FIXME("%x %s %s\n", (unsigned int) context, debugstr_w(reader), debugstr_w(group));
81  return SCARD_S_SUCCESS;
82 }
83 
85  LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
86 {
87  FIXME("(%x,%p,%p,%p) stub\n", dwScope, pvReserved1, pvReserved2, phContext);
90 }
91 
93 {
94  FIXME("(%lx) stub\n", context);
97 }
98 
99 LONG WINAPI SCardListCardsA(SCARDCONTEXT hContext, LPCBYTE pbAtr, LPCGUID rgguidInterfaces, DWORD cguidInterfaceCount, LPSTR mszCards, LPDWORD pcchCards)
100 {
101  FIXME(": stub\n");
103  return SCARD_F_INTERNAL_ERROR;
104 }
105 
107 {
108  FIXME("(%lx) stub\n", context);
110  return SCARD_F_INTERNAL_ERROR;
111 }
112 
113 LONG WINAPI SCardStatusA(SCARDHANDLE context, LPSTR szReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
114 {
115  FIXME("(%lx) stub\n", context);
117  return SCARD_F_INTERNAL_ERROR;
118 }
119 
120 LONG WINAPI SCardStatusW(SCARDHANDLE context, LPWSTR szReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState,LPDWORD pdwProtocol,LPBYTE pbAtr,LPDWORD pcbArtLen)
121 {
122  FIXME("(%lx) stub\n", context);
124  return SCARD_F_INTERNAL_ERROR;
125 }
126 
128 {
129  FIXME("stub\n");
130 }
131 
133 {
134  FIXME("(%lx, %s, %p, %p) stub\n", context, debugstr_a(groups), readers, buflen);
136 }
137 
139 {
140  FIXME("(%lx, %s, %p, %p) stub\n", context, debugstr_w(groups), readers, buflen);
142 }
143 
145 {
146  FIXME("(%lx) stub\n", context);
148  return SCARD_F_INTERNAL_ERROR;
149 }
LONG WINAPI SCardListReadersA(SCARDCONTEXT context, const CHAR *groups, CHAR *readers, DWORD *buflen)
Definition: winscard.c:132
#define SCARD_PROTOCOL_T0
Definition: winsmcrd.h:72
LONG WINAPI SCardReleaseContext(SCARDCONTEXT context)
Definition: winscard.c:106
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:407
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
Definition: http.c:7094
void WINAPI SCardReleaseStartedEvent(void)
Definition: winscard.c:127
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:138
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:99
#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:113
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:84
ULONG_PTR * LPSCARDCONTEXT
Definition: winscard.h:37
unsigned char * LPBYTE
Definition: typedefs.h:53
#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:111
const SCARD_IO_REQUEST g_rgSCardRawPci
Definition: winscard.c:32
#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:120
LONG WINAPI SCardAddReaderToGroupA(SCARDCONTEXT context, LPCSTR reader, LPCSTR group)
Definition: winscard.c:60
HANDLE WINAPI SCardAccessStartedEvent(void)
Definition: winscard.c:55
#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:31
ULONG_PTR SCARDHANDLE
Definition: winscard.h:38
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define SetLastError(x)
Definition: compat.h:418
static HANDLE g_startedEvent
Definition: winscard.c:28
LONG WINAPI SCardIsValidContext(SCARDCONTEXT context)
Definition: winscard.c:92
const SCARD_IO_REQUEST g_rgSCardT0Pci
Definition: winscard.c:30
#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:58
const BYTE * LPCBYTE
Definition: winscard.h:34
WINE_DEFAULT_DEBUG_CHANNEL(winscard)
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
LONG WINAPI SCardCancel(SCARDCONTEXT context)
Definition: winscard.c:144
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG WINAPI SCardAddReaderToGroupW(SCARDCONTEXT context, LPCWSTR reader, LPCWSTR group)
Definition: winscard.c:78
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
Definition: winscard.c:35