WLog_Print(smartcard->log, WLOG_WARN,
"REDIR_SCARDCONTEXT does not match native size: Actual: %d, Expected: %d",
context->cbContext, sizeof(ULONG_PTR));
+ return 0;
}
- if (context->cbContext > 4)
- hContext = (ULONG_PTR) context->pbContext.QuadPart;
- else
- hContext = (ULONG_PTR) context->pbContext.LowPart;
+ if (context->cbContext)
+ CopyMemory(&hContext, &(context->pbContext), context->cbContext);
return hContext;
}
void smartcard_scard_context_native_to_redir(SMARTCARD_DEVICE* smartcard, REDIR_SCARDCONTEXT* context, SCARDCONTEXT hContext)
{
+ ZeroMemory(context, sizeof(REDIR_SCARDCONTEXT));
context->cbContext = sizeof(ULONG_PTR);
-
- if (context->cbContext > 4)
- context->pbContext.QuadPart = (UINT64) hContext;
- else
- context->pbContext.LowPart = (UINT32) hContext;
+ CopyMemory(&(context->pbContext), &hContext, context->cbContext);
}
SCARDHANDLE smartcard_scard_handle_native_from_redir(SMARTCARD_DEVICE* smartcard, REDIR_SCARDHANDLE* handle)
WLog_Print(smartcard->log, WLOG_WARN,
"REDIR_SCARDHANDLE does not match native size: Actual: %d, Expected: %d",
handle->cbHandle, sizeof(ULONG_PTR));
+ return 0;
}
- if (handle->cbHandle > 4)
- hCard = (ULONG_PTR) handle->pbHandle.QuadPart;
- else
- hCard = (ULONG_PTR) handle->pbHandle.LowPart;
+ if (handle->cbHandle)
+ CopyMemory(&hCard, &(handle->pbHandle), handle->cbHandle);
return hCard;
}
-void smartcard_scard_handle_native_to_redir(SMARTCARD_DEVICE* smartcard, REDIR_SCARDHANDLE* context, SCARDHANDLE hCard)
+void smartcard_scard_handle_native_to_redir(SMARTCARD_DEVICE* smartcard, REDIR_SCARDHANDLE* handle, SCARDHANDLE hCard)
{
- context->cbHandle = sizeof(ULONG_PTR);
-
- if (context->cbHandle > 4)
- context->pbHandle.QuadPart = (UINT64) hCard;
- else
- context->pbHandle.LowPart = (UINT32) hCard;
+ ZeroMemory(handle, sizeof(REDIR_SCARDHANDLE));
+ handle->cbHandle = sizeof(ULONG_PTR);
+ CopyMemory(&(handle->pbHandle), &hCard, handle->cbHandle);
}
UINT32 smartcard_unpack_redir_scard_context(SMARTCARD_DEVICE* smartcard, wStream* s, REDIR_SCARDCONTEXT* context)
{
UINT32 pbContextNdrPtr;
- context->cbContext = 0;
- context->pbContext.QuadPart = 0;
+ ZeroMemory(context, sizeof(REDIR_SCARDCONTEXT));
if (Stream_GetRemainingLength(s) < 4)
{
}
if (context->cbContext > 4)
- Stream_Read_UINT64(s, context->pbContext.QuadPart);
- else
- Stream_Read_UINT32(s, context->pbContext.LowPart);
+ Stream_Read(s, &context->pbContext, context->cbContext);
return SCARD_S_SUCCESS;
}
UINT32 smartcard_pack_redir_scard_context_ref(SMARTCARD_DEVICE* smartcard, wStream* s, REDIR_SCARDCONTEXT* context)
{
+ Stream_Write_UINT32(s, context->cbContext); /* Length (4 bytes) */
+
if (context->cbContext)
{
- Stream_Write_UINT32(s, context->cbContext); /* Length (4 bytes) */
-
- if (context->cbContext > 4)
- Stream_Write_UINT64(s, context->pbContext.QuadPart);
- else if (context->cbContext > 0)
- Stream_Write_UINT32(s, context->pbContext.LowPart);
+ Stream_Write(s, &context->pbContext, context->cbContext);
}
return SCARD_S_SUCCESS;
UINT32 smartcard_unpack_redir_scard_handle(SMARTCARD_DEVICE* smartcard, wStream* s, REDIR_SCARDHANDLE* handle)
{
- UINT32 status;
- UINT32 length;
UINT32 pbHandleNdrPtr;
- handle->cbHandle = 0;
- handle->pbHandle.QuadPart = 0;
-
- status = smartcard_unpack_redir_scard_context(smartcard, s, &(handle->Context));
-
- if (status)
- return status;
+ ZeroMemory(handle, sizeof(REDIR_SCARDHANDLE));
if (Stream_GetRemainingLength(s) < 4)
{
Stream_Read_UINT32(s, pbHandleNdrPtr); /* NdrPtr (4 bytes) */
- return 0;
+ return SCARD_S_SUCCESS;
}
UINT32 smartcard_pack_redir_scard_handle(SMARTCARD_DEVICE* smartcard, wStream* s, REDIR_SCARDHANDLE* handle)
{
- UINT32 status;
UINT32 pbHandleNdrPtr;
- status = smartcard_pack_redir_scard_context(smartcard, s, &(handle->Context));
-
- if (status)
- return status;
-
pbHandleNdrPtr = (handle->cbHandle) ? 0x00020002 : 0;
Stream_Write_UINT32(s, handle->cbHandle); /* cbHandle (4 bytes) */
UINT32 smartcard_unpack_redir_scard_handle_ref(SMARTCARD_DEVICE* smartcard, wStream* s, REDIR_SCARDHANDLE* handle)
{
- UINT32 status;
UINT32 length;
- status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(handle->Context));
-
- if (status)
- return status;
-
if (Stream_GetRemainingLength(s) < 4)
{
WLog_Print(smartcard->log, WLOG_WARN, "REDIR_SCARDHANDLE is too short: Actual: %d, Expected: %d\n",
return STATUS_BUFFER_TOO_SMALL;
}
- if (handle->cbHandle > 4)
- Stream_Read_UINT64(s, handle->pbHandle.QuadPart);
- else
- Stream_Read_UINT32(s, handle->pbHandle.LowPart);
+ if (handle->cbHandle)
+ Stream_Read(s, &(handle->pbHandle), handle->cbHandle);
- return 0;
+ return SCARD_S_SUCCESS;
}
UINT32 smartcard_pack_redir_scard_handle_ref(SMARTCARD_DEVICE* smartcard, wStream* s, REDIR_SCARDHANDLE* handle)
{
- UINT32 status;
-
- status = smartcard_pack_redir_scard_context_ref(smartcard, s, &(handle->Context));
-
- if (status)
- return status;
+ Stream_Write_UINT32(s, handle->cbHandle); /* Length (4 bytes) */
if (handle->cbHandle)
- {
- Stream_Write_UINT32(s, handle->cbHandle); /* Length (4 bytes) */
+ Stream_Write(s, &(handle->pbHandle), handle->cbHandle);
- if (handle->cbHandle > 4)
- Stream_Write_UINT64(s, handle->pbHandle.HighPart);
- else
- Stream_Write_UINT32(s, handle->pbHandle.LowPart);
- }
-
- return 0;
+ return SCARD_S_SUCCESS;
}
UINT32 smartcard_unpack_establish_context_call(SMARTCARD_DEVICE* smartcard, wStream* s, EstablishContext_Call* call)
void smartcard_trace_establish_context_return(SMARTCARD_DEVICE* smartcard, EstablishContext_Return* ret)
{
+ BYTE* pb;
+
if (!WLog_IsLevelActive(smartcard->log, WLOG_DEBUG))
return;
WLog_Print(smartcard->log, WLOG_DEBUG, "ReturnCode: 0x%08X", ret->ReturnCode);
+ pb = (BYTE*) &(ret->Context.pbContext);
+
if (ret->Context.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- ret->Context.pbContext.HighPart, ret->Context.pbContext.LowPart, ret->Context.cbContext);
+ 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);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- ret->Context.pbContext.LowPart, ret->Context.cbContext);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], ret->Context.cbContext);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "}");
void smartcard_trace_context_call(SMARTCARD_DEVICE* smartcard, Context_Call* call, const char* name)
{
+ BYTE* pb;
+
WLog_Print(smartcard->log, WLOG_DEBUG, "%s_Call {", name);
+ pb = (BYTE*) &(call->Context.pbContext);
+
if (call->Context.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- call->Context.pbContext.HighPart, call->Context.pbContext.LowPart, call->Context.cbContext);
+ 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);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- call->Context.pbContext.LowPart, call->Context.cbContext);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->Context.cbContext);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "}");
void smartcard_trace_list_readers_call(SMARTCARD_DEVICE* smartcard, ListReaders_Call* call, BOOL unicode)
{
+ BYTE* pb;
char* mszGroupsA = NULL;
if (!WLog_IsLevelActive(smartcard->log, WLOG_DEBUG))
if (unicode)
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) call->mszGroups, call->cBytes / 2, &mszGroupsA, 0, NULL, NULL);
- WLog_Print(smartcard->log, WLOG_DEBUG, "ListReaders_Call {");
+ WLog_Print(smartcard->log, WLOG_DEBUG, "ListReaders%S_Call {", unicode ? "W" : "A");
+
+ pb = (BYTE*) &(call->Context.pbContext);
if (call->Context.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- call->Context.pbContext.HighPart, call->Context.pbContext.LowPart, call->Context.cbContext);
+ 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);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- call->Context.pbContext.LowPart, call->Context.cbContext);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->Context.cbContext);
}
WLog_Print(smartcard->log, WLOG_DEBUG,
mszA[index] = ',';
}
- WLog_Print(smartcard->log, WLOG_DEBUG, "ListReaders_Return {");
+ WLog_Print(smartcard->log, WLOG_DEBUG, "ListReaders%s_Return {", unicode ? "W" : "A");
WLog_Print(smartcard->log, WLOG_DEBUG,
"ReturnCode: 0x%08X cBytes: %d msz: %s",
void smartcard_trace_connect_a_call(SMARTCARD_DEVICE* smartcard, ConnectA_Call* call)
{
+ BYTE* pb;
+
if (!WLog_IsLevelActive(smartcard->log, WLOG_DEBUG))
return;
WLog_Print(smartcard->log, WLOG_DEBUG, "ConnectA_Call {");
+ pb = (BYTE*) &(call->Common.Context);
+
if (call->Common.Context.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- call->Common.Context.pbContext.HighPart, call->Common.Context.pbContext.LowPart,
- call->Common.Context.cbContext);
+ 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);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- call->Common.Context.pbContext.LowPart, call->Common.Context.cbContext);
+ 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);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "szReader: %s dwShareMode: 0x%08X dwPreferredProtocols: 0x%08X",
void smartcard_trace_connect_w_call(SMARTCARD_DEVICE* smartcard, ConnectW_Call* call)
{
+ BYTE* pb;
char* szReaderA = NULL;
if (!WLog_IsLevelActive(smartcard->log, WLOG_DEBUG))
WLog_Print(smartcard->log, WLOG_DEBUG, "ConnectA_Call {");
+ pb = (BYTE*) &(call->Common.Context);
+
if (call->Common.Context.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- call->Common.Context.pbContext.HighPart, call->Common.Context.pbContext.LowPart,
- call->Common.Context.cbContext);
+ 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);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- call->Common.Context.pbContext.LowPart, call->Common.Context.cbContext);
+ 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);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "szReader: %s dwShareMode: 0x%08X dwPreferredProtocols: %d",
{
UINT32 status;
+ status = smartcard_pack_redir_scard_context(smartcard, s, &(ret->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_pack_redir_scard_handle(smartcard, s, &(ret->hCard));
if (status)
Stream_Write_UINT32(s, ret->dwActiveProtocol); /* dwActiveProtocol (4 bytes) */
+ status = smartcard_pack_redir_scard_context_ref(smartcard, s, &(ret->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_pack_redir_scard_handle_ref(smartcard, s, &(ret->hCard));
if (status)
void smartcard_trace_connect_return(SMARTCARD_DEVICE* smartcard, Connect_Return* ret)
{
+ BYTE* pb;
+
if (!WLog_IsLevelActive(smartcard->log, WLOG_DEBUG))
return;
WLog_Print(smartcard->log, WLOG_DEBUG, "Connect_Return {");
- if (ret->hCard.Context.cbContext > 4)
+ pb = (BYTE*) &(ret->hContext.pbContext);
+
+ if (ret->hContext.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- ret->hCard.Context.pbContext.HighPart, ret->hCard.Context.pbContext.LowPart,
- ret->hCard.Context.cbContext);
+ 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->hContext.cbContext);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- ret->hCard.Context.pbContext.LowPart, ret->hCard.Context.cbContext);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], ret->hContext.cbContext);
}
+ pb = (BYTE*) &(ret->hCard.pbHandle);
+
if (ret->hCard.cbHandle > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%08X%08X (%d)",
- ret->hCard.pbHandle.HighPart, ret->hCard.pbHandle.LowPart, ret->hCard.cbHandle);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 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->hCard.cbHandle);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%08X (%d)",
- ret->hCard.pbHandle.LowPart, ret->hCard.cbHandle);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], ret->hCard.cbHandle);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "dwActiveProtocol: 0x%08X",
{
UINT32 status;
+ status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle(smartcard, s, &(call->hCard));
if (status)
Stream_Read_UINT32(s, call->dwPreferredProtocols); /* dwPreferredProtocols (4 bytes) */
Stream_Read_UINT32(s, call->dwInitialization); /* dwInitialization (4 bytes) */
+ status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle_ref(smartcard, s, &(call->hCard));
if (status)
{
UINT32 status;
+ status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle(smartcard, s, &(call->hCard));
if (status)
Stream_Read_UINT32(s, call->dwDisposition); /* dwDisposition (4 bytes) */
+ status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle_ref(smartcard, s, &(call->hCard));
if (status)
void smartcard_trace_hcard_and_disposition_call(SMARTCARD_DEVICE* smartcard, HCardAndDisposition_Call* call, const char* name)
{
+ BYTE* pb;
+
WLog_Print(smartcard->log, WLOG_DEBUG, "%s_Call {", name);
- if (call->hCard.Context.cbContext > 4)
+ pb = (BYTE*) &(call->hContext.pbContext);
+
+ if (call->hContext.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- call->hCard.Context.pbContext.HighPart, call->hCard.Context.pbContext.LowPart,
- call->hCard.Context.cbContext);
+ 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->hContext.cbContext);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- call->hCard.Context.pbContext.LowPart, call->hCard.Context.cbContext);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->hContext.cbContext);
}
+ pb = (BYTE*) &(call->hCard.pbHandle);
+
if (call->hCard.cbHandle > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%08X%08X (%d)",
- call->hCard.pbHandle.HighPart, call->hCard.pbHandle.LowPart, call->hCard.pbHandle);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 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->hCard.cbHandle);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%08X (%d)",
- call->hCard.pbHandle.LowPart, call->hCard.pbHandle);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->hCard.cbHandle);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "dwDisposition: 0x%08X", call->dwDisposition);
void smartcard_trace_get_status_change_a_call(SMARTCARD_DEVICE* smartcard, GetStatusChangeA_Call* call)
{
+ BYTE* pb;
UINT32 index;
LPSCARD_READERSTATEA readerState;
WLog_Print(smartcard->log, WLOG_DEBUG, "GetStatusChangeA_Call {");
+ pb = (BYTE*) &(call->Context.pbContext);
+
if (call->Context.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- call->Context.pbContext.HighPart, call->Context.pbContext.LowPart, call->Context.cbContext);
+ 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);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- call->Context.pbContext.LowPart, call->Context.cbContext);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->Context.cbContext);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "dwTimeOut: 0x%08X cReaders: %d",
void smartcard_trace_get_status_change_w_call(SMARTCARD_DEVICE* smartcard, GetStatusChangeW_Call* call)
{
+ BYTE* pb;
UINT32 index;
LPSCARD_READERSTATEW readerState;
WLog_Print(smartcard->log, WLOG_DEBUG, "GetStatusChangeW_Call {");
+ pb = (BYTE*) &(call->Context.pbContext);
+
if (call->Context.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- call->Context.pbContext.HighPart, call->Context.pbContext.LowPart, call->Context.cbContext);
+ 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);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- call->Context.pbContext.LowPart, call->Context.cbContext);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->Context.cbContext);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "dwTimeOut: 0x%08X cReaders: %d",
{
UINT32 status;
+ status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle(smartcard, s, &(call->hCard));
if (status)
Stream_Read_UINT32(s, call->fpbAtrIsNULL); /* fpbAtrIsNULL (4 bytes) */
Stream_Read_UINT32(s, call->cbAtrLen); /* cbAtrLen (4 bytes) */
+ status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle_ref(smartcard, s, &(call->hCard));
if (status)
{
UINT32 status;
+ status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle(smartcard, s, &(call->hCard));
if (status)
Stream_Read_UINT32(s, call->cchReaderLen); /* cchReaderLen (4 bytes) */
Stream_Read_UINT32(s, call->cbAtrLen); /* cbAtrLen (4 bytes) */
+ status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle_ref(smartcard, s, &(call->hCard));
if (status)
void smartcard_trace_status_call(SMARTCARD_DEVICE* smartcard, Status_Call* call, BOOL unicode)
{
+ BYTE* pb;
+
if (!WLog_IsLevelActive(smartcard->log, WLOG_DEBUG))
return;
WLog_Print(smartcard->log, WLOG_DEBUG, "Status%s_Call {", unicode ? "W" : "A");
- if (call->hCard.Context.cbContext > 4)
+ pb = (BYTE*) &(call->hContext.pbContext);
+
+ if (call->hContext.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- call->hCard.Context.pbContext.HighPart, call->hCard.Context.pbContext.LowPart,
- call->hCard.Context.cbContext);
+ 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->hContext.cbContext);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- call->hCard.Context.pbContext.LowPart, call->hCard.Context.cbContext);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->hContext.cbContext);
}
+ pb = (BYTE*) &(call->hCard.pbHandle);
+
if (call->hCard.cbHandle > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%08X%08X (%d)",
- call->hCard.pbHandle.HighPart, call->hCard.pbHandle.LowPart, call->hCard.pbHandle);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 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->hCard.cbHandle);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%08X (%d)",
- call->hCard.pbHandle.LowPart, call->hCard.pbHandle);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->hCard.cbHandle);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "fmszReaderNamesIsNULL: %d cchReaderLen: %d cbAtrLen: %d",
{
UINT32 status;
+ status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle(smartcard, s, &(call->hCard));
if (status)
Stream_Read_UINT32(s, call->fpbAttrIsNULL); /* fpbAttrIsNULL (4 bytes) */
Stream_Read_UINT32(s, call->cbAttrLen); /* cbAttrLen (4 bytes) */
+ status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle_ref(smartcard, s, &(call->hCard));
if (status)
void smartcard_trace_get_attrib_call(SMARTCARD_DEVICE* smartcard, GetAttrib_Call* call)
{
+ BYTE* pb;
+
if (!WLog_IsLevelActive(smartcard->log, WLOG_DEBUG))
return;
WLog_Print(smartcard->log, WLOG_DEBUG, "GetAttrib_Call {");
- if (call->hCard.Context.cbContext > 4)
+ pb = (BYTE*) &(call->hContext.pbContext);
+
+ if (call->hContext.cbContext > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X%08X (%d)",
- call->hCard.Context.pbContext.HighPart, call->hCard.Context.pbContext.LowPart,
- call->hCard.Context.cbContext);
+ 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->hContext.cbContext);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%08X (%d)",
- call->hCard.Context.pbContext.LowPart, call->hCard.Context.cbContext);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hContext: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->hContext.cbContext);
}
+ pb = (BYTE*) &(call->hCard.pbHandle);
+
if (call->hCard.cbHandle > 4)
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%08X%08X (%d)",
- call->hCard.pbHandle.HighPart, call->hCard.pbHandle.LowPart, call->hCard.pbHandle);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 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->hCard.cbHandle);
}
else
{
- WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%08X (%d)",
- call->hCard.pbHandle.LowPart, call->hCard.pbHandle);
+ WLog_Print(smartcard->log, WLOG_DEBUG, "hCard: 0x%02X%02X%02X%02X (%d)",
+ pb[0], pb[1], pb[2], pb[3], call->hCard.cbHandle);
}
WLog_Print(smartcard->log, WLOG_DEBUG, "dwAttrId: %s (0x%08X) fpbAttrIsNULL: %d cbAttrLen: 0x%08X",
call->pvInBuffer = NULL;
+ status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle(smartcard, s, &(call->hCard));
if (status)
Stream_Read_UINT32(s, call->fpvOutBufferIsNULL); /* fpvOutBufferIsNULL (4 bytes) */
Stream_Read_UINT32(s, call->cbOutBufferSize); /* cbOutBufferSize (4 bytes) */
+ status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle_ref(smartcard, s, &(call->hCard));
if (status)
call->pioRecvPci = NULL;
call->pbSendBuffer = NULL;
+ status = smartcard_unpack_redir_scard_context(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle(smartcard, s, &(call->hCard));
if (status)
return STATUS_INVALID_PARAMETER;
}
+ status = smartcard_unpack_redir_scard_context_ref(smartcard, s, &(call->hContext));
+
+ if (status)
+ return status;
+
status = smartcard_unpack_redir_scard_handle_ref(smartcard, s, &(call->hCard));
if (status)