VirtualBox

Changeset 1668 in vbox


Ignore:
Timestamp:
Mar 23, 2007 11:59:59 AM (18 years ago)
Author:
vboxsync
Message:

Use overlapped option for ConnectNamedPipe too.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp

    r1665 r1668  
    316316#ifdef __WIN__
    317317    RTFILE          NamedPipe = pData->NamedPipe;
     318    HANDLE          hEvent = CreateEvent(NULL, FALSE, FALSE, 0);
    318319#endif
    319320
     
    321322    {
    322323#ifdef __WIN__
    323         BOOL fConnected = ConnectNamedPipe((HANDLE)NamedPipe, NULL);
     324        OVERLAPPED overlapped;
     325
     326        memset(&overlapped, 0, sizeof(overlapped));
     327        overlapped.hEvent = hEvent;
     328
     329        BOOL fConnected = ConnectNamedPipe((HANDLE)NamedPipe, &overlapped);
    324330        if (!fConnected)
    325331        {
    326             int hrc = GetLastError();
     332            DWORD hrc = GetLastError();
     333
     334            if (hrc == ERROR_IO_PENDING)
     335            {
     336                hrc = 0;
     337                if (GetOverlappedResult((HANDLE)pData->NamedPipe, &overlapped, NULL, TRUE) == FALSE)
     338                    hrc = GetLastError();
     339
     340            }
    327341            if (hrc != ERROR_PIPE_CONNECTED)
    328342            {
     
    359373    }
    360374
     375#ifdef __WIN__
     376    CloseHandle(hEvent);
     377#endif
    361378    return VINF_SUCCESS;
    362379}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy