Synchronize with trunk revision 59781.
[reactos.git] / include / psdk / ws2tcpip.h
index b4c8a04..8d8aaa7 100644 (file)
@@ -62,10 +62,10 @@ WINSOCK_API_LINKAGE
 INT
 WSAAPI
 getaddrinfo(
-  IN PCSTR pNodeName OPTIONAL,
-  IN PCSTR pServiceName OPTIONAL,
-  IN const ADDRINFOA *pHints OPTIONAL,
-  OUT PADDRINFOA *ppResult);
+  _In_opt_ PCSTR pNodeName,
+  _In_opt_ PCSTR pServiceName,
+  _In_opt_ const ADDRINFOA *pHints,
+  _Outptr_ PADDRINFOA *ppResult);
 
 #if (NTDDI_VERSION >= NTDDI_WINXPSP2) || (_WIN32_WINNT >= 0x0502)
 
@@ -73,10 +73,10 @@ WINSOCK_API_LINKAGE
 INT
 WSAAPI
 GetAddrInfoW(
-  IN PCWSTR pNodeName OPTIONAL,
-  IN PCWSTR pServiceName OPTIONAL,
-  IN const ADDRINFOW *pHints OPTIONAL,
-  OUT PADDRINFOW *ppResult);
+  _In_opt_ PCWSTR pNodeName,
+  _In_opt_ PCWSTR pServiceName,
+  _In_opt_ const ADDRINFOW *pHints,
+  _Outptr_ PADDRINFOW *ppResult);
 
 #define GetAddrInfoA getaddrinfo
 
@@ -92,17 +92,17 @@ GetAddrInfoW(
 
 typedef INT
 (WSAAPI *LPFN_GETADDRINFO)(
-  IN PCSTR pNodeName OPTIONAL,
-  IN PCSTR pServiceName OPTIONAL,
-  IN const ADDRINFOA *pHints OPTIONAL,
-  OUT PADDRINFOA *ppResult);
+  _In_opt_ PCSTR pNodeName,
+  _In_opt_ PCSTR pServiceName,
+  _In_opt_ const ADDRINFOA *pHints,
+  _Outptr_ PADDRINFOA *ppResult);
 
 typedef INT
 (WSAAPI *LPFN_GETADDRINFOW)(
-  IN PCWSTR pNodeName OPTIONAL,
-  IN PCWSTR pServiceName OPTIONAL,
-  IN const ADDRINFOW *pHints OPTIONAL,
-  OUT PADDRINFOW *ppResult);
+  _In_opt_ PCWSTR pNodeName,
+  _In_opt_ PCWSTR pServiceName,
+  _In_opt_ const ADDRINFOW *pHints,
+  _Outptr_ PADDRINFOW *ppResult);
 
 #define LPFN_GETADDRINFOA LPFN_GETADDRINFO
 
@@ -118,39 +118,39 @@ typedef INT
 
 typedef void
 (CALLBACK *LPLOOKUPSERVICE_COMPLETION_ROUTINE)(
-  IN DWORD dwError,
-  IN DWORD dwBytes,
-  IN LPWSAOVERLAPPED lpOverlapped);
+  _In_ DWORD dwError,
+  _In_ DWORD dwBytes,
+  _In_ LPWSAOVERLAPPED lpOverlapped);
 
 WINSOCK_API_LINKAGE
 INT
 WSAAPI
 GetAddrInfoExA(
-  IN PCSTR pName OPTIONAL,
-  IN PCSTR pServiceName OPTIONAL,
-  IN DWORD dwNameSpace,
-  IN LPGUID lpNspId OPTIONAL,
-  IN const ADDRINFOEXA *hints,
-  OUT PADDRINFOEXA *ppResult,
-  IN struct timeval *timeout OPTIONAL,
-  IN LPOVERLAPPED lpOverlapped OPTIONAL,
-  IN LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
-  OUT LPHANDLE lpNameHandle OPTIONAL);
+  _In_opt_ PCSTR pName,
+  _In_opt_ PCSTR pServiceName,
+  _In_ DWORD dwNameSpace,
+  _In_opt_ LPGUID lpNspId,
+  _In_opt_ const ADDRINFOEXA *hints,
+  _Outptr_ PADDRINFOEXA *ppResult,
+  _In_opt_ struct timeval *timeout,
+  _In_opt_ LPOVERLAPPED lpOverlapped,
+  _In_opt_ LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
+  _Out_opt_ LPHANDLE lpNameHandle);
 
 WINSOCK_API_LINKAGE
 INT
 WSAAPI
 GetAddrInfoExW(
-  IN PCWSTR pName OPTIONAL,
-  IN PCWSTR pServiceName OPTIONAL,
-  IN DWORD dwNameSpace,
-  IN LPGUID lpNspId OPTIONAL,
-  IN const ADDRINFOEXW *hints OPTIONAL,
-  OUT PADDRINFOEXW *ppResult,
-  IN struct timeval *timeout OPTIONAL,
-  IN LPOVERLAPPED lpOverlapped OPTIONAL,
-  IN LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
-  OUT LPHANDLE lpHandle OPTIONAL);
+  _In_opt_ PCWSTR pName,
+  _In_opt_ PCWSTR pServiceName,
+  _In_ DWORD dwNameSpace,
+  _In_opt_ LPGUID lpNspId,
+  _In_opt_ const ADDRINFOEXW *hints,
+  _Outptr_ PADDRINFOEXW *ppResult,
+  _In_opt_ struct timeval *timeout,
+  _In_opt_ LPOVERLAPPED lpOverlapped,
+  _In_opt_ LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
+  _Out_opt_ LPHANDLE lpHandle);
 
 #ifdef UNICODE
 #define GetAddrInfoEx GetAddrInfoExW
@@ -162,29 +162,29 @@ GetAddrInfoExW(
 
 typedef INT
 (WSAAPI *LPFN_GETADDRINFOEXA)(
-  IN PCSTR pName,
-  IN PCSTR pServiceName OPTIONAL,
-  IN DWORD dwNameSpace,
-  IN LPGUID lpNspId OPTIONAL,
-  IN const ADDRINFOEXA *hints OPTIONAL,
-  OUT PADDRINFOEXA *ppResult,
-  IN struct timeval *timeout OPTIONAL,
-  IN LPOVERLAPPED lpOverlapped OPTIONAL,
-  IN LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
-  OUT LPHANDLE lpNameHandle OPTIONAL);
+  _In_ PCSTR pName,
+  _In_opt_ PCSTR pServiceName,
+  _In_ DWORD dwNameSpace,
+  _In_opt_ LPGUID lpNspId,
+  _In_opt_ const ADDRINFOEXA *hints,
+  _Outptr_ PADDRINFOEXA *ppResult,
+  _In_opt_ struct timeval *timeout,
+  _In_opt_ LPOVERLAPPED lpOverlapped,
+  _In_opt_ LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
+  _Out_opt_ LPHANDLE lpNameHandle);
 
 typedef INT
 (WSAAPI *LPFN_GETADDRINFOEXW)(
-  IN PCWSTR pName,
-  IN PCWSTR pServiceName OPTIONAL,
-  IN DWORD dwNameSpace,
-  IN LPGUID lpNspId OPTIONAL,
-  IN const ADDRINFOEXW *hints OPTIONAL,
-  OUT PADDRINFOEXW *ppResult,
-  IN struct timeval *timeout OPTIONAL,
-  IN LPOVERLAPPED lpOverlapped OPTIONAL,
-  IN LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
-  OUT LPHANDLE lpHandle OPTIONAL);
+  _In_ PCWSTR pName,
+  _In_opt_ PCWSTR pServiceName,
+  _In_ DWORD dwNameSpace,
+  _In_opt_ LPGUID lpNspId,
+  _In_opt_ const ADDRINFOEXW *hints,
+  _Outptr_ PADDRINFOEXW *ppResult,
+  _In_opt_ struct timeval *timeout,
+  _In_opt_ LPOVERLAPPED lpOverlapped,
+  _In_opt_ LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
+  _Out_opt_ LPHANDLE lpHandle);
 
 #ifdef UNICODE
 #define LPFN_GETADDRINFOEX LPFN_GETADDRINFOEXW
@@ -201,35 +201,35 @@ WINSOCK_API_LINKAGE
 INT
 WSAAPI
 SetAddrInfoExA(
-  IN PCSTR pName,
-  IN PCSTR pServiceName OPTIONAL,
-  IN SOCKET_ADDRESS *pAddresses OPTIONAL,
-  IN DWORD dwAddressCount,
-  IN LPBLOB lpBlob OPTIONAL,
-  IN DWORD dwFlags,
-  IN DWORD dwNameSpace,
-  IN LPGUID lpNspId OPTIONAL,
-  IN struct timeval *timeout OPTIONAL,
-  IN LPOVERLAPPED lpOverlapped OPTIONAL,
-  IN LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
-  OUT LPHANDLE lpNameHandle OPTIONAL);
+  _In_ PCSTR pName,
+  _In_opt_ PCSTR pServiceName,
+  _In_opt_ SOCKET_ADDRESS *pAddresses,
+  _In_ DWORD dwAddressCount,
+  _In_opt_ LPBLOB lpBlob,
+  _In_ DWORD dwFlags,
+  _In_ DWORD dwNameSpace,
+  _In_opt_ LPGUID lpNspId,
+  _In_opt_ struct timeval *timeout,
+  _In_opt_ LPOVERLAPPED lpOverlapped,
+  _In_opt_ LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
+  _Out_opt_ LPHANDLE lpNameHandle);
 
 WINSOCK_API_LINKAGE
 INT
 WSAAPI
 SetAddrInfoExW(
-  IN PCWSTR pName,
-  IN PCWSTR pServiceName OPTIONAL,
-  IN SOCKET_ADDRESS *pAddresses OPTIONAL,
-  IN DWORD dwAddressCount,
-  IN LPBLOB lpBlob OPTIONAL,
-  IN DWORD dwFlags,
-  IN DWORD dwNameSpace,
-  IN LPGUID lpNspId OPTIONAL,
-  IN struct timeval *timeout OPTIONAL,
-  IN LPOVERLAPPED lpOverlapped OPTIONAL,
-  IN LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
-  OUT LPHANDLE lpNameHandle OPTIONAL);
+  _In_ PCWSTR pName,
+  _In_opt_ PCWSTR pServiceName,
+  _In_opt_ SOCKET_ADDRESS *pAddresses,
+  _In_ DWORD dwAddressCount,
+  _In_opt_ LPBLOB lpBlob,
+  _In_ DWORD dwFlags,
+  _In_ DWORD dwNameSpace,
+  _In_opt_ LPGUID lpNspId,
+  _In_opt_ struct timeval *timeout,
+  _In_opt_ LPOVERLAPPED lpOverlapped,
+  _In_opt_ LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
+  _Out_opt_ LPHANDLE lpNameHandle);
 
 #ifdef UNICODE
 #define SetAddrInfoEx SetAddrInfoExW
