Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-19045

kernel32.dll DuplicateHandle function fails to duplicate sockets

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • RosDlls
    • None

    Description

      In Windows 2003 through Win10 sockets can be duplicated between arbitrary processes as long as socket handle 'value' is passed to the target process via some IPC method. This socket duplication method does not work in ReactOS. I have tested on multiple recent development builds as well as Windows server 2003 and Windows 10. (detected while porting samba 4 smbd file share server, which relies on this method to handle incoming client connections).

      DuplicateHandle returns success and does copy the NT ObjectHandle, but the lack of the necessary winsock structures in the target process causes the handle to return WSAENOTSOCK errors when it is used. WSADuplicateSocket cannot be used in this case because the socket duplication takes place from the target process rather than the process owning the original socket and WSADuplicateSocket also fails returning WSAENOTSOCK during its early parameter validation.

      I have attached a test application set for this (source and binary), as well as images showing test working on W2K3 and failing on a recent dev build.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bugdude bugdude
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: