Commit 7de85fc6 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winscard: Implement SCardGet/SetAttrib().

parent c53a2044
......@@ -46,6 +46,8 @@ LONG SCardBeginTransaction( UINT64 );
LONG SCardEndTransaction( UINT64, UINT64 );
LONG SCardTransmit( UINT64, const struct io_request *, const BYTE *, UINT64, struct io_request *, BYTE *, UINT64 * );
LONG SCardControl( UINT64, UINT64, const void *, UINT64, void *, UINT64, UINT64 * );
LONG SCardGetAttrib( UINT64, UINT64, BYTE *, UINT64 * );
LONG SCardSetAttrib( UINT64, UINT64, const BYTE *, UINT64 );
static NTSTATUS scard_establish_context( void *args )
{
......@@ -142,6 +144,18 @@ static NTSTATUS scard_control( void *args )
params->out_buflen, params->ret_len );
}
static NTSTATUS scard_get_attrib( void *args )
{
struct scard_get_attrib_params *params = args;
return SCardGetAttrib( params->handle, params->id, params->attr, params->attr_len );
}
static NTSTATUS scard_set_attrib( void *args )
{
struct scard_set_attrib_params *params = args;
return SCardSetAttrib( params->handle, params->id, params->attr, params->attr_len );
}
const unixlib_entry_t __wine_unix_call_funcs[] =
{
scard_establish_context,
......@@ -159,4 +173,6 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
scard_end_transaction,
scard_transmit,
scard_control,
scard_get_attrib,
scard_set_attrib,
};
......@@ -149,6 +149,22 @@ struct scard_control_params
UINT64 *ret_len;
};
struct scard_get_attrib_params
{
UINT64 handle;
UINT64 id;
void *attr;
UINT64 *attr_len;
};
struct scard_set_attrib_params
{
UINT64 handle;
UINT64 id;
const void *attr;
UINT64 attr_len;
};
enum winscard_funcs
{
unix_scard_establish_context,
......@@ -166,4 +182,6 @@ enum winscard_funcs
unix_scard_end_transaction,
unix_scard_transmit,
unix_scard_control,
unix_scard_get_attrib,
unix_scard_set_attrib,
};
......@@ -847,6 +847,47 @@ LONG WINAPI SCardControl( SCARDHANDLE connect, DWORD code, const void *in_buf, D
return ret;
}
LONG WINAPI SCardGetAttrib( SCARDHANDLE connect, DWORD id, BYTE *attr, DWORD *attr_len )
{
struct handle *handle = (struct handle *)connect;
struct scard_get_attrib_params params;
UINT64 attr_len64;
LONG ret;
TRACE( "%Ix, %#lx, %p, %p\n", connect, id, attr, attr_len );
if (!handle || handle->magic != CONNECT_MAGIC) return ERROR_INVALID_HANDLE;
if (!attr_len) return SCARD_E_INVALID_PARAMETER;
params.handle = handle->unix_handle;
params.id = id;
params.attr = attr;
attr_len64 = *attr_len;
params.attr_len = &attr_len64;
if (!(ret = UNIX_CALL( scard_get_attrib, &params ))) *attr_len = attr_len64;
TRACE( "returning %#lx\n", ret );
return ret;
}
LONG WINAPI SCardSetAttrib( SCARDHANDLE connect, DWORD id, const BYTE *attr, DWORD attr_len )
{
struct handle *handle = (struct handle *)connect;
struct scard_set_attrib_params params;
LONG ret;
TRACE( "%Ix, %#lx, %p, %lu\n", connect, id, attr, attr_len );
if (!handle || handle->magic != CONNECT_MAGIC) return ERROR_INVALID_HANDLE;
params.handle = handle->unix_handle;
params.id = id;
params.attr = attr;
params.attr_len = attr_len;
ret = UNIX_CALL( scard_set_attrib, &params );
TRACE( "returning %#lx\n", ret );
return ret;
}
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, void *reserved )
{
switch (reason)
......
......@@ -20,7 +20,7 @@
@ stub SCardForgetReaderGroupW
@ stub SCardForgetReaderW
@ stub SCardFreeMemory
@ stub SCardGetAttrib
@ stdcall SCardGetAttrib(long long ptr ptr)
@ stub SCardGetCardTypeProviderNameA
@ stub SCardGetCardTypeProviderNameW
@ stub SCardGetProviderIdA
......@@ -51,7 +51,7 @@
@ stdcall SCardReleaseStartedEvent()
@ stub SCardRemoveReaderFromGroupA
@ stub SCardRemoveReaderFromGroupW
@ stub SCardSetAttrib
@ stdcall SCardSetAttrib(long long ptr long)
@ stub SCardSetCardTypeProviderNameA
@ stub SCardSetCardTypeProviderNameW
@ stub SCardState
......
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