According to MSDN there is special virtual reader \?PNP?\Notification that allows get notification of arrival of new smartcard reader (via SCardGetStatusChange function). My code look like (error handling and checks are omitted):
while (true)
{
SCardGetStatusChange(hContext, INFINITE, rgReaderStates, cReaders);
// rgReaderStates[0] - \\?PNP?\Notification
WorkWithNewReader();
}
This code works perfect on non-terminal session. But via Citrix terminal session function SCardGetStatusChange immediately returns and rgReaderStates[0].dwEventState is 7 (SCARD_STATE_UNKNOWN). So, how i could recieve notification of inserting new smartcard reader?