status = ret.ReturnCode = SCardListReadersA(hContext, (LPCSTR) call.mszGroups, (LPSTR) &mszReaders, &cchReaders);
- if (status)
- return status;
-
ret.msz = (BYTE*) mszReaders;
ret.cBytes = cchReaders;
+ if (status)
+ return status;
+
status = smartcard_pack_list_readers_return(smartcard, irp->output, &ret);
if (status)
status = ret.ReturnCode = SCardListReadersW(hContext, (LPCWSTR) call.mszGroups, (LPWSTR) &mszReaders, &cchReaders);
+ ret.msz = (BYTE*) mszReaders;
+ ret.cBytes = cchReaders * 2;
+
if (status)
return status;
- ret.msz = (BYTE*) mszReaders;
- ret.cBytes = cchReaders;
-
status = smartcard_pack_list_readers_return(smartcard, irp->output, &ret);
if (status)
}
ret.mszReaderNames = (BYTE*) mszReaderNames;
- ret.cBytes = smartcard_multi_string_length_a((char*) ret.mszReaderNames) + 2;
+ ret.cBytes = cchReaderLen * 2;
status = smartcard_pack_status_return(smartcard, irp->output, &ret);
}
ret.mszReaderNames = (BYTE*) mszReaderNames;
- ret.cBytes = (smartcard_multi_string_length_w((WCHAR*) ret.mszReaderNames) + 2) * 2;
+ ret.cBytes = cchReaderLen * 2;
status = smartcard_pack_status_return(smartcard, irp->output, &ret);
call.cbAttrLen = 0;
if (call.cbAttrLen)
- ret.pbAttr = malloc(call.cbAttrLen);
+ ret.pbAttr = (BYTE*) malloc(call.cbAttrLen);
cbAttrLen = call.cbAttrLen;
smartcard_get_ioctl_string(ioControlCode, TRUE), ioControlCode, result);
}
- if (Stream_GetPosition(irp->input) < Stream_Length(irp->input))
+ if (((size_t) Stream_GetPosition(irp->input)) < Stream_Length(irp->input))
{
UINT32 difference;
winpr_HexDump(Stream_Pointer(irp->input), difference);
}
- if (Stream_GetPosition(irp->input) > Stream_Length(irp->input))
+ if (((size_t) Stream_GetPosition(irp->input)) > Stream_Length(irp->input))
{
UINT32 difference;
return STATUS_BUFFER_TOO_SMALL;
}
- readerState->szReader = malloc(count + 1);
+ readerState->szReader = (unsigned char*) malloc(count + 1);
Stream_Read(s, readerState->szReader, count);
smartcard_unpack_read_size_align(smartcard, s, count, 4);
readerState->szReader[count] = '\0';
return STATUS_BUFFER_TOO_SMALL;
}
- readerState->szReader = malloc((count + 1) * 2);
+ readerState->szReader = (WCHAR*) malloc((count + 1) * 2);
Stream_Read(s, readerState->szReader, (count * 2));
smartcard_unpack_read_size_align(smartcard, s, (count * 2), 4);
readerState->szReader[count] = '\0';
if (status && *pMszReadersA)
{
- *pcchReaders = ConvertToUnicode(CP_UTF8, 0, *pMszReadersA, *pcchReaders, (WCHAR**) mszReaders, 0) * 2;
+ *pcchReaders = ConvertToUnicode(CP_UTF8, 0, *pMszReadersA, *pcchReaders, (WCHAR**) mszReaders, 0);
PCSC_AddMemoryBlock(hContext, mszReaders);
}
if (mszReadersA)
{
- *pcchReaders = ConvertToUnicode(CP_UTF8, 0, mszReadersA, *pcchReaders, (WCHAR**) mszReaders, 0) * 2;
+ *pcchReaders = ConvertToUnicode(CP_UTF8, 0, mszReadersA, *pcchReaders, (WCHAR**) mszReaders, 0);
PCSC_AddMemoryBlock(hContext, mszReaders);
PCSC_SCardFreeMemory(hContext, mszReadersA);
if (mszReaderNamesA)
{
- *pcchReaderLen = ConvertToUnicode(CP_UTF8, 0, mszReaderNamesA, *pcchReaderLen, (WCHAR**) mszReaderNames, 0) * 2;
+ *pcchReaderLen = ConvertToUnicode(CP_UTF8, 0, mszReaderNamesA, *pcchReaderLen, (WCHAR**) mszReaderNames, 0);
PCSC_AddMemoryBlock(hContext, mszReaderNames);
PCSC_SCardFreeMemory(hContext, mszReaderNamesA);
int length;
WCHAR* pbAttrW = NULL;
- length = ConvertToUnicode(CP_UTF8, 0, (char*) pbAttr, *pcbAttrLen, &pbAttrW, 0) * 2;
+ length = ConvertToUnicode(CP_UTF8, 0, (char*) pbAttr, *pcbAttrLen, &pbAttrW, 0);
PCSC_SCardFreeMemory(hContext, pbAttrA);