com0com-cvs Mailing List for Null-modem emulator (Page 27)
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...> - 2007-10-05 07:34:41
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3681 Modified Files: bufutils.c Log Message: Added missing *pOverrun initialization Changed TX FIFO writing emulation to be interrupt driven Index: bufutils.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/bufutils.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** bufutils.c 20 Jul 2007 08:00:22 -0000 1.9 --- bufutils.c 5 Oct 2007 07:34:21 -0000 1.10 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.10 2007/10/05 07:34:21 vfrolov + * Added missing *pOverrun initialization + * Changed TX FIFO writing emulation to be interrupt driven + * * Revision 1.9 2007/07/20 08:00:22 vfrolov * Implemented TX buffer *************** *** 317,320 **** --- 321,327 ---- PUCHAR pWriteBuf = (PUCHAR)pWrite; + if (pOverrun) + *pOverrun = 0; + while (writeLength) { SIZE_T readDone, writeDone; *************** *** 334,339 **** pWriteBuf += writeDone; - } else { - *pOverrun = 0; } } --- 341,344 ---- *************** *** 596,602 **** SIZE_T writeLength) { ! PUCHAR pWriteBuf = (PUCHAR)pWrite; ! while (writeLength && pTxBuf->busy < C0C_TX_BUFFER_SIZE(pTxBuf)) { SIZE_T readLength; PUCHAR pReadBuf; --- 601,622 ---- SIZE_T writeLength) { ! PUCHAR pWriteBuf; ! SIZE_T sizeTxBuf; ! /* Writing to TX FIFO is interrupt driven so we can write only if it's empty */ ! ! if (!C0C_TX_BUFFER_THR_EMPTY(pTxBuf)) ! return 0; ! ! sizeTxBuf = C0C_TX_BUFFER_SIZE(pTxBuf); ! ! /* Write not more then TxFIFO registry value */ ! ! if (writeLength > sizeTxBuf - 1) ! writeLength = sizeTxBuf - 1; ! ! pWriteBuf = (PUCHAR)pWrite; ! ! while (writeLength && pTxBuf->busy < sizeTxBuf) { SIZE_T readLength; PUCHAR pReadBuf; *************** *** 683,687 **** UNREFERENCED_PARAMETER(cleanFifo); ! size = 1; size += 1; /* add shift register */ --- 703,707 ---- UNREFERENCED_PARAMETER(cleanFifo); ! size = sizeof(pTxBuf->leastBuf) - 1; size += 1; /* add shift register */ |
From: Vyacheslav F. <vf...@us...> - 2007-10-05 07:28:30
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv1232 Modified Files: setup.cpp Log Message: Added listing pairs w/o PortNum Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** setup.cpp 1 Oct 2007 15:44:19 -0000 1.18 --- setup.cpp 5 Oct 2007 07:28:26 -0000 1.19 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.19 2007/10/05 07:28:26 vfrolov + * Added listing pairs w/o PortNum + * * Revision 1.18 2007/10/01 15:44:19 vfrolov * Added check for install two ports with the same name *************** *** 360,363 **** --- 363,369 ---- } } + } else { + Trace(" " C0C_PREF_PORT_NAME_A "?\n"); + Trace(" " C0C_PREF_PORT_NAME_B "?\n"); } |
From: Vyacheslav F. <vf...@us...> - 2007-10-01 16:03:14
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9738 Modified Files: setup.cpp Log Message: Added check for install two ports with the same name Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** setup.cpp 1 Oct 2007 15:01:35 -0000 1.17 --- setup.cpp 1 Oct 2007 15:44:19 -0000 1.18 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.18 2007/10/01 15:44:19 vfrolov + * Added check for install two ports with the same name + * * Revision 1.17 2007/10/01 15:01:35 vfrolov * Added pDevInstID parameter to InstallDevice() *************** *** 604,607 **** --- 607,612 ---- goto err; + char portName[2][20]; + for (int j = 0 ; j < 2 ; j++) { char phPortName[20]; *************** *** 620,628 **** portParameters.ParseParametersStr(pParameters); ! char portName[20]; ! ! portParameters.FillPortName(portName, sizeof(portName)/sizeof(portName[0])); ! if (!IsValidPortName(portName, NULL)) goto err; --- 625,631 ---- portParameters.ParseParametersStr(pParameters); ! portParameters.FillPortName(portName[j], sizeof(portName[j])/sizeof(portName[j][0])); ! if (!IsValidPortName(portName[j], NULL)) goto err; *************** *** 635,638 **** --- 638,642 ---- } else { ShowError(MB_OK|MB_ICONWARNING, err, "portParameters.Load(%s)", phPortName); + SNPRINTF(portName[j], sizeof(portName[j])/sizeof(portName[j][0]), "%s", phPortName); } *************** *** 644,647 **** --- 648,659 ---- } + if (!lstrcmpi(portName[0], portName[1]) && + ShowMsg(MB_OKCANCEL|MB_ICONWARNING, + "The same port name %s is used for both ports.", + portName[0]) == IDCANCEL) + { + goto err; + } + if (!InstallBusDevice(infFile, i)) goto err; |
From: Vyacheslav F. <vf...@us...> - 2007-10-01 15:03:22
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv26132 Modified Files: setup.def Log Message: Fixed library name Index: setup.def =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.def,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.def 28 Jul 2006 12:16:43 -0000 1.1 --- setup.def 1 Oct 2007 15:03:19 -0000 1.2 *************** *** 1,3 **** ! LIBRARY C0CSETUP EXPORTS --- 1,3 ---- ! LIBRARY SETUP EXPORTS |
From: Vyacheslav F. <vf...@us...> - 2007-10-01 15:01:42
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25351 Modified Files: setup.cpp devutils.h devutils.cpp Log Message: Added pDevInstID parameter to InstallDevice() Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** devutils.h 25 Sep 2007 12:42:49 -0000 1.5 --- devutils.h 1 Oct 2007 15:01:35 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2007/10/01 15:01:35 vfrolov + * Added pDevInstID parameter to InstallDevice() + * * Revision 1.5 2007/09/25 12:42:49 vfrolov * Fixed update command (bug if multiple pairs active) *************** *** 128,131 **** --- 131,135 ---- InfFile &infFile, const char *pDevId, + const char *pDevInstID, PDEVCALLBACK pDevCallBack, void *pCallBackParam); Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** setup.cpp 25 Sep 2007 12:42:49 -0000 1.16 --- setup.cpp 1 Oct 2007 15:01:35 -0000 1.17 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.17 2007/10/01 15:01:35 vfrolov + * Added pDevInstID parameter to InstallDevice() + * * Revision 1.16 2007/09/25 12:42:49 vfrolov * Fixed update command (bug if multiple pairs active) *************** *** 502,536 **** } /////////////////////////////////////////////////////////////// ! static BOOL SetPortNum( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, ! PCDevProperties /*pDevProperties*/, BOOL * /*pRebootRequired*/, void *pParam) { ! int res; ! int num = *(int *)pParam; ! do { ! res = IDCONTINUE; ! LONG err = SetPortNum(hDevInfo, pDevInfoData, num); ! if (err != ERROR_SUCCESS) ! res = ShowError(MB_CANCELTRYCONTINUE, err, "SetPortNum(%d)", num); ! } while (res == IDTRYAGAIN); ! if (res != IDCONTINUE) ! return FALSE; ! SetFriendlyName(hDevInfo, pDevInfoData, num); ! return TRUE; } static BOOL InstallBusDevice(InfFile &infFile, int num) { ! return InstallDevice(infFile, C0C_BUS_DEVICE_ID, SetPortNum, &num); } --- 505,543 ---- } /////////////////////////////////////////////////////////////// ! static BOOL InstallDeviceCallBack( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, ! PCDevProperties pDevProperties, BOOL * /*pRebootRequired*/, void *pParam) { ! if (!lstrcmp(pDevProperties->DevId(), C0C_BUS_DEVICE_ID)) { ! int res; ! int num = *(int *)pParam; ! do { ! res = IDCONTINUE; ! LONG err = SetPortNum(hDevInfo, pDevInfoData, num); ! if (err != ERROR_SUCCESS) ! res = ShowError(MB_CANCELTRYCONTINUE, err, "SetPortNum(%d)", num); ! } while (res == IDTRYAGAIN); ! if (res != IDCONTINUE) ! return FALSE; ! SetFriendlyName(hDevInfo, pDevInfoData, num); ! return TRUE; ! } ! ! return FALSE; } static BOOL InstallBusDevice(InfFile &infFile, int num) { ! return InstallDevice(infFile, C0C_BUS_DEVICE_ID, C0C_CLASS, InstallDeviceCallBack, &num); } Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** devutils.cpp 25 Sep 2007 12:42:49 -0000 1.7 --- devutils.cpp 1 Oct 2007 15:01:35 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2007/10/01 15:01:35 vfrolov + * Added pDevInstID parameter to InstallDevice() + * * Revision 1.7 2007/09/25 12:42:49 vfrolov * Fixed update command (bug if multiple pairs active) *************** *** 82,86 **** typedef DevParams *PDevParams; - /////////////////////////////////////////////////////////////// static const char *SetStr(char **ppDst, const char *pSrc) --- 85,88 ---- *************** *** 106,111 **** return *ppDst; } ! ! const char *DevProperties::DevId(const char *_pDevId) { --- 108,112 ---- return *ppDst; } ! /////////////////////////////////////////////////////////////// const char *DevProperties::DevId(const char *_pDevId) { *************** *** 590,593 **** --- 591,595 ---- InfFile &infFile, const char *pDevId, + const char *pDevInstID, PDEVCALLBACK pDevCallBack, void *pCallBackParam) *************** *** 620,625 **** devInfoData.cbSize = sizeof(devInfoData); ! res = SetupDiCreateDeviceInfo(hDevInfo, className, &classGUID, NULL, 0, ! DICD_GENERATE_ID, &devInfoData); if (!res) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCreateDeviceInfo()"); --- 622,660 ---- devInfoData.cbSize = sizeof(devInfoData); ! if (StrChr(pDevInstID, '\\')) { ! /* ! * <enumerator>\<enumerator-specific-device-ID>\<instance-specific-ID> ! */ ! ! res = SetupDiCreateDeviceInfo(hDevInfo, pDevInstID, &classGUID, NULL, 0, 0, &devInfoData); ! ! if (!res && GetLastError() == ERROR_DEVINST_ALREADY_EXISTS) { ! char *pTmpDevInstID = NULL; ! ! if (SetStr(&pTmpDevInstID, pDevInstID)) { ! char *pSave; ! char *p; ! ! p = STRTOK_R(pTmpDevInstID, "\\", &pSave); ! ! if (p && !lstrcmp(p, REGSTR_KEY_ROOTENUM)) { ! p = STRTOK_R(NULL, "\\", &pSave); ! ! res = SetupDiCreateDeviceInfo(hDevInfo, p, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData); ! } ! ! SetStr(&pTmpDevInstID, NULL); ! } else { ! SetLastError(ERROR_DEVINST_ALREADY_EXISTS); ! } ! } ! } else { ! /* ! * <enumerator-specific-device-ID> ! */ ! ! res = SetupDiCreateDeviceInfo(hDevInfo, pDevInstID, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData); ! } ! if (!res) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCreateDeviceInfo()"); *************** *** 744,747 **** --- 779,783 ---- InfFile &infFile, const char *pDevId, + const char *pDevInstID, PDEVCALLBACK pDevCallBack, void *pCallBackParam) *************** *** 750,754 **** do { ! res = TryInstallDevice(infFile, pDevId, pDevCallBack, pCallBackParam); } while (res == IDTRYAGAIN); --- 786,790 ---- do { ! res = TryInstallDevice(infFile, pDevId, pDevInstID, pDevCallBack, pCallBackParam); } while (res == IDTRYAGAIN); |
From: Vyacheslav F. <vf...@us...> - 2007-10-01 14:56:42
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23393 Modified Files: sources precomp.h Log Message: Added shlwapi Index: precomp.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/precomp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** precomp.h 28 Jul 2006 12:16:43 -0000 1.1 --- precomp.h 1 Oct 2007 14:56:39 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,27 **** * * $Log$ * Revision 1.1 2006/07/28 12:16:43 vfrolov * Initial revision * - * */ --- 20,29 ---- * * $Log$ + * Revision 1.2 2007/10/01 14:56:39 vfrolov + * Added shlwapi + * * Revision 1.1 2006/07/28 12:16:43 vfrolov * Initial revision * */ *************** *** 35,38 **** --- 37,41 ---- #pragma warning(push, 3) #include <setupapi.h> + #include <shlwapi.h> #pragma warning(pop) Index: sources =================================================================== RCS file: /cvsroot/com0com/com0com/setup/sources,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sources 14 Jun 2007 16:14:19 -0000 1.5 --- sources 1 Oct 2007 14:56:39 -0000 1.6 *************** *** 24,27 **** --- 24,28 ---- $(DDK_LIB_PATH)\user32.lib \ $(DDK_LIB_PATH)\msports.lib \ + $(DDK_LIB_PATH)\shlwapi.lib \ PRECOMPILED_INCLUDE=precomp.h |
From: Vyacheslav F. <vf...@us...> - 2007-09-26 10:12:18
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25062 Modified Files: adddev.c Log Message: Added checks of DeviceExtension for zero Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** adddev.c 20 Jul 2007 08:00:22 -0000 1.29 --- adddev.c 26 Sep 2007 10:12:13 -0000 1.30 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.30 2007/09/26 10:12:13 vfrolov + * Added checks of DeviceExtension for zero + * * Revision 1.29 2007/07/20 08:00:22 vfrolov * Implemented TX buffer *************** *** 194,198 **** pPhDevExt = (PC0C_PDOPORT_EXTENSION)pPhDevObj->DeviceExtension; ! if (pPhDevExt->doType != C0C_DOTYPE_PP) { status = STATUS_UNSUCCESSFUL; SysLog(pPhDevObj, status, L"AddFdoPort FAIL. Type of PDO is not PP"); --- 197,201 ---- pPhDevExt = (PC0C_PDOPORT_EXTENSION)pPhDevObj->DeviceExtension; ! if (!pPhDevExt || pPhDevExt->doType != C0C_DOTYPE_PP) { status = STATUS_UNSUCCESSFUL; SysLog(pPhDevObj, status, L"AddFdoPort FAIL. Type of PDO is not PP"); *************** *** 329,332 **** --- 332,336 ---- HALT_UNLESS(pNewDevObj); pDevExt = pNewDevObj->DeviceExtension; + HALT_UNLESS(pDevExt); RtlZeroMemory(pDevExt, sizeof(*pDevExt)); pDevExt->pIoPortLocal = pPhDevExt->pIoPortLocal; *************** *** 509,512 **** --- 513,517 ---- pIoPortLocal->pPhDevObj = pNewDevObj; pDevExt = (pNewDevObj)->DeviceExtension; + HALT_UNLESS(pDevExt); RtlZeroMemory(pDevExt, sizeof(*pDevExt)); status = InitCommonExt((PC0C_COMMON_EXTENSION)pDevExt, pNewDevObj, C0C_DOTYPE_PP, portName.Buffer); *************** *** 566,571 **** for (pDevObj = pDrvObj->DeviceObject ; pDevObj ; pDevObj = pDevObj->NextDevice) { ! if (((PC0C_COMMON_EXTENSION)pDevObj->DeviceExtension)->doType == C0C_DOTYPE_FB) { ! ULONG portNum = ((PC0C_FDOBUS_EXTENSION)pDevObj->DeviceExtension)->portNum; if (portNum >= numNext) --- 571,578 ---- for (pDevObj = pDrvObj->DeviceObject ; pDevObj ; pDevObj = pDevObj->NextDevice) { ! PC0C_FDOBUS_EXTENSION pDevExt = (PC0C_FDOBUS_EXTENSION)pDevObj->DeviceExtension; ! ! if (pDevExt && pDevExt->doType == C0C_DOTYPE_FB) { ! ULONG portNum = pDevExt->portNum; if (portNum >= numNext) *************** *** 592,597 **** for (pDevObj = pDrvObj->DeviceObject ; pDevObj ; pDevObj = pDevObj->NextDevice) { ! if (((PC0C_COMMON_EXTENSION)pDevObj->DeviceExtension)->doType == C0C_DOTYPE_FB) { ! ULONG portNum = ((PC0C_FDOBUS_EXTENSION)pDevObj->DeviceExtension)->portNum; maskNum = portNum/(sizeof(*pBusyMask)*8); --- 599,606 ---- for (pDevObj = pDrvObj->DeviceObject ; pDevObj ; pDevObj = pDevObj->NextDevice) { ! PC0C_FDOBUS_EXTENSION pDevExt = (PC0C_FDOBUS_EXTENSION)pDevObj->DeviceExtension; ! ! if (pDevExt && pDevExt->doType == C0C_DOTYPE_FB) { ! ULONG portNum = pDevExt->portNum; maskNum = portNum/(sizeof(*pBusyMask)*8); *************** *** 718,721 **** --- 727,731 ---- HALT_UNLESS(pNewDevObj); pDevExt = pNewDevObj->DeviceExtension; + HALT_UNLESS(pDevExt); RtlZeroMemory(pDevExt, sizeof(*pDevExt)); status = InitCommonExt((PC0C_COMMON_EXTENSION)pDevExt, pNewDevObj, C0C_DOTYPE_FB, portName.Buffer); |
From: Vyacheslav F. <vf...@us...> - 2007-09-25 12:42:53
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10503 Modified Files: setup.cpp devutils.h devutils.cpp Log Message: Fixed update command (bug if multiple pairs active) Fixed uninstall command (restore active ports on cancell) Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** devutils.h 17 Sep 2007 14:35:06 -0000 1.4 --- devutils.h 25 Sep 2007 12:42:49 -0000 1.5 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.5 2007/09/25 12:42:49 vfrolov + * Fixed update command (bug if multiple pairs active) + * Fixed uninstall command (restore active ports on cancell) + * * Revision 1.4 2007/09/17 14:35:06 vfrolov * Fixed typo *************** *** 39,48 **** /////////////////////////////////////////////////////////////// ! struct DevProperties { ! DevProperties() : pDevId(NULL), pPhObjName(NULL), pLocation(NULL) {} ! const char *pDevId; ! const char *pPhObjName; ! const char *pLocation; }; --- 43,71 ---- /////////////////////////////////////////////////////////////// ! class DevProperties { ! public: ! DevProperties() : pDevId(NULL), pPhObjName(NULL), pLocation(NULL) {} ! DevProperties(const DevProperties &o) ! : pDevId(NULL), pPhObjName(NULL), pLocation(NULL) { *this = o; } ! ~DevProperties() { DevId(NULL); PhObjName(NULL); Location(NULL); } ! DevProperties &operator=(const DevProperties &o) ! { ! DevId(o.DevId()); PhObjName(o.PhObjName()); Location(o.Location()); ! return *this; ! } ! ! const char *DevId(const char *_pDevId); ! const char *PhObjName(const char *_pPhObjName); ! const char *Location(const char *_pLocation); ! ! const char *DevId() const { return pDevId; } ! const char *PhObjName() const { return pPhObjName; } ! const char *Location() const { return pLocation; } ! ! private: ! char *pDevId; ! char *pPhObjName; ! char *pLocation; }; *************** *** 50,53 **** --- 73,77 ---- class InfFile; + class Stack; typedef BOOL (* PDEVCALLBACK)( *************** *** 71,79 **** PSP_DEVINFO_DATA pDevInfoData, PCDevProperties pDevProperties, ! BOOL *pRebootRequired); BOOL DisableDevices( InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired); --- 95,110 ---- PSP_DEVINFO_DATA pDevInfoData, PCDevProperties pDevProperties, ! BOOL *pRebootRequired, ! Stack *pDevPropertiesStack); BOOL DisableDevices( InfFile &infFile, PCDevProperties pDevProperties, + BOOL *pRebootRequired, + Stack *pDevPropertiesStack); + + BOOL EnableDevices( + InfFile &infFile, + PCDevProperties pDevProperties, BOOL *pRebootRequired); Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** setup.cpp 3 Jul 2007 14:42:10 -0000 1.15 --- setup.cpp 25 Sep 2007 12:42:49 -0000 1.16 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.16 2007/09/25 12:42:49 vfrolov + * Fixed update command (bug if multiple pairs active) + * Fixed uninstall command (restore active ports on cancell) + * * Revision 1.15 2007/07/03 14:42:10 vfrolov * Added friendly name setting for bus device *************** *** 176,182 **** if (!pBuf) { - err = GetLastError(); ComDBClose(hComDB); ! res = ShowError(MB_CANCELTRYCONTINUE, err, "LocalAlloc(%lu)", (unsigned long)maxPortsReported); continue; } --- 180,187 ---- if (!pBuf) { ComDBClose(hComDB); ! ! SetLastError(ERROR_NOT_ENOUGH_MEMORY); ! res = ShowLastError(MB_CANCELTRYCONTINUE, "LocalAlloc(%lu)", (unsigned long)maxPortsReported); continue; } *************** *** 252,255 **** --- 257,281 ---- } /////////////////////////////////////////////////////////////// + static VOID CleanDevPropertiesStack(InfFile &infFile, Stack &stack, BOOL enable, BOOL *pRebootRequired) + { + for (;;) { + StackEl *pElem = stack.Pop(); + + if (!pElem) + break; + + DevProperties *pDevProperties = (DevProperties *)pElem->pData; + + delete pElem; + + if (pDevProperties) { + if (enable && pDevProperties->PhObjName()) + EnableDevices(infFile, pDevProperties, pRebootRequired); + + delete pDevProperties; + } + } + } + /////////////////////////////////////////////////////////////// struct ChangeDeviceParams { ChangeDeviceParams(InfFile &_infFile, const char *_pPhPortName, const char *_pParameters) *************** *** 313,318 **** DevProperties devProperties; ! devProperties.pDevId = C0C_PORT_DEVICE_ID; ! devProperties.pPhObjName = phDevName; RestartDevices(infFile, &devProperties, pRebootRequired); --- 339,346 ---- DevProperties devProperties; ! if (!devProperties.DevId(C0C_PORT_DEVICE_ID)) ! return FALSE; ! if (!devProperties.PhObjName(phDevName)) ! return FALSE; RestartDevices(infFile, &devProperties, pRebootRequired); *************** *** 337,341 **** DevProperties devProperties; ! devProperties.pDevId = C0C_BUS_DEVICE_ID; EnumDevices(infFile, &devProperties, &rebootRequired, ChangeDevice, ¶ms); --- 365,370 ---- DevProperties devProperties; ! if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return 1; EnumDevices(infFile, &devProperties, &rebootRequired, ChangeDevice, ¶ms); *************** *** 365,369 **** if (i == ((RemoveDeviceParams *)pParam)->num) { ((RemoveDeviceParams *)pParam)->res = ! DisableDevice(hDevInfo, pDevInfoData, pDevProperties, pRebootRequired); if (((RemoveDeviceParams *)pParam)->res != IDCONTINUE) --- 394,398 ---- if (i == ((RemoveDeviceParams *)pParam)->num) { ((RemoveDeviceParams *)pParam)->res = ! DisableDevice(hDevInfo, pDevInfoData, pDevProperties, pRebootRequired, NULL); if (((RemoveDeviceParams *)pParam)->res != IDCONTINUE) *************** *** 385,389 **** DevProperties devProperties; ! devProperties.pDevId = C0C_BUS_DEVICE_ID; EnumDevices(infFile, &devProperties, &rebootRequired, RemoveDevice, &removeDeviceParams); --- 414,419 ---- DevProperties devProperties; ! if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return 1; EnumDevices(infFile, &devProperties, &rebootRequired, RemoveDevice, &removeDeviceParams); *************** *** 402,407 **** DevProperties devProperties; ! devProperties.pDevId = C0C_PORT_DEVICE_ID; ! devProperties.pLocation = phPortName; RemoveDevices(infFile, &devProperties, NULL); --- 432,439 ---- DevProperties devProperties; ! if (!devProperties.DevId(C0C_PORT_DEVICE_ID)) ! return 1; ! if (!devProperties.Location(phPortName)) ! return 1; RemoveDevices(infFile, &devProperties, NULL); *************** *** 443,449 **** int Update(InfFile &infFile) { ! if (!UpdateDriverForPlugAndPlayDevices(0, C0C_BUS_DEVICE_ID, infFile.Path(), INSTALLFLAG_FORCE, NULL)) return 1; return 0; } --- 475,502 ---- int Update(InfFile &infFile) { ! Stack stack; ! BOOL rebootRequired = FALSE; ! ! DevProperties devProperties; ! if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) return 1; + if (!DisableDevices(infFile, &devProperties, &rebootRequired, &stack)) { + CleanDevPropertiesStack(infFile, stack, TRUE, &rebootRequired); + return 1; + } + + BOOL rr; + + if (!UpdateDriverForPlugAndPlayDevices(0, C0C_BUS_DEVICE_ID, infFile.Path(), INSTALLFLAG_FORCE, &rr)) { + CleanDevPropertiesStack(infFile, stack, TRUE, &rebootRequired); + return 1; + } + + CleanDevPropertiesStack(infFile, stack, TRUE, &rebootRequired); + + if (rebootRequired || rr) + SetupPromptReboot(NULL, NULL, FALSE); + return 0; } *************** *** 506,510 **** DevProperties devProperties; ! devProperties.pDevId = C0C_BUS_DEVICE_ID; if (EnumDevices(infFile, &devProperties, NULL, AddDeviceToBusyMask, &busyMask) < 0) --- 559,564 ---- DevProperties devProperties; ! if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return -1; if (EnumDevices(infFile, &devProperties, NULL, AddDeviceToBusyMask, &busyMask) < 0) *************** *** 601,611 **** devProperties = DevProperties(); ! devProperties.pDevId = C0C_PORT_DEVICE_ID; ! if (!DisableDevices(infFile, &devProperties, &rebootRequired)) return 1; devProperties = DevProperties(); ! devProperties.pDevId = C0C_BUS_DEVICE_ID; if (!RemoveDevices(infFile, &devProperties, &rebootRequired)) --- 655,673 ---- devProperties = DevProperties(); ! if (!devProperties.DevId(C0C_PORT_DEVICE_ID)) ! return 1; ! Stack stack; ! ! if (!DisableDevices(infFile, &devProperties, &rebootRequired, &stack)) { ! CleanDevPropertiesStack(infFile, stack, TRUE, &rebootRequired); return 1; + } + + CleanDevPropertiesStack(infFile, stack, FALSE, &rebootRequired); devProperties = DevProperties(); ! if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return 1; if (!RemoveDevices(infFile, &devProperties, &rebootRequired)) *************** *** 845,849 **** char buf[100]; ! lstrcpyn(buf, pStr, sizeof(buf)/sizeof(buf[0])); pStr += lstrlen(buf); --- 907,911 ---- char buf[100]; ! SNPRINTF(buf, sizeof(buf)/sizeof(buf[0]), "%s", pStr); pStr += lstrlen(buf); *************** *** 887,891 **** int Main(int argc, const char* argv[]) { ! SetOutputFile(NULL); while (argc > 1) { --- 949,954 ---- int Main(int argc, const char* argv[]) { ! if (!SetOutputFile(NULL)) ! return 1; while (argc > 1) { *************** *** 894,898 **** if (!strcmp(argv[1], "--output") && argc > 2) { ! SetOutputFile(argv[2]); argv[2] = argv[0]; argv += 2; --- 957,962 ---- if (!strcmp(argv[1], "--output") && argc > 2) { ! if (!SetOutputFile(argv[2])) ! return 1; argv[2] = argv[0]; argv += 2; *************** *** 1009,1013 **** char cmd[200]; ! lstrcpyn(cmd, pCmdLine, sizeof(cmd)/sizeof(cmd[0])); int argc; --- 1073,1077 ---- char cmd[200]; ! SNPRINTF(cmd, sizeof(cmd)/sizeof(cmd[0]), "%s", pCmdLine); int argc; Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** devutils.cpp 14 Sep 2007 12:58:44 -0000 1.6 --- devutils.cpp 25 Sep 2007 12:42:49 -0000 1.7 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.7 2007/09/25 12:42:49 vfrolov + * Fixed update command (bug if multiple pairs active) + * Fixed uninstall command (restore active ports on cancell) + * * Revision 1.6 2007/09/14 12:58:44 vfrolov * Removed INSTALLFLAG_FORCE *************** *** 52,55 **** --- 56,60 ---- struct EnumParams { EnumParams() { + pDevProperties = NULL; pParam1 = NULL; pParam2 = NULL; *************** *** 58,62 **** } ! DevProperties devProperties; void *pParam1; void *pParam2; --- 63,67 ---- } ! PCDevProperties pDevProperties; void *pParam1; void *pParam2; *************** *** 77,80 **** --- 82,125 ---- typedef DevParams *PDevParams; + + /////////////////////////////////////////////////////////////// + static const char *SetStr(char **ppDst, const char *pSrc) + { + if (*ppDst) { + LocalFree(*ppDst); + *ppDst = NULL; + } + + if (pSrc) { + int len = lstrlen(pSrc) + 1; + + *ppDst = (char *)LocalAlloc(LPTR, len * sizeof(pSrc[0])); + + if (*ppDst) { + SNPRINTF(*ppDst, len, "%s", pSrc); + } else { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc(%lu)", (unsigned long)(len * sizeof(pSrc[0]))); + } + } + + return *ppDst; + } + + + const char *DevProperties::DevId(const char *_pDevId) + { + return SetStr(&pDevId, _pDevId); + } + + const char *DevProperties::PhObjName(const char *_pPhObjName) + { + return SetStr(&pPhObjName, _pPhObjName); + } + + const char *DevProperties::Location(const char *_pLocation) + { + return SetStr(&pLocation, _pLocation); + } /////////////////////////////////////////////////////////////// static int EnumDevices( *************** *** 120,128 **** char hwid[40]; ! if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, NULL, (PBYTE)hwid, sizeof(hwid), NULL)) ! devParams.devProperties.pDevId = hwid; ! if (pEnumParams->devProperties.pDevId && (!devParams.devProperties.pDevId || ! lstrcmpi(devParams.devProperties.pDevId, pEnumParams->devProperties.pDevId))) { continue; --- 165,178 ---- char hwid[40]; ! if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, NULL, (PBYTE)hwid, sizeof(hwid), NULL)) { ! if (!devParams.devProperties.DevId(hwid)) { ! res = IDCANCEL; ! break; ! } ! } ! if (pEnumParams->pDevProperties && ! pEnumParams->pDevProperties->DevId() && (!devParams.devProperties.DevId() || ! lstrcmpi(devParams.devProperties.DevId(), pEnumParams->pDevProperties->DevId()))) { continue; *************** *** 131,139 **** char location[40]; ! if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_LOCATION_INFORMATION, NULL, (PBYTE)location, sizeof(location), NULL)) ! devParams.devProperties.pLocation = location; ! if (pEnumParams->devProperties.pLocation && (!devParams.devProperties.pLocation || ! lstrcmpi(devParams.devProperties.pLocation, pEnumParams->devProperties.pLocation))) { continue; --- 181,194 ---- char location[40]; ! if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_LOCATION_INFORMATION, NULL, (PBYTE)location, sizeof(location), NULL)) { ! if (!devParams.devProperties.Location(location)) { ! res = IDCANCEL; ! break; ! } ! } ! if (pEnumParams->pDevProperties && ! pEnumParams->pDevProperties->Location() && (!devParams.devProperties.Location() || ! lstrcmpi(devParams.devProperties.Location(), pEnumParams->pDevProperties->Location()))) { continue; *************** *** 142,150 **** char name[40]; ! if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_PHYSICAL_DEVICE_OBJECT_NAME, NULL, (PBYTE)name, sizeof(name), NULL)) ! devParams.devProperties.pPhObjName = name; ! if (pEnumParams->devProperties.pPhObjName && (!devParams.devProperties.pPhObjName || ! lstrcmpi(devParams.devProperties.pPhObjName, pEnumParams->devProperties.pPhObjName))) { continue; --- 197,210 ---- char name[40]; ! if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_PHYSICAL_DEVICE_OBJECT_NAME, NULL, (PBYTE)name, sizeof(name), NULL)) { ! if (!devParams.devProperties.PhObjName(name)) { ! res = IDCANCEL; ! break; ! } ! } ! if (pEnumParams->pDevProperties && ! pEnumParams->pDevProperties->PhObjName() && (!devParams.devProperties.PhObjName() || ! lstrcmpi(devParams.devProperties.PhObjName(), pEnumParams->pDevProperties->PhObjName()))) { continue; *************** *** 213,223 **** } /////////////////////////////////////////////////////////////// static int EnumDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { /* Trace("Enumerated %s %s %s\n", ! pDevParams->devProperties.pLocation, ! pDevParams->devProperties.pDevId, ! pDevParams->devProperties.pPhObjName); */ --- 273,294 ---- } /////////////////////////////////////////////////////////////// + static BOOL IsDisabled(PSP_DEVINFO_DATA pDevInfoData) + { + ULONG status = 0; + ULONG problem = 0; + + if (CM_Get_DevNode_Status(&status, &problem, pDevInfoData->DevInst, 0) != CR_SUCCESS) + return FALSE; + + return (status & DN_HAS_PROBLEM) != 0 && problem == CM_PROB_DISABLED; + } + /////////////////////////////////////////////////////////////// static int EnumDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { /* Trace("Enumerated %s %s %s\n", ! pDevParams->devProperties.Location(), ! pDevParams->devProperties.DevId(), ! pDevParams->devProperties.PhObjName()); */ *************** *** 249,255 **** EnumParams enumParams; ! if (pDevProperties) ! enumParams.devProperties = *pDevProperties; ! enumParams.pRebootRequired = pRebootRequired; enumParams.pParam1 = pDevCallBack; --- 320,324 ---- EnumParams enumParams; ! enumParams.pDevProperties = pDevProperties; enumParams.pRebootRequired = pRebootRequired; enumParams.pParam1 = pDevCallBack; *************** *** 266,278 **** PSP_DEVINFO_DATA pDevInfoData, PCDevProperties pDevProperties, ! BOOL *pRebootRequired) { if (!ChangeState(hDevInfo, pDevInfoData, DICS_DISABLE)) return IDCANCEL; Trace("Disabled %s %s %s\n", ! pDevProperties->pLocation, ! pDevProperties->pDevId, ! pDevProperties->pPhObjName); if (pRebootRequired && !*pRebootRequired) { --- 335,351 ---- PSP_DEVINFO_DATA pDevInfoData, PCDevProperties pDevProperties, ! BOOL *pRebootRequired, ! Stack *pDevPropertiesStack) { + if (IsDisabled(pDevInfoData)) + return IDCONTINUE; + if (!ChangeState(hDevInfo, pDevInfoData, DICS_DISABLE)) return IDCANCEL; Trace("Disabled %s %s %s\n", ! pDevProperties->Location(), ! pDevProperties->DevId(), ! pDevProperties->PhObjName()); if (pRebootRequired && !*pRebootRequired) { *************** *** 287,293 **** "Close application that use this device and Try Again.\n" "Or Continue and then reboot system.\n", ! pDevProperties->pLocation, ! pDevProperties->pDevId, ! pDevProperties->pPhObjName); if (res != IDCONTINUE) { --- 360,366 ---- "Close application that use this device and Try Again.\n" "Or Continue and then reboot system.\n", ! pDevProperties->Location(), ! pDevProperties->DevId(), ! pDevProperties->PhObjName()); if (res != IDCONTINUE) { *************** *** 296,302 **** Trace("Enabled %s %s %s\n", ! pDevProperties->pLocation, ! pDevProperties->pDevId, ! pDevProperties->pPhObjName); return res; --- 369,375 ---- Trace("Enabled %s %s %s\n", ! pDevProperties->Location(), ! pDevProperties->DevId(), ! pDevProperties->PhObjName()); return res; *************** *** 307,310 **** --- 380,396 ---- } + if (pDevPropertiesStack) { + DevProperties *pDevProp = new DevProperties(*pDevProperties); + + if (pDevProp) { + StackEl *pElem = new StackEl(pDevProp); + + if (pElem) + pDevPropertiesStack->Push(pElem); + else + delete pDevProp; + } + } + return IDCONTINUE; } *************** *** 312,318 **** static int DisableDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { ! int res = DisableDevice(hDevInfo, pDevInfoData, &pDevParams->devProperties, pDevParams->pEnumParams->pRebootRequired); ! if (res != IDCONTINUE) pDevParams->pEnumParams->count++; --- 398,408 ---- static int DisableDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { ! int res = DisableDevice(hDevInfo, ! pDevInfoData, ! &pDevParams->devProperties, ! pDevParams->pEnumParams->pRebootRequired, ! (Stack *)pDevParams->pEnumParams->pParam1); ! if (res == IDCONTINUE) pDevParams->pEnumParams->count++; *************** *** 323,327 **** InfFile &infFile, PCDevProperties pDevProperties, ! BOOL *pRebootRequired) { EnumParams enumParams; --- 413,418 ---- InfFile &infFile, PCDevProperties pDevProperties, ! BOOL *pRebootRequired, ! Stack *pDevPropertiesStack) { EnumParams enumParams; *************** *** 330,335 **** enumParams.pRebootRequired = pRebootRequired; ! if (pDevProperties) ! enumParams.devProperties = *pDevProperties; do { --- 421,426 ---- enumParams.pRebootRequired = pRebootRequired; ! enumParams.pDevProperties = pDevProperties; ! enumParams.pParam1 = pDevPropertiesStack; do { *************** *** 345,348 **** --- 436,473 ---- } /////////////////////////////////////////////////////////////// + static int EnableDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) + { + if (ChangeState(hDevInfo, pDevInfoData, DICS_ENABLE)) { + Trace("Enabled %s %s %s\n", + pDevParams->devProperties.Location(), + pDevParams->devProperties.DevId(), + pDevParams->devProperties.PhObjName()); + } + + return IDCONTINUE; + } + + BOOL EnableDevices( + InfFile &infFile, + PCDevProperties pDevProperties, + BOOL *pRebootRequired) + { + EnumParams enumParams; + + int res; + + enumParams.pRebootRequired = pRebootRequired; + enumParams.pDevProperties = pDevProperties; + + do { + res = EnumDevices(infFile, DIGCF_PRESENT, EnableDevice, &enumParams); + } while (res == IDTRYAGAIN); + + if (res != IDCONTINUE) + return FALSE; + + return TRUE; + } + /////////////////////////////////////////////////////////////// static int RestartDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { *************** *** 361,367 **** "Close application that use this device and Try Again.\n" "Or Continue and then reboot system.\n", ! pDevParams->devProperties.pLocation, ! pDevParams->devProperties.pDevId, ! pDevParams->devProperties.pPhObjName); if (res != IDCONTINUE) { --- 486,492 ---- "Close application that use this device and Try Again.\n" "Or Continue and then reboot system.\n", ! pDevParams->devProperties.Location(), ! pDevParams->devProperties.DevId(), ! pDevParams->devProperties.PhObjName()); if (res != IDCONTINUE) { *************** *** 378,384 **** if (!pDevParams->pEnumParams->pRebootRequired || !*pDevParams->pEnumParams->pRebootRequired) { Trace("Restarted %s %s %s\n", ! pDevParams->devProperties.pLocation, ! pDevParams->devProperties.pDevId, ! pDevParams->devProperties.pPhObjName); pDevParams->pEnumParams->count++; --- 503,509 ---- if (!pDevParams->pEnumParams->pRebootRequired || !*pDevParams->pEnumParams->pRebootRequired) { Trace("Restarted %s %s %s\n", ! pDevParams->devProperties.Location(), ! pDevParams->devProperties.DevId(), ! pDevParams->devProperties.PhObjName()); pDevParams->pEnumParams->count++; *************** *** 398,403 **** enumParams.pRebootRequired = pRebootRequired; ! if (pDevProperties) ! enumParams.devProperties = *pDevProperties; do { --- 523,527 ---- enumParams.pRebootRequired = pRebootRequired; ! enumParams.pDevProperties = pDevProperties; do { *************** *** 419,427 **** if (!SetupDiCallClassInstaller(DIF_REMOVE, hDevInfo, pDevInfoData)) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCallClassInstaller(DIF_REMOVE, %s, %s)", ! pDevProperties->pDevId, pDevProperties->pPhObjName); return FALSE; } ! Trace("Removed %s %s %s\n", pDevProperties->pLocation, pDevProperties->pDevId, pDevProperties->pPhObjName); return UpdateRebootRequired(hDevInfo, pDevInfoData, pRebootRequired); --- 543,551 ---- if (!SetupDiCallClassInstaller(DIF_REMOVE, hDevInfo, pDevInfoData)) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCallClassInstaller(DIF_REMOVE, %s, %s)", ! pDevProperties->DevId(), pDevProperties->PhObjName()); return FALSE; } ! Trace("Removed %s %s %s\n", pDevProperties->Location(), pDevProperties->DevId(), pDevProperties->PhObjName()); return UpdateRebootRequired(hDevInfo, pDevInfoData, pRebootRequired); *************** *** 448,453 **** enumParams.pRebootRequired = pRebootRequired; ! if (pDevProperties) ! enumParams.devProperties = *pDevProperties; do { --- 572,576 ---- enumParams.pRebootRequired = pRebootRequired; ! enumParams.pDevProperties = pDevProperties; do { *************** *** 476,480 **** updateErr = ERROR_SUCCESS; ! if (!SetupDiGetINFClass(infFile.Path(), &classGUID, className, sizeof(className), 0)) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiGetINFClass(%s)", infFile.Path()); return IDCANCEL; --- 599,603 ---- updateErr = ERROR_SUCCESS; ! if (!SetupDiGetINFClass(infFile.Path(), &classGUID, className, sizeof(className)/sizeof(className[0]), 0)) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiGetINFClass(%s)", infFile.Path()); return IDCANCEL; *************** *** 506,518 **** char hardwareId[MAX_DEVICE_ID_LEN + 1 + 1]; ! memset(hardwareId, 0, sizeof(hardwareId)); ! lstrcpyn(hardwareId, pDevId, sizeof(hardwareId) - 1 - 1); ! int hardwareIdSize; ! hardwareIdSize = (lstrlen(hardwareId) + 1 + 1) * sizeof(hardwareId[0]); res = SetupDiSetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, ! (LPBYTE)hardwareId, hardwareIdSize); if (!res) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiSetDeviceRegistryProperty()"); --- 629,641 ---- char hardwareId[MAX_DEVICE_ID_LEN + 1 + 1]; ! SNPRINTF(hardwareId, sizeof(hardwareId)/sizeof(hardwareId[0]) - 1, "%s", pDevId); ! int hardwareIdLen; ! hardwareIdLen = lstrlen(hardwareId) + 1 + 1; ! hardwareId[hardwareIdLen - 1] = 0; res = SetupDiSetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, ! (LPBYTE)hardwareId, hardwareIdLen * sizeof(hardwareId[0])); if (!res) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiSetDeviceRegistryProperty()"); *************** *** 530,534 **** DevProperties devProperties; ! devProperties.pDevId = pDevId; res = pDevCallBack(hDevInfo, &devInfoData, &devProperties, NULL, pCallBackParam); --- 653,660 ---- DevProperties devProperties; ! if (!devProperties.DevId(pDevId)) { ! res = FALSE; ! goto err1; ! } res = pDevCallBack(hDevInfo, &devInfoData, &devProperties, NULL, pCallBackParam); |
From: Vyacheslav F. <vf...@us...> - 2007-09-25 12:28:27
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv5068 Modified Files: utils.h Log Message: Implemented Stack class Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** utils.h 11 Jan 2007 15:03:43 -0000 1.4 --- utils.h 25 Sep 2007 12:28:22 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2007/09/25 12:28:22 vfrolov + * Implemented Stack class + * * Revision 1.4 2007/01/11 15:03:43 vfrolov * Added STRTOK_R() *************** *** 56,58 **** --- 59,95 ---- }; + class StackEl { + public: + StackEl(PVOID _pData) : pData(_pData), pNext(NULL) {} + PVOID pData; + private: + StackEl *pNext; + + friend class Stack; + }; + + class Stack { + public: + Stack() : pFirst(NULL) {} + BOOL Push(StackEl *pElem) + { + if (!pElem) + return FALSE; + pElem->pNext = pFirst; + pFirst = pElem; + return TRUE; + } + StackEl *Pop() + { + StackEl *pTop = pFirst; + if (pTop) { + pFirst = pTop->pNext; + pTop->pNext = NULL; + } + return pTop; + } + private: + StackEl *pFirst; + }; + #endif /* _C0C_UTILS_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2007-09-20 12:43:07
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21590 Modified Files: params.cpp Log Message: Added parameters string length check Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** params.cpp 17 Sep 2007 14:33:38 -0000 1.7 --- params.cpp 20 Sep 2007 12:43:03 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2007/09/20 12:43:03 vfrolov + * Added parameters string length check + * * Revision 1.7 2007/09/17 14:33:38 vfrolov * Implemented pseudo pin OPEN *************** *** 80,85 **** PortParameters::PortParameters(const char *pService, const char *pPhPortName) { ! SNPRINTF(service, sizeof(service), "%s", pService); ! SNPRINTF(phPortName, sizeof(phPortName), "%s", pPhPortName); Init(); --- 83,88 ---- PortParameters::PortParameters(const char *pService, const char *pPhPortName) { ! SNPRINTF(service, sizeof(service)/sizeof(service[0]), "%s", pService); ! SNPRINTF(phPortName, sizeof(phPortName)/sizeof(phPortName[0]), "%s", pPhPortName); Init(); *************** *** 88,92 **** void PortParameters::Init() { ! SNPRINTF(portName, sizeof(portName), "%s", phPortName); emuBR = 0; emuOverrun = 0; --- 91,95 ---- void PortParameters::Init() { ! SNPRINTF(portName, sizeof(portName)/sizeof(portName[0]), "%s", phPortName); emuBR = 0; emuOverrun = 0; *************** *** 122,127 **** if (lstrcmpi(portName, pNewPortName)) { ! lstrcpyn(portName, pNewPortName, sizeof(portName)); ! portName[sizeof(portName) - 1] = 0; maskChanged |= m_portName; } --- 125,129 ---- if (lstrcmpi(portName, pNewPortName)) { ! SNPRINTF(portName, sizeof(portName)/sizeof(portName[0]), "%s", pNewPortName); maskChanged |= m_portName; } *************** *** 372,376 **** char reqKey[100]; ! FillParametersKey(reqKey, sizeof(reqKey)); LONG err; --- 374,378 ---- char reqKey[100]; ! FillParametersKey(reqKey, sizeof(reqKey)/sizeof(reqKey[0])); LONG err; *************** *** 389,393 **** return err; ! char buf[20]; DWORD len; --- 391,395 ---- return err; ! BYTE buf[sizeof(portName)]; DWORD len; *************** *** 398,406 **** NULL, NULL, ! (PBYTE)buf, &len); if (err == ERROR_SUCCESS) { ! SNPRINTF(portName, sizeof(portName), "%s", buf); maskExplicit |= m_portName; --- 400,408 ---- NULL, NULL, ! buf, &len); if (err == ERROR_SUCCESS) { ! SNPRINTF(portName, sizeof(portName)/sizeof(portName[0]), "%s", (char *)buf); maskExplicit |= m_portName; *************** *** 429,433 **** char reqKey[100]; ! FillParametersKey(reqKey, sizeof(reqKey)); LONG err; --- 431,435 ---- char reqKey[100]; ! FillParametersKey(reqKey, sizeof(reqKey)/sizeof(reqKey[0])); LONG err; *************** *** 511,516 **** char pars[200]; ! lstrcpyn(pars, pParameters, sizeof(pars)); ! pars[sizeof(pars) - 1] = 0; char *pSave1; --- 513,520 ---- char pars[200]; ! if (SNPRINTF(pars, sizeof(pars)/sizeof(pars[0]), "%s", pParameters) < 0) { ! Trace("The parameters string '%s' is too long\n", pParameters); ! return FALSE; ! } char *pSave1; |
From: Vyacheslav F. <vf...@us...> - 2007-09-20 12:40:02
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20405 Modified Files: inffile.cpp Log Message: Added SetLastError(ERROR_NOT_ENOUGH_MEMORY) Index: inffile.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/inffile.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** inffile.cpp 15 Jun 2007 09:45:50 -0000 1.4 --- inffile.cpp 20 Sep 2007 12:39:59 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2007/09/20 12:39:59 vfrolov + * Added SetLastError(ERROR_NOT_ENOUGH_MEMORY) + * * Revision 1.4 2007/06/15 09:45:50 vfrolov * Increased list size for SetupGetInfFileList() *************** *** 76,80 **** } } else { ! ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc()"); return FALSE; } --- 79,84 ---- } } else { ! SetLastError(ERROR_NOT_ENOUGH_MEMORY); ! ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc(%lu)", (unsigned long)(size*sizeof(*ppValue[0]))); return FALSE; } *************** *** 141,148 **** pPath = (char *)LocalAlloc(LPTR, (len + 1)*sizeof(path[0])); ! if (pPath) lstrcpy(pPath, path); ! else ! ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc()"); } } --- 145,154 ---- pPath = (char *)LocalAlloc(LPTR, (len + 1)*sizeof(path[0])); ! if (pPath) { lstrcpy(pPath, path); ! } else { ! SetLastError(ERROR_NOT_ENOUGH_MEMORY); ! ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc(%lu)", (unsigned long)(sizeof(path)/sizeof(path[0]))); ! } } } *************** *** 437,445 **** } } else { - DWORD err = GetLastError(); - Trace("\n"); ! ShowError(MB_OK|MB_ICONSTOP, err, "LocalAlloc(%lu)", (unsigned long)size); return FALSE; } --- 443,450 ---- } } else { Trace("\n"); ! SetLastError(ERROR_NOT_ENOUGH_MEMORY); ! ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc(%lu)", (unsigned long)size); return FALSE; } |
From: Vyacheslav F. <vf...@us...> - 2007-09-20 12:37:10
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19526 Modified Files: utils.cpp Log Message: Added SetLastError(ERROR_NOT_ENOUGH_MEMORY) Index: utils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** utils.cpp 29 May 2007 15:22:00 -0000 1.5 --- utils.cpp 20 Sep 2007 12:37:06 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2007/09/20 12:37:06 vfrolov + * Added SetLastError(ERROR_NOT_ENOUGH_MEMORY) + * * Revision 1.5 2007/05/29 15:22:00 vfrolov * Fixed buffer overflow *************** *** 171,174 **** --- 174,178 ---- busyMaskLen = newBusyMaskLen; } else { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } |
From: Vyacheslav F. <vf...@us...> - 2007-09-20 12:29:09
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16168 Modified Files: msg.cpp msg.h Log Message: Added return value to SetOutputFile() Index: msg.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/msg.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** msg.h 21 Nov 2006 11:34:55 -0000 1.3 --- msg.h 20 Sep 2007 12:29:03 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2007/09/20 12:29:03 vfrolov + * Added return value to SetOutputFile() + * * Revision 1.3 2006/11/21 11:34:55 vfrolov * Added *************** *** 46,50 **** BOOL IsConsoleOpen(); void SetTitle(const char *pTitle); ! void SetOutputFile(const char *pFile); const char *GetOutputFile(); --- 49,53 ---- BOOL IsConsoleOpen(); void SetTitle(const char *pTitle); ! BOOL SetOutputFile(const char *pFile); const char *GetOutputFile(); Index: msg.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/msg.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** msg.cpp 21 Nov 2006 11:34:55 -0000 1.4 --- msg.cpp 20 Sep 2007 12:29:03 -0000 1.5 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2007/09/20 12:29:03 vfrolov + * Added return value to SetOutputFile() + * * Revision 1.4 2006/11/21 11:34:55 vfrolov * Added *************** *** 242,249 **** void SetTitle(const char *pTitle) { ! lstrcpyn(title, pTitle, sizeof(title)/sizeof(title[0])); } /////////////////////////////////////////////////////////////// ! void SetOutputFile(const char *pFile) { if (pOutputFile) { --- 245,252 ---- void SetTitle(const char *pTitle) { ! SNPRINTF(title, sizeof(title)/sizeof(title[0]), "%s", pTitle); } /////////////////////////////////////////////////////////////// ! BOOL SetOutputFile(const char *pFile) { if (pOutputFile) { *************** *** 253,261 **** if (pFile) { ! pOutputFile = (char *)LocalAlloc(LPTR, (lstrlen(pFile) + 1)*sizeof(*pFile)); ! if (pOutputFile) lstrcpy(pOutputFile, pFile); } } /////////////////////////////////////////////////////////////// --- 256,273 ---- if (pFile) { ! DWORD size = (lstrlen(pFile) + 1)*sizeof(*pFile); ! pOutputFile = (char *)LocalAlloc(LPTR, size); ! ! if (pOutputFile) { lstrcpy(pOutputFile, pFile); + } else { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc(%lu)", (unsigned long)size); + return FALSE; + } } + + return TRUE; } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2007-09-17 14:35:09
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19915 Modified Files: devutils.h Log Message: Fixed typo Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** devutils.h 10 Nov 2006 14:07:40 -0000 1.3 --- devutils.h 17 Sep 2007 14:35:06 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2007/09/17 14:35:06 vfrolov + * Fixed typo + * * Revision 1.3 2006/11/10 14:07:40 vfrolov * Implemented remove command *************** *** 37,41 **** struct DevProperties { ! DevProperties() : pDevId(), pPhObjName(), pLocation() {} const char *pDevId; --- 40,44 ---- struct DevProperties { ! DevProperties() : pDevId(NULL), pPhObjName(NULL), pLocation(NULL) {} const char *pDevId; |
From: Vyacheslav F. <vf...@us...> - 2007-09-17 14:33:41
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv19266 Modified Files: params.cpp Log Message: Implemented pseudo pin OPEN Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** params.cpp 3 Jul 2007 14:39:49 -0000 1.6 --- params.cpp 17 Sep 2007 14:33:38 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2007/09/17 14:33:38 vfrolov + * Implemented pseudo pin OPEN + * * Revision 1.6 2007/07/03 14:39:49 vfrolov * Implemented pinout customization *************** *** 234,237 **** --- 237,244 ---- } else + if (!lstrcmpi(pNewVal, "ropen")) { + newPin |= C0C_PIN_ROPEN; + } + else if (!lstrcmpi(pNewVal, "lrts")) { newPin |= C0C_PIN_LRTS; *************** *** 246,249 **** --- 253,260 ---- } else + if (!lstrcmpi(pNewVal, "lopen")) { + newPin |= C0C_PIN_LOPEN; + } + else if (!lstrcmpi(pNewVal, "on")) { newPin |= C0C_PIN_ON; *************** *** 617,623 **** --- 628,636 ---- case C0C_PIN_RDTR: pVal = "rdtr"; break; case C0C_PIN_ROUT1: pVal = "rout1"; break; + case C0C_PIN_ROPEN: pVal = "ropen"; break; case C0C_PIN_LRTS: pVal = "lrts"; break; case C0C_PIN_LDTR: pVal = "ldtr"; break; case C0C_PIN_LOUT1: pVal = "lout1"; break; + case C0C_PIN_LOPEN: pVal = "lopen"; break; case C0C_PIN_ON: pVal = "on"; break; } *************** *** 674,679 **** "\n" "The possible values of <p> above can be rrts, lrts, rdtr, ldtr, rout1, lout1\n" ! "(remote/local RTS/DTR/OUT1) or on (logical ON). The exclamation sign (!) can\n" ! "be used to invert the value.\n" "\n" "Special values:\n" --- 687,693 ---- "\n" "The possible values of <p> above can be rrts, lrts, rdtr, ldtr, rout1, lout1\n" ! "(remote/local RTS/DTR/OUT1), ropen, lopen (logical ON if remote/local port is\n" ! "open) or on (logical ON). The exclamation sign (!) can be used to invert the\n" ! "value.\n" "\n" "Special values:\n" |
From: Vyacheslav F. <vf...@us...> - 2007-09-17 14:31:10
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18353 Modified Files: com0com.h ioctl.c openclos.c pinouts.c tracetbl.c Log Message: Implemented pseudo pin OPEN Index: openclos.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/openclos.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** openclos.c 3 Jul 2007 14:35:17 -0000 1.19 --- openclos.c 17 Sep 2007 14:31:06 -0000 1.20 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.20 2007/09/17 14:31:06 vfrolov + * Implemented pseudo pin OPEN + * * Revision 1.19 2007/07/03 14:35:17 vfrolov * Implemented pinout customization *************** *** 168,171 **** --- 171,175 ---- SetHandFlow(pIoPort, NULL, &queueToComplete); + SetModemControl(pIoPort, C0C_MCR_OPEN, C0C_MCR_OPEN, &queueToComplete); KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); *************** *** 222,226 **** pIoPort->writeHoldingRemote = 0; pIoPort->sendXonXoff = 0; ! SetModemControl(pIoPort, 0, C0C_MCR_RTS | C0C_MCR_DTR, &queueToComplete); FreeBuffer(&pIoPort->readBuf); SetBreakHolding(pIoPort, FALSE); --- 226,230 ---- pIoPort->writeHoldingRemote = 0; pIoPort->sendXonXoff = 0; ! SetModemControl(pIoPort, 0, C0C_MCR_RTS | C0C_MCR_DTR | C0C_MCR_OPEN, &queueToComplete); FreeBuffer(&pIoPort->readBuf); SetBreakHolding(pIoPort, FALSE); Index: pinouts.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/pinouts.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pinouts.c 3 Jul 2007 14:35:17 -0000 1.1 --- pinouts.c 17 Sep 2007 14:31:06 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2007/09/17 14:31:06 vfrolov + * Implemented pseudo pin OPEN + * * Revision 1.1 2007/07/03 14:35:17 vfrolov * Implemented pinout customization *************** *** 77,80 **** --- 80,84 ---- SET_PIN_OUTS(DTR); SET_PIN_OUTS(OUT1); + SET_PIN_OUTS(OPEN); #undef SET_PIN_OUTS *************** *** 136,139 **** --- 140,144 ---- CASE_PIN(DTR) CASE_PIN(OUT1) + CASE_PIN(OPEN) #undef CASE_PIN Index: tracetbl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/tracetbl.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** tracetbl.c 21 Feb 2007 16:52:34 -0000 1.12 --- tracetbl.c 17 Sep 2007 14:31:06 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2007/09/17 14:31:06 vfrolov + * Implemented pseudo pin OPEN + * * Revision 1.12 2007/02/21 16:52:34 vfrolov * Added tracing of IRP_MJ_POWER with more details *************** *** 257,265 **** CODE2NAME codeNameTableModemControl[] = { ! {SERIAL_DTR_STATE, "DTR"}, ! {SERIAL_RTS_STATE, "RTS"}, ! {0x04, "OUT1"}, ! {0x08, "OUT2"}, ! {0x10, "LOOP"}, {0, NULL} }; --- 260,269 ---- CODE2NAME codeNameTableModemControl[] = { ! TOCODE2NAME(C0C_MCR_, DTR), ! TOCODE2NAME(C0C_MCR_, RTS), ! TOCODE2NAME(C0C_MCR_, OUT1), ! TOCODE2NAME(C0C_MCR_, OUT2), ! TOCODE2NAME(C0C_MCR_, LOOP), ! TOCODE2NAME(C0C_MCR_, OPEN), {0, NULL} }; Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/ioctl.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ioctl.c 9 Jul 2007 11:15:42 -0000 1.32 --- ioctl.c 17 Sep 2007 14:31:06 -0000 1.33 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.33 2007/09/17 14:31:06 vfrolov + * Implemented pseudo pin OPEN + * * Revision 1.32 2007/07/09 11:15:42 vfrolov * Implemented IOCTL_SERIAL_SET_MODEM_CONTROL *************** *** 245,249 **** pIoPortLocal, (UCHAR)*(PULONG)pIrp->AssociatedIrp.SystemBuffer, ! (UCHAR)~0, &queueToComplete); --- 248,252 ---- pIoPortLocal, (UCHAR)*(PULONG)pIrp->AssociatedIrp.SystemBuffer, ! (UCHAR)C0C_MCR_MASK, &queueToComplete); *************** *** 276,280 **** KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! modemControl = pIoPortLocal->modemControl; KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); --- 279,283 ---- KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! modemControl = pIoPortLocal->modemControl & C0C_MCR_MASK; KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** com0com.h 20 Jul 2007 08:00:22 -0000 1.37 --- com0com.h 17 Sep 2007 14:31:06 -0000 1.38 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.38 2007/09/17 14:31:06 vfrolov + * Implemented pseudo pin OPEN + * * Revision 1.37 2007/07/20 08:00:22 vfrolov * Implemented TX buffer *************** *** 272,277 **** #define C0C_PIN_OUTS_DTR 1 #define C0C_PIN_OUTS_OUT1 2 ! C0C_PIN_OUTS pinOuts[3]; SERIAL_HANDFLOW handFlow; --- 275,281 ---- #define C0C_PIN_OUTS_DTR 1 #define C0C_PIN_OUTS_OUT1 2 + #define C0C_PIN_OUTS_OPEN 3 ! C0C_PIN_OUTS pinOuts[4]; SERIAL_HANDFLOW handFlow; *************** *** 298,301 **** --- 302,307 ---- #define C0C_MCR_OUT2 0x08 #define C0C_MCR_LOOP 0x10 + #define C0C_MCR_OPEN 0x80 + #define C0C_MCR_MASK (~(C0C_MCR_OPEN)) UCHAR modemControl; |
From: Vyacheslav F. <vf...@us...> - 2007-09-17 14:28:11
|
Update of /cvsroot/com0com/com0com/include In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17061 Modified Files: com0com.h Log Message: Implemented pseudo pin OPEN Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/include/com0com.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** com0com.h 3 Jul 2007 14:25:12 -0000 1.4 --- com0com.h 17 Sep 2007 14:28:07 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2007/09/17 14:28:07 vfrolov + * Implemented pseudo pin OPEN + * * Revision 1.4 2007/07/03 14:25:12 vfrolov * Implemented pinout customization *************** *** 54,60 **** --- 57,65 ---- #define C0C_PIN_RDTR 0x00000002 #define C0C_PIN_ROUT1 0x00000004 + #define C0C_PIN_ROPEN 0x00000080 #define C0C_PIN_LRTS 0x00000100 #define C0C_PIN_LDTR 0x00000200 #define C0C_PIN_LOUT1 0x00000400 + #define C0C_PIN_LOPEN 0x00008000 #define C0C_PIN_ON 0x10000000 #define C0C_PIN_NEGATIVE 0x80000000 |
From: Vyacheslav F. <vf...@us...> - 2007-09-14 12:58:52
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2783 Modified Files: devutils.cpp Log Message: Removed INSTALLFLAG_FORCE Added UpdateDriverForPlugAndPlayDevices() retrying Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** devutils.cpp 15 Feb 2007 08:48:45 -0000 1.5 --- devutils.cpp 14 Sep 2007 12:58:44 -0000 1.6 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.6 2007/09/14 12:58:44 vfrolov + * Removed INSTALLFLAG_FORCE + * Added UpdateDriverForPlugAndPlayDevices() retrying + * * Revision 1.5 2007/02/15 08:48:45 vfrolov * Fixed 1658441 - Installation Failed *************** *** 534,543 **** } ! BOOL rebootRequired; ! res = UpdateDriverForPlugAndPlayDevices(0, pDevId, infFile.Path(), INSTALLFLAG_FORCE, &rebootRequired); ! if (!res) { ! updateErr = GetLastError(); err1: --- 538,567 ---- } ! int i; ! for (i = 0 ; i < 10 ; i++) { ! BOOL rebootRequired; ! ! res = UpdateDriverForPlugAndPlayDevices(0, pDevId, infFile.Path(), 0, &rebootRequired); ! ! if (res) { ! updateErr = ERROR_SUCCESS; ! } else { ! updateErr = GetLastError(); + if (updateErr == ERROR_SHARING_VIOLATION) { + Trace("."); + Sleep(1000); + continue; + } + } + + if (i) + Trace("\n"); + + break; + } + + if (updateErr != ERROR_SUCCESS) { err1: *************** *** 585,589 **** } ! ShowError(MB_OK|MB_ICONSTOP, updateErr, "UpdateDriverForPlugAndPlayDevices()"); } --- 609,613 ---- } ! return ShowError(MB_CANCELTRYCONTINUE, updateErr, "UpdateDriverForPlugAndPlayDevices()"); } |
From: Vyacheslav F. <vf...@us...> - 2007-09-12 12:32:57
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7851 Modified Files: io.c Log Message: Fixed TX buffer Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/io.c,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** io.c 20 Jul 2007 08:00:22 -0000 1.35 --- io.c 12 Sep 2007 12:32:53 -0000 1.36 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.36 2007/09/12 12:32:53 vfrolov + * Fixed TX buffer + * * Revision 1.35 2007/07/20 08:00:22 vfrolov * Implemented TX buffer *************** *** 1170,1185 **** if (dataChar.data.chr.isChr) { ! if (!pWriteLimit || *pWriteLimit) { ! if (CAN_WRITE_RW_DATA_CHR(pIoPortWrite, dataChar)) { ! SIZE_T done = 0; ! WriteToBuffers(&dataChar, pIoPortRead, ! pQueueToComplete, pWriteLimit, pWriteDelay, &done, &doneSend); ! } ! else ! if (pWriteDelay) { ! pWriteDelay->sentFrames += *pWriteLimit; ! *pWriteLimit = 0; ! } } } --- 1173,1186 ---- if (dataChar.data.chr.isChr) { ! if (CAN_WRITE_RW_DATA_CHR(pIoPortWrite, dataChar)) { ! SIZE_T done = 0; ! WriteToBuffers(&dataChar, pIoPortRead, ! pQueueToComplete, pWriteLimit, pWriteDelay, &done, &doneSend); ! } ! else ! if (pWriteDelay) { ! pWriteDelay->sentFrames += *pWriteLimit; ! *pWriteLimit = 0; } } *************** *** 1225,1238 **** dataIrpWrite.data.irp.status = STATUS_PENDING; ! if (!pWriteLimit || *pWriteLimit) { ! if (!pIoPortWrite->writeHolding) { ! WriteToBuffers(&dataIrpWrite, pIoPortRead, ! pQueueToComplete, pWriteLimit, pWriteDelay, &doneWrite, &doneSend); ! } ! else ! if (pWriteDelay) { ! pWriteDelay->sentFrames += *pWriteLimit; ! *pWriteLimit = 0; ! } } } --- 1226,1237 ---- dataIrpWrite.data.irp.status = STATUS_PENDING; ! if (!pIoPortWrite->writeHolding) { ! WriteToBuffers(&dataIrpWrite, pIoPortRead, ! pQueueToComplete, pWriteLimit, pWriteDelay, &doneWrite, &doneSend); ! } ! else ! if (pWriteDelay) { ! pWriteDelay->sentFrames += *pWriteLimit; ! *pWriteLimit = 0; } } |
From: Vyacheslav F. <vf...@us...> - 2007-08-08 14:15:19
|
Update of /cvsroot/com0com/com0com/NSIS In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11105 Modified Files: install.nsi Log Message: Added missing SetOutPath Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** install.nsi 22 Jan 2007 17:10:32 -0000 1.5 --- install.nsi 8 Aug 2007 14:15:16 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2007/08/08 14:15:16 vfrolov + * Added missing SetOutPath + * * Revision 1.5 2007/01/22 17:10:32 vfrolov * Partially added support for non i386 CPUs *************** *** 209,212 **** --- 212,218 ---- Section "Uninstall" + ; Set output path to the installation directory. + SetOutPath $INSTDIR + GetTempFileName $0 ExecWait "RunDll32 setup,RunDll --output $0 uninstall" |
From: Vyacheslav F. <vf...@us...> - 2007-07-20 09:23:52
|
Update of /cvsroot/com0com/com2tcp In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv26748 Modified Files: utils.h Log Message: Added virtual ~Protocol() Thanks to wurfholz Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com2tcp/utils.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** utils.h 16 Nov 2006 12:51:43 -0000 1.5 --- utils.h 20 Jul 2007 09:23:48 -0000 1.6 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.6 2007/07/20 09:23:48 vfrolov + * Added virtual ~Protocol() + * Thanks to wurfholz + * * Revision 1.5 2006/11/16 12:51:43 vfrolov * Added ability to set COM port parameters *************** *** 103,106 **** --- 107,111 ---- Protocol(int _thresholdSend = 0, int _thresholdWrite = 0) : streamSendRead(_thresholdSend), streamWriteRecv(_thresholdWrite) {} + virtual ~Protocol() {} virtual int Send(const void *pBuf, int count); |
From: Vyacheslav F. <vf...@us...> - 2007-07-20 08:00:26
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv28745 Modified Files: adddev.c bufutils.c bufutils.h com0com.h io.c Log Message: Implemented TX buffer Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/io.c,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** io.c 3 Jul 2007 14:35:17 -0000 1.34 --- io.c 20 Jul 2007 08:00:22 -0000 1.35 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.35 2007/07/20 08:00:22 vfrolov + * Implemented TX buffer + * * Revision 1.34 2007/07/03 14:35:17 vfrolov * Implemented pinout customization *************** *** 201,241 **** } - 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; - } - - VOID OnRxBreak( - PC0C_IO_PORT pReadIoPort, - PLIST_ENTRY pQueueToComplete) - { - pReadIoPort->errors |= SERIAL_ERROR_BREAK; - pReadIoPort->eventMask |= pReadIoPort->waitMask & (SERIAL_EV_BREAK | SERIAL_EV_ERR); - - if (pReadIoPort->eventMask) - WaitComplete(pReadIoPort, pQueueToComplete); - } - VOID OnRxChars( PC0C_IO_PORT pReadIoPort, --- 204,207 ---- *************** *** 282,356 **** } ! VOID WriteBuffer( ! PRW_DATA pDataWrite, PC0C_IO_PORT pReadIoPort, PLIST_ENTRY pQueueToComplete, PSIZE_T pWriteLimit, ! PSIZE_T pWriteDone) { ! SIZE_T writeLength, information; ! SIZE_T writeDone; C0C_FLOW_FILTER flowFilter; ! PVOID pWriteBuf; ! PC0C_BUFFER pBuf; ! SIZE_T length; ! BOOLEAN isBreak; ! isBreak = FALSE; ! if (pDataWrite->type == RW_DATA_TYPE_IRP) { ! PIRP pIrp = pDataWrite->data.irp.pIrp; ! information = pIrp->IoStatus.Information; ! pWriteBuf = GET_REST_BUFFER_WRITE(pIrp, information); ! writeLength = GetWriteLength(pIrp); ! } else { ! HALT_UNLESS1(pDataWrite->type == RW_DATA_TYPE_CHR, pDataWrite->type); ! information = 0; ! pWriteBuf = &pDataWrite->data.chr.chr; ! writeLength = pDataWrite->data.chr.isChr ? 1 : 0; ! if (pDataWrite->data.chr.type == RW_DATA_TYPE_CHR_BREAK) ! isBreak = TRUE; ! } ! pBuf = &pReadIoPort->readBuf; ! length = writeLength - information; ! if (pWriteLimit && length > *pWriteLimit) ! length = *pWriteLimit; ! FlowFilterInit(pReadIoPort, &flowFilter); ! writeDone = WriteToBuffer(pBuf, pWriteBuf, length, &flowFilter); ! if (writeDone) { ! *pWriteDone += writeDone; ! information += writeDone; ! if (pDataWrite->type == RW_DATA_TYPE_IRP) { ! pDataWrite->data.irp.pIrp->IoStatus.Information = information; ! pReadIoPort->pIoPortRemote->amountInWriteQueue -= (ULONG)writeDone; ! } if (pWriteLimit) ! *pWriteLimit -= writeDone; ! OnRxChars(pReadIoPort, writeDone, &flowFilter, pQueueToComplete); ! if (isBreak) ! OnRxBreak(pReadIoPort, pQueueToComplete); ! else ! pReadIoPort->pIoPortRemote->perfStats.TransmittedCount += (ULONG)writeDone; } ! if (information == writeLength) { ! if (pDataWrite->type == RW_DATA_TYPE_IRP) { ! pDataWrite->data.irp.status = STATUS_SUCCESS; ! } else { ! HALT_UNLESS1(pDataWrite->type == RW_DATA_TYPE_CHR, pDataWrite->type); ! pDataWrite->data.chr.isChr = FALSE; ! } ! } } --- 248,324 ---- } ! NTSTATUS ReadFromBuffers( ! PIRP pIrp, PC0C_IO_PORT pReadIoPort, PLIST_ENTRY pQueueToComplete, PSIZE_T pWriteLimit, ! PC0C_ADAPTIVE_DELAY pWriteDelay, ! PSIZE_T pReadDone, ! PSIZE_T pSendDone) { ! SIZE_T destRestLength; ! SIZE_T information; C0C_FLOW_FILTER flowFilter; ! SIZE_T sendDone; ! SIZE_T readDone; ! PUCHAR pDestRest; ! information = pIrp->IoStatus.Information; ! destRestLength = IoGetCurrentIrpStackLocation(pIrp)->Parameters.Read.Length - information; ! if (destRestLength == 0) ! return STATUS_SUCCESS; ! pDestRest = GET_REST_BUFFER(pIrp, information); ! readDone = ReadFromBuffer(&pReadIoPort->readBuf, pDestRest, destRestLength); ! if (readDone) { ! *pReadDone += readDone; ! information += readDone; ! destRestLength -= readDone; ! if (destRestLength == 0) { ! pIrp->IoStatus.Information = information; ! return STATUS_SUCCESS; ! } ! pDestRest += readDone; ! } ! FlowFilterInit(pReadIoPort, &flowFilter); ! readDone = ReadFromTxBuffer(&pReadIoPort->readBuf, ! &flowFilter, ! pDestRest, destRestLength, ! &pReadIoPort->pIoPortRemote->txBuf, ! pWriteLimit ? *pWriteLimit : -1, ! &sendDone); ! if (readDone) { ! *pReadDone += readDone; ! information += readDone; ! destRestLength -= readDone; ! } + if (sendDone) { if (pWriteLimit) ! *pWriteLimit -= sendDone; ! if (pWriteDelay) { ! pWriteDelay->sentFrames += sendDone; ! pWriteDelay->idleCount = 0; ! } ! ! OnRxChars(pReadIoPort, sendDone, &flowFilter, pQueueToComplete); ! *pSendDone += sendDone; } ! pIrp->IoStatus.Information = information; ! if (destRestLength == 0) ! return STATUS_SUCCESS; ! ! return STATUS_PENDING; } *************** *** 368,383 **** } ! VOID WriteOverrun( PRW_DATA pDataWrite, PC0C_IO_PORT pReadIoPort, PLIST_ENTRY pQueueToComplete, PSIZE_T pWriteLimit, ! PSIZE_T pWriteDone) { SIZE_T writeLength, information; ! SIZE_T writeDone, readDone; C0C_FLOW_FILTER flowFilter; ! PVOID pWriteBuf; SIZE_T length; BOOLEAN isBreak; --- 336,406 ---- } ! VOID SendTxBuffer( ! PC0C_IO_PORT pReadIoPort, ! PC0C_IO_PORT pWriteIoPort, ! PLIST_ENTRY pQueueToComplete, ! PSIZE_T pWriteLimit, ! PC0C_ADAPTIVE_DELAY pWriteDelay, ! PSIZE_T pSendDone) ! { ! SIZE_T sendDone; ! SIZE_T txLimit; ! C0C_FLOW_FILTER flowFilter; ! ! FlowFilterInit(pReadIoPort, &flowFilter); ! ! if (pWriteLimit) ! txLimit = *pWriteLimit; ! else ! txLimit = (SIZE_T)-1; ! ! if (pReadIoPort->emuOverrun) { ! SIZE_T overrun; ! ! sendDone = MoveFromTxBuffer(&pReadIoPort->readBuf, ! &pWriteIoPort->txBuf, txLimit, ! &flowFilter, ! &overrun); ! ! if (overrun) { ! AlertOverrun(pReadIoPort, pQueueToComplete); ! pReadIoPort->perfStats.BufferOverrunErrorCount += (ULONG)overrun; ! } ! } else { ! sendDone = MoveFromTxBuffer(&pReadIoPort->readBuf, ! &pWriteIoPort->txBuf, txLimit, ! &flowFilter, ! NULL); ! } ! ! if (sendDone) { ! if (pWriteLimit) ! *pWriteLimit -= sendDone; ! ! if (pWriteDelay) { ! pWriteDelay->sentFrames += sendDone; ! pWriteDelay->idleCount = 0; ! } ! ! OnRxChars(pReadIoPort, sendDone, &flowFilter, pQueueToComplete); ! *pSendDone += sendDone; ! } ! } ! ! VOID WriteToBuffers( PRW_DATA pDataWrite, PC0C_IO_PORT pReadIoPort, PLIST_ENTRY pQueueToComplete, PSIZE_T pWriteLimit, ! PC0C_ADAPTIVE_DELAY pWriteDelay, ! PSIZE_T pWriteDone, ! PSIZE_T pSendDone) { SIZE_T writeLength, information; ! SIZE_T sendDone, writeDone; C0C_FLOW_FILTER flowFilter; ! PUCHAR pWriteBuf; SIZE_T length; + SIZE_T sendLength; BOOLEAN isBreak; *************** *** 403,418 **** if (pWriteLimit && length > *pWriteLimit) ! length = *pWriteLimit; FlowFilterInit(pReadIoPort, &flowFilter); ! CopyCharsWithEscape( ! &pReadIoPort->readBuf, &flowFilter, ! NULL, 0, ! pWriteBuf, length, ! &readDone, &writeDone); if (writeDone) { - *pWriteDone += writeDone; information += writeDone; --- 426,458 ---- if (pWriteLimit && length > *pWriteLimit) ! sendLength = *pWriteLimit; ! else ! sendLength = length; FlowFilterInit(pReadIoPort, &flowFilter); ! if (pReadIoPort->emuOverrun) { ! SIZE_T overrun; ! ! sendDone = WriteToBuffer(&pReadIoPort->readBuf, pWriteBuf, sendLength, &flowFilter, &overrun); ! ! if (overrun) { ! AlertOverrun(pReadIoPort, pQueueToComplete); ! pReadIoPort->perfStats.BufferOverrunErrorCount += (ULONG)overrun; ! } ! } else { ! sendDone = WriteToBuffer(&pReadIoPort->readBuf, pWriteBuf, sendLength, &flowFilter, NULL); ! } ! ! HALT_UNLESS3(sendDone <= sendLength, pDataWrite->type, sendDone, sendLength); ! ! writeDone = sendDone; ! ! if (writeDone < length) ! writeDone += WriteToTxBuffer(&pReadIoPort->pIoPortRemote->txBuf, pWriteBuf + writeDone, length - writeDone); ! ! HALT_UNLESS3(writeDone <= length, pDataWrite->type, writeDone, length); if (writeDone) { information += writeDone; *************** *** 422,438 **** } if (pWriteLimit) ! *pWriteLimit -= writeDone; ! if (readDone) { ! AlertOverrun(pReadIoPort, pQueueToComplete); ! pReadIoPort->perfStats.BufferOverrunErrorCount += (ULONG)readDone; } ! OnRxChars(pReadIoPort, writeDone, &flowFilter, pQueueToComplete); ! if (isBreak) ! OnRxBreak(pReadIoPort, pQueueToComplete); ! else ! pReadIoPort->pIoPortRemote->perfStats.TransmittedCount += (ULONG)writeDone; } --- 462,484 ---- } + if (!isBreak) { + pReadIoPort->pIoPortRemote->perfStats.TransmittedCount += (ULONG)writeDone; + *pWriteDone += writeDone; + } + } + + if (sendDone) { if (pWriteLimit) ! *pWriteLimit -= sendDone; ! if (pWriteDelay) { ! pWriteDelay->sentFrames += sendDone; ! pWriteDelay->idleCount = 0; } ! OnRxChars(pReadIoPort, sendDone, &flowFilter, pQueueToComplete); ! ! if (!isBreak) ! *pSendDone += sendDone; } *************** *** 455,458 **** --- 501,505 ---- PLIST_ENTRY pQueueToComplete, PSIZE_T pWriteLimit, + PC0C_ADAPTIVE_DELAY pWriteDelay, PSIZE_T pReadDone, PSIZE_T pWriteDone) *************** *** 492,505 **** &readDone, &writeDone); - if (pWriteLimit) - *pWriteLimit -= writeDone; - pIrpRead->IoStatus.Information += readDone; - if (pDataWrite->type == RW_DATA_TYPE_IRP) { - pDataWrite->data.irp.pIrp->IoStatus.Information += writeDone; - pReadIoPort->pIoPortRemote->amountInWriteQueue -= (ULONG)writeDone; - } - if (readDone == readLength) *pStatusRead = STATUS_SUCCESS; --- 539,544 ---- *************** *** 516,528 **** if (writeDone) { OnRxChars(pReadIoPort, writeDone, &flowFilter, pQueueToComplete); ! if (isBreak) ! OnRxBreak(pReadIoPort, pQueueToComplete); ! else pReadIoPort->pIoPortRemote->perfStats.TransmittedCount += (ULONG)writeDone; } *pReadDone += readDone; - *pWriteDone += writeDone; } --- 555,580 ---- if (writeDone) { + if (pWriteLimit) + *pWriteLimit -= writeDone; + + if (pWriteDelay) { + pWriteDelay->sentFrames += writeDone; + pWriteDelay->idleCount = 0; + } + + if (pDataWrite->type == RW_DATA_TYPE_IRP) { + pDataWrite->data.irp.pIrp->IoStatus.Information += writeDone; + pReadIoPort->pIoPortRemote->amountInWriteQueue -= (ULONG)writeDone; + } + OnRxChars(pReadIoPort, writeDone, &flowFilter, pQueueToComplete); ! ! if (!isBreak) { pReadIoPort->pIoPortRemote->perfStats.TransmittedCount += (ULONG)writeDone; + *pWriteDone += writeDone; + } } *pReadDone += readDone; } *************** *** 798,801 **** --- 850,880 ---- PLIST_ENTRY pQueueToComplete) { + /* + * With the real serial ports the data goes this way: + * + * ---------software--------|------------hardware--------------- + * TX QUEUE ------------------> TX FIFO --> TX shift register - + * | + * RX QUEUE <-- RX buffer <--- RX FIFO <-- RX shift register <- + * -------------------------|----------------------------------- + * + * From application view point it's equivalent to: + * + * ------------------------------------------------------------- + * TX QUEUE ------------------> TX buffer --------------------- + * | + * RX QUEUE <-- RX buffer <------------------------------------ + * ------------------------------------------------------------- + * + * Here the data goes by following steps: + * + * - Move data from RX buffer to RX QUEUE while RX QUEUE is not empty; + * - Move shifted data from TX buffer to RX QUEUE while RX QUEUE is not empty; + * - Move shifted data from TX buffer to RX buffer if RX QUEUE is empty or + * move shifted data from TX QUEUE to RX QUEUE while RX QUEUE is not empty; + * - Move shifted data from TX QUEUE to RX buffer; + * - Move not shifted data from TX QUEUE to TX buffer while TX buffer not full; + * + */ NTSTATUS status; SIZE_T readBufBusyBeg, readBufBusyEnd; *************** *** 814,818 **** PDRIVER_CANCEL pCancelRoutineWrite; SIZE_T doneWrite; ! BOOLEAN wasWrite; PC0C_ADAPTIVE_DELAY pWriteDelay; --- 893,897 ---- PDRIVER_CANCEL pCancelRoutineWrite; SIZE_T doneWrite; ! SIZE_T doneSend; PC0C_ADAPTIVE_DELAY pWriteDelay; *************** *** 827,849 **** pQueueWrite = &pIoPortWrite->irpQueues[C0C_QUEUE_WRITE]; pWriteDelay = pIoPortWrite->pWriteDelay; if (pWriteDelay) { ! if (pQueueWrite->pCurrent || pIoPortWrite->sendBreak || pIoPortWrite->sendXonXoff) { StartWriteDelayTimer(pWriteDelay); writeLimit = GetWriteLimit(pWriteDelay); - status = STATUS_PENDING; } else { writeLimit = 0; - status = STATUS_SUCCESS; } pWriteLimit = &writeLimit; } else { - status = STATUS_SUCCESS; pWriteLimit = NULL; } readBufBusyBeg = C0C_BUFFER_BUSY(&pIoPortRead->readBuf); /* get first pIrpRead */ --- 906,935 ---- pQueueWrite = &pIoPortWrite->irpQueues[C0C_QUEUE_WRITE]; pWriteDelay = pIoPortWrite->pWriteDelay; + status = STATUS_SUCCESS; if (pWriteDelay) { ! if (C0C_TX_BUFFER_BUSY(&pIoPortWrite->txBuf) || ! pQueueWrite->pCurrent || ! pIoPortWrite->sendBreak || ! pIoPortWrite->sendXonXoff) ! { StartWriteDelayTimer(pWriteDelay); writeLimit = GetWriteLimit(pWriteDelay); } else { writeLimit = 0; } pWriteLimit = &writeLimit; } else { pWriteLimit = NULL; } + doneSend = 0; readBufBusyBeg = C0C_BUFFER_BUSY(&pIoPortRead->readBuf); + /****************************************************************************** + * Prepare RX QUEUE * + ******************************************************************************/ + /* get first pIrpRead */ *************** *** 859,866 **** } ! /* read from buffer */ while (dataIrpRead.data.irp.pIrp) { ! dataIrpRead.data.irp.status = ReadBuffer(dataIrpRead.data.irp.pIrp, &pIoPortRead->readBuf, &doneRead); if (dataIrpRead.data.irp.status == STATUS_PENDING) --- 945,960 ---- } ! /****************************************************************************** ! * Move data from RX buffer to RX QUEUE while RX QUEUE is not empty * ! * Move shifted data from TX buffer to RX QUEUE while RX QUEUE is not empty * ! ******************************************************************************/ while (dataIrpRead.data.irp.pIrp) { ! dataIrpRead.data.irp.status = ReadFromBuffers(dataIrpRead.data.irp.pIrp, ! pIoPortRead, ! pQueueToComplete, ! pWriteLimit, ! pWriteDelay, ! &doneRead, &doneSend); if (dataIrpRead.data.irp.status == STATUS_PENDING) *************** *** 884,888 **** } ! /* get char */ if (pIoPortWrite->sendBreak) { --- 978,993 ---- } ! /****************************************************************************** ! * Move shifted data from TX buffer to RX buffer if RX QUEUE is empty * ! ******************************************************************************/ ! ! if (!dataIrpRead.data.irp.pIrp) ! SendTxBuffer(pIoPortRead, pIoPortWrite, pQueueToComplete, pWriteLimit, pWriteDelay, &doneSend); ! ! /****************************************************************************** ! * Prepare TX QUEUE * ! ******************************************************************************/ ! ! /* get special char to send */ if (pIoPortWrite->sendBreak) { *************** *** 914,918 **** /* get first pIrpWrite */ - wasWrite = FALSE; doneWrite = 0; firstWrite = TRUE; --- 1019,1022 ---- *************** *** 926,930 **** } ! /* read/write direct */ while (dataIrpRead.data.irp.pIrp) { --- 1030,1036 ---- } ! /****************************************************************************** ! * Move shifted data from TX QUEUE to RX QUEUE while RX QUEUE is not empty * ! ******************************************************************************/ while (dataIrpRead.data.irp.pIrp) { *************** *** 933,938 **** if (CAN_WRITE_RW_DATA_CHR(pIoPortWrite, dataChar)) { if (dataIrpRead.data.irp.status == STATUS_PENDING) { - SIZE_T done = 0; - ReadWriteDirect(dataIrpRead.data.irp.pIrp, &dataChar, --- 1039,1042 ---- *************** *** 941,952 **** pQueueToComplete, pWriteLimit, ! &doneRead, &done); ! ! if (done) { ! if (pWriteDelay) { ! pWriteDelay->sentFrames += done; ! pWriteDelay->idleCount = 0; ! } ! } } } --- 1045,1050 ---- pQueueToComplete, pWriteLimit, ! pWriteDelay, ! &doneRead, &doneSend); } } *************** *** 978,991 **** pQueueToComplete, pWriteLimit, &doneRead, &done); if (done) { doneWrite += done; ! wasWrite = TRUE; ! ! if (pWriteDelay) { ! pWriteDelay->sentFrames += done; ! pWriteDelay->idleCount = 0; ! } } } --- 1076,1085 ---- pQueueToComplete, pWriteLimit, + pWriteDelay, &doneRead, &done); if (done) { doneWrite += done; ! doneSend += done; } } *************** *** 1070,1074 **** } ! /* write to buffer */ if (dataChar.data.chr.isChr) { --- 1164,1171 ---- } ! /****************************************************************************** ! * Move shifted data from TX QUEUE to RX buffer * ! * Move not shifted data from TX QUEUE to TX buffer while TX buffer not full * ! ******************************************************************************/ if (dataChar.data.chr.isChr) { *************** *** 1077,1098 **** SIZE_T done = 0; ! WriteBuffer(&dataChar, pIoPortRead, ! pQueueToComplete, pWriteLimit, &done); ! ! if (pIoPortRead->emuOverrun && ! dataChar.data.chr.isChr && ! CAN_WRITE_RW_DATA_CHR(pIoPortWrite, dataChar) && ! C0C_BUFFER_BUSY(&pIoPortRead->readBuf) >= C0C_BUFFER_SIZE(&pIoPortRead->readBuf)) ! { ! WriteOverrun(&dataChar, pIoPortRead, ! pQueueToComplete, pWriteLimit, &done); ! } ! ! if (done) { ! if (pWriteDelay) { ! pWriteDelay->sentFrames += done; ! pWriteDelay->idleCount = 0; ! } ! } } else --- 1174,1179 ---- SIZE_T done = 0; ! WriteToBuffers(&dataChar, pIoPortRead, ! pQueueToComplete, pWriteLimit, pWriteDelay, &done, &doneSend); } else *************** *** 1105,1108 **** --- 1186,1191 ---- if (!dataChar.data.chr.isChr) { + /* complete special char sending */ + switch (dataChar.data.chr.type) { case RW_DATA_TYPE_CHR_XCHR: *************** *** 1112,1115 **** --- 1195,1205 ---- if (pIoPortWrite->sendBreak) { pIoPortWrite->sendBreak = FALSE; + + pIoPortRead->errors |= SERIAL_ERROR_BREAK; + pIoPortRead->eventMask |= pIoPortRead->waitMask & (SERIAL_EV_BREAK | SERIAL_EV_ERR); + + if (pIoPortRead->eventMask) + WaitComplete(pIoPortRead, pQueueToComplete); + if (pIoPortRead->escapeChar) { UCHAR lsr = 0x10; /* break interrupt indicator */ *************** *** 1137,1163 **** if (!pWriteLimit || *pWriteLimit) { if (!pIoPortWrite->writeHolding) { ! SIZE_T done = 0; ! ! WriteBuffer(&dataIrpWrite, pIoPortRead, ! pQueueToComplete, pWriteLimit, &done); ! ! if (pIoPortRead->emuOverrun && ! dataIrpWrite.data.irp.status == STATUS_PENDING && ! !pIoPortWrite->writeHolding && ! C0C_BUFFER_BUSY(&pIoPortRead->readBuf) >= C0C_BUFFER_SIZE(&pIoPortRead->readBuf)) ! { ! WriteOverrun(&dataIrpWrite, pIoPortRead, ! pQueueToComplete, pWriteLimit, &done); ! } ! ! if (done) { ! doneWrite += done; ! wasWrite = TRUE; ! ! if (pWriteDelay) { ! pWriteDelay->sentFrames += done; ! pWriteDelay->idleCount = 0; ! } ! } } else --- 1227,1232 ---- if (!pWriteLimit || *pWriteLimit) { if (!pIoPortWrite->writeHolding) { ! WriteToBuffers(&dataIrpWrite, pIoPortRead, ! pQueueToComplete, pWriteLimit, pWriteDelay, &doneWrite, &doneSend); } else *************** *** 1216,1219 **** --- 1285,1290 ---- } + /******************************************************************************/ + readBufBusyEnd = C0C_BUFFER_BUSY(&pIoPortRead->readBuf); *************** *** 1234,1239 **** } ! if (wasWrite && !pQueueWrite->pCurrent && ! pIoPortWrite->waitMask & SERIAL_EV_TXEMPTY) { pIoPortWrite->eventMask |= SERIAL_EV_TXEMPTY; --- 1305,1310 ---- } ! if ((pIoPortWrite->waitMask & SERIAL_EV_TXEMPTY) && doneSend && ! !pQueueWrite->pCurrent && C0C_TX_BUFFER_THR_EMPTY(&pIoPortWrite->txBuf)) { pIoPortWrite->eventMask |= SERIAL_EV_TXEMPTY; Index: bufutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/bufutils.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bufutils.h 17 May 2006 15:28:03 -0000 1.5 --- bufutils.h 20 Jul 2007 08:00:22 -0000 1.6 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2007/07/20 08:00:22 vfrolov + * Implemented TX buffer + * * Revision 1.5 2006/05/17 15:28:03 vfrolov * Implemented SERIAL_DSR_SENSITIVITY *************** *** 75,79 **** PVOID pWrite, SIZE_T writeLength, ! PC0C_FLOW_FILTER pFlowFilter); VOID WriteMandatoryToBuffer(PC0C_BUFFER pBuf, UCHAR mandatoryChar); NTSTATUS WriteRawDataToBuffer(PC0C_RAW_DATA pRawData, PC0C_BUFFER pBuf); --- 78,83 ---- PVOID pWrite, SIZE_T writeLength, ! PC0C_FLOW_FILTER pFlowFilter, ! PSIZE_T pOverrun); VOID WriteMandatoryToBuffer(PC0C_BUFFER pBuf, UCHAR mandatoryChar); NTSTATUS WriteRawDataToBuffer(PC0C_RAW_DATA pRawData, PC0C_BUFFER pBuf); *************** *** 84,87 **** --- 88,109 ---- VOID FreeBuffer(PC0C_BUFFER pBuf); VOID SetBufferLimit(PC0C_BUFFER pBuf, SIZE_T limit); + SIZE_T ReadFromTxBuffer( + PC0C_BUFFER pBuf, + PC0C_FLOW_FILTER pFlowFilter, + PVOID pRead, SIZE_T readLength, + PC0C_TX_BUFFER pTxBuf, SIZE_T txLimit, + PSIZE_T pWriteDone); + SIZE_T WriteToTxBuffer( + PC0C_TX_BUFFER pTxBuf, + PVOID pWrite, + SIZE_T writeLength); + SIZE_T MoveFromTxBuffer( + PC0C_BUFFER pBuf, + PC0C_TX_BUFFER pTxBuf, + SIZE_T txLimit, + PC0C_FLOW_FILTER pFlowFilter, + PSIZE_T pOverrun); + VOID SetTxBuffer(PC0C_TX_BUFFER pTxBuf, SIZE_T size, BOOLEAN cleanFifo); + VOID FreeTxBuffer(PC0C_TX_BUFFER pTxBuf); #endif /* _C0C_BUFUTILS_H_ */ Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** adddev.c 3 Jul 2007 14:35:17 -0000 1.28 --- adddev.c 20 Jul 2007 08:00:22 -0000 1.29 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.29 2007/07/20 08:00:22 vfrolov + * Implemented TX buffer + * * Revision 1.28 2007/07/03 14:35:17 vfrolov * Implemented pinout customization *************** *** 117,120 **** --- 120,124 ---- #include "timeout.h" #include "delay.h" + #include "bufutils.h" #include "strutils.h" #include "showport.h" *************** *** 144,147 **** --- 148,152 ---- pDevExt->pIoPortLocal->exclusiveMode = FALSE; pDevExt->pIoPortLocal->pDevExt = NULL; + FreeTxBuffer(&pDevExt->pIoPortLocal->txBuf); } *************** *** 387,390 **** --- 392,397 ---- SetWriteDelay(pDevExt); + SetTxBuffer(&pDevExt->pIoPortLocal->txBuf, 1, TRUE); + pDevExt->pIoPortLocal->modemControl |= C0C_MCR_OUT2; Index: bufutils.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/bufutils.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bufutils.c 11 Jan 2007 14:50:29 -0000 1.8 --- bufutils.c 20 Jul 2007 08:00:22 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2007/07/20 08:00:22 vfrolov + * Implemented TX buffer + * * Revision 1.8 2007/01/11 14:50:29 vfrolov * Pool functions replaced by *************** *** 253,257 **** while (readLength) { SIZE_T length, writeLength; ! PVOID pWriteBuf; if (!pBuf->busy) { --- 256,260 ---- while (readLength) { SIZE_T length, writeLength; ! PUCHAR pWriteBuf; if (!pBuf->busy) { *************** *** 284,292 **** HALT_UNLESS(pBuf->pBase); - writeLength = pBuf->pFree <= pBuf->pBusy ? - pBuf->pEnd - pBuf->pBusy : pBuf->busy; - pWriteBuf = pBuf->pBusy; length = writeLength < readLength ? writeLength : readLength; --- 287,295 ---- HALT_UNLESS(pBuf->pBase); pWriteBuf = pBuf->pBusy; + writeLength = pBuf->pFree <= pWriteBuf ? + pBuf->pEnd - pWriteBuf : pBuf->busy; + length = writeLength < readLength ? writeLength : readLength; *************** *** 309,313 **** PVOID pWrite, SIZE_T writeLength, ! PC0C_FLOW_FILTER pFlowFilter) { PUCHAR pWriteBuf = (PUCHAR)pWrite; --- 312,317 ---- PVOID pWrite, SIZE_T writeLength, ! PC0C_FLOW_FILTER pFlowFilter, ! PSIZE_T pOverrun) { PUCHAR pWriteBuf = (PUCHAR)pWrite; *************** *** 318,323 **** PUCHAR pReadBuf; ! if (pBuf->limit <= pBuf->busy) break; pReadBuf = pBuf->pFree; --- 322,343 ---- PUCHAR pReadBuf; ! if (pBuf->limit <= pBuf->busy) { ! if (pOverrun) { ! if (pBuf->busy >= C0C_BUFFER_SIZE(pBuf)) { ! writeDone = readDone = writeLength; ! ! CopyCharsWithEscape( ! pBuf, pFlowFilter, ! NULL, 0, ! pWriteBuf, writeLength, ! &writeDone, pOverrun); ! ! pWriteBuf += writeDone; ! } else { ! *pOverrun = 0; ! } ! } break; + } pReadBuf = pBuf->pFree; *************** *** 520,521 **** --- 540,702 ---- } /********************************************************************/ + SIZE_T ReadFromTxBuffer( + PC0C_BUFFER pBuf, + PC0C_FLOW_FILTER pFlowFilter, + PVOID pRead, SIZE_T readLength, + PC0C_TX_BUFFER pTxBuf, SIZE_T txLimit, + PSIZE_T pWriteDone) + { + PUCHAR pReadBuf = (PUCHAR)pRead; + + *pWriteDone = 0; + + while (readLength) { + SIZE_T writeLength; + SIZE_T readDone, writeDone; + PUCHAR pWriteBuf; + + pWriteBuf = pTxBuf->pBusy; + + if (pTxBuf->busy) { + writeLength = pTxBuf->pFree <= pWriteBuf ? + pTxBuf->pEnd - pWriteBuf : pTxBuf->busy; + + if (writeLength > txLimit) + writeLength = txLimit; + } else { + writeLength = 0; + } + + CopyCharsWithEscape(pBuf, pFlowFilter, + pReadBuf, readLength, + pWriteBuf, writeLength, + &readDone, &writeDone); + + pTxBuf->busy -= writeDone; + pTxBuf->pBusy += writeDone; + if (pTxBuf->pBusy == pTxBuf->pEnd) + pTxBuf->pBusy = pTxBuf->pBase; + + *pWriteDone += writeDone; + + if (readDone == 0) + break; + + pReadBuf += readDone; + readLength -= readDone; + txLimit -= writeDone; + } + + return pReadBuf - (PUCHAR)pRead; + } + + SIZE_T WriteToTxBuffer( + PC0C_TX_BUFFER pTxBuf, + PVOID pWrite, + SIZE_T writeLength) + { + PUCHAR pWriteBuf = (PUCHAR)pWrite; + + while (writeLength && pTxBuf->busy < C0C_TX_BUFFER_SIZE(pTxBuf)) { + SIZE_T readLength; + PUCHAR pReadBuf; + + pReadBuf = pTxBuf->pFree; + + readLength = pTxBuf->pBusy <= pReadBuf ? + pTxBuf->pEnd - pReadBuf : pTxBuf->pBusy - pReadBuf; + + if (readLength > writeLength) + readLength = writeLength; + + RtlCopyMemory(pReadBuf, pWriteBuf, readLength); + + pTxBuf->busy += readLength; + pTxBuf->pFree += readLength; + if (pTxBuf->pFree == pTxBuf->pEnd) + pTxBuf->pFree = pTxBuf->pBase; + + pWriteBuf += readLength; + writeLength -= readLength; + } + + return pWriteBuf - (PUCHAR)pWrite; + } + + SIZE_T MoveFromTxBuffer( + PC0C_BUFFER pBuf, + PC0C_TX_BUFFER pTxBuf, + SIZE_T txLimit, + PC0C_FLOW_FILTER pFlowFilter, + PSIZE_T pOverrun) + { + SIZE_T done = 0; + + if (pOverrun) + *pOverrun = 0; + + while (pTxBuf->busy) { + SIZE_T writeLength; + SIZE_T writeDone; + PUCHAR pWriteBuf; + + pWriteBuf = pTxBuf->pBusy; + + writeLength = pTxBuf->pFree <= pWriteBuf ? + pTxBuf->pEnd - pWriteBuf : pTxBuf->busy; + + if (writeLength > txLimit) + writeLength = txLimit; + + if (writeLength == 0) + break; + + if (pOverrun) { + SIZE_T overrun; + + writeDone = WriteToBuffer(pBuf, pWriteBuf, writeLength, pFlowFilter, &overrun); + + *pOverrun += overrun; + } else { + writeDone = WriteToBuffer(pBuf, pWriteBuf, writeLength, pFlowFilter, NULL); + } + + if (writeDone == 0) + break; + + pTxBuf->busy -= writeDone; + pTxBuf->pBusy += writeDone; + if (pTxBuf->pBusy == pTxBuf->pEnd) + pTxBuf->pBusy = pTxBuf->pBase; + + done += writeDone; + txLimit -= writeDone; + } + + return done; + } + + VOID SetTxBuffer(PC0C_TX_BUFFER pTxBuf, SIZE_T size, BOOLEAN cleanFifo) + { + PUCHAR pBase; + + UNREFERENCED_PARAMETER(cleanFifo); + + size = 1; + + size += 1; /* add shift register */ + pBase = pTxBuf->leastBuf; + + pTxBuf->pFree = pTxBuf->pBusy = pTxBuf->pBase = pBase; + pTxBuf->pEnd = pTxBuf->pBase + size; + pTxBuf->busy = 0; + } + + VOID FreeTxBuffer(PC0C_TX_BUFFER pTxBuf) + { + if (pTxBuf->pBase && pTxBuf->pBase != pTxBuf->leastBuf) + C0C_FREE_POOL(pTxBuf->pBase); + + RtlZeroMemory(pTxBuf, sizeof(*pTxBuf)); + } + /********************************************************************/ Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** com0com.h 3 Jul 2007 14:35:17 -0000 1.36 --- com0com.h 20 Jul 2007 08:00:22 -0000 1.37 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.37 2007/07/20 08:00:22 vfrolov + * Implemented TX buffer + * * Revision 1.36 2007/07/03 14:35:17 vfrolov * Implemented pinout customization *************** *** 193,198 **** PUCHAR pFree; PUCHAR pEnd; - SIZE_T limit; SIZE_T busy; SIZE_T size80; BOOLEAN escape; --- 196,201 ---- PUCHAR pFree; PUCHAR pEnd; SIZE_T busy; + SIZE_T limit; SIZE_T size80; BOOLEAN escape; *************** *** 206,209 **** --- 209,230 ---- ((SIZE_T)((pBuf)->pEnd - (pBuf)->pBase)) + typedef struct _C0C_TX_BUFFER { + PUCHAR pBase; + PUCHAR pBusy; + PUCHAR pFree; + PUCHAR pEnd; + SIZE_T busy; + UCHAR leastBuf[1 + 1]; /* transmitter holding and shift registers */ + } C0C_TX_BUFFER, *PC0C_TX_BUFFER; + + #define C0C_TX_BUFFER_BUSY(pTxBuf) \ + ((pTxBuf)->busy) + + #define C0C_TX_BUFFER_THR_EMPTY(pTxBuf) \ + ((pTxBuf)->busy <= 1) + + #define C0C_TX_BUFFER_SIZE(pTxBuf) \ + ((SIZE_T)((pTxBuf)->pEnd - (pTxBuf)->pBase)) + struct _C0C_FDOPORT_EXTENSION; struct _C0C_ADAPTIVE_DELAY; *************** *** 281,284 **** --- 302,306 ---- C0C_BUFFER readBuf; + C0C_TX_BUFFER txBuf; short sendXonXoff; |
From: Vyacheslav F. <vf...@us...> - 2007-07-20 07:59:25
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv28340 Modified Files: delay.c Log Message: Fixed idleCount Index: delay.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/delay.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** delay.c 9 Jun 2007 08:49:47 -0000 1.8 --- delay.c 20 Jul 2007 07:59:20 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2007/07/20 07:59:20 vfrolov + * Fixed idleCount + * * Revision 1.8 2007/06/09 08:49:47 vfrolov * Improved baudrate emulation *************** *** 86,102 **** if (pWriteDelay->started) { ! NTSTATUS status; ! status = ReadWrite( pIoPort->pIoPortRemote, FALSE, pIoPort, FALSE, &queueToComplete); ! if (status != STATUS_PENDING) { ! if (++pWriteDelay->idleCount > 3) StopWriteDelayTimer(pWriteDelay); - } else { - pWriteDelay->idleCount = 0; - } } --- 89,101 ---- if (pWriteDelay->started) { ! pWriteDelay->idleCount++; ! ReadWrite( pIoPort->pIoPortRemote, FALSE, pIoPort, FALSE, &queueToComplete); ! if (pWriteDelay->idleCount > 3) StopWriteDelayTimer(pWriteDelay); } |
From: Vyacheslav F. <vf...@us...> - 2007-07-20 07:50:34
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25051 Modified Files: ReadMe.txt Log Message: Added note for Vista Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ReadMe.txt 4 Jun 2007 15:28:12 -0000 1.13 --- ReadMe.txt 20 Jul 2007 07:50:30 -0000 1.14 *************** *** 41,44 **** --- 41,47 ---- ========== + NOTE: Before installing/uninstalling the com0com driver or adding/removing/changing + ports on Windows Vista the User Account Control (UAC) should be turned off. + Simply run the installer (setup.exe). An installation wizard will guide you through the required steps. |
From: Vyacheslav F. <vf...@us...> - 2007-07-09 11:15:53
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12824 Modified Files: ioctl.c Log Message: Implemented IOCTL_SERIAL_SET_MODEM_CONTROL Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/ioctl.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ioctl.c 3 Jul 2007 14:35:17 -0000 1.31 --- ioctl.c 9 Jul 2007 11:15:42 -0000 1.32 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.32 2007/07/09 11:15:42 vfrolov + * Implemented IOCTL_SERIAL_SET_MODEM_CONTROL + * * Revision 1.31 2007/07/03 14:35:17 vfrolov * Implemented pinout customization *************** *** 178,181 **** --- 181,191 ---- } + if (pIoPortLocal->tryWrite) { + ReadWrite( + pIoPortLocal->pIoPortRemote, FALSE, + pIoPortLocal, FALSE, + &queueToComplete); + } + KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); FdoPortCompleteQueue(&queueToComplete); *************** *** 209,212 **** --- 219,229 ---- } + if (pIoPortLocal->tryWrite) { + ReadWrite( + pIoPortLocal->pIoPortRemote, FALSE, + pIoPortLocal, FALSE, + &queueToComplete); + } + KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); FdoPortCompleteQueue(&queueToComplete); *************** *** 214,217 **** --- 231,269 ---- } break; + case IOCTL_SERIAL_SET_MODEM_CONTROL: { + LIST_ENTRY queueToComplete; + + if (pIrpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG)) { + status = STATUS_BUFFER_TOO_SMALL; + break; + } + + InitializeListHead(&queueToComplete); + KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); + + SetModemControl( + pIoPortLocal, + (UCHAR)*(PULONG)pIrp->AssociatedIrp.SystemBuffer, + (UCHAR)~0, + &queueToComplete); + + if (pIoPortLocal->pIoPortRemote->tryWrite) { + ReadWrite( + pIoPortLocal, FALSE, + pIoPortLocal->pIoPortRemote, FALSE, + &queueToComplete); + } + + if (pIoPortLocal->tryWrite) { + ReadWrite( + pIoPortLocal->pIoPortRemote, FALSE, + pIoPortLocal, FALSE, + &queueToComplete); + } + + KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); + FdoPortCompleteQueue(&queueToComplete); + break; + } case IOCTL_SERIAL_GET_MODEM_CONTROL: case IOCTL_SERIAL_GET_DTRRTS: { |