@@ -241,33 +241,33 @@ SetAddrInfoExW(
 
 typedef INT
 (WSAAPI *LPFN_SETADDRINFOEXA)(
-  IN PCSTR pName,
-  IN PCSTR pServiceName OPTIONAL,
-  IN SOCKET_ADDRESS *pAddresses OPTIONAL,
-  IN DWORD dwAddressCount,
-  IN LPBLOB lpBlob OPTIONAL,
-  IN DWORD dwFlags,
-  IN DWORD dwNameSpace,
-  IN LPGUID lpNspId OPTIONAL,
-  IN struct timeval *timeout OPTIONAL,
-  IN LPOVERLAPPED lpOverlapped OPTIONAL,
-  IN LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
-  OUT LPHANDLE lpNameHandle OPTIONAL);
+  _In_ PCSTR pName,
+  _In_opt_ PCSTR pServiceName,
+  _In_opt_ SOCKET_ADDRESS *pAddresses,
+  _In_ DWORD dwAddressCount,
+  _In_opt_ LPBLOB lpBlob,
+  _In_ DWORD dwFlags,
+  _In_ DWORD dwNameSpace,
+  _In_opt_ LPGUID lpNspId,
+  _In_opt_ struct timeval *timeout,
+  _In_opt_ LPOVERLAPPED lpOverlapped,
+  _In_opt_ LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
+  _Out_opt_ LPHANDLE lpNameHandle);
 
 typedef INT
 (WSAAPI *LPFN_SETADDRINFOEXW)(
-  IN PCWSTR pName,
-  IN PCWSTR pServiceName OPTIONAL,
-  IN SOCKET_ADDRESS *pAddresses OPTIONAL,
-  IN DWORD dwAddressCount,
-  IN LPBLOB lpBlob OPTIONAL,
-  IN DWORD dwFlags,
-  IN DWORD dwNameSpace,
-  IN LPGUID lpNspId OPTIONAL,
-  IN struct timeval *timeout OPTIONAL,
-  IN LPOVERLAPPED lpOverlapped OPTIONAL,
-  IN LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL,
-  OUT LPHANDLE lpNameHandle OPTIONAL);
+  _In_ PCWSTR pName,
+  _In_opt_ PCWSTR pServiceName,
+  _In_opt_ SOCKET_ADDRESS *pAddresses,
+  _In_ DWORD dwAddressCount,
+  _In_opt_ LPBLOB lpBlob,
+  _In_ DWORD dwFlags,
+  _In_ DWORD dwNameSpace,
+  _In_opt_ LPGUID lpNspId,
+  _In_opt_ struct timeval *timeout,
+  _In_opt_ LPOVERLAPPED lpOverlapped,
+  _In_opt_ LPLOOKUPSERVICE_COMPLETION_ROUTINE lpCompletionRoutine,
+  _Out_opt_ LPHANDLE lpNameHandle);
 
 #ifdef UNICODE
 #define LPFN_SETADDRINFOEX LPFN_SETADDRINFOEXW
@@ -282,7 +282,7 @@ WINSOCK_API_LINKAGE
 VOID
 WSAAPI
 freeaddrinfo(
-  IN PADDRINFOA pAddrInfo OPTIONAL);
+  _In_opt_ PADDRINFOA pAddrInfo);
 
 #if (NTDDI_VERSION >= NTDDI_WINXPSP2) || (_WIN32_WINNT >= 0x0502)
 
@@ -290,7 +290,7 @@ WINSOCK_API_LINKAGE
 VOID
 WSAAPI
 FreeAddrInfoW(
-  IN PADDRINFOW pAddrInfo OPTIONAL);
+  _In_opt_ PADDRINFOW pAddrInfo);
 
 #define FreeAddrInfoA freeaddrinfo
 
@@ -305,11 +305,11 @@ FreeAddrInfoW(
 
 typedef VOID
 (WSAAPI *LPFN_FREEADDRINFO)(
-  IN PADDRINFOA pAddrInfo OPTIONAL);
+  _In_opt_ PADDRINFOA pAddrInfo);
 
 typedef VOID
 (WSAAPI *LPFN_FREEADDRINFOW)(
-  IN PADDRINFOW pAddrInfo OPTIONAL);
+  _In_opt_ PADDRINFOW pAddrInfo);
 
 #define LPFN_FREEADDRINFOA LPFN_FREEADDRINFO
 
@@ -327,13 +327,13 @@ WINSOCK_API_LINKAGE
 void
 WSAAPI
 FreeAddrInfoEx(
-  IN PADDRINFOEXA pAddrInfoEx OPTIONAL);
+  _In_opt_ PADDRINFOEXA pAddrInfoEx);
 
 WINSOCK_API_LINKAGE
 void
 WSAAPI
 FreeAddrInfoExW(
-  IN PADDRINFOEXW pAddrInfoEx OPTIONAL);
+  _In_opt_ PADDRINFOEXW pAddrInfoEx);
 
 #define FreeAddrInfoExA FreeAddrInfoEx
 
@@ -345,11 +345,11 @@ FreeAddrInfoExW(
 
 typedef void
 (WSAAPI *LPFN_FREEADDRINFOEXA)(
-  IN PADDRINFOEXA pAddrInfoEx);
+  _In_ PADDRINFOEXA pAddrInfoEx);
 
 typedef void
 (WSAAPI *LPFN_FREEADDRINFOEXW)(
-  IN PADDRINFOEXW pAddrInfoEx);
+  _In_ PADDRINFOEXW pAddrInfoEx);
 
 
 #ifdef UNICODE
