From 0b019f3ae852aaf304d92f6b09ac7f895d088932 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Tue, 21 Jul 2009 09:03:03 +0000 Subject: [PATCH] - Add some defines, prototypes. It fixes compilation ws2_32_new svn path=/trunk/; revision=42112 --- reactos/include/psdk/winsock2.h | 51 +++++++++++++++++++++++- reactos/include/psdk/ws2spi.h | 70 +++++++++++++++++++++------------ reactos/include/psdk/ws2tcpip.h | 69 +++++++++++++++++++++++--------- 3 files changed, 145 insertions(+), 45 deletions(-) diff --git a/reactos/include/psdk/winsock2.h b/reactos/include/psdk/winsock2.h index 43076dd366c..ab8ccb60004 100644 --- a/reactos/include/psdk/winsock2.h +++ b/reactos/include/psdk/winsock2.h @@ -49,6 +49,8 @@ typedef UINT_PTR SOCKET; #define FD_SETSIZE 64 #endif +#define WSAAPI WINAPI + /* shutdown() how types */ #define SD_RECEIVE 0x00 #define SD_SEND 0x01 @@ -519,6 +521,47 @@ struct sockproto { #endif /* !WSABASEERR */ +#if !defined(NS_ALL) +#define NS_ALL 0 +#define NS_SAP 1 +#define NS_NDS 2 +#define NS_PEER_BROWSE 3 +#define NS_SLP 5 +#define NS_DHCP 6 +#define NS_TCPIP_LOCAL 10 +#define NS_TCPIP_HOSTS 11 +#define NS_DNS 12 +#define NS_NETBT 13 +#define NS_WINS 14 +#define NS_NLA 15 +#define NS_NBP 20 +#define NS_MS 30 +#define NS_STDA 31 +#define NS_NTDS 32 +#define NS_X500 40 +#define NS_NIS 41 +#define NS_NISPLUS 42 +#define NS_WRQ 50 +#define NS_NETDES 60 +#endif /* !defined(NS_ALL) */ + +#define LUP_DEEP 0x0001 +#define LUP_CONTAINERS 0x0002 +#define LUP_NOCONTAINERS 0x0004 +#define LUP_NEAREST 0x0008 +#define LUP_RETURN_NAME 0x0010 +#define LUP_RETURN_TYPE 0x0020 +#define LUP_RETURN_VERSION 0x0040 +#define LUP_RETURN_COMMENT 0x0080 +#define LUP_RETURN_ADDR 0x0100 +#define LUP_RETURN_BLOB 0x0200 +#define LUP_RETURN_ALIASES 0x0400 +#define LUP_RETURN_QUERY_STRING 0x0800 +#define LUP_RETURN_ALL 0x0FF0 +#define LUP_RES_SERVICE 0x8000 +#define LUP_FLUSHCACHE 0x1000 +#define LUP_FLUSHPREVIOUS 0x2000 + #define WSANO_ADDRESS WSANO_DATA #if !(defined (__INSIDE_CYGWIN__) || defined (__INSIDE_MSYS__)) #define h_errno WSAGetLastError() @@ -556,6 +599,13 @@ int PASCAL WSAStartup(WORD,LPWSADATA); int PASCAL WSACleanup(void); void PASCAL WSASetLastError(int); int PASCAL WSAGetLastError(void); +typedef int (WSAAPI *LPFN_WSAGETLASTERROR)(void); +typedef int (WSAAPI *LPFN_WSACANCELBLOCKINGCALL)(void); +typedef FARPROC (WSAAPI *LPFN_WSASETBLOCKINGHOOK)(FARPROC); +typedef int (WSAAPI *LPFN_SELECT)(int nfds,fd_set FAR*,fd_set FAR*,fd_set FAR*,const struct timeval FAR*); +typedef int (WSAAPI *LPFN_WSASTARTUP)(WORD,LPWSADATA); +typedef int (WSAAPI *LPFN_WSACLEANUP)(void); +typedef int (WSAAPI *LPFN_GETSOCKOPT)(SOCKET,int,int,char FAR*,int FAR*); /* * Pseudo-blocking functions are deprecated in WinSock2 * spec. Use threads instead. @@ -647,7 +697,6 @@ typedef struct timeval *LPTIMEVAL; #define MSG_INTERRUPT 0x10 #define MSG_MAXIOVLEN 16 -#define WSAAPI WINAPI #define WSAEVENT HANDLE #define LPWSAEVENT LPHANDLE #define WSAOVERLAPPED OVERLAPPED diff --git a/reactos/include/psdk/ws2spi.h b/reactos/include/psdk/ws2spi.h index dc317de1466..b02ba931daa 100644 --- a/reactos/include/psdk/ws2spi.h +++ b/reactos/include/psdk/ws2spi.h @@ -113,13 +113,39 @@ typedef struct _WSPPROC_TABLE { LPWSPSTRINGTOADDRESS lpWSPStringToAddress; } WSPPROC_TABLE, FAR* LPWSPPROC_TABLE; +/* Prototypes for service provider namespace procedure table */ +typedef INT (WSAAPI *LPNSPCLEANUP)(LPGUID); +typedef INT (WSAAPI *LPNSPLOOKUPSERVICEBEGIN)(LPGUID,LPWSAQUERYSETW,LPWSASERVICECLASSINFOW,DWORD,LPHANDLE); +typedef INT (WSAAPI *LPNSPLOOKUPSERVICENEXT)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW); +typedef INT (WSAAPI *LPNSPLOOKUPSERVICEEND)(HANDLE); +typedef INT (WSAAPI *LPNSPSETSERVICE)(LPGUID,LPWSASERVICECLASSINFOW,LPWSAQUERYSETW,WSAESETSERVICEOP,DWORD); +typedef INT (WSAAPI *LPNSPINSTALLSERVICECLASS)(LPGUID,LPWSASERVICECLASSINFOW); +typedef INT (WSAAPI *LPNSPREMOVESERVICECLASS)(LPGUID,LPGUID); +typedef INT (WSAAPI *LPNSPGETSERVICECLASSINFO)(LPGUID,LPDWORD,LPWSASERVICECLASSINFOW); +typedef INT (WSAAPI *LPNSPIOCTL)(HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPWSACOMPLETION,LPWSATHREADID); + +typedef struct _NSP_ROUTINE { + DWORD cbSize; + DWORD dwMajorVersion; + DWORD dwMinorVersion; + LPNSPCLEANUP NSPCleanup; + LPNSPLOOKUPSERVICEBEGIN NSPLookupServiceBegin; + LPNSPLOOKUPSERVICENEXT NSPLookupServiceNext; + LPNSPLOOKUPSERVICEEND NSPLookupServiceEnd; + LPNSPSETSERVICE NSPSetService; + LPNSPINSTALLSERVICECLASS NSPInstallServiceClass; + LPNSPREMOVESERVICECLASS NSPRemoveServiceClass; + LPNSPGETSERVICECLASSINFO NSPGetServiceClassInfo; + LPNSPIOCTL NSPIoctl; +} NSP_ROUTINE, *PNSP_ROUTINE, FAR* LPNSP_ROUTINE; + /* Prototypes for service provider upcall procedure table */ typedef BOOL (WSPAPI *LPWPUCLOSEEVENT)(WSAEVENT,LPINT); typedef INT (WSPAPI *LPWPUCLOSESOCKETHANDLE)(SOCKET,LPINT); typedef INT (WSPAPI *LPWPUCLOSETHREAD)(LPWSATHREADID,LPINT); typedef WSAEVENT (WSPAPI *LPWPUCREATEEVENT)(LPINT); typedef SOCKET (WSPAPI *LPWPUCREATESOCKETHANDLE)(DWORD,DWORD,LPINT); -typedef SOCKET (WSPAPI *LPWPUFDISSET)(SOCKET,LPFD_SET); +typedef INT (WSPAPI *LPWPUFDISSET)(SOCKET,LPFD_SET); typedef INT (WSPAPI *LPWPUGETPROVIDERPATH)(LPGUID,LPWSTR,LPINT,LPINT); typedef SOCKET (WSPAPI *LPWPUMODIFYIFSHANDLE)(DWORD,SOCKET,LPINT); typedef INT (WSPAPI *LPWPUOPENCURRENTTHREAD)(LPWSATHREADID,LPINT); @@ -129,6 +155,7 @@ typedef INT (WSPAPI *LPWPUQUERYSOCKETHANDLECONTEXT)(SOCKET,LPDWORD,LPINT); typedef INT (WSPAPI *LPWPUQUEUEAPC)(LPWSATHREADID,LPWSAUSERAPC,DWORD,LPINT); typedef BOOL (WSPAPI *LPWPURESETEVENT)(WSAEVENT,LPINT); typedef BOOL (WSPAPI *LPWPUSETEVENT)(WSAEVENT,LPINT); +typedef INT (WSAAPI *LPNSPSTARTUP)(LPGUID,LPNSP_ROUTINE); /* Available only directly from the DLL */ typedef INT (WSPAPI *LPWPUCOMPLETEOVERLAPPEDREQUEST)(SOCKET,LPWSAOVERLAPPED,DWORD,DWORD,LPINT); @@ -153,30 +180,6 @@ typedef struct _WSPUPCALLTABLE { typedef INT (WSPAPI *LPWSPSTARTUP)(WORD,LPWSPDATA,LPWSAPROTOCOL_INFOW,WSPUPCALLTABLE,LPWSPPROC_TABLE); -/* Prototypes for service provider namespace procedure table */ -typedef INT (WSPAPI *LPNSPCLEANUP)(LPGUID); -typedef INT (WSPAPI *LPNSPGETSERVICECLASSINFO)(LPGUID,LPDWORD,LPWSASERVICECLASSINFOW); -typedef INT (WSPAPI *LPNSPINSTALLSERVICECLASS)(LPGUID,LPWSASERVICECLASSINFOW); -typedef INT (WSPAPI *LPNSPLOOKUPSERVICEBEGIN)(LPGUID,LPWSAQUERYSETW,LPWSASERVICECLASSINFOW,DWORD,LPHANDLE); -typedef INT (WSPAPI *LPNSPLOOKUPSERVICEEND)(HANDLE); -typedef INT (WSPAPI *LPNSPLOOKUPSERVICENEXT)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSET); -typedef INT (WSPAPI *LPNSPREMOVESERVICECLASS)(LPGUID,LPGUID); -typedef INT (WSPAPI *LPNSPSETSERVICE)(LPGUID,LPWSASERVICECLASSINFOW,LPWSAQUERYSETW,WSAESETSERVICEOP,DWORD); - -typedef struct _NSP_ROUTINE { - DWORD cbSize; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - LPNSPCLEANUP NSPCleanup; - LPNSPLOOKUPSERVICEBEGIN NSPLookupServiceBegin; - LPNSPLOOKUPSERVICENEXT NSPLookupServiceNext; - LPNSPLOOKUPSERVICEEND NSPLookupServiceEnd; - LPNSPSETSERVICE NSPSetService; - LPNSPINSTALLSERVICECLASS NSPInstallServiceClass; - LPNSPREMOVESERVICECLASS NSPRemoveServiceClass; - LPNSPGETSERVICECLASSINFO NSPGetServiceClassInfo; -} NSP_ROUTINE, *PNSP_ROUTINE, *LPNSP_ROUTINE; - INT WSPAPI NSPStartup(LPGUID,LPNSP_ROUTINE); /* WinSock 2 DLL function prototypes */ @@ -185,11 +188,26 @@ INT WSPAPI WSPStartup(WORD,LPWSPDATA,LPWSAPROTOCOL_INFOW,WSPUPCALLTABLE,LPWSPPRO INT WSPAPI WSCDeinstallProvider(LPGUID,LPINT); INT WSPAPI WSCEnumProtocols(LPINT,LPWSAPROTOCOL_INFOW,LPDWORD,LPINT); INT WSPAPI WSCGetProviderPath(LPGUID,LPWSTR,LPINT,LPINT); -INT WSPAPI WSCInstallProvider(CONST LPGUID,CONST LPWSTR,CONST LPWSAPROTOCOL_INFOW,DWORD,LPINT); +INT WSPAPI WSCInstallProvider(LPGUID,CONST WCHAR*,CONST LPWSAPROTOCOL_INFOW,DWORD,LPINT); INT WSPAPI WSCEnableNSProvider(LPGUID,BOOL); INT WSPAPI WSCInstallNameSpace(LPWSTR,LPWSTR,DWORD,DWORD,LPGUID); INT WSPAPI WSCUnInstallNameSpace(LPGUID); INT WSPAPI WSCWriteProviderOrder(LPDWORD,DWORD); +BOOL WSPAPI WPUPostMessage(HWND,UINT,WPARAM,LPARAM); +BOOL WSPAPI WPUCloseEvent(WSAEVENT,LPINT); +int WSPAPI WPUCloseSocketHandle(SOCKET,LPINT); +WSAEVENT WSPAPI WPUCreateEvent(LPINT); +SOCKET WSPAPI WPUModifyIFSHandle(DWORD,SOCKET,LPINT); +SOCKET WSPAPI WPUCreateSocketHandle(DWORD,DWORD_PTR,LPINT); +int WSPAPI WPUFDIsSet(SOCKET,LPFD_SET); +int WSPAPI WPUGetProviderPath(LPGUID,WCHAR FAR*,LPINT,LPINT); +int WSPAPI WPUQueryBlockingCallback(DWORD,LPBLOCKINGCALLBACK FAR*,PDWORD_PTR,LPINT); +int WSPAPI WPUQuerySocketHandleContext(SOCKET,PDWORD_PTR,LPINT); +int WSPAPI WPUQueueApc(LPWSATHREADID,LPWSAUSERAPC,DWORD_PTR,LPINT); +BOOL WSPAPI WPUResetEvent(WSAEVENT,LPINT); +BOOL WSPAPI WPUSetEvent(WSAEVENT,LPINT); +int WSPAPI WPUOpenCurrentThread(LPWSATHREADID,LPINT); +int WSPAPI WPUCloseThread(LPWSATHREADID,LPINT); #endif /* RC_INVOKED */ diff --git a/reactos/include/psdk/ws2tcpip.h b/reactos/include/psdk/ws2tcpip.h index 1677b51433a..42f7e62be7a 100644 --- a/reactos/include/psdk/ws2tcpip.h +++ b/reactos/include/psdk/ws2tcpip.h @@ -155,22 +155,23 @@ struct ip_msfilter { struct in6_addr { union { - u_char _S6_u8[16]; - u_short _S6_u16[8]; + u_char Byte[16]; + u_short Word[8]; u_long _S6_u32[4]; - } _S6_un; + } u; }; + /* s6_addr is the standard name */ -#define s6_addr _S6_un._S6_u8 +#define s6_addr u.Byte /* These are GLIBC names */ -#define s6_addr16 _S6_un._S6_u16 -#define s6_addr32 _S6_un._S6_u16 +#define s6_addr16 u.Word +#define s6_addr32 u.Word /* These are used in some MS code */ #define in_addr6 in6_addr -#define _s6_bytes _S6_un._S6_u8 -#define _s6_words _S6_un._S6_u16 +#define _s6_bytes u.Byte +#define _s6_words u.Word typedef struct in6_addr IN6_ADDR, *PIN6_ADDR, *LPIN6_ADDR; @@ -275,16 +276,37 @@ struct in6_pktinfo { }; typedef struct in6_pktinfo IN6_PKTINFO; -struct addrinfo { - int ai_flags; - int ai_family; - int ai_socktype; - int ai_protocol; - size_t ai_addrlen; - char *ai_canonname; - struct sockaddr *ai_addr; - struct addrinfo *ai_next; -}; +typedef struct addrinfo +{ + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + size_t ai_addrlen; + char *ai_canonname; + struct sockaddr *ai_addr; + struct addrinfo *ai_next; +} ADDRINFOA, *PADDRINFOA; + +typedef struct addrinfoW +{ + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + size_t ai_addrlen; + PWSTR ai_canonname; + struct sockaddr *ai_addr; + struct addrinfoW *ai_next; +} ADDRINFOW, *PADDRINFOW; + +#ifdef UNICODE +typedef ADDRINFOW ADDRINFOT,*PADDRINFOT; +#else +typedef ADDRINFOA ADDRINFOT,*PADDRINFOT; +#endif + +typedef ADDRINFOA ADDRINFO, FAR *LPADDRINFO; void WSAAPI freeaddrinfo (struct addrinfo*); int WSAAPI getaddrinfo (const char*,const char*,const struct addrinfo*, @@ -335,6 +357,17 @@ gai_strerrorW(int ecode) int WSAAPI getnameinfo(const struct sockaddr*,socklen_t,char*,DWORD, char*,DWORD,int); +#if (_WIN32_WINNT >= 0x0502) +INT WSAAPI GetNameInfoW(const SOCKADDR*,socklen_t,PWCHAR,DWORD,PWCHAR,DWORD,INT); +#define GetNameInfoA getnameinfo + +#ifdef UNICODE +#define GetNameInfo GetNameInfoW +#else +#define GetNameInfo GetNameInfoA +#endif /* UNICODE */ + +#endif /* (_WIN32_WINNT >= 0x0502) */ /* Some older IPv4/IPv6 compatability stuff */