VirtualBox

Ignore:
Timestamp:
Sep 24, 2015 2:40:39 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
102848
Message:

Serial/NamedPipe: Reorder error checks in the receive code path on Windows. Looks like Kaspersky AV changes the behavior of the named pipe API when hooking into it, always returning ERROR_IO_PENDING on an overlapped read even if no other process connected to the named pipe yet. ERROR_PIPE_LISTENING is returned as the overlapped result making our error checks trip and aborting the receive thread. The fix moves the check for ERROR_IO_PENDING to the front so it executed first and the check for other non fatal errors is done afterwards

File:
1 edited

Legend:

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

    r57358 r57882  
    116116            DWORD uError = GetLastError();
    117117
     118            if (uError == ERROR_IO_PENDING)
     119            {
     120                uError = 0;
     121
     122                /* Wait for incoming bytes. */
     123                if (GetOverlappedResult(pThis->NamedPipe, &pThis->OverlappedRead, &cbReallyRead, TRUE) == FALSE)
     124                    uError = GetLastError();
     125            }
     126
    118127            if (   uError == ERROR_PIPE_LISTENING
    119128                || uError == ERROR_PIPE_NOT_CONNECTED)
     
    127136            else
    128137            {
    129                 if (uError == ERROR_IO_PENDING)
    130                 {
    131                     uError = 0;
    132 
    133                     /* Wait for incoming bytes. */
    134                     if (GetOverlappedResult(pThis->NamedPipe, &pThis->OverlappedRead, &cbReallyRead, TRUE) == FALSE)
    135                         uError = GetLastError();
    136                 }
    137 
    138138                rc = RTErrConvertFromWin32(uError);
    139139                Log(("drvNamedPipeRead: ReadFile returned %d (%Rrc)\n", uError, rc));
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette