Release 961201
Sat Nov 30 19:21:17 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [configure]
Re-generated with autoconf 2.11. Let me know if you have
problems.
* [controls/listbox.c] [controls/oldlbox.c]
Listboxes rewritten from scratch. Moved old code still used by
comboboxes to oldlbox.c
* [misc/registry.c]
Use temporary file when saving registry.
* [windows/dialog.c]
Implemented Win32 version of DlgDirList() and DlgDirListComboBox().
* [windows/winproc.c]
Added translation for listbox Win32 messages.
Sat Nov 30 21:00:00 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [controls/widgets.c] [controls/button.c]
Fixed some incompatibilities with CTL3D DLL.
* [windows/dialog.c]
Made dialog windows fit into the desktop.
* [misc/winsock.c] [misc/winsock_async.c]
New Winsock engine.
* [windows/message.c]
GetMessage() fixes.
* [windows/queue.c] [windows/hook.c] [windows/win.c]
SetMessageQueue() fixes.
Fri Nov 29 10:25:12 1996 Slaven Rezic <eserte@cs.tu-berlin.de>
* [objects/text.c]
DrawText16(): Fixed return value.
Tue Nov 26 14:47:09 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [files/profile.c] [*/*]
Added Win32 profile functions, updated to new naming standard.
* [objects/font.c] [if1632/thunk.c] [include/windows.h]
Added EnumFonts32*, EnumFontFamiliesEx*, changed prototypes and
structures.
* [misc/ole2nls.c] [if1632/thunk.c]
Added EnumSystemLocales() (winhelp.exe).
* [misc/registry.c]
Added Windows 3.1 registry loader supplied by Tor Sjxwall, tor@sn.no
* [win32/file.c]
Partially fixed CreateFileMapping(), added UnmapViewOfFile().
Sat Nov 23 23:36:05 1996 Ronan Waide <waider@waider.ie>
* [misc/shell.c]
Fixed some FIXMEs relating to ShellExec() and FindExecutable().
* [misc/main.c]
Implemented a few more of the SystemParametersInfo() cases.
Tue Nov 19 01:24:34 1996 Philippe De Muyter <phdm@info.ucl.ac.be>
* [include/keyboard.h]
New file, new macro WINE_VKEY_MAPPINGS (using code taken from event.c).
* [include/windows.h]
New [VK_A, VK_Z] and [VK_0, VK9] macros.
* [misc/keyboard.c]
Fixes in KeyTable and ToAscii.
* [objects/font.c]
FONT_init : Give default value for MSWIN "system" font.
FONT_MatchFont : Do not try every size of a font family if the
family does not exist.
* [windows/event.c]
lastEventChar hack removed.
KeyStateTable replaced by InputKeyStateTable (maintained in event.c)
and QueueKeyStateTable (maintained in message.c).
EVENT_key : Corrections to the extended bit setting.
* [windows/message.c] [windows/keyboard.c]
Implementation of a new QueueKeyStateTable : table of key states
valid when messages are retrieved by GetMessage or PeekMessage,
and valid for TranslateMessage.
TranslateMessage : Convert WM*KEY messages using QueueKeyStateTable
and ToAscii.
Mon Nov 18 16:59:01 1996 Robert Pouliot <krynos@clic.net>
* [graphics/Makefile.in] [graphics/wing.c]
[if1632/wing.spec]
Some functions for WinG support, mostly empty stubs.
* [misc/crtdll.c] [if1632/crtdll.spec]
Many functions added to CRTDLL, mostly calls to Unix C library.
diff --git a/include/winsock.h b/include/winsock.h
index 9548229..9119c01 100644
--- a/include/winsock.h
+++ b/include/winsock.h
@@ -16,26 +16,112 @@
#include <sys/socket.h>
#include "windows.h"
-/*
- * The new type to be used in all
- * instances which refer to sockets.
- */
-typedef u_int SOCKET;
-
-extern int __WSAFDIsSet(SOCKET, fd_set *);
-
-/*
- * Internet address (old style... should be updated)
- */
-#ifdef WS_USE_OLD_STYLE
-#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
-#define s_host S_un.S_un_b.s_b2 /* host on imp */
-#define s_net S_un.S_un_b.s_b1 /* network */
-#define s_imp S_un.S_un_w.s_w2 /* imp */
-#define s_impno S_un.S_un_b.s_b4 /* imp # */
-#define s_lh S_un.S_un_b.s_b3 /* logical host */
+#ifndef WINELIB
+#pragma pack(1) /* tight alignment for the emulator */
#endif
+/* Win16 socket-related types */
+
+typedef UINT16 SOCKET16;
+
+typedef struct ws_hostent
+{
+ SEGPTR h_name; /* official name of host */
+ SEGPTR h_aliases; /* alias list */
+ INT16 h_addrtype; /* host address type */
+ INT16 h_length; /* length of address */
+ SEGPTR h_addr_list; /* list of addresses from name server */
+} _ws_hostent;
+
+typedef struct ws_protoent
+{
+ SEGPTR p_name; /* official protocol name */
+ SEGPTR p_aliases; /* alias list */
+ INT16 p_proto; /* protocol # */
+} _ws_protoent;
+
+typedef struct ws_servent
+{
+ SEGPTR s_name; /* official service name */
+ SEGPTR s_aliases; /* alias list */
+ INT16 s_port; /* port # */
+ SEGPTR s_proto; /* protocol to use */
+} _ws_servent;
+
+typedef struct ws_netent
+{
+ SEGPTR n_name; /* official name of net */
+ SEGPTR n_aliases; /* alias list */
+ INT16 n_addrtype; /* net address type */
+ INT32 n_net; /* network # */
+} _ws_netent;
+
+typedef struct sockaddr ws_sockaddr;
+
+typedef struct
+{
+ UINT16 fd_count; /* how many are SET? */
+ SOCKET16 fd_array[FD_SETSIZE]; /* an array of SOCKETs */
+} ws_fd_set;
+
+/* ws_fd_set operations */
+
+INT16 __WSAFDIsSet( SOCKET16, ws_fd_set * );
+
+#define WS_FD_CLR(fd, set) do { \
+ UINT16 __i; \
+ for (__i = 0; __i < ((ws_fd_set*)(set))->fd_count ; __i++) \
+ { \
+ if (((ws_fd_set*)(set))->fd_array[__i] == fd) \
+ { \
+ while (__i < ((ws_fd_set*)(set))->fd_count-1) \
+ { \
+ ((ws_fd_set*)(set))->fd_array[__i] = \
+ ((ws_fd_set*)(set))->fd_array[__i+1]; \
+ __i++; \
+ } \
+ ((ws_fd_set*)(set))->fd_count--; \
+ break; \
+ } \
+ } \
+} while(0)
+
+#define WS_FD_SET(fd, set) do { \
+ if (((ws_fd_set*)(set))->fd_count < FD_SETSIZE) \
+ ((ws_fd_set*)(set))->fd_array[((ws_fd_set*)(set))->fd_count++]=(fd);\
+} while(0)
+
+#define WS_FD_ZERO(set) (((ws_fd_set*)(set))->fd_count=0)
+
+#define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET16)(fd), (ws_fd_set*)(set))
+
+/*
+ * Internet address (old style... should be updated)
+ */
+
+typedef struct ws_addr_in
+{
+ union {
+ struct { BYTE s_b1,s_b2,s_b3,s_b4; } S_un_b;
+ struct { UINT16 s_w1,s_w2; } S_un_w;
+ UINT32 S_addr;
+ } S_un;
+#define ws_addr S_un.S_addr /* can be used for most tcp & ip code */
+#define ws_host S_un.S_un_b.s_b2 /* host on imp */
+#define ws_net S_un.S_un_b.s_b1 /* network */
+#define ws_imp S_un.S_un_w.s_w2 /* imp */
+#define ws_impno S_un.S_un_b.s_b4 /* imp # */
+#define ws_lh S_un.S_un_b.s_b3 /* logical host */
+} _ws_in_addr;
+
+typedef struct ws_sockaddr_in
+{
+ INT16 sin_family;
+ UINT16 sin_port;
+ _ws_in_addr sin_addr;
+ char sin_zero[8];
+} _ws_sockaddr_in;
+
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
@@ -44,24 +130,79 @@
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
- unsigned short iMaxSockets;
- unsigned short iMaxUdpDg;
- char *lpVendorInfo;
+ UINT16 iMaxSockets;
+ UINT16 iMaxUdpDg;
+ SEGPTR lpVendorInfo;
} WSADATA, *LPWSADATA;
+#ifndef WINELIB
+#pragma pack(4)
+#endif
+
+/* ----------------------------------- no Win16 structure defs beyond this line! */
+
/*
* This is used instead of -1, since the
* SOCKET type is unsigned.
*/
-#define INVALID_SOCKET (SOCKET)(~0)
-#define SOCKET_ERROR (-1)
+#define INVALID_SOCKET (SOCKET16)(~0)
+#define SOCKET_ERROR (-1)
+
+/*
+ * Types
+ */
+#define WS_SOCK_STREAM 1 /* stream socket */
+#define WS_SOCK_DGRAM 2 /* datagram socket */
+#define WS_SOCK_RAW 3 /* raw-protocol interface */
+#define WS_SOCK_RDM 4 /* reliably-delivered message */
+#define WS_SOCK_SEQPACKET 5 /* sequenced packet stream */
+
+#define WS_SOL_SOCKET (-1)
+#define WS_IPPROTO_TCP 6
/*
* Option flags per-socket.
*/
-#ifndef SO_DONTLINGER
-#define SO_DONTLINGER (u_int)(~SO_LINGER)
-#endif
+#define WS_SO_DEBUG 0x0001 /* turn on debugging info recording */
+#define WS_SO_ACCEPTCONN 0x0002 /* socket has had listen() */
+#define WS_SO_REUSEADDR 0x0004 /* allow local address reuse */
+#define WS_SO_KEEPALIVE 0x0008 /* keep connections alive */
+#define WS_SO_DONTROUTE 0x0010 /* just use interface addresses */
+#define WS_SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
+#define WS_SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
+#define WS_SO_LINGER 0x0080 /* linger on close if data present */
+#define WS_SO_OOBINLINE 0x0100 /* leave received OOB data in line */
+
+#define WS_SO_DONTLINGER (UINT16)(~WS_SO_LINGER)
+
+/*
+ * Additional options.
+ */
+#define WS_SO_SNDBUF 0x1001 /* send buffer size */
+#define WS_SO_RCVBUF 0x1002 /* receive buffer size */
+#define WS_SO_SNDLOWAT 0x1003 /* send low-water mark */
+#define WS_SO_RCVLOWAT 0x1004 /* receive low-water mark */
+#define WS_SO_SNDTIMEO 0x1005 /* send timeout */
+#define WS_SO_RCVTIMEO 0x1006 /* receive timeout */
+#define WS_SO_ERROR 0x1007 /* get error status and clear */
+#define WS_SO_TYPE 0x1008 /* get socket type */
+
+#define WS_IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
+#define WS_IOC_VOID 0x20000000 /* no parameters */
+#define WS_IOC_OUT 0x40000000 /* copy out parameters */
+#define WS_IOC_IN 0x80000000 /* copy in parameters */
+#define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
+#define WS_IOR(x,y,t) (WS_IOC_OUT|(((UINT32)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
+#define WS_IOW(x,y,t) (WS_IOC_IN|(((UINT32)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
+
+/*
+ * Socket I/O flags (supported by spec 1.1)
+ */
+
+#define WS_FIONREAD WS_IOR('f', 127, u_long)
+#define WS_FIONBIO WS_IOW('f', 126, u_long)
+
+#define WS_SIOCATMARK WS_IOR('s', 7, u_long)
/*
* Maximum queue length specifiable by listen.
@@ -84,12 +225,17 @@
/*
* Define flags to be used with the WSAAsyncSelect() call.
*/
-#define FD_READ 0x01
-#define FD_WRITE 0x02
-#define FD_OOB 0x04
-#define FD_ACCEPT 0x08
-#define FD_CONNECT 0x10
-#define FD_CLOSE 0x20
+#define WS_FD_READ 0x01
+#define WS_FD_WRITE 0x02
+#define WS_FD_OOB 0x04
+#define WS_FD_ACCEPT 0x08
+#define WS_FD_CONNECT 0x10
+#define WS_FD_CLOSE 0x20
+
+#define WS_FD_NONBLOCK 0x10000000 /* internal per-socket flags */
+#define WS_FD_INACTIVE 0x20000000
+#define WS_FD_CONNECTED 0x40000000
+#define WS_FD_INTERNAL 0xFFFF0000
/*
* All Windows Sockets error constants are biased by WSABASEERR from
@@ -190,29 +336,35 @@
/* Microsoft Windows Extension function prototypes */
-INT WSAStartup(WORD wVersionRequired, LPWSADATA lpWSAData);
-INT WSACleanup(void);
-void WSASetLastError(INT iError);
-INT WSAGetLastError(void);
-BOOL WSAIsBlocking(void);
-INT WSAUnhookBlockingHook(void);
+INT16 WSAStartup(UINT16 wVersionRequired, LPWSADATA lpWSAData);
+INT16 WSACleanup(void);
+void WSASetLastError(INT16 iError);
+INT16 WSAGetLastError(void);
+BOOL16 WSAIsBlocking(void);
+INT16 WSAUnhookBlockingHook(void);
FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc);
-INT WSACancelBlockingCall(void);
-HANDLE16 WSAAsyncGetServByName(HWND hWnd, u_int wMsg,
- LPCSTR name, LPCSTR proto,
- LPSTR buf, INT buflen);
-HANDLE16 WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, INT port,
- LPCSTR proto, LPSTR buf, INT buflen);
-HANDLE16 WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg,
- LPCSTR name, LPSTR buf, INT buflen);
-HANDLE16 WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg,
- INT number, LPSTR buf, INT buflen);
-HANDLE16 WSAAsyncGetHostByName(HWND hWnd, u_int wMsg,
- LPCSTR name, LPSTR buf, INT buflen);
-HANDLE16 WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, LPCSTR addr, INT len,
- INT type, LPSTR buf, INT buflen);
-INT WSACancelAsyncRequest(HANDLE16 hAsyncTaskHandle);
-INT WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, long lEvent);
+INT16 WSACancelBlockingCall(void);
+HANDLE16 WSAAsyncGetServByName(HWND16 hWnd, UINT16 wMsg,
+ LPCSTR name, LPCSTR proto,
+ SEGPTR buf, INT16 buflen);
+
+HANDLE16 WSAAsyncGetServByPort(HWND16 hWnd, UINT16 wMsg, INT16 port,
+ LPCSTR proto, SEGPTR buf, INT16 buflen);
+
+HANDLE16 WSAAsyncGetProtoByName(HWND16 hWnd, UINT16 wMsg,
+ LPCSTR name, SEGPTR buf, INT16 buflen);
+
+HANDLE16 WSAAsyncGetProtoByNumber(HWND16 hWnd, UINT16 wMsg,
+ INT16 number, SEGPTR buf, INT16 buflen);
+
+HANDLE16 WSAAsyncGetHostByName(HWND16 hWnd, UINT16 wMsg,
+ LPCSTR name, SEGPTR buf, INT16 buflen);
+
+HANDLE16 WSAAsyncGetHostByAddr(HWND16 hWnd, UINT16 wMsg, LPCSTR addr, INT16 len,
+ INT16 type, SEGPTR buf, INT16 buflen);
+
+INT16 WSACancelAsyncRequest(HANDLE16 hAsyncTaskHandle);
+INT16 WSAAsyncSelect(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, UINT32 lEvent);
#ifdef __cplusplus
}
@@ -267,4 +419,121 @@
*/
#define WSAGETSELECTERROR(lParam) HIWORD(lParam)
+/* ----------------------------------- internal structures */
+
+#define WS_DUP_NATIVE 0x0
+#define WS_DUP_OFFSET 0x2
+#define WS_DUP_SEGPTR 0x4
+
+#define AOP_IO 0x0000001 /* aop_control paramaters */
+
+#define AOP_CONTROL_REMOVE 0x0000000 /* aop_control return values */
+#define AOP_CONTROL_KEEP 0x0000001
+
+typedef struct __aop
+{
+ /* AOp header */
+
+ struct __aop *next, *prev;
+ int fd[2]; /* pipe */
+ int (*aop_control)(struct __aop*, int); /* SIGIO handler */
+ pid_t pid; /* child process pid */
+
+ /* custom data */
+
+ HWND16 hWnd;
+ UINT16 uMsg;
+
+ unsigned flags;
+ SEGPTR buffer_base;
+ int buflen;
+ char* init; /* parameter data - length is in the async_ctl */
+} ws_async_op;
+
+#define WSMSG_ASYNC_SELECT 0x0000001
+#define WSMSG_ASYNC_HOSTBYNAME 0x0000010
+#define WSMSG_ASYNC_HOSTBYADDR 0x0000020
+#define WSMSG_ASYNC_PROTOBYNAME 0x0000100
+#define WSMSG_ASYNC_PROTOBYNUM 0x0000200
+#define WSMSG_ASYNC_SERVBYNAME 0x0001000
+#define WSMSG_ASYNC_SERVBYPORT 0x0002000
+
+#define MTYPE_PARENT 0x50505357
+#define MTYPE_CLIENT 0x50435357
+
+#pragma pack(1)
+typedef struct
+{
+ long mtype; /* WSMSG_... */
+
+ UINT32 lParam;
+ UINT16 wParam; /* socket handle */
+} ipc_packet;
+
+#define MTYPE_PARENT_SIZE \
+ (sizeof(UINT32))
+#define MTYPE_CLIENT_SIZE \
+ (sizeof(ipc_packet) - sizeof(long))
+#pragma pack(4)
+
+typedef struct
+{
+ int fd;
+ unsigned flags;
+ ws_async_op* p_aop;
+} ws_socket;
+
+typedef struct
+{
+ ws_async_op* ws_aop; /* init'ed for getXbyY */
+ ws_socket* ws_sock; /* init'ed for AsyncSelect */
+ int lEvent;
+ int lLength;
+ char* buffer;
+ ipc_packet ip;
+} ws_async_ctl;
+
+#define WS_MAX_SOCKETS_PER_THREAD 16
+#define WS_MAX_UDP_DATAGRAM 1024
+
+#define WSI_BLOCKINGCALL 0x00000001 /* per-thread info flags */
+
+typedef struct __WSINFO
+{
+ struct __WSINFO* prev,*next;
+
+ unsigned flags;
+ int errno;
+ int num_startup;
+ int num_async_rq;
+ int last_free;
+ ws_socket sock[WS_MAX_SOCKETS_PER_THREAD];
+ int buflen;
+ char* buffer;
+ FARPROC16 blocking_hook;
+ HTASK16 tid; /* owning thread id - better switch
+ * to TLS when it gets fixed */
+} WSINFO, *LPWSINFO;
+
+int WS_dup_he(LPWSINFO pwsi, struct hostent* p_he, int flag);
+int WS_dup_pe(LPWSINFO pwsi, struct protoent* p_pe, int flag);
+int WS_dup_se(LPWSINFO pwsi, struct servent* p_se, int flag);
+
+void WS_do_async_gethost(LPWSINFO, unsigned);
+void WS_do_async_getproto(LPWSINFO, unsigned);
+void WS_do_async_getserv(LPWSINFO, unsigned);
+
+int WINSOCK_async_io(int fd, int async);
+int WINSOCK_unblock_io(int fd, int noblock);
+
+int WINSOCK_check_async_op(ws_async_op* p_aop);
+void WINSOCK_link_async_op(ws_async_op* p_aop);
+void WINSOCK_unlink_async_op(ws_async_op* p_aop);
+void WINSOCK_cancel_async_op(HTASK16 tid);
+void WINSOCK_do_async_select(void);
+
+UINT16 wsaErrno(void);
+UINT16 wsaHerrno(void);
+
#endif /* _WINSOCKAPI_ */
+