chansrv: got \?PnP?\Notification working, handle pcsc exit without cleanup

ulab-next
Jay Sorg 11 years ago
parent 75978a702b
commit b34cbe8a3e

@ -714,10 +714,16 @@ SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout,
offset = 12; offset = 12;
for (index = 0; index < cReaders; index++) for (index = 0; index < cReaders; index++)
{ {
if (rgReaderStates[index].dwCurrentState == 0) /* SCARD_STATE_UNAWARE */
{
rgReaderStates[index].dwEventState = 0;
rgReaderStates[index].cbAtr = 0;
}
str_len = strlen(rgReaderStates[index].szReader); str_len = strlen(rgReaderStates[index].szReader);
str_len = LMIN(str_len, 99); str_len = LMIN(str_len, 99);
memset(msg + offset, 0, 100); memset(msg + offset, 0, 100);
memcpy(msg + offset, rgReaderStates[index].szReader, str_len); memcpy(msg + offset, rgReaderStates[index].szReader, str_len);
LLOGLN(10, (" in szReader %s", rgReaderStates[index].szReader));
offset += 100; offset += 100;
LLOGLN(10, (" in dwCurrentState 0x%8.8x", rgReaderStates[index].dwCurrentState)); LLOGLN(10, (" in dwCurrentState 0x%8.8x", rgReaderStates[index].dwCurrentState));
SET_UINT32(msg, offset, rgReaderStates[index].dwCurrentState); SET_UINT32(msg, offset, rgReaderStates[index].dwCurrentState);
@ -761,12 +767,13 @@ SCardGetStatusChange(SCARDCONTEXT hContext, DWORD dwTimeout,
LLOGLN(10, ("SCardGetStatusChange: got back cReaders %d", cReaders)); LLOGLN(10, ("SCardGetStatusChange: got back cReaders %d", cReaders));
for (index = 0; index < cReaders; index++) for (index = 0; index < cReaders; index++)
{ {
LLOGLN(10, (" out szReader %s", rgReaderStates[index].szReader));
rgReaderStates[index].dwCurrentState = GET_UINT32(msg, offset); rgReaderStates[index].dwCurrentState = GET_UINT32(msg, offset);
offset += 4; offset += 4;
LLOGLN(10, (" out dwCurrentState %d", rgReaderStates[index].dwCurrentState)); LLOGLN(10, (" out dwCurrentState 0x%8.8x", rgReaderStates[index].dwCurrentState));
rgReaderStates[index].dwEventState = GET_UINT32(msg, offset); rgReaderStates[index].dwEventState = GET_UINT32(msg, offset);
offset += 4; offset += 4;
LLOGLN(10, (" out dwEventState %d", rgReaderStates[index].dwEventState)); LLOGLN(10, (" out dwEventState 0x%8.8x", rgReaderStates[index].dwEventState));
rgReaderStates[index].cbAtr = GET_UINT32(msg, offset); rgReaderStates[index].cbAtr = GET_UINT32(msg, offset);
offset += 4; offset += 4;
LLOGLN(10, (" out cbAtr %d", rgReaderStates[index].cbAtr)); LLOGLN(10, (" out cbAtr %d", rgReaderStates[index].cbAtr));

@ -106,14 +106,24 @@ scard_pcsc_get_wait_objs(tbus *objs, int *count, int *timeout)
int APP_CC int APP_CC
scard_pcsc_check_wait_objs(void) scard_pcsc_check_wait_objs(void)
{ {
LLOGLN(10, ("scard_pcsc_check_wait_objs")); LLOGLN(10, ("scard_pcsc_check_wait_objs:"));
if (g_lis != 0) if (g_lis != 0)
{ {
trans_check_wait_objs(g_lis); if (trans_check_wait_objs(g_lis) != 0)
{
LLOGLN(0, ("scard_pcsc_check_wait_objs: g_lis trans_check_wait_objs error"));
}
} }
if (g_con != 0) if (g_con != 0)
{ {
trans_check_wait_objs(g_con); if (trans_check_wait_objs(g_con) != 0)
{
LLOGLN(0, ("scard_pcsc_check_wait_objs: g_con trans_check_wait_objs error"));
/* TODO: cleanup better */
trans_delete(g_con);
g_con = 0;
g_xrdp_pcsc_state = 0;
}
} }
return 0; return 0;
} }

Loading…
Cancel
Save