[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-smartcardsdk
Subject:    Re: SCardGetStatusChange problem
From:       "Rodriguez,Jaime P." <JRODRIGUEZ () CERNER ! COM>
Date:       1998-08-25 23:03:21
[Download RAW message or body]


Doug et al,
Thanks for your response. Unfortunately I do not think that is the ( reader
name ) problem cause that same code works OK most of the time. It is only
when I get in that race condition ( two threads accessing in this call )..

I looked at the code and that same function also calls ScardState, I recall
some one mentioning multi-thread problems with this call so I replaced them
with ScardStatus. I can still reproduce this error. Yesterday I posted a
note asking for the debug winscard.dll is there a way you can tell me if it
is possible to get it and from where so I can dive into it?

Thanks in advance,
Jaime

> -----Original Message-----
> From: Doug Barlow [SMTP:dbarlow@MICROSOFT.COM]
> Sent: Monday, August 24, 1998 6:04 PM
> To:   SmartCardSDK@DISCUSS.MICROSOFT.COM
> Subject:      Re: SCardGetStatusChange problem
>
> The call does repackage some of your data for transmission to the resource
> manager.  Make sure your psReader value is a null terminated string.  You
> don't have to set the cbAtr field - it assumes a reasonable ATR size
> (although it shouldn't hurt).
>
> Multiple threads using the same context should just automatically block,
> taking turns using the service.
>
> Doug Barlow
> Microsoft Corporation
>         -----Original Message-----
>         From:   Rodriguez,Jaime P. [SMTP:JRODRIGUEZ@CERNER.COM]
>         Sent:   Monday, August 24, 1998 12:24 PM
>         To:     SmartCardSDK@DISCUSS.MICROSOFT.COM
>         Subject:        SCardGetStatusChange problem
>
>         I am having a small problem with SCardGetStatusChange..
>         I get the following HEAP overflow...
>
>         First-chance exception in pcdasservernew.exe (KERNEL32.DLL):
> 0xE06D7363:
>         Microsoft C++ Exception.
>         HEAP[pcdasservernew.exe]: Invalid allocation size - 80100070
> (exceeded
>         7ffdefff)
>
>         Attached is my code...
>         I added the Critical Section as I was debugging cause I was afraid
> that I
>         was doing some thing wrong accessing this call from multiple
> threads.. Am I?
>         I try to avoid calling it from multiple threads but in some cases
> (
> when a
>         new process starts, and is initializing, I can not ). If they call
> in the
>         different threads, they are in the SAME Context.
>
>         Is there something I should be aware of? Am I doing something
> wrong
> here ? I
>         only get it like 1 out of 50 or more times when I am pulling card
> in
> and out
>         very often to reproduce this error..
>
>
>
>         Here is my code..
>                         SCARD_READERSTATE rd_state;
>                         rd_state.szReader  = psReader;
>                         rd_state.pvUserData = NULL;
>                         rd_state.dwCurrentState = SCARD_STATE_EMPTY ;
>                         rd_state.dwEventState   = 0;
>                         rd_state.cbAtr    = sizeof(rd_state.rgbAtr);
>                         memset(rd_state.rgbAtr, 0,
> sizeof(rd_state.rgbAtr));
>
>                         EnterCriticalSection(&g_StatusCS);
>         ***             lRet = SCardGetStatusChange ( hContext, 100,
> &rd_state,
>         (DWORD)1);
>                         LeaveCriticalSection(&g_StatusCS);
>
>         *** The debugger always points here when I get the exception..
>         NTDLL! 77f76148()
>         NTDLL! 77f7d70e()
>         NTDLL! 77f64b1c()
>         MSVCRT! 78001536()
>         WINSCARD! 5f289679()
>         WINSCARD! 5f28dc01()
>         WINSCARD! 5f286ea3()
>         WINSCARD! 5f286c71()
>         WINSCARD! 5f28494c()
>         CSmartCardCtl::GetCurrentStatus(CSmartCardCtl * const 0x011d0e60,
> long *
>         0x0012f05c) line 592 + 23 bytes
>
>
>         Any input or help is greatly appreciated.
>         Thanks in advance,

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic