Hi, I have attached a patch for missing prototypes snf definitions for winsock2.h

First submission, feedback welcome :)

Rafael

--

        
        
From 80dcd79d14460523ac4e89773031399e4906b346 Mon Sep 17 00:00:00 2001
From: Raf Lopez <[email protected]>
Date: Fri, 3 Jun 2022 03:53:10 +0000
Subject: [PATCH] Add missing winsock2 prototypes and definitions

For socket notifications.

Signed-off-by: Rafael Lopez <[email protected]>
---
 mingw-w64-headers/include/winsock2.h | 70 ++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/mingw-w64-headers/include/winsock2.h b/mingw-w64-headers/include/winsock2.h
index d38469220..5bf9eb309 100644
--- a/mingw-w64-headers/include/winsock2.h
+++ b/mingw-w64-headers/include/winsock2.h
@@ -1258,6 +1258,76 @@ int WSAAPI WSASendMsg(
 );
 #endif /*(_WIN32_WINNT >= 0x0600)*/
 
+typedef struct SOCK_NOTIFY_REGISTRATION {
+    SOCKET socket;
+    PVOID completionKey;
+    UINT16 eventFilter;
+    UINT8 operation;
+    UINT8 triggerFlags;
+    DWORD registrationResult;
+} SOCK_NOTIFY_REGISTRATION;
+
+#define SOCK_NOTIFY_REGISTER_EVENT_NONE     0x00
+#define SOCK_NOTIFY_REGISTER_EVENT_IN       0x01
+#define SOCK_NOTIFY_REGISTER_EVENT_OUT      0x02
+#define SOCK_NOTIFY_REGISTER_EVENT_HANGUP   0x04
+
+#define SOCK_NOTIFY_REGISTER_EVENTS_ALL \
+    (SOCK_NOTIFY_REGISTER_EVENT_IN | SOCK_NOTIFY_REGISTER_EVENT_OUT | SOCK_NOTIFY_REGISTER_EVENT_HANGUP)
+
+#define SOCK_NOTIFY_EVENT_IN        SOCK_NOTIFY_REGISTER_EVENT_IN
+#define SOCK_NOTIFY_EVENT_OUT       SOCK_NOTIFY_REGISTER_EVENT_OUT
+#define SOCK_NOTIFY_EVENT_HANGUP    SOCK_NOTIFY_REGISTER_EVENT_HANGUP
+#define SOCK_NOTIFY_EVENT_ERR       0x40
+#define SOCK_NOTIFY_EVENT_REMOVE    0x80
+
+#define SOCK_NOTIFY_EVENTS_ALL \
+    (SOCK_NOTIFY_REGISTER_EVENTS_ALL | SOCK_NOTIFY_EVENT_ERR | SOCK_NOTIFY_EVENT_REMOVE)
+
+#define SOCK_NOTIFY_OP_NONE         0x00
+#define SOCK_NOTIFY_OP_ENABLE       0x01
+#define SOCK_NOTIFY_OP_DISABLE      0x02
+#define SOCK_NOTIFY_OP_REMOVE       0x04
+
+#define SOCK_NOTIFY_TRIGGER_ONESHOT    0x01
+#define SOCK_NOTIFY_TRIGGER_PERSISTENT 0x02
+#define SOCK_NOTIFY_TRIGGER_LEVEL      0x04
+#define SOCK_NOTIFY_TRIGGER_EDGE       0x08
+
+#define SOCK_NOTIFY_TRIGGER_ALL \
+    (SOCK_NOTIFY_TRIGGER_ONESHOT | SOCK_NOTIFY_TRIGGER_PERSISTENT | SOCK_NOTIFY_TRIGGER_LEVEL | SOCK_NOTIFY_TRIGGER_EDGE)
+
+#if (NTDDI_VERSION >= NTDDI_WIN10_MN)
+#if INCL_WINSOCK_API_PROTOTYPES
+WINSOCK_API_LINKAGE
+DWORD
+WSAAPI
+ProcessSocketNotifications(
+    _In_ HANDLE completionPort,
+    _In_ UINT32 registrationCount,
+    _Inout_updates_opt_(registrationCount)
+        SOCK_NOTIFY_REGISTRATION* registrationInfos,
+    _In_ UINT32 timeoutMs,
+    _In_ ULONG completionCount,
+    _Out_writes_to_opt_(completionCount, *receivedEntryCount)
+        OVERLAPPED_ENTRY* completionPortEntries,
+    _Out_opt_ UINT32* receivedEntryCount
+    );
+
+#if !defined(__midl)
+inline
+UINT32
+SocketNotificationRetrieveEvents (
+    _In_ OVERLAPPED_ENTRY* notification
+    )
+{
+    return (UINT32)notification->dwNumberOfBytesTransferred;
+}
+#endif // __midl
+
+#endif // INCL_WINSOCK_API_PROTOTYPES
+#endif // (NTDDI_VERSION >= NTDDI_WIN10_MN)
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.25.1

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to