RE: more CommEvents than expected
- From: v-raygon@xxxxxxxxxxxxxxxxxxxx (Rhett Gong [MSFT])
- Date: Thu, 07 Apr 2005 06:16:22 GMT
Hello
After checking your code, it seems that following lines are called several
times even if WaitCommEvent is not called in the for loop. Since dwEvtMask
works like a global variable to the for(::) loops, that is why you always
get the EV code repeated.
//-----------------------------------------
if (proc)
{
if (dwEvtMask & EV_DSR) printf("ev_dsr pin six fPending = %d ",
fPending);
if (dwEvtMask & EV_CTS) printf("ev_cts pin eight fPending = %d ",
fPending);
if (dwEvtMask & EV_RING) printf("ev_ring pin nine fPending = %d ",
fPending);
if (dwEvtMask & EV_RLSD) printf("ev_rlsd pin one fPending = %d ",
fPending);
if (GetCommModemStatus(hCom, &dwCommStatus))
printf("commStatus = %x\n", dwCommStatus);
else
printf("Error = %d\n", GetLastError());
}
//----------------------------------------
You may use following ways to resolve this issue:
1> clear dwEvtMask every time when you get into the new loop, I suggest you
add dwEvtMask=0 as following:
for(;;)
{
dwEvtMask =0;
proc = 0;
if (!fPending)
/.....
2> or you can add the " if(proc) ..." above when WaitCommEvent return TRUE,
like following:
if (WaitCommEvent(hCom, &dwEvtMask, &o))
{
proc = 1;
// add them
here
}
Please let me know if my answer helps you resolve the problem. If there is
anything more I can assist you, please feel free to let me know.
Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
.
- Follow-Ups:
- Re: more CommEvents than expected
- From: Chris Burnette
- Re: more CommEvents than expected
- References:
- more CommEvents than expected
- From: Tony
- more CommEvents than expected
- Prev by Date: Re: any way to hook process creation at kernel level in suspended ?
- Next by Date: RE: win application and ctfmon conflict
- Previous by thread: more CommEvents than expected
- Next by thread: Re: more CommEvents than expected
- Index(es):
Relevant Pages
|