RT3548: Remove unsupported platforms

This last one for this ticket.  Removes WIN16.
So long, MS_CALLBACK and MS_FAR.  We won't miss you.

Reviewed-by: Richard Levitte <levitte@openssl.org>
diff --git a/apps/apps.c b/apps/apps.c
index 80762c1..ac709a6 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -290,7 +290,7 @@
 		return(FORMAT_UNDEF);
 	}
 
-#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_NETWARE)
+#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_NETWARE)
 void program_name(char *in, char *out, int size)
 	{
 	int i,n;
diff --git a/apps/ciphers.c b/apps/ciphers.c
index 7de7dd3..0018360 100644
--- a/apps/ciphers.c
+++ b/apps/ciphers.c
@@ -59,9 +59,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#endif
 #include "apps.h"
 #include <openssl/err.h>
 #include <openssl/ssl.h>
diff --git a/apps/dhparam.c b/apps/dhparam.c
index 7982222..86bf19d 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -144,7 +144,7 @@
  * -C
  */
 
-static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb);
+static int dh_cb(int p, int n, BN_GENCB *cb);
 
 int MAIN(int, char **);
 
@@ -551,7 +551,7 @@
 	}
 
 /* dh_cb is identical to dsa_cb in apps/dsaparam.c */
-static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb)
+static int dh_cb(int p, int n, BN_GENCB *cb)
 	{
 	char c='*';
 
diff --git a/apps/dsaparam.c b/apps/dsaparam.c
index a922335..7a9ed82 100644
--- a/apps/dsaparam.c
+++ b/apps/dsaparam.c
@@ -101,7 +101,7 @@
 
 #endif
 
-static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *cb);
+static int dsa_cb(int p, int n, BN_GENCB *cb);
 
 int MAIN(int, char **);
 
@@ -468,7 +468,7 @@
 	OPENSSL_EXIT(ret);
 	}
 
-static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *cb)
+static int dsa_cb(int p, int n, BN_GENCB *cb)
 	{
 	char c='*';
 
diff --git a/apps/engine.c b/apps/engine.c
index 9a02943..04d4f73 100644
--- a/apps/engine.c
+++ b/apps/engine.c
@@ -60,9 +60,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#endif
 #include "apps.h"
 #include <openssl/err.h>
 #ifndef OPENSSL_NO_ENGINE
diff --git a/apps/gendh.c b/apps/gendh.c
index 4581bfa..ec68425 100644
--- a/apps/gendh.c
+++ b/apps/gendh.c
@@ -77,7 +77,7 @@
 #undef PROG
 #define PROG gendh_main
 
-static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb);
+static int dh_cb(int p, int n, BN_GENCB *cb);
 
 int MAIN(int, char **);
 
@@ -218,7 +218,7 @@
 	OPENSSL_EXIT(ret);
 	}
 
-static int MS_CALLBACK dh_cb(int p, int n, BN_GENCB *cb)
+static int dh_cb(int p, int n, BN_GENCB *cb)
 	{
 	char c='*';
 
diff --git a/apps/genrsa.c b/apps/genrsa.c
index fe00af9..b0bba05 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -77,7 +77,7 @@
 #undef PROG
 #define PROG genrsa_main
 
-static int MS_CALLBACK genrsa_cb(int p, int n, BN_GENCB *cb);
+static int genrsa_cb(int p, int n, BN_GENCB *cb);
 
 int MAIN(int, char **);
 
@@ -312,7 +312,7 @@
 	OPENSSL_EXIT(ret);
 	}
 
-static int MS_CALLBACK genrsa_cb(int p, int n, BN_GENCB *cb)
+static int genrsa_cb(int p, int n, BN_GENCB *cb)
 	{
 	char c='*';
 
diff --git a/apps/openssl.c b/apps/openssl.c
index 7453e65..c438daf 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -698,13 +698,13 @@
 	EVP_MD_do_all_sorted(list_md_fn, out);
 	}
 
-static int MS_CALLBACK function_cmp(const FUNCTION *a, const FUNCTION *b)
+static int function_cmp(const FUNCTION *a, const FUNCTION *b)
 	{
 	return strncmp(a->name,b->name,8);
 	}
 static IMPLEMENT_LHASH_COMP_FN(function, FUNCTION)
 
-static unsigned long MS_CALLBACK function_hash(const FUNCTION *a)
+static unsigned long function_hash(const FUNCTION *a)
 	{
 	return lh_strhash(a->name);
 	}	
diff --git a/apps/req.c b/apps/req.c
index 686fac4..e23c919 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -60,9 +60,6 @@
 #include <stdlib.h>
 #include <time.h>
 #include <string.h>
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#endif
 #include "apps.h"
 #include <openssl/bio.h>
 #include <openssl/evp.h>
