Thanks Liu, i have modified the patch and attached new one.


On 3/6/22 17:21, LIU Hao wrote:
在 2022-06-03 12:23, Rafael Lopez 写道:
Hi, I have attached a patch for missing prototypes snf definitions for winsock2.h

First submission, feedback welcome :)



Thank you for the patch. However there are indeed some issues:

1. Please use C89 comments instead of C++ comments.
2. Please keep function declarations in a single line, and remove those `_In_`,
   `_Out_` annotation. This is because GCC used to only print a single in
   diagnostic messages.
3. `inline` should be replaced with `static FORCEINLINE`, as it is unavailable
   in C89.





--
SoftIron        
        

*Rafael Lopez*

Senior Systems Engineer  | SoftIron

+1 (650) 305 7387 <tel:+1(650)3057387>

[email protected] <mailto:[email protected]>
From 04bb78e58382e6b5189ed376c2e7cc841cf6de0a 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 | 47 ++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/mingw-w64-headers/include/winsock2.h b/mingw-w64-headers/include/winsock2.h
index d38469220..930616e4e 100644
--- a/mingw-w64-headers/include/winsock2.h
+++ b/mingw-w64-headers/include/winsock2.h
@@ -1258,6 +1258,53 @@ 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(HANDLE completionPort, UINT32 registrationCount, SOCK_NOTIFY_REGISTRATION* registrationInfos, UINT32 timeoutMs, ULONG completionCount, OVERLAPPED_ENTRY* completionPortEntries, UINT32* receivedEntryCount);
+
+#if !defined(__midl)
+  static FORCEINLINE UINT32 SocketNotificationRetrieveEvents(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