Microsoft KB Archive/229960

{|
 * width="100%"|

BUG: SCardGetAttrib Returns ERROR_OUTOFMEMORY When SCARD_AUTOALLOCATE Is Used

 * }

Q229960

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * Microsoft Windows 98
 * Microsoft Windows 95
 * the operating system: Microsoft Windows NT

-

SYMPTOMS
For Smart Card Resource Manager version 1.0, the SCardGetAttrib API may fail with ERROR_OUTOFMEMORY if the SCARD_AUTOALLOCATE feature is used.

CAUSE
The problem is caused by an anomaly in this API.

RESOLUTION
To work around this problem, instead, allocate the memory yourself.

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

MORE INFORMATION
The following code snippet reproduces the problem described above:

  LPBYTE pbValue = NULL; DWORD dwArrtId = SCARD_ATTR_VENDOR_NAME; DWORD dwLength = SCARD_AUTOALLOCATE; SCardGetAttrib(hCard, dwAttrId,(LPBYTE)&pbValue, &dwLength);