mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 02:48:20 +00:00
winscard: Implement SCardRe/Disconnect().
This commit is contained in:
parent
836974d4d8
commit
ba2010a02a
|
@ -40,6 +40,8 @@ LONG SCardListReaders( UINT64, const char *, char *, UINT64 * );
|
|||
LONG SCardListReaderGroups( UINT64, char *, UINT64 * );
|
||||
LONG SCardConnect( UINT64, const char *, UINT64, UINT64, UINT64 *, UINT64 * );
|
||||
LONG SCardStatus( UINT64, char *, UINT64 *, UINT64 *, UINT64 *, BYTE *, UINT64 * );
|
||||
LONG SCardDisconnect( UINT64, UINT64 );
|
||||
LONG SCardReconnect( UINT64, UINT64, UINT64, UINT64, UINT64 * );
|
||||
|
||||
static NTSTATUS scard_establish_context( void *args )
|
||||
{
|
||||
|
@ -97,6 +99,19 @@ static NTSTATUS scard_status( void *args )
|
|||
params->atr, params->atr_len );
|
||||
}
|
||||
|
||||
static NTSTATUS scard_reconnect( void *args )
|
||||
{
|
||||
struct scard_reconnect_params *params = args;
|
||||
return SCardReconnect( params->handle, params->share_mode, params->preferred_protocols,
|
||||
params->initialization, params->protocol );
|
||||
}
|
||||
|
||||
static NTSTATUS scard_disconnect( void *args )
|
||||
{
|
||||
struct scard_disconnect_params *params = args;
|
||||
return SCardDisconnect( params->handle, params->disposition );
|
||||
}
|
||||
|
||||
const unixlib_entry_t __wine_unix_call_funcs[] =
|
||||
{
|
||||
scard_establish_context,
|
||||
|
@ -108,4 +123,6 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
|
|||
scard_list_reader_groups,
|
||||
scard_connect,
|
||||
scard_status,
|
||||
scard_reconnect,
|
||||
scard_disconnect,
|
||||
};
|
||||
|
|
|
@ -95,6 +95,21 @@ struct scard_status_params
|
|||
UINT64 *atr_len;
|
||||
};
|
||||
|
||||
struct scard_reconnect_params
|
||||
{
|
||||
UINT64 handle;
|
||||
UINT64 share_mode;
|
||||
UINT64 preferred_protocols;
|
||||
UINT64 initialization;
|
||||
UINT64 *protocol;
|
||||
};
|
||||
|
||||
struct scard_disconnect_params
|
||||
{
|
||||
UINT64 handle;
|
||||
UINT64 disposition;
|
||||
};
|
||||
|
||||
enum winscard_funcs
|
||||
{
|
||||
unix_scard_establish_context,
|
||||
|
@ -106,4 +121,6 @@ enum winscard_funcs
|
|||
unix_scard_list_reader_groups,
|
||||
unix_scard_connect,
|
||||
unix_scard_status,
|
||||
unix_scard_reconnect,
|
||||
unix_scard_disconnect,
|
||||
};
|
||||
|
|
|
@ -710,6 +710,49 @@ LONG WINAPI SCardConnectW( SCARDCONTEXT context, const WCHAR *reader, DWORD shar
|
|||
return ret;
|
||||
}
|
||||
|
||||
LONG WINAPI SCardReconnect( SCARDHANDLE connect, DWORD share_mode, DWORD preferred_protocols, DWORD initalization,
|
||||
DWORD *protocol )
|
||||
{
|
||||
struct handle *handle = (struct handle *)connect;
|
||||
struct scard_reconnect_params params;
|
||||
UINT64 protocol64;
|
||||
LONG ret;
|
||||
|
||||
TRACE( "%Ix, %#lx, %#lx, %#lx, %p\n", connect, share_mode, preferred_protocols, initalization, protocol );
|
||||
|
||||
if (!handle || handle->magic != CONNECT_MAGIC) return ERROR_INVALID_HANDLE;
|
||||
|
||||
params.handle = handle->unix_handle;
|
||||
params.share_mode = share_mode;
|
||||
params.preferred_protocols = preferred_protocols;
|
||||
params.initialization = initalization;
|
||||
params.protocol = &protocol64;
|
||||
if (!(ret = UNIX_CALL( scard_reconnect, ¶ms )) && protocol) *protocol = protocol64;
|
||||
TRACE( "returning %#lx\n", ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
LONG WINAPI SCardDisconnect( SCARDHANDLE connect, DWORD disposition )
|
||||
{
|
||||
struct handle *handle = (struct handle *)connect;
|
||||
struct scard_disconnect_params params;
|
||||
LONG ret;
|
||||
|
||||
TRACE( "%Ix, %#lx\n", connect, disposition );
|
||||
|
||||
if (!handle || handle->magic != CONNECT_MAGIC) return ERROR_INVALID_HANDLE;
|
||||
|
||||
params.handle = handle->unix_handle;
|
||||
params.disposition = disposition;
|
||||
if (!(ret = UNIX_CALL( scard_disconnect, ¶ms )))
|
||||
{
|
||||
handle->magic = 0;
|
||||
free( handle );
|
||||
}
|
||||
TRACE( "returning %#lx\n", ret );
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, void *reserved )
|
||||
{
|
||||
switch (reason)
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
@ stdcall SCardConnectA(long str long long ptr ptr)
|
||||
@ stdcall SCardConnectW(long wstr long long ptr ptr)
|
||||
@ stub SCardControl
|
||||
@ stub SCardDisconnect
|
||||
@ stdcall SCardDisconnect(long long)
|
||||
@ stub SCardEndTransaction
|
||||
@ stdcall SCardEstablishContext(long ptr ptr ptr)
|
||||
@ stub SCardForgetCardTypeA
|
||||
|
@ -46,7 +46,7 @@
|
|||
@ stub SCardLocateCardsByATRA
|
||||
@ stub SCardLocateCardsByATRW
|
||||
@ stub SCardLocateCardsW
|
||||
@ stub SCardReconnect
|
||||
@ stdcall SCardReconnect(long long long long ptr)
|
||||
@ stdcall SCardReleaseContext(long)
|
||||
@ stdcall SCardReleaseStartedEvent()
|
||||
@ stub SCardRemoveReaderFromGroupA
|
||||
|
|
Loading…
Reference in a new issue