VirtualBox

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


Ignore:
Timestamp:
Dec 30, 2011 1:06:50 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
75528
Message:

IPRT: Added RTPipeQueryReadable.

File:
1 edited

Legend:

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

    r34119 r39690  
    11481148
    11491149
     1150RTDECL(int) RTPipeQueryReadable(RTPIPE hPipe, size_t *pcbReadable)
     1151{
     1152    RTPIPEINTERNAL *pThis = hPipe;
     1153    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     1154    AssertReturn(pThis->u32Magic == RTPIPE_MAGIC, VERR_INVALID_HANDLE);
     1155    AssertReturn(pThis->fRead, VERR_PIPE_NOT_READ);
     1156    AssertPtrReturn(pcbReadable, VERR_INVALID_POINTER);
     1157
     1158    int rc = RTCritSectEnter(&pThis->CritSect);
     1159    if (RT_FAILURE(rc))
     1160        return rc;
     1161
     1162    DWORD cbAvailable = 0;
     1163    if (PeekNamedPipe(pThis->hPipe, NULL, 0, NULL, &cbAvailable, NULL)
     1164        *pcbReadable = cbAvailable;
     1165    else
     1166        rc = RTErrConvertFromWin32(GetLastError());
     1167
     1168    RTCritSectLeave(&pThis->CritSect);
     1169    return rc;
     1170}
     1171
     1172
    11501173/**
    11511174 * Internal RTPollSetAdd helper that returns the handle that should be added to
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