https://bugs.winehq.org/show_bug.cgi?id=54413
--- Comment #3 from Zeb Figura z.figura12@gmail.com --- Socket handles *are* NT handles, which is why you can duplicate them. The way it actually (seems to) work is that they have some in-process data as well. I'm not sure what this in-process data comprises—we don't store any—but it may simply have to do with layered service providers (which we don't implement).
Hence if you just create an NT socket handle in a target process, ws2_32 won't know about it, and will conclude it's not a socket when trying to look it up. In order to tell ws2_32 about it you're supposed to use WSADuplicateSocket() instead of DuplicateHandle() and then import it on the other end with WSASocket(). (Internally WSADuplicateSocket() seems to just call DuplicateHandle() and stash the socket handle in the returned struct.)
Which all makes this test failure very confusing—how did ws2_32 find out about this socket?