diff --git a/apps/s_apps.h b/apps/s_apps.h
index 9d16e45..625e1eb 100644
--- a/apps/s_apps.h
+++ b/apps/s_apps.h
@@ -157,7 +157,7 @@
 		   unsigned char *context, int naccept);
 #endif
 #ifdef HEADER_X509_H
-int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx);
+int verify_callback(int ok, X509_STORE_CTX *ctx);
 #endif
 #ifdef HEADER_SSL_H
 int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
@@ -176,19 +176,19 @@
 int extract_port(const char *str, short *port_ptr);
 int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p);
 
-long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
+long bio_dump_callback(BIO *bio, int cmd, const char *argp,
 				   int argi, long argl, long ret);
 
 #ifdef HEADER_SSL_H
-void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret);
-void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
-void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
+void apps_ssl_info_callback(const SSL *s, int where, int ret);
+void msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg);
+void tlsext_cb(SSL *s, int client_server, int type,
 					unsigned char *data, int len,
 					void *arg);
 #endif
 
-int MS_CALLBACK generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len);
-int MS_CALLBACK verify_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int cookie_len);
+int generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len);
+int verify_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int cookie_len);
 
 typedef struct ssl_excert_st SSL_EXCERT;
 
diff --git a/apps/s_cb.c b/apps/s_cb.c
index 7720144..758da23 100644
--- a/apps/s_cb.c
+++ b/apps/s_cb.c
@@ -135,7 +135,7 @@
 unsigned char cookie_secret[COOKIE_SECRET_LENGTH];
 int cookie_initialized=0;
 
-int MS_CALLBACK verify_callback(int ok, X509_STORE_CTX *ctx)
+int verify_callback(int ok, X509_STORE_CTX *ctx)
 	{
 	X509 *err_cert;
 	int err,depth;
@@ -557,7 +557,7 @@
 	}
 		
 
-long MS_CALLBACK bio_dump_callback(BIO *bio, int cmd, const char *argp,
+long bio_dump_callback(BIO *bio, int cmd, const char *argp,
 				   int argi, long argl, long ret)
 	{
 	BIO *out;
@@ -581,7 +581,7 @@
 	return(ret);
 	}
 
-void MS_CALLBACK apps_ssl_info_callback(const SSL *s, int where, int ret)
+void apps_ssl_info_callback(const SSL *s, int where, int ret)
 	{
 	const char *str;
 	int w;
@@ -638,7 +638,7 @@
 		}
 	}
 
-void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)
+void msg_cb(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)
 	{
 	BIO *bio = arg;
 	const char *str_write_p, *str_version, *str_content_type = "", *str_details1 = "", *str_details2= "";
@@ -868,7 +868,7 @@
 	(void)BIO_flush(bio);
 	}
 
-void MS_CALLBACK tlsext_cb(SSL *s, int client_server, int type,
+void tlsext_cb(SSL *s, int client_server, int type,
 					unsigned char *data, int len,
 					void *arg)
 	{
@@ -981,7 +981,7 @@
 	(void)BIO_flush(bio);
 	}
 
-int MS_CALLBACK generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len)
+int generate_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len)
 	{
 	unsigned char *buffer, result[EVP_MAX_MD_SIZE];
 	unsigned int length, resultlength;
@@ -1069,7 +1069,7 @@
 	return 1;
 	}
 
