status = ret.ReturnCode =
SCardListReaderGroupsW(operation->hContext, (LPWSTR)&mszGroups, &cchGroups);
ret.msz = (BYTE*)mszGroups;
- ret.cBytes = cchGroups;
+ ret.cBytes = cchGroups * sizeof(WCHAR);
if (status != SCARD_S_SUCCESS)
return status;
ret.cbAtrLen = cbAtrLen;
}
+ /* SCardStatusW returns number of characters, we need number of bytes */
+ ret.cBytes *= sizeof(WCHAR);
+
status = smartcard_pack_status_return(smartcard, irp->output, &ret, TRUE);
if (status != SCARD_S_SUCCESS)
return status;
const ListReaderGroups_Return* ret, BOOL unicode)
{
DWORD index = 0;
- UINT32 size = unicode ? sizeof(WCHAR) : sizeof(CHAR);
- size *= ret->cBytes;
smartcard_trace_list_reader_groups_return(smartcard, ret, unicode);
if (ret->ReturnCode != SCARD_S_SUCCESS)
if (!Stream_EnsureRemainingCapacity(s, 4))
return SCARD_E_NO_MEMORY;
- Stream_Write_UINT32(s, size); /* cBytes (4 bytes) */
- if (!smartcard_ndr_pointer_write(s, &index, size))
+ Stream_Write_UINT32(s, ret->cBytes); /* cBytes (4 bytes) */
+ if (!smartcard_ndr_pointer_write(s, &index, ret->cBytes))
return SCARD_E_NO_MEMORY;
- return smartcard_ndr_write(s, ret->msz, size, 1, NDR_PTR_SIMPLE);
+ return smartcard_ndr_write(s, ret->msz, ret->cBytes, 1, NDR_PTR_SIMPLE);
}
LONG smartcard_unpack_list_readers_call(SMARTCARD_DEVICE* smartcard, wStream* s,
BOOL unicode)
{
DWORD index = 0;
- UINT32 size = unicode ? sizeof(WCHAR) : sizeof(CHAR);
- size *= ret->cBytes;
smartcard_trace_status_return(smartcard, ret, unicode);
if (ret->ReturnCode != SCARD_S_SUCCESS)
if (!Stream_EnsureRemainingCapacity(s, 4))
return SCARD_F_INTERNAL_ERROR;
- Stream_Write_UINT32(s, size); /* cBytes (4 bytes) */
- if (!smartcard_ndr_pointer_write(s, &index, size))
+ Stream_Write_UINT32(s, ret->cBytes); /* cBytes (4 bytes) */
+ if (!smartcard_ndr_pointer_write(s, &index, ret->cBytes))
return SCARD_E_NO_MEMORY;
if (!Stream_EnsureRemainingCapacity(s, 44))
Stream_Write_UINT32(s, ret->dwProtocol); /* dwProtocol (4 bytes) */
Stream_Write(s, ret->pbAtr, sizeof(ret->pbAtr)); /* pbAtr (32 bytes) */
Stream_Write_UINT32(s, ret->cbAtrLen); /* cbAtrLen (4 bytes) */
- return smartcard_ndr_write(s, ret->mszReaderNames, size, 1, NDR_PTR_SIMPLE);
+ return smartcard_ndr_write(s, ret->mszReaderNames, ret->cBytes, 1, NDR_PTR_SIMPLE);
}
LONG smartcard_unpack_get_attrib_call(SMARTCARD_DEVICE* smartcard, wStream* s, GetAttrib_Call* call)