[KERNEL32]
[reactos.git] / rostests / winetests / kernel32 / comm.c
index 5fb8613..8ce6ccc 100755 (executable)
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <stdio.h>
@@ -27,7 +27,7 @@
 #define TIMEOUT 1000   /* one second for Timeouts*/
 #define SLOWBAUD 150
 #define FASTBAUD 115200
-#define TIMEDELTA 100  /* 100 ms uncertainty allowed */
+#define TIMEDELTA 150  /* 150 ms uncertainty allowed */
 
 /* Define the appropriate LOOPBACK(s) TRUE if you have a Loopback cable with
  * the mentioned shorts connected to your Serial port
@@ -56,336 +56,336 @@ static TEST test[] =
        {
                "baud=9600 parity=e data=5 stop=1 xon=on odsr=off octs=off dtr=on rts=on idsr=on",
                TRUE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x02, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "baud=0 parity=M data=6 stop=1.5 xon=off odsr=on octs=ON dtr=off rts=off idsr=OFF",
                TRUE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00000000, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x03, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "BAUD=4000000000 parity=n data=7 stop=2 to=off",
                TRUE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0xee6b2800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xee6b2800, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 }
        },
        {
                "Baud=115200 Parity=O Data=8 To=On",
                TRUE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x0001c200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x0001c200, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 }
        },
        {
                "PaRiTy=s           Data=7          DTR=on",
                TRUE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x04, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "data=4",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "data=9",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "parity=no",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "stop=0",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "stop=1.501",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "stop=3",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "to=foobar",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                " baud=9600",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "baud= 9600",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "baud=9600,data=8",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "11,n,8,1",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x0000006e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x0000006e, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "30 ,E, 5,1.5",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x0000012c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x0000012c, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x02, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "60, m, 6, 2 ",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000258, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00000258, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x03, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "12 , o , 7 , 1",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x000004b0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x000004b0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x01, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "24,s,8,1.5",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000960, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00000960, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x04, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "48,n,8,1,p",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x000012c0, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x000012c0, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "96,N,8,1 , x ",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "19, e, 7, 1, x",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00004b00, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00004b00, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x02, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "0,M,7,1,P",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00000000, 1, 1, 1, 1, 2, 1, 1, 0, 0, 1, 1, 2, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "4000000000,O,7,1.5,X",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0xee6b2800, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xee6b2800, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x01, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "96,N,8,1 to=on",
                FALSE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "96,NO,8,1",
                FALSE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "96,N,4,1",
                FALSE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "96,N,9,1",
                FALSE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "96,N,8,0",
                FALSE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "96,N,8,3",
                FALSE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "96,N,8,1,K",
                FALSE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "COM0:baud=115200",
                FALSE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "COMx:baud=38400 data=8",
                TRUE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00009600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00009600, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "COMx  :to=on stop=1.5",
                TRUE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0000EA60 }
        },
        {
                "COMx:               baud=12345     data=7",
                TRUE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00003039, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00003039, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "COMx : xon=on odsr=off",
                TRUE, FALSE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 0, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "COM0:9600,N,8,1",
                FALSE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00000000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0xffffffff, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 3, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "COMx:9600,N,8,1",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00002580, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00002580, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "COMx:  11,E,7,2",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x0000006e, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x07, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x0000006e, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x07, 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "COMx  :19,M,5,1",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x00004b00, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x00004b00, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x05, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
        {
                "COMx  :    57600,S,6,2,x",
                TRUE, TRUE,
-               { 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 },
-               { 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 },
+               { 0x00000000, 0x0000e100, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0x00000, 0x0000, 0x0000, 0x0000, 0x06, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0000 },
+               { 0xffffffff, 0x0000e100, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0x1ffff, 0xffff, 0xffff, 0xffff, 0x06, 0x04, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xffff },
                { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
                { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }
        },
@@ -393,11 +393,11 @@ static TEST test[] =
 
 #define TEST_COUNT (sizeof(test) / sizeof(TEST))
 
-/* This function can be useful if you are modifiying the test cases and want to
+/* This function can be useful if you are modifying the test cases and want to
    output the contents of a DCB structure. */
 /*static print_dcb(DCB *pdcb)
 {
-       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",
+       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, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%02x, 0x%04x\n",
                pdcb->DCBlength,
                pdcb->BaudRate,
                pdcb->fBinary,
@@ -433,7 +433,7 @@ static void check_result(const char *function, TEST *ptest, int initial_value, B
        DWORD LastError = GetLastError();
        DWORD CorrectError = (ptest->result ? 0xdeadbeef : ERROR_INVALID_PARAMETER);
 
-       ok(LastError == CorrectError, "%s(\"%s\"), 0x%02x: GetLastError() returned 0x%08lx, should be 0x%08lx\n", function, ptest->string, initial_value, LastError, CorrectError);
+       ok(LastError == CorrectError, "%s(\"%s\"), 0x%02x: GetLastError() returned %d, should be %d\n", function, ptest->string, initial_value, LastError, CorrectError);
        ok(result == ptest->result, "%s(\"%s\"), 0x%02x: return value should be %s\n", function, ptest->string, initial_value, ptest->result ? "TRUE" : "FALSE");
 }
 
@@ -444,7 +444,7 @@ static void check_dcb(const char *function, TEST *ptest, int initial_value, DCB
 {
        /* DCBlength is a special case since Win 9x sets it but NT does not.
           We will accept either as correct. */
-       check_dcb_member2(DCBlength, (DWORD)sizeof(DCB), "%lu");
+       check_dcb_member2(DCBlength, (DWORD)sizeof(DCB), "%u");
 
        /* For old style control strings Win 9x does not set the next five members, NT does. */
        if(ptest->old_style && ptest->result)
@@ -488,7 +488,7 @@ static void check_dcb(const char *function, TEST *ptest, int initial_value, DCB
        }
 
        /* Check the result of the DCB members. */
-       check_dcb_member(BaudRate, "%lu");
+       check_dcb_member(BaudRate, "%u");
        check_dcb_member(fBinary, "%u");
        check_dcb_member(fParity, "%u");
        check_dcb_member(fTXContinueOnXoff, "%u");
@@ -510,7 +510,7 @@ static void check_dcb(const char *function, TEST *ptest, int initial_value, DCB
        check_dcb_member(wReserved1, "%u");
 }
 
-#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);
+#define check_timeouts_member(a) ok(ptimeouts1->a == ptimeouts2->a, "%s(\"%s\"), 0x%02x: "#a" is %u, should be %u\n", function, ptest->string, initial_value, ptimeouts1->a, ptimeouts2->a);
 
 static void check_timeouts(const char *function, TEST *ptest, int initial_value, COMMTIMEOUTS *ptimeouts1, COMMTIMEOUTS *ptimeouts2)
 {
@@ -561,6 +561,7 @@ static void test_BuildCommDCBW(TEST *ptest, int initial_value, DCB *pexpected_dc
        BOOL result;
        DCB dcb;
        WCHAR wide_string[sizeof(ptest->string)];
+       static int reportedDCBW = 0;
 
        MultiByteToWideChar(CP_ACP, 0, ptest->string, -1, wide_string, sizeof(wide_string) / sizeof(WCHAR));
 
@@ -571,7 +572,11 @@ static void test_BuildCommDCBW(TEST *ptest, int initial_value, DCB *pexpected_dc
        result = BuildCommDCBW(wide_string, &dcb);
 
        if(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+       {
+               if(!reportedDCBW++)
+                       win_skip("BuildCommDCBW is not implemented\n");
                return;
+       }
 
        /* check results */
        check_result("BuildCommDCBW", ptest, initial_value, result);
@@ -584,6 +589,7 @@ static void test_BuildCommDCBAndTimeoutsW(TEST *ptest, int initial_value, DCB *p
        DCB dcb;
        COMMTIMEOUTS timeouts;
        WCHAR wide_string[sizeof(ptest->string)];
+       static int reportedDCBAndTW = 0;
 
        MultiByteToWideChar(CP_ACP, 0, ptest->string, -1, wide_string, sizeof(wide_string) / sizeof(WCHAR));
 
@@ -595,12 +601,16 @@ static void test_BuildCommDCBAndTimeoutsW(TEST *ptest, int initial_value, DCB *p
        result = BuildCommDCBAndTimeoutsW(wide_string, &dcb, &timeouts);
 
        if(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+       {
+               if(!reportedDCBAndTW++)
+                       win_skip("BuildCommDCBAndTimeoutsW is not implemented\n");
                return;
+       }
 
        /* check results */
-       check_result("BuildCommDCBAndTimeoutsA", ptest, initial_value, result);
-       check_dcb("BuildCommDCBAndTimeoutsA", ptest, initial_value, &dcb, pexpected_dcb);
-       check_timeouts("BuildCommDCBAndTimeoutsA", ptest, initial_value, &timeouts, pexpected_timeouts);
+       check_result("BuildCommDCBAndTimeoutsW", ptest, initial_value, result);
+       check_dcb("BuildCommDCBAndTimeoutsW", ptest, initial_value, &dcb, pexpected_dcb);
+       check_timeouts("BuildCommDCBAndTimeoutsW", ptest, initial_value, &timeouts, pexpected_timeouts);
 }
 
 static void test_BuildCommDCB(void)
@@ -674,25 +684,38 @@ static HANDLE test_OpenComm(BOOL doOverlap)
        if (hcom == INVALID_HANDLE_VALUE)
            trace("Could not find a valid COM port.  Skipping test_ReadTimeOut\n");
        else
-           trace("Found Com port %s. Connected devices may disturbe results\n", port_name);
+           trace("Found Com port %s. Connected devices may disturb results\n", port_name);
        /*shown = TRUE; */
     }
     if (hcom != INVALID_HANDLE_VALUE)
     {
-        ok(ClearCommError(hcom,&errors,&comstat), "Unexpected errors on open\n");
-        ok(comstat.cbInQue == 0, "Unexpected %ld chars in InQueue\n",comstat.cbInQue);
-        ok(comstat.cbOutQue == 0, "Still pending %ld charcters in OutQueue\n", comstat.cbOutQue);
-        ok(errors == 0, "Unexpected errors 0x%08lx\n", errors);
+        BOOL ret;
+
+        ret = ClearCommError(hcom, &errors, &comstat);
+        if (!ret && (GetLastError() == ERROR_NOT_READY || GetLastError() == ERROR_INVALID_HANDLE))
+        {
+            if (GetLastError() == ERROR_NOT_READY)
+                trace("%s doesn't respond, skipping the test\n", port_name);
+            else
+                trace("%s is not a real serial port, skipping the test\n", port_name);
+            CloseHandle(hcom);
+            return INVALID_HANDLE_VALUE;
+        }
+
+        ok(ret, "Unexpected error %u on open\n", GetLastError());
+        ok(comstat.cbInQue == 0, "Unexpected %d chars in InQueue\n",comstat.cbInQue);
+        ok(comstat.cbOutQue == 0, "Still pending %d charcters in OutQueue\n", comstat.cbOutQue);
+        ok(errors == 0, "Unexpected errors 0x%08x\n", errors);
     }
     return hcom;
 }
 
 static void test_GetModemStatus(HANDLE hcom)
 {
-    DWORD ModemStat;
+    DWORD ModemStat = 0;
 
     ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-    trace("GetCommModemStatus returned 0x%08lx->%s%s%s%s\n", ModemStat,
+    trace("GetCommModemStatus returned 0x%08x->%s%s%s%s\n", ModemStat,
          (ModemStat &MS_RLSD_ON)?"MS_RLSD_ON ":"",
          (ModemStat &MS_RING_ON)?"MS_RING_ON ":"",
          (ModemStat &MS_DSR_ON)?"MS_DSR_ON ":"",
@@ -727,10 +750,10 @@ static void test_ReadTimeOut(HANDLE hcom)
     LastError = GetLastError();
     after = GetTickCount();
     ok( res == TRUE, "A timed-out read should return TRUE\n");
-    ok( LastError == 0xdeadbeef, "err=%ld\n", LastError);
+    ok( LastError == 0xdeadbeef, "err=%d\n", LastError);
     timediff = after - before;
     ok( timediff > TIMEOUT>>2 && timediff < TIMEOUT *2,
-       "Unexpected TimeOut %ld, expected %d\n", timediff, TIMEOUT);
+       "Unexpected TimeOut %d, expected %d\n", timediff, TIMEOUT);
 }
 
 static void test_waittxempty(HANDLE hcom)
@@ -765,10 +788,10 @@ static void test_waittxempty(HANDLE hcom)
     after = GetTickCount();
     ok(res_write == TRUE, "WriteFile failed\n");
     ok(written == sizeof(tbuf),
-       "WriteFile: Unexpected write_size %ld , expected %d\n", written, sizeof(tbuf));
+       "WriteFile: Unexpected write_size %d\n", written);
 
-    trace("WriteFile succeeded, took %ld ms to write %d Bytes at %ld Baud\n",
-         after - before, sizeof(tbuf), baud);
+    trace("WriteFile succeeded, took %d ms to write %d Bytes at %d Baud\n",
+         after - before, written, baud);
 
     before = GetTickCount();
     res = WaitCommEvent(hcom, &evtmask, NULL);
@@ -776,12 +799,12 @@ static void test_waittxempty(HANDLE hcom)
 
     ok(res == TRUE, "WaitCommEvent failed\n");
     ok((evtmask & EV_TXEMPTY),
-                "WaitCommEvent: Unexpected EvtMask 0x%08lx, expected 0x%08x\n",
+                 "WaitCommEvent: Unexpected EvtMask 0x%08x, expected 0x%08x\n",
                 evtmask, EV_TXEMPTY);
 
     timediff = after - before;
 
-    trace("WaitCommEvent for EV_TXEMPTY took %ld ms\n", timediff);
+    trace("WaitCommEvent for EV_TXEMPTY took %d ms\n", timediff);
     /* 050604: This shows a difference between XP (tested with mingw compiled crosstest):
        XP returns Writefile only after everything went out of the Serial port,
        while wine returns immedate.
@@ -798,9 +821,9 @@ static void test_ClearCommErrors(HANDLE hcom)
     COMSTAT lpStat;
 
     ok(ClearCommError(hcom, &errors, &lpStat), "ClearCommError failed\n");
-    ok(lpStat.cbInQue == 0, "Unexpected %ld chars in InQueue\n", lpStat.cbInQue);
-    ok(lpStat.cbOutQue == 0, "Unexpected %ld chars in OutQueue\n", lpStat.cbOutQue);
-    ok(errors == 0, "ClearCommErrors: Unexpected error 0x%08lx\n", errors);
+    ok(lpStat.cbInQue == 0, "Unexpected %d chars in InQueue\n", lpStat.cbInQue);
+    ok(lpStat.cbOutQue == 0, "Unexpected %d chars in OutQueue\n", lpStat.cbOutQue);
+    ok(errors == 0, "ClearCommErrors: Unexpected error 0x%08x\n", errors);
     trace("test_ClearCommErrors done\n");
 }
 
@@ -813,7 +836,7 @@ static void test_non_pending_errors(HANDLE hcom)
     dcb.ByteSize = 255; /* likely bogus */
     ok(!SetCommState(hcom, &dcb), "SetCommState should have failed\n");
     ok(ClearCommError(hcom, &err, NULL), "ClearCommError should succeed\n");
-    ok(!(err & CE_MODE), "ClearCommError shouldn't set CE_MODE byte in this case (%lx)\n", err);
+    ok(!(err & CE_MODE), "ClearCommError shouldn't set CE_MODE byte in this case (%x)\n", err);
 }
 
 /**/
@@ -845,23 +868,22 @@ static void test_LoopbackRead(HANDLE hcom)
     before = GetTickCount();
     ok(WriteFile(hcom,tbuf,sizeof(tbuf),&written, NULL), "WriteFile failed\n");
     after = GetTickCount();
-    ok(written == sizeof(tbuf),"WriteFile %ld bytes written, expected %d\n",
-       written, sizeof(tbuf));
+    ok(written == sizeof(tbuf),"WriteFile %d bytes written\n", written);
     diff = after -before;
 
     /* make sure all bytes are written, so Readfile will succeed in one call*/
     ok(WaitCommEvent(hcom, &evtmask, NULL), "WaitCommEvent failed\n");
     before = GetTickCount();
     ok(evtmask == EV_TXEMPTY,
-                "WaitCommEvent: Unexpected EvtMask 0x%08lx, expected 0x%08x\n",
+                 "WaitCommEvent: Unexpected EvtMask 0x%08x, expected 0x%08x\n",
                 evtmask, EV_TXEMPTY);
-    trace("Write %ld ms WaitCommEvent EV_TXEMPTY %ld ms\n", diff, before- after);
+    trace("Write %d ms WaitCommEvent EV_TXEMPTY %d ms\n", diff, before- after);
 
     read=0;
     ok(ReadFile(hcom, rbuf, sizeof(rbuf), &read, NULL), "Readfile failed\n");
-    ok(read == sizeof(tbuf),"ReadFile read %ld bytes, expected %d \"%s\"\n", read, sizeof(tbuf),rbuf);
+    ok(read == sizeof(tbuf),"ReadFile read %d bytes, expected \"%s\"\n", read,rbuf);
 
-    /* Now do the same withe a slower Baud rate.
+    /* Now do the same with a slower Baud rate.
        As we request more characters then written, we will hit the timeout
     */
 
@@ -876,24 +898,22 @@ static void test_LoopbackRead(HANDLE hcom)
 
     ok(SetCommMask(hcom, EV_RXCHAR), "SetCommMask failed\n");
     ok(WriteFile(hcom,tbuf,sizeof(tbuf),&written, NULL), "WriteFile failed\n");
-    ok(written == sizeof(tbuf),"WriteFile %ld bytes written, expected %d\n",
-       written, sizeof(tbuf));
+    ok(written == sizeof(tbuf),"WriteFile %d bytes written\n", written);
 
     trace("WaitCommEventEV_RXCHAR\n");
     ok(WaitCommEvent(hcom, &evtmask, NULL), "WaitCommEvent failed\n");
-    ok(evtmask == EV_RXCHAR, "WaitCommEvent: Unexpected EvtMask 0x%08lx, expected 0x%08x\n",
+    ok(evtmask == EV_RXCHAR, "WaitCommEvent: Unexpected EvtMask 0x%08x, expected 0x%08x\n",
        evtmask, EV_RXCHAR);
 
     before = GetTickCount();
     res = ReadFile(hcom, rbuf, sizeof(rbuf), &read, NULL);
     after = GetTickCount();
     ok(res, "Readfile failed\n");
-    ok(read == sizeof(tbuf),"ReadFile read %ld bytes, expected %d\n", read, sizeof(tbuf));
+    ok(read == sizeof(tbuf),"ReadFile read %d bytes\n", read);
     diff = after - before;
-    trace("Readfile for %d chars with %d avail took %ld ms\n",
-         sizeof(rbuf), sizeof(tbuf), diff);
+    trace("Readfile for %d chars took %d ms\n", read, diff);
     ok( (diff > TIMEOUT - TIMEDELTA) && (diff < TIMEOUT + TIMEDELTA),
-       "Timedout Wait took %ld ms, expected around %d\n", diff, TIMEOUT);
+       "Timedout Wait took %d ms, expected around %d\n", diff, TIMEOUT);
 
     /* now do a plain read with slow speed
      * This will result in several low level reads and a timeout to happen
@@ -905,7 +925,7 @@ static void test_LoopbackRead(HANDLE hcom)
     read = 0;
     read1 =0;
     i=0;
-    do
+    do 
     {
        res = ReadFile(hcom, rbuf+read, sizeof(rbuf-read), &read1, NULL);
        ok(res, "Readfile failed\n");
@@ -914,16 +934,16 @@ static void test_LoopbackRead(HANDLE hcom)
     }
     while ((read < sizeof(tbuf)) && (i <10));
     after =  GetTickCount();
-    ok( read == sizeof(tbuf),"ReadFile read %ld bytes, expected %d\n", read, sizeof(tbuf));
-    trace("Plain Read for %d char at %d baud took %ld ms\n", sizeof(tbuf), SLOWBAUD, after-before);
-
+    ok( read == sizeof(tbuf),"ReadFile read %d bytes\n", read);
+    trace("Plain Read for %d char at %d baud took %d ms\n", read, SLOWBAUD, after-before);
 }
 
 static void test_LoopbackCtsRts(HANDLE hcom)
 {
-    DWORD ModemStat, defaultStat;
+    DWORD ModemStat = 0, defaultStat = 0;
     DCB dcb;
 
+    memset (&dcb, 0, sizeof (dcb));
     ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
     if (dcb.fRtsControl == RTS_CONTROL_HANDSHAKE)
     {
@@ -937,11 +957,11 @@ static void test_LoopbackCtsRts(HANDLE hcom)
     {
        ok(EscapeCommFunction(hcom, CLRRTS), "EscapeCommFunction failed to clear RTS\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok ((ModemStat & MS_CTS_ON) == 0, "CTS didn't react: 0x%04lx,  expected 0x%04lx\n",
+       ok ((ModemStat & MS_CTS_ON) == 0, "CTS didn't react: 0x%04x,  expected 0x%04x\n",
            ModemStat, (defaultStat & ~MS_CTS_ON));
        ok(EscapeCommFunction(hcom, SETRTS), "EscapeCommFunction failed to clear RTS\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok (ModemStat ==  defaultStat, "Failed to restore CTS: 0x%04lx, expected 0x%04lx\n",
+       ok (ModemStat ==  defaultStat, "Failed to restore CTS: 0x%04x, expected 0x%04x\n",
            ModemStat, defaultStat);
     }
     else
@@ -949,18 +969,18 @@ static void test_LoopbackCtsRts(HANDLE hcom)
        ok(EscapeCommFunction(hcom, SETRTS), "EscapeCommFunction failed to set RTS\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
        ok ((ModemStat & MS_CTS_ON) == MS_CTS_ON,
-           "CTS didn't react: 0x%04lx,  expected 0x%04lx\n",
+            "CTS didn't react: 0x%04x,  expected 0x%04x\n",
            ModemStat, (defaultStat | MS_CTS_ON));
        ok(EscapeCommFunction(hcom, CLRRTS), "EscapeCommFunction failed to clear RTS\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok (ModemStat ==  defaultStat, "Failed to restore CTS: 0x%04lx, expected 0x%04lx\n",
+       ok (ModemStat ==  defaultStat, "Failed to restore CTS: 0x%04x, expected 0x%04x\n",
            ModemStat, defaultStat);
     }
 }
 
 static void test_LoopbackDtrDcd(HANDLE hcom)
 {
-    DWORD ModemStat, defaultStat;
+    DWORD ModemStat = 0, defaultStat = 0;
     DCB dcb;
 
     ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
@@ -976,11 +996,11 @@ static void test_LoopbackDtrDcd(HANDLE hcom)
     {
        ok(EscapeCommFunction(hcom, CLRDTR), "EscapeCommFunction failed to clear DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok ((ModemStat & MS_RLSD_ON) == 0, "RLSD didn't react: 0x%04lx,  expected 0x%04lx\n",
+       ok ((ModemStat & MS_RLSD_ON) == 0, "RLSD didn't react: 0x%04x,  expected 0x%04x\n",
            ModemStat, (defaultStat & ~MS_RLSD_ON));
        ok(EscapeCommFunction(hcom, SETDTR), "EscapeCommFunction failed to set DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok (ModemStat ==  defaultStat, "Failed to restore RLSD: 0x%04lx, expected 0x%04lx\n",
+       ok (ModemStat ==  defaultStat, "Failed to restore RLSD: 0x%04x, expected 0x%04x\n",
            ModemStat, defaultStat);
     }
     else
@@ -988,18 +1008,18 @@ static void test_LoopbackDtrDcd(HANDLE hcom)
        ok(EscapeCommFunction(hcom, SETDTR), "EscapeCommFunction failed to set DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
        ok ((ModemStat & MS_RLSD_ON) == MS_RLSD_ON,
-           "RLSD didn't react: 0x%04lx,  expected 0x%04lx\n",
+            "RLSD didn't react: 0x%04x,  expected 0x%04x\n",
            ModemStat, (defaultStat | MS_RLSD_ON));
        ok(EscapeCommFunction(hcom, CLRDTR), "EscapeCommFunction failed to clear DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok (ModemStat ==  defaultStat, "Failed to restore RLSD: 0x%04lx, expected 0x%04lx\n",
+       ok (ModemStat ==  defaultStat, "Failed to restore RLSD: 0x%04x, expected 0x%04x\n",
            ModemStat, defaultStat);
     }
 }
 
 static void test_LoopbackDtrDsr(HANDLE hcom)
 {
-    DWORD ModemStat, defaultStat;
+    DWORD ModemStat = 0, defaultStat = 0;
     DCB dcb;
 
     ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
@@ -1015,11 +1035,11 @@ static void test_LoopbackDtrDsr(HANDLE hcom)
     {
        ok(EscapeCommFunction(hcom, CLRDTR), "EscapeCommFunction failed to clear DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok ((ModemStat & MS_DSR_ON) == 0, "CTS didn't react: 0x%04lx,  expected 0x%04lx\n",
+       ok ((ModemStat & MS_DSR_ON) == 0, "CTS didn't react: 0x%04x,  expected 0x%04x\n",
            ModemStat, (defaultStat & ~MS_DSR_ON));
        ok(EscapeCommFunction(hcom, SETDTR), "EscapeCommFunction failed to clear DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok (ModemStat ==  defaultStat, "Failed to restore DSR: 0x%04lx, expected 0x%04lx\n",
+       ok (ModemStat ==  defaultStat, "Failed to restore DSR: 0x%04x, expected 0x%04x\n",
            ModemStat, defaultStat);
     }
     else
@@ -1027,18 +1047,18 @@ static void test_LoopbackDtrDsr(HANDLE hcom)
        ok(EscapeCommFunction(hcom, SETDTR), "EscapeCommFunction failed to set DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
        ok ((ModemStat & MS_DSR_ON) == MS_DSR_ON,
-           "CTS didn't react: 0x%04lx,expected 0x%04lx\n",
+            "CTS didn't react: 0x%04x,expected 0x%04x\n",
            ModemStat, (defaultStat | MS_DSR_ON));
        ok(EscapeCommFunction(hcom, CLRDTR), "EscapeCommFunction failed to clear DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok (ModemStat ==  defaultStat, "Failed to restore DSR: 0x%04lx, expected 0x%04lx\n",
+       ok (ModemStat ==  defaultStat, "Failed to restore DSR: 0x%04x, expected 0x%04x\n",
            ModemStat, defaultStat);
     }
 }
 
 static void test_LoopbackDtrRing(HANDLE hcom)
 {
-    DWORD ModemStat, defaultStat;
+    DWORD ModemStat = 0, defaultStat = 0;
     DCB dcb;
 
     ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
@@ -1054,11 +1074,11 @@ static void test_LoopbackDtrRing(HANDLE hcom)
     {
        ok(EscapeCommFunction(hcom, CLRDTR), "EscapeCommFunction failed to clear DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok ((ModemStat & MS_RING_ON) == 0, "RING didn't react: 0x%04lx,  expected 0x%04lx\n",
+       ok ((ModemStat & MS_RING_ON) == 0, "RING didn't react: 0x%04x,  expected 0x%04x\n",
            ModemStat, (defaultStat & ~MS_RING_ON));
        ok(EscapeCommFunction(hcom, SETDTR), "EscapeCommFunction failed to set DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok (ModemStat ==  defaultStat, "Failed to restore RING: 0x%04lx, expected 0x%04lx\n",
+       ok (ModemStat ==  defaultStat, "Failed to restore RING: 0x%04x, expected 0x%04x\n",
            ModemStat, defaultStat);
     }
     else
@@ -1066,11 +1086,11 @@ static void test_LoopbackDtrRing(HANDLE hcom)
        ok(EscapeCommFunction(hcom, SETDTR), "EscapeCommFunction failed to set DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
        ok ((ModemStat & MS_RING_ON) == MS_RING_ON,
-           "RING didn't react: 0x%04lx,expected 0x%04lx\n",
+            "RING didn't react: 0x%04x,expected 0x%04x\n",
            ModemStat, (defaultStat | MS_RING_ON));
        ok(EscapeCommFunction(hcom, CLRDTR), "EscapeCommFunction failed to clear DTR\n");
        ok(GetCommModemStatus(hcom, &ModemStat), "GetCommModemStatus failed\n");
-       ok (ModemStat ==  defaultStat, "Failed to restore RING: 0x%04lx, expected 0x%04lx\n",
+       ok (ModemStat ==  defaultStat, "Failed to restore RING: 0x%04x, expected 0x%04x\n",
            ModemStat, defaultStat);
     }
 }
@@ -1096,7 +1116,7 @@ static void  test_WaitRx(HANDLE hcom)
     overlapped.hEvent = hComPortEvent;
 
     ok((hComWriteEvent =  CreateEvent( NULL, TRUE, FALSE, NULL )) !=0,
-       "CreateEvent res 0x%08lx\n",
+       "CreateEvent res %d\n",
        GetLastError());
     ZeroMemory( &overlapped_w, sizeof(overlapped_w));
     overlapped_w.hEvent = hComWriteEvent;
@@ -1105,47 +1125,47 @@ static void  test_WaitRx(HANDLE hcom)
     {success_wait = WaitCommEvent(hcom, &evtmask, &overlapped);}
     err_wait = GetLastError();
     after = GetTickCount();
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx\n", success_wait, err_wait, evtmask);
+    trace("Success 0x%08x err %d evtmask 0x%08x\n", success_wait, err_wait, evtmask);
     ok(success_wait || err_wait == ERROR_IO_PENDING, "overlapped WaitCommEvent failed\n");
     trace("overlapped WriteCommEvent returned.\n");
 
     success_write= WriteFile(hcom, "X", 1, &written, &overlapped_w);
     err_write = GetLastError();
     ok(success_write || err_write == ERROR_IO_PENDING,
-       "overlapped WriteFile failed, err 0x%08lx\n",
+       "overlapped WriteFile failed, err %d\n",
        err_write);
 
     if (!success_write && (err_write == ERROR_IO_PENDING)) {
       success_write = WaitForSingleObjectEx(hComWriteEvent, TIMEOUT, TRUE);
       err_write = GetLastError();
-      ok(success_write == WAIT_OBJECT_0, "WaitForSingleObjectEx, res 0x%08lx, err 0x%08lx\n",
+      ok(success_write == WAIT_OBJECT_0, "WaitForSingleObjectEx, res %d, err %d\n",
         success_write, err_write);
     }
     Sleep(TIMEOUT >>1);
     success_write = GetOverlappedResult(hcom, &overlapped_w, &written, FALSE);
     err_write = GetLastError();
 
-    trace("Write after Wait res 0x%08lx err 0x%08lx\n",success_write, err_write);
-    ok(success_write && written ==1, "Write after Wait res 0x%08lx err 0x%08lx\n",
+    trace("Write after Wait res 0x%08x err %d\n",success_write, err_write);
+    ok(success_write && written ==1, "Write after Wait res 0x%08x err %d\n",
        success_write, err_write);
 
     if (!success_wait && (err_wait == ERROR_IO_PENDING)) {
       success_wait = WaitForSingleObjectEx(hComPortEvent, TIMEOUT, TRUE);
       err_wait = GetLastError();
-      ok(success_wait == WAIT_OBJECT_0, "wait hComPortEvent, res 0x%08lx, err 0x%08lx\n",
+      ok(success_wait == WAIT_OBJECT_0, "wait hComPortEvent, res 0x%08x, err %d\n",
         success_wait, err_wait);
     }
     success_wait = GetOverlappedResult(hcom, &overlapped, &written, FALSE);
     err_wait = GetLastError();
     after1 = GetTickCount();
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx diff1 %ld, diff2 %ld\n",
+    trace("Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
          success_wait, err_wait, evtmask, after-before, after1-before);
 
-    ok(evtmask & EV_RXCHAR, "Detect  EV_RXCHAR: 0x%08lx, expected 0x%08x\n",
+    ok(evtmask & EV_RXCHAR, "Detect  EV_RXCHAR: 0x%08x, expected 0x%08x\n",
        evtmask, EV_RXCHAR);
     diff = after1 - before;
     ok ((diff > (TIMEOUT>>1) -TIMEDELTA) && (diff < (TIMEOUT>>1) + TIMEDELTA),
-       "Unexpected time %ld, expected around %d\n", diff, TIMEOUT>>1);
+       "Unexpected time %d, expected around %d\n", diff, TIMEOUT>>1);
 
 }
 
@@ -1154,21 +1174,20 @@ static void  test_WaitRx(HANDLE hcom)
 */
 static DWORD CALLBACK toggle_ctlLine(LPVOID arg)
 {
-    DWORD *args = (DWORD *) arg;
+    DWORD_PTR *args = arg;
     DWORD timeout = args[0];
     DWORD ctl     = args[1];
     HANDLE hcom   = (HANDLE) args[2];
     HANDLE hComPortEvent = (HANDLE) args[3];
     DWORD success, err;
 
-    trace("toggle_ctlLine timeout %ld clt 0x%08lx handle 0x%08lx\n",
-         args[0], args[1], args[2]);
+    trace("toggle_ctlLine timeout %d ctl 0x%08x handle %p\n", timeout, ctl, hcom );
     Sleep(timeout);
-    ok(EscapeCommFunction(hcom, ctl),"EscapeCommFunction 0x%08lx failed\n", ctl);
+    ok(EscapeCommFunction(hcom, ctl),"EscapeCommFunction 0x%08x failed\n", ctl);
     trace("toggle_ctline done\n");
     success = WaitForSingleObjectEx(hComPortEvent, TIMEOUT, TRUE);
     err = GetLastError();
-    trace("toggle_ctline WaitForSingleObjectEx res 0x%08lx err 0x%08lx\n",
+    trace("toggle_ctline WaitForSingleObjectEx res 0x%08x err %d\n",
          success, err);
     return 0;
 }
@@ -1183,8 +1202,8 @@ static void  test_WaitCts(HANDLE hcom)
     OVERLAPPED overlapped;
     HANDLE hComPortEvent;
     HANDLE alarmThread;
-    DWORD args[4], defaultStat;
-    DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
+    DWORD_PTR args[4];
+    DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0, defaultStat = 0;
 
     ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
     dcb.fRtsControl=RTS_CONTROL_ENABLE;
@@ -1201,15 +1220,15 @@ static void  test_WaitCts(HANDLE hcom)
        args[1] = CLRRTS;
     else
        args[1] = SETRTS;
-    args[2]=(DWORDhcom;
+    args[2]=(DWORD_PTR)hcom;
 
-    trace("test_WaitCts timeout %ld clt 0x%08lx handle 0x%08lx\n",args[0], args[1], args[2]);
+    trace("test_WaitCts timeout %ld clt 0x%08lx handle %p\n",args[0], args[1], hcom);
 
     ok(SetCommMask(hcom, EV_CTS), "SetCommMask failed\n");
     hComPortEvent =  CreateEvent( NULL, TRUE, FALSE, NULL );
     ok(hComPortEvent != 0, "CreateEvent failed\n");
-    args[3] = (DWORDhComPortEvent;
-    alarmThread = CreateThread(NULL, 0, toggle_ctlLine, (void *) &args, 0, &alarmThreadId);
+    args[3] = (DWORD_PTR)hComPortEvent;
+    alarmThread = CreateThread(NULL, 0, toggle_ctlLine, args, 0, &alarmThreadId);
     /* Wait a minimum to let the thread start up */
     Sleep(10);
     trace("Thread created\n");
@@ -1222,7 +1241,7 @@ static void  test_WaitCts(HANDLE hcom)
     err = GetLastError();
     after = GetTickCount();
 
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx\n", success, err, evtmask);
+    trace("Success 0x%08x err %d evtmask 0x%08x\n", success, err, evtmask);
     ok(success || err == ERROR_IO_PENDING, "overlapped WaitCommEvent failed\n");
     trace("overlapped WriteCommEvent returned.\n");
     if (!success && (err == ERROR_IO_PENDING))
@@ -1231,10 +1250,10 @@ static void  test_WaitCts(HANDLE hcom)
     success = GetOverlappedResult(hcom, &overlapped, &written, FALSE);
     err = GetLastError();
     after1 = GetTickCount();
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx diff1 %ld, diff2 %ld\n",
+    trace("Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
          success, err, evtmask, after-before, after1-before);
 
-    ok(evtmask & EV_CTS, "Failed to detect  EV_CTS: 0x%08lx, expected 0x%08x\n",
+    ok(evtmask & EV_CTS, "Failed to detect  EV_CTS: 0x%08x, expected 0x%08x\n",
                 evtmask, EV_CTS);
     ok(GetCommModemStatus(hcom, &evtmask), "GetCommModemStatus failed\n");
     if(defaultStat & MS_CTS_ON)
@@ -1244,7 +1263,7 @@ static void  test_WaitCts(HANDLE hcom)
 
     diff = after1 - before;
     ok ((diff > (TIMEOUT>>1) -TIMEDELTA) && (diff < (TIMEOUT>>1) + TIMEDELTA),
-                 "Unexpected time %ld, expected around %d\n", diff, TIMEOUT>>1);
+                  "Unexpected time %d, expected around %d\n", diff, TIMEOUT>>1);
 
     /*restore RTS Settings*/
     if(defaultStat & MS_CTS_ON)
@@ -1258,11 +1277,11 @@ static void  test_WaitCts(HANDLE hcom)
 */
 static DWORD CALLBACK reset_CommMask(LPVOID arg)
 {
-    DWORD *args = (DWORD *) arg;
+    DWORD_PTR *args = arg;
     DWORD timeout = args[0];
     HANDLE hcom   = (HANDLE) args[1];
 
-    trace(" Changing CommMask on the fly for handle %p after timeout %ld\n",
+    trace(" Changing CommMask on the fly for handle %p after timeout %d\n",
          hcom, timeout);
     Sleep(timeout);
     ok(SetCommMask(hcom, 0),"SetCommMask %p failed\n", hcom);
@@ -1280,7 +1299,7 @@ static void  test_AbortWaitCts(HANDLE hcom)
     OVERLAPPED overlapped;
     HANDLE hComPortEvent;
     HANDLE alarmThread;
-    DWORD args[2];
+    DWORD_PTR args[2];
     DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
 
     ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
@@ -1290,14 +1309,14 @@ static void  test_AbortWaitCts(HANDLE hcom)
        return;
     }
     args[0]= TIMEOUT >>1;
-    args[1]=(DWORD) hcom;
+    args[1]= (DWORD_PTR)hcom;
 
-    trace("test_AbortWaitCts timeout %ld handle 0x%08lx\n",args[0], args[1]);
+    trace("test_AbortWaitCts timeout %ld handle %p\n",args[0], hcom);
 
     ok(SetCommMask(hcom, EV_CTS), "SetCommMask failed\n");
     hComPortEvent =  CreateEvent( NULL, TRUE, FALSE, NULL );
     ok(hComPortEvent != 0, "CreateEvent failed\n");
-    alarmThread = CreateThread(NULL, 0, reset_CommMask, (void *) &args, 0, &alarmThreadId);
+    alarmThread = CreateThread(NULL, 0, reset_CommMask, args, 0, &alarmThreadId);
     /* Wait a minimum to let the thread start up */
     Sleep(10);
     trace("Thread created\n");
@@ -1310,7 +1329,7 @@ static void  test_AbortWaitCts(HANDLE hcom)
     err = GetLastError();
     after = GetTickCount();
 
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx\n", success, err, evtmask);
+    trace("Success 0x%08x err %d evtmask 0x%08x\n", success, err, evtmask);
     ok(success || err == ERROR_IO_PENDING, "overlapped WaitCommEvent failed\n");
     trace("overlapped WriteCommEvent returned.\n");
     if (!success && (err == ERROR_IO_PENDING))
@@ -1319,15 +1338,15 @@ static void  test_AbortWaitCts(HANDLE hcom)
     success = GetOverlappedResult(hcom, &overlapped, &written, FALSE);
     err = GetLastError();
     after1 = GetTickCount();
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx diff1 %ld, diff2 %ld\n",
+    trace("Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
          success, err, evtmask, after-before, after1-before);
 
-    ok(evtmask == 0, "Incorect EventMask 0x%08lx returned on Wait aborted bu SetCommMask, expected 0x%08x\n",
+    ok(evtmask == 0, "Incorect EventMask 0x%08x returned on Wait aborted bu SetCommMask, expected 0x%08x\n",
                 evtmask, 0);
     ok(GetCommModemStatus(hcom, &evtmask), "GetCommModemStatus failed\n");
     diff = after1 - before;
     ok ((diff > (TIMEOUT>>1) -TIMEDELTA) && (diff < (TIMEOUT>>1) + TIMEDELTA),
-                 "Unexpected time %ld, expected around %d\n", diff, TIMEOUT>>1);
+                  "Unexpected time %d, expected around %d\n", diff, TIMEOUT>>1);
 
 }
 
@@ -1341,8 +1360,8 @@ static void  test_WaitDsr(HANDLE hcom)
     OVERLAPPED overlapped;
     HANDLE hComPortEvent;
     HANDLE alarmThread;
-    DWORD args[3], defaultStat;
-    DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
+    DWORD_PTR args[3];
+    DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0, defaultStat = 0;
 
     ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
     if (dcb.fDtrControl == DTR_CONTROL_DISABLE)
@@ -1356,14 +1375,14 @@ static void  test_WaitDsr(HANDLE hcom)
        args[1] = CLRDTR;
     else
        args[1] = SETDTR;
-    args[2]=(DWORD) hcom;
+    args[2]= (DWORD_PTR)hcom;
 
-    trace("test_WaitDsr timeout %ld clt 0x%08lx handle 0x%08lx\n",args[0], args[1], args[2]);
+    trace("test_WaitDsr timeout %ld clt 0x%08lx handle %p\n",args[0], args[1], hcom);
 
     ok(SetCommMask(hcom, EV_DSR), "SetCommMask failed\n");
     hComPortEvent =  CreateEvent( NULL, TRUE, FALSE, NULL );
     ok(hComPortEvent != 0, "CreateEvent failed\n");
-    alarmThread = CreateThread(NULL, 0, toggle_ctlLine, (void *) &args, 0, &alarmThreadId);
+    alarmThread = CreateThread(NULL, 0, toggle_ctlLine, args, 0, &alarmThreadId);
     ok(alarmThread !=0 , "CreateThread Failed\n");
 
     ZeroMemory( &overlapped, sizeof(overlapped));
@@ -1373,7 +1392,7 @@ static void  test_WaitDsr(HANDLE hcom)
     err = GetLastError();
     after = GetTickCount();
 
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx\n", success, err, evtmask);
+    trace("Success 0x%08x err %d evtmask 0x%08x\n", success, err, evtmask);
     ok(success || err == ERROR_IO_PENDING, "overlapped WaitCommEvent failed\n");
     trace("overlapped WriteCommEvent returned.\n");
     if (!success && (err == ERROR_IO_PENDING))
@@ -1382,10 +1401,10 @@ static void  test_WaitDsr(HANDLE hcom)
     success = GetOverlappedResult(hcom, &overlapped, &written, FALSE);
     err = GetLastError();
     after1 = GetTickCount();
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx diff1 %ld, diff2 %ld\n",
+    trace("Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
          success, err, evtmask, after-before, after1-before);
 
-    ok(evtmask & EV_DSR, "Failed to detect  EV_DSR: 0x%08lx, expected 0x%08x\n",
+    ok(evtmask & EV_DSR, "Failed to detect  EV_DSR: 0x%08x, expected 0x%08x\n",
                 evtmask, EV_DSR);
     ok(GetCommModemStatus(hcom, &evtmask), "GetCommModemStatus failed\n");
     if(defaultStat & MS_DSR_ON)
@@ -1395,7 +1414,7 @@ static void  test_WaitDsr(HANDLE hcom)
 
     diff = after1 - before;
     ok ((diff > (TIMEOUT>>1) -TIMEDELTA) && (diff < (TIMEOUT>>1) + TIMEDELTA),
-                 "Unexpected time %ld, expected around %d\n", diff, TIMEOUT>>1);
+                  "Unexpected time %d, expected around %d\n", diff, TIMEOUT>>1);
 
     /*restore RTS Settings*/
     if(defaultStat & MS_DSR_ON)
@@ -1414,8 +1433,9 @@ static void  test_WaitRing(HANDLE hcom)
     OVERLAPPED overlapped;
     HANDLE hComPortEvent;
     HANDLE alarmThread;
-    DWORD args[3], defaultStat;
-    DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
+    DWORD_PTR args[3];
+    DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0, defaultStat;
+    BOOL ret;
 
     ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
     if (dcb.fDtrControl == DTR_CONTROL_DISABLE)
@@ -1424,19 +1444,23 @@ static void  test_WaitRing(HANDLE hcom)
        return;
     }
     args[0]= TIMEOUT >>1;
-    ok(GetCommModemStatus(hcom, &defaultStat), "GetCommModemStatus failed\n");
+    ok((ret = GetCommModemStatus(hcom, &defaultStat)), "GetCommModemStatus failed\n");
+    if (!ret) {
+       skip("modem status failed -> skip.\n");
+       return;
+    }
     if(defaultStat & MS_RING_ON)
        args[1] = CLRDTR;
     else
        args[1] = SETDTR;
-    args[2]=(DWORD) hcom;
+    args[2]=(DWORD_PTR) hcom;
 
-    trace("test_WaitRing timeout %ld clt 0x%08lx handle 0x%08lx\n",args[0], args[1], args[2]);
+    trace("test_WaitRing timeout %ld clt 0x%08lx handle %p\n",args[0], args[1], hcom);
 
     ok(SetCommMask(hcom, EV_RING), "SetCommMask failed\n");
     hComPortEvent =  CreateEvent( NULL, TRUE, FALSE, NULL );
     ok(hComPortEvent != 0, "CreateEvent failed\n");
-    alarmThread = CreateThread(NULL, 0, toggle_ctlLine, (void *) &args, 0, &alarmThreadId);
+    alarmThread = CreateThread(NULL, 0, toggle_ctlLine, args, 0, &alarmThreadId);
     ok(alarmThread !=0 , "CreateThread Failed\n");
 
     ZeroMemory( &overlapped, sizeof(overlapped));
@@ -1446,7 +1470,7 @@ static void  test_WaitRing(HANDLE hcom)
     err = GetLastError();
     after = GetTickCount();
 
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx\n", success, err, evtmask);
+    trace("Success 0x%08x err %d evtmask 0x%08x\n", success, err, evtmask);
     ok(success || err == ERROR_IO_PENDING, "overlapped WaitCommEvent failed\n");
     trace("overlapped WriteCommEvent returned.\n");
     if (!success && (err == ERROR_IO_PENDING))
@@ -1455,10 +1479,10 @@ static void  test_WaitRing(HANDLE hcom)
     success = GetOverlappedResult(hcom, &overlapped, &written, FALSE);
     err = GetLastError();
     after1 = GetTickCount();
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx diff1 %ld, diff2 %ld\n",
+    trace("Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
          success, err, evtmask, after-before, after1-before);
 
-    ok(evtmask & EV_RING, "Failed to detect  EV_RING: 0x%08lx, expected 0x%08x\n",
+    ok(evtmask & EV_RING, "Failed to detect  EV_RING: 0x%08x, expected 0x%08x\n",
        evtmask, EV_CTS);
     ok(GetCommModemStatus(hcom, &evtmask), "GetCommModemStatus failed\n");
     if(defaultStat & MS_RING_ON)
@@ -1468,7 +1492,7 @@ static void  test_WaitRing(HANDLE hcom)
 
     diff = after1 - before;
     ok ((diff > (TIMEOUT>>1) -TIMEDELTA) && (diff < (TIMEOUT>>1) + TIMEDELTA),
-                 "Unexpected time %ld, expected around %d\n", diff, TIMEOUT>>1);
+                  "Unexpected time %d, expected around %d\n", diff, TIMEOUT>>1);
 
     /*restore RTS Settings*/
     if(defaultStat & MS_RING_ON)
@@ -1486,8 +1510,8 @@ static void  test_WaitDcd(HANDLE hcom)
     OVERLAPPED overlapped;
     HANDLE hComPortEvent;
     HANDLE alarmThread;
-    DWORD args[3], defaultStat;
-    DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
+    DWORD_PTR args[3];
+    DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0, defaultStat = 0;
 
     ok(GetCommState(hcom, &dcb), "GetCommState failed\n");
     if (dcb.fDtrControl == DTR_CONTROL_DISABLE)
@@ -1501,14 +1525,14 @@ static void  test_WaitDcd(HANDLE hcom)
        args[1] = CLRDTR;
     else
        args[1] = SETDTR;
-    args[2]=(DWORD) hcom;
+    args[2]= (DWORD_PTR)hcom;
 
-    trace("test_WaitDcd timeout %ld clt 0x%08lx handle 0x%08lx\n",args[0], args[1], args[2]);
+    trace("test_WaitDcd timeout %ld clt 0x%08lx handle %p\n",args[0], args[1], hcom);
 
     ok(SetCommMask(hcom, EV_RLSD), "SetCommMask failed\n");
     hComPortEvent =  CreateEvent( NULL, TRUE, FALSE, NULL );
     ok(hComPortEvent != 0, "CreateEvent failed\n");
-    alarmThread = CreateThread(NULL, 0, toggle_ctlLine, (void *) &args, 0, &alarmThreadId);
+    alarmThread = CreateThread(NULL, 0, toggle_ctlLine, args, 0, &alarmThreadId);
     ok(alarmThread !=0 , "CreateThread Failed\n");
 
     ZeroMemory( &overlapped, sizeof(overlapped));
@@ -1518,7 +1542,7 @@ static void  test_WaitDcd(HANDLE hcom)
     err = GetLastError();
     after = GetTickCount();
 
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx\n", success, err, evtmask);
+    trace("Success 0x%08x err %d evtmask 0x%08x\n", success, err, evtmask);
     ok(success || err == ERROR_IO_PENDING, "overlapped WaitCommEvent failed\n");
     trace("overlapped WriteCommEvent returned.\n");
     if (!success && (err == ERROR_IO_PENDING))
@@ -1527,10 +1551,10 @@ static void  test_WaitDcd(HANDLE hcom)
     success = GetOverlappedResult(hcom, &overlapped, &written, FALSE);
     err = GetLastError();
     after1 = GetTickCount();
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx diff1 %ld, diff2 %ld\n",
+    trace("Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
          success, err, evtmask, after-before, after1-before);
 
-    ok(evtmask & EV_RLSD, "Failed to detect  EV_RLSD: 0x%08lx, expected 0x%08x\n",
+    ok(evtmask & EV_RLSD, "Failed to detect  EV_RLSD: 0x%08x, expected 0x%08x\n",
                 evtmask, EV_CTS);
     ok(GetCommModemStatus(hcom, &evtmask), "GetCommModemStatus failed\n");
     if(defaultStat & MS_RLSD_ON)
@@ -1540,7 +1564,7 @@ static void  test_WaitDcd(HANDLE hcom)
 
     diff = after1 - before;
     ok ((diff > (TIMEOUT>>1) -TIMEDELTA) && (diff < (TIMEOUT>>1) + TIMEDELTA),
-                 "Unexpected time %ld, expected around %d\n", diff, TIMEOUT>>1);
+                  "Unexpected time %d, expected around %d\n", diff, TIMEOUT>>1);
 
     /*restore RTS Settings*/
     if(defaultStat & MS_RLSD_ON)
@@ -1549,16 +1573,16 @@ static void  test_WaitDcd(HANDLE hcom)
        args[1] = CLRDTR;
 }
 
-/*
+/* 
    Set Break after timeout
 */
 static DWORD CALLBACK set_CommBreak(LPVOID arg)
 {
-    DWORD *args = (DWORD *) arg;
+    DWORD_PTR *args = arg;
     DWORD timeout = args[0];
     HANDLE hcom   = (HANDLE) args[1];
 
-    trace("SetCommBreak for handle %p after timeout %ld\n",
+    trace("SetCommBreak for handle %p after timeout %d\n",
          hcom, timeout);
     Sleep(timeout);
     ok(SetCommBreak(hcom),"SetCommBreak %p failed\n", hcom);
@@ -1575,7 +1599,7 @@ static void  test_WaitBreak(HANDLE hcom)
     OVERLAPPED overlapped;
     HANDLE hComPortEvent;
     HANDLE alarmThread;
-    DWORD args[2];
+    DWORD_PTR args[2];
     DWORD alarmThreadId, before, after, after1, diff, success, err, written, evtmask=0;
 
     ok(SetCommMask(hcom, EV_BREAK), "SetCommMask failed\n");
@@ -1584,8 +1608,8 @@ static void  test_WaitBreak(HANDLE hcom)
 
     trace("test_WaitBreak\n");
     args[0]= TIMEOUT >>1;
-    args[1]=(DWORD) hcom;
-    alarmThread = CreateThread(NULL, 0, set_CommBreak, (void *) &args, 0, &alarmThreadId);
+    args[1]= (DWORD_PTR)hcom;
+    alarmThread = CreateThread(NULL, 0, set_CommBreak, args, 0, &alarmThreadId);
     /* Wait a minimum to let the thread start up */
     Sleep(10);
     trace("Thread created\n");
@@ -1598,30 +1622,40 @@ static void  test_WaitBreak(HANDLE hcom)
     err = GetLastError();
     after = GetTickCount();
 
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx\n", success, err, evtmask);
+    trace("Success 0x%08x err %d evtmask 0x%08x\n", success, err, evtmask);
     ok(success || err == ERROR_IO_PENDING, "overlapped WaitCommEvent failed\n");
     trace("overlapped WriteCommEvent returned.\n");
 
     if (!success && (err == ERROR_IO_PENDING))
        ok(WaitForSingleObjectEx(hComPortEvent, TIMEOUT, TRUE) == 0,
-          "wait hComPortEvent res 0x%08lx\n", GetLastError());
+           "wait hComPortEvent res %d\n", GetLastError());
     success = GetOverlappedResult(hcom, &overlapped, &written, FALSE);
     err = GetLastError();
     after1 = GetTickCount();
-    trace("Success 0x%08lx err 0x%08lx evtmask 0x%08lx diff1 %ld, diff2 %ld\n",
+    trace("Success 0x%08x err %d evtmask 0x%08x diff1 %d, diff2 %d\n",
          success, err, evtmask, after-before, after1-before);
 
-    ok(evtmask & EV_BREAK, "Failed to detect  EV_BREAK: 0x%08lx, expected 0x%08x\n",
+    ok(evtmask & EV_BREAK, "Failed to detect  EV_BREAK: 0x%08x, expected 0x%08x\n",
        evtmask, EV_BREAK);
     ok(GetCommModemStatus(hcom, &evtmask), "GetCommModemStatus failed\n");
 
     diff = after1 - before;
     ok ((diff > (TIMEOUT>>1) -TIMEDELTA) && (diff < (TIMEOUT>>1) + TIMEDELTA),
-       "Unexpected time %ld, expected around %d\n", diff, TIMEOUT>>1);
+       "Unexpected time %d, expected around %d\n", diff, TIMEOUT>>1);
 
     ok(ClearCommBreak(hcom), "ClearCommBreak failed\n");
 }
 
+static void test_stdio(void)
+{
+    DCB dcb;
+
+    /* cygwin tries this to determine the stdin handle type */
+    ok( !GetCommState( GetStdHandle(STD_INPUT_HANDLE), &dcb ), "GetCommState succeeded on stdin\n" );
+    ok( GetLastError() == ERROR_INVALID_HANDLE || GetLastError() == ERROR_INVALID_FUNCTION,
+        "got error %u\n", GetLastError() );
+}
+
 START_TEST(comm)
 {
     HANDLE hcom;
@@ -1714,4 +1748,5 @@ START_TEST(comm)
        test_WaitBreak(hcom);
        CloseHandle(hcom);
     }
+    test_stdio();
 }