mirror of https://github.com/FreeRDP/FreeRDP
channels/smartcard: fix broken context/handle encoding/decoding
This commit is contained in:
parent
79453d1bb4
commit
32b65c3000
|
@ -187,7 +187,10 @@ static UINT32 smartcard_EstablishContext(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
|
||||
status = ret.ReturnCode = SCardEstablishContext(call.dwScope, NULL, NULL, &hContext);
|
||||
|
||||
smartcard_scard_context_native_to_redir(smartcard, &ret.Context, hContext);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
smartcard_scard_context_native_to_redir(smartcard, &(ret.hContext), hContext);
|
||||
|
||||
smartcard_trace_establish_context_return(smartcard, &ret);
|
||||
|
||||
|
@ -213,7 +216,7 @@ static UINT32 smartcard_ReleaseContext(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.Context);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
|
||||
status = ret.ReturnCode = SCardReleaseContext(hContext);
|
||||
|
||||
|
@ -234,7 +237,7 @@ static UINT32 smartcard_IsValidContext(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.Context);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
|
||||
status = ret.ReturnCode = SCardIsValidContext(hContext);
|
||||
|
||||
|
@ -257,7 +260,7 @@ static UINT32 smartcard_ListReadersA(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.Context);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
|
||||
cchReaders = SCARD_AUTOALLOCATE;
|
||||
|
||||
|
@ -301,7 +304,7 @@ static UINT32 smartcard_ListReadersW(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.Context);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
|
||||
cchReaders = SCARD_AUTOALLOCATE;
|
||||
|
||||
|
@ -345,7 +348,7 @@ static UINT32 smartcard_GetStatusChangeA(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.Context);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
|
||||
status = ret.ReturnCode = SCardGetStatusChangeA(hContext, call.dwTimeOut, call.rgReaderStates, call.cReaders);
|
||||
|
||||
|
@ -403,7 +406,7 @@ static UINT32 smartcard_GetStatusChangeW(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.Context);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
|
||||
status = ret.ReturnCode = SCardGetStatusChangeW(hContext, call.dwTimeOut, call.rgReaderStates, call.cReaders);
|
||||
|
||||
|
@ -459,7 +462,7 @@ static UINT32 smartcard_Cancel(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.Context);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
|
||||
status = ret.ReturnCode = SCardCancel(hContext);
|
||||
|
||||
|
@ -483,7 +486,7 @@ UINT32 smartcard_ConnectA(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.Common.Context);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.Common.hContext));
|
||||
|
||||
if ((call.Common.dwPreferredProtocols == SCARD_PROTOCOL_UNDEFINED) &&
|
||||
(call.Common.dwShareMode != SCARD_SHARE_DIRECT))
|
||||
|
@ -497,8 +500,8 @@ UINT32 smartcard_ConnectA(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
smartcard_scard_context_native_to_redir(smartcard, &ret.hContext, hContext);
|
||||
smartcard_scard_handle_native_to_redir(smartcard, &ret.hCard, hCard);
|
||||
smartcard_scard_context_native_to_redir(smartcard, &(ret.hContext), hContext);
|
||||
smartcard_scard_handle_native_to_redir(smartcard, &(ret.hCard), hCard);
|
||||
|
||||
smartcard_trace_connect_return(smartcard, &ret);
|
||||
|
||||
|
@ -530,7 +533,7 @@ UINT32 smartcard_ConnectW(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.Common.Context);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.Common.hContext));
|
||||
|
||||
if ((call.Common.dwPreferredProtocols == SCARD_PROTOCOL_UNDEFINED) &&
|
||||
(call.Common.dwShareMode != SCARD_SHARE_DIRECT))
|
||||
|
@ -544,8 +547,8 @@ UINT32 smartcard_ConnectW(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
smartcard_scard_context_native_to_redir(smartcard, &ret.hContext, hContext);
|
||||
smartcard_scard_handle_native_to_redir(smartcard, &ret.hCard, hCard);
|
||||
smartcard_scard_context_native_to_redir(smartcard, &(ret.hContext), hContext);
|
||||
smartcard_scard_handle_native_to_redir(smartcard, &(ret.hCard), hCard);
|
||||
|
||||
smartcard_trace_connect_return(smartcard, &ret);
|
||||
|
||||
|
@ -573,8 +576,8 @@ static UINT32 smartcard_Reconnect(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
status = ret.ReturnCode = SCardReconnect(hCard, call.dwShareMode,
|
||||
call.dwPreferredProtocols, call.dwInitialization, &ret.dwActiveProtocol);
|
||||
|
@ -605,10 +608,10 @@ static UINT32 smartcard_Disconnect(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
status = ret.ReturnCode = SCardDisconnect(hCard, (DWORD) call.dwDisposition);
|
||||
status = ret.ReturnCode = SCardDisconnect(hCard, call.dwDisposition);
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -631,8 +634,8 @@ static UINT32 smartcard_BeginTransaction(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
status = ret.ReturnCode = SCardBeginTransaction(hCard);
|
||||
|
||||
|
@ -657,8 +660,8 @@ static UINT32 smartcard_EndTransaction(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
status = ret.ReturnCode = SCardEndTransaction(hCard, call.dwDisposition);
|
||||
|
||||
|
@ -681,8 +684,8 @@ static UINT32 smartcard_State(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
ret.cbAtrLen = SCARD_ATR_LENGTH;
|
||||
|
||||
|
@ -719,8 +722,8 @@ static DWORD smartcard_StatusA(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
if (call.cbAtrLen > 32)
|
||||
call.cbAtrLen = 32;
|
||||
|
@ -766,8 +769,8 @@ static DWORD smartcard_StatusW(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
if (call.cbAtrLen > 32)
|
||||
call.cbAtrLen = 32;
|
||||
|
@ -809,8 +812,8 @@ static UINT32 smartcard_Transmit(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
ret.cbRecvLength = 0;
|
||||
ret.pbRecvBuffer = NULL;
|
||||
|
@ -863,8 +866,8 @@ static UINT32 smartcard_Control(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
if (DEVICE_TYPE_FROM_CTL_CODE(call.dwControlCode) == FILE_DEVICE_SMARTCARD)
|
||||
{
|
||||
|
@ -911,8 +914,8 @@ static UINT32 smartcard_GetAttrib(SMARTCARD_DEVICE* smartcard, IRP* irp)
|
|||
if (status)
|
||||
return status;
|
||||
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &call.hContext);
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &call.hCard);
|
||||
hContext = smartcard_scard_context_native_from_redir(smartcard, &(call.hContext));
|
||||
hCard = smartcard_scard_handle_native_from_redir(smartcard, &(call.hCard));
|
||||
|
||||
ret.pbAttr = NULL;
|
||||
|
||||
|
|
|
@ -228,6 +228,12 @@ UINT32 smartcard_unpack_redir_scard_context(SMARTCARD_DEVICE* smartcard, wStream
|
|||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
if ((context->cbContext != 4) && (context->cbContext != 8))
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_WARN, "REDIR_SCARDCONTEXT length is not 4 or 8: %d\n", context->cbContext);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Stream_Read_UINT32(s, pbContextNdrPtr); /* pbContextNdrPtr (4 bytes) */
|
||||
|
||||
if (context->cbContext > Stream_GetRemainingLength(s))
|
||||
|
@ -285,8 +291,8 @@ UINT32 smartcard_unpack_redir_scard_context_ref(SMARTCARD_DEVICE* smartcard, wSt
|
|||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
if (context->cbContext > 4)
|
||||
Stream_Read(s, &context->pbContext, context->cbContext);
|
||||
if (context->cbContext)
|
||||
Stream_Read(s, &(context->pbContext), context->cbContext);
|
||||
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
@ -297,7 +303,7 @@ UINT32 smartcard_pack_redir_scard_context_ref(SMARTCARD_DEVICE* smartcard, wStre
|
|||
|
||||
if (context->cbContext)
|
||||
{
|
||||
Stream_Write(s, &context->pbContext, context->cbContext);
|
||||
Stream_Write(s, &(context->pbContext), context->cbContext);
|
||||
}
|
||||
|
||||
return SCARD_S_SUCCESS;
|
||||
|
@ -421,12 +427,12 @@ UINT32 smartcard_pack_establish_context_return(SMARTCARD_DEVICE* smartcard, wStr
|
|||
{
|
||||
UINT32 status;
|
||||
|
||||
status = smartcard_pack_redir_scard_context(smartcard, s, &(ret->Context));
|
||||
status = smartcard_pack_redir_scard_context(smartcard, s, &(ret->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
status = smartcard_pack_redir_scard_context_ref(smartcard, s, &(ret->Context));
|
||||
status = smartcard_pack_redir_scard_context_ref(smartcard, s, &(ret->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -445,17 +451,17 @@ void smartcard_trace_establish_context_return(SMARTCARD_DEVICE* smartcard, Estab
|
|||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "ReturnCode: 0x%08X", ret->ReturnCode);
|
||||
|
||||
pb = (BYTE*) &(ret->Context.pbContext);
|
||||
pb = (BYTE*) &(ret->hContext.pbContext);
|
||||
|
||||
if (ret->Context.cbContext > 4)
|
||||
if (ret->hContext.cbContext > 4)
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], ret->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], ret->hContext.cbContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], ret->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], ret->hContext.cbContext);
|
||||
}
|
||||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "}");
|
||||
|
@ -465,12 +471,12 @@ UINT32 smartcard_unpack_context_call(SMARTCARD_DEVICE* smartcard, wStream* s, Co
|
|||
{
|
||||
UINT32 status;
|
||||
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->Context));
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->Context));
|
||||
status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -484,17 +490,17 @@ void smartcard_trace_context_call(SMARTCARD_DEVICE* smartcard, Context_Call* cal
|
|||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "%s_Call {", name);
|
||||
|
||||
pb = (BYTE*) &(call->Context.pbContext);
|
||||
pb = (BYTE*) &(call->hContext.pbContext);
|
||||
|
||||
if (call->Context.cbContext > 4)
|
||||
if (call->hContext.cbContext > 4)
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->hContext.cbContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], call->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], call->hContext.cbContext);
|
||||
}
|
||||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "}");
|
||||
|
@ -508,7 +514,7 @@ UINT32 smartcard_unpack_list_readers_call(SMARTCARD_DEVICE* smartcard, wStream*
|
|||
|
||||
call->mszGroups = NULL;
|
||||
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->Context));
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -525,7 +531,7 @@ UINT32 smartcard_unpack_list_readers_call(SMARTCARD_DEVICE* smartcard, wStream*
|
|||
Stream_Read_UINT32(s, call->fmszReadersIsNULL); /* fmszReadersIsNULL (4 bytes) */
|
||||
Stream_Read_UINT32(s, call->cchReaders); /* cchReaders (4 bytes) */
|
||||
|
||||
status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->Context));
|
||||
status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -586,17 +592,17 @@ void smartcard_trace_list_readers_call(SMARTCARD_DEVICE* smartcard, ListReaders_
|
|||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "ListReaders%S_Call {", unicode ? "W" : "A");
|
||||
|
||||
pb = (BYTE*) &(call->Context.pbContext);
|
||||
pb = (BYTE*) &(call->hContext.pbContext);
|
||||
|
||||
if (call->Context.cbContext > 4)
|
||||
if (call->hContext.cbContext > 4)
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->hContext.cbContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], call->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], call->hContext.cbContext);
|
||||
}
|
||||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG,
|
||||
|
@ -682,7 +688,7 @@ UINT32 smartcard_unpack_connect_common(SMARTCARD_DEVICE* smartcard, wStream* s,
|
|||
return STATUS_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(common->Context));
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(common->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -725,7 +731,7 @@ UINT32 smartcard_unpack_connect_a_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
|||
smartcard_unpack_read_size_align(smartcard, s, count, 4);
|
||||
call->szReader[count] = '\0';
|
||||
|
||||
smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->Common.Context));
|
||||
smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->Common.hContext));
|
||||
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
@ -739,17 +745,17 @@ void smartcard_trace_connect_a_call(SMARTCARD_DEVICE* smartcard, ConnectA_Call*
|
|||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "ConnectA_Call {");
|
||||
|
||||
pb = (BYTE*) &(call->Common.Context);
|
||||
pb = (BYTE*) &(call->Common.hContext.pbContext);
|
||||
|
||||
if (call->Common.Context.cbContext > 4)
|
||||
if (call->Common.hContext.cbContext > 4)
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->Common.Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->Common.hContext.cbContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], call->Common.Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], call->Common.hContext.cbContext);
|
||||
}
|
||||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "szReader: %s dwShareMode: 0x%08X dwPreferredProtocols: 0x%08X",
|
||||
|
@ -790,7 +796,7 @@ UINT32 smartcard_unpack_connect_w_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
|||
smartcard_unpack_read_size_align(smartcard, s, (count * 2), 4);
|
||||
call->szReader[count] = '\0';
|
||||
|
||||
smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->Common.Context));
|
||||
smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->Common.hContext));
|
||||
|
||||
return SCARD_S_SUCCESS;
|
||||
}
|
||||
|
@ -807,17 +813,17 @@ void smartcard_trace_connect_w_call(SMARTCARD_DEVICE* smartcard, ConnectW_Call*
|
|||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "ConnectA_Call {");
|
||||
|
||||
pb = (BYTE*) &(call->Common.Context);
|
||||
pb = (BYTE*) &(call->Common.hContext.pbContext);
|
||||
|
||||
if (call->Common.Context.cbContext > 4)
|
||||
if (call->Common.hContext.cbContext > 4)
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->Common.Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->Common.hContext.cbContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], call->Common.Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], call->Common.hContext.cbContext);
|
||||
}
|
||||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "szReader: %s dwShareMode: 0x%08X dwPreferredProtocols: %d",
|
||||
|
@ -1029,7 +1035,7 @@ UINT32 smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wS
|
|||
|
||||
call->rgReaderStates = NULL;
|
||||
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->Context));
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -1045,7 +1051,7 @@ UINT32 smartcard_unpack_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, wS
|
|||
Stream_Read_UINT32(s, call->cReaders); /* cReaders (4 bytes) */
|
||||
Stream_Read_UINT32(s, rgReaderStatesNdrPtr); /* rgReaderStatesNdrPtr (4 bytes) */
|
||||
|
||||
status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->Context));
|
||||
status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -1144,17 +1150,17 @@ void smartcard_trace_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, GetSt
|
|||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "GetStatusChangeA_Call {");
|
||||
|
||||
pb = (BYTE*) &(call->Context.pbContext);
|
||||
pb = (BYTE*) &(call->hContext.pbContext);
|
||||
|
||||
if (call->Context.cbContext > 4)
|
||||
if (call->hContext.cbContext > 4)
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->hContext.cbContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], call->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], call->hContext.cbContext);
|
||||
}
|
||||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "dwTimeOut: 0x%08X cReaders: %d",
|
||||
|
@ -1186,7 +1192,7 @@ UINT32 smartcard_unpack_get_status_change_w_call(SMARTCARD_DEVICE* smartcard, wS
|
|||
|
||||
call->rgReaderStates = NULL;
|
||||
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->Context));
|
||||
status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -1202,7 +1208,7 @@ UINT32 smartcard_unpack_get_status_change_w_call(SMARTCARD_DEVICE* smartcard, wS
|
|||
Stream_Read_UINT32(s, call->cReaders); /* cReaders (4 bytes) */
|
||||
Stream_Read_UINT32(s, rgReaderStatesNdrPtr); /* rgReaderStatesNdrPtr (4 bytes) */
|
||||
|
||||
status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->Context));
|
||||
status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
|
||||
|
||||
if (status)
|
||||
return status;
|
||||
|
@ -1293,17 +1299,17 @@ void smartcard_trace_get_status_change_w_call(SMARTCARD_DEVICE* smartcard, GetSt
|
|||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "GetStatusChangeW_Call {");
|
||||
|
||||
pb = (BYTE*) &(call->Context.pbContext);
|
||||
pb = (BYTE*) &(call->hContext.pbContext);
|
||||
|
||||
if (call->Context.cbContext > 4)
|
||||
if (call->hContext.cbContext > 4)
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], pb[4], pb[5], pb[6], pb[7], call->hContext.cbContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
|
||||
pb[0], pb[1], pb[2], pb[3], call->Context.cbContext);
|
||||
pb[0], pb[1], pb[2], pb[3], call->hContext.cbContext);
|
||||
}
|
||||
|
||||
WLog_Print(smartcard->log, WLOG_DEBUG, "dwTimeOut: 0x%08X cReaders: %d",
|
||||
|
|
|
@ -57,31 +57,31 @@ typedef struct _longAndMultiString_Return ListReaders_Return;
|
|||
|
||||
typedef struct _Context_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
} Context_Call;
|
||||
|
||||
typedef struct _ContextAndStringA_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
/* [string] */ unsigned char *sz;
|
||||
} ContextAndStringA_Call;
|
||||
|
||||
typedef struct _ContextAndStringW_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
/* [string] */ WCHAR *sz;
|
||||
} ContextAndStringW_Call;
|
||||
|
||||
typedef struct _ContextAndTwoStringA_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
/* [string] */ unsigned char *sz1;
|
||||
/* [string] */ unsigned char *sz2;
|
||||
} ContextAndTwoStringA_Call;
|
||||
|
||||
typedef struct _ContextAndTwoStringW_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
/* [string] */ WCHAR *sz1;
|
||||
/* [string] */ WCHAR *sz2;
|
||||
} ContextAndTwoStringW_Call;
|
||||
|
@ -94,19 +94,19 @@ typedef struct _EstablishContext_Call
|
|||
typedef struct _EstablishContext_Return
|
||||
{
|
||||
LONG ReturnCode;
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
} EstablishContext_Return;
|
||||
|
||||
typedef struct _ListReaderGroups_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
LONG fmszGroupsIsNULL;
|
||||
DWORD cchGroups;
|
||||
} ListReaderGroups_Call;
|
||||
|
||||
typedef struct _ListReaders_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
/* [range] */ DWORD cBytes;
|
||||
/* [size_is][unique] */ BYTE *mszGroups;
|
||||
LONG fmszReadersIsNULL;
|
||||
|
@ -143,7 +143,7 @@ typedef struct _ReaderState_Return
|
|||
|
||||
typedef struct _GetStatusChangeA_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
DWORD dwTimeOut;
|
||||
/* [range] */ DWORD cReaders;
|
||||
/* [size_is] */ LPSCARD_READERSTATEA rgReaderStates;
|
||||
|
@ -151,7 +151,7 @@ typedef struct _GetStatusChangeA_Call
|
|||
|
||||
typedef struct _LocateCardsA_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
/* [range] */ DWORD cBytes;
|
||||
/* [size_is] */ BYTE *mszCards;
|
||||
/* [range] */ DWORD cReaders;
|
||||
|
@ -160,7 +160,7 @@ typedef struct _LocateCardsA_Call
|
|||
|
||||
typedef struct _LocateCardsW_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
/* [range] */ DWORD cBytes;
|
||||
/* [size_is] */ BYTE *mszCards;
|
||||
/* [range] */ DWORD cReaders;
|
||||
|
@ -176,7 +176,7 @@ typedef struct _LocateCards_ATRMask
|
|||
|
||||
typedef struct _LocateCardsByATRA_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
/* [range] */ DWORD cAtrs;
|
||||
/* [size_is] */ LocateCards_ATRMask *rgAtrMasks;
|
||||
/* [range] */ DWORD cReaders;
|
||||
|
@ -185,7 +185,7 @@ typedef struct _LocateCardsByATRA_Call
|
|||
|
||||
typedef struct _LocateCardsByATRW_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
/* [range] */ DWORD cAtrs;
|
||||
/* [size_is] */ LocateCards_ATRMask *rgAtrMasks;
|
||||
/* [range] */ DWORD cReaders;
|
||||
|
@ -203,7 +203,7 @@ typedef struct _GetStatusChange_Return GetStatusChange_Return;
|
|||
|
||||
typedef struct _GetStatusChangeW_Call
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
DWORD dwTimeOut;
|
||||
/* [range] */ DWORD cReaders;
|
||||
/* [size_is] */ LPSCARD_READERSTATEW rgReaderStates;
|
||||
|
@ -211,7 +211,7 @@ typedef struct _GetStatusChangeW_Call
|
|||
|
||||
typedef struct _Connect_Common
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
DWORD dwShareMode;
|
||||
DWORD dwPreferredProtocols;
|
||||
} Connect_Common;
|
||||
|
@ -379,7 +379,7 @@ typedef struct _SetAttrib_Call
|
|||
|
||||
typedef struct _ReadCache_Common
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
UUID *CardIdentifier;
|
||||
DWORD FreshnessCounter;
|
||||
LONG fPbDataIsNULL;
|
||||
|
@ -407,7 +407,7 @@ typedef struct _ReadCache_Return
|
|||
|
||||
typedef struct _WriteCache_Common
|
||||
{
|
||||
REDIR_SCARDCONTEXT Context;
|
||||
REDIR_SCARDCONTEXT hContext;
|
||||
UUID *CardIdentifier;
|
||||
DWORD FreshnessCounter;
|
||||
/* [range] */ DWORD cbDataLen;
|
||||
|
|
Loading…
Reference in New Issue