| 83 | #define IsConsoleHandle(h) (((long) (intptr_t) (h) & 3) == 3) |
| 84 | |
| 85 | static BOOL |
| 86 | IsSocketHandle (HANDLE h) |
| 87 | { |
| 88 | WSANETWORKEVENTS ev; |
| 89 | |
| 90 | if (IsConsoleHandle (h)) |
| 91 | return FALSE; |
| 92 | |
| 93 | /* Under Wine, it seems that getsockopt returns 0 for pipes too. |
| 94 | WSAEnumNetworkEvents instead distinguishes the two correctly. */ |
| 95 | ev.lNetworkEvents = 0xDEADBEEF; |
| 96 | WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev); |
| 97 | return ev.lNetworkEvents != 0xDEADBEEF; |
| 98 | } |
| 99 | |
| 100 | /* Declare data structures for ntdll functions. */ |
| 101 | typedef struct _FILE_PIPE_LOCAL_INFORMATION { |