27 #include <winpr/comm.h>
28 #include <winpr/crt.h>
32 static BOOL test_SerialSys(HANDLE hComm)
38 int TestHandflow(
int argc,
char* argv[])
40 struct stat statbuf = { 0 };
44 if (stat(
"/dev/ttyS0", &statbuf) < 0)
46 (void)fprintf(stderr,
"/dev/ttyS0 not available, making the test to succeed though\n");
50 result = DefineCommDevice(
"COM1",
"/dev/ttyS0");
53 (void)fprintf(stderr,
"DefineCommDevice failure: 0x%x\n", GetLastError());
57 hComm = CreateFile(
"COM1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
58 if (hComm == INVALID_HANDLE_VALUE)
60 (void)fprintf(stderr,
"CreateFileA failure: 0x%x\n", GetLastError());
64 _comm_setServerSerialDriver(hComm, SerialDriverSerialSys);
65 if (!test_SerialSys(hComm))
67 (void)fprintf(stderr,
"test_SerCxSys failure\n");
85 if (!CloseHandle(hComm))
87 (void)fprintf(stderr,
"CloseHandle failure, GetLastError()=%08x\n", GetLastError());