@@ -367,13 +367,13 @@ WINSOCK_API_LINKAGE
 INT
 WSAAPI
 getnameinfo(
-  IN const SOCKADDR *pSockaddr,
-  IN socklen_t SockaddrLength,
-  OUT PCHAR pNodeBuffer OPTIONAL,
-  IN DWORD NodeBufferSize,
-  OUT PCHAR pServiceBuffer,
-  IN DWORD ServiceBufferSize,
-  IN INT Flags);
+  _In_reads_bytes_(SockaddrLength) const SOCKADDR *pSockaddr,
+  _In_ socklen_t SockaddrLength,
+  _Out_writes_opt_(NodeBufferSize) PCHAR pNodeBuffer,
+  _In_ DWORD NodeBufferSize,
+  _Out_writes_opt_(ServiceBufferSize) PCHAR pServiceBuffer,
+  _In_ DWORD ServiceBufferSize,
+  _In_ INT Flags);
 
 #if (NTDDI_VERSION >= NTDDI_WINXPSP2) || (_WIN32_WINNT >= 0x0502)
 
@@ -381,13 +381,13 @@ WINSOCK_API_LINKAGE
 INT
 WSAAPI
 GetNameInfoW(
-  IN const SOCKADDR *pSockaddr,
-  IN socklen_t SockaddrLength,
-  OUT PWCHAR pNodeBuffer,
-  IN DWORD NodeBufferSize,
-  OUT PWCHAR pServiceBuffer OPTIONAL,
-  IN DWORD ServiceBufferSize,
-  IN INT Flags);
+  _In_reads_bytes_(SockaddrLength) const SOCKADDR *pSockaddr,
+  _In_ socklen_t SockaddrLength,
+  _Out_writes_opt_(NodeBufferSize) PWCHAR pNodeBuffer,
+  _In_ DWORD NodeBufferSize,
+  _Out_writes_opt_(ServiceBufferSize) PWCHAR pServiceBuffer,
+  _In_ DWORD ServiceBufferSize,
+  _In_ INT Flags);
 
 #define GetNameInfoA getnameinfo
 
@@ -403,23 +403,23 @@ GetNameInfoW(
 
 typedef int
 (WSAAPI *LPFN_GETNAMEINFO)(
-  IN const SOCKADDR *pSockaddr,
-  IN socklen_t SockaddrLength,
-  OUT PCHAR pNodeBuffer,
-  IN DWORD NodeBufferSize,
-  OUT PCHAR pServiceBuffer OPTIONAL,
-  IN DWORD ServiceBufferSize,
-  IN INT Flags);
+  _In_reads_bytes_(SockaddrLength) const SOCKADDR *pSockaddr,
+  _In_ socklen_t SockaddrLength,
+  _Out_writes_opt_(NodeBufferSize) PCHAR pNodeBuffer,
+  _In_ DWORD NodeBufferSize,
+  _Out_writes_opt_(ServiceBufferSize) PCHAR pServiceBuffer,
+  _In_ DWORD ServiceBufferSize,
+  _In_ INT Flags);
 
 typedef INT
 (WSAAPI *LPFN_GETNAMEINFOW)(
-  IN const SOCKADDR *pSockaddr,
-  IN socklen_t SockaddrLength,
-  OUT PWCHAR pNodeBuffer,
-  IN DWORD NodeBufferSize,
-  OUT PWCHAR pServiceBuffer OPTIONAL,
-  IN DWORD ServiceBufferSize,
-  IN INT Flags);
+  _In_reads_bytes_(SockaddrLength) const SOCKADDR *pSockaddr,
+  _In_ socklen_t SockaddrLength,
+  _Out_writes_opt_(NodeBufferSize) PWCHAR pNodeBuffer,
+  _In_ DWORD NodeBufferSize,
+  _Out_writes_opt_(ServiceBufferSize) PWCHAR pServiceBuffer,
+  _In_ DWORD ServiceBufferSize,
+  _In_ INT Flags);
 
 #define LPFN_GETNAMEINFOA LPFN_GETNAMEINFO
 
