2007-05-23 00:51:46 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2007 Mounir IDRASSI (mounir.idrassi@idrix.fr, for IDRIX)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wine/debug.h"
|
2007-08-30 16:17:39 +02:00
|
|
|
#include "winscard.h"
|
2008-10-08 23:25:42 +02:00
|
|
|
#include "winternl.h"
|
2007-05-23 00:51:46 +02:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(winscard);
|
|
|
|
|
2008-10-20 23:03:39 +02:00
|
|
|
static HANDLE g_startedEvent = NULL;
|
2007-05-23 00:51:46 +02:00
|
|
|
|
|
|
|
const SCARD_IO_REQUEST g_rgSCardT0Pci = { SCARD_PROTOCOL_T0, 8 };
|
|
|
|
const SCARD_IO_REQUEST g_rgSCardT1Pci = { SCARD_PROTOCOL_T1, 8 };
|
|
|
|
const SCARD_IO_REQUEST g_rgSCardRawPci = { SCARD_PROTOCOL_RAW, 8 };
|
|
|
|
|
|
|
|
|
|
|
|
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
|
|
{
|
|
|
|
TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved);
|
|
|
|
|
|
|
|
switch (fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
2008-10-20 23:03:39 +02:00
|
|
|
/* FIXME: for now, we act as if the pcsc daemon is always started */
|
|
|
|
g_startedEvent = CreateEventA(NULL,TRUE,TRUE,NULL);
|
2007-05-23 00:51:46 +02:00
|
|
|
break;
|
|
|
|
case DLL_PROCESS_DETACH:
|
2013-05-17 12:18:10 +02:00
|
|
|
if (lpvReserved) break;
|
2008-10-20 23:03:39 +02:00
|
|
|
CloseHandle(g_startedEvent);
|
2007-05-23 00:51:46 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2007-06-19 17:00:35 +02:00
|
|
|
|
2008-10-20 23:03:39 +02:00
|
|
|
HANDLE WINAPI SCardAccessStartedEvent(void)
|
|
|
|
{
|
|
|
|
return g_startedEvent;
|
|
|
|
}
|
|
|
|
|
2008-10-08 23:25:42 +02:00
|
|
|
LONG WINAPI SCardAddReaderToGroupA(SCARDCONTEXT context, LPCSTR reader, LPCSTR group)
|
|
|
|
{
|
|
|
|
LONG retval;
|
|
|
|
UNICODE_STRING readerW, groupW;
|
|
|
|
|
|
|
|
if(reader) RtlCreateUnicodeStringFromAsciiz(&readerW,reader);
|
|
|
|
else readerW.Buffer = NULL;
|
|
|
|
if(group) RtlCreateUnicodeStringFromAsciiz(&groupW,group);
|
|
|
|
else groupW.Buffer = NULL;
|
|
|
|
|
|
|
|
retval = SCardAddReaderToGroupW(context, readerW.Buffer, groupW.Buffer);
|
|
|
|
|
|
|
|
RtlFreeUnicodeString(&readerW);
|
|
|
|
RtlFreeUnicodeString(&groupW);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG WINAPI SCardAddReaderToGroupW(SCARDCONTEXT context, LPCWSTR reader, LPCWSTR group)
|
|
|
|
{
|
|
|
|
FIXME("%x %s %s\n", (unsigned int) context, debugstr_w(reader), debugstr_w(group));
|
|
|
|
return SCARD_S_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-06-19 17:00:35 +02:00
|
|
|
LONG WINAPI SCardEstablishContext(DWORD dwScope, LPCVOID pvReserved1,
|
|
|
|
LPCVOID pvReserved2, LPSCARDCONTEXT phContext)
|
|
|
|
{
|
|
|
|
FIXME("(%x,%p,%p,%p) stub\n", dwScope, pvReserved1, pvReserved2, phContext);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return SCARD_F_INTERNAL_ERROR;
|
|
|
|
}
|
2009-08-31 01:59:16 +02:00
|
|
|
|
2010-07-16 20:20:52 +02:00
|
|
|
LONG WINAPI SCardIsValidContext(SCARDCONTEXT context)
|
|
|
|
{
|
|
|
|
FIXME("(%lx) stub\n", context);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return SCARD_F_INTERNAL_ERROR;
|
|
|
|
}
|
|
|
|
|
2009-08-31 01:59:16 +02:00
|
|
|
LONG WINAPI SCardListCardsA(SCARDCONTEXT hContext, LPCBYTE pbAtr, LPCGUID rgguidInterfaces, DWORD cguidInterfaceCount, LPSTR mszCards, LPDWORD pcchCards)
|
|
|
|
{
|
|
|
|
FIXME(": stub\n");
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return SCARD_F_INTERNAL_ERROR;
|
|
|
|
}
|
2010-07-16 20:20:52 +02:00
|
|
|
|
|
|
|
LONG WINAPI SCardReleaseContext(SCARDCONTEXT context)
|
|
|
|
{
|
|
|
|
FIXME("(%lx) stub\n", context);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return SCARD_F_INTERNAL_ERROR;
|
|
|
|
}
|
2010-10-26 23:12:20 +02:00
|
|
|
|
2012-01-25 08:44:00 +01:00
|
|
|
LONG WINAPI SCardStatusA(SCARDHANDLE context, LPSTR szReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, LPBYTE pbAtr, LPDWORD pcbAtrLen)
|
|
|
|
{
|
|
|
|
FIXME("(%lx) stub\n", context);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return SCARD_F_INTERNAL_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG WINAPI SCardStatusW(SCARDHANDLE context, LPWSTR szReaderName, LPDWORD pcchReaderLen, LPDWORD pdwState,LPDWORD pdwProtocol,LPBYTE pbAtr,LPDWORD pcbArtLen)
|
|
|
|
{
|
|
|
|
FIXME("(%lx) stub\n", context);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return SCARD_F_INTERNAL_ERROR;
|
|
|
|
}
|
|
|
|
|
2010-10-26 23:12:20 +02:00
|
|
|
void WINAPI SCardReleaseStartedEvent(void)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|
2016-03-21 04:58:27 +01:00
|
|
|
|
|
|
|
LONG WINAPI SCardListReadersA(SCARDCONTEXT context, const CHAR *groups, CHAR *readers, DWORD *buflen)
|
|
|
|
{
|
|
|
|
FIXME("(%lx, %s, %p, %p) stub\n", context, debugstr_a(groups), readers, buflen);
|
|
|
|
return SCARD_E_NO_READERS_AVAILABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG WINAPI SCardListReadersW(SCARDCONTEXT context, const WCHAR *groups, WCHAR *readers, DWORD *buflen)
|
|
|
|
{
|
|
|
|
FIXME("(%lx, %s, %p, %p) stub\n", context, debugstr_w(groups), readers, buflen);
|
|
|
|
return SCARD_E_NO_READERS_AVAILABLE;
|
|
|
|
}
|
2018-09-25 22:46:46 +02:00
|
|
|
|
|
|
|
LONG WINAPI SCardCancel(SCARDCONTEXT context)
|
|
|
|
{
|
|
|
|
FIXME("(%lx) stub\n", context);
|
|
|
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
|
|
return SCARD_F_INTERNAL_ERROR;
|
|
|
|
}
|