Hi Pelle,
IMHO there is a bug. Following code shows the problem:
#include <stdio.h>
#include <stddef.h>
#include <windows.h>
int main(int argc, char *argv[])
{
DCB dcb={sizeof(DCB)};
HANDLE h = CreateFileA("COM1:", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
GetCommState(h, &dcb);
printf("ByteSize is at offset %d\n", offsetof(DCB, ByteSize)); // 22 (and should be 18)
printf("ByteSize is %d\n", dcb.ByteSize); // 0
dcb.XonLim=20;
if(!SetCommState(h, &dcb))
{
printf("Error where none should be...\n");
}
CloseHandle(h);
return 0;
}
Kindly regards,
Andreas Martin