- Lots of minimal changes to better support WINCE as a build target

diff --git a/programs/ssl/ssl_client1.c b/programs/ssl/ssl_client1.c
index 2ffe30c..b57fe8d 100644
--- a/programs/ssl/ssl_client1.c
+++ b/programs/ssl/ssl_client1.c
@@ -1,7 +1,7 @@
 /*
  *  SSL client demonstration program
  *
- *  Copyright (C) 2006-2010, Brainspark B.V.
+ *  Copyright (C) 2006-2011, Brainspark B.V.
  *
  *  This file is part of PolarSSL (http://www.polarssl.org)
  *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@@ -54,15 +54,18 @@
 #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) ||   \
     !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
     !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C)
-int main( void )
+int main( int argc, char *argv[] )
 {
+    ((void) argc);
+    ((void) argv);
+
     printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
            "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
            "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
     return( 0 );
 }
 #else
-int main( void )
+int main( int argc, char *argv[] )
 {
     int ret, len, server_fd;
     unsigned char buf[1024];
@@ -70,6 +73,9 @@
     ssl_context ssl;
     ssl_session ssn;
 
+    ((void) argc);
+    ((void) argv);
+
     /*
      * 0. Initialize the RNG and the session data
      */
@@ -182,7 +188,7 @@
 
     memset( &ssl, 0, sizeof( ssl ) );
 
-#ifdef WIN32
+#if defined(_WIN32)
     printf( "  + Press Enter to exit this program.\n" );
     fflush( stdout ); getchar();
 #endif
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index 2eb8cbc..de0af25 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -1,7 +1,7 @@
 /*
  *  SSL client with certificate authentication
  *
- *  Copyright (C) 2006-2010, Brainspark B.V.
+ *  Copyright (C) 2006-2011, Brainspark B.V.
  *
  *  This file is part of PolarSSL (http://www.polarssl.org)
  *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@@ -98,8 +98,11 @@
 #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) ||   \
     !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
     !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C)
-int main( void )
+int main( int argc, char *argv[] )
 {
+    ((void) argc);
+    ((void) argv);
+
     printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
            "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
            "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
@@ -458,7 +461,7 @@
 
     memset( &ssl, 0, sizeof( ssl ) );
 
-#ifdef WIN32
+#if defined(_WIN32)
     printf( "  + Press Enter to exit this program.\n" );
     fflush( stdout ); getchar();
 #endif
diff --git a/programs/ssl/ssl_fork_server.c b/programs/ssl/ssl_fork_server.c
index e14da8b..411eac1 100644
--- a/programs/ssl/ssl_fork_server.c
+++ b/programs/ssl/ssl_fork_server.c
@@ -1,7 +1,7 @@
 /*
  *  SSL server demonstration program using fork() for handling multiple clients
  *
- *  Copyright (C) 2006-2010, Brainspark B.V.
+ *  Copyright (C) 2006-2011, Brainspark B.V.
  *
  *  This file is part of PolarSSL (http://www.polarssl.org)
  *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@@ -27,7 +27,7 @@
 #define _CRT_SECURE_NO_DEPRECATE 1
 #endif
 
-#ifdef WIN32
+#if defined(_WIN32)
 #include <windows.h>
 #endif
 
@@ -55,17 +55,23 @@
     !defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_SSL_TLS_C) ||  \
     !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) ||     \
     !defined(POLARSSL_RSA_C)
-int main( void )
+int main( int argc, char *argv[] )
 {
+    ((void) argc);
+    ((void) argv);
+
     printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_HAVEGE_C "
            "and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
            "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
     return( 0 );
 }
-#elif defined(WIN32)
-int main( void )
+#elif defined(_WIN32)
+int main( int argc, char *argv[] )
 {
-    printf("WIN32 defined. This application requires fork() and signals "
+    ((void) argc);
+    ((void) argv);
+
+    printf("_WIN32 defined. This application requires fork() and signals "
            "to work correctly.\n");
     return( 0 );
 }
@@ -192,7 +198,7 @@
     return( 0 );
 }
 
-int main( void )
+int main( int argc, char *argv[] )
 {
     int ret, len, cnt = 0, pid;
     int listen_fd;
@@ -205,6 +211,9 @@
     x509_cert srvcert;
     rsa_context rsa;
 
+    ((void) argc);
+    ((void) argv);
+
     signal( SIGCHLD, SIG_IGN );
 
     /*
@@ -450,7 +459,7 @@
 
     memset( &ssl, 0, sizeof( ssl_context ) );
 
-#ifdef WIN32
+#if defined(_WIN32)
     printf( "  Press Enter to exit this program.\n" );
     fflush( stdout ); getchar();
 #endif
diff --git a/programs/ssl/ssl_mail_client.c b/programs/ssl/ssl_mail_client.c
index 2adff52..8034a24 100644
--- a/programs/ssl/ssl_mail_client.c
+++ b/programs/ssl/ssl_mail_client.c
@@ -1,7 +1,7 @@
 /*
  *  SSL client for SMTP servers
  *
- *  Copyright (C) 2006-2010, Brainspark B.V.
+ *  Copyright (C) 2006-2011, Brainspark B.V.
  *
  *  This file is part of PolarSSL (http://www.polarssl.org)
  *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@@ -103,8 +103,11 @@
 #if !defined(POLARSSL_BIGNUM_C) || !defined(POLARSSL_HAVEGE_C) ||   \
     !defined(POLARSSL_SSL_TLS_C) || !defined(POLARSSL_SSL_CLI_C) || \
     !defined(POLARSSL_NET_C) || !defined(POLARSSL_RSA_C)
-int main( void )
+int main( int argc, char *argv[] )
 {
+    ((void) argc);
+    ((void) argv);
+
     printf("POLARSSL_BIGNUM_C and/or POLARSSL_HAVEGE_C and/or "
            "POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_CLI_C and/or "
            "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
@@ -789,7 +792,7 @@
 
     memset( &ssl, 0, sizeof( ssl ) );
 
-#ifdef WIN32
+#if defined(_WIN32)
     printf( "  + Press Enter to exit this program.\n" );
     fflush( stdout ); getchar();
 #endif
diff --git a/programs/ssl/ssl_server.c b/programs/ssl/ssl_server.c
index 6f427dd..1c6fec2 100644
--- a/programs/ssl/ssl_server.c
+++ b/programs/ssl/ssl_server.c
@@ -1,7 +1,7 @@
 /*
  *  SSL server demonstration program
  *
- *  Copyright (C) 2006-2010, Brainspark B.V.
+ *  Copyright (C) 2006-2011, Brainspark B.V.
  *
  *  This file is part of PolarSSL (http://www.polarssl.org)
  *  Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
@@ -27,7 +27,7 @@
 #define _CRT_SECURE_NO_DEPRECATE 1
 #endif
 
-#ifdef WIN32
+#if defined(_WIN32)
 #include <windows.h>
 #endif
 
@@ -118,7 +118,7 @@
         prv = cur;
         cur = cur->next;
 
-        if( ssl->timeout != 0 && t - prv->start > ssl->timeout )
+        if( ssl->timeout != 0 && (int) ( t - prv->start ) > ssl->timeout )
             continue;
 
         if( ssl->session->ciphersuite != prv->ciphersuite ||
@@ -144,7 +144,7 @@
 
     while( cur != NULL )
     {
-        if( ssl->timeout != 0 && t - cur->start > ssl->timeout )
+        if( ssl->timeout != 0 && (int) ( t - cur->start ) > ssl->timeout )
             break; /* expired, reuse this slot */
 
         if( memcmp( ssl->session->id, cur->id, cur->length ) == 0 )