-int MS_CALLBACK verify_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int cookie_len)
+int verify_cookie_callback(SSL *ssl, unsigned char *cookie, unsigned int cookie_len)
 	{
 	unsigned char *buffer, result[EVP_MAX_MD_SIZE];
 	unsigned int length, resultlength;
diff --git a/apps/s_client.c b/apps/s_client.c
index d650cc4..199a587 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -141,10 +141,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <openssl/e_os2.h>
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#endif
-
 /* With IPv6, it looks like Digital has mixed up the proper order of
    recursive header file inclusion, resulting in the compiler complaining
    that u_int isn't defined, but only if _POSIX_C_SOURCE is defined, which
@@ -384,7 +380,7 @@
 } tlsextctx;
 
 
-static int MS_CALLBACK ssl_servername_cb(SSL *s, int *ad, void *arg)
+static int ssl_servername_cb(SSL *s, int *ad, void *arg)
 	{
 	tlsextctx * p = (tlsextctx *) arg;
 	const char * hn= SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
@@ -454,7 +450,7 @@
    primality tests are rather cpu consuming.
 */
 
-static int MS_CALLBACK ssl_srp_verify_param_cb(SSL *s, void *arg)
+static int ssl_srp_verify_param_cb(SSL *s, void *arg)
 	{
 	SRP_ARG *srp_arg = (SRP_ARG *)arg;
 	BIGNUM *N = NULL, *g = NULL;
@@ -489,7 +485,7 @@
 
 #define PWD_STRLEN 1024
 
-static char * MS_CALLBACK ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
+static char * ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
 	{
 	SRP_ARG *srp_arg = (SRP_ARG *)arg;
 	char *pass = (char *)OPENSSL_malloc(PWD_STRLEN+1);
diff --git a/apps/s_server.c b/apps/s_server.c
index 6690646..412091d 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -148,9 +148,6 @@
 #include <string.h>
 
 #include <openssl/e_os2.h>
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#endif
 
 #if !defined(OPENSSL_SYS_NETWARE)  /* conflicts with winsock2 stuff on netware */
 #include <sys/types.h>
@@ -193,7 +190,7 @@
 #endif
 
 #ifndef OPENSSL_NO_RSA
-static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength);
+static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength);
 #endif
 static int not_resumable_sess_cb(SSL *s, int is_forward_secure);
 static int sv_body(char *hostname, int s, int stype, unsigned char *context);
@@ -367,7 +364,7 @@
    (which would normally occur after a worker has finished) and we
    set the user parameters. 
 */
-static int MS_CALLBACK ssl_srp_server_param_cb(SSL *s, int *ad, void *arg)
+static int ssl_srp_server_param_cb(SSL *s, int *ad, void *arg)
 	{
 	srpsrvparm *p = (srpsrvparm *)arg;
 	if (p->login == NULL && p->user == NULL )
@@ -721,7 +718,7 @@
 } tlsextctx;
 
 
-static int MS_CALLBACK ssl_servername_cb(SSL *s, int *ad, void *arg)
+static int ssl_servername_cb(SSL *s, int *ad, void *arg)
 	{
 	tlsextctx * p = (tlsextctx *) arg;
 	const char * servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
@@ -3411,7 +3408,7 @@
 	}
 
 #ifndef OPENSSL_NO_RSA
-static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength)
+static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
 	{
 	BIGNUM *bn = NULL;
 	static RSA *rsa_tmp=NULL;
diff --git a/apps/s_socket.c b/apps/s_socket.c
index f44050d..397cb1e 100644
--- a/apps/s_socket.c
+++ b/apps/s_socket.c
@@ -107,12 +107,6 @@
 static int do_accept_unix(int acc_sock, int *sock);
 #endif
 
-#ifdef OPENSSL_SYS_WIN16
-#define SOCKET_PROTOCOL	0 /* more microsoft stupidity */
-#else
-#define SOCKET_PROTOCOL	IPPROTO_TCP
-#endif
-
 #if defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
 static int wsa_init_done=0;
 #endif
@@ -121,36 +115,6 @@
 static struct WSAData wsa_state;
 static int wsa_init_done=0;
 
-#ifdef OPENSSL_SYS_WIN16
-static HWND topWnd=0;
-static FARPROC lpTopWndProc=NULL;
-static FARPROC lpTopHookProc=NULL;
-extern HINSTANCE _hInstance;  /* nice global CRT provides */
-
-static LONG FAR PASCAL topHookProc(HWND hwnd, UINT message, WPARAM wParam,
-	     LPARAM lParam)
-	{
-	if (hwnd == topWnd)
-		{
-		switch(message)
-			{
-		case WM_DESTROY:
-		case WM_CLOSE:
-			SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopWndProc);
-			ssl_sock_cleanup();
-			break;
-			}
-		}
-	return CallWindowProc(lpTopWndProc,hwnd,message,wParam,lParam);
-	}
-
-static BOOL CALLBACK enumproc(HWND hwnd,LPARAM lParam)
-	{
-	topWnd=hwnd;
-	return(FALSE);
-	}
-
-#endif /* OPENSSL_SYS_WIN32 */
 #endif /* OPENSSL_SYS_WINDOWS */
 
 #ifdef OPENSSL_SYS_WINDOWS
@@ -199,14 +163,6 @@
 			BIO_printf(bio_err,"unable to start WINSOCK, error code=%d\n",err);
 			return(0);
 			}
-
-#ifdef OPENSSL_SYS_WIN16
-		EnumTaskWindows(GetCurrentTask(),enumproc,0L);
-		lpTopWndProc=(FARPROC)GetWindowLong(topWnd,GWL_WNDPROC);
-		lpTopHookProc=MakeProcInstance((FARPROC)topHookProc,_hInstance);
-
-		SetWindowLong(topWnd,GWL_WNDPROC,(LONG)lpTopHookProc);
-#endif /* OPENSSL_SYS_WIN16 */
 		}
 #elif defined(OPENSSL_SYS_NETWARE) && !defined(NETWARE_BSDSOCK)
    WORD wVerReq;
@@ -263,7 +219,7 @@
 	them.sin_addr.s_addr=htonl(addr);
 
 	if (type == SOCK_STREAM)
