libwinpr-winscard: add WINPR_WINSCARD_LOCK_TRANSACTIONS environment variable, fix winpr_HexDump line feeds

This commit is contained in:
Marc-André Moreau 2015-01-20 15:29:05 -05:00
parent ee51da8500
commit f0fc27f7bd
3 changed files with 26 additions and 1 deletions

View File

@ -2091,6 +2091,13 @@ UINT32 smartcard_unpack_transmit_call(SMARTCARD_DEVICE* smartcard, wStream* s, T
Stream_Read_UINT32(s, call->fpbRecvBufferIsNULL); /* fpbRecvBufferIsNULL (4 bytes) */
Stream_Read_UINT32(s, call->cbRecvLength); /* cbRecvLength (4 bytes) */
if (pioRecvPciNdrPtr)
{
WLog_WARN(TAG, "Transmit_Call with pioRecvPci:");
winpr_HexDump(TAG, WLOG_WARN, Stream_Pointer(s) - 32,
Stream_GetRemainingLength(s) + 32);
}
if (ioSendPci.cbExtraBytes > 1024)
{
WLog_WARN(TAG, "Transmit_Call ioSendPci.cbExtraBytes is out of bounds: %d (max: %d)",

View File

@ -2811,8 +2811,27 @@ extern int PCSC_InitializeSCardApi_Link(void);
int PCSC_InitializeSCardApi(void)
{
DWORD nSize;
char* env = NULL;
nSize = GetEnvironmentVariableA("WINPR_WINSCARD_LOCK_TRANSACTIONS", NULL, 0);
if (nSize)
{
env = (LPSTR) malloc(nSize);
nSize = GetEnvironmentVariableA("WINPR_WINSCARD_LOCK_TRANSACTIONS", env, nSize);
if (strcmp(env, "1") == 0)
g_LockTransactions = TRUE;
else if (strcmp(env, "0") == 0)
g_LockTransactions = FALSE;
free(env);
}
/* Disable pcsc-lite's (poor) blocking so we can handle it ourselves */
SetEnvironmentVariableA("PCSCLITE_NO_BLOCKING", "1");
#ifndef DISABLE_PCSC_LINK
if (PCSC_InitializeSCardApi_Link() >= 0)

View File

@ -65,7 +65,6 @@ void winpr_HexDump(const char* tag, int level, const BYTE* data, int length)
pos += trio_snprintf(&buffer[pos], blen - pos, "%c",
(p[i] >= 0x20 && p[i] < 0x7F) ? p[i] : '.');
pos += trio_snprintf(&buffer[pos], blen - pos, "\n");
WLog_LVL(tag, level, "%s", buffer);
offset += line;
p += line;