儲存庫 vbox 的更動 18443
- 時間撮記:
- 2009-3-28 上午03:15:18 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Serial/DrvNamedPipe.cpp
r11284 r18443 100 100 101 101 /** @copydoc PDMISTREAM::pfnRead */ 102 static DECLCALLBACK(int) drvNamedPipeRead(PPDMISTREAM pInterface, void *pvBuf, size_t * cbRead)102 static DECLCALLBACK(int) drvNamedPipeRead(PPDMISTREAM pInterface, void *pvBuf, size_t *pcbRead) 103 103 { 104 104 int rc = VINF_SUCCESS; 105 105 PDRVNAMEDPIPE pThis = PDMISTREAM_2_DRVNAMEDPIPE(pInterface); 106 LogFlow(("%s: pvBuf=%p cbRead=%#x (%s)\n", __FUNCTION__, pvBuf,cbRead, pThis->pszLocation));106 LogFlow(("%s: pvBuf=%p *pcbRead=%#x (%s)\n", __FUNCTION__, pvBuf, *pcbRead, pThis->pszLocation)); 107 107 108 108 Assert(pvBuf); … … 113 113 pThis->OverlappedRead.Offset = 0; 114 114 pThis->OverlappedRead.OffsetHigh = 0; 115 if (!ReadFile(pThis->NamedPipe, pvBuf, *cbRead, &cbReallyRead, &pThis->OverlappedRead))115 if (!ReadFile(pThis->NamedPipe, pvBuf, (DWORD)*pcbRead, &cbReallyRead, &pThis->OverlappedRead)) 116 116 { 117 117 DWORD uError = GetLastError(); … … 164 164 cbReallyRead = 0; 165 165 } 166 * cbRead = (size_t)cbReallyRead;166 *pcbRead = (size_t)cbReallyRead; 167 167 } 168 168 #else /* !RT_OS_WINDOWS */ … … 170 170 { 171 171 ssize_t cbReallyRead; 172 cbReallyRead = recv(pThis->LocalSocket, pvBuf, * cbRead, 0);172 cbReallyRead = recv(pThis->LocalSocket, pvBuf, *pcbRead, 0); 173 173 if (cbReallyRead == 0) 174 174 { … … 182 182 rc = RTErrConvertFromErrno(errno); 183 183 } 184 * cbRead = cbReallyRead;184 *pcbRead = cbReallyRead; 185 185 } 186 186 #endif /* !RT_OS_WINDOWS */ … … 188 188 { 189 189 RTThreadSleep(100); 190 * cbRead = 0;191 } 192 193 LogFlow(("%s: cbRead=%d returns %Rrc\n", __FUNCTION__, *cbRead, rc));190 *pcbRead = 0; 191 } 192 193 LogFlow(("%s: *pcbRead=%zu returns %Rrc\n", __FUNCTION__, *pcbRead, rc)); 194 194 return rc; 195 195 } … … 197 197 198 198 /** @copydoc PDMISTREAM::pfnWrite */ 199 static DECLCALLBACK(int) drvNamedPipeWrite(PPDMISTREAM pInterface, const void *pvBuf, size_t * cbWrite)199 static DECLCALLBACK(int) drvNamedPipeWrite(PPDMISTREAM pInterface, const void *pvBuf, size_t *pcbWrite) 200 200 { 201 201 int rc = VINF_SUCCESS; 202 202 PDRVNAMEDPIPE pThis = PDMISTREAM_2_DRVNAMEDPIPE(pInterface); 203 LogFlow(("%s: pvBuf=%p cbWrite=%#x (%s)\n", __FUNCTION__, pvBuf,cbWrite, pThis->pszLocation));203 LogFlow(("%s: pvBuf=%p *pcbWrite=%#x (%s)\n", __FUNCTION__, pvBuf, *pcbWrite, pThis->pszLocation)); 204 204 205 205 Assert(pvBuf); … … 207 207 if (pThis->NamedPipe != INVALID_HANDLE_VALUE) 208 208 { 209 unsigned cbWritten;209 DWORD cbWritten = (DWORD)*pcbWrite; 210 210 pThis->OverlappedWrite.Offset = 0; 211 211 pThis->OverlappedWrite.OffsetHigh = 0; 212 if (!WriteFile(pThis->NamedPipe, pvBuf, *cbWrite, NULL, &pThis->OverlappedWrite))212 if (!WriteFile(pThis->NamedPipe, pvBuf, cbWritten, NULL, &pThis->OverlappedWrite)) 213 213 { 214 214 DWORD uError = GetLastError(); … … 217 217 || uError == ERROR_PIPE_NOT_CONNECTED) 218 218 { 219 /* No connection yet/anymore; just discard the write. */ 220 cbWritten = *cbWrite; 221 } 222 else 223 if (uError != ERROR_IO_PENDING) 219 /* No connection yet/anymore; just discard the write (pretening everything was written). */; 220 } 221 else if (uError != ERROR_IO_PENDING) 224 222 { 225 223 rc = RTErrConvertFromWin32(uError); 226 224 Log(("drvNamedPipeWrite: WriteFile returned %d (%Rrc)\n", uError, rc)); 225 cbWritten = 0; 227 226 } 228 227 else 229 228 { 230 229 /* Wait for the write to complete. */ 231 if (GetOverlappedResult(pThis->NamedPipe, &pThis->OverlappedWrite, (DWORD *)&cbWritten, TRUE) == FALSE) 232 uError = GetLastError(); 233 } 234 } 235 else 236 cbWritten = *cbWrite; 230 if (GetOverlappedResult(pThis->NamedPipe, &pThis->OverlappedWrite, &cbWritten, TRUE /*bWait*/) == FALSE) 231 rc = RTErrConvertFromWin32(uError = GetLastError()); 232 } 233 } 237 234 238 235 if (RT_FAILURE(rc)) … … 253 250 cbWritten = 0; 254 251 } 255 * cbWrite = cbWritten;252 *pcbWrite = cbWritten; 256 253 } 257 254 #else /* !RT_OS_WINDOWS */ … … 259 256 { 260 257 ssize_t cbWritten; 261 cbWritten = send(pThis->LocalSocket, pvBuf, * cbWrite, 0);258 cbWritten = send(pThis->LocalSocket, pvBuf, *pcbWrite, 0); 262 259 if (cbWritten == 0) 263 260 { … … 271 268 rc = RTErrConvertFromErrno(errno); 272 269 } 273 * cbWrite = cbWritten;270 *pcbWrite = cbWritten; 274 271 } 275 272 #endif /* !RT_OS_WINDOWS */
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器