Fixed SCard debug WCHAR string lengths
This commit is contained in:
parent
a4bf477cca
commit
b049265203
@ -421,7 +421,7 @@ static LONG smartcard_ListReaderGroupsW_Call(SMARTCARD_DEVICE* smartcard,
|
|||||||
status = ret.ReturnCode =
|
status = ret.ReturnCode =
|
||||||
SCardListReaderGroupsW(operation->hContext, (LPWSTR)&mszGroups, &cchGroups);
|
SCardListReaderGroupsW(operation->hContext, (LPWSTR)&mszGroups, &cchGroups);
|
||||||
ret.msz = (BYTE*)mszGroups;
|
ret.msz = (BYTE*)mszGroups;
|
||||||
ret.cBytes = cchGroups;
|
ret.cBytes = cchGroups * sizeof(WCHAR);
|
||||||
|
|
||||||
if (status != SCARD_S_SUCCESS)
|
if (status != SCARD_S_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
@ -1719,6 +1719,9 @@ static LONG smartcard_StatusW_Call(SMARTCARD_DEVICE* smartcard, SMARTCARD_OPERAT
|
|||||||
ret.cbAtrLen = cbAtrLen;
|
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);
|
status = smartcard_pack_status_return(smartcard, irp->output, &ret, TRUE);
|
||||||
if (status != SCARD_S_SUCCESS)
|
if (status != SCARD_S_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
|
@ -2043,8 +2043,6 @@ LONG smartcard_pack_list_reader_groups_return(SMARTCARD_DEVICE* smartcard, wStre
|
|||||||
const ListReaderGroups_Return* ret, BOOL unicode)
|
const ListReaderGroups_Return* ret, BOOL unicode)
|
||||||
{
|
{
|
||||||
DWORD index = 0;
|
DWORD index = 0;
|
||||||
UINT32 size = unicode ? sizeof(WCHAR) : sizeof(CHAR);
|
|
||||||
size *= ret->cBytes;
|
|
||||||
|
|
||||||
smartcard_trace_list_reader_groups_return(smartcard, ret, unicode);
|
smartcard_trace_list_reader_groups_return(smartcard, ret, unicode);
|
||||||
if (ret->ReturnCode != SCARD_S_SUCCESS)
|
if (ret->ReturnCode != SCARD_S_SUCCESS)
|
||||||
@ -2053,11 +2051,11 @@ LONG smartcard_pack_list_reader_groups_return(SMARTCARD_DEVICE* smartcard, wStre
|
|||||||
if (!Stream_EnsureRemainingCapacity(s, 4))
|
if (!Stream_EnsureRemainingCapacity(s, 4))
|
||||||
return SCARD_E_NO_MEMORY;
|
return SCARD_E_NO_MEMORY;
|
||||||
|
|
||||||
Stream_Write_UINT32(s, size); /* cBytes (4 bytes) */
|
Stream_Write_UINT32(s, ret->cBytes); /* cBytes (4 bytes) */
|
||||||
if (!smartcard_ndr_pointer_write(s, &index, size))
|
if (!smartcard_ndr_pointer_write(s, &index, ret->cBytes))
|
||||||
return SCARD_E_NO_MEMORY;
|
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,
|
LONG smartcard_unpack_list_readers_call(SMARTCARD_DEVICE* smartcard, wStream* s,
|
||||||
@ -2658,8 +2656,6 @@ LONG smartcard_pack_status_return(SMARTCARD_DEVICE* smartcard, wStream* s, const
|
|||||||
BOOL unicode)
|
BOOL unicode)
|
||||||
{
|
{
|
||||||
DWORD index = 0;
|
DWORD index = 0;
|
||||||
UINT32 size = unicode ? sizeof(WCHAR) : sizeof(CHAR);
|
|
||||||
size *= ret->cBytes;
|
|
||||||
|
|
||||||
smartcard_trace_status_return(smartcard, ret, unicode);
|
smartcard_trace_status_return(smartcard, ret, unicode);
|
||||||
if (ret->ReturnCode != SCARD_S_SUCCESS)
|
if (ret->ReturnCode != SCARD_S_SUCCESS)
|
||||||
@ -2668,8 +2664,8 @@ LONG smartcard_pack_status_return(SMARTCARD_DEVICE* smartcard, wStream* s, const
|
|||||||
if (!Stream_EnsureRemainingCapacity(s, 4))
|
if (!Stream_EnsureRemainingCapacity(s, 4))
|
||||||
return SCARD_F_INTERNAL_ERROR;
|
return SCARD_F_INTERNAL_ERROR;
|
||||||
|
|
||||||
Stream_Write_UINT32(s, size); /* cBytes (4 bytes) */
|
Stream_Write_UINT32(s, ret->cBytes); /* cBytes (4 bytes) */
|
||||||
if (!smartcard_ndr_pointer_write(s, &index, size))
|
if (!smartcard_ndr_pointer_write(s, &index, ret->cBytes))
|
||||||
return SCARD_E_NO_MEMORY;
|
return SCARD_E_NO_MEMORY;
|
||||||
|
|
||||||
if (!Stream_EnsureRemainingCapacity(s, 44))
|
if (!Stream_EnsureRemainingCapacity(s, 44))
|
||||||
@ -2679,7 +2675,7 @@ LONG smartcard_pack_status_return(SMARTCARD_DEVICE* smartcard, wStream* s, const
|
|||||||
Stream_Write_UINT32(s, ret->dwProtocol); /* dwProtocol (4 bytes) */
|
Stream_Write_UINT32(s, ret->dwProtocol); /* dwProtocol (4 bytes) */
|
||||||
Stream_Write(s, ret->pbAtr, sizeof(ret->pbAtr)); /* pbAtr (32 bytes) */
|
Stream_Write(s, ret->pbAtr, sizeof(ret->pbAtr)); /* pbAtr (32 bytes) */
|
||||||
Stream_Write_UINT32(s, ret->cbAtrLen); /* cbAtrLen (4 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)
|
LONG smartcard_unpack_get_attrib_call(SMARTCARD_DEVICE* smartcard, wStream* s, GetAttrib_Call* call)
|
||||||
|
Loading…
Reference in New Issue
Block a user