@@ -436,32 +436,32 @@ WINSOCK_API_LINKAGE
 INT
 WSAAPI
 inet_pton(
-  IN INT Family,
-  IN PCSTR pszAddrString,
-  OUT PVOID pAddrBuf);
+  _In_ INT Family,
+  _In_ PCSTR pszAddrString,
+  _Out_writes_bytes_(sizeof(IN6_ADDR)) PVOID pAddrBuf);
 
 INT
 WSAAPI
 InetPtonW(
-  IN INT Family,
-  IN PCWSTR pszAddrString,
-  OUT PVOID pAddrBuf);
+  _In_ INT Family,
+  _In_ PCWSTR pszAddrString,
+  _Out_writes_bytes_(sizeof(IN6_ADDR)) PVOID pAddrBuf);
 
 PCSTR
 WSAAPI
 inet_ntop(
-  IN INT Family,
-  IN PVOID pAddr,
-  OUT PSTR pStringBuf,
-  IN size_t StringBufSize);
+  _In_ INT Family,
+  _In_ PVOID pAddr,
+  _Out_writes_(StringBufSize) PSTR pStringBuf,
+  _In_ size_t StringBufSize);
 
 PCWSTR
 WSAAPI
 InetNtopW(
-  IN INT Family,
-  IN PVOID pAddr,
-  OUT PWSTR pStringBuf,
-  IN size_t StringBufSize);
+  _In_ INT Family,
+  _In_ PVOID pAddr,
+  _Out_writes_(StringBufSize) PWSTR pStringBuf,
+  _In_ size_t StringBufSize);
 
 #define InetPtonA inet_pton
 #define InetNtopA inet_ntop
@@ -478,29 +478,29 @@ InetNtopW(
 
 typedef INT
 (WSAAPI *LPFN_INET_PTONA)(
-  IN INT Family,
-  IN PCSTR pszAddrString,
-  OUT PVOID pAddrBuf);
+  _In_ INT Family,
+  _In_ PCSTR pszAddrString,
+  _Out_writes_bytes_(sizeof(IN6_ADDR)) PVOID pAddrBuf);
 
 typedef INT
 (WSAAPI *LPFN_INET_PTONW)(
-  IN INT Family,
-  IN PCWSTR pszAddrString,
-  OUT PVOID pAddrBuf);
+  _In_ INT Family,
+  _In_ PCWSTR pszAddrString,
+  _Out_writes_bytes_(sizeof(IN6_ADDR)) PVOID pAddrBuf);
 
 typedef PCSTR
 (WSAAPI *LPFN_INET_NTOPA)(
-  IN INT Family,
-  IN PVOID pAddr,
-  OUT PSTR pStringBuf,
-  IN size_t StringBufSize);
+  _In_ INT Family,
+  _In_ PVOID pAddr,
+  _Out_writes_(StringBufSize) PSTR pStringBuf,
+  _In_ size_t StringBufSize);
 
 typedef PCWSTR
 (WSAAPI *LPFN_INET_NTOPW)(
-  IN INT Family,
-  IN PVOID pAddr,
-  OUT PWSTR pStringBuf,
-  IN size_t StringBufSize);
+  _In_ INT Family,
+  _In_ PVOID pAddr,
+  _Out_writes_(StringBufSize) PWSTR pStringBuf,
+  _In_ size_t StringBufSize);
 
 #ifdef UNICODE
 #define LPFN_INET_PTON LPFN_INET_PTONW
@@ -526,7 +526,7 @@ typedef PCWSTR
 static __inline
 char *
 gai_strerrorA(
-  IN int ecode)
+  _In_ int ecode)
 {
   static char buff[GAI_STRERROR_BUFFER_SIZE + 1];
 
@@ -546,7 +546,7 @@ gai_strerrorA(
 static __inline
 WCHAR *
 gai_strerrorW(
-  IN int ecode)
+  _In_ int ecode)
 {
   static WCHAR buff[GAI_STRERROR_BUFFER_SIZE + 1];
 
@@ -568,12 +568,12 @@ gai_strerrorW(
 WS2TCPIP_INLINE
 int
 setipv4sourcefilter(
-  IN SOCKET Socket,
-  IN IN_ADDR Interface,
-  IN IN_ADDR Group,
-  IN MULTICAST_MODE_TYPE FilterMode,
-  IN ULONG SourceCount,
-  IN CONST IN_ADDR *SourceList)
+  _In_ SOCKET Socket,
+  _In_ IN_ADDR Interface,
+  _In_ IN_ADDR Group,
+  _In_ MULTICAST_MODE_TYPE FilterMode,
+  _In_ ULONG SourceCount,
+  _In_reads_(SourceCount) CONST IN_ADDR *SourceList)
 {
   int Error;
   DWORD Size, Returned;
@@ -609,15 +609,16 @@ setipv4sourcefilter(
   return Error;
 }
 
+_Success_(return == 0)
 WS2TCPIP_INLINE
 int
 getipv4sourcefilter(
-  IN SOCKET Socket,
-  IN IN_ADDR Interface,
-  IN IN_ADDR Group,
-  OUT MULTICAST_MODE_TYPE *FilterMode,
-  IN OUT ULONG *SourceCount,
-  OUT IN_ADDR *SourceList)
+  _In_ SOCKET Socket,
+  _In_ IN_ADDR Interface,
+  _In_ IN_ADDR Group,
+  _Out_ MULTICAST_MODE_TYPE *FilterMode,
+  _Inout_ ULONG *SourceCount,
+  _Out_writes_(*SourceCount) IN_ADDR *SourceList)
 {
   int Error;
   DWORD Size, Returned;
@@ -662,13 +663,13 @@ getipv4sourcefilter(
 WS2TCPIP_INLINE
 int
 setsourcefilter(
-  IN SOCKET Socket,
-  IN ULONG Interface,
-  IN CONST SOCKADDR *Group,
-  IN int GroupLength,
-  IN MULTICAST_MODE_TYPE FilterMode,
-  IN ULONG SourceCount,
-  IN CONST SOCKADDR_STORAGE *SourceList)
+  _In_ SOCKET Socket,
+  _In_ ULONG Interface,
+  _In_ CONST SOCKADDR *Group,
+  _In_ int GroupLength,
+  _In_ MULTICAST_MODE_TYPE FilterMode,
+  _In_ ULONG SourceCount,
+  _In_reads_(SourceCount) CONST SOCKADDR_STORAGE *SourceList)
 {
   int Error;
   DWORD Size, Returned;
@@ -701,16 +702,17 @@ setsourcefilter(
   return Error;
 }
 
+_Success_(return == 0)
 WS2TCPIP_INLINE
 int
 getsourcefilter(
-  IN SOCKET Socket,
-  IN ULONG Interface,
-  IN CONST SOCKADDR *Group,
-  IN int GroupLength,
-  OUT MULTICAST_MODE_TYPE *FilterMode,
-  IN OUT ULONG *SourceCount,
-  OUT SOCKADDR_STORAGE *SourceList)
+  _In_ SOCKET Socket,
+  _In_ ULONG Interface,
+  _In_ CONST SOCKADDR *Group,
+  _In_ int GroupLength,
+  _Out_ MULTICAST_MODE_TYPE *FilterMode,
+  _Inout_ ULONG *SourceCount,
+  _Out_writes_(*SourceCount) SOCKADDR_STORAGE *SourceList)
 {
   int Error;
   DWORD Size, Returned;
@@ -753,8 +755,8 @@ getsourcefilter(
 WS2TCPIP_INLINE
 int
 idealsendbacklogquery(
-  IN SOCKET s,
-  OUT ULONG *pISB)
+  _In_ SOCKET s,
+  _Out_ ULONG *pISB)
 {
   DWORD bytes;
 
@@ -765,9 +767,9 @@ idealsendbacklogquery(
 WS2TCPIP_INLINE
 int
 idealsendbacklognotify(
-  IN SOCKET s,
-  IN LPWSAOVERLAPPED lpOverlapped OPTIONAL,
-  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine OPTIONAL)
+  _In_ SOCKET s,
+  _In_opt_ LPWSAOVERLAPPED lpOverlapped,
+  _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
 {
   DWORD bytes;
 
@@ -786,51 +788,51 @@ WINSOCK_API_LINKAGE
 INT
 WSAAPI
 WSASetSocketSecurity(
-  IN SOCKET Socket,
-  IN const SOCKET_SECURITY_SETTINGS *SecuritySettings OPTIONAL,
-  IN ULONG SecuritySettingsLen,
-  IN LPWSAOVERLAPPED Overlapped OPTIONAL,
-  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine OPTIONAL);
+  _In_ SOCKET Socket,
+  _In_reads_bytes_opt_(SecuritySettingsLen) const SOCKET_SECURITY_SETTINGS *SecuritySettings,
+  _In_ ULONG SecuritySettingsLen,
+  _In_opt_ LPWSAOVERLAPPED Overlapped,
+  _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine);
 
 WINSOCK_API_LINKAGE
 INT
 WSAAPI
 WSAQuerySocketSecurity(
-  IN SOCKET Socket,
-  IN const SOCKET_SECURITY_QUERY_TEMPLATE *SecurityQueryTemplate OPTIONAL,
-  IN ULONG SecurityQueryTemplateLen,
-  OUT SOCKET_SECURITY_QUERY_INFO* SecurityQueryInfo OPTIONAL,
-  IN OUT ULONG *SecurityQueryInfoLen,
-  IN LPWSAOVERLAPPED Overlapped OPTIONAL,
-  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine OPTIONAL);
+  _In_ SOCKET Socket,
+  _In_reads_bytes_opt_(SecurityQueryTemplateLen) const SOCKET_SECURITY_QUERY_TEMPLATE *SecurityQueryTemplate,
+  _In_ ULONG SecurityQueryTemplateLen,
+  _Out_writes_bytes_to_opt_(*SecurityQueryInfoLen, *SecurityQueryInfoLen) SOCKET_SECURITY_QUERY_INFO* SecurityQueryInfo,
+  _Inout_ ULONG *SecurityQueryInfoLen,
+  _In_opt_ LPWSAOVERLAPPED Overlapped,
+  _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine);
 
 WINSOCK_API_LINKAGE
 INT
 WSAAPI
 WSASetSocketPeerTargetName(
-  IN SOCKET Socket,
-  IN const SOCKET_PEER_TARGET_NAME *PeerTargetName,
-  IN ULONG PeerTargetNameLen,
-  IN LPWSAOVERLAPPED Overlapped OPTIONAL,
-  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine OPTIONAL);
+  _In_ SOCKET Socket,
+  _In_reads_bytes_(PeerTargetNameLen) const SOCKET_PEER_TARGET_NAME *PeerTargetName,
+  _In_ ULONG PeerTargetNameLen,
+  _In_opt_ LPWSAOVERLAPPED Overlapped,
+  _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine);
 
 WINSOCK_API_LINKAGE
 INT
 WSAAPI
 WSADeleteSocketPeerTargetName(
-  IN SOCKET Socket,
-  IN const struct sockaddr *PeerAddr,
-  IN ULONG PeerAddrLen,
-  IN LPWSAOVERLAPPED Overlapped OPTIONAL,
-  IN LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine OPTIONAL);
+  _In_ SOCKET Socket,
+  _In_reads_bytes_(PeerAddrLen) const struct sockaddr *PeerAddr,
+  _In_ ULONG PeerAddrLen,
+  _In_opt_ LPWSAOVERLAPPED Overlapped,
+  _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE CompletionRoutine);
 
 WINSOCK_API_LINKAGE
 INT
 WSAAPI
 WSAImpersonateSocketPeer(
-  IN SOCKET Socket,
-  IN const struct sockaddr *PeerAddr OPTIONAL,
-  IN ULONG PeerAddrLen);
+  _In_ SOCKET Socket,
+  _In_reads_bytes_opt_(PeerAddrLen) const struct sockaddr *PeerAddr,
+  _In_ ULONG PeerAddrLen);
 
 WINSOCK_API_LINKAGE
 INT