com0com-cvs Mailing List for Null-modem emulator (Page 30)
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-01-22 17:10:42
|
Update of /cvsroot/com0com/com0com/NSIS In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23999 Modified Files: install.nsi Log Message: Partially added support for non i386 CPUs Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** install.nsi 14 Dec 2006 08:25:44 -0000 1.4 --- install.nsi 22 Jan 2007 17:10:32 -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/01/22 17:10:32 vfrolov + * Partially added support for non i386 CPUs + * * Revision 1.4 2006/12/14 08:25:44 vfrolov * Added ReadMe.lnk *************** *** 42,45 **** --- 45,67 ---- ;-------------------------------- + !if "$%BUILD_DEFAULT_TARGETS%" == "-386" + !define TARGET_CPU i386 + !else if "$%BUILD_DEFAULT_TARGETS%" == "-IA64" + !define TARGET_CPU ia64 + !else if "$%BUILD_DEFAULT_TARGETS%" == "-ia64" + !define TARGET_CPU ia64 + !else if "$%BUILD_DEFAULT_TARGETS%" == "-AMD64" + !define TARGET_CPU amd64 + !else if "$%BUILD_DEFAULT_TARGETS%" == "-amd64" + !define TARGET_CPU amd64 + !endif + + !ifndef TARGET_CPU + !define TARGET_CPU i386 + !Warning "TARGET_CPU=${TARGET_CPU}" + !endif + + ;-------------------------------- + Function LaunchSetupCommandPrompt *************** *** 139,144 **** File "..\ReadMe.txt" File "..\com0com.inf" ! File "..\i386\com0com.sys" ! File "..\i386\setup.dll" File "..\setup\setup.bat" --- 161,166 ---- File "..\ReadMe.txt" File "..\com0com.inf" ! File "..\${TARGET_CPU}\com0com.sys" ! File "..\${TARGET_CPU}\setup.dll" File "..\setup\setup.bat" |
From: Vyacheslav F. <vf...@us...> - 2007-01-22 17:05:32
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21789 Modified Files: startirp.c Log Message: Added missing 1IoMarkIrpPending() Index: startirp.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/startirp.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** startirp.c 15 Jan 2007 16:09:16 -0000 1.14 --- startirp.c 22 Jan 2007 17:05:16 -0000 1.15 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.15 2007/01/22 17:05:16 vfrolov + * Added missing 1IoMarkIrpPending() + * * Revision 1.14 2007/01/15 16:09:16 vfrolov * Fixed non zero Information for IOCTL_SERIAL_IMMEDIATE_CHAR *************** *** 254,259 **** #pragma warning(pop) ! if (!pCancelRoutine) return STATUS_PENDING; return status; --- 257,264 ---- #pragma warning(pop) ! if (!pCancelRoutine) { ! IoMarkIrpPending(pIrp); return STATUS_PENDING; + } return status; |
From: Vyacheslav F. <vf...@us...> - 2007-01-15 16:23:54
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31752 Modified Files: sources Log Message: Added DLLENTRY and USE_MSVCRT Index: sources =================================================================== RCS file: /cvsroot/com0com/com0com/setup/sources,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** sources 2 Nov 2006 16:13:03 -0000 1.3 --- sources 15 Jan 2007 16:23:49 -0000 1.4 *************** *** 2,5 **** --- 2,7 ---- TARGETPATH=.. TARGETTYPE=DYNLINK + DLLENTRY=_DllMainCRTStartup + USE_MSVCRT=1 MSC_WARNING_LEVEL=/W4 |
From: Vyacheslav F. <vf...@us...> - 2007-01-15 16:09:26
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv26111 Modified Files: startirp.c Log Message: Fixed non zero Information for IOCTL_SERIAL_IMMEDIATE_CHAR Index: startirp.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/startirp.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** startirp.c 28 Jun 2006 13:52:09 -0000 1.13 --- startirp.c 15 Jan 2007 16:09:16 -0000 1.14 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2007/01/15 16:09:16 vfrolov + * Fixed non zero Information for IOCTL_SERIAL_IMMEDIATE_CHAR + * * Revision 1.13 2006/06/28 13:52:09 vfrolov * Fixed double-release of spin lock *************** *** 208,211 **** --- 211,215 ---- PC0C_IRP_STATE pState; PLIST_ENTRY pListEntry; + PIO_STACK_LOCATION pIrpStack; pListEntry = RemoveHeadList(pQueueToComplete); *************** *** 229,234 **** } ! if (pIrp->IoStatus.Status == STATUS_CANCELLED) pIrp->IoStatus.Information = 0; IoCompleteRequest(pIrp, IO_SERIAL_INCREMENT); --- 233,244 ---- } ! pIrpStack = IoGetCurrentIrpStackLocation(pIrp); ! ! if (pIrp->IoStatus.Status == STATUS_CANCELLED || ! (pIrpStack->MajorFunction == IRP_MJ_DEVICE_CONTROL && ! pIrpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SERIAL_IMMEDIATE_CHAR)) ! { pIrp->IoStatus.Information = 0; + } IoCompleteRequest(pIrp, IO_SERIAL_INCREMENT); *************** *** 283,289 **** status = NoPending(pIrp, status); ! if (pState->iQueue == C0C_QUEUE_WRITE && status != STATUS_PENDING) { ! pIoPort->amountInWriteQueue -= ! GetWriteLength(pIrp) - (ULONG)pIrp->IoStatus.Information; } --- 293,312 ---- status = NoPending(pIrp, status); ! if (status != STATUS_PENDING) { ! PIO_STACK_LOCATION pIrpStack; ! ! if (pState->iQueue == C0C_QUEUE_WRITE) { ! pIoPort->amountInWriteQueue -= ! GetWriteLength(pIrp) - (ULONG)pIrp->IoStatus.Information; ! } ! ! pIrpStack = IoGetCurrentIrpStackLocation(pIrp); ! ! if (status == STATUS_CANCELLED || ! (pIrpStack->MajorFunction == IRP_MJ_DEVICE_CONTROL && ! pIrpStack->Parameters.DeviceIoControl.IoControlCode == IOCTL_SERIAL_IMMEDIATE_CHAR)) ! { ! pIrp->IoStatus.Information = 0; ! } } |
From: Vyacheslav F. <vf...@us...> - 2007-01-15 16:07:26
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25219 Modified Files: ioctl.c Log Message: Fixed non zero Information for IOCTL_SERIAL_PURGE and IOCTL_SERIAL_LSRMST_INSERT Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/ioctl.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ioctl.c 11 Jan 2007 14:50:29 -0000 1.27 --- ioctl.c 15 Jan 2007 16:07:12 -0000 1.28 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.28 2007/01/15 16:07:12 vfrolov + * Fixed non zero Information for IOCTL_SERIAL_PURGE and IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.27 2007/01/11 14:50:29 vfrolov * Pool functions replaced by *************** *** 357,361 **** FdoPortCompleteQueue(&queueToComplete); - pIrp->IoStatus.Information = sizeof(ULONG); break; } --- 360,363 ---- *************** *** 519,526 **** } ! if (status == STATUS_SUCCESS) { pIoPortLocal->escapeChar = escapeChar; - pIrp->IoStatus.Information = sizeof(UCHAR); - } KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); --- 521,526 ---- } ! if (status == STATUS_SUCCESS) pIoPortLocal->escapeChar = escapeChar; KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); |
From: Vyacheslav F. <vf...@us...> - 2007-01-11 15:09:03
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17057 Modified Files: .cvsignore Log Message: Added i386 ia64 amd64 Index: .cvsignore =================================================================== RCS file: /cvsroot/com0com/com0com/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 23 Oct 2006 12:24:16 -0000 1.1 --- .cvsignore 11 Jan 2007 15:08:59 -0000 1.2 *************** *** 1 **** --- 1,4 ---- *.log + i386 + ia64 + amd64 |
From: Vyacheslav F. <vf...@us...> - 2007-01-11 15:07:43
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16628 Modified Files: ReadMe.txt Log Message: Added comment for Found New Hardware Wizard Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ReadMe.txt 13 Dec 2006 16:44:40 -0000 1.11 --- ReadMe.txt 11 Jan 2007 15:07:39 -0000 1.12 *************** *** 6,11 **** ============ ! The null-modem emulator is a kernel-mode virtual serial port driver for ! Windows. You can create an unlimited number of virtual COM port pairs and use any pair to connect one application to another. Each COM port pair provides two COM ports with default names starting --- 6,12 ---- ============ ! The Null-modem emulator is an open source kernel-mode virtual serial ! port driver for Windows, available freely under GPL license. ! You can create an unlimited number of virtual COM port pairs and use any pair to connect one application to another. Each COM port pair provides two COM ports with default names starting *************** *** 41,47 **** Simply run the installer (setup.exe). An installation wizard will guide ! you through the required steps. The one COM port pair with names CNCA0 and ! CNCB0 will be available on your system after the installation. You can add ! more pairs with the Setup Command Prompt: 1. Launch the Setup Command Prompt shortcut. --- 42,53 ---- Simply run the installer (setup.exe). An installation wizard will guide ! you through the required steps. ! If the Found New Hardware Wizard will pop up then ! - select "No, not this time" and click Next; ! - select "Install the software automatically (Recommended)" and click Next. ! The one COM port pair with names CNCA0 and CNCB0 will be available on your ! system after the installation. ! ! You can add more pairs with the Setup Command Prompt: 1. Launch the Setup Command Prompt shortcut. |
From: Vyacheslav F. <vf...@us...> - 2007-01-11 15:05:31
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15495 Modified Files: setup.cpp params.cpp Log Message: Replaced strtok() by STRTOK_R() Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** params.cpp 2 Nov 2006 16:11:58 -0000 1.3 --- params.cpp 11 Jan 2007 15:05: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/01/11 15:05:03 vfrolov + * Replaced strtok() by STRTOK_R() + * * Revision 1.3 2006/11/02 16:11:58 vfrolov * Added default values to help text *************** *** 34,37 **** --- 37,41 ---- #include "params.h" #include "utils.h" + #include "msg.h" /////////////////////////////////////////////////////////////// *************** *** 378,400 **** pars[sizeof(pars) - 1] = 0; ! for (const char *pPar = strtok(pars, "=") ; pPar ; pPar = strtok(NULL, "=")) { ! const char *pVal = strtok(NULL, ","); ! //Trace("'%s'='%s'\n", pPar, pVal); if (!pVal) return FALSE; ! if (!lstrcmpi(pPar, "PortName")) { if (!tmp.SetPortName(pVal)) return FALSE; } else ! if (!lstrcmpi(pPar, "EmuBR")) { if (!tmp.SetEmuBR(pVal)) return FALSE; } else ! if (!lstrcmpi(pPar, "EmuOverrun")) { if (!tmp.SetEmuOverrun(pVal)) return FALSE; --- 382,408 ---- pars[sizeof(pars) - 1] = 0; ! char *pSave1; ! for (char *pPar = STRTOK_R(pars, ",", &pSave1) ; pPar ; pPar = STRTOK_R(NULL, ",", &pSave1)) { ! char *pSave2; ! const char *pKey = STRTOK_R(pPar, "=", &pSave2); ! const char *pVal = STRTOK_R(NULL, "=", &pSave2); ! ! //Trace("'%s'='%s'\n", pKey, pVal); if (!pVal) return FALSE; ! if (!lstrcmpi(pKey, "PortName")) { if (!tmp.SetPortName(pVal)) return FALSE; } else ! if (!lstrcmpi(pKey, "EmuBR")) { if (!tmp.SetEmuBR(pVal)) return FALSE; } else ! if (!lstrcmpi(pKey, "EmuOverrun")) { if (!tmp.SetEmuOverrun(pVal)) return FALSE; Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** setup.cpp 21 Nov 2006 11:36:06 -0000 1.11 --- setup.cpp 11 Jan 2007 15:05:03 -0000 1.12 *************** *** 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.12 2007/01/11 15:05:03 vfrolov + * Replaced strtok() by STRTOK_R() + * * Revision 1.11 2006/11/21 11:36:06 vfrolov * Added --output option *************** *** 859,863 **** argc = 0; ! for (char *pArg = strtok(pCmd, " \t\r\n") ; pArg ; pArg = strtok(NULL, " \t\r\n")) { if ((argc + 2) > sizeArgv) break; --- 862,868 ---- argc = 0; ! char *pSave; ! ! for (char *pArg = STRTOK_R(pCmd, " \t\r\n", &pSave) ; pArg ; pArg = STRTOK_R(NULL, " \t\r\n", &pSave)) { if ((argc + 2) > sizeArgv) break; |
From: Vyacheslav F. <vf...@us...> - 2007-01-11 15:03:48
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15064 Modified Files: utils.cpp utils.h Log Message: Added STRTOK_R() Index: utils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** utils.cpp 3 Nov 2006 13:17:28 -0000 1.3 --- utils.cpp 11 Jan 2007 15:03:43 -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/01/11 15:03:43 vfrolov + * Added STRTOK_R() + * * Revision 1.3 2006/11/03 13:17:28 vfrolov * Fixed LocalReAlloc() usage *************** *** 63,66 **** --- 66,105 ---- } /////////////////////////////////////////////////////////////// + static BOOL IsDelim(char c, const char *pDelims) + { + while (*pDelims) { + if (c == *pDelims++) + return TRUE; + } + + return FALSE; + } + + char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave) + { + if (!pStr) + pStr = *ppSave; + + while (IsDelim(*pStr, pDelims)) + pStr++; + + if (!*pStr) { + *ppSave = pStr; + return NULL; + } + + char *pToken = pStr; + + while (*pStr && !IsDelim(*pStr, pDelims)) + pStr++; + + if (*pStr) + *pStr++ = 0; + + *ppSave = pStr; + + return pToken; + } + /////////////////////////////////////////////////////////////// BOOL StrToInt(const char *pStr, int *pNum) { Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** utils.h 3 Nov 2006 13:17:28 -0000 1.3 --- utils.h 11 Jan 2007 15:03:43 -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/01/11 15:03:43 vfrolov + * Added STRTOK_R() + * * Revision 1.3 2006/11/03 13:17:28 vfrolov * Fixed LocalReAlloc() usage *************** *** 37,40 **** --- 40,44 ---- int VSNPRINTF(char *pBuf, int size, const char *pFmt, va_list va); int SNPRINTF(char *pBuf, int size, const char *pFmt, ...); + char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave); BOOL StrToInt(const char *pStr, int *pNum); |
From: Vyacheslav F. <vf...@us...> - 2007-01-11 14:50:40
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9876 Modified Files: adddev.c bufutils.c delay.c ioctl.c openclos.c pnp.c strutils.c Log Message: Pool functions replaced by C0C_ALLOCATE_POOL() C0C_ALLOCATE_POOL_WITH_QUOTA() C0C_FREE_POOL() Index: bufutils.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/bufutils.c,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** bufutils.c 21 Jun 2006 16:23:57 -0000 1.7 --- bufutils.c 11 Jan 2007 14:50:29 -0000 1.8 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.8 2007/01/11 14:50:29 vfrolov + * Pool functions replaced by + * C0C_ALLOCATE_POOL() + * C0C_ALLOCATE_POOL_WITH_QUOTA() + * C0C_FREE_POOL() + * * Revision 1.7 2006/06/21 16:23:57 vfrolov * Fixed possible BSOD after one port of pair removal *************** *** 445,449 **** if (size <= C0C_BUFFER_SIZE(pBuf)) { ! ExFreePool(pBase); return FALSE; } --- 451,455 ---- if (size <= C0C_BUFFER_SIZE(pBuf)) { ! C0C_FREE_POOL(pBase); return FALSE; } *************** *** 472,476 **** } ! ExFreePool(pBuf->pBase); } --- 478,482 ---- } ! C0C_FREE_POOL(pBuf->pBase); } *************** *** 501,505 **** { if (pBuf->pBase) ! ExFreePool(pBuf->pBase); RtlZeroMemory(pBuf, sizeof(*pBuf)); --- 507,511 ---- { if (pBuf->pBase) ! C0C_FREE_POOL(pBuf->pBase); RtlZeroMemory(pBuf, sizeof(*pBuf)); Index: openclos.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/openclos.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** openclos.c 23 Jun 2006 11:44:52 -0000 1.15 --- openclos.c 11 Jan 2007 14:50:29 -0000 1.16 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.16 2007/01/11 14:50:29 vfrolov + * Pool functions replaced by + * C0C_ALLOCATE_POOL() + * C0C_ALLOCATE_POOL_WITH_QUOTA() + * C0C_FREE_POOL() + * * Revision 1.15 2006/06/23 11:44:52 vfrolov * Mass replacement pDevExt by pIoPort *************** *** 93,107 **** case MmLargeSystem: size = 4096; ! pBase = (PUCHAR)ExAllocatePool(NonPagedPool, size); if (pBase) break; case MmMediumSystem: size = 1024; ! pBase = (PUCHAR)ExAllocatePool(NonPagedPool, size); if (pBase) break; case MmSmallSystem: size = 128; ! pBase = (PUCHAR)ExAllocatePool(NonPagedPool, size); if (pBase) break; --- 99,113 ---- case MmLargeSystem: size = 4096; ! pBase = (PUCHAR)C0C_ALLOCATE_POOL(NonPagedPool, size); if (pBase) break; case MmMediumSystem: size = 1024; ! pBase = (PUCHAR)C0C_ALLOCATE_POOL(NonPagedPool, size); if (pBase) break; case MmSmallSystem: size = 128; ! pBase = (PUCHAR)C0C_ALLOCATE_POOL(NonPagedPool, size); if (pBase) break; Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/ioctl.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ioctl.c 23 Aug 2006 13:16:50 -0000 1.26 --- ioctl.c 11 Jan 2007 14:50:29 -0000 1.27 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.27 2007/01/11 14:50:29 vfrolov + * Pool functions replaced by + * C0C_ALLOCATE_POOL() + * C0C_ALLOCATE_POOL_WITH_QUOTA() + * C0C_FREE_POOL() + * * Revision 1.26 2006/08/23 13:16:50 vfrolov * Moved code for IOCTL_SERIAL_GET_PROPERTIES to commprop.c *************** *** 613,617 **** try { ! pBase = ExAllocatePoolWithQuota(NonPagedPool, pSysBuf->InSize); } except (EXCEPTION_EXECUTE_HANDLER) { pBase = NULL; --- 619,623 ---- try { ! pBase = C0C_ALLOCATE_POOL_WITH_QUOTA(NonPagedPool, pSysBuf->InSize); } except (EXCEPTION_EXECUTE_HANDLER) { pBase = NULL; Index: strutils.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/strutils.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** strutils.c 3 Nov 2006 13:13:26 -0000 1.3 --- strutils.c 11 Jan 2007 14:50:29 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.4 2007/01/11 14:50:29 vfrolov + * Pool functions replaced by + * C0C_ALLOCATE_POOL() + * C0C_ALLOCATE_POOL_WITH_QUOTA() + * C0C_FREE_POOL() + * * Revision 1.3 2006/11/03 13:13:26 vfrolov * CopyStrW() now gets size in characters (not in bytes) *************** *** 79,83 **** len = (ULONG)(pStrTmp - pStr) * sizeof(WCHAR); ! pStrTmp = (PWCHAR)ExAllocatePool(PagedPool, len); if (!pStrTmp) --- 85,89 ---- len = (ULONG)(pStrTmp - pStr) * sizeof(WCHAR); ! pStrTmp = (PWCHAR)C0C_ALLOCATE_POOL(PagedPool, len); if (!pStrTmp) *************** *** 93,97 **** { if (pDest->Buffer) ! ExFreePool(pDest->Buffer); RtlZeroMemory(pDest, sizeof(*pDest)); } --- 99,103 ---- { if (pDest->Buffer) ! C0C_FREE_POOL(pDest->Buffer); RtlZeroMemory(pDest, sizeof(*pDest)); } *************** *** 128,132 **** if (pDest->MaximumLength == (old.Length + lenSrc)) ! pDest->Buffer = ExAllocatePool(PagedPool, pDest->MaximumLength + sizeof(WCHAR)); if (pDest->Buffer) { --- 134,138 ---- if (pDest->MaximumLength == (old.Length + lenSrc)) ! pDest->Buffer = C0C_ALLOCATE_POOL(PagedPool, pDest->MaximumLength + sizeof(WCHAR)); if (pDest->Buffer) { *************** *** 136,140 **** PWCHAR pSrc0; ! pSrc0 = ExAllocatePool(PagedPool, lenSrc + sizeof(WCHAR)); if (pSrc0) { --- 142,146 ---- PWCHAR pSrc0; ! pSrc0 = C0C_ALLOCATE_POOL(PagedPool, lenSrc + sizeof(WCHAR)); if (pSrc0) { *************** *** 144,148 **** status = RtlAppendUnicodeToString(pDest, pSrc0); ! ExFreePool(pSrc0); } else status = STATUS_INSUFFICIENT_RESOURCES; --- 150,154 ---- status = RtlAppendUnicodeToString(pDest, pSrc0); ! C0C_FREE_POOL(pSrc0); } else status = STATUS_INSUFFICIENT_RESOURCES; *************** *** 154,158 **** if (old.Buffer) ! ExFreePool(old.Buffer); *pStatus = status; --- 160,164 ---- if (old.Buffer) ! C0C_FREE_POOL(old.Buffer); *pStatus = status; *************** *** 210,214 **** PWCHAR pStrTmp; ! pStrTmp = (PWCHAR)ExAllocatePool(PagedPool, len); if (pStrTmp) { --- 216,220 ---- PWCHAR pStrTmp; ! pStrTmp = (PWCHAR)C0C_ALLOCATE_POOL(PagedPool, len); if (pStrTmp) { *************** *** 222,226 **** StrAppendStr0(&status, pDest, pStrTmp); ! ExFreePool(pStrTmp); } else { status = STATUS_INSUFFICIENT_RESOURCES; --- 228,232 ---- StrAppendStr0(&status, pDest, pStrTmp); ! C0C_FREE_POOL(pStrTmp); } else { status = STATUS_INSUFFICIENT_RESOURCES; Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** adddev.c 23 Nov 2006 11:10:10 -0000 1.23 --- adddev.c 11 Jan 2007 14:50:28 -0000 1.24 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.24 2007/01/11 14:50:28 vfrolov + * Pool functions replaced by + * C0C_ALLOCATE_POOL() + * C0C_ALLOCATE_POOL_WITH_QUOTA() + * C0C_FREE_POOL() + * * Revision 1.23 2006/11/23 11:10:10 vfrolov * Strict usage fixed port numbers *************** *** 562,569 **** busyMaskLen = (numNext + (sizeof(*pBusyMask)*8 - 1))/(sizeof(*pBusyMask)*8); ! pBusyMask = ExAllocatePool(PagedPool, busyMaskLen); if (!pBusyMask) { ! SysLog(pDrvObj, STATUS_INSUFFICIENT_RESOURCES, L"AllocPortNum ExAllocatePool FAIL"); return numNext; } --- 568,575 ---- busyMaskLen = (numNext + (sizeof(*pBusyMask)*8 - 1))/(sizeof(*pBusyMask)*8); ! pBusyMask = C0C_ALLOCATE_POOL(PagedPool, busyMaskLen); if (!pBusyMask) { ! SysLog(pDrvObj, STATUS_INSUFFICIENT_RESOURCES, L"AllocPortNum C0C_ALLOCATE_POOL FAIL"); return numNext; } *************** *** 597,601 **** } ! ExFreePool(pBusyMask); return num; --- 603,607 ---- } ! C0C_FREE_POOL(pBusyMask); return num; *************** *** 625,629 **** len = sizeof(KEY_VALUE_FULL_INFORMATION) + sizeof(ULONG); ! pInfo = ExAllocatePool(PagedPool, len); if (pInfo) { --- 631,635 ---- len = sizeof(KEY_VALUE_FULL_INFORMATION) + sizeof(ULONG); ! pInfo = C0C_ALLOCATE_POOL(PagedPool, len); if (pInfo) { *************** *** 633,637 **** numPref = *(PULONG)pInfo->Data; ! ExFreePool(pInfo); } --- 639,643 ---- numPref = *(PULONG)pInfo->Data; ! C0C_FREE_POOL(pInfo); } Index: pnp.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/pnp.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pnp.c 23 Jun 2006 07:37:24 -0000 1.5 --- pnp.c 11 Jan 2007 14:50:29 -0000 1.6 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,29 ---- * * $Log$ + * Revision 1.6 2007/01/11 14:50:29 vfrolov + * Pool functions replaced by + * C0C_ALLOCATE_POOL() + * C0C_ALLOCATE_POOL_WITH_QUOTA() + * C0C_FREE_POOL() + * * Revision 1.5 2006/06/23 07:37:24 vfrolov * Disabled usage pDevExt after deleting device *************** *** 83,87 **** countRelations = pRelationsPrev ? pRelationsPrev->Count : 0; ! pRelations = (PDEVICE_RELATIONS)ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS) + ((countPdos + countRelations - 1) * sizeof (PDEVICE_OBJECT))); --- 89,93 ---- countRelations = pRelationsPrev ? pRelationsPrev->Count : 0; ! pRelations = (PDEVICE_RELATIONS)C0C_ALLOCATE_POOL(PagedPool, sizeof(DEVICE_RELATIONS) + ((countPdos + countRelations - 1) * sizeof (PDEVICE_OBJECT))); *************** *** 105,109 **** if (pRelationsPrev) ! ExFreePool(pRelationsPrev); pIrp->IoStatus.Information = (ULONG_PTR)pRelations; --- 111,115 ---- if (pRelationsPrev) ! C0C_FREE_POOL(pRelationsPrev); pIrp->IoStatus.Information = (ULONG_PTR)pRelations; *************** *** 226,230 **** PPNP_BUS_INFORMATION pBusInfo; ! pBusInfo = (PPNP_BUS_INFORMATION)ExAllocatePool(PagedPool, sizeof(PNP_BUS_INFORMATION)); if (!pBusInfo) --- 232,236 ---- PPNP_BUS_INFORMATION pBusInfo; ! pBusInfo = (PPNP_BUS_INFORMATION)C0C_ALLOCATE_POOL(PagedPool, sizeof(PNP_BUS_INFORMATION)); if (!pBusInfo) Index: delay.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/delay.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** delay.c 23 Jun 2006 11:44:52 -0000 1.4 --- delay.c 11 Jan 2007 14:50:29 -0000 1.5 *************** *** 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,29 ---- * * $Log$ + * Revision 1.5 2007/01/11 14:50:29 vfrolov + * Pool functions replaced by + * C0C_ALLOCATE_POOL() + * C0C_ALLOCATE_POOL_WITH_QUOTA() + * C0C_FREE_POOL() + * * Revision 1.4 2006/06/23 11:44:52 vfrolov * Mass replacement pDevExt by pIoPort *************** *** 112,116 **** PC0C_ADAPTIVE_DELAY pWriteDelay; ! pWriteDelay = (PC0C_ADAPTIVE_DELAY)ExAllocatePool(NonPagedPool, sizeof(*pWriteDelay)); if (!pWriteDelay) --- 118,122 ---- PC0C_ADAPTIVE_DELAY pWriteDelay; ! pWriteDelay = (PC0C_ADAPTIVE_DELAY)C0C_ALLOCATE_POOL(NonPagedPool, sizeof(*pWriteDelay)); if (!pWriteDelay) *************** *** 136,140 **** pIoPort->pWriteDelay = NULL; StopWriteDelayTimer(pWriteDelay); ! ExFreePool(pWriteDelay); } } --- 142,146 ---- pIoPort->pWriteDelay = NULL; StopWriteDelayTimer(pWriteDelay); ! C0C_FREE_POOL(pWriteDelay); } } |
From: Vyacheslav F. <vf...@us...> - 2007-01-11 14:44:56
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7233 Modified Files: com0com.h Log Message: Defined C0C_TAG C0C_ALLOCATE_POOL() C0C_ALLOCATE_POOL_WITH_QUOTA() C0C_FREE_POOL() Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** com0com.h 3 Nov 2006 13:07:58 -0000 1.31 --- com0com.h 11 Jan 2007 14:44:52 -0000 1.32 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,30 ---- * * $Log$ + * Revision 1.32 2007/01/11 14:44:52 vfrolov + * Defined + * C0C_TAG + * C0C_ALLOCATE_POOL() + * C0C_ALLOCATE_POOL_WITH_QUOTA() + * C0C_FREE_POOL() + * * Revision 1.31 2006/11/03 13:07:58 vfrolov * Moved C0C_PORT_NAME_LEN from sys/com0com.h to include/com0com.h *************** *** 396,398 **** --- 403,413 ---- PLIST_ENTRY pQueueToComplete); + #define C0C_TAG 'c0c' + #define C0C_ALLOCATE_POOL(PoolType, NumberOfBytes) \ + ExAllocatePoolWithTag(PoolType, NumberOfBytes, C0C_TAG) + #define C0C_ALLOCATE_POOL_WITH_QUOTA(PoolType, NumberOfBytes) \ + ExAllocatePoolWithQuotaTag(PoolType, NumberOfBytes, C0C_TAG) + #define C0C_FREE_POOL(P) \ + ExFreePool(P) /*ExFreePoolWithTag(P, C0C_TAG)*/ + #endif /* _C0C_COM0COM_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2007-01-11 14:39:11
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv4850 Modified Files: version.h Log Message: Post-tagging version change Index: version.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/version.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** version.h 13 Dec 2006 16:49:35 -0000 1.8 --- version.h 11 Jan 2007 14:39:08 -0000 1.9 *************** *** 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 *************** *** 23,32 **** #define _C0C_VERSION_H_ ! #define C0C_COPYRIGHT_YEARS "2004-2006" #define C0C_V1 1 #define C0C_V2 7 #define C0C_V3 0 ! #define C0C_V4 0 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 --- 23,32 ---- #define _C0C_VERSION_H_ ! #define C0C_COPYRIGHT_YEARS "2004-2007" #define C0C_V1 1 #define C0C_V2 7 #define C0C_V3 0 ! #define C0C_V4 1 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 |
From: Vyacheslav F. <vf...@us...> - 2006-12-14 08:25:58
|
Update of /cvsroot/com0com/com0com/NSIS In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27617 Modified Files: install.nsi Log Message: Added ReadMe.lnk Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** install.nsi 22 Nov 2006 07:58:45 -0000 1.3 --- install.nsi 14 Dec 2006 08:25:44 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2006/12/14 08:25:44 vfrolov + * Added ReadMe.lnk + * * Revision 1.3 2006/11/22 07:58:45 vfrolov * Changed uninstall keys *************** *** 164,167 **** --- 167,171 ---- CreateShortCut "$SMPROGRAMS\com0com\Setup Command Prompt.lnk" "$INSTDIR\setup.bat" CreateShortCut "$SMPROGRAMS\com0com\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 + CreateShortCut "$SMPROGRAMS\com0com\ReadMe.lnk" "$INSTDIR\ReadMe.txt" SectionEnd |
From: Vyacheslav F. <vf...@us...> - 2006-12-13 16:49:39
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23233 Modified Files: version.h Log Message: Pre-tagging version change Index: version.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/version.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** version.h 17 Jul 2006 09:54:59 -0000 1.7 --- version.h 13 Dec 2006 16:49:35 -0000 1.8 *************** *** 26,32 **** #define C0C_V1 1 ! #define C0C_V2 6 #define C0C_V3 0 ! #define C0C_V4 1 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 --- 26,32 ---- #define C0C_V1 1 ! #define C0C_V2 7 #define C0C_V3 0 ! #define C0C_V4 0 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 |
From: Vyacheslav F. <vf...@us...> - 2006-12-13 16:44:47
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21000 Modified Files: ReadMe.txt Log Message: Added installer description Removed "Manually" Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ReadMe.txt 23 Oct 2006 12:20:32 -0000 1.10 --- ReadMe.txt 13 Dec 2006 16:44:40 -0000 1.11 *************** *** 27,35 **** ======== 1. Set up the DDK environment on your machine. 2. Run the build -wcZ command in the com0com directory to build ! com0com.sys and setup.dll. ! 3. Copy com0com.inf, %CPU%\com0com.sys, %CPU%\setup.dll and setup\setup.bat ! files to a temporary directory. --- 27,38 ---- ======== + If you'd like to build a binary from source yourself then: + 1. Set up the DDK environment on your machine. 2. Run the build -wcZ command in the com0com directory to build ! <CPU>\com0com.sys and <CPU>\setup.dll (where <CPU> is i386, ia64 ! or amd64). ! 3. Create the installer (setup.exe) from NSIS\install.nsi by ! NSIS (see http://nsis.sourceforge.net/ for details) *************** *** 37,46 **** ========== ! With setup.dll ! -------------- ! 1. Run the setup.bat in the directory with com0com.inf, com0com.sys and ! setup.dll files. ! 2. Enter install command, for example: command> install - - --- 40,50 ---- ========== ! Simply run the installer (setup.exe). An installation wizard will guide ! you through the required steps. The one COM port pair with names CNCA0 and ! CNCB0 will be available on your system after the installation. You can add ! more pairs with the Setup Command Prompt: ! 1. Launch the Setup Command Prompt shortcut. ! 2. Enter the install command, for example: command> install - - *************** *** 48,82 **** The system will create 3 new virtual devices. One of the devices has name "com0com - bus for serial port pair emulator" and other two of ! them have name "com0com - serial port emulator" and located on CNCA0 ! and CNCB0 ports (or CNCA1 and CNCB1 or ...). ! To get more info enter help command, for example: command> help - Manually - -------- - - 1. Start the "Add/Remove Hardware" wizard in Control Panel. - 2. Click "Add/Troubleshoot a Device". - 3. Select "Add a new device" and then click Next. - 4. Select "No, I Want to Select the Hardware from a list". - 5. For the first time (if the driver is not installed yet): - 1. Select "Other Devices" and then click Next. - 2. Click "Have Disk". - 3. Enter path to the directory with com0com.inf and com0com.sys - files and then click OK. - For the next time (adding one more port pair) select - "com0com - serial port emulators" and then click Next. - 6. Select "com0com - bus for serial port pair emulator" and then - click Next. - - The system will create 3 new virtual devices. One of the devices has - name "com0com - bus for serial port pair emulator" and other two of - them have name "com0com - serial port emulator" and located on CNCA0 - and CNCB0 ports (or CNCA1 and CNCB1 or ...). - - TESTING ======= --- 52,63 ---- The system will create 3 new virtual devices. One of the devices has name "com0com - bus for serial port pair emulator" and other two of ! them have name "com0com - serial port emulator" and located on CNCAn ! and CNCBn ports. ! To get more info enter the help command, for example: command> help TESTING ======= *************** *** 91,125 **** ============ ! With setup.dll ! -------------- ! ! 1. Run the setup.bat in the directory with com0com.inf, com0com.sys and ! setup.dll files. ! 2. Enter uninstall command: ! ! command> uninstall ! ! ! Manually ! -------- ! ! Start Device Manager this way: ! ! set DEVMGR_SHOW_NONPRESENT_DEVICES=1 ! %SystemRoot%\system32\devmgmt.msc ! ! Click View and select "Show hidden devices". Remove all "com0com" devices. ! ! Remove the following subtrees from the registry: ! ! [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{DF799E12-3C56-421B-B298-B6D3642BC878}] ! [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com] ! [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\System\com0com] ! ! Delete file %SystemRoot%\system32\drivers\com0com.sys ! Find in the %SystemRoot%\inf\ directory the oem{N}.inf file(s) that corresponds ! to the com0com.inf file (the system renames com0com.inf to oem{N}.inf, where {N} ! is a number). Delete all found oem{N}.inf and corresponding oem{N}.PNF files. --- 72,82 ---- ============ ! Simply launch the com0com's Uninstall shortcut in the Start Menu or remove ! the "Null-modem emulator (com0com)" entry from the "Add/Remove Programs" ! section in the Control Panel. An uninstallation wizard will guide ! you through the required steps. ! HINT: To uninstall the old version of com0com (distributed w/o installer) ! install the new one and then uninstall it. *************** *** 128,150 **** Q. Is it possible to change the names CNCA0 and CNCB0 to COM2 and COM3? ! A. Yes, it's possible. Add the following to the registry: ! [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Parameters\CNCA0] ! "PortName"="COM2" ! [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Parameters\CNCB0] ! "PortName"="COM3" Q. The baud rate setting does not seem to make a difference: data is always transferred at the same speed. How to enable the baud rate emulation? ! A. To enable baud rate emulation for transferring data from CNCA0 to CNCB0 add ! the following to the registry: ! [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Parameters\CNCA0] ! "EmuBR"=dword:FFFFFFFF Q. The HyperTerminal test succeeds, but I get a failure when trying to open the port with CreateFile("CNCA0", ...). GetLastError() returns ERROR_FILE_NOT_FOUND. ! A. You must prefix name with the special characters "\\.\". Try to open the port ! with CreateFile("\\\\.\\CNCA0", ...). Q. My application hangs during its startup when it sends anything to one paired --- 85,109 ---- Q. Is it possible to change the names CNCA0 and CNCB0 to COM2 and COM3? ! A. Yes, it's possible. To change the names: ! 1. Launch the Setup Command Prompt shortcut. ! 2. Enter the change commands, for example: ! ! command> change CNCA0 PortName=COM2 ! command> change CNCB0 PortName=COM3 Q. The baud rate setting does not seem to make a difference: data is always transferred at the same speed. How to enable the baud rate emulation? ! A. To enable baud rate emulation for transferring data from CNCA0 to CNCB0: ! 1. Launch the Setup Command Prompt shortcut. ! 2. Enter the change command, for example: ! ! command> change CNCA0 EmuBR=yes Q. The HyperTerminal test succeeds, but I get a failure when trying to open the port with CreateFile("CNCA0", ...). GetLastError() returns ERROR_FILE_NOT_FOUND. ! A. You must prefix the port name with the special characters "\\.\". Try to open ! the port with CreateFile("\\\\.\\CNCA0", ...). Q. My application hangs during its startup when it sends anything to one paired *************** *** 156,163 **** receiving port. Also, to prevent some flow control issues you need to enable baud rate emulation for the sending port. So, if your application use port CNCA0 ! and other paired port is CNCB0, then add the following to the registry: ! [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Parameters\CNCB0] ! "EmuOverrun"=dword:FFFFFFFF ! [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\com0com\Parameters\CNCA0] ! "EmuBR"=dword:FFFFFFFF --- 115,123 ---- receiving port. Also, to prevent some flow control issues you need to enable baud rate emulation for the sending port. So, if your application use port CNCA0 ! and other paired port is CNCB0, then: ! 1. Launch the Setup Command Prompt shortcut. ! 2. Enter the change commands, for example: ! ! command> change CNCB0 EmuOverrun=yes ! command> change CNCA0 EmuBR=yes |
From: Vyacheslav F. <vf...@us...> - 2006-11-27 12:00:12
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29840 Modified Files: io.c Log Message: Fixed unexpected completing all queued read requests when completing the first one Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/io.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** io.c 21 Jun 2006 16:23:57 -0000 1.28 --- io.c 27 Nov 2006 11:58:27 -0000 1.29 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.29 2006/11/27 11:58:27 vfrolov + * Fixed unexpected completing all queued read requests when + * completing the first one + * * Revision 1.28 2006/06/21 16:23:57 vfrolov * Fixed possible BSOD after one port of pair removal *************** *** 760,764 **** /* get first pIrpRead */ ! dataIrpRead.data.irp.status = STATUS_SUCCESS; doneRead = 0; firstRead = TRUE; --- 764,768 ---- /* get first pIrpRead */ ! dataIrpRead.data.irp.status = STATUS_PENDING; doneRead = 0; firstRead = TRUE; *************** *** 952,955 **** --- 956,960 ---- if (dataIrpRead.data.irp.status != STATUS_PENDING) { + dataIrpRead.data.irp.status = STATUS_PENDING; doneRead = 0; firstRead = FALSE; |
From: Vyacheslav F. <vf...@us...> - 2006-11-23 11:10:15
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv701 Modified Files: adddev.c Log Message: Strict usage fixed port numbers Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** adddev.c 3 Nov 2006 13:13:26 -0000 1.22 --- adddev.c 23 Nov 2006 11:10:10 -0000 1.23 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.23 2006/11/23 11:10:10 vfrolov + * Strict usage fixed port numbers + * * Revision 1.22 2006/11/03 13:13:26 vfrolov * CopyStrW() now gets size in characters (not in bytes) *************** *** 633,637 **** } ! num = AllocPortNum(pDrvObj, numPref); if (num != numPref) { --- 636,643 ---- } ! if (numPref == (ULONG)-1) ! num = AllocPortNum(pDrvObj, numPref); ! else ! num = numPref; if (num != numPref) { |
From: Vyacheslav F. <vf...@us...> - 2006-11-22 07:59:00
|
Update of /cvsroot/com0com/com0com/NSIS In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv449 Modified Files: install.nsi Log Message: Changed uninstall keys Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** install.nsi 21 Nov 2006 11:43:42 -0000 1.2 --- install.nsi 22 Nov 2006 07:58:45 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2006/11/22 07:58:45 vfrolov + * Changed uninstall keys + * * Revision 1.2 2006/11/21 11:43:42 vfrolov * Added Modern UI *************** *** 28,32 **** * Initial revision * - * */ --- 31,34 ---- *************** *** 143,150 **** ; Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "DisplayName" "Null-modem emulator (com0com)" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "UninstallString" '"$INSTDIR\uninstall.exe"' - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "URLInfoAbout" "http://com0com.sourceforge.net/" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "NoRepair" 1 WriteUninstaller "uninstall.exe" --- 145,156 ---- ; Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "DisplayName" "Null-modem emulator (com0com)" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "HelpLink" "http://com0com.sourceforge.net/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "URLUpdateInfo" "http://com0com.sourceforge.net/" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "Readme" "$INSTDIR\ReadMe.txt" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "NoRepair" 1 + WriteUninstaller "uninstall.exe" |
From: Vyacheslav F. <vf...@us...> - 2006-11-21 11:43:46
|
Update of /cvsroot/com0com/com0com/NSIS In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30488 Modified Files: install.nsi Log Message: Added Modern UI Added "CNCA0<->CNCB0" section Added "Launch Setup Command Prompt" on finish page Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** install.nsi 23 Oct 2006 12:26:02 -0000 1.1 --- install.nsi 21 Nov 2006 11:43:42 -0000 1.2 *************** *** 20,23 **** --- 20,28 ---- * * $Log$ + * Revision 1.2 2006/11/21 11:43:42 vfrolov + * Added Modern UI + * Added "CNCA0<->CNCB0" section + * Added "Launch Setup Command Prompt" on finish page + * * Revision 1.1 2006/10/23 12:26:02 vfrolov * Initial revision *************** *** 28,31 **** --- 33,84 ---- ;-------------------------------- + !include "MUI.nsh" + + ;-------------------------------- + + Function LaunchSetupCommandPrompt + + Exec "RunDll32 setup,RunDll" + + FunctionEnd + + ;-------------------------------- + + !macro MoveFileToDetails file + + Push $0 + Push $1 + Push $2 + Push $3 + + StrCpy $0 "${file}" + + FileOpen $1 $0 r + IfErrors +9 + + FileRead $1 $2 + IfErrors +7 + + StrCpy $3 $2 2 -2 + StrCmp $3 "$\r$\n" 0 +2 + StrCpy $2 $2 -2 + + StrCmp $2 "" +2 + DetailPrint $2 + + Goto -7 + + FileClose $1 + Delete $0 + + Pop $3 + Pop $2 + Pop $1 + Pop $0 + + !macroend + + ;-------------------------------- + ; The name of the installer Name "Null-modem emulator (com0com)" *************** *** 41,59 **** InstallDirRegKey HKLM "Software\com0com" "Install_Dir" ! ;-------------------------------- ; Pages ! Page components ! Page directory ! Page instfiles ! UninstPage uninstConfirm ! UninstPage instfiles ;-------------------------------- ! ; The stuff to install ! Section "Install com0com" SectionIn RO --- 94,128 ---- InstallDirRegKey HKLM "Software\com0com" "Install_Dir" ! ShowInstDetails show ! ShowUninstDetails show + ;-------------------------------- ; Pages ! !define MUI_FINISHPAGE_RUN ! !define MUI_FINISHPAGE_RUN_FUNCTION LaunchSetupCommandPrompt ! !define MUI_FINISHPAGE_RUN_TEXT "Launch Setup Command Prompt" ! !define MUI_FINISHPAGE_NOAUTOCLOSE ! !define MUI_UNFINISHPAGE_NOAUTOCLOSE ! !insertmacro MUI_PAGE_WELCOME ! !insertmacro MUI_PAGE_COMPONENTS ! !insertmacro MUI_PAGE_DIRECTORY ! !insertmacro MUI_PAGE_INSTFILES ! !insertmacro MUI_PAGE_FINISH ! ! !insertmacro MUI_UNPAGE_WELCOME ! !insertmacro MUI_UNPAGE_CONFIRM ! !insertmacro MUI_UNPAGE_INSTFILES ! !insertmacro MUI_UNPAGE_FINISH ;-------------------------------- + ;Languages ! !insertmacro MUI_LANGUAGE "English" ! ! ;-------------------------------- ! ! Section "com0com" sec_com0com SectionIn RO *************** *** 82,90 **** SectionEnd ! ; Optional section (can be disabled by the user) ! Section "Start Menu Shortcuts" CreateDirectory "$SMPROGRAMS\com0com" ! CreateShortCut "$SMPROGRAMS\com0com\setup.lnk" "$INSTDIR\setup.bat" CreateShortCut "$SMPROGRAMS\com0com\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 --- 151,160 ---- SectionEnd ! ;-------------------------------- ! ! Section "Start Menu Shortcuts" sec_shortcuts CreateDirectory "$SMPROGRAMS\com0com" ! CreateShortCut "$SMPROGRAMS\com0com\Setup Command Prompt.lnk" "$INSTDIR\setup.bat" CreateShortCut "$SMPROGRAMS\com0com\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 *************** *** 93,101 **** ;-------------------------------- ; Uninstaller Section "Uninstall" ! ExecWait "RunDll32 setup,RunDll uninstall" ; Remove registry keys --- 163,183 ---- ;-------------------------------- + Section "CNCA0<->CNCB0" sec_ports + + GetTempFileName $0 + ExecWait "RunDll32 setup,RunDll --output $0 install 0 - -" + !insertmacro MoveFileToDetails $0 + + SectionEnd + + ;-------------------------------- + ; Uninstaller Section "Uninstall" ! GetTempFileName $0 ! ExecWait "RunDll32 setup,RunDll --output $0 uninstall" ! !insertmacro MoveFileToDetails $0 ; Remove registry keys *************** *** 119,120 **** --- 201,218 ---- SectionEnd + + ;-------------------------------- + + ;Language strings + LangString DESC_sec_com0com ${LANG_ENGLISH} "Install com0com files." + LangString DESC_sec_shortcuts ${LANG_ENGLISH} "Add shortcuts to the Start Menu." + LangString DESC_sec_ports ${LANG_ENGLISH} "Install a pair of linked ports with identifiers CNCA0 and CNCB0." + + ;Assign language strings to sections + !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${sec_com0com} $(DESC_sec_com0com) + !insertmacro MUI_DESCRIPTION_TEXT ${sec_shortcuts} $(DESC_sec_shortcuts) + !insertmacro MUI_DESCRIPTION_TEXT ${sec_ports} $(DESC_sec_ports) + !insertmacro MUI_FUNCTION_DESCRIPTION_END + + ;-------------------------------- |
From: Vyacheslav F. <vf...@us...> - 2006-11-21 11:36:14
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27654 Modified Files: setup.cpp Log Message: Added --output option Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** setup.cpp 10 Nov 2006 14:07:40 -0000 1.10 --- setup.cpp 21 Nov 2006 11:36:06 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2006/11/21 11:36:06 vfrolov + * Added --output option + * * Revision 1.10 2006/11/10 14:07:40 vfrolov * Implemented remove command *************** *** 689,700 **** SetTitle(C0C_SETUP_TITLE " (HELP)"); ! Trace( C0C_SETUP_TITLE "\n" "\n"); ! Trace( "Usage:\n" ! " %s<command>\n" , pCmdPref); ! Trace( "\n" "Commands:\n" --- 692,708 ---- SetTitle(C0C_SETUP_TITLE " (HELP)"); ! ConsoleWrite( C0C_SETUP_TITLE "\n" "\n"); ! ConsoleWrite( "Usage:\n" ! " %s [options] <command>\n" , pCmdPref); ! ConsoleWrite( ! "\n" ! "Options:\n" ! " --output <file> - file for output, default is console\n" ! ); ! ConsoleWrite( "\n" "Commands:\n" *************** *** 717,753 **** " help - print this help\n" ); ! Trace( "\n" "%s", PortParameters::GetHelp()); ! Trace( "\n" "Examples:\n" ); ! Trace( " %sinstall - -\n" , pCmdPref); ! Trace( " %sinstall 5 * *\n" , pCmdPref); ! Trace( " %sremove 0\n" , pCmdPref); ! Trace( " %sinstall PortName=COM2 PortName=COM4\n" , pCmdPref); ! Trace( " %sinstall PortName=COM5,EmuBR=yes,EmuOverrun=yes -\n" , pCmdPref); ! Trace( " %schange " C0C_PREF_PORT_NAME_A "0 EmuBR=yes,EmuOverrun=yes\n" , pCmdPref); ! Trace( " %slist\n" , pCmdPref); ! Trace( " %suninstall\n" , pCmdPref); ! Trace( "\n"); --- 725,761 ---- " help - print this help\n" ); ! ConsoleWrite( "\n" "%s", PortParameters::GetHelp()); ! ConsoleWrite( "\n" "Examples:\n" ); ! ConsoleWrite( " %sinstall - -\n" , pCmdPref); ! ConsoleWrite( " %sinstall 5 * *\n" , pCmdPref); ! ConsoleWrite( " %sremove 0\n" , pCmdPref); ! ConsoleWrite( " %sinstall PortName=COM2 PortName=COM4\n" , pCmdPref); ! ConsoleWrite( " %sinstall PortName=COM5,EmuBR=yes,EmuOverrun=yes -\n" , pCmdPref); ! ConsoleWrite( " %schange " C0C_PREF_PORT_NAME_A "0 EmuBR=yes,EmuOverrun=yes\n" , pCmdPref); ! ConsoleWrite( " %slist\n" , pCmdPref); ! ConsoleWrite( " %suninstall\n" , pCmdPref); ! ConsoleWrite( "\n"); *************** *** 757,760 **** --- 765,785 ---- int Main(int argc, const char* argv[]) { + SetOutputFile(NULL); + + while (argc > 1) { + if (*argv[1] != '-') + break; + + if (!strcmp(argv[1], "--output") && argc > 2) { + SetOutputFile(argv[2]); + argv[2] = argv[0]; + argv += 2; + argc -= 2; + } else { + ConsoleWrite("Invalid option %s\n", argv[1]); + return 1; + } + } + if (argc == 1) { return 0; *************** *** 823,827 **** } ! Trace("Invalid command\n"); return 1; --- 848,852 ---- } ! ConsoleWrite("Invalid command\n"); return 1; *************** *** 868,872 **** if (argc == 1) { ! Trace("Enter 'help' to get info about usage of " C0C_SETUP_TITLE ".\n\n"); argv[0] = ""; --- 893,897 ---- if (argc == 1) { ! ConsoleWrite("Enter 'help' to get info about usage of " C0C_SETUP_TITLE ".\n\n"); argv[0] = ""; *************** *** 890,894 **** int res = Main(argc, argv); ! ConsoleWriteRead(cmd, sizeof(cmd)/sizeof(cmd[0]), "\nPress <RETURN> to continue\n"); return res; --- 915,920 ---- int res = Main(argc, argv); ! if (!GetOutputFile()) ! ConsoleWriteRead(cmd, sizeof(cmd)/sizeof(cmd[0]), "\nPress <RETURN> to continue\n"); return res; |
From: Vyacheslav F. <vf...@us...> - 2006-11-21 11:35:04
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv27116 Modified Files: msg.cpp msg.h Log Message: Added ConsoleWrite() IsConsoleOpen() SetOutputFile() GetOutputFile() Index: msg.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/msg.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** msg.h 23 Oct 2006 12:04:23 -0000 1.2 --- msg.h 21 Nov 2006 11:34:55 -0000 1.3 *************** *** 20,23 **** --- 20,30 ---- * * $Log$ + * Revision 1.3 2006/11/21 11:34:55 vfrolov + * Added + * ConsoleWrite() + * IsConsoleOpen() + * SetOutputFile() + * GetOutputFile() + * * Revision 1.2 2006/10/23 12:04:23 vfrolov * Added SetTitle() *************** *** 26,30 **** * Initial revision * - * */ --- 33,36 ---- *************** *** 37,41 **** --- 43,51 ---- void Trace(const char *pFmt, ...); void ConsoleWriteRead(char *pReadBuf, int lenReadBuf, const char *pFmt, ...); + void ConsoleWrite(const char *pFmt, ...); + BOOL IsConsoleOpen(); void SetTitle(const char *pTitle); + void SetOutputFile(const char *pFile); + const char *GetOutputFile(); #endif /* _C0C_MSG_H_ */ Index: msg.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/msg.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** msg.cpp 23 Oct 2006 12:04:23 -0000 1.3 --- msg.cpp 21 Nov 2006 11:34:55 -0000 1.4 *************** *** 20,23 **** --- 20,30 ---- * * $Log$ + * Revision 1.4 2006/11/21 11:34:55 vfrolov + * Added + * ConsoleWrite() + * IsConsoleOpen() + * SetOutputFile() + * GetOutputFile() + * * Revision 1.3 2006/10/23 12:04:23 vfrolov * Added SetTitle() *************** *** 35,38 **** --- 42,46 ---- #include "utils.h" + char *pOutputFile = NULL; char title[80] = ""; *************** *** 45,48 **** --- 53,58 ---- static int (* pShowMsg)(LPCSTR pText, UINT type) = ShowMsgDefault; /////////////////////////////////////////////////////////////// + static BOOL isConsoleOpen = FALSE; + static void ConsoleWriteReadDefault(LPSTR pReadBuf, DWORD lenReadBuf, LPCSTR pText) { *************** *** 53,56 **** --- 63,67 ---- handle = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTitle(title); + isConsoleOpen = TRUE; } *************** *** 74,77 **** --- 85,116 ---- { pConsole(NULL, 0, pText); + + if (!pOutputFile || !pText) + return; + + HANDLE hFile = CreateFile( + pOutputFile, + GENERIC_WRITE, + FILE_SHARE_READ, + NULL, + OPEN_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (hFile != INVALID_HANDLE_VALUE) { + SetFilePointer(hFile, 0, NULL, FILE_END); + + LPCSTR p; + + for (p = pText ; *p ; p++) { + DWORD not_used; + + if (*p == '\n') + WriteFile(hFile, "\r", sizeof(*p), ¬_used, NULL); + WriteFile(hFile, p, sizeof(*p), ¬_used, NULL); + } + + CloseHandle(hFile); + } } *************** *** 182,185 **** --- 221,243 ---- } /////////////////////////////////////////////////////////////// + void ConsoleWrite(const char *pFmt, ...) + { + char buf[1024]; + va_list va; + + va_start(va, pFmt); + + VSNPRINTF(buf, sizeof(buf)/sizeof(buf[0]), pFmt, va); + + va_end(va); + + pConsole(NULL, 0, buf); + } + /////////////////////////////////////////////////////////////// + BOOL IsConsoleOpen() + { + return isConsoleOpen; + } + /////////////////////////////////////////////////////////////// void SetTitle(const char *pTitle) { *************** *** 187,188 **** --- 245,266 ---- } /////////////////////////////////////////////////////////////// + void SetOutputFile(const char *pFile) + { + if (pOutputFile) { + LocalFree(pOutputFile); + pOutputFile = NULL; + } + + if (pFile) { + pOutputFile = (char *)LocalAlloc(LPTR, (lstrlen(pFile) + 1)*sizeof(*pFile)); + + if (pOutputFile) + lstrcpy(pOutputFile, pFile); + } + } + /////////////////////////////////////////////////////////////// + const char *GetOutputFile() + { + return pOutputFile; + } + /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2006-11-16 12:51:52
|
Update of /cvsroot/com0com/com2tcp In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11266 Modified Files: utils.cxx utils.h com2tcp.cpp Log Message: Added ability to set COM port parameters Index: com2tcp.cpp =================================================================== RCS file: /cvsroot/com0com/com2tcp/com2tcp.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** com2tcp.cpp 25 Nov 2005 13:49:23 -0000 1.9 --- com2tcp.cpp 16 Nov 2006 12:51:43 -0000 1.10 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2006/11/16 12:51:43 vfrolov + * Added ability to set COM port parameters + * * Revision 1.9 2005/11/25 13:49:23 vfrolov * Implemented --interface option for client mode *************** *** 47,51 **** * Initial revision * - * */ --- 50,53 ---- *************** *** 523,527 **** } /////////////////////////////////////////////////////////////// ! static HANDLE OpenC0C(const char *pPath, BOOL ignoreDSR) { HANDLE hC0C = CreateFile(pPath, --- 525,529 ---- } /////////////////////////////////////////////////////////////// ! static HANDLE OpenC0C(const char *pPath, const ComParams &comParams) { HANDLE hC0C = CreateFile(pPath, *************** *** 545,556 **** } ! dcb.BaudRate = CBR_19200; ! dcb.ByteSize = 8; ! dcb.Parity = NOPARITY; ! dcb.StopBits = ONESTOPBIT; dcb.fOutxCtsFlow = FALSE; dcb.fOutxDsrFlow = FALSE; ! dcb.fDsrSensitivity = !ignoreDSR; dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; dcb.fDtrControl = DTR_CONTROL_ENABLE; --- 547,565 ---- } ! if (comParams.BaudRate() > 0) ! dcb.BaudRate = (DWORD)comParams.BaudRate(); ! ! if (comParams.ByteSize() > 0) ! dcb.ByteSize = (BYTE)comParams.ByteSize(); ! ! if (comParams.Parity() >= 0) ! dcb.Parity = (BYTE)comParams.Parity(); ! ! if (comParams.StopBits() >= 0) ! dcb.StopBits = (BYTE)comParams.StopBits(); dcb.fOutxCtsFlow = FALSE; dcb.fOutxDsrFlow = FALSE; ! dcb.fDsrSensitivity = !comParams.IgnoreDSR(); dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; dcb.fDtrControl = DTR_CONTROL_ENABLE; *************** *** 593,597 **** } ! printf("OpenC0C(\"%s\") - OK\n", pPath); return hC0C; --- 602,611 ---- } ! printf("OpenC0C(\"%s\", baud=%ld, data=%ld, parity=%s, stop=%s) - OK\n", ! pPath, ! (long)dcb.BaudRate, ! (long)dcb.ByteSize, ! ComParams::ParityStr(dcb.Parity), ! ComParams::StopBitsStr(dcb.StopBits)); return hC0C; *************** *** 700,704 **** static int tcp2com( const char *pPath, ! BOOL ignoreDSR, const char *pIF, const char *pPort, --- 714,718 ---- static int tcp2com( const char *pPath, ! const ComParams &comParams, const char *pIF, const char *pPort, *************** *** 722,729 **** break; ! HANDLE hC0C = OpenC0C(pPath, ignoreDSR); if (hC0C != INVALID_HANDLE_VALUE) { ! InOut(hC0C, hSock, protocol, ignoreDSR, hSockListen); CloseHandle(hC0C); } --- 736,743 ---- break; ! HANDLE hC0C = OpenC0C(pPath, comParams); if (hC0C != INVALID_HANDLE_VALUE) { ! InOut(hC0C, hSock, protocol, comParams.IgnoreDSR(), hSockListen); CloseHandle(hC0C); } *************** *** 765,769 **** static int com2tcp( const char *pPath, ! BOOL ignoreDSR, const char *pIF, const char *pAddr, --- 779,783 ---- static int com2tcp( const char *pPath, ! const ComParams &comParams, const char *pIF, const char *pAddr, *************** *** 772,776 **** const BYTE *pAwakSeq) { ! HANDLE hC0C = OpenC0C(pPath, ignoreDSR); if (hC0C == INVALID_HANDLE_VALUE) { --- 786,790 ---- const BYTE *pAwakSeq) { ! HANDLE hC0C = OpenC0C(pPath, comParams); if (hC0C == INVALID_HANDLE_VALUE) { *************** *** 778,782 **** } ! while (WaitComReady(hC0C, ignoreDSR, pAwakSeq)) { SOCKET hSock = Connect(pIF, pAddr, pPort); --- 792,796 ---- } ! while (WaitComReady(hC0C, comParams.IgnoreDSR(), pAwakSeq)) { SOCKET hSock = Connect(pIF, pAddr, pPort); *************** *** 784,788 **** break; ! InOut(hC0C, hSock, protocol, ignoreDSR); Disconnect(hSock); --- 798,802 ---- break; ! InOut(hC0C, hSock, protocol, comParams.IgnoreDSR()); Disconnect(hSock); *************** *** 805,809 **** fprintf(stderr, " --telnet - use Telnet protocol.\n"); fprintf(stderr, " --terminal <type> - use terminal <type> (RFC 1091).\n"); ! fprintf(stderr, " --ignore-dsr - ignore DSR state.\n"); fprintf(stderr, "\n"); fprintf(stderr, "Client mode options:\n"); --- 819,847 ---- fprintf(stderr, " --telnet - use Telnet protocol.\n"); fprintf(stderr, " --terminal <type> - use terminal <type> (RFC 1091).\n"); ! fprintf(stderr, " --help - show this help.\n"); ! fprintf(stderr, "\n"); ! fprintf(stderr, "COM port options:\n"); ! fprintf(stderr, " --baud <b> - set baud rate to <b> (default is %ld),\n", ! (long)ComParams().BaudRate()); ! fprintf(stderr, " where <b> is %s.\n", ! ComParams::BaudRateLst()); ! fprintf(stderr, " --data <d> - set data bits to <d> (default is %ld), where <d> is\n", ! (long)ComParams().ByteSize()); ! fprintf(stderr, " %s.\n", ! ComParams::ByteSizeLst()); ! fprintf(stderr, " --parity <p> - set parity to <p> (default is %s), where <p> is\n", ! ComParams::ParityStr(ComParams().Parity())); ! fprintf(stderr, " %s.\n", ! ComParams::ParityLst()); ! fprintf(stderr, " --stop <s> - set stop bits to <s> (default is %s), where <s> is\n", ! ComParams::StopBitsStr(ComParams().StopBits())); ! fprintf(stderr, " %s.\n", ! ComParams::StopBitsLst()); ! fprintf(stderr, " --ignore-dsr - ignore DSR state (do not wait DSR to be ON before\n"); ! fprintf(stderr, " connecting to host, do not close connection after\n"); ! fprintf(stderr, " DSR is OFF and do not ignore any bytes received\n"); ! fprintf(stderr, " while DSR is OFF).\n"); ! fprintf(stderr, "\n"); ! fprintf(stderr, " The value d[efault] above means to use current COM port settings.\n"); fprintf(stderr, "\n"); fprintf(stderr, "Client mode options:\n"); *************** *** 825,829 **** const char *pIF = NULL; char **pArgs = &argv[1]; ! BOOL ignoreDSR = FALSE; while (argc > 1) { --- 863,867 ---- const char *pIF = NULL; char **pArgs = &argv[1]; ! ComParams comParams; while (argc > 1) { *************** *** 831,834 **** --- 869,875 ---- break; + if (!strcmp(*pArgs, "--help")) { + Usage(argv[0]); + } else if (!strcmp(*pArgs, "--telnet")) { protocol = prTelnet; *************** *** 836,839 **** --- 877,888 ---- argc--; } else + if (!strcmp(*pArgs, "--ignore-dsr")) { + pArgs++; + argc--; + comParams.SetIgnoreDSR(TRUE); + } else + if (argc < 3) { + Usage(argv[0]); + } else if (!strcmp(*pArgs, "--terminal")) { pArgs++; *************** *** 843,850 **** argc--; } else ! if (!strcmp(*pArgs, "--ignore-dsr")) { pArgs++; argc--; - ignoreDSR = TRUE; } else if (!strcmp(*pArgs, "--awak-seq")) { --- 892,928 ---- argc--; } else ! if (!strcmp(*pArgs, "--baud")) { ! pArgs++; ! argc--; ! comParams.SetBaudRate(*pArgs); ! pArgs++; ! argc--; ! } else ! if (!strcmp(*pArgs, "--data")) { ! pArgs++; ! argc--; ! comParams.SetByteSize(*pArgs); ! pArgs++; ! argc--; ! } else ! if (!strcmp(*pArgs, "--parity")) { ! pArgs++; ! argc--; ! if (!comParams.SetParity(*pArgs)) { ! fprintf(stderr, "Unknown parity value %s\n", *pArgs); ! exit(1); ! } ! pArgs++; ! argc--; ! } else ! if (!strcmp(*pArgs, "--stop")) { ! pArgs++; ! argc--; ! if (!comParams.SetStopBits(*pArgs)) { ! fprintf(stderr, "Unknown stop bits value %s\n", *pArgs); ! exit(1); ! } pArgs++; argc--; } else if (!strcmp(*pArgs, "--awak-seq")) { *************** *** 863,867 **** } else { fprintf(stderr, "Unknown option %s\n", *pArgs); ! Usage(argv[0]); } } --- 941,945 ---- } else { fprintf(stderr, "Unknown option %s\n", *pArgs); ! exit(1); } } *************** *** 888,894 **** if (argc == 4) ! res = com2tcp(pArgs[0], ignoreDSR, pIF, pArgs[1], pArgs[2], *pProtocol, pAwakSeq); else ! res = tcp2com(pArgs[0], ignoreDSR, pIF, pArgs[1], *pProtocol); delete pProtocol; --- 966,972 ---- if (argc == 4) ! res = com2tcp(pArgs[0], comParams, pIF, pArgs[1], pArgs[2], *pProtocol, pAwakSeq); else ! res = tcp2com(pArgs[0], comParams, pIF, pArgs[1], *pProtocol); delete pProtocol; Index: utils.cxx =================================================================== RCS file: /cvsroot/com0com/com2tcp/utils.cxx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** utils.cxx 3 Oct 2005 13:44:17 -0000 1.3 --- utils.cxx 16 Nov 2006 12:51:43 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2006/11/16 12:51:43 vfrolov + * Added ability to set COM port parameters + * * Revision 1.3 2005/10/03 13:44:17 vfrolov * Added Clean() method *************** *** 29,33 **** * Initial revision * - * */ --- 32,35 ---- *************** *** 181,182 **** --- 183,267 ---- } /////////////////////////////////////////////////////////////// + ComParams::ComParams() + : baudRate(CBR_19200), + byteSize(8), + parity(NOPARITY), + stopBits(ONESTOPBIT), + ignoreDSR(FALSE) + { + } + + BOOL ComParams::SetParity(const char *pParity) + { + switch (*pParity) { + case 'n': parity = NOPARITY; break; + case 'o': parity = ODDPARITY; break; + case 'e': parity = EVENPARITY; break; + case 'm': parity = MARKPARITY; break; + case 's': parity = SPACEPARITY; break; + case 'd': parity = -1; break; + default : return FALSE; + } + return TRUE; + } + + BOOL ComParams::SetStopBits(const char *pStopBits) + { + switch (*pStopBits) { + case '1': + if ((pStopBits[1] == '.' || pStopBits[1] == ',') && pStopBits[2] == '5') + stopBits = ONE5STOPBITS; + else + stopBits = ONESTOPBIT; + break; + case '2': stopBits = TWOSTOPBITS; break; + case 'd': stopBits = -1; break; + default : return FALSE; + } + return TRUE; + } + + const char *ComParams::ParityStr(int parity) + { + switch (parity) { + case NOPARITY: return "no"; + case ODDPARITY: return "odd"; + case EVENPARITY: return "even"; + case MARKPARITY: return "mark"; + case SPACEPARITY: return "space"; + case -1: return "default"; + } + return "?"; + } + + const char *ComParams::StopBitsStr(int stopBits) + { + switch (stopBits) { + case ONESTOPBIT: return "1"; + case ONE5STOPBITS: return "1.5"; + case TWOSTOPBITS: return "2"; + case -1: return "default"; + } + return "?"; + } + + const char *ComParams::BaudRateLst() + { + return "positive number or d[efault]"; + } + + const char *ComParams::ByteSizeLst() + { + return "positive number or d[efault]"; + } + + const char *ComParams::ParityLst() + { + return "n[o], o[dd], e[ven], m[ark], s[pace] or d[efault]"; + } + + const char *ComParams::StopBitsLst() + { + return "1, 1.5, 2 or d[efault]"; + } + /////////////////////////////////////////////////////////////// Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com2tcp/utils.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** utils.h 3 Oct 2005 13:44:17 -0000 1.4 --- utils.h 16 Nov 2006 12:51:43 -0000 1.5 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2006/11/16 12:51:43 vfrolov + * Added ability to set COM port parameters + * * Revision 1.4 2005/10/03 13:44:17 vfrolov * Added Clean() method *************** *** 32,36 **** * Initial revision * - * */ --- 35,38 ---- *************** *** 120,123 **** --- 122,158 ---- }; /////////////////////////////////////////////////////////////// + class ComParams + { + public: + ComParams(); + + void SetBaudRate(const char *pBaudRate) { baudRate = atol(pBaudRate); } + void SetByteSize(const char *pByteSize) { byteSize = atoi(pByteSize); } + BOOL SetParity(const char *pParity); + BOOL SetStopBits(const char *pStopBits); + void SetIgnoreDSR(BOOL val) { ignoreDSR = val; } + + static const char *ParityStr(int parity); + static const char *StopBitsStr(int stopBits); + + static const char *BaudRateLst(); + static const char *ByteSizeLst(); + static const char *ParityLst(); + static const char *StopBitsLst(); + + long BaudRate() const { return baudRate; } + int ByteSize() const { return byteSize; } + int Parity() const { return parity; } + int StopBits() const { return stopBits; } + BOOL IgnoreDSR() const { return ignoreDSR; } + + private: + long baudRate; + int byteSize; + int parity; + int stopBits; + BOOL ignoreDSR; + }; + /////////////////////////////////////////////////////////////// #endif // _UTILS_H |
From: Vyacheslav F. <vf...@us...> - 2006-11-13 10:51:08
|
Update of /cvsroot/com0com/com2tcp In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv26565 Modified Files: telnet.cpp Log Message: Fixed type casting Index: telnet.cpp =================================================================== RCS file: /cvsroot/com0com/com2tcp/telnet.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** telnet.cpp 3 Oct 2005 13:44:17 -0000 1.3 --- telnet.cpp 13 Nov 2006 10:37:14 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2006/11/13 10:37:14 vfrolov + * Fixed type casting + * * Revision 1.3 2005/10/03 13:44:17 vfrolov * Added Clean() method *************** *** 29,33 **** * Initial revision * - * */ --- 32,35 ---- *************** *** 267,272 **** printf(" "); for (BYTE_vector::const_iterator i = params.begin() ; i != params.end() ; i++) { ! printf("%u ", (unsigned)*i); ! SendRaw(i, 1); } printf("SE\n"); --- 269,276 ---- printf(" "); for (BYTE_vector::const_iterator i = params.begin() ; i != params.end() ; i++) { ! BYTE b = *i; ! ! printf("%u ", (unsigned)b); ! SendRaw(&b, sizeof(b)); } printf("SE\n"); |
From: Vyacheslav F. <vf...@us...> - 2006-11-10 14:07:48
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2957 Modified Files: devutils.cpp devutils.h setup.cpp Log Message: Implemented remove command Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** devutils.h 2 Nov 2006 16:20:44 -0000 1.2 --- devutils.h 10 Nov 2006 14:07:40 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2006/11/10 14:07:40 vfrolov + * Implemented remove command + * * Revision 1.2 2006/11/02 16:20:44 vfrolov * Added usage the fixed port numbers *************** *** 26,30 **** * Initial revision * - * */ --- 29,32 ---- *************** *** 32,35 **** --- 34,49 ---- #define _C0C_DEVUTILS_H_ + /////////////////////////////////////////////////////////////// + + struct DevProperties { + DevProperties() : pDevId(), pPhObjName(), pLocation() {} + + const char *pDevId; + const char *pPhObjName; + const char *pLocation; + }; + + typedef const DevProperties *PCDevProperties; + class InfFile; *************** *** 37,64 **** HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, BOOL *pRebootRequired, void *pParam); int EnumDevices( InfFile &infFile, ! const char *pDevId, BOOL *pRebootRequired, PDEVCALLBACK pDevCallBack, void *pCallBackParam); BOOL DisableDevices( InfFile &infFile, ! const char *pDevId, BOOL *pRebootRequired); BOOL RestartDevices( InfFile &infFile, ! const char *pDevId, ! const char *pPhDevName, BOOL *pRebootRequired); BOOL RemoveDevices( InfFile &infFile, ! const char *pDevId, BOOL *pRebootRequired); --- 51,92 ---- HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, + PCDevProperties pDevProperties, BOOL *pRebootRequired, void *pParam); + /////////////////////////////////////////////////////////////// + int EnumDevices( InfFile &infFile, ! PCDevProperties pDevProperties, BOOL *pRebootRequired, PDEVCALLBACK pDevCallBack, void *pCallBackParam); + int DisableDevice( + HDEVINFO hDevInfo, + PSP_DEVINFO_DATA pDevInfoData, + PCDevProperties pDevProperties, + BOOL *pRebootRequired); + BOOL DisableDevices( InfFile &infFile, ! PCDevProperties pDevProperties, BOOL *pRebootRequired); BOOL RestartDevices( InfFile &infFile, ! PCDevProperties pDevProperties, ! BOOL *pRebootRequired); ! ! BOOL RemoveDevice( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! PCDevProperties pDevProperties, BOOL *pRebootRequired); BOOL RemoveDevices( InfFile &infFile, ! PCDevProperties pDevProperties, BOOL *pRebootRequired); *************** *** 69,71 **** --- 97,101 ---- void *pCallBackParam); + /////////////////////////////////////////////////////////////// + #endif /* _C0C_DEVUTILS_H_ */ Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** setup.cpp 3 Nov 2006 16:13:29 -0000 1.9 --- setup.cpp 10 Nov 2006 14:07:40 -0000 1.10 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2006/11/10 14:07:40 vfrolov + * Implemented remove command + * * Revision 1.9 2006/11/03 16:13:29 vfrolov * Added port name length checkings *************** *** 151,154 **** --- 154,158 ---- HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, + PCDevProperties /*pDevProperties*/, BOOL *pRebootRequired, void *pParam) *************** *** 196,200 **** Trace("change %s %s\n", phPortName, buf); ! RestartDevices(infFile, C0C_PORT_DEVICE_ID, phDevName, pRebootRequired); } else { ShowError(MB_OK|MB_ICONWARNING, err, "portParameters.Save(%s)", phPortName); --- 200,208 ---- Trace("change %s %s\n", phPortName, buf); ! DevProperties devProperties; ! devProperties.pDevId = C0C_PORT_DEVICE_ID; ! devProperties.pPhObjName = phDevName; ! ! RestartDevices(infFile, &devProperties, pRebootRequired); } else { ShowError(MB_OK|MB_ICONWARNING, err, "portParameters.Save(%s)", phPortName); *************** *** 216,220 **** ChangeDeviceParams params(infFile, pPhPortName, pParameters); ! EnumDevices(infFile, C0C_BUS_DEVICE_ID, &rebootRequired, ChangeDevice, ¶ms); if (rebootRequired) --- 224,231 ---- ChangeDeviceParams params(infFile, pPhPortName, pParameters); ! DevProperties devProperties; ! devProperties.pDevId = C0C_BUS_DEVICE_ID; ! ! EnumDevices(infFile, &devProperties, &rebootRequired, ChangeDevice, ¶ms); if (rebootRequired) *************** *** 224,227 **** --- 235,309 ---- } /////////////////////////////////////////////////////////////// + struct RemoveDeviceParams { + RemoveDeviceParams(int _num) : num(_num), res(IDCANCEL) {} + + int num; + int res; + }; + + static BOOL RemoveDevice( + HDEVINFO hDevInfo, + PSP_DEVINFO_DATA pDevInfoData, + PCDevProperties pDevProperties, + BOOL *pRebootRequired, + void *pParam) + { + int i = GetPortNum(hDevInfo, pDevInfoData); + + if (i == ((RemoveDeviceParams *)pParam)->num) { + ((RemoveDeviceParams *)pParam)->res = + DisableDevice(hDevInfo, pDevInfoData, pDevProperties, pRebootRequired); + + if (((RemoveDeviceParams *)pParam)->res != IDCONTINUE) + return FALSE; + + return RemoveDevice(hDevInfo, pDevInfoData, pDevProperties, pRebootRequired); + } + + return TRUE; + } + + int Remove(InfFile &infFile, int num) + { + int res; + BOOL rebootRequired = FALSE; + + do { + RemoveDeviceParams removeDeviceParams(num); + + DevProperties devProperties; + devProperties.pDevId = C0C_BUS_DEVICE_ID; + + EnumDevices(infFile, &devProperties, &rebootRequired, RemoveDevice, &removeDeviceParams); + + res = removeDeviceParams.res; + + } while (res == IDTRYAGAIN); + + if (res == IDCONTINUE) { + for (int j = 0 ; j < 2 ; j++) { + char phPortName[20]; + + SNPRINTF(phPortName, sizeof(phPortName)/sizeof(phPortName[0]), "%s%d", + j ? C0C_PREF_PORT_NAME_B : C0C_PREF_PORT_NAME_A, num); + + DevProperties devProperties; + + devProperties.pDevId = C0C_PORT_DEVICE_ID; + devProperties.pLocation = phPortName; + + RemoveDevices(infFile, &devProperties, NULL); + } + } + + if (rebootRequired) + SetupPromptReboot(NULL, NULL, FALSE); + + if (res != IDCONTINUE) + return 1; + + return 0; + } + /////////////////////////////////////////////////////////////// int Preinstall(InfFile &infFile) { *************** *** 258,262 **** HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, ! BOOL * /* pRebootRequired */, void *pParam) { --- 340,345 ---- HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, ! PCDevProperties /*pDevProperties*/, ! BOOL * /*pRebootRequired*/, void *pParam) { *************** *** 287,291 **** HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, ! BOOL * /* pRebootRequired */, void *pParam) { --- 370,375 ---- HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, ! PCDevProperties /*pDevProperties*/, ! BOOL * /*pRebootRequired*/, void *pParam) { *************** *** 306,310 **** BusyMask busyMask; ! if (EnumDevices(infFile, C0C_BUS_DEVICE_ID, NULL, AddDeviceToBusyMask, &busyMask) < 0) return -1; --- 390,397 ---- BusyMask busyMask; ! DevProperties devProperties; ! devProperties.pDevId = C0C_BUS_DEVICE_ID; ! ! if (EnumDevices(infFile, &devProperties, NULL, AddDeviceToBusyMask, &busyMask) < 0) return -1; *************** *** 396,404 **** { BOOL rebootRequired = FALSE; ! if (!DisableDevices(infFile, C0C_PORT_DEVICE_ID, &rebootRequired)) return 1; ! if (!RemoveDevices(infFile, C0C_BUS_DEVICE_ID, &rebootRequired)) return 1; --- 483,498 ---- { BOOL rebootRequired = FALSE; + DevProperties devProperties; ! 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)) return 1; *************** *** 610,613 **** --- 704,710 ---- " install <prmsA> <prmsB> (by default <n> is the first not used number),\n" " set their parameters to <prmsA> and <prmsB>\n" + " remove <n> - remove a pair of linked ports with\n" + " identifiers " C0C_PREF_PORT_NAME_A "<n> and " + C0C_PREF_PORT_NAME_B "<n>\n" " change <portid> <prms> - set parameters <prms> for port with\n" " identifier <portid>\n" *************** *** 635,638 **** --- 732,738 ---- , pCmdPref); Trace( + " %sremove 0\n" + , pCmdPref); + Trace( " %sinstall PortName=COM2 PortName=COM4\n" , pCmdPref); *************** *** 699,702 **** --- 799,811 ---- } else + if (argc == 3 && !lstrcmpi(argv[1], "remove")) { + SetTitle(C0C_SETUP_TITLE " (REMOVE)"); + + int num; + + if (StrToInt(argv[2], &num) && num >= 0) + return Remove(infFile, num); + } + else if (argc == 2 && !lstrcmpi(argv[1], "preinstall")) { SetTitle(C0C_SETUP_TITLE " (PREINSTALL)"); Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** devutils.cpp 2 Nov 2006 16:20:44 -0000 1.3 --- devutils.cpp 10 Nov 2006 14:07:40 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2006/11/10 14:07:40 vfrolov + * Implemented remove command + * * Revision 1.3 2006/11/02 16:20:44 vfrolov * Added usage the fixed port numbers *************** *** 41,58 **** struct EnumParams { EnumParams() { - pDevId = NULL; - pPhObjName = NULL; pParam1 = NULL; pParam2 = NULL; - count = 0; pRebootRequired = NULL; } ! const char *pDevId; ! const char *pPhObjName; void *pParam1; void *pParam2; - int count; BOOL *pRebootRequired; --- 44,56 ---- struct EnumParams { EnumParams() { pParam1 = NULL; pParam2 = NULL; count = 0; pRebootRequired = NULL; } ! DevProperties devProperties; void *pParam1; void *pParam2; int count; BOOL *pRebootRequired; *************** *** 64,76 **** DevParams(PEnumParams _pEnumParams) { pEnumParams = _pEnumParams; - - pDevId = NULL; - pPhObjName = NULL; } PEnumParams pEnumParams; ! ! const char *pDevId; ! const char *pPhObjName; }; --- 62,69 ---- DevParams(PEnumParams _pEnumParams) { pEnumParams = _pEnumParams; } PEnumParams pEnumParams; ! DevProperties devProperties; }; *************** *** 117,135 **** DevParams devParams(pEnumParams); ! char hwid[150]; if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, NULL, (PBYTE)hwid, sizeof(hwid), NULL)) ! devParams.pDevId = hwid; ! if (pEnumParams->pDevId && (!devParams.pDevId || lstrcmpi(devParams.pDevId, pEnumParams->pDevId))) continue; ! char name[150]; if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_PHYSICAL_DEVICE_OBJECT_NAME, NULL, (PBYTE)name, sizeof(name), NULL)) ! devParams.pPhObjName = name; ! if (pEnumParams->pPhObjName && (!devParams.pPhObjName || lstrcmpi(devParams.pPhObjName, pEnumParams->pPhObjName))) continue; res = pFunk(hDevInfo, &devInfoData, &devParams); --- 110,145 ---- DevParams devParams(pEnumParams); ! 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; + } ! 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; ! } ! ! 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; + } res = pFunk(hDevInfo, &devInfoData, &devParams); *************** *** 197,201 **** static int EnumDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { ! //Trace("Enumerated %s %s\n", pDevParams->pDevId, pDevParams->pPhObjName); int res = IDCONTINUE; --- 207,216 ---- 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); ! */ int res = IDCONTINUE; *************** *** 204,207 **** --- 219,223 ---- if (!PDEVCALLBACK(pDevParams->pEnumParams->pParam1)(hDevInfo, pDevInfoData, + &pDevParams->devProperties, pDevParams->pEnumParams->pRebootRequired, pDevParams->pEnumParams->pParam2)) *************** *** 218,222 **** int EnumDevices( InfFile &infFile, ! const char *pDevId, BOOL *pRebootRequired, PDEVCALLBACK pDevCallBack, --- 234,238 ---- int EnumDevices( InfFile &infFile, ! PCDevProperties pDevProperties, BOOL *pRebootRequired, PDEVCALLBACK pDevCallBack, *************** *** 225,229 **** EnumParams enumParams; ! enumParams.pDevId = pDevId; enumParams.pRebootRequired = pRebootRequired; enumParams.pParam1 = pDevCallBack; --- 241,247 ---- EnumParams enumParams; ! if (pDevProperties) ! enumParams.devProperties = *pDevProperties; ! enumParams.pRebootRequired = pRebootRequired; enumParams.pParam1 = pDevCallBack; *************** *** 236,248 **** } /////////////////////////////////////////////////////////////// ! static int DisableDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { if (!ChangeState(hDevInfo, pDevInfoData, DICS_DISABLE)) return IDCANCEL; ! Trace("Disabled %s %s\n", pDevParams->pDevId, pDevParams->pPhObjName); ! pDevParams->pEnumParams->count++; ! if (pDevParams->pEnumParams->pRebootRequired && !*pDevParams->pEnumParams->pRebootRequired) { BOOL rebootRequired = FALSE; --- 254,272 ---- } /////////////////////////////////////////////////////////////// ! int DisableDevice( ! HDEVINFO hDevInfo, ! 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) { BOOL rebootRequired = FALSE; *************** *** 252,259 **** if (rebootRequired) { int res = ShowMsg(MB_CANCELTRYCONTINUE, ! "Can't disable device %s %s.\n" "Close application that use this device and Try Again.\n" "Or Continue and then reboot system.\n", ! pDevParams->pDevId, pDevParams->pPhObjName); if (res != IDCONTINUE) { --- 276,285 ---- if (rebootRequired) { int res = ShowMsg(MB_CANCELTRYCONTINUE, ! "Can't disable device %s %s %s.\n" "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) { *************** *** 261,271 **** return IDCANCEL; ! Trace("Enabled %s %s\n", pDevParams->pDevId, pDevParams->pPhObjName); ! pDevParams->pEnumParams->count--; return res; } ! *pDevParams->pEnumParams->pRebootRequired = TRUE; } } --- 287,299 ---- return IDCANCEL; ! Trace("Enabled %s %s %s\n", ! pDevProperties->pLocation, ! pDevProperties->pDevId, ! pDevProperties->pPhObjName); return res; } ! *pRebootRequired = TRUE; } } *************** *** 273,280 **** return IDCONTINUE; } BOOL DisableDevices( InfFile &infFile, ! const char *pDevId, BOOL *pRebootRequired) { --- 301,318 ---- return IDCONTINUE; } + /////////////////////////////////////////////////////////////// + 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++; + + return res; + } BOOL DisableDevices( InfFile &infFile, ! PCDevProperties pDevProperties, BOOL *pRebootRequired) { *************** *** 284,288 **** enumParams.pRebootRequired = pRebootRequired; ! enumParams.pDevId = pDevId; do { --- 322,327 ---- enumParams.pRebootRequired = pRebootRequired; ! if (pDevProperties) ! enumParams.devProperties = *pDevProperties; do { *************** *** 311,318 **** if (rebootRequired) { int res = ShowMsg(MB_CANCELTRYCONTINUE, ! "Can't reastart device %s %s.\n" "Close application that use this device and Try Again.\n" "Or Continue and then reboot system.\n", ! pDevParams->pDevId, pDevParams->pPhObjName); if (res != IDCONTINUE) { --- 350,359 ---- if (rebootRequired) { int res = ShowMsg(MB_CANCELTRYCONTINUE, ! "Can't reastart device %s %s %s.\n" "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) { *************** *** 328,332 **** if (!pDevParams->pEnumParams->pRebootRequired || !*pDevParams->pEnumParams->pRebootRequired) { ! Trace("Restarted %s %s\n", pDevParams->pDevId, pDevParams->pPhObjName); pDevParams->pEnumParams->count++; } --- 369,377 ---- 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++; } *************** *** 337,342 **** BOOL RestartDevices( InfFile &infFile, ! const char *pDevId, ! const char *pPhDevName, BOOL *pRebootRequired) { --- 382,386 ---- BOOL RestartDevices( InfFile &infFile, ! PCDevProperties pDevProperties, BOOL *pRebootRequired) { *************** *** 346,351 **** enumParams.pRebootRequired = pRebootRequired; ! enumParams.pDevId = pDevId; ! enumParams.pPhObjName = pPhDevName; do { --- 390,395 ---- enumParams.pRebootRequired = pRebootRequired; ! if (pDevProperties) ! enumParams.devProperties = *pDevProperties; do { *************** *** 359,375 **** } /////////////////////////////////////////////////////////////// ! static int RemoveDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { if (!SetupDiCallClassInstaller(DIF_REMOVE, hDevInfo, pDevInfoData)) { ! ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCallClassInstaller(DIF_REMOVE, %s, %s)", pDevParams->pDevId, pDevParams->pPhObjName); ! return IDCANCEL; } ! Trace("Removed %s %s\n", pDevParams->pDevId, pDevParams->pPhObjName); ! pDevParams->pEnumParams->count++; ! if (!UpdateRebootRequired(hDevInfo, pDevInfoData, pDevParams->pEnumParams->pRebootRequired)) return IDCANCEL; return IDCONTINUE; } --- 403,430 ---- } /////////////////////////////////////////////////////////////// ! BOOL RemoveDevice( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! PCDevProperties pDevProperties, ! BOOL *pRebootRequired) { 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); ! } ! /////////////////////////////////////////////////////////////// ! static int RemoveDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) ! { ! if (!RemoveDevice(hDevInfo, pDevInfoData, &pDevParams->devProperties, pDevParams->pEnumParams->pRebootRequired)) return IDCANCEL; + pDevParams->pEnumParams->count++; + return IDCONTINUE; } *************** *** 377,381 **** BOOL RemoveDevices( InfFile &infFile, ! const char *pDevId, BOOL *pRebootRequired) { --- 432,436 ---- BOOL RemoveDevices( InfFile &infFile, ! PCDevProperties pDevProperties, BOOL *pRebootRequired) { *************** *** 385,389 **** enumParams.pRebootRequired = pRebootRequired; ! enumParams.pDevId = pDevId; do { --- 440,445 ---- enumParams.pRebootRequired = pRebootRequired; ! if (pDevProperties) ! enumParams.devProperties = *pDevProperties; do { *************** *** 461,465 **** if (pDevCallBack) { ! res = pDevCallBack(hDevInfo, &devInfoData, NULL, pCallBackParam); if (!res) --- 517,525 ---- if (pDevCallBack) { ! DevProperties devProperties; ! ! devProperties.pDevId = pDevId; ! ! res = pDevCallBack(hDevInfo, &devInfoData, &devProperties, NULL, pCallBackParam); if (!res) |
From: Vyacheslav F. <vf...@us...> - 2006-11-03 16:13:36
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15975 Modified Files: setup.cpp Log Message: Added port name length checkings Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** setup.cpp 3 Nov 2006 13:22:07 -0000 1.8 --- setup.cpp 3 Nov 2006 16:13:29 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2006/11/03 16:13:29 vfrolov + * Added port name length checkings + * * Revision 1.8 2006/11/03 13:22:07 vfrolov * Added checking of BusyMask::AddNum() return value *************** *** 73,76 **** --- 76,99 ---- /////////////////////////////////////////////////////////////// + static BOOL IsValidPortNum(int num) + { + if (num < 0) + return FALSE; + + char buf[C0C_PORT_NAME_LEN + 1]; + + if (SNPRINTF(buf, sizeof(buf)/sizeof(buf[0]), C0C_PREF_BUS_NAME "%d", num) < 0 || + SNPRINTF(buf, sizeof(buf)/sizeof(buf[0]), C0C_PREF_PORT_NAME_A "%d", num) < 0 || + SNPRINTF(buf, sizeof(buf)/sizeof(buf[0]), C0C_PREF_PORT_NAME_B "%d", num) < 0) + { + int res = ShowMsg(MB_OKCANCEL|MB_ICONWARNING, "The port number %d is too big.\n", num); + + if (res == IDCANCEL) + return FALSE; + } + + return TRUE; + } + /////////////////////////////////////////////////////////////// static BOOL IsValidPortName( const char *pPortName, *************** *** 79,82 **** --- 102,115 ---- int res; + if (lstrlen(pPortName) > C0C_PORT_NAME_LEN) { + res = ShowMsg(MB_OKCANCEL|MB_ICONWARNING, + "The length of port name %s\n" + "is too big (greater then %d).\n", + pPortName, C0C_PORT_NAME_LEN); + + if (res == IDCANCEL) + return FALSE; + } + do { res = IDCONTINUE; *************** *** 95,99 **** res = ShowMsg(MB_CANCELTRYCONTINUE, ! "Port name %s is already used for other device %s.", pPortName, phDevName); --- 128,132 ---- res = ShowMsg(MB_CANCELTRYCONTINUE, ! "The port name %s is already used for other device %s.", pPortName, phDevName); *************** *** 305,308 **** --- 338,344 ---- goto err; + if (!IsValidPortNum(i)) + goto err; + for (int j = 0 ; j < 2 ; j++) { char phPortName[20]; |