com0com-cvs Mailing List for Null-modem emulator (Page 36)
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
You can subscribe to this list here.
2005 |
Jan
|
Feb
(7) |
Mar
|
Apr
|
May
(13) |
Jun
(18) |
Jul
(9) |
Aug
(10) |
Sep
(15) |
Oct
(6) |
Nov
(9) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(7) |
Jun
(11) |
Jul
(6) |
Aug
(9) |
Sep
(1) |
Oct
(27) |
Nov
(22) |
Dec
(3) |
2007 |
Jan
(13) |
Feb
(16) |
Mar
(2) |
Apr
(3) |
May
(7) |
Jun
(17) |
Jul
(9) |
Aug
(1) |
Sep
(13) |
Oct
(20) |
Nov
(18) |
Dec
(1) |
2008 |
Jan
|
Feb
(3) |
Mar
(46) |
Apr
(40) |
May
(4) |
Jun
(9) |
Jul
(7) |
Aug
(62) |
Sep
(25) |
Oct
(51) |
Nov
(67) |
Dec
(81) |
2009 |
Jan
(13) |
Feb
(31) |
Mar
(12) |
Apr
|
May
(10) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(10) |
Oct
|
Nov
(3) |
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
(4) |
Apr
|
May
(12) |
Jun
(9) |
Jul
(12) |
Aug
(7) |
Sep
(6) |
Oct
|
Nov
|
Dec
(1) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(11) |
Jun
|
Jul
(26) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(23) |
2012 |
Jan
(7) |
Feb
(3) |
Mar
|
Apr
|
May
(2) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vyacheslav F. <vf...@us...> - 2005-08-30 13:12:13
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6985 Modified Files: trace.reg trace.c Log Message: Disabled IOCTL_SERIAL_GET_MODEMSTATUS tracing by default Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/trace.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** trace.c 25 Aug 2005 07:48:39 -0000 1.9 --- trace.c 30 Aug 2005 13:12:04 -0000 1.10 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2005/08/30 13:12:04 vfrolov + * Disabled IOCTL_SERIAL_GET_MODEMSTATUS tracing by default + * * Revision 1.9 2005/08/25 07:48:39 vfrolov * Changed type of code names from wchar to char *************** *** 81,84 **** --- 84,88 ---- ULONG setTimeouts; ULONG getCommStatus; + ULONG getModemStatus; } traceEnable; /********************************************************************/ *************** *** 138,142 **** NTSTATUS status; UNICODE_STRING traceRegistryPath; ! RTL_QUERY_REGISTRY_TABLE queryTable[6]; ULONG zero = 0; --- 142,146 ---- NTSTATUS status; UNICODE_STRING traceRegistryPath; ! RTL_QUERY_REGISTRY_TABLE queryTable[7]; ULONG zero = 0; *************** *** 191,194 **** --- 195,205 ---- queryTable[4].DefaultLength = sizeof(ULONG); + queryTable[5].Flags = RTL_QUERY_REGISTRY_DIRECT; + queryTable[5].Name = L"GetModemStatus"; + queryTable[5].EntryContext = &traceEnable.getModemStatus; + queryTable[5].DefaultType = REG_DWORD; + queryTable[5].DefaultData = &zero; + queryTable[5].DefaultLength = sizeof(ULONG); + status = RtlQueryRegistryValues( RTL_REGISTRY_ABSOLUTE, *************** *** 1093,1096 **** --- 1104,1111 ---- return; break; + case IOCTL_SERIAL_GET_MODEMSTATUS: + if (!traceEnable.getModemStatus) + return; + break; } break; Index: trace.reg =================================================================== RCS file: /cvsroot/com0com/com0com/trace.reg,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** trace.reg 14 Jul 2005 13:53:45 -0000 1.2 --- trace.reg 30 Aug 2005 13:12:04 -0000 1.3 *************** *** 10,12 **** "SetTimeouts"=dword:00000000 "GetCommStatus"=dword:00000000 ! --- 10,12 ---- "SetTimeouts"=dword:00000000 "GetCommStatus"=dword:00000000 ! "GetModemStatus"=dword:00000000 |
From: Vyacheslav F. <vf...@us...> - 2005-08-26 08:35:15
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7914 Modified Files: io.c Log Message: Fixed unwanted interference to baudrate emulation by read operations Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/io.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** io.c 25 Aug 2005 15:38:17 -0000 1.10 --- io.c 26 Aug 2005 08:35:05 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2005/08/26 08:35:05 vfrolov + * Fixed unwanted interference to baudrate emulation by read operations + * * Revision 1.10 2005/08/25 15:38:17 vfrolov * Some code moved from io.c to bufutils.c *************** *** 379,383 **** status = STATUS_PENDING; } else { - StopWriteDelayTimer(pWriteDelay); writeLimit = 0; status = STATUS_SUCCESS; --- 382,385 ---- |
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; } |
From: Vyacheslav F. <vf...@us...> - 2005-08-25 08:25:52
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11082 Modified Files: io.c Log Message: Fixed data types Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/io.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** io.c 23 Aug 2005 15:49:21 -0000 1.8 --- io.c 25 Aug 2005 08:25:40 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2005/08/25 08:25:40 vfrolov + * Fixed data types + * * Revision 1.8 2005/08/23 15:49:21 vfrolov * Implemented baudrate emulation *************** *** 106,110 **** { NTSTATUS status; ! ULONG information; PIO_STACK_LOCATION pIrpStack; --- 109,113 ---- { NTSTATUS status; ! SIZE_T information; PIO_STACK_LOCATION pIrpStack; *************** *** 272,276 **** { NTSTATUS status; ! ULONG information; PIO_STACK_LOCATION pIrpStack; PC0C_BUFFER pBuf = &pReadIoPort->readBuf; --- 275,279 ---- { NTSTATUS status; ! SIZE_T information; PIO_STACK_LOCATION pIrpStack; PC0C_BUFFER pBuf = &pReadIoPort->readBuf; |
From: Vyacheslav F. <vf...@us...> - 2005-08-25 07:48:47
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3258 Modified Files: trace.c trace.h tracetbl.c Log Message: Changed type of code names from wchar to char Fixed HandFlow tracing Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/trace.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** trace.c 23 Aug 2005 15:28:26 -0000 1.8 --- trace.c 25 Aug 2005 07:48:39 -0000 1.9 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.9 2005/08/25 07:48:39 vfrolov + * Changed type of code names from wchar to char + * Fixed HandFlow tracing + * * Revision 1.8 2005/08/23 15:28:26 vfrolov * Added build timestamp *************** *** 460,464 **** /********************************************************************/ ! PWCHAR code2name( IN ULONG code, IN PCODE2NAME pTable) --- 464,468 ---- /********************************************************************/ ! PCHAR code2name( IN ULONG code, IN PCODE2NAME pTable) *************** *** 481,490 **** IN ULONG base) { ! PWCHAR pStr; pStr = code2name(code, pTable); if (pStr) { ! pDestStr = AnsiStrCopyStrW(pDestStr, pSize, pStr); } else { if (pPref) --- 485,494 ---- IN ULONG base) { ! PCHAR pStr; pStr = code2name(code, pTable); if (pStr) { ! pDestStr = AnsiStrCopyStr(pDestStr, pSize, pStr); } else { if (pPref) *************** *** 512,516 **** for (b = 1 ; b ; b <<= 1) { if ((mask & b) != 0) { ! PWCHAR pStr; pStr = code2name(b, pTable); --- 516,520 ---- for (b = 1 ; b ; b <<= 1) { if ((mask & b) != 0) { ! PCHAR pStr; pStr = code2name(b, pTable); *************** *** 519,523 **** if (count) pDestStr = AnsiStrCopyStr(pDestStr, pSize, "|"); ! pDestStr = AnsiStrCopyStrW(pDestStr, pSize, pStr); count++; } else { --- 523,527 ---- if (count) pDestStr = AnsiStrCopyStr(pDestStr, pSize, "|"); ! pDestStr = AnsiStrCopyStr(pDestStr, pSize, pStr); count++; } else { *************** *** 536,539 **** --- 540,575 ---- } + PCHAR AnsiStrCopyFields( + PCHAR pDestStr, + PSIZE_T pSize, + IN PFIELD2NAME pTable, + IN ULONG mask) + { + int count = 0; + + pDestStr = AnsiStrCopyStr(pDestStr, pSize, "["); + + while (pTable->name) { + ULONG m = (mask & pTable->mask); + + if (m == pTable->code) { + mask &= ~pTable->mask; + if (count) + pDestStr = AnsiStrCopyStr(pDestStr, pSize, "|"); + pDestStr = AnsiStrCopyStr(pDestStr, pSize, pTable->name); + count++; + } + pTable++; + } + + if (mask) { + if (count) + pDestStr = AnsiStrCopyStr(pDestStr, pSize, "|"); + pDestStr = AnsiStrFormat(pDestStr, pSize, "0x%lX", mask); + } + + return AnsiStrCopyStr(pDestStr, pSize, "]"); + } + PCHAR AnsiStrCopyDump( PCHAR pDestStr, *************** *** 584,593 **** { pDestStr = AnsiStrCopyStr(pDestStr, pSize, " Hand"); ! pDestStr = AnsiStrCopyMask(pDestStr, pSize, codeNameTableControlHandShake, pHandFlow->ControlHandShake); pDestStr = AnsiStrCopyStr(pDestStr, pSize, " Flow"); ! pDestStr = AnsiStrCopyMask(pDestStr, pSize, codeNameTableFlowReplace, pHandFlow->FlowReplace); --- 620,629 ---- { pDestStr = AnsiStrCopyStr(pDestStr, pSize, " Hand"); ! pDestStr = AnsiStrCopyFields(pDestStr, pSize, codeNameTableControlHandShake, pHandFlow->ControlHandShake); pDestStr = AnsiStrCopyStr(pDestStr, pSize, " Flow"); ! pDestStr = AnsiStrCopyFields(pDestStr, pSize, codeNameTableFlowReplace, pHandFlow->FlowReplace); Index: trace.h =================================================================== RCS file: /cvsroot/com0com/com0com/trace.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** trace.h 14 Jul 2005 12:18:59 -0000 1.2 --- trace.h 25 Aug 2005 07:48:39 -0000 1.3 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.3 2005/08/25 07:48:39 vfrolov + * Changed type of code names from wchar to char + * Fixed HandFlow tracing + * * Revision 1.2 2005/07/14 12:18:59 vfrolov * Defined HALT_UNLESS *************** *** 47,53 **** typedef struct _CODE2NAME { ULONG code; ! PWCHAR name; } CODE2NAME, *PCODE2NAME; VOID TraceOpen( IN PDRIVER_OBJECT _pDrvObj, --- 51,63 ---- typedef struct _CODE2NAME { ULONG code; ! PCHAR name; } CODE2NAME, *PCODE2NAME; + typedef struct _FIELD2NAME { + ULONG code; + ULONG mask; + PCHAR name; + } FIELD2NAME, *PFIELD2NAME; + VOID TraceOpen( IN PDRIVER_OBJECT _pDrvObj, *************** *** 91,96 **** CODE2NAME codeNameTableDoType[]; CODE2NAME codeNameTableModemStatus[]; - CODE2NAME codeNameTableControlHandShake[]; - CODE2NAME codeNameTableFlowReplace[]; CODE2NAME codeNameTableStatus[]; CODE2NAME codeNameTableIrpMj[]; --- 101,104 ---- *************** *** 99,102 **** --- 107,113 ---- CODE2NAME codeNameTableDeviceText[]; + FIELD2NAME codeNameTableControlHandShake[]; + FIELD2NAME codeNameTableFlowReplace[]; + #else /* DBG */ Index: tracetbl.c =================================================================== RCS file: /cvsroot/com0com/com0com/tracetbl.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tracetbl.c 26 Jan 2005 12:18:54 -0000 1.1 --- tracetbl.c 25 Aug 2005 07:48:39 -0000 1.2 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.2 2005/08/25 07:48:39 vfrolov + * Changed type of code names from wchar to char + * Fixed HandFlow tracing + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 30,35 **** #if DBG ! #define TOCODE2NAME1(s) { (ULONG)s, L#s } ! #define TOCODE2NAME(p, s) { (ULONG)p##s, L#s } CODE2NAME codeNameTableWaitMask[] = { --- 34,42 ---- #if DBG ! #define TOCODE2NAME1(s) { (ULONG)s, #s } ! #define TOCODE2NAME(p, s) { (ULONG)p##s, #s } ! ! #define TOFIELD2NAME2(p, s) { (ULONG)p##s, (ULONG)p##s, #s } ! #define TOFIELD2NAME(p, s, m) { (ULONG)p##s, (ULONG)m, #s } CODE2NAME codeNameTableWaitMask[] = { *************** *** 161,185 **** }; ! CODE2NAME codeNameTableControlHandShake[] = { ! TOCODE2NAME(SERIAL_, DTR_CONTROL), ! TOCODE2NAME(SERIAL_, DTR_HANDSHAKE), ! TOCODE2NAME(SERIAL_, CTS_HANDSHAKE), ! TOCODE2NAME(SERIAL_, DSR_HANDSHAKE), ! TOCODE2NAME(SERIAL_, DCD_HANDSHAKE), ! TOCODE2NAME(SERIAL_, DSR_SENSITIVITY), ! TOCODE2NAME(SERIAL_, ERROR_ABORT), ! {0, NULL} }; ! CODE2NAME codeNameTableFlowReplace[] = { ! TOCODE2NAME(SERIAL_, AUTO_TRANSMIT), ! TOCODE2NAME(SERIAL_, AUTO_RECEIVE), ! TOCODE2NAME(SERIAL_, ERROR_CHAR), ! TOCODE2NAME(SERIAL_, NULL_STRIPPING), ! TOCODE2NAME(SERIAL_, BREAK_CHAR), ! TOCODE2NAME(SERIAL_, RTS_CONTROL), ! TOCODE2NAME(SERIAL_, RTS_HANDSHAKE), ! TOCODE2NAME(SERIAL_, XOFF_CONTINUE), ! {0, NULL} }; --- 168,193 ---- }; ! FIELD2NAME codeNameTableControlHandShake[] = { ! TOFIELD2NAME (SERIAL_, DTR_CONTROL, SERIAL_DTR_MASK), ! TOFIELD2NAME (SERIAL_, DTR_HANDSHAKE, SERIAL_DTR_MASK), ! TOFIELD2NAME2(SERIAL_, CTS_HANDSHAKE), ! TOFIELD2NAME2(SERIAL_, DSR_HANDSHAKE), ! TOFIELD2NAME2(SERIAL_, DCD_HANDSHAKE), ! TOFIELD2NAME2(SERIAL_, DSR_SENSITIVITY), ! TOFIELD2NAME2(SERIAL_, ERROR_ABORT), ! {0, 0, NULL} }; ! FIELD2NAME codeNameTableFlowReplace[] = { ! TOFIELD2NAME2(SERIAL_, AUTO_TRANSMIT), ! TOFIELD2NAME2(SERIAL_, AUTO_RECEIVE), ! TOFIELD2NAME2(SERIAL_, ERROR_CHAR), ! TOFIELD2NAME2(SERIAL_, NULL_STRIPPING), ! TOFIELD2NAME2(SERIAL_, BREAK_CHAR), ! TOFIELD2NAME (SERIAL_, RTS_CONTROL, SERIAL_RTS_MASK), ! TOFIELD2NAME (SERIAL_, RTS_HANDSHAKE, SERIAL_RTS_MASK), ! TOFIELD2NAME (SERIAL_, TRANSMIT_TOGGLE, SERIAL_RTS_MASK), ! TOFIELD2NAME2(SERIAL_, XOFF_CONTINUE), ! {0, 0, NULL} }; |
From: Vyacheslav F. <vf...@us...> - 2005-08-24 12:50:54
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23978 Modified Files: startirp.c Log Message: Fixed IRP processing order Index: startirp.c =================================================================== RCS file: /cvsroot/com0com/com0com/startirp.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** startirp.c 14 Jul 2005 13:51:09 -0000 1.2 --- startirp.c 24 Aug 2005 12:50:40 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2005/08/24 12:50:40 vfrolov + * Fixed IRP processing order + * * Revision 1.2 2005/07/14 13:51:09 vfrolov * Replaced ASSERT by HALT_UNLESS *************** *** 74,78 **** PLIST_ENTRY pListEntry; ! pListEntry = RemoveTailList(&pQueue->queue); pIrp = CONTAINING_RECORD(pListEntry, IRP, Tail.Overlay.ListEntry); --- 77,81 ---- PLIST_ENTRY pListEntry; ! pListEntry = RemoveHeadList(&pQueue->queue); pIrp = CONTAINING_RECORD(pListEntry, IRP, Tail.Overlay.ListEntry); *************** *** 155,159 **** PLIST_ENTRY pListEntry; ! pListEntry = RemoveTailList(&pQueue->queue); pIrp = CONTAINING_RECORD(pListEntry, IRP, Tail.Overlay.ListEntry); --- 158,162 ---- PLIST_ENTRY pListEntry; ! pListEntry = RemoveHeadList(&pQueue->queue); pIrp = CONTAINING_RECORD(pListEntry, IRP, Tail.Overlay.ListEntry); |
From: Vyacheslav F. <vf...@us...> - 2005-08-23 15:49:30
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1407 Modified Files: adddev.c com0com.h io.c ioctl.c read.c sources timeout.c timeout.h write.c Log Message: Implemented baudrate emulation Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/ioctl.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ioctl.c 14 Jul 2005 12:29:23 -0000 1.6 --- ioctl.c 23 Aug 2005 15:49:21 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2005/08/23 15:49:21 vfrolov + * Implemented baudrate emulation + * * Revision 1.6 2005/07/14 12:29:23 vfrolov * Fixed BSOD on IRP_MJ_READ after IOCTL_SERIAL_SET_QUEUE_SIZE *************** *** 43,46 **** --- 46,50 ---- #include "precomp.h" #include "timeout.h" + #include "delay.h" NTSTATUS FdoPortIoCtl( *************** *** 315,318 **** --- 319,324 ---- pDevExt->lineControl = *(PSERIAL_LINE_CONTROL)pIrp->AssociatedIrp.SystemBuffer; KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); + + SetWriteDelay(pDevExt); break; case IOCTL_SERIAL_GET_LINE_CONTROL: *************** *** 338,341 **** --- 344,349 ---- pDevExt->baudRate = *(PSERIAL_BAUD_RATE)pIrp->AssociatedIrp.SystemBuffer; KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); + + SetWriteDelay(pDevExt); break; case IOCTL_SERIAL_GET_BAUD_RATE: Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/io.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** io.c 14 Jul 2005 12:24:31 -0000 1.7 --- io.c 23 Aug 2005 15:49:21 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2005/08/23 15:49:21 vfrolov + * Implemented baudrate emulation + * * Revision 1.7 2005/07/14 12:24:31 vfrolov * Replaced ASSERT by HALT_UNLESS *************** *** 46,49 **** --- 49,53 ---- #include "precomp.h" #include "timeout.h" + #include "delay.h" /* *************** *** 52,57 **** #define FILE_ID 1 ! #define GET_REST_BUFFER(pIrp) \ ! (((PUCHAR)(pIrp)->AssociatedIrp.SystemBuffer) + (pIrp)->IoStatus.Information) VOID CompactRawData(PC0C_RAW_DATA pRawData, SIZE_T writeDone) --- 56,61 ---- #define FILE_ID 1 ! #define GET_REST_BUFFER(pIrp, done) \ ! (((PUCHAR)(pIrp)->AssociatedIrp.SystemBuffer) + done) VOID CompactRawData(PC0C_RAW_DATA pRawData, SIZE_T writeDone) *************** *** 99,108 **** } ! NTSTATUS ReadBuffer(PIRP pIrp, PC0C_BUFFER pBuf) { NTSTATUS status; PIO_STACK_LOCATION pIrpStack; status = STATUS_PENDING; pIrpStack = IoGetCurrentIrpStackLocation(pIrp); --- 103,114 ---- } ! NTSTATUS ReadBuffer(PIRP pIrp, PC0C_BUFFER pBuf, PSIZE_T pReadDone) { NTSTATUS status; + ULONG information; PIO_STACK_LOCATION pIrpStack; status = STATUS_PENDING; + information = pIrp->IoStatus.Information; pIrpStack = IoGetCurrentIrpStackLocation(pIrp); *************** *** 111,115 **** PUCHAR pWriteBuf, pReadBuf; ! readLength = pIrpStack->Parameters.Read.Length - pIrp->IoStatus.Information; if (!readLength) { --- 117,121 ---- PUCHAR pWriteBuf, pReadBuf; ! readLength = pIrpStack->Parameters.Read.Length - information; if (!readLength) { *************** *** 118,122 **** } ! pReadBuf = GET_REST_BUFFER(pIrp); if (!pBuf->busy) { --- 124,128 ---- } ! pReadBuf = GET_REST_BUFFER(pIrp, information); if (!pBuf->busy) { *************** *** 124,128 **** pBuf->escape = FALSE; *pReadBuf++ = SERIAL_LSRMST_ESCAPE; ! pIrp->IoStatus.Information++; readLength--; if (!readLength) { --- 130,134 ---- pBuf->escape = FALSE; *pReadBuf++ = SERIAL_LSRMST_ESCAPE; ! information++; readLength--; if (!readLength) { *************** *** 142,146 **** RtlCopyMemory(pReadBuf, pBuf->insertData.data, length); pReadBuf += length; ! pIrp->IoStatus.Information += length; readLength -= length; CompactRawData(&pBuf->insertData, length); --- 148,152 ---- RtlCopyMemory(pReadBuf, pBuf->insertData.data, length); pReadBuf += length; ! information += length; readLength -= length; CompactRawData(&pBuf->insertData, length); *************** *** 169,175 **** pBuf->pBusy = pBuf->pBase; ! pIrp->IoStatus.Information += length; } return status; } --- 175,185 ---- pBuf->pBusy = pBuf->pBase; ! information += length; } + *pReadDone += information - pIrp->IoStatus.Information; + + pIrp->IoStatus.Information = information; + return status; } *************** *** 254,260 **** } ! NTSTATUS WriteBuffer(PIRP pIrp, PC0C_IO_PORT pReadIoPort, PLIST_ENTRY pQueueToComplete) { NTSTATUS status; PIO_STACK_LOCATION pIrpStack; PC0C_BUFFER pBuf = &pReadIoPort->readBuf; --- 264,276 ---- } ! NTSTATUS WriteBuffer( ! PIRP pIrp, ! PC0C_IO_PORT pReadIoPort, ! PLIST_ENTRY pQueueToComplete, ! PSIZE_T pWriteLimit, ! PSIZE_T pWriteDone) { NTSTATUS status; + ULONG information; PIO_STACK_LOCATION pIrpStack; PC0C_BUFFER pBuf = &pReadIoPort->readBuf; *************** *** 264,267 **** --- 280,284 ---- status = STATUS_PENDING; + information = pIrp->IoStatus.Information; pIrpStack = IoGetCurrentIrpStackLocation(pIrp); *************** *** 271,275 **** PVOID pWriteBuf, pReadBuf; ! writeLength = pIrpStack->Parameters.Write.Length - pIrp->IoStatus.Information; if (!writeLength) { --- 288,292 ---- PVOID pWriteBuf, pReadBuf; ! writeLength = pIrpStack->Parameters.Write.Length - information; if (!writeLength) { *************** *** 278,285 **** } ! pWriteBuf = GET_REST_BUFFER(pIrp); ! if ((SIZE_T)(pBuf->pEnd - pBuf->pBase) <= pBuf->busy) break; readLength = pBuf->pBusy <= pBuf->pFree ? --- 295,317 ---- } ! 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 ? *************** *** 299,303 **** pBuf->pFree = pBuf->pBase; ! pIrp->IoStatus.Information += writeDone; if (writeDone) --- 331,338 ---- pBuf->pFree = pBuf->pBase; ! if (pWriteLimit) ! *pWriteLimit -= writeDone; ! ! information += writeDone; if (writeDone) *************** *** 305,308 **** --- 340,347 ---- } + *pWriteDone += information - pIrp->IoStatus.Information; + + pIrp->IoStatus.Information = information; + return status; } *************** *** 363,398 **** VOID ReadWriteDirect( ! PIRP pIrpLocal, ! PIRP pIrpRemote, ! PNTSTATUS pStatusLocal, ! PNTSTATUS pStatusRemote, ! PC0C_IO_PORT pIoPortRemote, ! PLIST_ENTRY pQueueToComplete) { - PC0C_IO_PORT pReadIoPort; SIZE_T readDone, writeDone; - PIRP pIrpRead, pIrpWrite; - PNTSTATUS pStatusRead, pStatusWrite; SIZE_T writeLength, readLength; PVOID pWriteBuf, pReadBuf; ! if (IoGetCurrentIrpStackLocation(pIrpLocal)->MajorFunction == IRP_MJ_WRITE) { ! pIrpRead = pIrpRemote; ! pIrpWrite = pIrpLocal; ! pStatusRead = pStatusRemote; ! pStatusWrite = pStatusLocal; ! pReadIoPort = pIoPortRemote; ! } else { ! pIrpRead = pIrpLocal; ! pIrpWrite = pIrpRemote; ! pStatusRead = pStatusLocal; ! pStatusWrite = pStatusRemote; ! pReadIoPort = pIoPortRemote->pDevExt->pIoPortRemote; ! } ! ! pReadBuf = GET_REST_BUFFER(pIrpRead); readLength = IoGetCurrentIrpStackLocation(pIrpRead)->Parameters.Read.Length - pIrpRead->IoStatus.Information; ! pWriteBuf = GET_REST_BUFFER(pIrpWrite); writeLength = IoGetCurrentIrpStackLocation(pIrpWrite)->Parameters.Write.Length - pIrpWrite->IoStatus.Information; --- 402,424 ---- VOID ReadWriteDirect( ! PIRP pIrpRead, ! PIRP pIrpWrite, ! PNTSTATUS pStatusRead, ! PNTSTATUS pStatusWrite, ! PC0C_IO_PORT pReadIoPort, ! PLIST_ENTRY pQueueToComplete, ! PSIZE_T pWriteLimit, ! PSIZE_T pReadDone, ! PSIZE_T pWriteDone) { 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 = GET_REST_BUFFER(pIrpWrite, pIrpWrite->IoStatus.Information); writeLength = IoGetCurrentIrpStackLocation(pIrpWrite)->Parameters.Write.Length - pIrpWrite->IoStatus.Information; *************** *** 401,407 **** &pReadIoPort->readBuf, pReadIoPort->escapeChar, pReadBuf, readLength, ! pWriteBuf, writeLength, &readDone, &writeDone); pIrpRead->IoStatus.Information += readDone; pIrpWrite->IoStatus.Information += writeDone; --- 427,436 ---- &pReadIoPort->readBuf, pReadIoPort->escapeChar, pReadBuf, readLength, ! pWriteBuf, (pWriteLimit && writeLength > *pWriteLimit) ? *pWriteLimit : writeLength, &readDone, &writeDone); + if (pWriteLimit) + *pWriteLimit -= writeDone; + pIrpRead->IoStatus.Information += readDone; pIrpWrite->IoStatus.Information += writeDone; *************** *** 414,417 **** --- 443,449 ---- if (writeDone) WaitCompleteRxChar(pReadIoPort, pQueueToComplete); + + *pReadDone += readDone; + *pWriteDone += writeDone; } *************** *** 421,425 **** PNTSTATUS pStatusWrite, PNTSTATUS pStatusRead, ! PC0C_BUFFER pBuf) { SIZE_T readDone, writeDone; --- 453,458 ---- PNTSTATUS pStatusWrite, PNTSTATUS pStatusRead, ! PC0C_BUFFER pBuf, ! PSIZE_T pReadDone) { SIZE_T readDone, writeDone; *************** *** 427,431 **** PVOID pWriteBuf, pReadBuf; ! pReadBuf = GET_REST_BUFFER(pIrpRead); readLength = IoGetCurrentIrpStackLocation(pIrpRead)->Parameters.Read.Length - pIrpRead->IoStatus.Information; --- 460,464 ---- PVOID pWriteBuf, pReadBuf; ! pReadBuf = GET_REST_BUFFER(pIrpRead, pIrpRead->IoStatus.Information); readLength = IoGetCurrentIrpStackLocation(pIrpRead)->Parameters.Read.Length - pIrpRead->IoStatus.Information; *************** *** 449,500 **** if (writeDone == writeLength) *pStatusWrite = STATUS_SUCCESS; } ! NTSTATUS FdoPortIo( ! int ioType, ! PVOID pParam, PC0C_IO_PORT pIoPort, PC0C_IRP_QUEUE pQueue, PLIST_ENTRY pQueueToComplete) { ! NTSTATUS status; ! BOOLEAN first; ! if (ioType == C0C_IO_TYPE_READ) { ! HALT_UNLESS(pParam); ! status = ReadBuffer((PIRP)pParam, &pIoPort->pDevExt->pIoPortRemote->readBuf); ! } else { ! status = STATUS_PENDING; ! } ! for (first = TRUE ; pQueue->pCurrent ; first = FALSE) { ! PIRP pIrpCurrent; ! PDRIVER_CANCEL pCancelRoutineCurrent; ! PC0C_IRP_STATE pStateCurrent; ! NTSTATUS statusCurrent; ! statusCurrent = STATUS_PENDING; ! pIrpCurrent = pQueue->pCurrent; ! pStateCurrent = GetIrpState(pIrpCurrent); ! HALT_UNLESS(pStateCurrent); #pragma warning(push, 3) ! pCancelRoutineCurrent = IoSetCancelRoutine(pIrpCurrent, NULL); #pragma warning(pop) ! if (!pCancelRoutineCurrent) { ! ShiftQueue(pQueue); ! continue; } switch (ioType) { - case C0C_IO_TYPE_READ: - case C0C_IO_TYPE_WRITE: - HALT_UNLESS(pParam); - if (status == STATUS_PENDING) - ReadWriteDirect((PIRP)pParam, pIrpCurrent, &status, &statusCurrent, pIoPort, pQueueToComplete); - break; case C0C_IO_TYPE_WAIT_COMPLETE: HALT_UNLESS(pParam); --- 482,595 ---- if (writeDone == writeLength) *pStatusWrite = STATUS_SUCCESS; + + *pReadDone += readDone; } ! PIRP StartCurrentIrp(PC0C_IRP_QUEUE pQueue, PDRIVER_CANCEL *ppCancelRoutine, PBOOLEAN pFirst) ! { ! while (pQueue->pCurrent) { ! PIRP pIrp; ! ! pIrp = pQueue->pCurrent; ! ! #pragma warning(push, 3) ! *ppCancelRoutine = IoSetCancelRoutine(pIrp, NULL); ! #pragma warning(pop) ! ! if (*ppCancelRoutine) ! return pIrp; ! ! ShiftQueue(pQueue); ! *pFirst = FALSE; ! } ! return NULL; ! } ! ! NTSTATUS StopCurrentIrp( ! NTSTATUS status, ! PDRIVER_CANCEL pCancelRoutine, ! BOOLEAN first, ! SIZE_T done, PC0C_IO_PORT pIoPort, PC0C_IRP_QUEUE pQueue, PLIST_ENTRY pQueueToComplete) { ! PIRP pIrp; ! pIrp = pQueue->pCurrent; ! if (status == STATUS_PENDING && done) { ! PC0C_IRP_STATE pState; ! pState = GetIrpState(pIrp); ! HALT_UNLESS(pState); ! if ((pState->flags & C0C_IRP_FLAG_WAIT_ONE) != 0) { ! status = STATUS_SUCCESS; ! } ! else ! if ((first && pState->flags & C0C_IRP_FLAG_INTERVAL_TIMEOUT) != 0) { ! SetIntervalTimeout(pIoPort); ! } ! } ! if (!first && status == STATUS_PENDING) ! status = FdoPortSetIrpTimeout(pIoPort->pDevExt, pIrp); ! ! HALT_UNLESS(pCancelRoutine); + if (status == STATUS_PENDING) { #pragma warning(push, 3) ! IoSetCancelRoutine(pIrp, pCancelRoutine); #pragma warning(pop) + if (pIrp->Cancel) { + #pragma warning(push, 3) + pCancelRoutine = IoSetCancelRoutine(pIrp, NULL); + #pragma warning(pop) ! if (pCancelRoutine) { ! ShiftQueue(pQueue); ! pIrp->IoStatus.Status = STATUS_CANCELLED; ! pIrp->IoStatus.Information = 0; ! InsertTailList(pQueueToComplete, &pIrp->Tail.Overlay.ListEntry); ! return STATUS_CANCELLED; ! } } + } else { + ShiftQueue(pQueue); + pIrp->IoStatus.Status = status; + InsertTailList(pQueueToComplete, &pIrp->Tail.Overlay.ListEntry); + } + + return status; + } + + NTSTATUS FdoPortIo( + int ioType, + PVOID pParam, + PC0C_IO_PORT pIoPort, + PC0C_IRP_QUEUE pQueue, + PLIST_ENTRY pQueueToComplete) + { + NTSTATUS status; + BOOLEAN first; + BOOLEAN firstCurrent; + PIRP pIrpCurrent; + PDRIVER_CANCEL pCancelRoutineCurrent; + SIZE_T done; + + first = TRUE; + done = 0; + + status = STATUS_PENDING; + + for (firstCurrent = TRUE ; (pIrpCurrent = StartCurrentIrp(pQueue, &pCancelRoutineCurrent, &firstCurrent)) != NULL ; firstCurrent = FALSE) { + NTSTATUS statusCurrent; + SIZE_T doneCurrent; + + statusCurrent = STATUS_PENDING; + doneCurrent = 0; switch (ioType) { case C0C_IO_TYPE_WAIT_COMPLETE: HALT_UNLESS(pParam); *************** *** 506,570 **** case C0C_IO_TYPE_INSERT: HALT_UNLESS(pParam); ! InsertDirect((PC0C_RAW_DATA)pParam, pIrpCurrent, &status, &statusCurrent, &pIoPort->readBuf); break; } ! if (IoGetCurrentIrpStackLocation(pIrpCurrent)->MajorFunction == IRP_MJ_WRITE && ! statusCurrent == STATUS_PENDING) ! statusCurrent = WriteBuffer(pIrpCurrent, pIoPort->pDevExt->pIoPortRemote, pQueueToComplete); ! if (statusCurrent == STATUS_PENDING) { ! if ((pStateCurrent->flags & C0C_IRP_FLAG_WAIT_ONE) != 0) { ! statusCurrent = STATUS_SUCCESS; ! } ! else ! if ((pStateCurrent->flags & C0C_IRP_FLAG_INTERVAL_TIMEOUT) != 0) { ! KeSetTimer( ! &pIoPort->timerReadInterval, ! pIoPort->timeoutInterval, ! &pIoPort->timerReadIntervalDpc); ! } } ! if (statusCurrent == STATUS_PENDING && !first) ! statusCurrent = FdoPortSetIrpTimeout(pIoPort->pDevExt, pIrpCurrent); ! if (statusCurrent == STATUS_PENDING) { ! #pragma warning(push, 3) ! IoSetCancelRoutine(pIrpCurrent, pCancelRoutineCurrent); ! #pragma warning(pop) ! if (pIrpCurrent->Cancel) { ! #pragma warning(push, 3) ! pCancelRoutineCurrent = IoSetCancelRoutine(pIrpCurrent, NULL); ! #pragma warning(pop) ! if (pCancelRoutineCurrent) { ! ShiftQueue(pQueue); ! pIrpCurrent->IoStatus.Status = STATUS_CANCELLED; ! pIrpCurrent->IoStatus.Information = 0; ! InsertTailList(pQueueToComplete, &pIrpCurrent->Tail.Overlay.ListEntry); ! continue; ! } ! } ! break; } ! ShiftQueue(pQueue); ! pIrpCurrent->IoStatus.Status = statusCurrent; ! InsertTailList(pQueueToComplete, &pIrpCurrent->Tail.Overlay.ListEntry); } ! if (status == STATUS_PENDING) { ! switch (ioType) { ! case C0C_IO_TYPE_WRITE: ! HALT_UNLESS(pParam); ! status = WriteBuffer((PIRP)pParam, pIoPort, pQueueToComplete); break; ! case C0C_IO_TYPE_INSERT: ! HALT_UNLESS(pParam); ! status = InsertBuffer((PC0C_RAW_DATA)pParam, &pIoPort->readBuf); break; } } return status; } --- 601,762 ---- case C0C_IO_TYPE_INSERT: HALT_UNLESS(pParam); ! InsertDirect((PC0C_RAW_DATA)pParam, pIrpCurrent, &status, &statusCurrent, &pIoPort->readBuf, &doneCurrent); break; } ! statusCurrent = StopCurrentIrp(statusCurrent, ! pCancelRoutineCurrent, ! firstCurrent, ! doneCurrent, ! pIoPort, ! pQueue, ! pQueueToComplete); ! if (statusCurrent == STATUS_PENDING) ! break; ! } ! ! if (status == STATUS_PENDING) { ! switch (ioType) { ! case C0C_IO_TYPE_INSERT: ! HALT_UNLESS(pParam); ! status = InsertBuffer((PC0C_RAW_DATA)pParam, &pIoPort->readBuf); ! break; } + } + return status; + } ! NTSTATUS ReadWrite( ! PC0C_IO_PORT pIoPortRead, ! PC0C_IRP_QUEUE pQueueRead, ! BOOLEAN startRead, ! PC0C_IO_PORT pIoPortWrite, ! PC0C_IRP_QUEUE pQueueWrite, ! BOOLEAN startWrite, ! PLIST_ENTRY pQueueToComplete) ! { ! NTSTATUS status; ! BOOLEAN firstRead; ! PC0C_ADAPTIVE_DELAY pWriteDelay; ! SIZE_T writeLimit; ! PSIZE_T pWriteLimit; ! pWriteDelay = pIoPortWrite->pWriteDelay; ! if (pWriteDelay) { ! if (pQueueWrite->pCurrent) { ! StartWriteDelayTimer(pWriteDelay); ! writeLimit = GetWriteLimit(pWriteDelay); ! status = STATUS_PENDING; ! } else { ! StopWriteDelayTimer(pWriteDelay); ! writeLimit = 0; ! status = STATUS_SUCCESS; } ! pWriteLimit = &writeLimit; ! } else { ! status = STATUS_SUCCESS; ! pWriteLimit = NULL; } ! for (firstRead = TRUE ;; firstRead = FALSE) { ! NTSTATUS statusRead; ! PDRIVER_CANCEL pCancelRoutineRead; ! PIRP pIrpRead; ! SIZE_T doneRead; ! BOOLEAN firstWrite; ! ! if (startRead) { ! pIrpRead = pQueueRead->pCurrent; ! pCancelRoutineRead = NULL; ! } else { ! pIrpRead = StartCurrentIrp(pQueueRead, &pCancelRoutineRead, &firstRead); ! } ! ! doneRead = 0; ! ! if (pIrpRead) ! statusRead = ReadBuffer(pIrpRead, &pIoPortRead->readBuf, &doneRead); ! else ! statusRead = STATUS_SUCCESS; ! ! for (firstWrite = TRUE ; !pWriteLimit || *pWriteLimit ; firstWrite = FALSE) { ! NTSTATUS statusWrite; ! PDRIVER_CANCEL pCancelRoutineWrite; ! PIRP pIrpWrite; ! SIZE_T doneWrite; ! ! if(startWrite) { ! pIrpWrite = pQueueWrite->pCurrent; ! pCancelRoutineWrite = NULL; ! } else { ! pIrpWrite = StartCurrentIrp(pQueueWrite, startWrite ? NULL : &pCancelRoutineWrite, &firstWrite); ! } ! ! if (!pIrpWrite) ! break; ! ! statusWrite = STATUS_PENDING; ! ! doneWrite = 0; ! ! if (statusRead == STATUS_PENDING) ! ReadWriteDirect( ! pIrpRead, pIrpWrite, ! &statusRead, &statusWrite, ! pIoPortRead, ! pQueueToComplete, ! pWriteLimit, ! &doneRead, &doneWrite); ! ! if (statusWrite == STATUS_PENDING) ! statusWrite = WriteBuffer(pIrpWrite, pIoPortRead, pQueueToComplete, pWriteLimit, &doneWrite); ! ! if (pWriteDelay) ! pWriteDelay->sentFrames += doneWrite; ! ! if (startWrite) { ! status = statusWrite; ! if (status == STATUS_PENDING) ! status = FdoPortSetIrpTimeout(pIoPortWrite->pDevExt, pIrpWrite); ! break; ! } ! ! statusWrite = StopCurrentIrp(statusWrite, ! pCancelRoutineWrite, ! firstWrite, ! doneWrite, ! pIoPortWrite, ! pQueueWrite, ! pQueueToComplete); ! ! if (statusWrite == STATUS_PENDING) ! break; ! } ! ! if (!pIrpRead) break; ! ! if (startRead) { ! status = statusRead; ! if (status == STATUS_PENDING) ! status = FdoPortSetIrpTimeout(pIoPortRead->pDevExt, pIrpRead); break; } + + statusRead = StopCurrentIrp(statusRead, + pCancelRoutineRead, + firstRead, + doneRead, + pIoPortRead, + pQueueRead, + pQueueToComplete); + + if (statusRead == STATUS_PENDING) + break; } + return status; } Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** com0com.h 13 Jul 2005 16:12:36 -0000 1.10 --- com0com.h 23 Aug 2005 15:49:21 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2005/08/23 15:49:21 vfrolov + * Implemented baudrate emulation + * * Revision 1.10 2005/07/13 16:12:36 vfrolov * Added c0cGlobal struct for global driver's data *************** *** 119,126 **** struct _C0C_FDOPORT_EXTENSION; typedef struct _C0C_IO_PORT { ! struct _C0C_FDOPORT_EXTENSION *pDevExt; #define C0C_QUEUE_READ 0 --- 122,130 ---- struct _C0C_FDOPORT_EXTENSION; + struct _C0C_ADAPTIVE_DELAY; typedef struct _C0C_IO_PORT { ! struct _C0C_FDOPORT_EXTENSION *pDevExt; #define C0C_QUEUE_READ 0 *************** *** 142,145 **** --- 146,151 ---- KDPC timerWriteTotalDpc; + struct _C0C_ADAPTIVE_DELAY *pWriteDelay; + ULONG waitMask; ULONG eventMask; *************** *** 285,290 **** PC0C_IRP_STATE GetIrpState(IN PIRP pIrp); - #define C0C_IO_TYPE_READ 1 - #define C0C_IO_TYPE_WRITE 2 #define C0C_IO_TYPE_WAIT_COMPLETE 3 #define C0C_IO_TYPE_INSERT 4 --- 291,294 ---- *************** *** 297,300 **** --- 301,313 ---- PLIST_ENTRY pQueueToComplete); + NTSTATUS ReadWrite( + PC0C_IO_PORT pIoPortRead, + PC0C_IRP_QUEUE pQueueRead, + BOOLEAN startRead, + PC0C_IO_PORT pIoPortWrite, + PC0C_IRP_QUEUE pQueueWrite, + BOOLEAN startWrite, + PLIST_ENTRY pQueueToComplete); + VOID SetModemStatus( IN PC0C_IO_PORT pIoPort, Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/adddev.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** adddev.c 16 Aug 2005 16:36:33 -0000 1.7 --- adddev.c 23 Aug 2005 15:49:21 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2005/08/23 15:49:21 vfrolov + * Implemented baudrate emulation + * * Revision 1.7 2005/08/16 16:36:33 vfrolov * Hidden timeout functions *************** *** 46,49 **** --- 49,53 ---- #include "precomp.h" #include "timeout.h" + #include "delay.h" #include "strutils.h" *************** *** 68,81 **** if (pDevExt->pIoPortLocal && pDevExt->pIoPortLocal->pDevExt) { pDevExt->pIoPortLocal->pDevExt = NULL; ! ! KeCancelTimer(&pDevExt->pIoPortLocal->timerReadTotal); ! KeCancelTimer(&pDevExt->pIoPortLocal->timerReadInterval); ! KeCancelTimer(&pDevExt->pIoPortLocal->timerWriteTotal); ! ! KeRemoveQueueDpc(&pDevExt->pIoPortLocal->timerReadTotalDpc); ! KeRemoveQueueDpc(&pDevExt->pIoPortLocal->timerReadIntervalDpc); ! KeRemoveQueueDpc(&pDevExt->pIoPortLocal->timerWriteTotalDpc); } if (pDevExt->mappedSerialDevice) RtlDeleteRegistryValue(RTL_REGISTRY_DEVICEMAP, C0C_SERIAL_DEVICEMAP, --- 72,80 ---- if (pDevExt->pIoPortLocal && pDevExt->pIoPortLocal->pDevExt) { pDevExt->pIoPortLocal->pDevExt = NULL; ! FreeTimeouts(pDevExt); } + FreeWriteDelay(pDevExt); + if (pDevExt->mappedSerialDevice) RtlDeleteRegistryValue(RTL_REGISTRY_DEVICEMAP, C0C_SERIAL_DEVICEMAP, *************** *** 102,105 **** --- 101,105 ---- PDEVICE_OBJECT pNewDevObj; PC0C_FDOPORT_EXTENSION pDevExt = NULL; + ULONG emuBR = 0; WCHAR propertyBuffer[255]; PWCHAR pPortName; *************** *** 119,123 **** } ! Trace00(NULL, L"AddFdoPort for ", propertyBuffer); for (pPortName = NULL, i = 0 ; propertyBuffer[i] ; i++) --- 119,123 ---- } ! Trace00((PC0C_COMMON_EXTENSION)pPhDevObj->DeviceExtension, L"AddFdoPort for ", propertyBuffer); for (pPortName = NULL, i = 0 ; propertyBuffer[i] ; i++) *************** *** 131,139 **** } { - WCHAR portNameBuf[C0C_PORT_NAME_LEN]; - UNICODE_STRING portNameTmp; UNICODE_STRING portRegistryPath; - RTL_QUERY_REGISTRY_TABLE queryTable[2]; RtlInitUnicodeString(&portRegistryPath, NULL); --- 131,138 ---- } + RtlInitUnicodeString(&portName, NULL); + { UNICODE_STRING portRegistryPath; RtlInitUnicodeString(&portRegistryPath, NULL); *************** *** 142,178 **** StrAppendStr0(&status, &portRegistryPath, pPortName); ! if (!NT_SUCCESS(status)) { ! SysLog(pPhDevObj, status, L"AddFdoPort FAIL"); ! goto clean; ! } ! RtlZeroMemory(queryTable, sizeof(queryTable)); ! portNameTmp.Length = 0; ! portNameTmp.MaximumLength = sizeof(portNameBuf); ! portNameTmp.Buffer = portNameBuf; ! queryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED; ! queryTable[0].Name = L"PortName"; ! queryTable[0].EntryContext = &portNameTmp; ! status = RtlQueryRegistryValues( ! RTL_REGISTRY_ABSOLUTE, ! portRegistryPath.Buffer, ! queryTable, ! NULL, ! NULL); ! StrFree(&portRegistryPath); ! RtlInitUnicodeString(&portName, NULL); ! if (!NT_SUCCESS(status) || !portNameTmp.Length) { ! status = STATUS_SUCCESS; ! StrAppendStr0(&status, &portName, pPortName); ! } else { ! StrAppendStr(&status, &portName, portNameTmp.Buffer, portNameTmp.Length); ! Trace00(NULL, L"PortName set to ", portName.Buffer); } } --- 141,197 ---- StrAppendStr0(&status, &portRegistryPath, pPortName); ! if (NT_SUCCESS(status)) { ! WCHAR portNameBuf[C0C_PORT_NAME_LEN]; ! UNICODE_STRING portNameTmp; ! RTL_QUERY_REGISTRY_TABLE queryTable[2]; ! RtlZeroMemory(queryTable, sizeof(queryTable)); ! portNameTmp.Length = 0; ! portNameTmp.MaximumLength = sizeof(portNameBuf); ! portNameTmp.Buffer = portNameBuf; ! queryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED; ! queryTable[0].Name = L"PortName"; ! queryTable[0].EntryContext = &portNameTmp; ! status = RtlQueryRegistryValues( ! RTL_REGISTRY_ABSOLUTE, ! portRegistryPath.Buffer, ! queryTable, ! NULL, ! NULL); ! if (!NT_SUCCESS(status) || !portNameTmp.Length) { ! status = STATUS_SUCCESS; ! StrAppendStr0(&status, &portName, pPortName); ! } else { ! StrAppendStr(&status, &portName, portNameTmp.Buffer, portNameTmp.Length); ! Trace00((PC0C_COMMON_EXTENSION)pPhDevObj->DeviceExtension, L"PortName set to ", portName.Buffer); ! } ! } ! if (NT_SUCCESS(status)) { ! RTL_QUERY_REGISTRY_TABLE queryTable[2]; ! ULONG zero = 0; ! RtlZeroMemory(queryTable, sizeof(queryTable)); ! ! queryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; ! queryTable[0].Name = L"EmuBR"; ! queryTable[0].EntryContext = &emuBR; ! queryTable[0].DefaultType = REG_DWORD; ! queryTable[0].DefaultData = &zero; ! queryTable[0].DefaultLength = sizeof(ULONG); ! ! RtlQueryRegistryValues( ! RTL_REGISTRY_ABSOLUTE, ! portRegistryPath.Buffer, ! queryTable, ! NULL, ! NULL); } + + StrFree(&portRegistryPath); } *************** *** 216,220 **** pDevExt->pIoPortRemote = ((PC0C_PDOPORT_EXTENSION)pPhDevObj->DeviceExtension)->pIoPortRemote; ! InitializeTimeoutDpc(pDevExt); KeInitializeSpinLock(&pDevExt->controlLock); --- 235,243 ---- pDevExt->pIoPortRemote = ((PC0C_PDOPORT_EXTENSION)pPhDevObj->DeviceExtension)->pIoPortRemote; ! if (emuBR) { ! if (NT_SUCCESS(AllocWriteDelay(pDevExt))) ! Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Enabled baudrate emulation"); ! } ! AllocTimeouts(pDevExt); KeInitializeSpinLock(&pDevExt->controlLock); *************** *** 228,231 **** --- 251,256 ---- pDevExt->baudRate.BaudRate = 1200; + SetWriteDelay(pDevExt); + status = IoCreateSymbolicLink(&pDevExt->win32DeviceName, &pDevExt->ntDeviceName); *************** *** 343,349 **** InitializeListHead(&pIoPortLocal->irpQueues[i].queue); pIoPortLocal->irpQueues[i].pCurrent = NULL; - KeInitializeTimer(&pIoPortLocal->timerReadTotal); - KeInitializeTimer(&pIoPortLocal->timerReadInterval); - KeInitializeTimer(&pIoPortLocal->timerWriteTotal); } --- 368,371 ---- Index: sources =================================================================== RCS file: /cvsroot/com0com/com0com/sources,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sources 26 Jan 2005 12:18:54 -0000 1.1 --- sources 23 Aug 2005 15:49:21 -0000 1.2 *************** *** 19,22 **** --- 19,23 ---- startirp.c \ timeout.c \ + delay.c \ strutils.c \ syslog.c \ Index: timeout.h =================================================================== RCS file: /cvsroot/com0com/com0com/timeout.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** timeout.h 16 Aug 2005 16:36:33 -0000 1.2 --- timeout.h 23 Aug 2005 15:49:21 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2005/08/23 15:49:21 vfrolov + * Implemented baudrate emulation + * * Revision 1.2 2005/08/16 16:36:33 vfrolov * Hidden timeout functions *************** *** 32,36 **** #define _C0C_TIMEOUT_H_ ! VOID InitializeTimeoutDpc(IN PC0C_FDOPORT_EXTENSION pDevExt); NTSTATUS FdoPortSetIrpTimeout( --- 35,42 ---- #define _C0C_TIMEOUT_H_ ! VOID AllocTimeouts(IN PC0C_FDOPORT_EXTENSION pDevExt); ! VOID FreeTimeouts(IN PC0C_FDOPORT_EXTENSION pDevExt); ! ! VOID SetIntervalTimeout(PC0C_IO_PORT pIoPort); NTSTATUS FdoPortSetIrpTimeout( Index: write.c =================================================================== RCS file: /cvsroot/com0com/com0com/write.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** write.c 26 Jan 2005 12:18:54 -0000 1.1 --- write.c 23 Aug 2005 15:49:21 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/08/23 15:49:21 vfrolov + * Implemented baudrate emulation + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 27,31 **** #include "precomp.h" - #include "timeout.h" NTSTATUS StartIrpWrite( --- 30,33 ---- *************** *** 33,51 **** IN PLIST_ENTRY pQueueToComplete) { ! NTSTATUS status; ! PIRP pIrp; ! ! pIrp = pDevExt->pIoPortLocal->irpQueues[C0C_QUEUE_WRITE].pCurrent; ! ! status = FdoPortIo(C0C_IO_TYPE_WRITE, ! pIrp, ! pDevExt->pIoPortRemote, ! &pDevExt->pIoPortRemote->irpQueues[C0C_QUEUE_READ], ! pQueueToComplete); ! ! if (status == STATUS_PENDING) ! status = FdoPortSetIrpTimeout(pDevExt, pIrp); ! ! return status; } --- 35,46 ---- IN PLIST_ENTRY pQueueToComplete) { ! return ReadWrite( ! pDevExt->pIoPortRemote, ! &pDevExt->pIoPortRemote->irpQueues[C0C_QUEUE_READ], ! FALSE, ! pDevExt->pIoPortLocal, ! &pDevExt->pIoPortLocal->irpQueues[C0C_QUEUE_WRITE], ! TRUE, ! pQueueToComplete); } Index: read.c =================================================================== RCS file: /cvsroot/com0com/com0com/read.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** read.c 26 Jan 2005 12:18:54 -0000 1.1 --- read.c 23 Aug 2005 15:49:21 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/08/23 15:49:21 vfrolov + * Implemented baudrate emulation + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 27,31 **** #include "precomp.h" - #include "timeout.h" NTSTATUS StartIrpRead( --- 30,33 ---- *************** *** 33,51 **** IN PLIST_ENTRY pQueueToComplete) { ! NTSTATUS status; ! PIRP pIrp; ! ! pIrp = pDevExt->pIoPortLocal->irpQueues[C0C_QUEUE_READ].pCurrent; ! ! status = FdoPortIo(C0C_IO_TYPE_READ, ! pIrp, ! pDevExt->pIoPortRemote, ! &pDevExt->pIoPortRemote->irpQueues[C0C_QUEUE_WRITE], ! pQueueToComplete); ! ! if (status == STATUS_PENDING) ! status = FdoPortSetIrpTimeout(pDevExt, pIrp); ! ! return status; } --- 35,46 ---- IN PLIST_ENTRY pQueueToComplete) { ! return ReadWrite( ! pDevExt->pIoPortLocal, ! &pDevExt->pIoPortLocal->irpQueues[C0C_QUEUE_READ], ! TRUE, ! pDevExt->pIoPortRemote, ! &pDevExt->pIoPortRemote->irpQueues[C0C_QUEUE_WRITE], ! FALSE, ! pQueueToComplete); } Index: timeout.c =================================================================== RCS file: /cvsroot/com0com/com0com/timeout.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** timeout.c 16 Aug 2005 16:36:33 -0000 1.3 --- timeout.c 23 Aug 2005 15:49:21 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2005/08/23 15:49:21 vfrolov + * Implemented baudrate emulation + * * Revision 1.3 2005/08/16 16:36:33 vfrolov * Hidden timeout functions *************** *** 80,84 **** { SERIAL_TIMEOUTS timeouts; - KIRQL oldIrql; BOOLEAN setTotal; ULONG multiplier; --- 83,86 ---- *************** *** 92,98 **** HALT_UNLESS(pState); ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); timeouts = pDevExt->timeouts; ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); if (timeouts.ReadIntervalTimeout == MAXULONG && --- 94,100 ---- HALT_UNLESS(pState); ! KeAcquireSpinLockAtDpcLevel(&pDevExt->controlLock); timeouts = pDevExt->timeouts; ! KeReleaseSpinLockFromDpcLevel(&pDevExt->controlLock); if (timeouts.ReadIntervalTimeout == MAXULONG && *************** *** 130,141 **** pState->flags |= C0C_IRP_FLAG_INTERVAL_TIMEOUT; ! pDevExt->pIoPortLocal->timeoutInterval.QuadPart = ((LONGLONG)timeouts.ReadIntervalTimeout) * -10000; if (pIrp->IoStatus.Information) ! KeSetTimer( ! &pDevExt->pIoPortLocal->timerReadInterval, ! pDevExt->pIoPortLocal->timeoutInterval, ! &pDevExt->pIoPortLocal->timerReadIntervalDpc); } } --- 132,140 ---- pState->flags |= C0C_IRP_FLAG_INTERVAL_TIMEOUT; ! pDevExt->pIoPortLocal->timeoutInterval.QuadPart = ((LONGLONG)timeouts.ReadIntervalTimeout) * -10000; if (pIrp->IoStatus.Information) ! SetIntervalTimeout(pDevExt->pIoPortLocal); } } *************** *** 161,165 **** { SERIAL_TIMEOUTS timeouts; - KIRQL oldIrql; BOOLEAN setTotal; ULONG multiplier; --- 160,163 ---- *************** *** 168,174 **** KeCancelTimer(&pDevExt->pIoPortLocal->timerWriteTotal); ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); timeouts = pDevExt->timeouts; ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); setTotal = FALSE; --- 166,172 ---- KeCancelTimer(&pDevExt->pIoPortLocal->timerWriteTotal); ! KeAcquireSpinLockAtDpcLevel(&pDevExt->controlLock); timeouts = pDevExt->timeouts; ! KeReleaseSpinLockFromDpcLevel(&pDevExt->controlLock); setTotal = FALSE; *************** *** 244,249 **** } ! VOID InitializeTimeoutDpc(IN PC0C_FDOPORT_EXTENSION pDevExt) { KeInitializeDpc(&pDevExt->pIoPortLocal->timerReadTotalDpc, TimeoutReadTotal, pDevExt); KeInitializeDpc(&pDevExt->pIoPortLocal->timerReadIntervalDpc, TimeoutReadInterval, pDevExt); --- 242,251 ---- } ! VOID AllocTimeouts(IN PC0C_FDOPORT_EXTENSION pDevExt) { + KeInitializeTimer(&pDevExt->pIoPortLocal->timerReadTotal); + KeInitializeTimer(&pDevExt->pIoPortLocal->timerReadInterval); + KeInitializeTimer(&pDevExt->pIoPortLocal->timerWriteTotal); + KeInitializeDpc(&pDevExt->pIoPortLocal->timerReadTotalDpc, TimeoutReadTotal, pDevExt); KeInitializeDpc(&pDevExt->pIoPortLocal->timerReadIntervalDpc, TimeoutReadInterval, pDevExt); *************** *** 251,254 **** --- 253,272 ---- } + VOID FreeTimeouts(IN PC0C_FDOPORT_EXTENSION pDevExt) + { + KeCancelTimer(&pDevExt->pIoPortLocal->timerReadTotal); + KeCancelTimer(&pDevExt->pIoPortLocal->timerReadInterval); + KeCancelTimer(&pDevExt->pIoPortLocal->timerWriteTotal); + + KeRemoveQueueDpc(&pDevExt->pIoPortLocal->timerReadTotalDpc); + KeRemoveQueueDpc(&pDevExt->pIoPortLocal->timerReadIntervalDpc); + KeRemoveQueueDpc(&pDevExt->pIoPortLocal->timerWriteTotalDpc); + } + + VOID SetIntervalTimeout(PC0C_IO_PORT pIoPort) + { + KeSetTimer(&pIoPort->timerReadInterval, pIoPort->timeoutInterval, &pIoPort->timerReadIntervalDpc); + } + NTSTATUS FdoPortSetIrpTimeout( IN PC0C_FDOPORT_EXTENSION pDevExt, |
From: Vyacheslav F. <vf...@us...> - 2005-08-23 15:30:30
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28712 Added Files: delay.c delay.h Log Message: Initial revision --- NEW FILE: delay.h --- /* * $Id: delay.h,v 1.1 2005/08/23 15:30:22 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: delay.h,v $ * Revision 1.1 2005/08/23 15:30:22 vfrolov * Initial revision * * */ #ifndef _C0C_DELAY_H_ #define _C0C_DELAY_H_ typedef struct _C0C_DELAY_PARAMS { ULONG decibits_per_frame; ULONG baudRate; } C0C_DELAY_PARAMS, *PC0C_DELAY_PARAMS; typedef struct _C0C_ADAPTIVE_DELAY { KTIMER timer; KDPC timerDpc; C0C_DELAY_PARAMS params; ULONGLONG startTime; ULONGLONG sentFrames; BOOLEAN started; } C0C_ADAPTIVE_DELAY, *PC0C_ADAPTIVE_DELAY; NTSTATUS AllocWriteDelay(IN PC0C_FDOPORT_EXTENSION pDevExt); VOID FreeWriteDelay(IN PC0C_FDOPORT_EXTENSION pDevExt); SIZE_T GetWriteLimit(PC0C_ADAPTIVE_DELAY pWriteDelay); VOID SetWriteDelay(IN PC0C_FDOPORT_EXTENSION pDevExt); VOID StartWriteDelayTimer(PC0C_ADAPTIVE_DELAY pWriteDelay); VOID StopWriteDelayTimer(PC0C_ADAPTIVE_DELAY pWriteDelay); #endif /* _C0C_DELAY_H_ */ --- NEW FILE: delay.c --- /* * $Id: delay.c,v 1.1 2005/08/23 15:30:22 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: delay.c,v $ * Revision 1.1 2005/08/23 15:30:22 vfrolov * Initial revision * * */ #include "precomp.h" #include "delay.h" /* * FILE_ID used by HALT_UNLESS to put it on BSOD */ #define FILE_ID 7 VOID WriteDelayRoutine( IN PKDPC pDpc, IN PVOID deferredContext, IN PVOID systemArgument1, IN PVOID systemArgument2) { PC0C_FDOPORT_EXTENSION pDevExt; PC0C_ADAPTIVE_DELAY pWriteDelay; UNREFERENCED_PARAMETER(pDpc); UNREFERENCED_PARAMETER(systemArgument1); UNREFERENCED_PARAMETER(systemArgument2); pDevExt = (PC0C_FDOPORT_EXTENSION)deferredContext; pWriteDelay = pDevExt->pIoPortLocal->pWriteDelay; if (pWriteDelay) { LIST_ENTRY queueToComplete; KIRQL oldIrql; InitializeListHead(&queueToComplete); KeAcquireSpinLock(pDevExt->pIoLock, &oldIrql); if (pWriteDelay->started) { NTSTATUS status; status = ReadWrite( pDevExt->pIoPortRemote, &pDevExt->pIoPortRemote->irpQueues[C0C_QUEUE_READ], FALSE, pDevExt->pIoPortLocal, &pDevExt->pIoPortLocal->irpQueues[C0C_QUEUE_WRITE], FALSE, &queueToComplete); if (status != STATUS_PENDING) StopWriteDelayTimer(pWriteDelay); } KeReleaseSpinLock(pDevExt->pIoLock, oldIrql); FdoPortCompleteQueue(&queueToComplete); } } SIZE_T GetWriteLimit(PC0C_ADAPTIVE_DELAY pWriteDelay) { ULONGLONG curTime; ULONGLONG maxFrames; HALT_UNLESS(pWriteDelay); curTime = KeQueryInterruptTime(); HALT_UNLESS(pWriteDelay->params.decibits_per_frame); maxFrames = ((curTime - pWriteDelay->startTime) * pWriteDelay->params.baudRate)/ (pWriteDelay->params.decibits_per_frame * 1000000L); if (maxFrames < pWriteDelay->sentFrames) return 0; return (SIZE_T)(maxFrames - pWriteDelay->sentFrames); } NTSTATUS AllocWriteDelay(IN PC0C_FDOPORT_EXTENSION pDevExt) { PC0C_ADAPTIVE_DELAY pWriteDelay; pWriteDelay = (PC0C_ADAPTIVE_DELAY)ExAllocatePool(NonPagedPool, sizeof(*pWriteDelay)); if (!pWriteDelay) return STATUS_INSUFFICIENT_RESOURCES; RtlZeroMemory(pWriteDelay, sizeof(*pWriteDelay)); KeInitializeTimer(&pWriteDelay->timer); KeInitializeDpc(&pWriteDelay->timerDpc, WriteDelayRoutine, pDevExt); pDevExt->pIoPortLocal->pWriteDelay = pWriteDelay; return STATUS_SUCCESS; } VOID FreeWriteDelay(IN PC0C_FDOPORT_EXTENSION pDevExt) { PC0C_ADAPTIVE_DELAY pWriteDelay; pWriteDelay = pDevExt->pIoPortLocal->pWriteDelay; if (pWriteDelay) { pDevExt->pIoPortLocal->pWriteDelay = NULL; StopWriteDelayTimer(pWriteDelay); ExFreePool(pWriteDelay); } } VOID SetWriteDelay(IN PC0C_FDOPORT_EXTENSION pDevExt) { PC0C_ADAPTIVE_DELAY pWriteDelay; KIRQL oldIrql; C0C_DELAY_PARAMS params; SERIAL_LINE_CONTROL lineControl; pWriteDelay = pDevExt->pIoPortLocal->pWriteDelay; if (!pWriteDelay) return; KeAcquireSpinLock(pDevExt->pIoLock, &oldIrql); KeAcquireSpinLockAtDpcLevel(&pDevExt->controlLock); lineControl = pDevExt->lineControl; params.baudRate = pDevExt->baudRate.BaudRate; KeReleaseSpinLockFromDpcLevel(&pDevExt->controlLock); /* Startbit + WordLength */ params.decibits_per_frame = (1 + lineControl.WordLength) * 10; switch (lineControl.Parity) { case NO_PARITY: break; default: case ODD_PARITY: case EVEN_PARITY: case MARK_PARITY: case SPACE_PARITY: params.decibits_per_frame += 10; break; } switch (lineControl.StopBits) { default: case STOP_BIT_1: params.decibits_per_frame += 10; break; case STOP_BITS_1_5: params.decibits_per_frame += 15; break; case STOP_BITS_2: params.decibits_per_frame += 30; break; } if (pWriteDelay->params.baudRate != params.baudRate || pWriteDelay->params.decibits_per_frame != params.decibits_per_frame) { pWriteDelay->params = params; if (pWriteDelay->started) { StopWriteDelayTimer(pWriteDelay); StartWriteDelayTimer(pWriteDelay); } } KeReleaseSpinLock(pDevExt->pIoLock, oldIrql); } VOID StartWriteDelayTimer(PC0C_ADAPTIVE_DELAY pWriteDelay) { LARGE_INTEGER dueTime; ULONG period; ULONG intervals_100ns; if (pWriteDelay->started) return; if (!pWriteDelay->params.baudRate) return; pWriteDelay->startTime = KeQueryInterruptTime(); pWriteDelay->sentFrames = 0; /* 100-nanosecond intervals per frame */ intervals_100ns = (pWriteDelay->params.decibits_per_frame * 1000000L)/pWriteDelay->params.baudRate; if (!intervals_100ns) intervals_100ns = 1; period = intervals_100ns/10000; /* 1-millisecond intervals per frame */ dueTime.QuadPart = -(LONGLONG)intervals_100ns; if (!period) period = 1; KeSetTimerEx( &pWriteDelay->timer, dueTime, period, &pWriteDelay->timerDpc); pWriteDelay->started = TRUE; } VOID StopWriteDelayTimer(PC0C_ADAPTIVE_DELAY pWriteDelay) { pWriteDelay->started = FALSE; KeCancelTimer(&pWriteDelay->timer); KeRemoveQueueDpc(&pWriteDelay->timerDpc); } |
From: Vyacheslav F. <vf...@us...> - 2005-08-23 15:28:36
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28297 Modified Files: trace.c Log Message: Added build timestamp Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/trace.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** trace.c 14 Jul 2005 13:51:09 -0000 1.7 --- trace.c 23 Aug 2005 15:28:26 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2005/08/23 15:28:26 vfrolov + * Added build timestamp + * * Revision 1.7 2005/07/14 13:51:09 vfrolov * Replaced ASSERT by HALT_UNLESS *************** *** 917,920 **** --- 920,924 ---- TraceF(NULL, "===== BEGIN ====="); + TraceF(NULL, "(" __DATE__ " " __TIME__ ")"); } } |
From: Vyacheslav F. <vf...@us...> - 2005-08-16 16:36:41
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31074 Modified Files: adddev.c timeout.c timeout.h Log Message: Hidden timeout functions Index: timeout.c =================================================================== RCS file: /cvsroot/com0com/com0com/timeout.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** timeout.c 14 Jul 2005 13:51:09 -0000 1.2 --- timeout.c 16 Aug 2005 16:36:33 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2005/08/16 16:36:33 vfrolov + * Hidden timeout functions + * * Revision 1.2 2005/07/14 13:51:09 vfrolov * Replaced ASSERT by HALT_UNLESS *************** *** 241,244 **** --- 244,254 ---- } + VOID InitializeTimeoutDpc(IN PC0C_FDOPORT_EXTENSION pDevExt) + { + KeInitializeDpc(&pDevExt->pIoPortLocal->timerReadTotalDpc, TimeoutReadTotal, pDevExt); + KeInitializeDpc(&pDevExt->pIoPortLocal->timerReadIntervalDpc, TimeoutReadInterval, pDevExt); + KeInitializeDpc(&pDevExt->pIoPortLocal->timerWriteTotalDpc, TimeoutWriteTotal, pDevExt); + } + NTSTATUS FdoPortSetIrpTimeout( IN PC0C_FDOPORT_EXTENSION pDevExt, Index: timeout.h =================================================================== RCS file: /cvsroot/com0com/com0com/timeout.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** timeout.h 26 Jan 2005 12:18:54 -0000 1.1 --- timeout.h 16 Aug 2005 16:36:33 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/08/16 16:36:33 vfrolov + * Hidden timeout functions + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 29,49 **** #define _C0C_TIMEOUT_H_ ! VOID TimeoutReadTotal( ! IN PKDPC pDpc, ! IN PVOID deferredContext, ! IN PVOID systemArgument1, ! IN PVOID systemArgument2); ! ! VOID TimeoutReadInterval( ! IN PKDPC pDpc, ! IN PVOID deferredContext, ! IN PVOID systemArgument1, ! IN PVOID systemArgument2); ! ! VOID TimeoutWriteTotal( ! IN PKDPC pDpc, ! IN PVOID deferredContext, ! IN PVOID systemArgument1, ! IN PVOID systemArgument2); NTSTATUS FdoPortSetIrpTimeout( --- 32,36 ---- #define _C0C_TIMEOUT_H_ ! VOID InitializeTimeoutDpc(IN PC0C_FDOPORT_EXTENSION pDevExt); NTSTATUS FdoPortSetIrpTimeout( Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/adddev.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** adddev.c 14 Jul 2005 13:51:08 -0000 1.6 --- adddev.c 16 Aug 2005 16:36:33 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2005/08/16 16:36:33 vfrolov + * Hidden timeout functions + * * Revision 1.6 2005/07/14 13:51:08 vfrolov * Replaced ASSERT by HALT_UNLESS *************** *** 213,219 **** pDevExt->pIoPortRemote = ((PC0C_PDOPORT_EXTENSION)pPhDevObj->DeviceExtension)->pIoPortRemote; ! KeInitializeDpc(&pDevExt->pIoPortLocal->timerReadTotalDpc, TimeoutReadTotal, pDevExt); ! KeInitializeDpc(&pDevExt->pIoPortLocal->timerReadIntervalDpc, TimeoutReadInterval, pDevExt); ! KeInitializeDpc(&pDevExt->pIoPortLocal->timerWriteTotalDpc, TimeoutWriteTotal, pDevExt); KeInitializeSpinLock(&pDevExt->controlLock); --- 216,220 ---- pDevExt->pIoPortRemote = ((PC0C_PDOPORT_EXTENSION)pPhDevObj->DeviceExtension)->pIoPortRemote; ! InitializeTimeoutDpc(pDevExt); KeInitializeSpinLock(&pDevExt->controlLock); |
From: Vyacheslav F. <vf...@us...> - 2005-07-14 16:06:37
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5339 Modified Files: com0com.inf com0com.rc Log Message: Changed version Index: com0com.inf =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.inf,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** com0com.inf 8 Jul 2005 14:07:21 -0000 1.2 --- com0com.inf 14 Jul 2005 16:06:23 -0000 1.3 *************** *** 15,19 **** ClassGUID = {df799e12-3c56-421b-b298-b6d3642bc878} CatalogFile = com0com.cat ! DriverVer = 02/18/2004,1.0.0.0 ;****************************************************************************** --- 15,19 ---- ClassGUID = {df799e12-3c56-421b-b298-b6d3642bc878} CatalogFile = com0com.cat ! DriverVer = 02/18/2004,1.2.0.0 ;****************************************************************************** Index: com0com.rc =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.rc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** com0com.rc 22 Jun 2005 14:59:28 -0000 1.4 --- com0com.rc 14 Jul 2005 16:06:23 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2005/07/14 16:06:23 vfrolov + * Changed version + * * Revision 1.4 2005/06/22 14:59:28 vfrolov * Changed version *************** *** 36,41 **** #include "c0clog.rc" ! #define VER_VERSION 1,1,1,0 ! #define VER_VERSION_STR "1.1.1.0" #define VER_PODUCT_NAME_STR "Null-modem emulator" --- 39,44 ---- #include "c0clog.rc" ! #define VER_VERSION 1,2,0,0 ! #define VER_VERSION_STR "1.2.0.0" #define VER_PODUCT_NAME_STR "Null-modem emulator" |
From: Vyacheslav F. <vf...@us...> - 2005-07-14 13:53:53
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8633 Modified Files: trace.reg Log Message: Changed drive letter to C Index: trace.reg =================================================================== RCS file: /cvsroot/com0com/com0com/trace.reg,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** trace.reg 26 Jan 2005 12:18:54 -0000 1.1 --- trace.reg 14 Jul 2005 13:53:45 -0000 1.2 *************** *** 2,6 **** [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Trace] ! "TraceFile"="\\??\\F:\\com0com.log" [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Trace\Enable] --- 2,6 ---- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Trace] ! "TraceFile"="\\??\\C:\\com0com.log" [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Trace\Enable] |
From: Vyacheslav F. <vf...@us...> - 2005-07-14 13:51:25
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7982 Modified Files: pnp.c adddev.c startirp.c timeout.c trace.c Log Message: Replaced ASSERT by HALT_UNLESS Index: startirp.c =================================================================== RCS file: /cvsroot/com0com/com0com/startirp.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** startirp.c 26 Jan 2005 12:18:54 -0000 1.1 --- startirp.c 14 Jul 2005 13:51:09 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/07/14 13:51:09 vfrolov + * Replaced ASSERT by HALT_UNLESS + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 28,31 **** --- 31,39 ---- #include "precomp.h" + /* + * FILE_ID used by HALT_UNLESS to put it on BSOD + */ + #define FILE_ID 2 + PC0C_IRP_STATE GetIrpState(IN PIRP pIrp) { *************** *** 55,59 **** pState = GetIrpState(pQueue->pCurrent); ! ASSERT(pState); pQueue->pCurrent = NULL; --- 63,67 ---- pState = GetIrpState(pQueue->pCurrent); ! HALT_UNLESS(pState); pQueue->pCurrent = NULL; *************** *** 71,75 **** pState = GetIrpState(pIrp); ! ASSERT(pState); pQueue->pCurrent = pIrp; --- 79,83 ---- pState = GetIrpState(pIrp); ! HALT_UNLESS(pState); pQueue->pCurrent = pIrp; *************** *** 86,90 **** pState = GetIrpState(pIrp); ! ASSERT(pState); pQueue = &pDevExt->pIoPortLocal->irpQueues[pState->iQueue]; --- 94,98 ---- pState = GetIrpState(pIrp); ! HALT_UNLESS(pState); pQueue = &pDevExt->pIoPortLocal->irpQueues[pState->iQueue]; *************** *** 128,132 **** if (pCancelRoutine) { ! ASSERT(pCancelRoutine == CancelRoutine); pIrp->Cancel = TRUE; KeReleaseSpinLock(pDevExt->pIoLock, *pOldIrql); --- 136,140 ---- if (pCancelRoutine) { ! HALT_UNLESS(pCancelRoutine == CancelRoutine); pIrp->Cancel = TRUE; KeReleaseSpinLock(pDevExt->pIoLock, *pOldIrql); *************** *** 152,156 **** pState = GetIrpState(pIrp); ! ASSERT(pState); pState->flags &= ~C0C_IRP_FLAG_IN_QUEUE; --- 160,164 ---- pState = GetIrpState(pIrp); ! HALT_UNLESS(pState); pState->flags &= ~C0C_IRP_FLAG_IN_QUEUE; *************** *** 215,219 **** pState = GetIrpState(pIrp); ! ASSERT(pState); pState->flags = 0; --- 223,227 ---- pState = GetIrpState(pIrp); ! HALT_UNLESS(pState); pState->flags = 0; Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/trace.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** trace.c 1 Jul 2005 11:03:50 -0000 1.6 --- trace.c 14 Jul 2005 13:51:09 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2005/07/14 13:51:09 vfrolov + * Replaced ASSERT by HALT_UNLESS + * * Revision 1.6 2005/07/01 11:03:50 vfrolov * Included <stdarg.h> *************** *** 46,49 **** --- 49,57 ---- #if DBG + /* + * FILE_ID used by HALT_UNLESS to put it on BSOD + */ + #define FILE_ID 4 + /********************************************************************/ #include <stdarg.h> *************** *** 213,217 **** VOID FreeTraceBuf(PTRACE_BUFFER pBuf) { ! ASSERT(pBuf); pBuf->busy = FALSE; } --- 221,225 ---- VOID FreeTraceBuf(PTRACE_BUFFER pBuf) { ! HALT_UNLESS(pBuf); pBuf->busy = FALSE; } *************** *** 750,754 **** pDestStr = AnsiStrCopyTimeFields(pDestStr, &size, &timeFields); pDestStr = AnsiStrFormat(pDestStr, &size, " *%u* %s\r\n", (unsigned)KeGetCurrentIrql(), pStr); ! ASSERT(size > 0); if (size == 1) { --- 758,762 ---- pDestStr = AnsiStrCopyTimeFields(pDestStr, &size, &timeFields); pDestStr = AnsiStrFormat(pDestStr, &size, " *%u* %s\r\n", (unsigned)KeGetCurrentIrql(), pStr); ! HALT_UNLESS3(size > 0, strOldFreeInd, strOldBusyInd, sizeof(strOld)); if (size == 1) { *************** *** 770,774 **** pIoObject = pDrvObj; ! ASSERT(TRACE_FILE_OK); InitializeObjectAttributes(&objectAttributes, &traceFileName, 0, NULL, NULL); --- 778,782 ---- pIoObject = pDrvObj; ! HALT_UNLESS(TRACE_FILE_OK); InitializeObjectAttributes(&objectAttributes, &traceFileName, 0, NULL, NULL); *************** *** 811,815 **** pDestStr[lenBuf] = 0; strOldBusyInd += (LONG)lenBuf; ! ASSERT(strOldBusyInd <= strOldFreeInd); if (strOldBusyInd == strOldFreeInd) InterlockedExchange(&strOldFreeInd, strOldBusyInd = 0); --- 819,823 ---- pDestStr[lenBuf] = 0; strOldBusyInd += (LONG)lenBuf; ! HALT_UNLESS3(strOldBusyInd <= strOldFreeInd, strOldFreeInd, strOldBusyInd, lenBuf); if (strOldBusyInd == strOldFreeInd) InterlockedExchange(&strOldFreeInd, strOldBusyInd = 0); Index: timeout.c =================================================================== RCS file: /cvsroot/com0com/com0com/timeout.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** timeout.c 26 Jan 2005 12:18:54 -0000 1.1 --- timeout.c 14 Jul 2005 13:51:09 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/07/14 13:51:09 vfrolov + * Replaced ASSERT by HALT_UNLESS + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 29,32 **** --- 32,40 ---- #include "timeout.h" + /* + * FILE_ID used by HALT_UNLESS to put it on BSOD + */ + #define FILE_ID 3 + VOID TimeoutRoutine( IN PC0C_FDOPORT_EXTENSION pDevExt, *************** *** 79,83 **** pState = GetIrpState(pIrp); ! ASSERT(pState); KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); --- 87,91 ---- pState = GetIrpState(pIrp); ! HALT_UNLESS(pState); KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); Index: pnp.c =================================================================== RCS file: /cvsroot/com0com/com0com/pnp.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pnp.c 28 Jun 2005 12:25:34 -0000 1.3 --- pnp.c 14 Jul 2005 13:51:07 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2005/07/14 13:51:07 vfrolov + * Replaced ASSERT by HALT_UNLESS + * * Revision 1.3 2005/06/28 12:25:34 vfrolov * Implemented IRP_MN_QUERY_CAPABILITIES and IRP_MN_QUERY_BUS_INFORMATION for PdoPortPnp() *************** *** 37,40 **** --- 40,48 ---- /* + * FILE_ID used by HALT_UNLESS to put it on BSOD + */ + #define FILE_ID 5 + + /* * {E74D3627-7582-48a6-8B0B-ED60CE908A51} */ *************** *** 311,315 **** PC0C_COMMON_EXTENSION pDevExt = pDevObj->DeviceExtension; ! ASSERT(IoGetCurrentIrpStackLocation(pIrp)->MajorFunction == IRP_MJ_PNP); TraceIrp("PNP", pIrp, NULL, TRACE_FLAG_PARAMS); --- 319,325 ---- PC0C_COMMON_EXTENSION pDevExt = pDevObj->DeviceExtension; ! HALT_UNLESS2(IoGetCurrentIrpStackLocation(pIrp)->MajorFunction == IRP_MJ_PNP, ! IoGetCurrentIrpStackLocation(pIrp)->MajorFunction, ! IoGetCurrentIrpStackLocation(pIrp)->MinorFunction); TraceIrp("PNP", pIrp, NULL, TRACE_FLAG_PARAMS); Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/adddev.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** adddev.c 13 Jul 2005 16:12:36 -0000 1.5 --- adddev.c 14 Jul 2005 13:51:08 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2005/07/14 13:51:08 vfrolov + * Replaced ASSERT by HALT_UNLESS + * * Revision 1.5 2005/07/13 16:12:36 vfrolov * Added c0cGlobal struct for global driver's data *************** *** 42,45 **** --- 45,53 ---- #include "strutils.h" + /* + * FILE_ID used by HALT_UNLESS to put it on BSOD + */ + #define FILE_ID 6 + NTSTATUS InitCommonExt( PC0C_COMMON_EXTENSION pDevExt, *************** *** 184,188 **** } ! ASSERT(pNewDevObj); pDevExt = pNewDevObj->DeviceExtension; RtlZeroMemory(pDevExt, sizeof(*pDevExt)); --- 192,196 ---- } ! HALT_UNLESS(pNewDevObj); pDevExt = pNewDevObj->DeviceExtension; RtlZeroMemory(pDevExt, sizeof(*pDevExt)); *************** *** 316,320 **** } ! ASSERT(pNewDevObj); pDevExt = (pNewDevObj)->DeviceExtension; RtlZeroMemory(pDevExt, sizeof(*pDevExt)); --- 324,328 ---- } ! HALT_UNLESS(pNewDevObj); pDevExt = (pNewDevObj)->DeviceExtension; RtlZeroMemory(pDevExt, sizeof(*pDevExt)); *************** *** 397,401 **** ULONG num = ((PC0C_FDOBUS_EXTENSION)pDevObj->DeviceExtension)->portNum; ! ASSERT(num < busyMaskLen); pBusyMask[num] = 1; } --- 405,409 ---- ULONG num = ((PC0C_FDOBUS_EXTENSION)pDevObj->DeviceExtension)->portNum; ! HALT_UNLESS3(num < busyMaskLen, num, busyMaskLen, numNext); pBusyMask[num] = 1; } *************** *** 453,457 **** } ! ASSERT(pNewDevObj != NULL); pDevExt = pNewDevObj->DeviceExtension; RtlZeroMemory(pDevExt, sizeof(*pDevExt)); --- 461,465 ---- } ! HALT_UNLESS(pNewDevObj); pDevExt = pNewDevObj->DeviceExtension; RtlZeroMemory(pDevExt, sizeof(*pDevExt)); |
From: Vyacheslav F. <vf...@us...> - 2005-07-14 12:29:31
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23922 Modified Files: ioctl.c Log Message: Fixed BSOD on IRP_MJ_READ after IOCTL_SERIAL_SET_QUEUE_SIZE Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/ioctl.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ioctl.c 19 May 2005 08:23:41 -0000 1.5 --- ioctl.c 14 Jul 2005 12:29:23 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2005/07/14 12:29:23 vfrolov + * Fixed BSOD on IRP_MJ_READ after IOCTL_SERIAL_SET_QUEUE_SIZE + * * Revision 1.5 2005/05/19 08:23:41 vfrolov * Fixed data types *************** *** 497,500 **** --- 500,506 ---- } + readBufNew.escape = pReadBuf->escape; + readBufNew.insertData = pReadBuf->insertData; + *pReadBuf = readBufNew; |
From: Vyacheslav F. <vf...@us...> - 2005-07-14 12:24:45
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22684 Modified Files: io.c Log Message: Replaced ASSERT by HALT_UNLESS Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/io.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** io.c 19 May 2005 08:23:41 -0000 1.6 --- io.c 14 Jul 2005 12:24:31 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2005/07/14 12:24:31 vfrolov + * Replaced ASSERT by HALT_UNLESS + * * Revision 1.6 2005/05/19 08:23:41 vfrolov * Fixed data types *************** *** 44,47 **** --- 47,55 ---- #include "timeout.h" + /* + * FILE_ID used by HALT_UNLESS to put it on BSOD + */ + #define FILE_ID 1 + #define GET_REST_BUFFER(pIrp) \ (((PUCHAR)(pIrp)->AssociatedIrp.SystemBuffer) + (pIrp)->IoStatus.Information) *************** *** 53,57 **** if (pRawData->size) { ! ASSERT((pRawData->size + writeDone) <= sizeof(pRawData->data)); RtlMoveMemory(pRawData->data, pRawData->data + writeDone, pRawData->size); --- 61,66 ---- 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); *************** *** 62,73 **** NTSTATUS MoveRawData(PC0C_RAW_DATA pDstRawData, PC0C_RAW_DATA pSrcRawData) { ! int free; if (!pSrcRawData->size) return STATUS_SUCCESS; free = sizeof(pDstRawData->data) - pDstRawData->size; ! if (free > 0) { SIZE_T length; --- 71,85 ---- 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; *************** *** 77,81 **** length = free; ! ASSERT((pDstRawData->size + length) <= sizeof(pDstRawData->data)); RtlCopyMemory(pDstRawData->data + pDstRawData->size, pSrcRawData->data, length); --- 89,94 ---- length = free; ! HALT_UNLESS3((pDstRawData->size + length) <= sizeof(pDstRawData->data), ! pDstRawData->size, length, sizeof(pDstRawData->data)); RtlCopyMemory(pDstRawData->data + pDstRawData->size, pSrcRawData->data, length); *************** *** 121,124 **** --- 134,140 ---- length = pBuf->insertData.size; + HALT_UNLESS2(length <= sizeof(pBuf->insertData.data), + length, sizeof(pBuf->insertData.data)); + if (length > readLength) length = readLength; *************** *** 137,141 **** } ! ASSERT(pBuf->pBase); writeLength = pBuf->pFree <= pBuf->pBusy ? --- 153,157 ---- } ! HALT_UNLESS(pBuf->pBase); writeLength = pBuf->pFree <= pBuf->pBusy ? *************** *** 189,192 **** --- 205,211 ---- SIZE_T length = pBuf->insertData.size; + HALT_UNLESS2(length <= sizeof(pBuf->insertData.data), + length, sizeof(pBuf->insertData.data)); + if (length > readLength) length = readLength; *************** *** 202,209 **** writeDone = writeLength < readLength ? writeLength : readLength; ! if (writeDone) RtlCopyMemory(pReadBuf, pWriteBuf, writeDone); ! ! readDone += writeDone; } else { writeDone = 0; --- 221,228 ---- writeDone = writeLength < readLength ? writeLength : readLength; ! if (writeDone) { RtlCopyMemory(pReadBuf, pWriteBuf, writeDone); ! readDone += writeDone; ! } } else { writeDone = 0; *************** *** 310,313 **** --- 329,335 ---- } + HALT_UNLESS2(writeLength <= sizeof(pRawData->data), + writeLength, sizeof(pRawData->data)); + pWriteBuf = pRawData->data; *************** *** 411,414 **** --- 433,439 ---- writeLength = pRawData->size; + HALT_UNLESS2(writeLength <= sizeof(pRawData->data), + writeLength, sizeof(pRawData->data)); + CopyCharsWithEscape( pBuf, 0, *************** *** 437,441 **** if (ioType == C0C_IO_TYPE_READ) { ! ASSERT(pParam); status = ReadBuffer((PIRP)pParam, &pIoPort->pDevExt->pIoPortRemote->readBuf); } else { --- 462,466 ---- if (ioType == C0C_IO_TYPE_READ) { ! HALT_UNLESS(pParam); status = ReadBuffer((PIRP)pParam, &pIoPort->pDevExt->pIoPortRemote->readBuf); } else { *************** *** 454,458 **** pStateCurrent = GetIrpState(pIrpCurrent); ! ASSERT(pStateCurrent); #pragma warning(push, 3) --- 479,483 ---- pStateCurrent = GetIrpState(pIrpCurrent); ! HALT_UNLESS(pStateCurrent); #pragma warning(push, 3) *************** *** 468,477 **** case C0C_IO_TYPE_READ: case C0C_IO_TYPE_WRITE: ! ASSERT(pParam); if (status == STATUS_PENDING) ReadWriteDirect((PIRP)pParam, pIrpCurrent, &status, &statusCurrent, pIoPort, pQueueToComplete); break; case C0C_IO_TYPE_WAIT_COMPLETE: ! ASSERT(pParam); *((PULONG)pIrpCurrent->AssociatedIrp.SystemBuffer) = *((PULONG)pParam); *((PULONG)pParam) = 0; --- 493,502 ---- case C0C_IO_TYPE_READ: case C0C_IO_TYPE_WRITE: ! HALT_UNLESS(pParam); if (status == STATUS_PENDING) ReadWriteDirect((PIRP)pParam, pIrpCurrent, &status, &statusCurrent, pIoPort, pQueueToComplete); break; case C0C_IO_TYPE_WAIT_COMPLETE: ! HALT_UNLESS(pParam); *((PULONG)pIrpCurrent->AssociatedIrp.SystemBuffer) = *((PULONG)pParam); *((PULONG)pParam) = 0; *************** *** 480,484 **** break; case C0C_IO_TYPE_INSERT: ! ASSERT(pParam); InsertDirect((PC0C_RAW_DATA)pParam, pIrpCurrent, &status, &statusCurrent, &pIoPort->readBuf); break; --- 505,509 ---- break; case C0C_IO_TYPE_INSERT: ! HALT_UNLESS(pParam); InsertDirect((PC0C_RAW_DATA)pParam, pIrpCurrent, &status, &statusCurrent, &pIoPort->readBuf); break; *************** *** 533,541 **** switch (ioType) { case C0C_IO_TYPE_WRITE: ! ASSERT(pParam); status = WriteBuffer((PIRP)pParam, pIoPort, pQueueToComplete); break; case C0C_IO_TYPE_INSERT: ! ASSERT(pParam); status = InsertBuffer((PC0C_RAW_DATA)pParam, &pIoPort->readBuf); break; --- 558,566 ---- switch (ioType) { case C0C_IO_TYPE_WRITE: ! HALT_UNLESS(pParam); status = WriteBuffer((PIRP)pParam, pIoPort, pQueueToComplete); break; case C0C_IO_TYPE_INSERT: ! HALT_UNLESS(pParam); status = InsertBuffer((PC0C_RAW_DATA)pParam, &pIoPort->readBuf); break; |
From: Vyacheslav F. <vf...@us...> - 2005-07-14 12:19:20
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21406 Modified Files: trace.h Log Message: Defined HALT_UNLESS Index: trace.h =================================================================== RCS file: /cvsroot/com0com/com0com/trace.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** trace.h 26 Jan 2005 12:18:54 -0000 1.1 --- trace.h 14 Jul 2005 12:18:59 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/07/14 12:18:59 vfrolov + * Defined HALT_UNLESS + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 31,34 **** --- 34,45 ---- #if DBG + #define HALT_UNLESS3(exp, p1, p2, p3) \ + if (!(exp)) \ + KeBugCheckEx(0xDEADC0CD, (FILE_ID << 16) + __LINE__, p1, p2, p3) + + #define HALT_UNLESS2(exp, p1, p2) HALT_UNLESS3(exp, p1, p2, 0) + #define HALT_UNLESS1(exp, p1) HALT_UNLESS3(exp, p1, 0, 0) + #define HALT_UNLESS(exp) HALT_UNLESS3(exp, 0, 0, 0) + #define TRACE_FLAG_PARAMS 0x0001 #define TRACE_FLAG_RESULTS 0x0002 *************** *** 90,93 **** --- 101,108 ---- #else /* DBG */ + #define HALT_UNLESS3(exp, p1, p2, p3) + #define HALT_UNLESS2(exp, p1, p2) + #define HALT_UNLESS1(exp, p1) + #define HALT_UNLESS(exp) #define TraceOpen(a1, a2) #define TraceClose() |
From: Vyacheslav F. <vf...@us...> - 2005-07-13 16:13:18
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18107 Modified Files: adddev.c com0com.h initunlo.c Log Message: Added c0cGlobal struct for global driver's data Index: initunlo.c =================================================================== RCS file: /cvsroot/com0com/com0com/initunlo.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** initunlo.c 12 May 2005 07:41:27 -0000 1.2 --- initunlo.c 13 Jul 2005 16:12:36 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2005/07/13 16:12:36 vfrolov + * Added c0cGlobal struct for global driver's data + * * Revision 1.2 2005/05/12 07:41:27 vfrolov * Added ability to change the port names *************** *** 32,36 **** #include "strutils.h" ! UNICODE_STRING c0cRegistryPath; NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDrvObj, IN PUNICODE_STRING pRegistryPath) --- 35,39 ---- #include "strutils.h" ! C0C_GLOBAL c0cGlobal; NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDrvObj, IN PUNICODE_STRING pRegistryPath) *************** *** 38,47 **** NTSTATUS status; ! TraceOpen(pDrvObj, pRegistryPath); status = STATUS_SUCCESS; ! RtlInitUnicodeString(&c0cRegistryPath, NULL); ! StrAppendStr(&status, &c0cRegistryPath, pRegistryPath->Buffer, pRegistryPath->Length); if (!NT_SUCCESS(status)) { --- 41,50 ---- NTSTATUS status; ! c0cGlobal.pDrvObj = pDrvObj; status = STATUS_SUCCESS; ! RtlInitUnicodeString(&c0cGlobal.registryPath, NULL); ! StrAppendStr(&status, &c0cGlobal.registryPath, pRegistryPath->Buffer, pRegistryPath->Length); if (!NT_SUCCESS(status)) { *************** *** 50,53 **** --- 53,58 ---- } + TraceOpen(pDrvObj, pRegistryPath); + pDrvObj->DriverUnload = c0cUnload; pDrvObj->DriverExtension->AddDevice = c0cAddDevice; *************** *** 74,78 **** UNREFERENCED_PARAMETER(pDrvObj); ! StrFree(&c0cRegistryPath); TraceClose(); --- 79,83 ---- UNREFERENCED_PARAMETER(pDrvObj); ! StrFree(&c0cGlobal.registryPath); TraceClose(); Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/adddev.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** adddev.c 28 Jun 2005 12:17:12 -0000 1.4 --- adddev.c 13 Jul 2005 16:12:36 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2005/07/13 16:12:36 vfrolov + * Added c0cGlobal struct for global driver's data + * * Revision 1.4 2005/06/28 12:17:12 vfrolov * Added pBusExt to C0C_PDOPORT_EXTENSION *************** *** 124,128 **** RtlInitUnicodeString(&portRegistryPath, NULL); ! StrAppendStr(&status, &portRegistryPath, c0cRegistryPath.Buffer, c0cRegistryPath.Length); StrAppendStr0(&status, &portRegistryPath, L"\\Parameters\\"); StrAppendStr0(&status, &portRegistryPath, pPortName); --- 127,131 ---- RtlInitUnicodeString(&portRegistryPath, NULL); ! StrAppendStr(&status, &portRegistryPath, c0cGlobal.registryPath.Buffer, c0cGlobal.registryPath.Length); StrAppendStr0(&status, &portRegistryPath, L"\\Parameters\\"); StrAppendStr0(&status, &portRegistryPath, pPortName); Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** com0com.h 28 Jun 2005 12:17:12 -0000 1.9 --- com0com.h 13 Jul 2005 16:12:36 -0000 1.10 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2005/07/13 16:12:36 vfrolov + * Added c0cGlobal struct for global driver's data + * * Revision 1.9 2005/06/28 12:17:12 vfrolov * Added pBusExt to C0C_PDOPORT_EXTENSION *************** *** 200,204 **** } C0C_FDOBUS_EXTENSION, *PC0C_FDOBUS_EXTENSION; ! extern UNICODE_STRING c0cRegistryPath; VOID c0cUnload(IN PDRIVER_OBJECT pDrvObj); --- 203,212 ---- } C0C_FDOBUS_EXTENSION, *PC0C_FDOBUS_EXTENSION; ! typedef struct _C0C_GLOBAL { ! PDRIVER_OBJECT pDrvObj; ! UNICODE_STRING registryPath; ! } C0C_GLOBAL; ! ! extern C0C_GLOBAL c0cGlobal; VOID c0cUnload(IN PDRIVER_OBJECT pDrvObj); |
From: Vyacheslav F. <vf...@us...> - 2005-07-01 11:05:52
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25875 Modified Files: precomp.h Log Message: Removed unused headers Index: precomp.h =================================================================== RCS file: /cvsroot/com0com/com0com/precomp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** precomp.h 26 Jan 2005 12:18:54 -0000 1.1 --- precomp.h 1 Jul 2005 11:05:41 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/07/01 11:05:41 vfrolov + * Removed unused headers + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 37,43 **** #pragma warning(pop) - #include <stdio.h> - #include <stdarg.h> - #include "com0com.h" #include "trace.h" --- 40,43 ---- |
From: Vyacheslav F. <vf...@us...> - 2005-07-01 11:04:24
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25099 Modified Files: trace.c Log Message: Included <stdarg.h> Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/trace.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** trace.c 19 May 2005 08:23:41 -0000 1.5 --- trace.c 1 Jul 2005 11:03:50 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2005/07/01 11:03:50 vfrolov + * Included <stdarg.h> + * * Revision 1.5 2005/05/19 08:23:41 vfrolov * Fixed data types *************** *** 44,47 **** --- 47,52 ---- /********************************************************************/ + #include <stdarg.h> + #include "trace.h" #include "strutils.h" |
From: Vyacheslav F. <vf...@us...> - 2005-06-28 12:25:56
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14712 Modified Files: pnp.c Log Message: Implemented IRP_MN_QUERY_CAPABILITIES and IRP_MN_QUERY_BUS_INFORMATION for PdoPortPnp() Index: pnp.c =================================================================== RCS file: /cvsroot/com0com/com0com/pnp.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pnp.c 17 May 2005 15:06:18 -0000 1.2 --- pnp.c 28 Jun 2005 12:25:34 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2005/06/28 12:25:34 vfrolov + * Implemented IRP_MN_QUERY_CAPABILITIES and IRP_MN_QUERY_BUS_INFORMATION for PdoPortPnp() + * * Revision 1.2 2005/05/17 15:06:18 vfrolov * Fixed type cast *************** *** 31,34 **** --- 34,44 ---- #include "precomp.h" #include "strutils.h" + #include <initguid.h> + + /* + * {E74D3627-7582-48a6-8B0B-ED60CE908A51} + */ + DEFINE_GUID(GUID_C0C_BUS_TYPE, + 0xe74d3627, 0x7582, 0x48a6, 0x8b, 0xb, 0xed, 0x60, 0xce, 0x90, 0x8a, 0x51); NTSTATUS FdoBusPnp( *************** *** 149,158 **** UNREFERENCED_PARAMETER(pDevExt); if (pCaps->Version != 1 || pCaps->Size < sizeof(DEVICE_CAPABILITIES)) ! return STATUS_UNSUCCESSFUL; ! ! return pIrp->IoStatus.Status; } --- 159,168 ---- UNREFERENCED_PARAMETER(pDevExt); + UNREFERENCED_PARAMETER(pIrp); if (pCaps->Version != 1 || pCaps->Size < sizeof(DEVICE_CAPABILITIES)) ! return STATUS_UNSUCCESSFUL; ! return STATUS_SUCCESS; } *************** *** 197,200 **** --- 207,230 ---- } + NTSTATUS PdoPortBusInfo( + IN PC0C_PDOPORT_EXTENSION pDevExt, + IN PIRP pIrp) + { + PPNP_BUS_INFORMATION pBusInfo; + + pBusInfo = (PPNP_BUS_INFORMATION)ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION)); + + if (!pBusInfo) + return STATUS_INSUFFICIENT_RESOURCES; + + pBusInfo->BusTypeGuid = GUID_C0C_BUS_TYPE; + pBusInfo->LegacyBusType = PNPBus; + pBusInfo->BusNumber = pDevExt->pBusExt->portNum; + + pIrp->IoStatus.Information = (ULONG_PTR)pBusInfo; + + return STATUS_SUCCESS; + } + NTSTATUS PdoPortPnp( IN PC0C_PDOPORT_EXTENSION pDevExt, *************** *** 214,217 **** --- 244,250 ---- status = PdoPortQueryDevText(pDevExt, pIrp, pIrpStack); break; + case IRP_MN_QUERY_BUS_INFORMATION: + status = PdoPortBusInfo(pDevExt, pIrp); + break; case IRP_MN_QUERY_DEVICE_RELATIONS: switch (pIrpStack->Parameters.QueryDeviceRelations.Type) { |
From: Vyacheslav F. <vf...@us...> - 2005-06-28 12:17:39
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9801 Modified Files: com0com.h adddev.c Log Message: Added pBusExt to C0C_PDOPORT_EXTENSION Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** com0com.h 20 May 2005 12:06:05 -0000 1.8 --- com0com.h 28 Jun 2005 12:17:12 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2005/06/28 12:17:12 vfrolov + * Added pBusExt to C0C_PDOPORT_EXTENSION + * * Revision 1.8 2005/05/20 12:06:05 vfrolov * Improved port numbering *************** *** 153,156 **** --- 156,161 ---- COMMON_EXTENSION + struct _C0C_FDOBUS_EXTENSION *pBusExt; + PKSPIN_LOCK pIoLock; PC0C_IO_PORT pIoPortLocal; Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/adddev.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** adddev.c 20 May 2005 12:06:05 -0000 1.3 --- adddev.c 28 Jun 2005 12:17:12 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2005/06/28 12:17:12 vfrolov + * Added pBusExt to C0C_PDOPORT_EXTENSION + * * Revision 1.3 2005/05/20 12:06:05 vfrolov * Improved port numbering *************** *** 320,323 **** --- 323,327 ---- } + pDevExt->pBusExt = pBusExt; pDevExt->pIoLock = &pBusExt->ioLock; pDevExt->pIoPortLocal = pIoPortLocal; |
From: Vyacheslav F. <vf...@us...> - 2005-06-22 14:59:36
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25116 Modified Files: com0com.rc Log Message: Changed version Index: com0com.rc =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.rc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** com0com.rc 17 May 2005 14:23:42 -0000 1.3 --- com0com.rc 22 Jun 2005 14:59:28 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2005/06/22 14:59:28 vfrolov + * Changed version + * * Revision 1.3 2005/05/17 14:23:42 vfrolov * Changed version *************** *** 33,38 **** #include "c0clog.rc" ! #define VER_VERSION 1,1,0,0 ! #define VER_VERSION_STR "1.1.0.0" #define VER_PODUCT_NAME_STR "Null-modem emulator" --- 36,41 ---- #include "c0clog.rc" ! #define VER_VERSION 1,1,1,0 ! #define VER_VERSION_STR "1.1.1.0" #define VER_PODUCT_NAME_STR "Null-modem emulator" |
From: Vyacheslav F. <vf...@us...> - 2005-06-22 14:55:01
|
Update of /cvsroot/com0com/com2tcp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22201 Modified Files: com2tcp.rc Log Message: Changed version Index: com2tcp.rc =================================================================== RCS file: /cvsroot/com0com/com2tcp/com2tcp.rc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** com2tcp.rc 7 Jun 2005 15:29:52 -0000 1.1 --- com2tcp.rc 22 Jun 2005 14:54:25 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/06/22 14:54:25 vfrolov + * Changed version + * * Revision 1.1 2005/06/07 15:29:52 vfrolov * Initial revision *************** *** 29,34 **** ! #define VER_FILEVERSION 1,0,0,0 ! #define VER_PRODUCTVERSION_STR "1.0.0.0" #define VER_LEGALCOPYRIGHT_YEARS "2005" --- 32,37 ---- ! #define VER_FILEVERSION 1,1,0,0 ! #define VER_PRODUCTVERSION_STR "1.1.0.0" #define VER_LEGALCOPYRIGHT_YEARS "2005" |
From: Vyacheslav F. <vf...@us...> - 2005-06-10 16:01:30
|
Update of /cvsroot/com0com/com2tcp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32653 Modified Files: com2tcp.dsp Log Message: Changed processor to 80386 Added precompile precomp.h Index: com2tcp.dsp =================================================================== RCS file: /cvsroot/com0com/com2tcp/com2tcp.dsp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** com2tcp.dsp 7 Jun 2005 15:31:07 -0000 1.3 --- com2tcp.dsp 10 Jun 2005 16:01:05 -0000 1.4 *************** *** 43,48 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c ! # ADD CPP /nologo /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c ! # SUBTRACT CPP /YX /Yc /Yu # ADD BASE RSC /l 0x419 /d "NDEBUG" # ADD RSC /l 0x419 /d "NDEBUG" --- 43,47 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c ! # ADD CPP /nologo /G3 /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX"precomp.h" /FD /c # ADD BASE RSC /l 0x419 /d "NDEBUG" # ADD RSC /l 0x419 /d "NDEBUG" *************** *** 68,73 **** # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c ! # ADD CPP /nologo /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c ! # SUBTRACT CPP /YX /Yc /Yu # ADD BASE RSC /l 0x419 /d "_DEBUG" # ADD RSC /l 0x419 /d "_DEBUG" --- 67,71 ---- # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c ! # ADD CPP /nologo /G3 /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX"precomp.h" /FD /GZ /c # ADD BASE RSC /l 0x419 /d "_DEBUG" # ADD RSC /l 0x419 /d "_DEBUG" *************** *** 110,113 **** --- 108,115 ---- # Begin Source File + SOURCE=.\precomp.h + # End Source File + # Begin Source File + SOURCE=.\telnet.h # End Source File |
From: Vyacheslav F. <vf...@us...> - 2005-06-10 15:55:20
|
Update of /cvsroot/com0com/com2tcp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29968 Modified Files: telnet.cpp telnet.h utils.h com2tcp.cpp Log Message: Implemented --terminal option Index: com2tcp.cpp =================================================================== RCS file: /cvsroot/com0com/com2tcp/com2tcp.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** com2tcp.cpp 8 Jun 2005 15:48:17 -0000 1.5 --- com2tcp.cpp 10 Jun 2005 15:55:10 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2005/06/10 15:55:10 vfrolov + * Implemented --terminal option + * * Revision 1.5 2005/06/08 15:48:17 vfrolov * Implemented --awak-seq option *************** *** 38,47 **** */ ! #include <winsock2.h> ! #include <windows.h> ! ! #include <stdio.h> ! ! #include "utils.h" #include "telnet.h" --- 41,45 ---- */ ! #include "precomp.h" #include "telnet.h" *************** *** 596,599 **** --- 594,598 ---- fprintf(stderr, "Options:\n"); fprintf(stderr, " --telnet - use Telnet protocol.\n"); + fprintf(stderr, " --terminal type - use terminal type.\n"); fprintf(stderr, " --awak-seq sequence - wait awakening sequence from com port.\n"); exit(1); *************** *** 603,606 **** --- 602,606 ---- { enum {prNone, prTelnet} protocol = prNone; + const char *pTermType = NULL; const BYTE *pAwakSeq = NULL; char **pArgs = &argv[1]; *************** *** 615,618 **** --- 615,625 ---- argc--; } else + if (!strcmp(*pArgs, "--terminal")) { + pArgs++; + argc--; + pTermType = *pArgs; + pArgs++; + argc--; + } else if (!strcmp(*pArgs, "--awak-seq")) { pArgs++; *************** *** 651,654 **** --- 658,662 ---- case prTelnet: pProtocol = new TelnetProtocol(10, 10); + ((TelnetProtocol *)pProtocol)->SetTerminalType(pTermType); break; default: Index: telnet.cpp =================================================================== RCS file: /cvsroot/com0com/com2tcp/telnet.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** telnet.cpp 6 Jun 2005 15:19:02 -0000 1.1 --- telnet.cpp 10 Jun 2005 15:55:10 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/06/10 15:55:10 vfrolov + * Implemented --terminal option + * * Revision 1.1 2005/06/06 15:19:02 vfrolov * Initial revision *************** *** 26,38 **** */ ! #include <winsock2.h> ! #include <windows.h> ! ! #include <stdio.h> ! ! #include "utils.h" #include "telnet.h" /////////////////////////////////////////////////////////////// enum { cdWILL = 251, cdWONT = 252, --- 29,39 ---- */ ! #include "precomp.h" #include "telnet.h" + /////////////////////////////////////////////////////////////// enum { + cdSE = 240, + cdSB = 250, cdWILL = 251, cdWONT = 252, *************** *** 45,48 **** --- 46,55 ---- { switch (code) { + case cdSE: + return "SE"; + break; + case cdSB: + return "SB"; + break; case cdWILL: return "WILL"; *************** *** 62,66 **** /////////////////////////////////////////////////////////////// enum { ! opEcho = 1, }; /////////////////////////////////////////////////////////////// --- 69,74 ---- /////////////////////////////////////////////////////////////// enum { ! opEcho = 1, ! opTerminalType = 24, }; /////////////////////////////////////////////////////////////// *************** *** 69,72 **** --- 77,82 ---- stCode, stOption, + stSubParams, + stSubCode, }; /////////////////////////////////////////////////////////////// *************** *** 75,79 **** --- 85,103 ---- state(stData) { + SetTerminalType(NULL); + options[opEcho].remoteOptionState = OptionState::osNo; + options[opTerminalType].localOptionState = OptionState::osNo; + } + + void TelnetProtocol::SetTerminalType(const char *pTerminalType) + { + terminalType.clear(); + + if (!pTerminalType) + pTerminalType = "UNKNOWN"; + + while (*pTerminalType) + terminalType.push_back(*pTerminalType++); } *************** *** 95,98 **** --- 119,123 ---- WriteRaw(&ch, 1); break; + case cdSB: case cdWILL: case cdWONT: *************** *** 110,113 **** --- 135,143 ---- printf("RECV: %s %u\n", code2name(code), (unsigned)ch); switch (code) { + case cdSB: + option = ch; + params.clear(); + state = stSubParams; + break; case cdWILL: switch (options[ch].remoteOptionState) { *************** *** 159,166 **** break; default: ! printf("RECV: %u %u (ignore)\n", (unsigned)code, (unsigned)ch); ! }; ! state = stData; ! break; } } --- 189,234 ---- break; default: ! printf(" ignored\n"); ! }; ! if (state == stOption) ! state = stData; ! break; ! case stSubParams: ! if (ch == cdIAC) ! state = stSubCode; ! else ! params.push_back(ch); ! break; ! case stSubCode: ! switch (ch) { ! case cdIAC: ! state = stSubParams; ! break; ! case cdSE: ! printf(" "); ! { ! for (BYTE_vector::const_iterator i = params.begin() ; i != params.end() ; i++) ! printf("%u ", (unsigned)*i); ! } ! printf("SE\n"); ! ! switch (option) { ! case opTerminalType: ! params.clear(); ! params.push_back(0); ! params.insert(params.end(), terminalType.begin(), terminalType.end()); ! SendSubNegotiation(option, params); ! break; ! default: ! printf(" ignored\n"); ! } ! ! state = stData; ! break; ! default: ! printf("RECV: unknown sub code %u\n", (unsigned)ch); ! state = stData; ! }; ! break; } } *************** *** 177,179 **** --- 245,263 ---- SendRaw(buf, sizeof(buf)); } + + void TelnetProtocol::SendSubNegotiation(int option, const BYTE_vector ¶ms) + { + SendOption(cdSB, (BYTE)option); + + printf(" "); + for (BYTE_vector::const_iterator i = params.begin() ; i != params.end() ; i++) { + printf("%u ", (unsigned)*i); + SendRaw(i, 1); + } + printf("SE\n"); + + BYTE buf[2] = {cdIAC, cdSE}; + + SendRaw(buf, sizeof(buf)); + } /////////////////////////////////////////////////////////////// Index: telnet.h =================================================================== RCS file: /cvsroot/com0com/com2tcp/telnet.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** telnet.h 6 Jun 2005 15:19:02 -0000 1.1 --- telnet.h 10 Jun 2005 15:55:10 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2005/06/10 15:55:10 vfrolov + * Implemented --terminal option + * * Revision 1.1 2005/06/06 15:19:02 vfrolov * Initial revision *************** *** 34,46 **** public: TelnetProtocol(int _thresholdSend = 0, int _thresholdWrite = 0); - //virtual int Send(const void *pBuf, int count); virtual int Write(const void *pBuf, int count); - protected: void SendOption(BYTE code, BYTE option); int state; int code; struct OptionState --- 37,51 ---- public: TelnetProtocol(int _thresholdSend = 0, int _thresholdWrite = 0); + void SetTerminalType(const char *pTerminalType); virtual int Write(const void *pBuf, int count); protected: void SendOption(BYTE code, BYTE option); + void SendSubNegotiation(int option, const BYTE_vector ¶ms); int state; int code; + int option; + BYTE_vector params; struct OptionState *************** *** 53,57 **** OptionState options[256]; ! DataStream toTelnet; }; /////////////////////////////////////////////////////////////// --- 58,62 ---- OptionState options[256]; ! BYTE_vector terminalType; }; /////////////////////////////////////////////////////////////// Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com2tcp/utils.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** utils.h 8 Jun 2005 07:40:23 -0000 1.2 --- utils.h 10 Jun 2005 15:55:10 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2005/06/10 15:55:10 vfrolov + * Implemented --terminal option + * * Revision 1.2 2005/06/08 07:40:23 vfrolov * Added missing DataStream::busy initialization *************** *** 33,36 **** --- 36,41 ---- /////////////////////////////////////////////////////////////// + typedef vector< BYTE, allocator<BYTE> > BYTE_vector; + /////////////////////////////////////////////////////////////// class ChunkStream { |