-		s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
+		s=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
 	else /* ( type == SOCK_DGRAM) */
 		s=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
 			
@@ -412,7 +368,7 @@
 #endif
 	
 		if (type == SOCK_STREAM)
-			s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
+			s=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
 		else /* type == SOCK_DGRAM */
 			s=socket(AF_INET, SOCK_DGRAM,IPPROTO_UDP);
 
@@ -667,8 +623,7 @@
 			BIO_printf(bio_err,"gethostbyname failure\n");
 			goto err;
 			}
-		/* cast to short because of win16 winsock definition */
-		if ((short)he->h_addrtype != AF_INET)
+		if (he->h_addrtype != AF_INET)
 			{
 			BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n");
 			return(0);
diff --git a/apps/s_time.c b/apps/s_time.c
index 6542be2..dfe8df7 100644
--- a/apps/s_time.c
+++ b/apps/s_time.c
@@ -69,9 +69,6 @@
 
 #define USE_SOCKETS
 #include "apps.h"
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#endif
 #include <openssl/x509.h>
 #include <openssl/ssl.h>
 #include <openssl/pem.h>
diff --git a/apps/ts.c b/apps/ts.c
index ace13bd..2a1d666 100644
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -103,7 +103,7 @@
 static TS_RESP *create_response(CONF *conf, const char *section, char *engine,
 				char *queryfile, char *passin, char *inkey,
 				char *signer, char *chain, const char *policy);
-static ASN1_INTEGER * MS_CALLBACK serial_cb(TS_RESP_CTX *ctx, void *data);
+static ASN1_INTEGER * serial_cb(TS_RESP_CTX *ctx, void *data);
 static ASN1_INTEGER *next_serial(const char *serialfile);
 static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial);
 
@@ -116,7 +116,7 @@
 					char *ca_path, char *ca_file,
 					char *untrusted);
 static X509_STORE *create_cert_store(char *ca_path, char *ca_file);
-static int MS_CALLBACK verify_cb(int ok, X509_STORE_CTX *ctx);
+static int verify_cb(int ok, X509_STORE_CTX *ctx);
 
 /* Main function definition. */
 int MAIN(int, char **);
@@ -876,7 +876,7 @@
 	return response;
 	}
 
-static ASN1_INTEGER * MS_CALLBACK serial_cb(TS_RESP_CTX *ctx, void *data)
+static ASN1_INTEGER * serial_cb(TS_RESP_CTX *ctx, void *data)
 	{
 	const char *serial_file = (const char *) data;
 	ASN1_INTEGER *serial = next_serial(serial_file);
@@ -1128,7 +1128,7 @@
 	return NULL;
 	}
 
-static int MS_CALLBACK verify_cb(int ok, X509_STORE_CTX *ctx)
+static int verify_cb(int ok, X509_STORE_CTX *ctx)
 	{
 	/*-
 	char buf[256];
diff --git a/apps/verify.c b/apps/verify.c
index b9480bd..2b2224f 100644
--- a/apps/verify.c
+++ b/apps/verify.c
@@ -69,7 +69,7 @@
 #undef PROG
 #define PROG	verify_main
 
-static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx);
+static int cb(int ok, X509_STORE_CTX *ctx);
 static int check(X509_STORE *ctx, char *file,
 		STACK_OF(X509) *uchain, STACK_OF(X509) *tchain,
 		STACK_OF(X509_CRL) *crls, ENGINE *e, int show_chain);
@@ -342,7 +342,7 @@
 	return(ret);
 	}
 
-static int MS_CALLBACK cb(int ok, X509_STORE_CTX *ctx)
+static int cb(int ok, X509_STORE_CTX *ctx)
 	{
 	int cert_error = X509_STORE_CTX_get_error(ctx);
 	X509 *current_cert = X509_STORE_CTX_get_current_cert(ctx);
diff --git a/apps/x509.c b/apps/x509.c
index 3bb2610..b3c2390 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -60,9 +60,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#endif
 #include "apps.h"
 #include <openssl/bio.h>
 #include <openssl/asn1.h>
@@ -156,7 +153,7 @@
 NULL
 };
 
-static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx);
+static int callb(int ok, X509_STORE_CTX *ctx);
 static int sign (X509 *x, EVP_PKEY *pkey,int days,int clrext, const EVP_MD *digest,
 						CONF *conf, char *section);
 static int x509_certify (X509_STORE *ctx,char *CAfile,const EVP_MD *digest,
@@ -1279,7 +1276,7 @@
 	return ret;
 	}
 
-static int MS_CALLBACK callb(int ok, X509_STORE_CTX *ctx)
+static int callb(int ok, X509_STORE_CTX *ctx)
 	{
 	int err;
 	X509 *err_cert;