2000-09-17 09:36:01 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS WinSock 2 DLL
|
|
|
|
* FILE: include/ws2_32.h
|
|
|
|
* PURPOSE: WinSock 2 DLL header
|
|
|
|
*/
|
2014-01-26 17:48:17 +00:00
|
|
|
|
2000-09-17 09:36:01 +00:00
|
|
|
#ifndef __WS2_32_H
|
|
|
|
#define __WS2_32_H
|
|
|
|
|
2014-01-26 17:48:17 +00:00
|
|
|
#include <stdarg.h>
|
KJK::Hyperion is proud to present "dllimport purity", another landmark commit that you should really build only after a "clean"
Disclaimer: in an uncharacteristic and daring move, I actually built, installed and booted this revision
modified tools/rbuild/backend/mingw/mingw.cpp
modified tools/rbuild/backend/mingw/modulehandler.cpp
modified tools/rbuild/module.cpp
modified tools/rbuild/project.dtd
modified tools/rbuild/rbuild.h
modified include/crt/_mingw.h
New module attribute iscrt for marking modules that implement a C runtime library
New module attribute crt for compiling and linking modules to a specific C runtime library. Can be "ntdll" (for ntdll.dll) "msvcrt" (msvcrt.dll), "crt" (statically-linked runtime), "libcntpr" (libcntpr.lib), "dll" (one of the <library> entries specifies a CRT DLL) or "static". Defaults to "msvcrt" for Win32 modules, to "static" for CRT modules themselves, and to "dll" for drivers
Define _DLL for code that compiles against a dynamically-linked CRT
Define __MINGW_IMPORT and _CRTIMP according to whether _DLL is defined. We finally use __declspec(dllimport) somewhere, anywhere (SDK headers still don't use it)
Bonus fix: actually use compiler-specific command line flags when compiling files
modified lib/3rdparty/adns/adns.rbuild
modified lib/3rdparty/libxml2/libxml2.rbuild
modified lib/3rdparty/mingw/mingw.rbuild
And for the downside: static libraries that will be linked to a module that links to the CRT dynamically have to be compiled for a dynamically-linked CRT, as well. Say it out aloud.
modified base/applications/wordpad/wordpad.rbuild
modified base/setup/usetup/usetup.rbuild
modified dll/3rdparty/dxtn/dxtn.rbuild
modified dll/3rdparty/freetype/freetype.rbuild
modified dll/3rdparty/mesa32/mesa32.rbuild
modified dll/cpl/desk/desk.rbuild
modified dll/cpl/input/input.rbuild
modified dll/cpl/intl/intl.rbuild
modified dll/cpl/joy/joy.rbuild
modified dll/cpl/main/main.rbuild
modified dll/cpl/mmsys/mmsys.rbuild
modified dll/cpl/odbccp32/odbccp32.rbuild
modified dll/cpl/powercfg/powercfg.rbuild
modified dll/cpl/sysdm/sysdm.rbuild
modified dll/cpl/telephon/telephon.rbuild
modified dll/cpl/timedate/timedate.rbuild
modified dll/cpl/usrmgr/usrmgr.rbuild
modified dll/directx/ddraw/ddraw.rbuild
modified dll/directx/dsound/dsound.rbuild
modified dll/directx/wine/wined3d/wined3d.rbuild
modified dll/nls/idndl_redist/idndl_redist.rbuild
modified dll/nls/normaliz_redist/normaliz_redist.rbuild
modified dll/shellext/deskadp/deskadp.rbuild
modified dll/shellext/deskmon/deskmon.rbuild
modified dll/shellext/fontext/fontext.rbuild
modified dll/win32/dhcpcsvc/dhcpcsvc.rbuild
modified dll/win32/dnsapi/dnsapi.rbuild
modified dll/win32/glu32/glu32.rbuild
modified dll/win32/icmp/icmp.rbuild
modified dll/win32/winmm/midimap/midimap.rbuild
modified drivers/video/displays/framebuf/framebuf.rbuild
modified drivers/video/displays/framebufacc/framebufacc.rbuild
modified drivers/video/displays/vga/vgaddi.rbuild
modified subsystems/win32/csrss/csrss.rbuild
modified subsystems/win32/csrss/win32csr/win32csr.rbuild
modified subsystems/win32/win32k/win32k.rbuild
Don't specify msvcrt explicitely as a <library> if it's going to be linked implicitely as the CRT
<library>libcntpr</library> -> crt="libcntpr"
Remove miscellaneous unused <library> entries
modified dll/win32/crtdll/crtdll.rbuild
modified dll/win32/msvcrt20/msvcrt20.rbuild
modified dll/win32/msvcrt40/msvcrt40.rbuild
modified dll/win32/msvcrt/msvcrt.rbuild
Mark CRT DLLs as CRT modules
modified dll/win32/user32/windows/font.c
modified include/reactos/wine/unicode.h
Don't redefine or redeclare CRT functions
modified dll/win32/ws2_32/include/ws2_32.h
Arch, you idiot, it's defined in <stdlib.h>
modified include/crt/ctype.h
modified include/crt/wctype.h
Don't import ctype routines that were already defined as inlines
modified include/crt/stdio.h
modified include/reactos/wine/config.h
Avoid linking to libmingwex.a if possible
modified base/applications/taskmgr/taskmgr.rbuild
modified tools/nci/nci.mak
modified tools/nci/ncitool.c
modified dll/ntdll/ntdll.rbuild
Mark ntdll module as a CRT
New "ntsys" module to import just Nt/Zw from ntdll.dll. Avoids accidentally linking to ntdll.dll's CRT when importing system calls
modified include/psdk/winternl.h
Nope, it doesn't.
modified base/applications/network/net/help.c
modified base/applications/network/net/main.c
Replace printf with puts, or GCC will do it on its own and link to the dllimport thunk for puts
modified base/applications/network/ping/ping.c
Removed broken, unnecessary workaround
modified base/shell/cmd/cmd.rbuild
Simplify cmd module
This commit dediHAPPY BIRTHDAY STEFAN GINSBERG <3 <3 <3
svn path=/trunk/; revision=37187
2008-11-04 18:16:58 +00:00
|
|
|
|
2005-10-19 17:03:38 +00:00
|
|
|
#define WIN32_NO_STATUS
|
2013-01-24 23:00:42 +00:00
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
2014-01-26 17:48:17 +00:00
|
|
|
|
2013-01-24 23:00:42 +00:00
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
|
|
|
#include <winuser.h>
|
2000-09-17 09:36:01 +00:00
|
|
|
#include <ws2spi.h>
|
2005-06-20 19:30:55 +00:00
|
|
|
#define NTOS_MODE_USER
|
2011-08-13 21:39:37 +00:00
|
|
|
#include <ndk/rtlfuncs.h>
|
2005-06-20 19:30:55 +00:00
|
|
|
|
2005-08-15 02:24:48 +00:00
|
|
|
#include <wsahelp.h>
|
|
|
|
|
2004-01-11 20:46:06 +00:00
|
|
|
#undef assert
|
2000-09-17 09:36:01 +00:00
|
|
|
#include <debug.h>
|
2005-04-01 21:44:22 +00:00
|
|
|
#include <windns.h> // DNS_A_DATA
|
2000-09-17 09:36:01 +00:00
|
|
|
|
2011-08-10 23:04:40 +00:00
|
|
|
#include "catalog.h"
|
|
|
|
#include "handle.h"
|
|
|
|
|
2008-11-30 13:28:04 +00:00
|
|
|
#define EXPORT WINAPI
|
2000-09-17 09:36:01 +00:00
|
|
|
|
2006-08-17 16:48:36 +00:00
|
|
|
extern HINSTANCE g_hInstDll;
|
2000-09-17 09:36:01 +00:00
|
|
|
extern HANDLE GlobalHeap;
|
2005-04-18 18:24:06 +00:00
|
|
|
extern BOOL WsaInitialized; /* TRUE if WSAStartup() has been successfully called */
|
2000-09-17 09:36:01 +00:00
|
|
|
extern WSPUPCALLTABLE UpcallTable;
|
|
|
|
|
2004-06-09 18:11:39 +00:00
|
|
|
#define WS2_INTERNAL_MAX_ALIAS 16
|
|
|
|
|
2006-08-14 17:26:36 +00:00
|
|
|
typedef struct _WINSOCK_GETSERVBYNAME_CACHE
|
|
|
|
{
|
2004-06-09 18:11:39 +00:00
|
|
|
UINT Size;
|
|
|
|
SERVENT ServerEntry;
|
|
|
|
PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS];
|
|
|
|
CHAR Data[1];
|
|
|
|
} WINSOCK_GETSERVBYNAME_CACHE, *PWINSOCK_GETSERVBYNAME_CACHE;
|
2000-09-17 09:36:01 +00:00
|
|
|
|
2006-08-14 17:26:36 +00:00
|
|
|
typedef struct _WINSOCK_GETSERVBYPORT_CACHE
|
|
|
|
{
|
2004-07-15 02:03:07 +00:00
|
|
|
UINT Size;
|
|
|
|
SERVENT ServerEntry;
|
|
|
|
PCHAR Aliases[WS2_INTERNAL_MAX_ALIAS];
|
|
|
|
CHAR Data[1];
|
|
|
|
} WINSOCK_GETSERVBYPORT_CACHE, *PWINSOCK_GETSERVBYPORT_CACHE;
|
|
|
|
|
2006-08-14 17:26:36 +00:00
|
|
|
typedef struct _WINSOCK_THREAD_BLOCK
|
|
|
|
{
|
2000-09-17 09:36:01 +00:00
|
|
|
INT LastErrorValue; /* Error value from last function that failed */
|
2001-01-14 17:44:38 +00:00
|
|
|
CHAR Intoa[16]; /* Buffer for inet_ntoa() */
|
2006-08-14 17:26:36 +00:00
|
|
|
PWINSOCK_GETSERVBYNAME_CACHE
|
2004-06-09 18:11:39 +00:00
|
|
|
Getservbyname; /* Buffer used by getservbyname */
|
2004-07-15 02:03:07 +00:00
|
|
|
PWINSOCK_GETSERVBYPORT_CACHE
|
|
|
|
Getservbyport; /* Buffer used by getservbyname */
|
2004-11-25 23:32:54 +00:00
|
|
|
struct hostent* Hostent;
|
2000-09-17 09:36:01 +00:00
|
|
|
} WINSOCK_THREAD_BLOCK, *PWINSOCK_THREAD_BLOCK;
|
|
|
|
|
|
|
|
|
|
|
|
/* Macros */
|
|
|
|
|
2005-04-18 18:24:06 +00:00
|
|
|
#define WSAINITIALIZED (WsaInitialized)
|
2000-09-17 09:36:01 +00:00
|
|
|
|
2005-04-18 18:24:06 +00:00
|
|
|
#define WSASETINITIALIZED (WsaInitialized = TRUE)
|
2000-09-17 09:36:01 +00:00
|
|
|
|
2004-11-25 23:32:54 +00:00
|
|
|
/* ws2_32 internal Functions */
|
|
|
|
void check_hostent(struct hostent **he);
|
2012-06-20 00:57:53 +00:00
|
|
|
void populate_hostent(struct hostent *he, char* name, IP4_ADDRESS addr);
|
2004-11-25 23:32:54 +00:00
|
|
|
void free_hostent(struct hostent *he);
|
|
|
|
void free_servent(struct servent* s);
|
2001-07-04 20:40:24 +00:00
|
|
|
|
|
|
|
#ifdef LE
|
|
|
|
|
|
|
|
/* DWORD network to host byte order conversion for little endian machines */
|
|
|
|
#define DN2H(dw) \
|
|
|
|
((((dw) & 0xFF000000L) >> 24) | \
|
|
|
|
(((dw) & 0x00FF0000L) >> 8) | \
|
|
|
|
(((dw) & 0x0000FF00L) << 8) | \
|
|
|
|
(((dw) & 0x000000FFL) << 24))
|
|
|
|
|
|
|
|
/* DWORD host to network byte order conversion for little endian machines */
|
|
|
|
#define DH2N(dw) \
|
|
|
|
((((dw) & 0xFF000000L) >> 24) | \
|
|
|
|
(((dw) & 0x00FF0000L) >> 8) | \
|
|
|
|
(((dw) & 0x0000FF00L) << 8) | \
|
|
|
|
(((dw) & 0x000000FFL) << 24))
|
|
|
|
|
|
|
|
/* WORD network to host order conversion for little endian machines */
|
|
|
|
#define WN2H(w) \
|
|
|
|
((((w) & 0xFF00) >> 8) | \
|
|
|
|
(((w) & 0x00FF) << 8))
|
|
|
|
|
|
|
|
/* WORD host to network byte order conversion for little endian machines */
|
|
|
|
#define WH2N(w) \
|
|
|
|
((((w) & 0xFF00) >> 8) | \
|
|
|
|
(((w) & 0x00FF) << 8))
|
|
|
|
|
|
|
|
#else /* LE */
|
|
|
|
|
|
|
|
/* DWORD network to host byte order conversion for big endian machines */
|
|
|
|
#define DN2H(dw) \
|
|
|
|
(dw)
|
|
|
|
|
|
|
|
/* DWORD host to network byte order conversion big endian machines */
|
|
|
|
#define DH2N(dw) \
|
|
|
|
(dw)
|
|
|
|
|
|
|
|
/* WORD network to host order conversion for big endian machines */
|
|
|
|
#define WN2H(w) \
|
|
|
|
(w)
|
|
|
|
|
|
|
|
/* WORD host to network byte order conversion for big endian machines */
|
|
|
|
#define WH2N(w) \
|
|
|
|
(w)
|
|
|
|
|
|
|
|
#endif /* LE */
|
|
|
|
|
2000-09-17 09:36:01 +00:00
|
|
|
#endif /* __WS2_32_H */
|