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);
|
|
|
|
|
|
|
|
static HMODULE WINSCARD_hModule;
|
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);
|
|
|
|
WINSCARD_hModule = 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:
|
2008-10-20 23:03:39 +02:00
|
|
|
{
|
|
|
|
CloseHandle(g_startedEvent);
|
2007-05-23 00:51:46 +02:00
|
|
|
break;
|
2008-10-20 23:03:39 +02:00
|
|
|
}
|
2007-05-23 00:51:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
void WINAPI SCardReleaseStartedEvent(void)
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
}
|