Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fd3ce00a
Commit
fd3ce00a
authored
Feb 16, 2023
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winscard: Implement SCardConnectA/W().
parent
abb7f750
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
2 deletions
+107
-2
unixlib.c
dlls/winscard/unixlib.c
+9
-0
unixlib.h
dlls/winscard/unixlib.h
+11
-0
winscard.c
dlls/winscard/winscard.c
+85
-0
winscard.spec
dlls/winscard/winscard.spec
+2
-2
No files found.
dlls/winscard/unixlib.c
View file @
fd3ce00a
...
...
@@ -38,6 +38,7 @@ LONG SCardGetStatusChange( UINT64, UINT64, struct reader_state *, UINT64 );
LONG
SCardCancel
(
UINT64
);
LONG
SCardListReaders
(
UINT64
,
const
char
*
,
char
*
,
UINT64
*
);
LONG
SCardListReaderGroups
(
UINT64
,
char
*
,
UINT64
*
);
LONG
SCardConnect
(
UINT64
,
const
char
*
,
UINT64
,
UINT64
,
UINT64
*
,
UINT64
*
);
static
NTSTATUS
scard_establish_context
(
void
*
args
)
{
...
...
@@ -81,6 +82,13 @@ static NTSTATUS scard_list_reader_groups( void *args )
return
SCardListReaderGroups
(
params
->
handle
,
params
->
groups
,
params
->
groups_len
);
}
static
NTSTATUS
scard_connect
(
void
*
args
)
{
struct
scard_connect_params
*
params
=
args
;
return
SCardConnect
(
params
->
context_handle
,
params
->
reader
,
params
->
share_mode
,
params
->
preferred_protocols
,
params
->
connect_handle
,
params
->
protocol
);
}
const
unixlib_entry_t
__wine_unix_call_funcs
[]
=
{
scard_establish_context
,
...
...
@@ -90,4 +98,5 @@ const unixlib_entry_t __wine_unix_call_funcs[] =
scard_cancel
,
scard_list_readers
,
scard_list_reader_groups
,
scard_connect
,
};
dlls/winscard/unixlib.h
View file @
fd3ce00a
...
...
@@ -74,6 +74,16 @@ struct scard_list_reader_groups_params
UINT64
*
groups_len
;
};
struct
scard_connect_params
{
UINT64
context_handle
;
const
char
*
reader
;
UINT64
share_mode
;
UINT64
preferred_protocols
;
UINT64
*
connect_handle
;
UINT64
*
protocol
;
};
enum
winscard_funcs
{
unix_scard_establish_context
,
...
...
@@ -83,4 +93,5 @@ enum winscard_funcs
unix_scard_cancel
,
unix_scard_list_readers
,
unix_scard_list_reader_groups
,
unix_scard_connect
,
};
dlls/winscard/winscard.c
View file @
fd3ce00a
...
...
@@ -140,6 +140,7 @@ LONG WINAPI SCardAddReaderToGroupW(SCARDCONTEXT context, LPCWSTR reader, LPCWSTR
}
#define CONTEXT_MAGIC (('C' << 24) | ('T' << 16) | ('X' << 8) | '0')
#define CONNECT_MAGIC (('C' << 24) | ('O' << 16) | ('N' << 8) | '0')
struct
handle
{
DWORD
magic
;
...
...
@@ -551,6 +552,90 @@ LONG WINAPI SCardGetStatusChangeW( SCARDCONTEXT context, DWORD timeout, SCARD_RE
return
ret
;
}
LONG
WINAPI
SCardConnectA
(
SCARDCONTEXT
context
,
const
char
*
reader
,
DWORD
share_mode
,
DWORD
preferred_protocols
,
SCARDHANDLE
*
connect
,
DWORD
*
protocol
)
{
struct
handle
*
context_handle
=
(
struct
handle
*
)
context
,
*
connect_handle
;
struct
scard_connect_params
params
;
char
*
reader_utf8
;
UINT64
protocol64
;
LONG
ret
;
TRACE
(
"%Ix, %s, %#lx, %#lx, %p, %p
\n
"
,
context
,
debugstr_a
(
reader
),
share_mode
,
preferred_protocols
,
connect
,
protocol
);
if
(
!
context_handle
||
context_handle
->
magic
!=
CONTEXT_MAGIC
)
return
ERROR_INVALID_HANDLE
;
if
(
!
connect
)
return
SCARD_E_INVALID_PARAMETER
;
if
(
!
(
connect_handle
=
malloc
(
sizeof
(
*
connect_handle
)
)))
return
SCARD_E_NO_MEMORY
;
connect_handle
->
magic
=
CONNECT_MAGIC
;
if
(
!
(
reader_utf8
=
ansi_to_utf8
(
reader
)))
{
free
(
connect_handle
);
return
SCARD_E_NO_MEMORY
;
}
params
.
context_handle
=
context_handle
->
unix_handle
;
params
.
reader
=
reader_utf8
;
params
.
share_mode
=
share_mode
;
params
.
preferred_protocols
=
preferred_protocols
;
params
.
connect_handle
=
&
connect_handle
->
unix_handle
;
params
.
protocol
=
&
protocol64
;
if
((
ret
=
UNIX_CALL
(
scard_connect
,
&
params
)))
free
(
connect_handle
);
else
{
*
connect
=
(
SCARDHANDLE
)
connect_handle
;
if
(
protocol
)
*
protocol
=
protocol64
;
}
free
(
reader_utf8
);
TRACE
(
"returning %#lx
\n
"
,
ret
);
return
ret
;
}
LONG
WINAPI
SCardConnectW
(
SCARDCONTEXT
context
,
const
WCHAR
*
reader
,
DWORD
share_mode
,
DWORD
preferred_protocols
,
SCARDHANDLE
*
connect
,
DWORD
*
protocol
)
{
struct
handle
*
context_handle
=
(
struct
handle
*
)
context
,
*
connect_handle
;
struct
scard_connect_params
params
;
char
*
reader_utf8
;
UINT64
protocol64
;
LONG
ret
;
TRACE
(
"%Ix, %s, %#lx, %#lx, %p, %p
\n
"
,
context
,
debugstr_w
(
reader
),
share_mode
,
preferred_protocols
,
connect
,
protocol
);
if
(
!
context_handle
||
context_handle
->
magic
!=
CONTEXT_MAGIC
)
return
ERROR_INVALID_HANDLE
;
if
(
!
connect
)
return
SCARD_E_INVALID_PARAMETER
;
if
(
!
(
connect_handle
=
malloc
(
sizeof
(
*
connect_handle
)
)))
return
SCARD_E_NO_MEMORY
;
connect_handle
->
magic
=
CONNECT_MAGIC
;
if
(
!
(
reader_utf8
=
utf16_to_utf8
(
reader
)))
{
free
(
connect_handle
);
return
SCARD_E_NO_MEMORY
;
}
params
.
context_handle
=
context_handle
->
unix_handle
;
params
.
reader
=
reader_utf8
;
params
.
share_mode
=
share_mode
;
params
.
preferred_protocols
=
preferred_protocols
;
params
.
connect_handle
=
&
connect_handle
->
unix_handle
;
params
.
protocol
=
&
protocol64
;
if
((
ret
=
UNIX_CALL
(
scard_connect
,
&
params
)))
free
(
connect_handle
);
else
{
*
connect
=
(
SCARDHANDLE
)
connect_handle
;
if
(
protocol
)
*
protocol
=
protocol64
;
}
free
(
reader_utf8
);
TRACE
(
"returning %#lx
\n
"
,
ret
);
return
ret
;
}
BOOL
WINAPI
DllMain
(
HINSTANCE
hinst
,
DWORD
reason
,
void
*
reserved
)
{
switch
(
reason
)
...
...
dlls/winscard/winscard.spec
View file @
fd3ce00a
...
...
@@ -7,8 +7,8 @@
@ stdcall SCardAddReaderToGroupW(long wstr wstr)
@ stub SCardBeginTransaction
@ stdcall SCardCancel(long)
@ st
ub SCardConnectA
@ st
ub SCardConnectW
@ st
dcall SCardConnectA(long str long long ptr ptr)
@ st
dcall SCardConnectW(long wstr long long ptr ptr)
@ stub SCardControl
@ stub SCardDisconnect
@ stub SCardEndTransaction
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment