[Com0com-cvs] com0com bufutils.c,NONE,1.1 bufutils.h,NONE,1.1 io.c,1.9,1.10 sources,1.2,1.3
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2005-08-25 15:38:27
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11457 Modified Files: io.c sources Added Files: bufutils.c bufutils.h Log Message: Some code moved from io.c to bufutils.c Index: sources =================================================================== RCS file: /cvsroot/com0com/com0com/sources,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sources 23 Aug 2005 15:49:21 -0000 1.2 --- sources 25 Aug 2005 15:38:17 -0000 1.3 *************** *** 20,23 **** --- 20,24 ---- timeout.c \ delay.c \ + bufutils.c \ strutils.c \ syslog.c \ --- NEW FILE: bufutils.h --- /* * $Id: bufutils.h,v 1.1 2005/08/25 15:38:17 vfrolov Exp $ * * Copyright (c) 2005 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: bufutils.h,v $ * Revision 1.1 2005/08/25 15:38:17 vfrolov * Some code moved from io.c to bufutils.c * * */ #ifndef _C0C_BUFUTILS_H_ #define _C0C_BUFUTILS_H_ VOID CopyCharsWithEscape( PC0C_BUFFER pBuf, UCHAR escapeChar, PUCHAR pReadBuf, SIZE_T readLength, PUCHAR pWriteBuf, SIZE_T writeLength, PSIZE_T pReadDone, PSIZE_T pWriteDone); SIZE_T ReadFromBuffer(PC0C_BUFFER pBuf, PVOID pRead, SIZE_T readLength); SIZE_T WriteToBuffer(PC0C_BUFFER pBuf, PVOID pWrite, SIZE_T writeLength, UCHAR escapeChar); NTSTATUS WriteRawDataToBuffer(PC0C_RAW_DATA pRawData, PC0C_BUFFER pBuf); SIZE_T WriteRawData(PC0C_RAW_DATA pRawData, PNTSTATUS pStatus, PVOID pReadBuf, SIZE_T readLength); #endif /* _C0C_BUFUTILS_H_ */ --- NEW FILE: bufutils.c --- /* * $Id: bufutils.c,v 1.1 2005/08/25 15:38:17 vfrolov Exp $ * * Copyright (c) 2004-2005 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: bufutils.c,v $ * Revision 1.1 2005/08/25 15:38:17 vfrolov * Some code moved from io.c to bufutils.c * * */ #include "precomp.h" #include "bufutils.h" /* * FILE_ID used by HALT_UNLESS to put it on BSOD */ #define FILE_ID 8 VOID CompactRawData(PC0C_RAW_DATA pRawData, SIZE_T writeDone) { if (writeDone) { pRawData->size = (UCHAR)(pRawData->size - writeDone); if (pRawData->size) { HALT_UNLESS3((pRawData->size + writeDone) <= sizeof(pRawData->data), pRawData->size, writeDone, sizeof(pRawData->data)); RtlMoveMemory(pRawData->data, pRawData->data + writeDone, pRawData->size); } } } NTSTATUS MoveRawData(PC0C_RAW_DATA pDstRawData, PC0C_RAW_DATA pSrcRawData) { SIZE_T free; if (!pSrcRawData->size) return STATUS_SUCCESS; HALT_UNLESS2(pDstRawData->size <= sizeof(pDstRawData->data), pDstRawData->size, sizeof(pDstRawData->data)); free = sizeof(pDstRawData->data) - pDstRawData->size; if (free) { SIZE_T length; if (free > pSrcRawData->size) length = pSrcRawData->size; else length = free; HALT_UNLESS3((pDstRawData->size + length) <= sizeof(pDstRawData->data), pDstRawData->size, length, sizeof(pDstRawData->data)); RtlCopyMemory(pDstRawData->data + pDstRawData->size, pSrcRawData->data, length); pDstRawData->size = (UCHAR)(pDstRawData->size + length); CompactRawData(pSrcRawData, length); } return pSrcRawData->size ? STATUS_PENDING : STATUS_SUCCESS; } VOID CopyCharsWithEscape( PC0C_BUFFER pBuf, UCHAR escapeChar, PUCHAR pReadBuf, SIZE_T readLength, PUCHAR pWriteBuf, SIZE_T writeLength, PSIZE_T pReadDone, PSIZE_T pWriteDone) { SIZE_T readDone; SIZE_T writeDone; readDone = 0; if (pBuf->escape && readLength) { pBuf->escape = FALSE; *pReadBuf++ = SERIAL_LSRMST_ESCAPE; readDone++; readLength--; } if (pBuf->insertData.size && readLength) { SIZE_T length = pBuf->insertData.size; HALT_UNLESS2(length <= sizeof(pBuf->insertData.data), length, sizeof(pBuf->insertData.data)); if (length > readLength) length = readLength; RtlCopyMemory(pReadBuf, pBuf->insertData.data, length); pReadBuf += length; readDone += length; readLength -= length; CompactRawData(&pBuf->insertData, length); } if (!escapeChar) { writeDone = writeLength < readLength ? writeLength : readLength; if (writeDone) { RtlCopyMemory(pReadBuf, pWriteBuf, writeDone); readDone += writeDone; } } else { writeDone = 0; while (writeLength--) { UCHAR curChar; if (!readLength--) break; curChar = *pWriteBuf++; writeDone++; *pReadBuf++ = curChar; readDone++; if (curChar == escapeChar) { if (!readLength--) { pBuf->escape = TRUE; break; } *pReadBuf++ = SERIAL_LSRMST_ESCAPE; readDone++; } } } *pReadDone = readDone; *pWriteDone = writeDone; } SIZE_T ReadFromBuffer(PC0C_BUFFER pBuf, PVOID pRead, SIZE_T readLength) { PUCHAR pReadBuf = (PUCHAR)pRead; while (readLength) { SIZE_T length, writeLength; PVOID pWriteBuf; if (!pBuf->busy) { if (pBuf->escape) { pBuf->escape = FALSE; *pReadBuf++ = SERIAL_LSRMST_ESCAPE; readLength--; if (!readLength) break; } if (pBuf->insertData.size) { length = pBuf->insertData.size; HALT_UNLESS2(length <= sizeof(pBuf->insertData.data), length, sizeof(pBuf->insertData.data)); if (length > readLength) length = readLength; RtlCopyMemory(pReadBuf, pBuf->insertData.data, length); pReadBuf += length; readLength -= length; CompactRawData(&pBuf->insertData, length); if (!readLength) break; } break; } HALT_UNLESS(pBuf->pBase); writeLength = pBuf->pFree <= pBuf->pBusy ? pBuf->pEnd - pBuf->pBusy : pBuf->busy; pWriteBuf = pBuf->pBusy; length = writeLength < readLength ? writeLength : readLength; RtlCopyMemory(pReadBuf, pWriteBuf, length); pBuf->busy -= length; pBuf->pBusy += length; if (pBuf->pBusy == pBuf->pEnd) pBuf->pBusy = pBuf->pBase; pReadBuf += length; readLength -= length; } return pReadBuf - (PUCHAR)pRead; } SIZE_T WriteToBuffer(PC0C_BUFFER pBuf, PVOID pWrite, SIZE_T writeLength, UCHAR escapeChar) { PUCHAR pWriteBuf = (PUCHAR)pWrite; while (writeLength) { SIZE_T readDone, writeDone; SIZE_T readLength; PVOID pReadBuf; if ((SIZE_T)(pBuf->pEnd - pBuf->pBase) <= pBuf->busy) break; readLength = pBuf->pBusy <= pBuf->pFree ? pBuf->pEnd - pBuf->pFree : pBuf->pBusy - pBuf->pFree; pReadBuf = pBuf->pFree; CopyCharsWithEscape( pBuf, escapeChar, pReadBuf, readLength, pWriteBuf, writeLength, &readDone, &writeDone); pBuf->busy += readDone; pBuf->pFree += readDone; if (pBuf->pFree == pBuf->pEnd) pBuf->pFree = pBuf->pBase; pWriteBuf += writeDone; writeLength -= writeDone; } return pWriteBuf - (PUCHAR)pWrite; } NTSTATUS WriteRawDataToBuffer(PC0C_RAW_DATA pRawData, PC0C_BUFFER pBuf) { NTSTATUS status; if (!pBuf->pBase) return STATUS_PENDING; status = STATUS_PENDING; for (;;) { SIZE_T readDone, writeDone; SIZE_T writeLength, readLength; PVOID pWriteBuf, pReadBuf; writeLength = pRawData->size; if (!writeLength) { status = STATUS_SUCCESS; break; } HALT_UNLESS2(writeLength <= sizeof(pRawData->data), writeLength, sizeof(pRawData->data)); pWriteBuf = pRawData->data; if ((SIZE_T)(pBuf->pEnd - pBuf->pBase) <= pBuf->busy) break; readLength = pBuf->pBusy <= pBuf->pFree ? pBuf->pEnd - pBuf->pFree : pBuf->pBusy - pBuf->pFree; pReadBuf = pBuf->pFree; CopyCharsWithEscape( pBuf, 0, pReadBuf, readLength, pWriteBuf, writeLength, &readDone, &writeDone); pBuf->busy += readDone; pBuf->pFree += readDone; if (pBuf->pFree == pBuf->pEnd) pBuf->pFree = pBuf->pBase; CompactRawData(pRawData, writeDone); } if (status == STATUS_PENDING) status = MoveRawData(&pBuf->insertData, pRawData); return status; } SIZE_T WriteRawData(PC0C_RAW_DATA pRawData, PNTSTATUS pStatus, PVOID pReadBuf, SIZE_T readLength) { SIZE_T length, writeLength; PVOID pWriteBuf; pWriteBuf = pRawData->data; writeLength = pRawData->size; HALT_UNLESS2(writeLength <= sizeof(pRawData->data), writeLength, sizeof(pRawData->data)); length = writeLength < readLength ? writeLength : readLength; RtlCopyMemory(pReadBuf, pWriteBuf, length); CompactRawData(pRawData, length); if (!pRawData->size) *pStatus = STATUS_SUCCESS; return length; } Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/io.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** io.c 25 Aug 2005 08:25:40 -0000 1.9 --- io.c 25 Aug 2005 15:38:17 -0000 1.10 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2005/08/25 15:38:17 vfrolov + * Some code moved from io.c to bufutils.c + * * Revision 1.9 2005/08/25 08:25:40 vfrolov * Fixed data types *************** *** 53,56 **** --- 56,60 ---- #include "timeout.h" #include "delay.h" + #include "bufutils.h" /* *************** *** 62,187 **** (((PUCHAR)(pIrp)->AssociatedIrp.SystemBuffer) + done) - VOID CompactRawData(PC0C_RAW_DATA pRawData, SIZE_T writeDone) - { - if (writeDone) { - pRawData->size = (UCHAR)(pRawData->size - writeDone); - - if (pRawData->size) { - HALT_UNLESS3((pRawData->size + writeDone) <= sizeof(pRawData->data), - pRawData->size, writeDone, sizeof(pRawData->data)); - - RtlMoveMemory(pRawData->data, pRawData->data + writeDone, pRawData->size); - } - } - } - - NTSTATUS MoveRawData(PC0C_RAW_DATA pDstRawData, PC0C_RAW_DATA pSrcRawData) - { - SIZE_T free; - - if (!pSrcRawData->size) - return STATUS_SUCCESS; - - HALT_UNLESS2(pDstRawData->size <= sizeof(pDstRawData->data), - pDstRawData->size, sizeof(pDstRawData->data)); - - free = sizeof(pDstRawData->data) - pDstRawData->size; - - if (free) { - SIZE_T length; - - if (free > pSrcRawData->size) - length = pSrcRawData->size; - else - length = free; - - HALT_UNLESS3((pDstRawData->size + length) <= sizeof(pDstRawData->data), - pDstRawData->size, length, sizeof(pDstRawData->data)); - - RtlCopyMemory(pDstRawData->data + pDstRawData->size, pSrcRawData->data, length); - pDstRawData->size = (UCHAR)(pDstRawData->size + length); - CompactRawData(pSrcRawData, length); - } - return pSrcRawData->size ? STATUS_PENDING : STATUS_SUCCESS; - } - NTSTATUS ReadBuffer(PIRP pIrp, PC0C_BUFFER pBuf, PSIZE_T pReadDone) { NTSTATUS status; ! SIZE_T information; ! PIO_STACK_LOCATION pIrpStack; ! status = STATUS_PENDING; information = pIrp->IoStatus.Information; - pIrpStack = IoGetCurrentIrpStackLocation(pIrp); - - for (;;) { - SIZE_T length, writeLength, readLength; - PUCHAR pWriteBuf, pReadBuf; - - readLength = pIrpStack->Parameters.Read.Length - information; - - if (!readLength) { - status = STATUS_SUCCESS; - break; - } - - pReadBuf = GET_REST_BUFFER(pIrp, information); ! if (!pBuf->busy) { ! if (pBuf->escape) { ! pBuf->escape = FALSE; ! *pReadBuf++ = SERIAL_LSRMST_ESCAPE; ! information++; ! readLength--; ! if (!readLength) { ! status = STATUS_SUCCESS; ! break; ! } ! } ! if (pBuf->insertData.size) { ! length = pBuf->insertData.size; ! ! HALT_UNLESS2(length <= sizeof(pBuf->insertData.data), ! length, sizeof(pBuf->insertData.data)); ! ! if (length > readLength) ! length = readLength; ! ! RtlCopyMemory(pReadBuf, pBuf->insertData.data, length); ! pReadBuf += length; ! information += length; ! readLength -= length; ! CompactRawData(&pBuf->insertData, length); ! if (!readLength) { ! status = STATUS_SUCCESS; ! break; ! } ! } ! break; ! } ! ! HALT_UNLESS(pBuf->pBase); ! ! writeLength = pBuf->pFree <= pBuf->pBusy ? ! pBuf->pEnd - pBuf->pBusy : pBuf->busy; ! ! pWriteBuf = pBuf->pBusy; ! ! length = writeLength < readLength ? writeLength : readLength; ! ! RtlCopyMemory(pReadBuf, pWriteBuf, length); ! ! pBuf->busy -= length; ! pBuf->pBusy += length; ! if (pBuf->pBusy == pBuf->pEnd) ! pBuf->pBusy = pBuf->pBase; ! information += length; } - *pReadDone += information - pIrp->IoStatus.Information; ! pIrp->IoStatus.Information = information; return status; --- 66,91 ---- (((PUCHAR)(pIrp)->AssociatedIrp.SystemBuffer) + done) NTSTATUS ReadBuffer(PIRP pIrp, PC0C_BUFFER pBuf, PSIZE_T pReadDone) { NTSTATUS status; ! SIZE_T readLength, information; ! SIZE_T readDone; ! readLength = IoGetCurrentIrpStackLocation(pIrp)->Parameters.Read.Length; information = pIrp->IoStatus.Information; ! readDone = ReadFromBuffer(pBuf, GET_REST_BUFFER(pIrp, information), readLength - information); ! if (readDone) { ! *pReadDone += readDone; ! information += readDone; ! pIrp->IoStatus.Information = information; } ! if (information == readLength) ! status = STATUS_SUCCESS; ! else ! status = STATUS_PENDING; return status; *************** *** 196,270 **** } - VOID CopyCharsWithEscape( - PC0C_BUFFER pBuf, UCHAR escapeChar, - PUCHAR pReadBuf, SIZE_T readLength, - PUCHAR pWriteBuf, SIZE_T writeLength, - PSIZE_T pReadDone, - PSIZE_T pWriteDone) - { - SIZE_T readDone; - SIZE_T writeDone; - - readDone = 0; - - if (pBuf->escape && readLength) { - pBuf->escape = FALSE; - *pReadBuf++ = SERIAL_LSRMST_ESCAPE; - readDone++; - readLength--; - } - - if (pBuf->insertData.size && readLength) { - SIZE_T length = pBuf->insertData.size; - - HALT_UNLESS2(length <= sizeof(pBuf->insertData.data), - length, sizeof(pBuf->insertData.data)); - - if (length > readLength) - length = readLength; - - RtlCopyMemory(pReadBuf, pBuf->insertData.data, length); - pReadBuf += length; - readDone += length; - readLength -= length; - CompactRawData(&pBuf->insertData, length); - } - - if (!escapeChar) { - writeDone = writeLength < readLength ? writeLength : readLength; - - if (writeDone) { - RtlCopyMemory(pReadBuf, pWriteBuf, writeDone); - readDone += writeDone; - } - } else { - writeDone = 0; - - while (writeLength--) { - UCHAR curChar; - - if (!readLength--) - break; - - curChar = *pWriteBuf++; - writeDone++; - *pReadBuf++ = curChar; - readDone++; - - if (curChar == escapeChar) { - if (!readLength--) { - pBuf->escape = TRUE; - break; - } - *pReadBuf++ = SERIAL_LSRMST_ESCAPE; - readDone++; - } - } - } - - *pReadDone = readDone; - *pWriteDone = writeDone; - } - NTSTATUS WriteBuffer( PIRP pIrp, --- 100,103 ---- *************** *** 275,403 **** { NTSTATUS status; ! SIZE_T information; ! PIO_STACK_LOCATION pIrpStack; ! PC0C_BUFFER pBuf = &pReadIoPort->readBuf; ! ! if (!pBuf->pBase) ! return STATUS_PENDING; ! status = STATUS_PENDING; information = pIrp->IoStatus.Information; ! pIrpStack = IoGetCurrentIrpStackLocation(pIrp); ! ! for (;;) { ! SIZE_T readDone, writeDone; ! SIZE_T writeLength, readLength; ! PVOID pWriteBuf, pReadBuf; ! ! writeLength = pIrpStack->Parameters.Write.Length - information; ! ! if (!writeLength) { ! status = STATUS_SUCCESS; ! break; ! } ! ! if (pWriteLimit && writeLength > *pWriteLimit) { ! writeLength = *pWriteLimit; ! if (!writeLength) ! break; ! } ! ! pWriteBuf = GET_REST_BUFFER(pIrp, information); ! ! if ((SIZE_T)(pBuf->pEnd - pBuf->pBase) <= pBuf->busy) { ! /* ! if (pWriteLimit) { ! // errors |= SERIAL_ERROR_QUEUEOVERRUN ! information += writeLength; ! *pWriteLimit -= writeLength; ! continue; ! } ! */ ! break; ! } ! ! readLength = pBuf->pBusy <= pBuf->pFree ? ! pBuf->pEnd - pBuf->pFree : pBuf->pBusy - pBuf->pFree; ! pReadBuf = pBuf->pFree; ! CopyCharsWithEscape( ! pBuf, pReadIoPort->escapeChar, ! pReadBuf, readLength, ! pWriteBuf, writeLength, ! &readDone, &writeDone); ! pBuf->busy += readDone; ! pBuf->pFree += readDone; ! if (pBuf->pFree == pBuf->pEnd) ! pBuf->pFree = pBuf->pBase; if (pWriteLimit) *pWriteLimit -= writeDone; ! information += writeDone; ! ! if (writeDone) ! WaitCompleteRxChar(pReadIoPort, pQueueToComplete); ! } ! ! *pWriteDone += information - pIrp->IoStatus.Information; ! ! pIrp->IoStatus.Information = information; ! ! return status; ! } ! ! NTSTATUS InsertBuffer(PC0C_RAW_DATA pRawData, PC0C_BUFFER pBuf) ! { ! NTSTATUS status; ! ! if (!pBuf->pBase) ! return STATUS_PENDING; ! ! status = STATUS_PENDING; ! ! for (;;) { ! SIZE_T readDone, writeDone; ! SIZE_T writeLength, readLength; ! PVOID pWriteBuf, pReadBuf; ! ! writeLength = pRawData->size; ! ! if (!writeLength) { ! status = STATUS_SUCCESS; ! break; ! } ! ! HALT_UNLESS2(writeLength <= sizeof(pRawData->data), ! writeLength, sizeof(pRawData->data)); ! ! pWriteBuf = pRawData->data; ! ! if ((SIZE_T)(pBuf->pEnd - pBuf->pBase) <= pBuf->busy) ! break; ! ! readLength = pBuf->pBusy <= pBuf->pFree ? ! pBuf->pEnd - pBuf->pFree : pBuf->pBusy - pBuf->pFree; ! ! pReadBuf = pBuf->pFree; ! ! CopyCharsWithEscape( ! pBuf, 0, ! pReadBuf, readLength, ! pWriteBuf, writeLength, ! &readDone, &writeDone); ! ! pBuf->busy += readDone; ! pBuf->pFree += readDone; ! if (pBuf->pFree == pBuf->pEnd) ! pBuf->pFree = pBuf->pBase; ! ! CompactRawData(pRawData, writeDone); } ! if (status == STATUS_PENDING) ! status = MoveRawData(&pBuf->insertData, pRawData); return status; --- 108,141 ---- { NTSTATUS status; ! SIZE_T writeLength, information; ! SIZE_T writeDone; ! PC0C_BUFFER pBuf; ! SIZE_T length; ! writeLength = IoGetCurrentIrpStackLocation(pIrp)->Parameters.Write.Length; information = pIrp->IoStatus.Information; ! pBuf = &pReadIoPort->readBuf; ! length = writeLength - information; ! if (pWriteLimit && length > *pWriteLimit) ! length = *pWriteLimit; ! writeDone = WriteToBuffer(pBuf, GET_REST_BUFFER(pIrp, information), length, pReadIoPort->escapeChar); ! if (writeDone) { ! *pWriteDone += writeDone; ! information += writeDone; ! pIrp->IoStatus.Information = information; if (pWriteLimit) *pWriteLimit -= writeDone; ! WaitCompleteRxChar(pReadIoPort, pQueueToComplete); } ! if (information == writeLength) ! status = STATUS_SUCCESS; ! else ! status = STATUS_PENDING; return status; *************** *** 456,488 **** PNTSTATUS pStatusWrite, PNTSTATUS pStatusRead, - PC0C_BUFFER pBuf, PSIZE_T pReadDone) { ! SIZE_T readDone, writeDone; ! SIZE_T writeLength, readLength; ! PVOID pWriteBuf, pReadBuf; pReadBuf = GET_REST_BUFFER(pIrpRead, pIrpRead->IoStatus.Information); readLength = IoGetCurrentIrpStackLocation(pIrpRead)->Parameters.Read.Length - pIrpRead->IoStatus.Information; - pWriteBuf = pRawData->data; - writeLength = pRawData->size; ! HALT_UNLESS2(writeLength <= sizeof(pRawData->data), ! writeLength, sizeof(pRawData->data)); ! ! CopyCharsWithEscape( ! pBuf, 0, ! pReadBuf, readLength, ! pWriteBuf, writeLength, ! &readDone, &writeDone); pIrpRead->IoStatus.Information += readDone; - CompactRawData(pRawData, writeDone); if (readDone == readLength) *pStatusRead = STATUS_SUCCESS; - if (writeDone == writeLength) - *pStatusWrite = STATUS_SUCCESS; *pReadDone += readDone; --- 194,213 ---- PNTSTATUS pStatusWrite, PNTSTATUS pStatusRead, PSIZE_T pReadDone) { ! SIZE_T readDone; ! SIZE_T readLength; ! PVOID pReadBuf; pReadBuf = GET_REST_BUFFER(pIrpRead, pIrpRead->IoStatus.Information); readLength = IoGetCurrentIrpStackLocation(pIrpRead)->Parameters.Read.Length - pIrpRead->IoStatus.Information; ! readDone = WriteRawData(pRawData, pStatusWrite, pReadBuf, readLength); pIrpRead->IoStatus.Information += readDone; if (readDone == readLength) *pStatusRead = STATUS_SUCCESS; *pReadDone += readDone; *************** *** 604,608 **** case C0C_IO_TYPE_INSERT: HALT_UNLESS(pParam); ! InsertDirect((PC0C_RAW_DATA)pParam, pIrpCurrent, &status, &statusCurrent, &pIoPort->readBuf, &doneCurrent); break; } --- 329,333 ---- case C0C_IO_TYPE_INSERT: HALT_UNLESS(pParam); ! InsertDirect((PC0C_RAW_DATA)pParam, pIrpCurrent, &status, &statusCurrent, &doneCurrent); break; } *************** *** 624,628 **** case C0C_IO_TYPE_INSERT: HALT_UNLESS(pParam); ! status = InsertBuffer((PC0C_RAW_DATA)pParam, &pIoPort->readBuf); break; } --- 349,353 ---- case C0C_IO_TYPE_INSERT: HALT_UNLESS(pParam); ! status = WriteRawDataToBuffer((PC0C_RAW_DATA)pParam, &pIoPort->readBuf); break; } |