VirtualBox

Changeset 98618 in vbox for trunk/src/VBox/Runtime/r3/win


Ignore:
Timestamp:
Feb 17, 2023 12:40:37 PM (2 years ago)
Author:
vboxsync
Message:

IPRT/pipe-win.cpp: Deal correctly with partial overlapping writes (shouldn't happen).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/win/pipe-win.cpp

    r98103 r98618  
    326326
    327327                /* resubmit the remainder of the buffer - can this actually happen? */
    328                 memmove(&pThis->pbBounceBuf[0], &pThis->pbBounceBuf[cbWritten], pThis->cbBounceBufUsed - cbWritten);
     328                pThis->cbBounceBufUsed -= cbWritten;
     329                memmove(&pThis->pbBounceBuf[0], &pThis->pbBounceBuf[cbWritten], pThis->cbBounceBufUsed);
    329330                rc = ResetEvent(pThis->Overlapped.hEvent); Assert(rc == TRUE);
    330                 if (!WriteFile(pThis->hPipe, pThis->pbBounceBuf, (DWORD)pThis->cbBounceBufUsed,
    331                                &cbWritten, &pThis->Overlapped))
    332                 {
    333                     if (GetLastError() == ERROR_IO_PENDING)
     331                if (!WriteFile(pThis->hPipe, pThis->pbBounceBuf, (DWORD)pThis->cbBounceBufUsed, &cbWritten, &pThis->Overlapped))
     332                {
     333                    DWORD const dwErr = GetLastError();
     334                    if (dwErr == ERROR_IO_PENDING)
    334335                        rc = VINF_TRY_AGAIN;
    335336                    else
    336337                    {
    337338                        pThis->fIOPending = false;
    338                         if (GetLastError() == ERROR_NO_DATA)
     339                        if (dwErr == ERROR_NO_DATA)
    339340                            rc = VERR_BROKEN_PIPE;
    340341                        else
Note: See TracChangeset for help on using the changeset viewer.

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