if (WAIT_OBJECT_0 == WaitForSingleObjectEx(hEvent,
INFINITE, // Wait forever.
TRUE))
{
SetWaitableTimer(hTimer, // Handle to the timer object.
&liDueTime, // When timer will become signaled.
0, // Periodic timer interval of 2 seconds.
TimerAPCProc, // Completion routine.
NULL, // Argument to the completion routine.
FALSE );
}
else
{
HANDLE hD;
hD=CreateFile(name_device,
GENERIC_WRITE,
FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL);
ULONG nyte=0;
if (hD!=INVALID_HANDLE_VALUE)
{
char InterfaceInfo[512];
DeviceIoControl (hD,
IOCTL_Ezusb_GET_PIPE_INFO,
NULL,
0,
&InterfaceInfo,
sizeof(InterfaceInfo),
(unsigned long *)&nyte,
NULL);
if (nyte>16)
{
for (int pipe=0; pipe!=6 ; pipe++)
{
DeviceIoControl(hD,
IOCTL_Ezusb_ABORTPIPE,
&pipe,
sizeof(int),
NULL,
0,
&nyte,
NULL);
}
}
}
CloseHandle(hD);
Terminate();
}