winscard.dll
Vitaliy Margolen
wine-devel at kievinfo.com
Tue Sep 28 08:22:43 CDT 2010
On 09/28/2010 06:46 AM, viny wrote:
> Yes I started with this referenced discussion.
>
> Here is a first patch. With it, Winscard can identify your smartcard reader.
> + g_pcscliteHandle = wine_dlopen("libpcsclite.so", RTLD_LAZY | RTLD_GLOBAL, error, sizeof(error));
You need to use configure to get the so name of the library.
> +LONG WINAPI SCardListReadersA(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)
> +{
> + LONG retval;
> + LPSTR *pmszReaders;
> + LPSTR szList = NULL;
> + DWORD ListLength = 0;
> +
> + TRACE(" 0x%08X %p %p %p\n", (unsigned int) hContext, mszGroups, mszReaders, pcchReaders);
If you want to print a pointer, print it as a pointer, don't convert it into
int. It's not correct for 64-bit Wine.
> +LONG WINAPI SCardListReadersA(SCARDCONTEXT hContext, LPCSTR mszGroups, LPSTR mszReaders, LPDWORD pcchReaders)
> +{
> + LONG retval;
> + LPSTR *pmszReaders;
> + LPSTR szList = NULL;
> + DWORD ListLength = 0;
> +
> + TRACE(" 0x%08X %p %p %p\n", (unsigned int) hContext, mszGroups, mszReaders, pcchReaders);
> +
> + if (!pcchReaders)
> + retval = SCARD_E_INVALID_PARAMETER;
> + else if (!pSCardListReaders)
> + retval = SCARD_F_INTERNAL_ERROR;
> + else if (mszReaders && *pcchReaders == SCARD_AUTOALLOCATE)
> + {
> + /* get list from pcsc-lite */
> + *pmszReaders = (LPSTR*) mszReaders;
You corrupting memory here. You haven't assigned any memory to pmszReaders.
Did you mean to write "pmszReaders = (LPSTR) mszReaders;" ? In fact I don't
see you using the assigned value at all.
Also you have some trailing spaces in your patch.
Vitaliy.
More information about the wine-devel
mailing list