Commit 26c72e91 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winscard: Implement SCardTransmit().

parent 094161f3
......@@ -44,6 +44,7 @@ LONG SCardDisconnect( UINT64, UINT64 );
LONG SCardReconnect( UINT64, UINT64, UINT64, UINT64, UINT64 * );
LONG SCardBeginTransaction( UINT64 );
LONG SCardEndTransaction( UINT64, UINT64 );
LONG SCardTransmit( UINT64, const struct io_request *, const BYTE *, UINT64, struct io_request *, BYTE *, UINT64 * );
static NTSTATUS scard_establish_context( void *args )
{
......@@ -126,6 +127,13 @@ static NTSTATUS scard_end_transaction( void *args )
return SCardEndTransaction( params->handle, params->disposition );
}
static NTSTATUS scard_transmit( void *args )
{
struct scard_transmit_params *params = args;
return SCardTransmit( params->handle, params->send, params->send_buf, params->send_buflen, params->recv,
params->recv_buf, params->recv_buflen );
}
const unixlib_entry_t __wine_unix_call_funcs[] =
{
scard_establish_context,
......@@ -141,4 +149,5 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
scard_disconnect,
scard_begin_transaction,
scard_end_transaction,
scard_transmit,
};
......@@ -121,6 +121,23 @@ struct scard_end_transaction_params
UINT64 disposition;
};
struct io_request
{
UINT64 protocol;
UINT64 pci_len;
};
struct scard_transmit_params
{
UINT64 handle;
const struct io_request *send;
const BYTE *send_buf;
UINT64 send_buflen;
struct io_request *recv;
BYTE *recv_buf;
UINT64 *recv_buflen;
};
enum winscard_funcs
{
unix_scard_establish_context,
......@@ -136,4 +153,5 @@ enum winscard_funcs
unix_scard_disconnect,
unix_scard_begin_transaction,
unix_scard_end_transaction,
unix_scard_transmit,
};
......@@ -786,6 +786,42 @@ LONG WINAPI SCardEndTransaction( SCARDHANDLE connect, DWORD disposition )
return ret;
}
LONG WINAPI SCardTransmit( SCARDHANDLE connect, const SCARD_IO_REQUEST *send, const BYTE *send_buf,
DWORD send_buflen, SCARD_IO_REQUEST *recv, BYTE *recv_buf, DWORD *recv_buflen )
{
struct handle *handle = (struct handle *)connect;
struct scard_transmit_params params;
struct io_request send64 = { send->dwProtocol, send->cbPciLength }, recv64;
UINT64 recv_buflen64;
LONG ret;
TRACE( "%Ix, %p, %p, %lu, %p, %p, %p\n", connect, send, send_buf, send_buflen, recv, recv_buf, recv_buflen );
if (!handle || handle->magic != CONNECT_MAGIC) return ERROR_INVALID_HANDLE;
if (!recv_buflen) return SCARD_E_INVALID_PARAMETER;
params.handle = handle->unix_handle;
params.send = &send64;
params.send_buf = send_buf;
params.send_buflen = send_buflen;
params.recv = &recv64;
params.recv_buf = recv_buf;
recv_buflen64 = *recv_buflen;
params.recv_buflen = &recv_buflen64;
if (!(ret = UNIX_CALL( scard_transmit, &params )))
{
if (recv)
{
recv->dwProtocol = recv64.protocol;
recv->cbPciLength = recv64.pci_len;
}
*recv_buflen = recv_buflen64;
}
TRACE( "returning %#lx\n", ret );
return ret;
}
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, void *reserved )
{
switch (reason)
......
......@@ -57,7 +57,7 @@
@ stub SCardState
@ stdcall SCardStatusA(long str ptr ptr ptr ptr ptr)
@ stdcall SCardStatusW(long wstr ptr ptr ptr ptr ptr)
@ stub SCardTransmit
@ stdcall SCardTransmit(long ptr ptr long ptr ptr ptr)
@ extern g_rgSCardRawPci
@ extern g_rgSCardT0Pci
@ extern g_rgSCardT1Pci
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment