1 /* Unit test suite for comm functions
3 * Copyright 2003 Kevin Groeneveld
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/test.h"
32 COMMTIMEOUTS timeouts1, timeouts2;
38 "baud=9600 parity=e data=5 stop=1 xon=on odsr=off octs=off dtr=on rts=on idsr=on",
40 { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x02, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
41 { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x02, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
42 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
43 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
46 "baud=0 parity=M data=6 stop=1.5 xon=off odsr=on octs=ON dtr=off rts=off idsr=OFF",
48 { 0x00000000, 0x00000000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x03, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
49 { 0xffffffff, 0x00000000, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x03, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
50 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
51 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
54 "BAUD=4000000000 parity=n data=7 stop=2 to=off",
56 { 0x00000000, 0xee6b2800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x00, 0x02, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
57 { 0xffffffff, 0xee6b2800, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x00, 0x02, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
58 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
59 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }
62 "Baud=115200 Parity=O Data=8 To=On",
64 { 0x00000000, 0x0001c200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x01, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
65 { 0xffffffff, 0x0001c200, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x01, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
66 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 },
67 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 }
70 "PaRiTy=s Data=7 DTR=on",
72 { 0x00000000, 0x00000000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x04, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
73 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x04, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
74 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
75 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
80 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
81 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
82 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
83 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
88 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
89 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
90 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
91 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
96 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
97 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
98 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
99 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
104 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
105 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
106 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
107 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
112 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
113 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
114 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
115 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
120 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
121 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
122 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
123 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
128 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
129 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
130 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
131 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
136 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
137 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
138 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
139 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
144 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
145 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
146 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
147 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
152 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
153 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
154 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
155 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
160 { 0x00000000, 0x0000006e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
161 { 0xffffffff, 0x0000006e, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
162 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
163 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
168 { 0x00000000, 0x0000012c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x02, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
169 { 0xffffffff, 0x0000012c, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x02, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
170 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
171 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
176 { 0x00000000, 0x00000258, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x03, 0x02, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
177 { 0xffffffff, 0x00000258, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x03, 0x02, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
178 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
179 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
184 { 0x00000000, 0x000004b0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x01, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
185 { 0xffffffff, 0x000004b0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x01, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
186 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
187 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
192 { 0x00000000, 0x00000960, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x04, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
193 { 0xffffffff, 0x00000960, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x04, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
194 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
195 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
200 { 0x00000000, 0x000012c0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
201 { 0xffffffff, 0x000012c0, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
202 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
203 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
208 { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
209 { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
210 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
211 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
216 { 0x00000000, 0x00004b00, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x02, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
217 { 0xffffffff, 0x00004b00, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x02, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
218 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
219 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
224 { 0x00000000, 0x00000000, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x03, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
225 { 0xffffffff, 0x00000000, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x03, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
226 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
227 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
230 "4000000000,O,7,1.5,X",
232 { 0x00000000, 0xee6b2800, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x01, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
233 { 0xffffffff, 0xee6b2800, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x01, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
234 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
235 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
240 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
241 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
242 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
243 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
248 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
249 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
250 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
251 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
256 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
257 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
258 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
259 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
264 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
265 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
266 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
267 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
272 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
273 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
274 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
275 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
280 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
281 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
282 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
283 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
288 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
289 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
290 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
291 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
296 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
297 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
298 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
299 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
302 "COMx:baud=38400 data=8",
304 { 0x00000000, 0x00009600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
305 { 0xffffffff, 0x00009600, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0xff, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
306 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
307 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
310 "COMx :to=on stop=1.5",
312 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x01, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
313 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0x01, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
314 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 },
315 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 }
318 "COMx: baud=12345 data=7",
320 { 0x00000000, 0x00003039, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
321 { 0xffffffff, 0x00003039, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0xff, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
322 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
323 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
326 "COMx : xon=on odsr=off",
328 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
329 { 0xffffffff, 0xffffffff, 1, 1, 1, 0, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
330 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
331 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
336 { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
337 { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
338 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
339 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
344 { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
345 { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
346 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
347 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
352 { 0x00000000, 0x0000006e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x02, 0x02, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
353 { 0xffffffff, 0x0000006e, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x02, 0x02, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
354 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
355 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
360 { 0x00000000, 0x00004b00, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x03, 0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
361 { 0xffffffff, 0x00004b00, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x03, 0x00, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
362 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
363 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
366 "COMx : 57600,S,6,2,x",
368 { 0x00000000, 0x0000e100, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x04, 0x02, (char)0x00, (char)0x00, (char)0x00, (char)0x00, (char)0x00, 0x0000 },
369 { 0xffffffff, 0x0000e100, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x04, 0x02, (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0xff, 0xffff },
370 { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
371 { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
375 #define TEST_COUNT (sizeof(test) / sizeof(TEST))
377 /* This function can be useful if you are modifiying the test cases and want to
378 output the contents of a DCB structure. */
379 /*static print_dcb(DCB *pdcb)
381 printf("0x%08x, 0x%08x, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, %u, 0x%05x, 0x%04x, 0x%04x, 0x%04x, 0x%02x, 0x%02x, 0x%02x, (char)0x%02x, (char)0x%02x, (char)0x%02x, (char)0x%02x, (char)0x%02x, 0x%04x\n",
389 pdcb->fDsrSensitivity,
390 pdcb->fTXContinueOnXoff,
404 pdcb->XonChar & 0xff,
405 pdcb->XoffChar & 0xff,
406 pdcb->ErrorChar & 0xff,
407 pdcb->EofChar & 0xff,
408 pdcb->EvtChar & 0xff,
409 pdcb->wReserved1 & 0xffff );
412 static void check_result(const char *function, TEST *ptest, int initial_value, BOOL result)
414 DWORD LastError = GetLastError();
415 DWORD CorrectError = (ptest->result ? 0xdeadbeef : ERROR_INVALID_PARAMETER);
417 ok(LastError == CorrectError, "%s(\"%s\"), 0x%02x: GetLastError() returned 0x%08lx, should be 0x%08lx\n", function, ptest->string, initial_value, LastError, CorrectError);
418 ok(result == ptest->result, "%s(\"%s\"), 0x%02x: return value should be %s\n", function, ptest->string, initial_value, ptest->result ? "TRUE" : "FALSE");
421 #define check_dcb_member(a,b) ok(pdcb1->a == pdcb2->a, "%s(\"%s\"), 0x%02x: "#a" is "b", should be "b"\n", function, ptest->string, initial_value, pdcb1->a, pdcb2->a)
422 #define check_dcb_member2(a,c,b) if(pdcb2->a == c) { check_dcb_member(a,b); } else { ok(pdcb1->a == pdcb2->a || pdcb1->a == c, "%s(\"%s\"), 0x%02x: "#a" is "b", should be "b" or "b"\n", function, ptest->string, initial_value, pdcb1->a, pdcb2->a, c); }
424 static void check_dcb(const char *function, TEST *ptest, int initial_value, DCB *pdcb1, DCB *pdcb2)
426 /* DCBlength is a special case since Win 9x sets it but NT does not.
427 We will accept either as correct. */
428 check_dcb_member2(DCBlength, (DWORD)sizeof(DCB), "%lu");
430 /* For old style control strings Win 9x does not set the next five members, NT does. */
431 if(ptest->old_style && ptest->result)
433 check_dcb_member2(fOutxCtsFlow, ((unsigned int)initial_value & 1), "%u");
434 check_dcb_member2(fDtrControl, ((unsigned int)initial_value & 3), "%u");
435 check_dcb_member2(fOutX, ((unsigned int)initial_value & 1), "%u");
436 check_dcb_member2(fInX, ((unsigned)initial_value & 1), "%u");
437 check_dcb_member2(fRtsControl, ((unsigned)initial_value & 3), "%u");
441 check_dcb_member(fOutxCtsFlow, "%u");
442 check_dcb_member(fDtrControl, "%u");
443 check_dcb_member(fOutX, "%u");
444 check_dcb_member(fInX, "%u");
445 check_dcb_member(fRtsControl, "%u");
450 /* For the idsr=xxx parameter, NT sets fDsrSensitivity, 9x sets
452 if(!ptest->old_style)
454 check_dcb_member2(fOutxDsrFlow, pdcb2->fDsrSensitivity, "%u");
455 check_dcb_member2(fDsrSensitivity, pdcb2->fOutxDsrFlow, "%u");
459 /* For old style control strings Win 9x does not set the
460 fOutxDsrFlow member, NT does. */
461 check_dcb_member2(fOutxDsrFlow, ((unsigned int)initial_value & 1), "%u");
462 check_dcb_member(fDsrSensitivity, "%u");
467 check_dcb_member(fOutxDsrFlow, "%u");
468 check_dcb_member(fDsrSensitivity, "%u");
471 /* Check the result of the DCB members. */
472 check_dcb_member(BaudRate, "%lu");
473 check_dcb_member(fBinary, "%u");
474 check_dcb_member(fParity, "%u");
475 check_dcb_member(fTXContinueOnXoff, "%u");
476 check_dcb_member(fErrorChar, "%u");
477 check_dcb_member(fNull, "%u");
478 check_dcb_member(fAbortOnError, "%u");
479 check_dcb_member(fDummy2, "%u");
480 check_dcb_member(wReserved, "%u");
481 check_dcb_member(XonLim, "%u");
482 check_dcb_member(XoffLim, "%u");
483 check_dcb_member(ByteSize, "%u");
484 check_dcb_member(Parity, "%u");
485 check_dcb_member(StopBits, "%u");
486 check_dcb_member(XonChar, "%d");
487 check_dcb_member(XoffChar, "%d");
488 check_dcb_member(ErrorChar, "%d");
489 check_dcb_member(EofChar, "%d");
490 check_dcb_member(EvtChar, "%d");
491 check_dcb_member(wReserved1, "%u");
494 #define check_timeouts_member(a) ok(ptimeouts1->a == ptimeouts2->a, "%s(\"%s\"), 0x%02x: "#a" is %lu, should be %lu\n", function, ptest->string, initial_value, ptimeouts1->a, ptimeouts2->a);
496 static void check_timeouts(const char *function, TEST *ptest, int initial_value, COMMTIMEOUTS *ptimeouts1, COMMTIMEOUTS *ptimeouts2)
498 check_timeouts_member(ReadIntervalTimeout);
499 check_timeouts_member(ReadTotalTimeoutMultiplier);
500 check_timeouts_member(ReadTotalTimeoutConstant);
501 check_timeouts_member(WriteTotalTimeoutMultiplier);
502 check_timeouts_member(WriteTotalTimeoutConstant);
505 static void test_BuildCommDCBA(TEST *ptest, int initial_value, DCB *pexpected_dcb)
510 /* set initial conditions */
511 memset(&dcb, initial_value, sizeof(DCB));
512 SetLastError(0xdeadbeef);
514 result = BuildCommDCBA(ptest->string, &dcb);
517 check_result("BuildCommDCBA", ptest, initial_value, result);
518 check_dcb("BuildCommDCBA", ptest, initial_value, &dcb, pexpected_dcb);
521 static void test_BuildCommDCBAndTimeoutsA(TEST *ptest, int initial_value, DCB *pexpected_dcb, COMMTIMEOUTS *pexpected_timeouts)
525 COMMTIMEOUTS timeouts;
527 /* set initial conditions */
528 memset(&dcb, initial_value, sizeof(DCB));
529 memset(&timeouts, initial_value, sizeof(COMMTIMEOUTS));
530 SetLastError(0xdeadbeef);
532 result = BuildCommDCBAndTimeoutsA(ptest->string, &dcb, &timeouts);
535 check_result("BuildCommDCBAndTimeoutsA", ptest, initial_value, result);
536 check_dcb("BuildCommDCBAndTimeoutsA", ptest, initial_value, &dcb, pexpected_dcb);
537 check_timeouts("BuildCommDCBAndTimeoutsA", ptest, initial_value, &timeouts, pexpected_timeouts);
540 static void test_BuildCommDCBW(TEST *ptest, int initial_value, DCB *pexpected_dcb)
544 WCHAR wide_string[sizeof(ptest->string)];
546 MultiByteToWideChar(CP_ACP, 0, ptest->string, -1, wide_string, sizeof(wide_string) / sizeof(WCHAR));
548 /* set initial conditions */
549 memset(&dcb, initial_value, sizeof(DCB));
550 SetLastError(0xdeadbeef);
552 result = BuildCommDCBW(wide_string, &dcb);
554 if(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
558 check_result("BuildCommDCBW", ptest, initial_value, result);
559 check_dcb("BuildCommDCBW", ptest, initial_value, &dcb, pexpected_dcb);
562 static void test_BuildCommDCBAndTimeoutsW(TEST *ptest, int initial_value, DCB *pexpected_dcb, COMMTIMEOUTS *pexpected_timeouts)
566 COMMTIMEOUTS timeouts;
567 WCHAR wide_string[sizeof(ptest->string)];
569 MultiByteToWideChar(CP_ACP, 0, ptest->string, -1, wide_string, sizeof(wide_string) / sizeof(WCHAR));
571 /* set initial conditions */
572 memset(&dcb, initial_value, sizeof(DCB));
573 memset(&timeouts, initial_value, sizeof(COMMTIMEOUTS));
574 SetLastError(0xdeadbeef);
576 result = BuildCommDCBAndTimeoutsW(wide_string, &dcb, &timeouts);
578 if(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
582 check_result("BuildCommDCBAndTimeoutsA", ptest, initial_value, result);
583 check_dcb("BuildCommDCBAndTimeoutsA", ptest, initial_value, &dcb, pexpected_dcb);
584 check_timeouts("BuildCommDCBAndTimeoutsA", ptest, initial_value, &timeouts, pexpected_timeouts);
587 static void test_BuildCommDCB(void)
589 char port_name[] = "COMx";
594 /* Some of these tests require a valid COM port. This loop will try to find
596 for(port_name[3] = '1'; port_name[3] <= '9'; port_name[3]++)
598 COMMCONFIG commconfig;
599 DWORD size = sizeof(COMMCONFIG);
601 if(GetDefaultCommConfig(port_name, &commconfig, &size))
609 trace("Could not find a valid COM port. Some tests will be skipped.\n");
611 for(i = 0; i < TEST_COUNT; i++)
613 /* Check if this test case needs a valid COM port. */
614 ptr = strstr(test[i].string, "COMx");
616 /* If required, substitute valid port number into device control string. */
625 test_BuildCommDCBA(&test[i], 0x00, &test[i].dcb1);
626 test_BuildCommDCBA(&test[i], 0xff, &test[i].dcb2);
627 test_BuildCommDCBAndTimeoutsA(&test[i], 0x00, &test[i].dcb1, &test[i].timeouts1);
628 test_BuildCommDCBAndTimeoutsA(&test[i], 0xff, &test[i].dcb2, &test[i].timeouts2);
630 test_BuildCommDCBW(&test[i], 0x00, &test[i].dcb1);
631 test_BuildCommDCBW(&test[i], 0xff, &test[i].dcb2);
632 test_BuildCommDCBAndTimeoutsW(&test[i], 0x00, &test[i].dcb1, &test[i].timeouts1);
633 test_BuildCommDCBAndTimeoutsW(&test[i], 0xff, &test[i].dcb2, &test[i].timeouts2);