@@ -174,15 +174,18 @@
     !defined(POLARSSL_HAVEGE_C) || !defined(POLARSSL_SSL_TLS_C) ||  \
     !defined(POLARSSL_SSL_SRV_C) || !defined(POLARSSL_NET_C) ||   \
     !defined(POLARSSL_RSA_C)
-int main( void )
+int main( int argc, char *argv[] )
 {
+    ((void) argc);
+    ((void) argv);
+
     printf("POLARSSL_BIGNUM_C and/or POLARSSL_CERTS_C and/or POLARSSL_HAVEGE_C "
            "and/or POLARSSL_SSL_TLS_C and/or POLARSSL_SSL_SRV_C and/or "
            "POLARSSL_NET_C and/or POLARSSL_RSA_C not defined.\n");
     return( 0 );
 }
 #else
-int main( void )
+int main( int argc, char *argv[] )
 {
     int ret, len;
     int listen_fd;
@@ -195,6 +198,9 @@
     x509_cert srvcert;
     rsa_context rsa;
 
+    ((void) argc);
+    ((void) argv);
+
     /*
      * 1. Load the certificates and private RSA key
      */
@@ -293,7 +299,24 @@
     /*
      * 3. Wait until a client connects
      */
-#ifdef WIN32
+#if defined(_WIN32_WCE)
+    {
+        SHELLEXECUTEINFO sei;
+
+        ZeroMemory( &sei, sizeof( SHELLEXECUTEINFO ) );
+
+        sei.cbSize = sizeof( SHELLEXECUTEINFO );
+        sei.fMask = 0;
+        sei.hwnd = 0;
+        sei.lpVerb = _T( "open" );
+        sei.lpFile = _T( "https://localhost:4433/" );
+        sei.lpParameters = NULL;
+        sei.lpDirectory = NULL;
+        sei.nShow = SW_SHOWNORMAL;
+
+        ShellExecuteEx( &sei );
+    }
+#elif defined(_WIN32)
     ShellExecute( NULL, "open", "https://localhost:4433/",
                   NULL, NULL, SW_SHOWNORMAL );
 #endif
@@ -419,7 +442,7 @@
 
     memset( &ssl, 0, sizeof( ssl_context ) );
 
-#ifdef WIN32
+#if defined(_WIN32)
     printf( "  Press Enter to exit this program.\n" );
     fflush( stdout ); getchar();
 #endif