com0com-cvs Mailing List for Null-modem emulator (Page 2)
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...> - 2011-12-23 05:37:24
|
Update of /cvsroot/com0com/com0com/setup In directory vz-cvs-4.sog:/tmp/cvs-serv15551 Modified Files: setup.cpp Log Message: Implemented setting friendly names for ports Added options -no-update-fnames and --show-fnames Added commands updatefnames and listfnames Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** setup.cpp 21 Dec 2011 13:24:12 -0000 1.49 --- setup.cpp 23 Dec 2011 05:37:21 -0000 1.50 *************** *** 20,23 **** --- 20,28 ---- * * $Log$ + * Revision 1.50 2011/12/23 05:37:21 vfrolov + * Implemented setting friendly names for ports + * Added options -no-update-fnames and --show-fnames + * Added commands updatefnames and listfnames + * * Revision 1.49 2011/12/21 13:24:12 vfrolov * Added using DeviceDesc to set FriendlyName *************** *** 278,281 **** --- 283,288 ---- static bool detailPrms = FALSE; static bool no_update = FALSE; + static bool no_update_fnames = FALSE; + static bool show_fnames = FALSE; /////////////////////////////////////////////////////////////// static CNC_ENUM_FILTER EnumFilter; *************** *** 375,379 **** } /////////////////////////////////////////////////////////////// ! static VOID SetFriendlyNameBus( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 382,386 ---- } /////////////////////////////////////////////////////////////// ! static VOID UpdateFriendlyNameBus( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 396,420 **** } ! char friendlyName[120]; ! char deviceDesc[80]; ! if (!SetupDiGetDeviceRegistryProperty(hDevInfo, ! pDevInfoData, ! SPDRP_DEVICEDESC, ! NULL, ! (LPBYTE)deviceDesc, ! sizeof(deviceDesc), ! NULL)) { ! SNPRINTF(deviceDesc, sizeof(deviceDesc)/sizeof(deviceDesc[0]), ! "com0com - bus for serial port pair emulator"); } ! SNPRINTF(friendlyName, sizeof(friendlyName)/sizeof(friendlyName[0]), ! "%s %d (%s <-> %s)", ! deviceDesc, num, portName[0], portName[1]); ! SetupDiSetDeviceRegistryProperty(hDevInfo, pDevInfoData, SPDRP_FRIENDLYNAME, ! (LPBYTE)friendlyName, (lstrlen(friendlyName) + 1) * sizeof(*friendlyName)); } /////////////////////////////////////////////////////////////// --- 403,582 ---- } ! char friendlyNameOld[120]; ! if (!SetupDiGetDeviceRegistryProperty(hDevInfo, pDevInfoData, SPDRP_FRIENDLYNAME, NULL, ! (LPBYTE)friendlyNameOld, sizeof(friendlyNameOld), NULL)) { ! SNPRINTF(friendlyNameOld, sizeof(friendlyNameOld)/sizeof(friendlyNameOld[0]), ""); } ! if (show_fnames) ! Trace(" " C0C_PREF_BUS_NAME "%d FriendlyName=\"%s\"\n", num, friendlyNameOld); ! if (!no_update_fnames) { ! char deviceDesc[80]; ! ! if (!SetupDiGetDeviceRegistryProperty(hDevInfo, pDevInfoData, SPDRP_DEVICEDESC, NULL, ! (LPBYTE)deviceDesc, sizeof(deviceDesc), NULL)) ! { ! SNPRINTF(deviceDesc, sizeof(deviceDesc)/sizeof(deviceDesc[0]), ! "com0com - bus for serial port pair emulator"); ! } ! ! char friendlyName[120]; ! ! SNPRINTF(friendlyName, sizeof(friendlyName)/sizeof(friendlyName[0]), ! "%s %d (%s <-> %s)", ! deviceDesc, num, portName[0], portName[1]); ! ! if (lstrcmp(friendlyName, friendlyNameOld) != 0) { ! if (SetupDiSetDeviceRegistryProperty(hDevInfo, pDevInfoData, SPDRP_FRIENDLYNAME, ! (LPBYTE)friendlyName, (lstrlen(friendlyName) + 1) * sizeof(*friendlyName))) ! { ! if (show_fnames) ! Trace("update " C0C_PREF_BUS_NAME "%d FriendlyName=\"%s\"\n", num, friendlyName); ! } ! } ! } ! } ! /////////////////////////////////////////////////////////////// ! static VOID SetFriendlyNamePort( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! const char *pPhObjName) ! { ! //Trace("SetFriendlyNamePort pPhObjName=%s\n", pPhObjName); ! ! char phPortName[20]; ! ! for (int j = 0 ;; j++) { ! if (j > 1) ! return; ! ! const char *pPref = (j ? C0C_PREF_DEVICE_NAME_B : C0C_PREF_DEVICE_NAME_A); ! int lenPref = lstrlen(pPref); ! ! if (lenPref >= lstrlen(pPhObjName)) ! continue; ! ! if (memcmp(pPhObjName, pPref, lenPref*sizeof(pPref[0])) != 0) ! continue; ! ! int num; ! ! if (!StrToInt(pPhObjName + lenPref, &num) || num < 0) ! continue; ! ! SNPRINTF(phPortName, sizeof(phPortName)/sizeof(phPortName[0]), "%s%d", ! j ? C0C_PREF_PORT_NAME_B : C0C_PREF_PORT_NAME_A, num); ! ! break; ! } ! ! //Trace("SetFriendlyNamePort phPortName=%s\n", phPortName); ! ! char portName[20]; ! PortParameters portParameters(C0C_SERVICE, phPortName); ! ! if (portParameters.Load() == ERROR_SUCCESS) ! portParameters.FillPortName(portName, sizeof(portName)/sizeof(portName[0])); ! else ! SNPRINTF(portName, sizeof(portName)/sizeof(portName[0]), "%s", phPortName); ! ! //Trace("SetFriendlyNamePort portName=%s\n", portName); ! ! char friendlyNameOld[120]; ! ! if (!SetupDiGetDeviceRegistryProperty(hDevInfo, pDevInfoData, SPDRP_FRIENDLYNAME, NULL, ! (LPBYTE)friendlyNameOld, sizeof(friendlyNameOld), NULL)) ! { ! SNPRINTF(friendlyNameOld, sizeof(friendlyNameOld)/sizeof(friendlyNameOld[0]), ""); ! } ! ! if (show_fnames) ! Trace(" %s FriendlyName=\"%s\"\n", phPortName, friendlyNameOld); ! ! if (lstrcmpi(C0C_PORT_NAME_COMCLASS, portName) == 0) ! return; ! ! if (!no_update_fnames) { ! char deviceDesc[80]; ! ! if (!SetupDiGetDeviceRegistryProperty(hDevInfo, pDevInfoData, SPDRP_DEVICEDESC, NULL, ! (LPBYTE)deviceDesc, sizeof(deviceDesc), NULL)) ! { ! SNPRINTF(deviceDesc, sizeof(deviceDesc)/sizeof(deviceDesc[0]), ! "com0com - serial port emulator"); ! } ! ! char friendlyName[120]; ! ! SNPRINTF(friendlyName, sizeof(friendlyName)/sizeof(friendlyName[0]), "%s %s (%s)", deviceDesc, phPortName, portName); ! ! //Trace("SetFriendlyNamePort friendlyName=%s\n", friendlyName); ! ! if (lstrcmp(friendlyName, friendlyNameOld) != 0) { ! if (SetupDiSetDeviceRegistryProperty(hDevInfo, pDevInfoData, SPDRP_FRIENDLYNAME, ! (LPBYTE)friendlyName, (lstrlen(friendlyName) + 1) * sizeof(*friendlyName))) ! { ! if (show_fnames) ! Trace("update %s FriendlyName=\"%s\"\n", phPortName, friendlyName); ! } ! } ! } ! } ! /////////////////////////////////////////////////////////////// ! static CNC_DEV_CALLBACK UpdateFriendlyNamePort; ! static bool UpdateFriendlyNamePort( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! PCDevProperties pDevProperties, ! BOOL * /*pRebootRequired*/, ! void * /*pParam*/) ! { ! if (!lstrcmp(pDevProperties->DevId(), C0C_PORT_DEVICE_ID)) { ! SetFriendlyNamePort(hDevInfo, pDevInfoData, pDevProperties->PhObjName()); ! return TRUE; ! } ! ! // we never should be here ! return FALSE; ! } ! /////////////////////////////////////////////////////////////// ! static CNC_DEV_CALLBACK UpdateFriendlyNamesBus; ! static bool UpdateFriendlyNamesBus( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! PCDevProperties pDevProperties, ! BOOL *pRebootRequired, ! void *pParam) ! { ! if (!lstrcmp(pDevProperties->DevId(), C0C_BUS_DEVICE_ID)) { ! int num = GetPortNum(hDevInfo, pDevInfoData); ! ! if (*(int *)pParam == num || *(int *)pParam == -1) { ! UpdateFriendlyNameBus(hDevInfo, pDevInfoData, num); ! ! for (int j = 0 ; j < 2 ; j++) { ! char phDevName[40]; ! ! SNPRINTF(phDevName, sizeof(phDevName)/sizeof(phDevName[0]), "%s%d", ! j ? C0C_PREF_DEVICE_NAME_B : C0C_PREF_DEVICE_NAME_A, num); ! ! DevProperties devProperties; ! if (!devProperties.DevId(C0C_PORT_DEVICE_ID)) ! return FALSE; ! if (!devProperties.PhObjName(phDevName)) ! return FALSE; ! ! EnumDevices(EnumFilter, &devProperties, pRebootRequired, UpdateFriendlyNamePort, NULL); ! } ! } ! ! return TRUE; ! } ! ! // we never should be here ! return FALSE; } /////////////////////////////////////////////////////////////// *************** *** 590,594 **** Trace("change %s %s\n", phPortName, buf); ! SetFriendlyNameBus(hDevInfo, pDevInfoData, i); DevProperties devProperties; --- 752,757 ---- Trace("change %s %s\n", phPortName, buf); ! if (lstrcmpi(portName, portNameOld) != 0) ! UpdateFriendlyNameBus(hDevInfo, pDevInfoData, i); DevProperties devProperties; *************** *** 604,607 **** --- 767,773 ---- ReenumerateDeviceNode(pDevInfoData); } else { + if (lstrcmpi(portName, portNameOld) != 0) + EnumDevices(EnumFilter, &devProperties, pRebootRequired, UpdateFriendlyNamePort, NULL); + RestartDevices(EnumFilter, &devProperties, pRebootRequired); } *************** *** 819,826 **** if (!ok) { Trace("\nUpdate not completed!\n"); ! } ! else ! if (rebootRequired) { ! PromptReboot(); } --- 985,1000 ---- if (!ok) { Trace("\nUpdate not completed!\n"); ! } else { ! DevProperties devProperties; ! ! if (devProperties.DevId(C0C_BUS_DEVICE_ID)) { ! int num = -1; ! ! EnumDevices(EnumFilter, &devProperties, &rebootRequired, UpdateFriendlyNamesBus, &num); ! } ! ! if (rebootRequired) { ! PromptReboot(); ! } } *************** *** 881,887 **** --- 1055,1099 ---- ComDbSync(EnumFilter); + DevProperties devProperties; + + if (devProperties.DevId(C0C_BUS_DEVICE_ID)) { + int num = -1; + + EnumDevices(EnumFilter, &devProperties, &rebootRequired, UpdateFriendlyNamesBus, &num); + } + + if (rebootRequired) + PromptReboot(); + + return TRUE; + } + /////////////////////////////////////////////////////////////// + static bool UpdateFriendlyNames(bool update) + { + bool no_update_fnames_save = no_update_fnames; + + if (!update) + no_update_fnames = TRUE; + + bool show_fnames_save = show_fnames; + + show_fnames = TRUE; + + BOOL rebootRequired = FALSE; + + DevProperties devProperties; + + if (devProperties.DevId(C0C_BUS_DEVICE_ID)) { + int num = -1; + + EnumDevices(EnumFilter, &devProperties, &rebootRequired, UpdateFriendlyNamesBus, &num); + } + if (rebootRequired) PromptReboot(); + show_fnames = show_fnames_save; + no_update_fnames = no_update_fnames_save; + return TRUE; } *************** *** 918,942 **** } - static CNC_DEV_CALLBACK SetFriendlyNameBus; - static bool SetFriendlyNameBus( - HDEVINFO hDevInfo, - PSP_DEVINFO_DATA pDevInfoData, - PCDevProperties pDevProperties, - BOOL * /*pRebootRequired*/, - void *pParam) - { - if (!lstrcmp(pDevProperties->DevId(), C0C_BUS_DEVICE_ID)) { - int num = GetPortNum(hDevInfo, pDevInfoData); - - if (num == *(int *)pParam) - SetFriendlyNameBus(hDevInfo, pDevInfoData, num); - - return TRUE; - } - - // we never should be here - return FALSE; - } - static bool InstallBusDevice(const char *pInfFilePath, int num) { --- 1130,1133 ---- *************** *** 949,953 **** if (devProperties.DevId(C0C_BUS_DEVICE_ID)) ! EnumDevices(EnumFilter, &devProperties, &rebootRequired, SetFriendlyNameBus, &num); if (rebootRequired) --- 1140,1144 ---- if (devProperties.DevId(C0C_BUS_DEVICE_ID)) ! EnumDevices(EnumFilter, &devProperties, &rebootRequired, UpdateFriendlyNamesBus, &num); if (rebootRequired) *************** *** 1587,1590 **** --- 1778,1783 ---- " execution (the other install command w/o this\n" " option expected later)\n" + " --no-update-fnames - do not update friendly names\n" + " --show-fnames - show friendly names activity\n" ); ConsoleWrite( *************** *** 1616,1619 **** --- 1809,1817 ---- " busynames <pattern> - show names that already in use and match the\n" " <pattern> (wildcards: '*' and '?')\n" + " updatefnames - update friendly names\n" + " listfnames - for each bus and port show its identifier and\n" + " friendly name\n" + ); + ConsoleWrite( " quit - quit\n" " help - print this help\n" *************** *** 1689,1692 **** --- 1887,1892 ---- detailPrms = FALSE; no_update = FALSE; + no_update_fnames = FALSE; + show_fnames = FALSE; while (argc > 1) { *************** *** 1733,1736 **** --- 1933,1950 ---- argc--; } + else + if (!strcmp(argv[1], "--no-update-fnames")) { + no_update_fnames = TRUE; + argv[1] = argv[0]; + argv++; + argc--; + } + else + if (!strcmp(argv[1], "--show-fnames")) { + show_fnames = TRUE; + argv[1] = argv[0]; + argv++; + argc--; + } else { ConsoleWrite("Invalid option %s\n", argv[1]); *************** *** 1762,1765 **** --- 1976,1989 ---- } else + if (argc == 2 && !lstrcmpi(argv[1], "updatefnames")) { + SetTitle(C0C_SETUP_TITLE " (UPDATE FRIENDLY NAMES)"); + return Complete(UpdateFriendlyNames(TRUE)); + } + else + if (argc == 2 && !lstrcmpi(argv[1], "listfnames")) { + SetTitle(C0C_SETUP_TITLE " (LIST FRIENDLY NAMES)"); + return Complete(UpdateFriendlyNames(FALSE)); + } + else if (argc == 4 && !lstrcmpi(argv[1], "change")) { SetTitle(C0C_SETUP_TITLE " (CHANGE)"); |
From: Vyacheslav F. <vf...@us...> - 2011-12-21 13:24:15
|
Update of /cvsroot/com0com/com0com/setup In directory vz-cvs-4.sog:/tmp/cvs-serv31905 Modified Files: setup.cpp Log Message: Added using DeviceDesc to set FriendlyName Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** setup.cpp 15 Dec 2011 16:43:20 -0000 1.48 --- setup.cpp 21 Dec 2011 13:24:12 -0000 1.49 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.49 2011/12/21 13:24:12 vfrolov + * Added using DeviceDesc to set FriendlyName + * * Revision 1.48 2011/12/15 16:43:20 vfrolov * Added parameters parsing result check *************** *** 372,376 **** } /////////////////////////////////////////////////////////////// ! static VOID SetFriendlyName( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 375,379 ---- } /////////////////////////////////////////////////////////////// ! static VOID SetFriendlyNameBus( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 393,401 **** } ! char friendlyName[80]; SNPRINTF(friendlyName, sizeof(friendlyName)/sizeof(friendlyName[0]), ! "com0com - bus for serial port pair emulator %d (%s <-> %s)", ! num, portName[0], portName[1]); SetupDiSetDeviceRegistryProperty(hDevInfo, pDevInfoData, SPDRP_FRIENDLYNAME, --- 396,417 ---- } ! char friendlyName[120]; ! char deviceDesc[80]; ! ! if (!SetupDiGetDeviceRegistryProperty(hDevInfo, ! pDevInfoData, ! SPDRP_DEVICEDESC, ! NULL, ! (LPBYTE)deviceDesc, ! sizeof(deviceDesc), ! NULL)) ! { ! SNPRINTF(deviceDesc, sizeof(deviceDesc)/sizeof(deviceDesc[0]), ! "com0com - bus for serial port pair emulator"); ! } SNPRINTF(friendlyName, sizeof(friendlyName)/sizeof(friendlyName[0]), ! "%s %d (%s <-> %s)", ! deviceDesc, num, portName[0], portName[1]); SetupDiSetDeviceRegistryProperty(hDevInfo, pDevInfoData, SPDRP_FRIENDLYNAME, *************** *** 574,578 **** Trace("change %s %s\n", phPortName, buf); ! SetFriendlyName(hDevInfo, pDevInfoData, i); DevProperties devProperties; --- 590,594 ---- Trace("change %s %s\n", phPortName, buf); ! SetFriendlyNameBus(hDevInfo, pDevInfoData, i); DevProperties devProperties; *************** *** 896,904 **** return FALSE; ! SetFriendlyName(hDevInfo, pDevInfoData, num); return TRUE; } return FALSE; } --- 912,939 ---- return FALSE; ! return TRUE; ! } ! ! return FALSE; ! } ! ! static CNC_DEV_CALLBACK SetFriendlyNameBus; ! static bool SetFriendlyNameBus( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! PCDevProperties pDevProperties, ! BOOL * /*pRebootRequired*/, ! void *pParam) ! { ! if (!lstrcmp(pDevProperties->DevId(), C0C_BUS_DEVICE_ID)) { ! int num = GetPortNum(hDevInfo, pDevInfoData); ! ! if (num == *(int *)pParam) ! SetFriendlyNameBus(hDevInfo, pDevInfoData, num); return TRUE; } + // we never should be here return FALSE; } *************** *** 911,914 **** --- 946,954 ---- return FALSE; + DevProperties devProperties; + + if (devProperties.DevId(C0C_BUS_DEVICE_ID)) + EnumDevices(EnumFilter, &devProperties, &rebootRequired, SetFriendlyNameBus, &num); + if (rebootRequired) PromptReboot(); |
From: Vyacheslav F. <vf...@us...> - 2011-12-18 16:42:25
|
Update of /cvsroot/com0com/com0com/NSIS In directory vz-cvs-4.sog:/tmp/cvs-serv5264 Modified Files: install.nsi Log Message: Added ability to build installer with both 32-bit and 64-bit drivers Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** install.nsi 12 Dec 2011 13:17:43 -0000 1.24 --- install.nsi 18 Dec 2011 16:42:23 -0000 1.25 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.25 2011/12/18 16:42:23 vfrolov + * Added ability to build installer with both 32-bit and 64-bit drivers + * * Revision 1.24 2011/12/12 13:17:43 vfrolov * Added CNC_INSTALL_SKIP_SETUP_PREINSTALL and CNC_UNINSTALL_SKIP_SETUP_UNINSTALL environment variables *************** *** 118,136 **** ;-------------------------------- ! !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 --- 121,155 ---- ;-------------------------------- ! !ifndef OUTPUT_FILE ! !ifndef ADD_TARGET_CPU_i386 ! !ifndef ADD_TARGET_CPU_amd64 ! !ifndef ADD_TARGET_CPU_ia64 ! !if "$%BUILD_DEFAULT_TARGETS%" == "-386" ! !define OUTPUT_FILE "..\i386\setup.exe" ! !define ADD_TARGET_CPU_i386 ! !else if "$%BUILD_DEFAULT_TARGETS%" == "-AMD64" ! !define OUTPUT_FILE "..\amd64\setup.exe" ! !define ADD_TARGET_CPU_amd64 ! !else if "$%BUILD_DEFAULT_TARGETS%" == "-amd64" ! !define OUTPUT_FILE "..\amd64\setup.exe" ! !define ADD_TARGET_CPU_amd64 ! !else if "$%BUILD_DEFAULT_TARGETS%" == "-IA64" ! !define OUTPUT_FILE "..\ia64\setup.exe" ! !define ADD_TARGET_CPU_ia64 ! !else if "$%BUILD_DEFAULT_TARGETS%" == "-ia64" ! !define OUTPUT_FILE "..\ia64\setup.exe" ! !define ADD_TARGET_CPU_ia64 ! !else ! !define OUTPUT_FILE "..\i386\setup.exe" ! !define ADD_TARGET_CPU_i386 ! !Warning "Using target CPU i386" ! !endif ! !endif ! !endif ! !endif !endif ! !ifndef OUTPUT_FILE ! !Error "Not defined OUTPUT_FILE" !endif *************** *** 271,275 **** ; The file to write ! OutFile "..\${TARGET_CPU}\setup.exe" ; The default installation directory --- 290,295 ---- ; The file to write ! ;!Warning "Using output file '${OUTPUT_FILE}'" ! OutFile "${OUTPUT_FILE}" ; The default installation directory *************** *** 328,331 **** --- 348,382 ---- ;-------------------------------- + !macro CpuSection cpu + + !ifdef ADD_TARGET_CPU_${cpu} + + ;!Warning "Adding CPU ${cpu}" + + Section /o "-com0com ${cpu}" sec_com0com_${cpu} + + ; Set output path to the installation directory. + SetOutPath $INSTDIR + + ; Put target cpu files there + File "..\${cpu}\com0com.sys" + File /nonfatal "..\${cpu}\com0com.cat" + File "..\${cpu}\setup.dll" + File "..\${cpu}\setupc.exe" + + SectionEnd + + !endif + + !macroend + + ;-------------------------------- + + !insertmacro CpuSection i386 + !insertmacro CpuSection amd64 + !insertmacro CpuSection ia64 + + ;-------------------------------- + Section "com0com" sec_com0com *************** *** 337,349 **** ; Put files there File "..\ReadMe.txt" - File "..\com0com.inf" File "..\cncport.inf" File "..\comport.inf" - File "..\${TARGET_CPU}\com0com.sys" - File /nonfatal "..\${TARGET_CPU}\com0com.cat" - - File "..\${TARGET_CPU}\setup.dll" - File "..\${TARGET_CPU}\setupc.exe" File "..\setupg\Release\setupg.exe" --- 388,394 ---- *************** *** 365,369 **** WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "Language" $LANGUAGE ! GetDLLVersionLocal "..\${TARGET_CPU}\com0com.sys" $R0 $R1 IntOp $R2 $R0 / 0x00010000 IntOp $R3 $R0 & 0x0000FFFF --- 410,414 ---- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "Language" $LANGUAGE ! GetDLLVersion "$INSTDIR\com0com.sys" $R0 $R1 IntOp $R2 $R0 / 0x00010000 IntOp $R3 $R0 & 0x0000FFFF *************** *** 383,405 **** WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "VersionMinor" $R3 ! ${GetSize} "$INSTDIR" "/M=ReadMe.txt /S=0B /G=0" $R0 $R1 $R2 ! ${GetSize} "$INSTDIR" "/M=com0com.inf /S=0B /G=0" $R3 $R1 $R2 ! IntOp $R0 $R0 + $R3 ! ${GetSize} "$INSTDIR" "/M=cncport.inf /S=0B /G=0" $R3 $R1 $R2 ! IntOp $R0 $R0 + $R3 ! ${GetSize} "$INSTDIR" "/M=comport.inf /S=0B /G=0" $R3 $R1 $R2 ! IntOp $R0 $R0 + $R3 ! ${GetSize} "$INSTDIR" "/M=com0com.sys /S=0B /G=0" $R3 $R1 $R2 ! IntOp $R0 $R0 + $R3 ! ${GetSize} "$INSTDIR" "/M=com0com.cat /S=0B /G=0" $R3 $R1 $R2 ! IntOp $R0 $R0 + $R3 ! ${GetSize} "$INSTDIR" "/M=setup.dll /S=0B /G=0" $R3 $R1 $R2 ! IntOp $R0 $R0 + $R3 ! ${GetSize} "$INSTDIR" "/M=setupc.exe /S=0B /G=0" $R3 $R1 $R2 ! IntOp $R0 $R0 + $R3 ! ${GetSize} "$INSTDIR" "/M=setupg.exe /S=0B /G=0" $R3 $R1 $R2 ! IntOp $R0 $R0 + $R3 ! ${GetSize} "$INSTDIR" "/M=uninstall.exe /S=0B /G=0" $R3 $R1 $R2 ! IntOp $R0 $R0 + $R3 IntOp $R0 $R0 / 1024 ; in KBytes --- 428,432 ---- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "VersionMinor" $R3 ! ${GetSize} "$INSTDIR" "/S=0B" $R0 $R1 $R2 IntOp $R0 $R0 / 1024 ; in KBytes *************** *** 484,497 **** ${If} ${RunningX64} ! !if "${TARGET_CPU}" == "i386" MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION \ ! "The 32-bit driver cannot run under 64-bit System.$\n$\nContinue?" \ /SD IDNO IDYES +2 Abort !endif ${Else} ! !if "${TARGET_CPU}" != "i386" MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION \ ! "The 64-bit driver cannot run under 32-bit System.$\n$\nContinue?" \ /SD IDNO IDYES +2 Abort --- 511,532 ---- ${If} ${RunningX64} ! !ifdef ADD_TARGET_CPU_amd64 ! SectionGetFlags ${sec_com0com_amd64} $0 ! IntOp $0 $0 | ${SF_SELECTED} ! SectionSetFlags ${sec_com0com_amd64} $0 ! !else MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION \ ! "This package does not include 64-bit driver required for your system.$\n$\nContinue?" \ /SD IDNO IDYES +2 Abort !endif ${Else} ! !ifdef ADD_TARGET_CPU_i386 ! SectionGetFlags ${sec_com0com_i386} $0 ! IntOp $0 $0 | ${SF_SELECTED} ! SectionSetFlags ${sec_com0com_i386} $0 ! !else MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION \ ! "This package does not include 32-bit driver required for your system.$\n$\nContinue?" \ /SD IDNO IDYES +2 Abort |
From: Vyacheslav F. <vf...@us...> - 2011-12-16 17:35:19
|
Update of /cvsroot/com0com/com0com/sys In directory vz-cvs-4.sog:/tmp/cvs-serv3894 Modified Files: openclos.c Log Message: Added resuming i/o after opening port (Bugs item #3460850) Index: openclos.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/openclos.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** openclos.c 26 Jul 2011 16:07:42 -0000 1.26 --- openclos.c 16 Dec 2011 17:35:17 -0000 1.27 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.27 2011/12/16 17:35:17 vfrolov + * Added resuming i/o after opening port (Bugs item #3460850) + * * Revision 1.26 2011/07/26 16:07:42 vfrolov * Fixed double closing *************** *** 195,198 **** --- 198,206 ---- SetModemControl(pIoPort, C0C_MCR_OPEN, C0C_MCR_OPEN, &queueToComplete); + ReadWrite( + pIoPort, FALSE, + pIoPort->pIoPortRemote, FALSE, + &queueToComplete); + if (pIoPort->pIoPortRemote->pWriteDelay && pIoPort->pIoPortRemote->brokeCharsProbability > 0) StartWriteDelayTimer(pIoPort->pIoPortRemote->pWriteDelay); |
From: Vyacheslav F. <vf...@us...> - 2011-12-15 16:43:23
|
Update of /cvsroot/com0com/com0com/setup In directory vz-cvs-4.sog:/tmp/cvs-serv3836 Modified Files: setup.cpp Log Message: Added parameters parsing result check Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** setup.cpp 15 Dec 2011 15:51:48 -0000 1.47 --- setup.cpp 15 Dec 2011 16:43:20 -0000 1.48 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.48 2011/12/15 16:43:20 vfrolov + * Added parameters parsing result check + * * Revision 1.47 2011/12/15 15:51:48 vfrolov * Fixed types *************** *** 530,534 **** portParameters.FillPortName(portNameOld, sizeof(portNameOld)/sizeof(portNameOld[0])); ! portParameters.ParseParametersStr(pParameters); char phDevName[40]; --- 533,538 ---- portParameters.FillPortName(portNameOld, sizeof(portNameOld)/sizeof(portNameOld[0])); ! if (!portParameters.ParseParametersStr(pParameters)) ! return FALSE; char phDevName[40]; *************** *** 992,996 **** if (err == ERROR_SUCCESS) { ! portParameters.ParseParametersStr(pParameters); portParameters.FillPortName(portName[j], sizeof(portName[j])/sizeof(portName[j][0])); --- 996,1001 ---- if (err == ERROR_SUCCESS) { ! if (!portParameters.ParseParametersStr(pParameters)) ! goto err; portParameters.FillPortName(portName[j], sizeof(portName[j])/sizeof(portName[j][0])); |
From: Vyacheslav F. <vf...@us...> - 2011-12-15 15:51:50
|
Update of /cvsroot/com0com/com0com/setup In directory vz-cvs-4.sog:/tmp/cvs-serv30519 Modified Files: comdb.cpp comdb.h devutils.cpp devutils.h inffile.cpp inffile.h msg.cpp msg.h params.cpp params.h setup.cpp utils.cpp utils.h Log Message: Fixed types Index: inffile.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/inffile.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** inffile.h 27 May 2010 11:16:46 -0000 1.3 --- inffile.h 15 Dec 2011 15:51:48 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.3 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 46,50 **** struct InfFileUninstall { const InfFile::InfFileField *pRequiredFields; ! BOOL queryConfirmation; }; --- 49,53 ---- struct InfFileUninstall { const InfFile::InfFileField *pRequiredFields; ! bool queryConfirmation; }; *************** *** 53,72 **** ~InfFile(); ! BOOL Test(const InfFileField *pFields, BOOL showErrors = TRUE) const; const char *Path() const { return pPath; } ! const char *OemPath(BOOL showErrors = TRUE) const; ! const char *ClassGUID(BOOL showErrors = TRUE) const; ! const char *Class(BOOL showErrors = TRUE) const; ! const char *Provider(BOOL showErrors = TRUE) const; ! const char *DriverVer(BOOL showErrors = TRUE) const; ! const char *UninstallInfTag(BOOL showErrors = TRUE) const; ! BOOL UninstallFiles(const char *pFilesSection) const; ! BOOL InstallOEMInf() const; ! BOOL UninstallOEMInf() const; ! static BOOL UninstallAllInfFiles( const InfFileUninstall *pInfFileUninstallList, const char *const *ppOemPathExcludeList); --- 56,75 ---- ~InfFile(); ! bool Test(const InfFileField *pFields, bool showErrors = TRUE) const; const char *Path() const { return pPath; } ! const char *OemPath(bool showErrors = TRUE) const; ! const char *ClassGUID(bool showErrors = TRUE) const; ! const char *Class(bool showErrors = TRUE) const; ! const char *Provider(bool showErrors = TRUE) const; ! const char *DriverVer(bool showErrors = TRUE) const; ! const char *UninstallInfTag(bool showErrors = TRUE) const; ! bool UninstallFiles(const char *pFilesSection) const; ! bool InstallOEMInf() const; ! bool UninstallOEMInf() const; ! static bool UninstallAllInfFiles( const InfFileUninstall *pInfFileUninstallList, const char *const *ppOemPathExcludeList); Index: comdb.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/comdb.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comdb.h 27 May 2010 11:16:46 -0000 1.3 --- comdb.h 15 Dec 2011 15:51:48 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.3 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 35,42 **** /////////////////////////////////////////////////////////////// ! typedef BOOL (* C0C_ENUM_FILTER)(const char *pHardwareId); ! /////////////////////////////////////////////////////////////// ! BOOL ComDbGetInUse(const char *pPortName, BOOL &inUse); ! void ComDbSync(C0C_ENUM_FILTER pFilter); DWORD ComDbQueryNames(char *pBuf, DWORD maxChars); /////////////////////////////////////////////////////////////// --- 38,43 ---- /////////////////////////////////////////////////////////////// ! bool ComDbGetInUse(const char *pPortName, bool &inUse); ! void ComDbSync(PCNC_ENUM_FILTER pFilter); DWORD ComDbQueryNames(char *pBuf, DWORD maxChars); /////////////////////////////////////////////////////////////// Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** utils.h 30 Jul 2010 09:15:04 -0000 1.8 --- utils.h 15 Dec 2011 15:51:48 -0000 1.9 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.8 2010/07/30 09:15:04 vfrolov * Added STRDUP() *************** *** 54,60 **** 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); ! BOOL MatchPattern(const char *pPattern, const char *pStr); ! char *STRDUP(const char *pSrcStr, BOOL showErrors = TRUE); /////////////////////////////////////////////////////////////// class BusyMask { --- 57,63 ---- 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); ! bool MatchPattern(const char *pPattern, const char *pStr); ! char *STRDUP(const char *pSrcStr, bool showErrors = TRUE); /////////////////////////////////////////////////////////////// class BusyMask { *************** *** 64,70 **** void Clear(); ! BOOL AddNum(int num); void DelNum(int num); ! BOOL IsFreeNum(int num) const; int GetFirstFreeNum() const; private: --- 67,73 ---- void Clear(); ! bool AddNum(int num); void DelNum(int num); ! bool IsFreeNum(int num) const; int GetFirstFreeNum() const; private: *************** *** 86,90 **** public: Stack() : pFirst(NULL) {} ! BOOL Push(StackEl *pElem) { if (!pElem) --- 89,93 ---- public: Stack() : pFirst(NULL) {} ! bool Push(StackEl *pElem) { if (!pElem) Index: params.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** params.h 6 Dec 2011 16:03:22 -0000 1.10 --- params.h 15 Dec 2011 15:51:48 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.10 2011/12/06 16:03:22 vfrolov * Added cleaning high data bits for less then 8 bit data *************** *** 65,92 **** LONG Load(); LONG Save(); ! BOOL ParseParametersStr(const char *pParameters); ! BOOL FillParametersStr(char *pParameters, int size, BOOL detail); ! BOOL FillPortName(char *pPortName, int size); ! BOOL Changed() const { return maskChanged != 0; } ! BOOL ClassChanged() const { return classChanged; } ! BOOL DialogRequested() const { return dialogRequested; } static const char *PortParameters::GetHelp(); protected: ! BOOL FillParametersKey(char *pRegKey, int size); DWORD *GetDwPtr(DWORD bit); void LoadDw(HKEY hKey, DWORD bit); LONG SaveDw(HKEY hKey, DWORD bit); ! BOOL SetPortName(const char *pNewPortName); ! BOOL SetFlag(const char *pNewVal, DWORD bit); ! BOOL SetPin(const char *pNewVal, DWORD bit); ! BOOL SetProbability(const char *pNewVal, DWORD bit); ! BOOL SetUnsigned(const char *pNewVal, DWORD bit); ! BOOL SetBit(const char *pVal, const Bit &bit); ! BOOL classChanged; ! BOOL dialogRequested; DWORD maskChanged; DWORD maskExplicit; --- 68,95 ---- LONG Load(); LONG Save(); ! bool ParseParametersStr(const char *pParameters); ! bool FillParametersStr(char *pParameters, int size, bool detail); ! bool FillPortName(char *pPortName, int size); ! bool Changed() const { return maskChanged != 0; } ! bool ClassChanged() const { return classChanged; } ! bool DialogRequested() const { return dialogRequested; } static const char *PortParameters::GetHelp(); protected: ! bool FillParametersKey(char *pRegKey, int size); DWORD *GetDwPtr(DWORD bit); void LoadDw(HKEY hKey, DWORD bit); LONG SaveDw(HKEY hKey, DWORD bit); ! bool SetPortName(const char *pNewPortName); ! bool SetFlag(const char *pNewVal, DWORD bit); ! bool SetPin(const char *pNewVal, DWORD bit); ! bool SetProbability(const char *pNewVal, DWORD bit); ! bool SetUnsigned(const char *pNewVal, DWORD bit); ! bool SetBit(const char *pVal, const Bit &bit); ! bool classChanged; ! bool dialogRequested; DWORD maskChanged; DWORD maskExplicit; Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** params.cpp 6 Dec 2011 16:03:22 -0000 1.19 --- params.cpp 15 Dec 2011 15:51:48 -0000 1.20 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.20 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.19 2011/12/06 16:03:22 vfrolov * Added cleaning high data bits for less then 8 bit data *************** *** 167,171 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::SetPortName(const char *pNewPortName) { if (lstrcmpi(pNewPortName, "?") == 0) { --- 170,174 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::SetPortName(const char *pNewPortName) { if (lstrcmpi(pNewPortName, "?") == 0) { *************** *** 262,266 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::SetFlag(const char *pNewVal, DWORD bit) { DWORD newFlag; --- 265,269 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::SetFlag(const char *pNewVal, DWORD bit) { DWORD newFlag; *************** *** 291,295 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::SetPin(const char *pNewVal, DWORD bit) { DWORD newPin; --- 294,298 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::SetPin(const char *pNewVal, DWORD bit) { DWORD newPin; *************** *** 363,367 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::SetProbability(const char *pNewVal, DWORD bit) { DWORD newVal = 0; --- 366,370 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::SetProbability(const char *pNewVal, DWORD bit) { DWORD newVal = 0; *************** *** 413,417 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::SetUnsigned(const char *pNewVal, DWORD bit) { DWORD newVal = 0; --- 416,420 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::SetUnsigned(const char *pNewVal, DWORD bit) { DWORD newVal = 0; *************** *** 438,442 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::SetBit(const char *pVal, const Bit &bit) { if (!lstrcmpi(pVal, "*")) --- 441,445 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::SetBit(const char *pVal, const Bit &bit) { if (!lstrcmpi(pVal, "*")) *************** *** 490,494 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::FillParametersKey(char *pRegKey, int size) { int len; --- 493,497 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::FillParametersKey(char *pRegKey, int size) { int len; *************** *** 684,688 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::ParseParametersStr(const char *pParameters) { PortParameters tmp = *this; --- 687,691 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::ParseParametersStr(const char *pParameters) { PortParameters tmp = *this; *************** *** 745,749 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::FillParametersStr(char *pParameters, int size, BOOL detail) { int len; --- 748,752 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::FillParametersStr(char *pParameters, int size, bool detail) { int len; *************** *** 863,867 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::FillPortName(char *pPortName, int size) { int len; --- 866,870 ---- } /////////////////////////////////////////////////////////////// ! bool PortParameters::FillPortName(char *pPortName, int size) { int len; Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** setup.cpp 15 Jul 2011 16:09:05 -0000 1.46 --- setup.cpp 15 Dec 2011 15:51:48 -0000 1.47 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.47 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.46 2011/07/15 16:09:05 vfrolov * Disabled MessageBox() for silent mode and added default processing *************** *** 223,227 **** const char *pCopyDriversSection; const char *pHardwareId; ! BOOL preinstallClass; const InfFile::InfFileField *pRequiredFields; }; --- 226,230 ---- const char *pCopyDriversSection; const char *pHardwareId; ! bool preinstallClass; const InfFile::InfFileField *pRequiredFields; }; *************** *** 267,274 **** /////////////////////////////////////////////////////////////// static int timeout = 0; ! static BOOL detailPrms = FALSE; ! static BOOL no_update = FALSE; /////////////////////////////////////////////////////////////// ! static BOOL EnumFilter(const char *pHardwareId) { if (!pHardwareId) --- 270,278 ---- /////////////////////////////////////////////////////////////// static int timeout = 0; ! static bool detailPrms = FALSE; ! static bool no_update = FALSE; /////////////////////////////////////////////////////////////// ! static CNC_ENUM_FILTER EnumFilter; ! static bool EnumFilter(const char *pHardwareId) { if (!pHardwareId) *************** *** 285,289 **** } /////////////////////////////////////////////////////////////// ! static BOOL IsValidPortNum(int num) { if (num < 0) --- 289,293 ---- } /////////////////////////////////////////////////////////////// ! static bool IsValidPortNum(int num) { if (num < 0) *************** *** 305,309 **** } /////////////////////////////////////////////////////////////// ! static BOOL IsValidPortName( const char *pPortName) { --- 309,313 ---- } /////////////////////////////////////////////////////////////// ! static bool IsValidPortName( const char *pPortName) { *************** *** 344,348 **** res = IDCONTINUE; ! BOOL inUse; if (!ComDbGetInUse(pPortName, inUse)) { --- 348,352 ---- res = IDCONTINUE; ! bool inUse; if (!ComDbGetInUse(pPortName, inUse)) { *************** *** 444,448 **** static VOID CleanDevPropertiesStack( Stack &stack, ! BOOL enable, BOOL *pRebootRequired) { --- 448,452 ---- static VOID CleanDevPropertiesStack( Stack &stack, ! bool enable, BOOL *pRebootRequired) { *************** *** 474,481 **** const char *pPhPortName; const char *pParameters; ! BOOL changed; }; ! static BOOL ShowDialog( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 478,486 ---- const char *pPhPortName; const char *pParameters; ! bool changed; }; ! static CNC_DEV_CALLBACK ShowDialog; ! static bool ShowDialog( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 490,494 **** } ! static BOOL ChangeDevice( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 495,500 ---- } ! static CNC_DEV_CALLBACK ChangeDevice; ! static bool ChangeDevice( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 597,601 **** } ! BOOL Change(const char *pPhPortName, const char *pParameters) { BOOL rebootRequired = FALSE; --- 603,607 ---- } ! bool Change(const char *pPhPortName, const char *pParameters) { BOOL rebootRequired = FALSE; *************** *** 624,628 **** }; ! static BOOL RemoveDevice( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 630,635 ---- }; ! static CNC_DEV_CALLBACK RemoveDevice; ! static bool RemoveDevice( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 646,650 **** } ! BOOL Remove(int num) { int res; --- 653,657 ---- } ! bool Remove(int num) { int res; *************** *** 691,695 **** } /////////////////////////////////////////////////////////////// ! BOOL Preinstall(const InfFileInstall *pInfFileInstallList) { for ( --- 698,702 ---- } /////////////////////////////////////////////////////////////// ! bool Preinstall(const InfFileInstall *pInfFileInstallList) { for ( *************** *** 730,734 **** } /////////////////////////////////////////////////////////////// ! BOOL Reload( const char *pHardwareId, const char *pInfFilePath, --- 737,741 ---- } /////////////////////////////////////////////////////////////// ! bool Reload( const char *pHardwareId, const char *pInfFilePath, *************** *** 774,780 **** } /////////////////////////////////////////////////////////////// ! BOOL Update(const InfFileInstall *pInfFileInstallList) { ! BOOL ok = TRUE; BOOL rebootRequired = FALSE; --- 781,787 ---- } /////////////////////////////////////////////////////////////// ! bool Update(const InfFileInstall *pInfFileInstallList) { ! bool ok = TRUE; BOOL rebootRequired = FALSE; *************** *** 801,805 **** } /////////////////////////////////////////////////////////////// ! BOOL Disable() { BOOL rebootRequired = FALSE; --- 808,812 ---- } /////////////////////////////////////////////////////////////// ! bool Disable() { BOOL rebootRequired = FALSE; *************** *** 818,822 **** } /////////////////////////////////////////////////////////////// ! BOOL Enable() { BOOL rebootRequired = FALSE; --- 825,829 ---- } /////////////////////////////////////////////////////////////// ! bool Enable() { BOOL rebootRequired = FALSE; *************** *** 836,840 **** } /////////////////////////////////////////////////////////////// ! BOOL Install(const char *pInfFilePath) { if (no_update) --- 843,847 ---- } /////////////////////////////////////////////////////////////// ! bool Install(const char *pInfFilePath) { if (no_update) *************** *** 860,864 **** } /////////////////////////////////////////////////////////////// ! static BOOL InstallDeviceCallBack( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 867,872 ---- } /////////////////////////////////////////////////////////////// ! static CNC_DEV_CALLBACK InstallDeviceCallBack; ! static bool InstallDeviceCallBack( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 892,896 **** } ! static BOOL InstallBusDevice(const char *pInfFilePath, int num) { BOOL rebootRequired = FALSE; --- 900,904 ---- } ! static bool InstallBusDevice(const char *pInfFilePath, int num) { BOOL rebootRequired = FALSE; *************** *** 905,909 **** } ! static BOOL AddDeviceToBusyMask( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 913,918 ---- } ! static CNC_DEV_CALLBACK AddDeviceToBusyMask; ! static bool AddDeviceToBusyMask( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 938,942 **** } ! BOOL Install(const char *pInfFilePath, const char *pParametersA, const char *pParametersB, int num) { int i; --- 947,951 ---- } ! bool Install(const char *pInfFilePath, const char *pParametersA, const char *pParametersB, int num) { int i; *************** *** 1053,1057 **** } /////////////////////////////////////////////////////////////// ! BOOL Uninstall( const InfFileInstall *pInfFileInstallList, const InfFile::InfFileUninstall *pInfFileUninstallList) --- 1062,1066 ---- } /////////////////////////////////////////////////////////////// ! bool Uninstall( const InfFileInstall *pInfFileInstallList, const InfFile::InfFileUninstall *pInfFileUninstallList) *************** *** 1093,1097 **** int res; ! BOOL notDeleted; LONG err; --- 1102,1106 ---- int res; ! bool notDeleted; LONG err; *************** *** 1289,1297 **** } /////////////////////////////////////////////////////////////// ! BOOL InfClean( const InfFileInstall *pInfFileInstallList, const InfFile::InfFileUninstall *pInfFileUninstallList) { ! BOOL ok = TRUE; InfFile **pInfFiles = NULL; const char **ppOemPathExcludeList = NULL; --- 1298,1306 ---- } /////////////////////////////////////////////////////////////// ! bool InfClean( const InfFileInstall *pInfFileInstallList, const InfFile::InfFileUninstall *pInfFileUninstallList) { ! bool ok = TRUE; InfFile **pInfFiles = NULL; const char **ppOemPathExcludeList = NULL; *************** *** 1365,1369 **** } /////////////////////////////////////////////////////////////// ! BOOL ShowBusyNames(const char *pPattern) { char *pPatternUp; --- 1374,1378 ---- } /////////////////////////////////////////////////////////////// ! bool ShowBusyNames(const char *pPattern) { char *pPatternUp; *************** *** 1614,1618 **** } /////////////////////////////////////////////////////////////// ! static int Complete(BOOL ok) { if (ok) { --- 1623,1627 ---- } /////////////////////////////////////////////////////////////// ! static int Complete(bool ok) { if (ok) { Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** devutils.cpp 15 Jul 2011 16:09:05 -0000 1.19 --- devutils.cpp 15 Dec 2011 15:51:48 -0000 1.20 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.20 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.19 2011/07/15 16:09:05 vfrolov * Disabled MessageBox() for silent mode and added default processing *************** *** 92,97 **** EnumParams() { pDevProperties = NULL; ! pParam1 = NULL; ! pParam2 = NULL; count = 0; pRebootRequired = NULL; --- 95,101 ---- EnumParams() { pDevProperties = NULL; ! pDevCallBack = NULL; ! pDevCallBackParam = NULL; ! pStack = NULL; count = 0; pRebootRequired = NULL; *************** *** 99,104 **** PCDevProperties pDevProperties; ! void *pParam1; ! void *pParam2; int count; BOOL *pRebootRequired; --- 103,109 ---- PCDevProperties pDevProperties; ! PCNC_DEV_CALLBACK pDevCallBack; ! void *pDevCallBackParam; ! Stack *pStack; int count; BOOL *pRebootRequired; *************** *** 156,163 **** } /////////////////////////////////////////////////////////////// static int EnumDevices( ! C0C_ENUM_FILTER pFilter, DWORD flags, ! BOOL (* pFunk)(HDEVINFO, PSP_DEVINFO_DATA, PDevParams), PEnumParams pEnumParams) { --- 161,175 ---- } /////////////////////////////////////////////////////////////// + typedef int CNC_DEV_ROUTINE( + HDEVINFO hDevInfo, + PSP_DEVINFO_DATA pDevInfoData, + PDevParams pDevParams); + + typedef CNC_DEV_ROUTINE *PCNC_DEV_ROUTINE; + static int EnumDevices( ! PCNC_ENUM_FILTER pFilter, DWORD flags, ! PCNC_DEV_ROUTINE pDevRoutine, PEnumParams pEnumParams) { *************** *** 243,247 **** } ! res = pFunk(hDevInfo, &devInfoData, &devParams); if (res != IDCONTINUE) --- 255,259 ---- } ! res = pDevRoutine(hDevInfo, &devInfoData, &devParams); if (res != IDCONTINUE) *************** *** 258,262 **** } /////////////////////////////////////////////////////////////// ! static BOOL UpdateRebootRequired(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, BOOL *pRebootRequired) { if (!pRebootRequired) --- 270,274 ---- } /////////////////////////////////////////////////////////////// ! static bool UpdateRebootRequired(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, BOOL *pRebootRequired) { if (!pRebootRequired) *************** *** 297,301 **** } /////////////////////////////////////////////////////////////// ! static BOOL ChangeState(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, DWORD stateChange) { SP_PROPCHANGE_PARAMS propChangeParams; --- 309,313 ---- } /////////////////////////////////////////////////////////////// ! static bool ChangeState(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, DWORD stateChange) { SP_PROPCHANGE_PARAMS propChangeParams; *************** *** 321,325 **** } /////////////////////////////////////////////////////////////// ! static BOOL IsDisabled(PSP_DEVINFO_DATA pDevInfoData) { ULONG status = 0; --- 333,337 ---- } /////////////////////////////////////////////////////////////// ! static bool IsDisabled(PSP_DEVINFO_DATA pDevInfoData) { ULONG status = 0; *************** *** 332,336 **** } /////////////////////////////////////////////////////////////// ! static BOOL IsEnabled(PSP_DEVINFO_DATA pDevInfoData) { ULONG status = 0; --- 344,348 ---- } /////////////////////////////////////////////////////////////// ! static bool IsEnabled(PSP_DEVINFO_DATA pDevInfoData) { ULONG status = 0; *************** *** 343,346 **** --- 355,359 ---- } /////////////////////////////////////////////////////////////// + static CNC_DEV_ROUTINE EnumDevice; static int EnumDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { *************** *** 354,363 **** int res = IDCONTINUE; ! if (pDevParams->pEnumParams->pParam1) { ! if (!PDEVCALLBACK(pDevParams->pEnumParams->pParam1)(hDevInfo, pDevInfoData, &pDevParams->devProperties, pDevParams->pEnumParams->pRebootRequired, ! pDevParams->pEnumParams->pParam2)) { res = IDCANCEL; --- 367,376 ---- int res = IDCONTINUE; ! if (pDevParams->pEnumParams->pDevCallBack) { ! if (!pDevParams->pEnumParams->pDevCallBack( hDevInfo, pDevInfoData, &pDevParams->devProperties, pDevParams->pEnumParams->pRebootRequired, ! pDevParams->pEnumParams->pDevCallBackParam)) { res = IDCANCEL; *************** *** 371,379 **** int EnumDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, ! PDEVCALLBACK pDevCallBack, ! void *pCallBackParam) { EnumParams enumParams; --- 384,392 ---- int EnumDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, ! PCNC_DEV_CALLBACK pDevCallBack, ! void *pDevCallBackParam) { EnumParams enumParams; *************** *** 381,386 **** enumParams.pDevProperties = pDevProperties; enumParams.pRebootRequired = pRebootRequired; ! enumParams.pParam1 = pDevCallBack; ! enumParams.pParam2 = pCallBackParam; if (EnumDevices(pFilter, DIGCF_PRESENT, EnumDevice, &enumParams) != IDCONTINUE) --- 394,399 ---- enumParams.pDevProperties = pDevProperties; enumParams.pRebootRequired = pRebootRequired; ! enumParams.pDevCallBack = pDevCallBack; ! enumParams.pDevCallBackParam = pDevCallBackParam; if (EnumDevices(pFilter, DIGCF_PRESENT, EnumDevice, &enumParams) != IDCONTINUE) *************** *** 472,475 **** --- 485,489 ---- } /////////////////////////////////////////////////////////////// + static CNC_DEV_ROUTINE DisableDevice; static int DisableDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { *************** *** 478,482 **** &pDevParams->devProperties, pDevParams->pEnumParams->pRebootRequired, ! (Stack *)pDevParams->pEnumParams->pParam1); if (res == IDCONTINUE) --- 492,496 ---- &pDevParams->devProperties, pDevParams->pEnumParams->pRebootRequired, ! pDevParams->pEnumParams->pStack); if (res == IDCONTINUE) *************** *** 486,491 **** } ! BOOL DisableDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, --- 500,505 ---- } ! bool DisableDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, *************** *** 498,502 **** enumParams.pRebootRequired = pRebootRequired; enumParams.pDevProperties = pDevProperties; ! enumParams.pParam1 = pDevPropertiesStack; do { --- 512,516 ---- enumParams.pRebootRequired = pRebootRequired; enumParams.pDevProperties = pDevProperties; ! enumParams.pStack = pDevPropertiesStack; do { *************** *** 513,516 **** --- 527,531 ---- } /////////////////////////////////////////////////////////////// + static CNC_DEV_ROUTINE EnableDevice; static int EnableDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { *************** *** 530,535 **** } ! BOOL EnableDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired) --- 545,550 ---- } ! bool EnableDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired) *************** *** 552,555 **** --- 567,571 ---- } /////////////////////////////////////////////////////////////// + static CNC_DEV_ROUTINE RestartDevice; static int RestartDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { *************** *** 603,608 **** } ! BOOL RestartDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired) --- 619,624 ---- } ! bool RestartDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired) *************** *** 625,629 **** } /////////////////////////////////////////////////////////////// ! BOOL RemoveDevice( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 641,645 ---- } /////////////////////////////////////////////////////////////// ! bool RemoveDevice( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 642,645 **** --- 658,662 ---- } /////////////////////////////////////////////////////////////// + static CNC_DEV_ROUTINE RemoveDevice; static int RemoveDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { *************** *** 652,657 **** } ! BOOL RemoveDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired) --- 669,674 ---- } ! bool RemoveDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired) *************** *** 677,681 **** } /////////////////////////////////////////////////////////////// ! BOOL ReenumerateDeviceNode(PSP_DEVINFO_DATA pDevInfoData) { return CM_Reenumerate_DevNode(pDevInfoData->DevInst, 0) == CR_SUCCESS; --- 694,698 ---- } /////////////////////////////////////////////////////////////// ! bool ReenumerateDeviceNode(PSP_DEVINFO_DATA pDevInfoData) { return CM_Reenumerate_DevNode(pDevInfoData->DevInst, 0) == CR_SUCCESS; *************** *** 686,690 **** const char *pHardwareId, DWORD flags, ! BOOL mandatory, BOOL *pRebootRequired) { --- 703,707 ---- const char *pHardwareId, DWORD flags, ! bool mandatory, BOOL *pRebootRequired) { *************** *** 771,777 **** const char *pDevId, const char *pDevInstID, ! PDEVCALLBACK pDevCallBack, ! void *pCallBackParam, ! BOOL updateDriver, BOOL *pRebootRequired) { --- 788,794 ---- const char *pDevId, const char *pDevInstID, ! PCNC_DEV_CALLBACK pDevCallBack, ! void *pDevCallBackParam, ! bool updateDriver, BOOL *pRebootRequired) { *************** *** 888,892 **** } ! if (!pDevCallBack(hDevInfo, &devInfoData, &devProperties, NULL, pCallBackParam)) { res = IDCANCEL; goto exit2; --- 905,909 ---- } ! if (!pDevCallBack(hDevInfo, &devInfoData, &devProperties, NULL, pDevCallBackParam)) { res = IDCANCEL; goto exit2; *************** *** 911,921 **** } ! BOOL InstallDevice( const char *pInfFilePath, const char *pDevId, const char *pDevInstID, ! PDEVCALLBACK pDevCallBack, ! void *pCallBackParam, ! BOOL updateDriver, BOOL *pRebootRequired) { --- 928,938 ---- } ! bool InstallDevice( const char *pInfFilePath, const char *pDevId, const char *pDevInstID, ! PCNC_DEV_CALLBACK pDevCallBack, ! void *pDevCallBackParam, ! bool updateDriver, BOOL *pRebootRequired) { *************** *** 923,927 **** do { ! res = TryInstallDevice(pInfFilePath, pDevId, pDevInstID, pDevCallBack, pCallBackParam, updateDriver, pRebootRequired); } while (res == IDTRYAGAIN); --- 940,944 ---- do { ! res = TryInstallDevice(pInfFilePath, pDevId, pDevInstID, pDevCallBack, pDevCallBackParam, updateDriver, pRebootRequired); } while (res == IDTRYAGAIN); *************** *** 929,933 **** } /////////////////////////////////////////////////////////////// ! BOOL WaitNoPendingInstallEvents(int timeLimit) { typedef DWORD (WINAPI *PWAITNOPENDINGINSTALLEVENTS)(IN DWORD); --- 946,950 ---- } /////////////////////////////////////////////////////////////// ! bool WaitNoPendingInstallEvents(int timeLimit) { typedef DWORD (WINAPI *PWAITNOPENDINGINSTALLEVENTS)(IN DWORD); *************** *** 950,957 **** timeLimit = -1; ! BOOL inTrace = FALSE; DWORD startTime = GetTickCount(); ! for (BOOL count = 0 ;;) { DWORD res = pWaitNoPendingInstallEvents(0); --- 967,974 ---- timeLimit = -1; ! bool inTrace = FALSE; DWORD startTime = GetTickCount(); ! for (int count = 0 ;;) { DWORD res = pWaitNoPendingInstallEvents(0); Index: msg.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/msg.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** msg.h 16 Feb 2009 10:32:56 -0000 1.5 --- msg.h 15 Dec 2011 15:51:48 -0000 1.6 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.5 2009/02/16 10:32:56 vfrolov * Added Silent() and PromptReboot() *************** *** 50,59 **** void ConsoleWriteRead(char *pReadBuf, int lenReadBuf, const char *pFmt, ...); void ConsoleWrite(const char *pFmt, ...); ! BOOL IsConsoleOpen(); void SetTitle(const char *pTitle); ! BOOL SetOutputFile(const char *pFile); const char *GetOutputFile(); ! BOOL Silent(); ! void Silent(BOOL val); void PromptReboot(); --- 53,62 ---- void ConsoleWriteRead(char *pReadBuf, int lenReadBuf, const char *pFmt, ...); void ConsoleWrite(const char *pFmt, ...); ! bool IsConsoleOpen(); void SetTitle(const char *pTitle); ! bool SetOutputFile(const char *pFile); const char *GetOutputFile(); ! bool Silent(); ! void Silent(bool val); void PromptReboot(); Index: utils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** utils.cpp 30 Jul 2010 09:15:04 -0000 1.9 --- utils.cpp 15 Dec 2011 15:51:48 -0000 1.10 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.9 2010/07/30 09:15:04 vfrolov * Added STRDUP() *************** *** 82,86 **** } /////////////////////////////////////////////////////////////// ! static BOOL IsDelim(char c, const char *pDelims) { while (*pDelims) { --- 85,89 ---- } /////////////////////////////////////////////////////////////// ! static bool IsDelim(char c, const char *pDelims) { while (*pDelims) { *************** *** 118,124 **** } /////////////////////////////////////////////////////////////// ! BOOL StrToInt(const char *pStr, int *pNum) { ! BOOL res = FALSE; int num; int sign = 1; --- 121,127 ---- } /////////////////////////////////////////////////////////////// ! bool StrToInt(const char *pStr, int *pNum) { ! bool res = FALSE; int num; int sign = 1; *************** *** 161,165 **** } /////////////////////////////////////////////////////////////// ! BOOL MatchPattern(const char *pPattern, const char *pStr) { for (;;) { --- 164,168 ---- } /////////////////////////////////////////////////////////////// ! bool MatchPattern(const char *pPattern, const char *pStr) { for (;;) { *************** *** 193,197 **** } /////////////////////////////////////////////////////////////// ! char *STRDUP(const char *pSrcStr, BOOL showErrors) { char *pDstStr; --- 196,200 ---- } /////////////////////////////////////////////////////////////// ! char *STRDUP(const char *pSrcStr, bool showErrors) { char *pDstStr; *************** *** 220,224 **** } ! BOOL BusyMask::AddNum(int num) { ULONG maskNum = num/(sizeof(*pBusyMask)*8); --- 223,227 ---- } ! bool BusyMask::AddNum(int num) { ULONG maskNum = num/(sizeof(*pBusyMask)*8); *************** *** 261,265 **** } ! BOOL BusyMask::IsFreeNum(int num) const { ULONG maskNum = num/(sizeof(*pBusyMask)*8); --- 264,268 ---- } ! bool BusyMask::IsFreeNum(int num) const { ULONG maskNum = num/(sizeof(*pBusyMask)*8); Index: comdb.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/comdb.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comdb.cpp 27 May 2010 11:16:46 -0000 1.3 --- comdb.cpp 15 Dec 2011 15:51:48 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.3 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 64,68 **** } /////////////////////////////////////////////////////////////// ! static BOOL LoadComDb(BusyMask &comDb) { comDb.Clear(); --- 67,71 ---- } /////////////////////////////////////////////////////////////// ! static bool LoadComDb(BusyMask &comDb) { comDb.Clear(); *************** *** 129,133 **** } /////////////////////////////////////////////////////////////// ! static BOOL ClaimReleasePort(DWORD num, BOOL claim) { int res; --- 132,136 ---- } /////////////////////////////////////////////////////////////// ! static bool ClaimReleasePort(DWORD num, bool claim) { int res; *************** *** 181,185 **** } /////////////////////////////////////////////////////////////// ! static BOOL LoadComDbLocal(BusyMask &comDb) { comDb.Clear(); --- 184,188 ---- } /////////////////////////////////////////////////////////////// ! static bool LoadComDbLocal(BusyMask &comDb) { comDb.Clear(); *************** *** 270,274 **** } /////////////////////////////////////////////////////////////// ! static BOOL AddComNames( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 273,278 ---- } /////////////////////////////////////////////////////////////// ! static CNC_DEV_CALLBACK AddComNames; ! static bool AddComNames( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 306,310 **** } ! static BOOL LoadComNames(C0C_ENUM_FILTER pFilter, BusyMask &comDb) { comDb.Clear(); --- 310,314 ---- } ! static bool LoadComNames(PCNC_ENUM_FILTER pFilter, BusyMask &comDb) { comDb.Clear(); *************** *** 321,325 **** } /////////////////////////////////////////////////////////////// ! static BOOL SaveComDbLocal(const BusyMask &comDb) { int res; --- 325,329 ---- } /////////////////////////////////////////////////////////////// ! static bool SaveComDbLocal(const BusyMask &comDb) { int res; *************** *** 403,407 **** } /////////////////////////////////////////////////////////////// ! BOOL ComDbGetInUse(const char *pPortName, BOOL &inUse) { WORD num = name2num(pPortName); --- 407,411 ---- } /////////////////////////////////////////////////////////////// ! bool ComDbGetInUse(const char *pPortName, bool &inUse) { WORD num = name2num(pPortName); *************** *** 421,425 **** } /////////////////////////////////////////////////////////////// ! void ComDbSync(C0C_ENUM_FILTER pFilter) { BusyMask comNames; --- 425,429 ---- } /////////////////////////////////////////////////////////////// ! void ComDbSync(PCNC_ENUM_FILTER pFilter) { BusyMask comNames; Index: msg.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/msg.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** msg.cpp 8 Dec 2011 09:32:04 -0000 1.12 --- msg.cpp 15 Dec 2011 15:51:48 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.12 2011/12/08 09:32:04 vfrolov * Fixed unreadable console output by changing LANG_NEUTRAL to LANG_ENGLISH *************** *** 68,72 **** static char *pOutputFile = NULL; static char title[80] = ""; ! static BOOL silent = FALSE; /////////////////////////////////////////////////////////////// --- 71,75 ---- static char *pOutputFile = NULL; static char title[80] = ""; ! static bool silent = FALSE; /////////////////////////////////////////////////////////////// *************** *** 78,82 **** static int (* pShowMsg)(LPCSTR pText, UINT type) = ShowMsgDefault; /////////////////////////////////////////////////////////////// ! static BOOL isConsoleOpen = FALSE; static void ConsoleWriteReadDefault(LPSTR pReadBuf, DWORD lenReadBuf, LPCSTR pText) --- 81,85 ---- static int (* pShowMsg)(LPCSTR pText, UINT type) = ShowMsgDefault; /////////////////////////////////////////////////////////////// ! static bool isConsoleOpen = FALSE; static void ConsoleWriteReadDefault(LPSTR pReadBuf, DWORD lenReadBuf, LPCSTR pText) *************** *** 313,317 **** } /////////////////////////////////////////////////////////////// ! BOOL IsConsoleOpen() { return isConsoleOpen; --- 316,320 ---- } /////////////////////////////////////////////////////////////// ! bool IsConsoleOpen() { return isConsoleOpen; *************** *** 323,327 **** } /////////////////////////////////////////////////////////////// ! BOOL SetOutputFile(const char *pFile) { if (pOutputFile) { --- 326,330 ---- } /////////////////////////////////////////////////////////////// ! bool SetOutputFile(const char *pFile) { if (pOutputFile) { *************** *** 345,354 **** } /////////////////////////////////////////////////////////////// ! BOOL Silent() { return silent; } /////////////////////////////////////////////////////////////// ! void Silent(BOOL val) { silent = val; --- 348,357 ---- } /////////////////////////////////////////////////////////////// ! bool Silent() { return silent; } /////////////////////////////////////////////////////////////// ! void Silent(bool val) { silent = val; Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** devutils.h 13 Jul 2011 17:39:56 -0000 1.12 --- devutils.h 15 Dec 2011 15:51:48 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.12 2011/07/13 17:39:56 vfrolov * Fixed result treatment of UpdateDriverForPlugAndPlayDevices() *************** *** 94,98 **** class Stack; ! typedef BOOL (* PDEVCALLBACK)( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 97,102 ---- class Stack; ! /////////////////////////////////////////////////////////////// ! typedef bool CNC_DEV_CALLBACK( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 100,112 **** BOOL *pRebootRequired, void *pParam); /////////////////////////////////////////////////////////////// ! typedef BOOL (* C0C_ENUM_FILTER)(const char *pHardwareId); /////////////////////////////////////////////////////////////// int EnumDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, ! PDEVCALLBACK pDevCallBack, ! void *pCallBackParam); int DisableDevice( --- 104,119 ---- BOOL *pRebootRequired, void *pParam); + + typedef CNC_DEV_CALLBACK *PCNC_DEV_CALLBACK; /////////////////////////////////////////////////////////////// ! typedef bool CNC_ENUM_FILTER(const char *pHardwareId); ! typedef CNC_ENUM_FILTER *PCNC_ENUM_FILTER; /////////////////////////////////////////////////////////////// int EnumDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, ! PCNC_DEV_CALLBACK pDevCallBack, ! void *pDevCallBackParam); int DisableDevice( *************** *** 117,137 **** Stack *pDevPropertiesStack); ! BOOL DisableDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, Stack *pDevPropertiesStack); ! BOOL EnableDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired); ! BOOL RestartDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired); ! BOOL RemoveDevice( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, --- 124,144 ---- Stack *pDevPropertiesStack); ! bool DisableDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, Stack *pDevPropertiesStack); ! bool EnableDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired); ! bool RestartDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired); ! bool RemoveDevice( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, *************** *** 139,148 **** BOOL *pRebootRequired); ! BOOL RemoveDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired); ! BOOL ReenumerateDeviceNode( PSP_DEVINFO_DATA pDevInfoData); --- 146,155 ---- BOOL *pRebootRequired); ! bool RemoveDevices( ! PCNC_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired); ! bool ReenumerateDeviceNode( PSP_DEVINFO_DATA pDevInfoData); *************** *** 151,167 **** const char *pHardwareId, DWORD flags, ! BOOL mandatory, BOOL *pRebootRequired); ! BOOL InstallDevice( const char *pInfFilePath, const char *pDevId, const char *pDevInstID, ! PDEVCALLBACK pDevCallBack, ! void *pCallBackParam, ! BOOL updateDriver, BOOL *pRebootRequired); ! BOOL WaitNoPendingInstallEvents( int timeLimit); /////////////////////////////////////////////////////////////// --- 158,174 ---- const char *pHardwareId, DWORD flags, ! bool mandatory, BOOL *pRebootRequired); ! bool InstallDevice( const char *pInfFilePath, const char *pDevId, const char *pDevInstID, ! PCNC_DEV_CALLBACK pDevCallBack, ! void *pDevCallBackParam, ! bool updateDriver, BOOL *pRebootRequired); ! bool WaitNoPendingInstallEvents( int timeLimit); /////////////////////////////////////////////////////////////// Index: inffile.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/inffile.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** inffile.cpp 15 Jul 2011 16:09:05 -0000 1.11 --- inffile.cpp 15 Dec 2011 15:51:48 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2011/12/15 15:51:48 vfrolov + * Fixed types + * * Revision 1.11 2011/07/15 16:09:05 vfrolov * Disabled MessageBox() for silent mode and added default processing *************** *** 63,67 **** /////////////////////////////////////////////////////////////// ! static BOOL GetVersionInfo(const char *pInfPath, const char *pKey, char **ppValue, BOOL showErrors) { if (!pInfPath) --- 66,70 ---- /////////////////////////////////////////////////////////////// ! static bool GetVersionInfo(const char *pInfPath, const char *pKey, char **ppValue, bool showErrors) { if (!pInfPath) *************** *** 124,128 **** } /////////////////////////////////////////////////////////////// ! static BOOL Open(const char *pInfPath, HINF *phInf, BOOL showErrors) { if (*phInf != INVALID_HANDLE_VALUE) --- 127,131 ---- } /////////////////////////////////////////////////////////////// ! static bool Open(const char *pInfPath, HINF *phInf, bool showErrors) { if (*phInf != INVALID_HANDLE_VALUE) *************** *** 150,154 **** } /////////////////////////////////////////////////////////////// ! static BOOL IsPathInList( const char *pPath, const char *const *ppList) --- 153,157 ---- } /////////////////////////////////////////////////////////////// ! static bool IsPathInList( const char *pPath, const char *const *ppList) *************** *** 165,169 **** } /////////////////////////////////////////////////////////////// ! static BOOL GetFilePath( const char *pFileName, const char *pNearPath, --- 168,172 ---- } /////////////////////////////////////////////////////////////// ! static bool GetFilePath( const char *pFileName, const char *pNearPath, *************** *** 251,255 **** } /////////////////////////////////////////////////////////////// ! BOOL InfFile::Test(const InfFileField *pFields, BOOL showErrors) const { if (!Open(pPath, &hInf, showErrors)) --- 254,258 ---- } /////////////////////////////////////////////////////////////// ! bool InfFile::Test(const InfFileField *pFields, bool showErrors) const { if (!Open(pPath, &hInf, showErrors)) *************** *** 296,300 **** } /////////////////////////////////////////////////////////////// ! const char *InfFile::OemPath(BOOL showErrors) const { if (!pOemPath) { --- 299,303 ---- } /////////////////////////////////////////////////////////////// ! const char *InfFile::OemPath(bool showErrors) const { if (!pOemPath) { *************** *** 312,316 **** } /////////////////////////////////////////////////////////////// ! const char *InfFile::ClassGUID(BOOL showErrors) const { GetVersionInfo(pPath, "ClassGUID", &pClassGUID, showErrors); --- 315,319 ---- } /////////////////////////////////////////////////////////////// ! const char *InfFile::ClassGUID(bool showErrors) const { GetVersionInfo(pPath, "ClassGUID", &pClassGUID, showErrors); *************** *** 319,323 **** } /////////////////////////////////////////////////////////////// ! const char *InfFile::Class(BOOL showErrors) const { GetVersionInfo(pPath, "Class", &pClass, showErrors); --- 322,326 ---- } /////////////////////////////////////////////////////////////// ! const char *InfFile::Class(bool showErrors) const { GetVersionInfo(pPath, "Class", &pClass, showErrors); *************** *** 326,330 **** } /////////////////////////////////////////////////////////////// ! const char *InfFile::Provider(BOOL showErrors) const { GetVersionInfo(pPath, "Provider", &pProvider, showErrors); --- 329,333 ---- } /////////////////////////////////////////////////////////////// ! const char *InfFile::Provider(bool showErrors) const { GetVersionInfo(pPath, "Provider", &pProvider, showErrors); *************** *** 333,337 **** } /////////////////////////////////////////////////////////////// ! const char *InfFile::DriverVer(BOOL showErrors) const { GetVersionInfo(pPath, "DriverVer", &pDriverVer, showErrors); --- 336,340 ---- } /////////////////////////////////////////////////////////////// ! const char *InfFile::DriverVer(bool showErrors) const { GetVersionInfo(pPath, "DriverVer", &pDriverVer, showErrors); *************** *** 340,344 **** } /////////////////////////////////////////////////////////////// ! const char *InfFile::UninstallInfTag(BOOL showErrors) const { GetVersionInfo(pPath, "UninstallInfTag", &pUninstallInfTag, showErrors); --- 343,347 ---- } /////////////////////////////////////////////////////////////// ! const char *InfFile::UninstallInfTag(bool showErrors) const { GetVersionInfo(pPath, "UninstallInfTag", &pUninstallInfTag, showErrors); *************** *** 371,375 **** } ! BOOL InfFile::UninstallFiles(const char *pFilesSection) const { if (!pPath) --- 374,378 ---- } ! bool InfFile::UninstallFiles(const char *pFilesSection) const { if (!pPath) *************** *** 414,423 **** } /////////////////////////////////////////////////////////////// ! BOOL InfFile::InstallOEMInf() const { if (!pPath) return FALSE; ! BOOL wasInstalled = (OemPath() != NULL); if (!SetupCopyOEMInf(pPath, NULL, SPOST_PATH, 0, NULL, 0, NULL, NULL)) { --- 417,426 ---- } /////////////////////////////////////////////////////////////// ! bool InfFile::InstallOEMInf() const { if (!pPath) return FALSE; ! bool wasInstalled = (OemPath() != NULL); if (!SetupCopyOEMInf(pPath, NULL, SPOST_PATH, 0, NULL, 0, NULL, NULL)) { *************** *** 434,438 **** } /////////////////////////////////////////////////////////////// ! static BOOL UninstallFile(const char *pPath) { int res; --- 437,441 ---- } /////////////////////////////////////////////////////////////// ! static bool UninstallFile(const char *pPath) { int res; *************** *** 459,463 **** } ! static BOOL UninstallInf(const char *pPath) { if (pPath == NULL) --- 462,466 ---- } ! static bool UninstallInf(const char *pPath) { if (pPath == NULL) *************** *** 523,530 **** return FALSE; ! return res; } /////////////////////////////////////////////////////////////// ! BOOL InfFile::UninstallOEMInf() const { if (!pPath) --- 526,533 ---- return FALSE; ! return TRUE; } /////////////////////////////////////////////////////////////// ! bool InfFile::UninstallOEMInf() const { if (!pPath) *************** *** 553,560 **** } /////////////////////////////////////////////////////////////// ! static BOOL TestUninstall( const InfFile &infFile, const InfFile::InfFileUninstall *pInfFileUninstallList, ! BOOL queryConfirmation) { for ( --- 556,563 ---- } /////////////////////////////////////////////////////////////// ! static bool TestUninstall( const InfFile &infFile, const InfFile::InfFileUninstall *pInfFileUninstallList, ! bool queryConfirmation) { for ( *************** *** 573,577 **** } ! BOOL InfFile::UninstallAllInfFiles( const InfFileUninstall *pInfFileUninstallList, const char *const *ppOemPathExcludeList) --- 576,580 ---- } ! bool InfFile::UninstallAllInfFiles( const InfFileUninstall *pInfFileUninstallList, const char *const *ppOemPathExcludeList) *************** *** 657,661 **** { InfFile infFile(infPath, NULL); ! BOOL doUninstall; if (IsPathInList(infFile.Path(), ppOemPathExcludeList)) { --- 660,664 ---- { InfFile infFile(infPath, NULL); ! bool doUninstall; if (IsPathInList(infFile.Path(), ppOemPathExcludeList)) { |
From: Vyacheslav F. <vf...@us...> - 2011-12-15 08:47:51
|
Update of /cvsroot/com0com/com0com/sys In directory vz-cvs-4.sog:/tmp/cvs-serv15695 Modified Files: precomp.h Log Message: Added ability to disable tracing code compiling by environment variable (SET C_DEFINES=/DENABLE_TRACING=0) Index: precomp.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/precomp.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** precomp.h 12 Jul 2011 18:15:37 -0000 1.6 --- precomp.h 15 Dec 2011 08:47:49 -0000 1.7 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.7 2011/12/15 08:47:49 vfrolov + * Added ability to disable tracing code compiling by environment variable + * (SET C_DEFINES=/DENABLE_TRACING=0) + * * Revision 1.6 2011/07/12 18:15:37 vfrolov * Discarded WDM garbage *************** *** 52,57 **** #ifndef NTDDI_WIN7 ! /* Declare stuff missing in old DDKs */ ! typedef VOID KDEFERRED_ROUTINE( --- 56,60 ---- #ifndef NTDDI_WIN7 ! /* Declarations missing in old DDKs */ typedef VOID KDEFERRED_ROUTINE( *************** *** 92,96 **** #endif /* NTDDI_WIN7 */ ! #define ENABLE_TRACING 1 #include "com0com.h" --- 95,101 ---- #endif /* NTDDI_WIN7 */ ! #ifndef ENABLE_TRACING ! #define ENABLE_TRACING 1 ! #endif #include "com0com.h" |
From: Vyacheslav F. <vf...@us...> - 2011-12-15 06:17:15
|
Update of /cvsroot/com0com/com0com/sys In directory vz-cvs-4.sog:/tmp/cvs-serv30226 Modified Files: adddev.c initunlo.c syslog.c syslog.h trace.c Log Message: Removed usage undocumented PDRIVER_OBJECT->Type Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/trace.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** trace.c 26 Jul 2011 16:06:33 -0000 1.39 --- trace.c 15 Dec 2011 06:17:12 -0000 1.40 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.40 2011/12/15 06:17:12 vfrolov + * Removed usage undocumented PDRIVER_OBJECT->Type + * * Revision 1.39 2011/07/26 16:06:33 vfrolov * Added PID tracing on IRP_MJ_CLOSE *************** *** 227,231 **** if (!NT_SUCCESS(status)) { ! SysLog(pDrvObj, status, L"QueryRegistryTrace FAIL"); return; } --- 230,234 ---- if (!NT_SUCCESS(status)) { ! SysLogDrv(pDrvObj, status, L"QueryRegistryTrace FAIL"); return; } *************** *** 271,275 **** if (!NT_SUCCESS(status)) { ! SysLog(pDrvObj, status, L"QueryRegistryTraceEnable FAIL"); return; } --- 274,278 ---- if (!NT_SUCCESS(status)) { ! SysLogDrv(pDrvObj, status, L"QueryRegistryTraceEnable FAIL"); return; } *************** *** 613,617 **** return _AnsiStrVaFormat(pDestStr, pSize, pFmt, va); } except (EXCEPTION_EXECUTE_HANDLER) { ! SysLog(pDrvObj, GetExceptionCode(), L"AnsiStrVaFormat EXCEPTION"); *pSize = oldSize; return pDestStr; --- 616,620 ---- return _AnsiStrVaFormat(pDestStr, pSize, pFmt, va); } except (EXCEPTION_EXECUTE_HANDLER) { ! SysLogDrv(pDrvObj, GetExceptionCode(), L"AnsiStrVaFormat EXCEPTION"); *pSize = oldSize; return pDestStr; *************** *** 977,981 **** NTSTATUS TraceWrite( - IN PVOID pIoObject, IN HANDLE handle, IN PCHAR pStr) --- 980,983 ---- *************** *** 1000,1004 **** if (!NT_SUCCESS(status)) { pTraceData->errorCount++; ! SysLog(pIoObject, status, L"TraceWrite ZwWriteFile FAIL"); } --- 1002,1006 ---- if (!NT_SUCCESS(status)) { pTraceData->errorCount++; ! SysLogDrv(pDrvObj, status, L"TraceWrite ZwWriteFile FAIL"); } *************** *** 1006,1015 **** } ! VOID TraceOutput( ! IN PC0C_COMMON_EXTENSION pDevExt, ! IN PCHAR pStr) { NTSTATUS status; - PVOID pIoObject; HANDLE handle; OBJECT_ATTRIBUTES objectAttributes; --- 1008,1014 ---- } ! VOID TraceOutput(IN PCHAR pStr) { NTSTATUS status; HANDLE handle; OBJECT_ATTRIBUTES objectAttributes; *************** *** 1019,1023 **** if (pTraceData->errorCount < (TRACE_ERROR_LIMIT + 100)) { pTraceData->errorCount += 100; ! SysLog(pDrvObj, STATUS_SUCCESS, L"Trace disabled"); } return; --- 1018,1022 ---- if (pTraceData->errorCount < (TRACE_ERROR_LIMIT + 100)) { pTraceData->errorCount += 100; ! SysLogDrv(pDrvObj, STATUS_SUCCESS, L"Trace disabled"); } return; *************** *** 1058,1066 **** } - if (pDevExt) - pIoObject = pDevExt->pDevObj; - else - pIoObject = pDrvObj; - HALT_UNLESS(TRACE_FILE_OK); InitializeObjectAttributes( --- 1057,1060 ---- *************** *** 1117,1121 **** if (lenBuf) ! TraceWrite(pIoObject, handle, pBuf->buf); } --- 1111,1115 ---- if (lenBuf) ! TraceWrite(handle, pBuf->buf); } *************** *** 1126,1130 **** AnsiStrFormat(pDestStr, &tmp_size, "*** skipped %lu lines ***\r\n", (long)skipped); ! TraceWrite(pIoObject, handle, pBuf->buf); } --- 1120,1124 ---- AnsiStrFormat(pDestStr, &tmp_size, "*** skipped %lu lines ***\r\n", (long)skipped); ! TraceWrite(handle, pBuf->buf); } *************** *** 1137,1141 **** pDestStr = AnsiStrFormat(pDestStr, &size, " %s\r\n", pStr); ! TraceWrite(pIoObject, handle, pBuf->buf); } --- 1131,1135 ---- pDestStr = AnsiStrFormat(pDestStr, &size, " %s\r\n", pStr); ! TraceWrite(handle, pBuf->buf); } *************** *** 1147,1156 **** if (!NT_SUCCESS(status)) { pTraceData->errorCount++; ! SysLog(pIoObject, status, L"TraceOutput ZwClose FAIL"); } } else { pTraceData->errorCount++; ! SysLog(pIoObject, status, L"TraceOutput ZwCreateFile FAIL"); } } --- 1141,1150 ---- if (!NT_SUCCESS(status)) { pTraceData->errorCount++; ! SysLogDrv(pDrvObj, status, L"TraceOutput ZwClose FAIL"); } } else { pTraceData->errorCount++; ! SysLogDrv(pDrvObj, status, L"TraceOutput ZwCreateFile FAIL"); } } *************** *** 1182,1186 **** va_end(va); ! TraceOutput(pDevExt, pBuf->buf); FreeTraceBuf(pBuf); } --- 1176,1180 ---- va_end(va); ! TraceOutput(pBuf->buf); FreeTraceBuf(pBuf); } *************** *** 1206,1210 **** if (!pTraceData) { ! SysLog(pDrvObj, STATUS_INSUFFICIENT_RESOURCES, L"TraceEnable C0C_ALLOCATE_POOL FAIL"); return; } --- 1200,1204 ---- if (!pTraceData) { ! SysLogDrv(pDrvObj, STATUS_INSUFFICIENT_RESOURCES, L"TraceEnable C0C_ALLOCATE_POOL FAIL"); return; } *************** *** 1232,1236 **** if (NT_SUCCESS(status)) ! SysLog(pDrvObj, status, msg.Buffer); StrFree(&msg); --- 1226,1230 ---- if (NT_SUCCESS(status)) ! SysLogDrv(pDrvObj, status, msg.Buffer); StrFree(&msg); *************** *** 1241,1245 **** if (pTraceData->errorCount) { TraceDisable(); ! SysLog(pDrvObj, STATUS_SUCCESS, L"Trace disabled"); } } --- 1235,1239 ---- if (pTraceData->errorCount) { TraceDisable(); ! SysLogDrv(pDrvObj, STATUS_SUCCESS, L"Trace disabled"); } } *************** *** 1304,1308 **** } ! TraceOutput(pDevExt, pBuf->buf); FreeTraceBuf(pBuf); } --- 1298,1302 ---- } ! TraceOutput(pBuf->buf); FreeTraceBuf(pBuf); } *************** *** 1329,1333 **** pDestStr = AnsiStrCopyMask(pDestStr, &size, pTable, mask); ! TraceOutput(pDevExt, pBuf->buf); FreeTraceBuf(pBuf); } --- 1323,1327 ---- pDestStr = AnsiStrCopyMask(pDestStr, &size, pTable, mask); ! TraceOutput(pBuf->buf); FreeTraceBuf(pBuf); } *************** *** 1397,1401 **** if (!(enableMask & TRACE_ENABLE_IRP)) { ! TraceOutput(pDevExt, NULL); return; } --- 1391,1395 ---- if (!(enableMask & TRACE_ENABLE_IRP)) { ! TraceOutput(NULL); return; } *************** *** 1767,1771 **** } ! TraceOutput(pDevExt, pBuf->buf); FreeTraceBuf(pBuf); } --- 1761,1765 ---- } ! TraceOutput(pBuf->buf); FreeTraceBuf(pBuf); } Index: syslog.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/syslog.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** syslog.c 26 Jan 2005 12:18:54 -0000 1.1 --- syslog.c 15 Dec 2011 06:17:12 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2005 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2011/12/15 06:17:12 vfrolov + * Removed usage undocumented PDRIVER_OBJECT->Type + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 33,37 **** IN PVOID pIoObject, IN NTSTATUS status, ! IN PWCHAR pStr) { PIO_ERROR_LOG_PACKET pErrorLogEntry; --- 36,41 ---- IN PVOID pIoObject, IN NTSTATUS status, ! IN PWCHAR pStr, ! IN NTSTATUS msgId) { PIO_ERROR_LOG_PACKET pErrorLogEntry; *************** *** 54,61 **** RtlZeroMemory(pInsert, lenInsert); ! if (((PDRIVER_OBJECT)pIoObject)->Type == IO_TYPE_DRIVER) ! pErrorLogEntry->ErrorCode = COM0COM_LOG_DRV; ! else ! pErrorLogEntry->ErrorCode = COM0COM_LOG; pErrorLogEntry->SequenceNumber = 0; --- 58,62 ---- RtlZeroMemory(pInsert, lenInsert); ! pErrorLogEntry->ErrorCode = msgId; pErrorLogEntry->SequenceNumber = 0; *************** *** 72,73 **** --- 73,90 ---- IoWriteErrorLogEntry(pErrorLogEntry); } + + VOID SysLogDrv( + IN PDRIVER_OBJECT pDrvObj, + IN NTSTATUS status, + IN PWCHAR pStr) + { + SysLog(pDrvObj, status, pStr, COM0COM_LOG_DRV); + } + + VOID SysLogDev( + IN PDEVICE_OBJECT pDevObj, + IN NTSTATUS status, + IN PWCHAR pStr) + { + SysLog(pDevObj, status, pStr, COM0COM_LOG); + } Index: initunlo.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/initunlo.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** initunlo.c 9 Aug 2010 06:02:40 -0000 1.8 --- initunlo.c 15 Dec 2011 06:17:12 -0000 1.9 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2011/12/15 06:17:12 vfrolov + * Removed usage undocumented PDRIVER_OBJECT->Type + * * Revision 1.8 2010/08/09 06:02:40 vfrolov * Eliminated accessing undocumented structure members *************** *** 68,72 **** if (!NT_SUCCESS(status)) { ! SysLog(pDrvObj, status, L"DriverEntry FAIL"); return status; } --- 71,75 ---- if (!NT_SUCCESS(status)) { ! SysLogDrv(pDrvObj, status, L"DriverEntry FAIL"); return status; } Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** adddev.c 6 Dec 2011 16:03:22 -0000 1.39 --- adddev.c 15 Dec 2011 06:17:12 -0000 1.40 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.40 2011/12/15 06:17:12 vfrolov + * Removed usage undocumented PDRIVER_OBJECT->Type + * * Revision 1.39 2011/12/06 16:03:22 vfrolov * Added cleaning high data bits for less then 8 bit data *************** *** 186,190 **** if (!HidePort(pDevExt)) ! SysLog(pDevExt->pDevObj, STATUS_UNSUCCESSFUL, L"RemoveFdoPort HidePort FAIL"); if (pDevExt->symbolicLinkName.Buffer) --- 189,193 ---- if (!HidePort(pDevExt)) ! SysLogDev(pDevExt->pDevObj, STATUS_UNSUCCESSFUL, L"RemoveFdoPort HidePort FAIL"); if (pDevExt->symbolicLinkName.Buffer) *************** *** 224,228 **** if (!NT_SUCCESS(status)) { ! SysLog(pPhDevObj, status, L"AddFdoPort IoGetDeviceProperty FAIL"); goto clean; } --- 227,231 ---- if (!NT_SUCCESS(status)) { ! SysLogDev(pPhDevObj, status, L"AddFdoPort IoGetDeviceProperty FAIL"); goto clean; } *************** *** 232,236 **** if (!pPhDevExt || pPhDevExt->doType != C0C_DOTYPE_PP) { status = STATUS_UNSUCCESSFUL; ! SysLog(pPhDevObj, status, L"AddFdoPort FAIL. Type of PDO is not PP"); goto clean; } --- 235,239 ---- if (!pPhDevExt || pPhDevExt->doType != C0C_DOTYPE_PP) { status = STATUS_UNSUCCESSFUL; ! SysLogDev(pPhDevObj, status, L"AddFdoPort FAIL. Type of PDO is not PP"); goto clean; } *************** *** 242,246 **** if (!*pPhPortName) { status = STATUS_UNSUCCESSFUL; ! SysLog(pPhDevObj, status, L"AddFdoPort FAIL. The PDO has invalid port name"); goto clean; } --- 245,249 ---- if (!*pPhPortName) { status = STATUS_UNSUCCESSFUL; ! SysLogDev(pPhDevObj, status, L"AddFdoPort FAIL. The PDO has invalid port name"); goto clean; } *************** *** 413,417 **** if (!NT_SUCCESS(status)) { ! SysLog(pPhDevObj, status, L"AddFdoPort FAIL"); goto clean; } --- 416,420 ---- if (!NT_SUCCESS(status)) { ! SysLogDev(pPhDevObj, status, L"AddFdoPort FAIL"); goto clean; } *************** *** 426,430 **** if (!NT_SUCCESS(status)) { ! SysLog(pPhDevObj, status, L"AddFdoPort IoCreateDevice FAIL"); goto clean; } --- 429,433 ---- if (!NT_SUCCESS(status)) { ! SysLogDev(pPhDevObj, status, L"AddFdoPort IoCreateDevice FAIL"); goto clean; } *************** *** 438,442 **** if (!NT_SUCCESS(status)) { ! SysLog(pPhDevObj, status, L"AddFdoPort FAIL"); goto clean; } --- 441,445 ---- if (!NT_SUCCESS(status)) { ! SysLogDev(pPhDevObj, status, L"AddFdoPort FAIL"); goto clean; } *************** *** 448,452 **** Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Enabled baudrate emulation"); else ! SysLog(pPhDevObj, status, L"AddFdoPort AllocWriteDelay FAIL"); } else { Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Disabled baudrate emulation"); --- 451,455 ---- Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Enabled baudrate emulation"); else ! SysLogDev(pPhDevObj, status, L"AddFdoPort AllocWriteDelay FAIL"); } else { Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Disabled baudrate emulation"); *************** *** 537,541 **** if (!pDevExt->pLowDevObj) { status = STATUS_NO_SUCH_DEVICE; ! SysLog(pPhDevObj, status, L"AddFdoPort IoAttachDeviceToDeviceStack FAIL"); goto clean; } --- 540,544 ---- if (!pDevExt->pLowDevObj) { status = STATUS_NO_SUCH_DEVICE; ! SysLogDev(pPhDevObj, status, L"AddFdoPort IoAttachDeviceToDeviceStack FAIL"); goto clean; } *************** *** 557,561 **** StrFree(&pDevExt->ntDeviceName); ! SysLog(pPhDevObj, status, L"AddFdoPort StrAppendStr0 FAIL"); } --- 560,564 ---- StrFree(&pDevExt->ntDeviceName); ! SysLogDev(pPhDevObj, status, L"AddFdoPort StrAppendStr0 FAIL"); } *************** *** 566,570 **** if (!NT_SUCCESS(status)) { ! SysLog(pPhDevObj, status, L"AddFdoPort IoRegisterDeviceInterface FAIL"); pDevExt->symbolicLinkName.Buffer = NULL; } --- 569,573 ---- if (!NT_SUCCESS(status)) { ! SysLogDev(pPhDevObj, status, L"AddFdoPort IoRegisterDeviceInterface FAIL"); pDevExt->symbolicLinkName.Buffer = NULL; } *************** *** 572,576 **** if (!pDevExt->pIoPortLocal->plugInMode || pDevExt->pIoPortLocal->pIoPortRemote->isOpen) { if (!ShowPort(pDevExt)) ! SysLog(pDevExt->pDevObj, STATUS_UNSUCCESSFUL, L"AddFdoPort ShowPort FAIL"); } else { HidePortName(pDevExt); --- 575,579 ---- if (!pDevExt->pIoPortLocal->plugInMode || pDevExt->pIoPortLocal->pIoPortRemote->isOpen) { if (!ShowPort(pDevExt)) ! SysLogDev(pDevExt->pDevObj, STATUS_UNSUCCESSFUL, L"AddFdoPort ShowPort FAIL"); } else { HidePortName(pDevExt); *************** *** 624,628 **** if (!NT_SUCCESS(status)) { ! SysLog(pBusExt->pDevObj, status, L"AddPdoPort FAIL"); goto clean; } --- 627,631 ---- if (!NT_SUCCESS(status)) { ! SysLogDev(pBusExt->pDevObj, status, L"AddPdoPort FAIL"); goto clean; } *************** *** 637,641 **** if (!NT_SUCCESS(status)) { ! SysLog(pBusExt->pDevObj, status, L"AddPdoPort IoCreateDevice FAIL"); goto clean; } --- 640,644 ---- if (!NT_SUCCESS(status)) { ! SysLogDev(pBusExt->pDevObj, status, L"AddPdoPort IoCreateDevice FAIL"); goto clean; } *************** *** 649,653 **** if (!NT_SUCCESS(status)) { ! SysLog(pBusExt->pDevObj, status, L"AddPdoPort FAIL"); goto clean; } --- 652,656 ---- if (!NT_SUCCESS(status)) { ! SysLogDev(pBusExt->pDevObj, status, L"AddPdoPort FAIL"); goto clean; } *************** *** 789,798 **** if (!NT_SUCCESS(status)) ! SysLog(pPhDevObj, status, L"ZwSetValueKey(PortName) FAIL"); } ZwClose(hKey); } else { ! SysLog(pPhDevObj, status, L"GetPortNum IoOpenDeviceRegistryKey(PLUGPLAY_REGKEY_DEVICE) FAIL"); num = ListFdoBusGetFreeNum(); --- 792,801 ---- if (!NT_SUCCESS(status)) ! SysLogDev(pPhDevObj, status, L"ZwSetValueKey(PortName) FAIL"); } ZwClose(hKey); } else { ! SysLogDev(pPhDevObj, status, L"GetPortNum IoOpenDeviceRegistryKey(PLUGPLAY_REGKEY_DEVICE) FAIL"); num = ListFdoBusGetFreeNum(); *************** *** 823,827 **** if (!NT_SUCCESS(status)) { ! SysLog(pDrvObj, status, L"AddFdoBus FAIL"); goto clean; } --- 826,830 ---- if (!NT_SUCCESS(status)) { ! SysLogDrv(pDrvObj, status, L"AddFdoBus FAIL"); goto clean; } *************** *** 836,840 **** if (!NT_SUCCESS(status)) { ! SysLog(pDrvObj, status, L"AddFdoBus IoCreateDevice FAIL"); goto clean; } --- 839,843 ---- if (!NT_SUCCESS(status)) { ! SysLogDrv(pDrvObj, status, L"AddFdoBus IoCreateDevice FAIL"); goto clean; } *************** *** 849,853 **** if (!NT_SUCCESS(status)) { ! SysLog(pDrvObj, status, L"AddFdoBus InitCommonExt FAIL"); goto clean; } --- 852,856 ---- if (!NT_SUCCESS(status)) { ! SysLogDrv(pDrvObj, status, L"AddFdoBus InitCommonExt FAIL"); goto clean; } *************** *** 857,861 **** if (!pDevExt->pLowDevObj) { status = STATUS_NO_SUCH_DEVICE; ! SysLog(pNewDevObj, status, L"AddFdoBus IoAttachDeviceToDeviceStack FAIL"); goto clean; } --- 860,864 ---- if (!pDevExt->pLowDevObj) { status = STATUS_NO_SUCH_DEVICE; ! SysLogDev(pNewDevObj, status, L"AddFdoBus IoAttachDeviceToDeviceStack FAIL"); goto clean; } *************** *** 890,894 **** if (!NT_SUCCESS(status)) { ! SysLog(pNewDevObj, status, L"AddFdoBus AddPdoPort FAIL"); pDevExt->childs[i].pDevExt = NULL; goto clean; --- 893,897 ---- if (!NT_SUCCESS(status)) { ! SysLogDev(pNewDevObj, status, L"AddFdoBus AddPdoPort FAIL"); pDevExt->childs[i].pDevExt = NULL; goto clean; *************** *** 922,926 **** Trace00(NULL, L"c0cAddDevice for ", property.Buffer); else { ! SysLog(pDrvObj, status, L"c0cAddDevice IoGetDeviceProperty FAIL"); return status; } --- 925,929 ---- Trace00(NULL, L"c0cAddDevice for ", property.Buffer); else { ! SysLogDrv(pDrvObj, status, L"c0cAddDevice IoGetDeviceProperty FAIL"); return status; } *************** *** 938,942 **** StrFree(&property); status = STATUS_UNSUCCESSFUL; ! SysLog(pDrvObj, status, L"c0cAddDevice unknown HardwareID"); } --- 941,945 ---- StrFree(&property); status = STATUS_UNSUCCESSFUL; ! SysLogDrv(pDrvObj, status, L"c0cAddDevice unknown HardwareID"); } Index: syslog.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/syslog.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** syslog.h 26 Jan 2005 12:18:54 -0000 1.1 --- syslog.h 15 Dec 2011 06:17:12 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2005 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2011/12/15 06:17:12 vfrolov + * Removed usage undocumented PDRIVER_OBJECT->Type + * * Revision 1.1 2005/01/26 12:18:54 vfrolov * Initial revision *************** *** 29,34 **** #define _C0C_SYSLOG_H_ ! VOID SysLog( ! IN PVOID pIoObject, IN NTSTATUS status, IN PWCHAR pStr); --- 32,42 ---- #define _C0C_SYSLOG_H_ ! VOID SysLogDrv( ! IN PDRIVER_OBJECT pDrvObj, ! IN NTSTATUS status, ! IN PWCHAR pStr); ! ! VOID SysLogDev( ! IN PDEVICE_OBJECT pDevObj, IN NTSTATUS status, IN PWCHAR pStr); |
From: Vyacheslav F. <vf...@us...> - 2011-12-13 15:25:43
|
Update of /cvsroot/com0com/com0com In directory vz-cvs-4.sog:/tmp/cvs-serv31745 Modified Files: ReadMe.txt Log Message: Added about suppressing PNP-related UI messages (thanks Dmitry) Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ReadMe.txt 12 Dec 2011 13:22:15 -0000 1.32 --- ReadMe.txt 13 Dec 2011 15:25:40 -0000 1.33 *************** *** 252,256 **** update command, for example: ! command> update Q. How to monitor and get the paired port settings (baud rate, byte size, parity --- 252,267 ---- update command, for example: ! setupc install - - ! setupc update ! ! Additionally you can temporary suppress Plug and Play-related UI messages, for ! example: ! ! reg add HKLM\Software\Policies\Microsoft\Windows\DeviceInstall\Settings /v SuppressNewHWUI /t REG_DWORD /d 1 /f ! setupc install - - ! setupc update ! reg add HKLM\Software\Policies\Microsoft\Windows\DeviceInstall\Settings /v SuppressNewHWUI /t REG_DWORD /d 0 /f ! ! See http://support.microsoft.com/kb/938596 for more info. Q. How to monitor and get the paired port settings (baud rate, byte size, parity |
From: Vyacheslav F. <vf...@us...> - 2011-12-12 13:22:17
|
Update of /cvsroot/com0com/com0com In directory vz-cvs-4.sog:/tmp/cvs-serv1110 Modified Files: ReadMe.txt Log Message: Added CNC_INSTALL_SKIP_SETUP_PREINSTALL and CNC_UNINSTALL_SKIP_SETUP_UNINSTALL environment variables Added cancelling Found New Hardware Wizard by update command Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ReadMe.txt 6 Dec 2011 15:44:40 -0000 1.31 --- ReadMe.txt 12 Dec 2011 13:22:15 -0000 1.32 *************** *** 126,135 **** http://nsis.sourceforge.net/Docs/Chapter3.html#3.2 ! Additionally the following environment variables can be used to change ! behaviour of setup.exe ! CNC_INSTALL_START_MENU_SHORTCUTS={YES|NO} - select/unselect "Start Menu Shortcuts" ! CNC_INSTALL_CNCA0_CNCB0_PORTS={YES|NO} - select/unselect "CNCA0 <-> CNCB0" ! CNC_INSTALL_COMX_COMX_PORTS={YES|NO} - select/unselect "COM# <-> COM#" Q. Is it possible to change the names CNCA0 and CNCB0 to COM2 and COM3? --- 126,141 ---- http://nsis.sourceforge.net/Docs/Chapter3.html#3.2 ! Additionally the following environment variables can be used. ! To change behaviour of setup.exe: ! ! CNC_INSTALL_START_MENU_SHORTCUTS={YES|NO} - select/unselect "Start Menu Shortcuts" ! CNC_INSTALL_CNCA0_CNCB0_PORTS={YES|NO} - select/unselect "CNCA0 <-> CNCB0" ! CNC_INSTALL_COMX_COMX_PORTS={YES|NO} - select/unselect "COM# <-> COM#" ! CNC_INSTALL_SKIP_SETUP_PREINSTALL={YES|NO} - skip preinstalling/updating driver ! ! To change behaviour of uninstall.exe: ! ! CNC_UNINSTALL_SKIP_SETUP_UNINSTALL={YES|NO} - skip uninstalling devices and driver Q. Is it possible to change the names CNCA0 and CNCB0 to COM2 and COM3? *************** *** 243,246 **** --- 249,257 ---- Windows Driver Kit (WDK). + Alternatively you can cancel Found New Hardware Wizard and install driver by + update command, for example: + + command> update + Q. How to monitor and get the paired port settings (baud rate, byte size, parity and stop bits)? |
From: Vyacheslav F. <vf...@us...> - 2011-12-12 13:17:45
|
Update of /cvsroot/com0com/com0com/NSIS In directory vz-cvs-4.sog:/tmp/cvs-serv32346 Modified Files: install.nsi Log Message: Added CNC_INSTALL_SKIP_SETUP_PREINSTALL and CNC_UNINSTALL_SKIP_SETUP_UNINSTALL environment variables Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** install.nsi 14 Jul 2011 15:02:41 -0000 1.23 --- install.nsi 12 Dec 2011 13:17:43 -0000 1.24 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.24 2011/12/12 13:17:43 vfrolov + * Added CNC_INSTALL_SKIP_SETUP_PREINSTALL and CNC_UNINSTALL_SKIP_SETUP_UNINSTALL environment variables + * * Revision 1.23 2011/07/14 15:02:41 vfrolov * Added packaging com0com.cat (if file exists) *************** *** 408,425 **** WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "NoRepair" 1 ! GetTempFileName $0 ! StrCpy $1 "" ! IfSilent 0 +2 ! StrCpy $1 "--silent" ! ExecWait '"$INSTDIR\setupc.exe" $1 --output "$0" preinstall' ! !insertmacro MoveFileToDetails $0 ! ExecWait '"$INSTDIR\setupc.exe" $1 --output "$0" update' ! !insertmacro MoveFileToDetails $0 ! ExecWait '"$INSTDIR\setupc.exe" $1 --output "$0" infclean' ! !insertmacro MoveFileToDetails $0 SectionEnd --- 411,435 ---- WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "NoRepair" 1 ! ReadEnvStr $0 "CNC_INSTALL_SKIP_SETUP_PREINSTALL" ! StrCpy $0 $0 1 ! ${Select} $0 ! ${Case2} "Y" "y" ! DetailPrint 'Skipped "$INSTDIR\setupc.exe" preinstall/update/infclean' ! ${CaseElse} ! GetTempFileName $0 ! StrCpy $1 "" ! IfSilent 0 +2 ! StrCpy $1 "--silent" ! ExecWait '"$INSTDIR\setupc.exe" $1 --output "$0" preinstall' ! !insertmacro MoveFileToDetails $0 ! ExecWait '"$INSTDIR\setupc.exe" $1 --output "$0" update' ! !insertmacro MoveFileToDetails $0 ! ExecWait '"$INSTDIR\setupc.exe" $1 --output "$0" infclean' ! !insertmacro MoveFileToDetails $0 ! ${EndSelect} SectionEnd *************** *** 541,552 **** SetOutPath $INSTDIR ! GetTempFileName $0 ! StrCpy $1 "" ! IfSilent 0 +2 ! StrCpy $1 "--silent" ! ExecWait '"$INSTDIR\setupc.exe" $1 --output "$0" uninstall' ! !insertmacro MoveFileToDetails $0 ; Remove registry keys --- 551,569 ---- SetOutPath $INSTDIR ! ReadEnvStr $0 "CNC_UNINSTALL_SKIP_SETUP_UNINSTALL" ! StrCpy $0 $0 1 ! ${Select} $0 ! ${Case2} "Y" "y" ! DetailPrint 'Skipped "$INSTDIR\setupc.exe" uninstall' ! ${CaseElse} ! GetTempFileName $0 ! StrCpy $1 "" ! IfSilent 0 +2 ! StrCpy $1 "--silent" ! ExecWait '"$INSTDIR\setupc.exe" $1 --output "$0" uninstall' ! !insertmacro MoveFileToDetails $0 ! ${EndSelect} ; Remove registry keys |
From: Vyacheslav F. <vf...@us...> - 2011-12-08 09:38:26
|
Update of /cvsroot/com0com/hub4com/plugins/tcp In directory vz-cvs-4.sog:/tmp/cvs-serv8135 Modified Files: comio.cpp Log Message: Fixed compile warning Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/comio.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** comio.cpp 26 Jul 2011 11:59:14 -0000 1.12 --- comio.cpp 8 Dec 2011 09:38:23 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2011/12/08 09:38:23 vfrolov + * Fixed compile warning + * * Revision 1.12 2011/07/26 11:59:14 vfrolov * Replaced strerror() by FormatMessage() *************** *** 217,223 **** IN DWORD_PTR dwCallbackData) { ! ConditionProcData *pCpd = (ConditionProcData *)dwCallbackData; ! ! _ASSERTE(pCpd != NULL); if (lpCallerId) --- 220,224 ---- IN DWORD_PTR dwCallbackData) { ! _ASSERTE((ConditionProcData *)dwCallbackData != NULL); if (lpCallerId) |
From: Vyacheslav F. <vf...@us...> - 2011-12-08 09:32:06
|
Update of /cvsroot/com0com/com0com/setup In directory vz-cvs-4.sog:/tmp/cvs-serv7692 Modified Files: msg.cpp Log Message: Fixed unreadable console output by changing LANG_NEUTRAL to LANG_ENGLISH Index: msg.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/msg.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** msg.cpp 15 Jul 2011 16:09:05 -0000 1.11 --- msg.cpp 8 Dec 2011 09:32:04 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2011/12/08 09:32:04 vfrolov + * Fixed unreadable console output by changing LANG_NEUTRAL to LANG_ENGLISH + * * Revision 1.11 2011/07/15 16:09:05 vfrolov * Disabled MessageBox() for silent mode and added default processing *************** *** 198,202 **** NULL, err, ! MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), (LPTSTR) &pMsgBuf, 0, --- 201,205 ---- NULL, err, ! MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPTSTR) &pMsgBuf, 0, |
From: Vyacheslav F. <vf...@us...> - 2011-12-08 09:20:46
|
Update of /cvsroot/com0com/hub4com/examples In directory vz-cvs-4.sog:/tmp/cvs-serv5843 Modified Files: com2tcp-rfc2217.bat Log Message: Added --share-com-port option Index: com2tcp-rfc2217.bat =================================================================== RCS file: /cvsroot/com0com/hub4com/examples/com2tcp-rfc2217.bat,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** com2tcp-rfc2217.bat 7 Nov 2011 14:27:42 -0000 1.8 --- com2tcp-rfc2217.bat 8 Dec 2011 09:20:43 -0000 1.9 *************** *** 23,26 **** --- 23,31 ---- :END_OPTION_TRACE + IF /I "%OPTION%" NEQ "--share-com-port" GOTO END_OPTION_SHARE_COM_PORT + SET OPTIONS=%OPTIONS% --share-mode=on + GOTO BEGIN_PARSE_OPTIONS + :END_OPTION_SHARE_COM_PORT + IF /I "%OPTION%" NEQ "--interface" GOTO END_OPTION_INTERFACE SET OPTIONS=%OPTIONS% --interface=%~1 *************** *** 175,178 **** --- 180,186 ---- ECHO --keep-active ^<s^> - send NOP command every ^<s^> seconds to keep the ECHO connection active if data is not transferred. + ECHO --share-com-port - open the com port on connecting and close it on + ECHO disconnecting. By default the com port is open + ECHO permanently. ECHO --trace - enable trace output. ECHO --help - show this help. |
From: Vyacheslav F. <vf...@us...> - 2011-12-06 16:03:25
|
Update of /cvsroot/com0com/com0com/sys In directory vz-cvs-4.sog:/tmp/cvs-serv15824/sys Modified Files: adddev.c bufutils.c com0com.h Log Message: Added cleaning high data bits for less then 8 bit data Added AllDataBits option to force 8 bit data Index: bufutils.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/bufutils.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** bufutils.c 4 Aug 2010 10:38:55 -0000 1.18 --- bufutils.c 6 Dec 2011 16:03:22 -0000 1.19 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.19 2011/12/06 16:03:22 vfrolov + * Added cleaning high data bits for less then 8 bit data + * Added AllDataBits option to force 8 bit data + * * Revision 1.18 2010/08/04 10:38:55 vfrolov * Minimized PREfast noise *************** *** 225,228 **** --- 229,246 ---- PC0C_IO_PORT pIoPort = pFlowFilter->pIoPort; PC0C_IO_PORT pIoPortRemote = pIoPort->pIoPortRemote; + UCHAR dataMask; + + { + static const UCHAR masks[] = {0x00, 0x01, 0x03, 0x07, 0x0F, 0x1F, 0x3F, 0x7F, 0xFF}; + UCHAR wordLength = 8; + + if (!pIoPort->allDataBits && wordLength > pIoPort->lineControl.WordLength) + wordLength = pIoPort->lineControl.WordLength; + + if (!pIoPortRemote->allDataBits && wordLength > pIoPortRemote->lineControl.WordLength) + wordLength = pIoPortRemote->lineControl.WordLength; + + dataMask = masks[wordLength]; + } for (writeDone = 0 ; writeDone < writeLength && (readLength || pReadBuf == NULL) ; writeDone++) { *************** *** 297,300 **** --- 315,319 ---- } + curChar &= dataMask; pFlowFilter->rxCount++; Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** adddev.c 9 Aug 2010 06:02:40 -0000 1.38 --- adddev.c 6 Dec 2011 16:03:22 -0000 1.39 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.39 2011/12/06 16:03:22 vfrolov + * Added cleaning high data bits for less then 8 bit data + * Added AllDataBits option to force 8 bit data + * * Revision 1.38 2010/08/09 06:02:40 vfrolov * Eliminated accessing undocumented structure members *************** *** 205,209 **** PC0C_FDOPORT_EXTENSION pDevExt; PC0C_PDOPORT_EXTENSION pPhDevExt; ! ULONG emuBR, emuOverrun, plugInMode, exclusiveMode, hiddenMode; ULONG brokeCharsProbability; ULONG addRTTO, addRITO; --- 209,213 ---- PC0C_FDOPORT_EXTENSION pDevExt; PC0C_PDOPORT_EXTENSION pPhDevExt; ! ULONG emuBR, emuOverrun, plugInMode, exclusiveMode, hiddenMode, allDataBits; ULONG brokeCharsProbability; ULONG addRTTO, addRITO; *************** *** 311,314 **** --- 315,319 ---- exclusiveMode = C0C_DEFAULT_EXCLUSIVEMODE; hiddenMode = C0C_DEFAULT_HIDDENMODE; + allDataBits = C0C_DEFAULT_ALLDATABITS; pinCTS = C0C_DEFAULT_PIN_CTS; pinDSR = C0C_DEFAULT_PIN_DSR; *************** *** 320,324 **** if (NT_SUCCESS(status)) { ! RTL_QUERY_REGISTRY_TABLE queryTable[13]; int i; --- 325,329 ---- if (NT_SUCCESS(status)) { ! RTL_QUERY_REGISTRY_TABLE queryTable[14]; int i; *************** *** 357,360 **** --- 362,370 ---- i++; + queryTable[i].Name = L"AllDataBits"; + queryTable[i].EntryContext = &allDataBits; + queryTable[i].DefaultData = &allDataBits; + + i++; queryTable[i].Name = L"cts"; queryTable[i].EntryContext = &pinCTS; *************** *** 467,470 **** --- 477,488 ---- } + if (allDataBits) { + pDevExt->pIoPortLocal->allDataBits = TRUE; + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Enabled all data bits"); + } else { + pDevExt->pIoPortLocal->allDataBits = FALSE; + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Disabled all data bits"); + } + SetHiddenMode(pDevExt, hiddenMode); Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** com0com.h 9 Aug 2010 06:02:40 -0000 1.51 --- com0com.h 6 Dec 2011 16:03:22 -0000 1.52 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.52 2011/12/06 16:03:22 vfrolov + * Added cleaning high data bits for less then 8 bit data + * Added AllDataBits option to force 8 bit data + * * Revision 1.51 2010/08/09 06:02:40 vfrolov * Eliminated accessing undocumented structure members *************** *** 372,375 **** --- 376,380 ---- BOOLEAN plugInMode; BOOLEAN exclusiveMode; + BOOLEAN allDataBits; BOOLEAN isComClass; } C0C_IO_PORT, *PC0C_IO_PORT; |
From: Vyacheslav F. <vf...@us...> - 2011-12-06 16:03:24
|
Update of /cvsroot/com0com/com0com/include In directory vz-cvs-4.sog:/tmp/cvs-serv15824/include Modified Files: com0com.h Log Message: Added cleaning high data bits for less then 8 bit data Added AllDataBits option to force 8 bit data Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/include/com0com.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** com0com.h 1 Jun 2010 06:14:10 -0000 1.12 --- com0com.h 6 Dec 2011 16:03:22 -0000 1.13 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 63,66 **** --- 63,67 ---- #define C0C_DEFAULT_EXCLUSIVEMODE 0x00000000 #define C0C_DEFAULT_HIDDENMODE 0x00000000 + #define C0C_DEFAULT_ALLDATABITS 0x00000000 #define C0C_DEFAULT_EMUNOISE 0x00000000 #define C0C_DEFAULT_ADDRTTO 0x00000000 |
From: Vyacheslav F. <vf...@us...> - 2011-12-06 15:46:28
|
Update of /cvsroot/com0com/com0com In directory vz-cvs-4.sog:/tmp/cvs-serv13683 Modified Files: com0com.inf Log Message: Commented CopyINF = comport.inf to be more silent Index: com0com.inf =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.inf,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** com0com.inf 7 Jun 2010 07:06:10 -0000 1.6 --- com0com.inf 6 Dec 2011 15:46:26 -0000 1.7 *************** *** 5,9 **** ; Installation file for the Null-modem emulator driver. ; ! ; Copyright (c) 2004-2010 Vyacheslav Frolov ; ;****************************************************************************** --- 5,9 ---- ; Installation file for the Null-modem emulator driver. ; ! ; Copyright (c) 2004-2011 Vyacheslav Frolov ; ;****************************************************************************** *************** *** 16,20 **** CatalogFile = com0com.cat ; MM/DD/YYYY ! DriverVer = 06/07/2010,3.0.0.0 UninstallInfTag = {df799e12-3c56-421b-b298-b6d3642bc878} --- 16,20 ---- CatalogFile = com0com.cat ; MM/DD/YYYY ! DriverVer = 12/06/2011,3.0.0.0 UninstallInfTag = {df799e12-3c56-421b-b298-b6d3642bc878} *************** *** 80,84 **** AddReg = com0com_AddReg CopyFiles = com0com_CopyDrivers ! CopyINF = cncport.inf, comport.inf [com0com_inst.Services] --- 80,85 ---- AddReg = com0com_AddReg CopyFiles = com0com_CopyDrivers ! CopyINF = cncport.inf ! ;CopyINF = comport.inf [com0com_inst.Services] |
From: Vyacheslav F. <vf...@us...> - 2011-12-06 15:44:42
|
Update of /cvsroot/com0com/com0com In directory vz-cvs-4.sog:/tmp/cvs-serv13590 Modified Files: ReadMe.txt Log Message: Added questions about 64-bit System and about ouput buffer of the port sending to the not opened port Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ReadMe.txt 12 Jul 2011 18:01:27 -0000 1.30 --- ReadMe.txt 6 Dec 2011 15:44:40 -0000 1.31 *************** *** 100,103 **** --- 100,108 ---- A. No, it is not possible. You need Windows 2000 platform or newer. + Q. I get an error message when I run the installer: + "The 32-bit driver cannot run under 64-bit System". What to do? + A. For 64-bit system download x64 package + (for example com0com-2.2.2.0-x64-fre-signed.zip). + Q. Is it possible to install or uninstall com0com silently (with no user intervention and no user interface)? *************** *** 181,184 **** --- 186,204 ---- command> change CNCA0 EmuBR=yes + Q. When the corresponding port of a pair is not open, some characters will remain + in the ouput buffer of the sending port and be output upon the next connection. + Any clue on a possible workaround? + A. It's a correct behavior if receive buffer overrun is disabled (by default). If + you need behavior where those characters should be lost (like real null modem do) + then enable receive buffer overrun for the receiving port. Also, to prevent some + flow control issues enable baud rate emulation for the sending port. So, if + sending port is CNCA0 and receiving 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 + Q. I have to write an application connected to one side of the com0com port pair, and I don't want users to 'see' all the virtual ports created by com0com, but |
From: Vyacheslav F. <vf...@us...> - 2011-12-02 14:43:27
|
Update of /cvsroot/com0com/hub4com/plugins/tag In directory vz-cvs-4.sog:/tmp/cvs-serv25770 Modified Files: filter.cpp Log Message: Added Tag synchronization filter Added example Allowed multi-instancing Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tag/filter.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** filter.cpp 2 Feb 2009 15:21:42 -0000 1.4 --- filter.cpp 2 Dec 2011 14:43:24 -0000 1.5 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,28 ---- * * $Log$ + * Revision 1.5 2011/12/02 14:43:24 vfrolov + * Added Tag synchronization filter + * Added example + * Allowed multi-instancing + * * Revision 1.4 2009/02/02 15:21:42 vfrolov * Optimized filter's API *************** *** 109,125 **** }; /////////////////////////////////////////////////////////////// class Filter : public Valid { public: Filter(int argc, const char *const argv[]); ! int inTag; ! int outTag; ! enum OutTagState {No, My, Alien} outTagState; }; Filter::Filter(int argc, const char *const argv[]) ! : inTag(-1), ! outTag(-1), ! outTagState(No) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { --- 114,145 ---- }; /////////////////////////////////////////////////////////////// + class State { + public: + State() : isValOut(FALSE) {} + + BOOL isValOut; + BOOL isMyValOut; + }; + /////////////////////////////////////////////////////////////// + class StateSync { + public: + StateSync() : isValOut(FALSE), isValIn(FALSE), periodOut(1) {} + + BOOL isValIn; + BOOL isValOut; + int periodOut; + }; + /////////////////////////////////////////////////////////////// class Filter : public Valid { public: Filter(int argc, const char *const argv[]); ! int tagIn; ! int tagOut; }; Filter::Filter(int argc, const char *const argv[]) ! : tagIn(-1) ! , tagOut(-1) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { *************** *** 143,147 **** } ! inTag = outTag = tag; } else { --- 163,167 ---- } ! tagIn = tagOut = tag; } else { *************** *** 151,160 **** } ! if (inTag < 0) { cerr << "IN tag was not set" << endl; Invalidate(); } ! if (outTag < 0) { cerr << "OUT tag was not set" << endl; Invalidate(); --- 171,180 ---- } ! if (tagIn < 0) { cerr << "IN tag was not set" << endl; Invalidate(); } ! if (tagOut < 0) { cerr << "OUT tag was not set" << endl; Invalidate(); *************** *** 162,165 **** --- 182,246 ---- } /////////////////////////////////////////////////////////////// + class FilterSync : public Valid { + public: + FilterSync(int argc, const char *const argv[]); + + int syncIn; + int syncOut; + int periodOut; + }; + + FilterSync::FilterSync(int argc, const char *const argv[]) + : syncIn(-1) + , syncOut(-1) + , periodOut(0) + { + for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { + const char *pArg = GetParam(*pArgs, "--"); + + if (!pArg) { + cerr << "Unknown option " << *pArgs << endl; + Invalidate(); + continue; + } + + const char *pParam; + + if ((pParam = GetParam(pArg, "sync=")) != NULL) { + int sync; + + if (!StrToInt(pParam, &sync) || sync < 0 || sync > 254) { + cerr << "Invalid sync in " << pParam << endl; + Invalidate(); + continue; + } + + syncIn = syncOut = sync; + } + else + if ((pParam = GetParam(pArg, "period=")) != NULL) { + if (!StrToInt(pParam, &periodOut) || periodOut < 0) { + cerr << "Invalid period in " << pParam << endl; + Invalidate(); + continue; + } + } + else { + cerr << "Unknown option " << pArg << endl; + Invalidate(); + } + } + + if (syncIn < 0) { + cerr << "IN sync was not set" << endl; + Invalidate(); + } + + if (syncOut < 0) { + cerr << "OUT sync was not set" << endl; + Invalidate(); + } + } + /////////////////////////////////////////////////////////////// static PLUGIN_TYPE CALLBACK GetPluginType() { *************** *** 170,174 **** sizeof(PLUGIN_ABOUT_A), "tag", ! "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Tag filter", --- 251,255 ---- sizeof(PLUGIN_ABOUT_A), "tag", ! "Copyright (c) 2008-2011 Vyacheslav Frolov", "GNU General Public License", "Tag filter", *************** *** 180,183 **** --- 261,277 ---- } /////////////////////////////////////////////////////////////// + static const PLUGIN_ABOUT_A aboutSync = { + sizeof(PLUGIN_ABOUT_A), + "tag-sync", + "Copyright (c) 2011 Vyacheslav Frolov", + "GNU General Public License", + "Tag synchronization filter", + }; + + static const PLUGIN_ABOUT_A * CALLBACK GetPluginAboutSync() + { + return &aboutSync; + } + /////////////////////////////////////////////////////////////// static void CALLBACK Help(const char *pProgPath) { *************** *** 187,191 **** << endl << "Options:" << endl ! << " --tag=<tag> - set IN and OUT tags to <tag> (number from 0 to 254)." << endl << endl << "IN method input data stream description:" << endl --- 281,286 ---- << endl << "Options:" << endl ! << " --tag=<tag> - set IN and OUT tags (number from 0 to 254," << endl ! << " mandatory)." << endl << endl << "IN method input data stream description:" << endl *************** *** 202,205 **** --- 297,365 ---- << endl << "Examples:" << endl + << " " << pProgPath << " --load=,,_END_" << endl + << " \\\\.\\COM1" << endl + << " --create-filter=tag-sync:--sync=120 --period=3" << endl + << " --add-filters=0:tag-sync" << endl + << endl + << " --use-driver=connector" << endl + << " CNCB0-muxA" << endl + << " --create-filter=tag,CNCB0-tag:--tag=48" << endl + << " --add-filters=1:CNCB0-tag" << endl + << " CNCB0-muxB" << endl + << " --bi-connect=CNCB0-muxA:CNCB0-muxB" << endl + << " --use-driver=serial" << endl + << " \\\\.\\CNCB0" << endl + << " --bi-route=2:3" << endl + << endl + << " --use-driver=connector" << endl + << " CNCB1-muxA" << endl + << " --create-filter=tag,CNCB1-tag:--tag=49" << endl + << " --add-filters=4:CNCB1-tag" << endl + << " CNCB1-muxB" << endl + << " --bi-connect=CNCB1-muxA:CNCB1-muxB" << endl + << " --use-driver=serial" << endl + << " \\\\.\\CNCB1" << endl + << " --bi-route=5:6" << endl + << endl + << " --bi-route=0:1,4" << endl + << " --no-default-fc-route=1,4:0" << endl + << " _END_" << endl + << endl + << " - If from port COM1 received \"0a1ex0b1f0c1gx0d1h...\" then to the port CNCB0" << endl + << " will be sent \"abcd...\" and to the port CNCB1 will be sent \"efgh...\"." << endl + << " If from port CNCB0 received \"abcd...\" and simultaneously from port CNCB1" << endl + << " received \"efgh...\" then to the port COM1 will be sent something like" << endl + << " \"x0a1e0bx1f0c1gx0d1h...\"." << endl + ; + } + /////////////////////////////////////////////////////////////// + static void CALLBACK HelpSync(const char *pProgPath) + { + cerr + << "Usage:" << endl + << " " << pProgPath << " ... --create-filter=" << GetPluginAboutSync()->pName << "[,<FID>][:<options>] ... --add-filters=<ports>:[...,]<FID>[,...] ..." << endl + << endl + << "Options:" << endl + << " --sync=<sync> - set IN and OUT syncs (number from 0 to 254," << endl + << " mandatory)." << endl + << " --period=<sync> - set period for OUT syncs (0 by default)." << endl + << " If period is O then OUT sync will be inserted once" << endl + << " before 1-st tag. If period is N then OUT sync will be" << endl + << " inserted before 1-st and each subsequent N-th tag" << endl + << endl + << "IN method input data stream description:" << endl + << " LINE_DATA - tagged data with IN syncs." << endl + << endl + << "IN method output data stream description:" << endl + << " LINE_DATA - tagged data." << endl + << endl + << "OUT method input data stream description:" << endl + << " LINE_DATA - tagged data." << endl + << endl + << "OUT method output data stream description:" << endl + << " LINE_DATA - tagged data with OUT syncs." << endl + << endl + << "Examples:" << endl + << " See examples for Tag filter." << endl ; } *************** *** 228,231 **** --- 388,414 ---- } /////////////////////////////////////////////////////////////// + static HFILTER CALLBACK CreateSync( + HMASTERFILTER DEBUG_PARAM(hMasterFilter), + HCONFIG /*hConfig*/, + int argc, + const char *const argv[]) + { + _ASSERTE(hMasterFilter != NULL); + + FilterSync *pFilter = new FilterSync(argc, argv); + + if (!pFilter) { + cerr << "No enough memory." << endl; + exit(2); + } + + if (!pFilter->IsValid()) { + delete pFilter; + return NULL; + } + + return (HFILTER)pFilter; + } + /////////////////////////////////////////////////////////////// static void CALLBACK Delete( HFILTER hFilter) *************** *** 236,246 **** } /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, ! HFILTERINSTANCE /*hFilterInstance*/, HUB_MSG *pInMsg, HUB_MSG **DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); --- 419,470 ---- } /////////////////////////////////////////////////////////////// + static void CALLBACK DeleteSync( + HFILTER hFilter) + { + _ASSERTE(hFilter != NULL); + + delete (FilterSync *)hFilter; + } + /////////////////////////////////////////////////////////////// + static HFILTERINSTANCE CALLBACK CreateInstance( + HMASTERFILTERINSTANCE DEBUG_PARAM(hMasterFilterInstance)) + { + _ASSERTE(hMasterFilterInstance != NULL); + + return (HFILTERINSTANCE)new State(); + } + /////////////////////////////////////////////////////////////// + static HFILTERINSTANCE CALLBACK CreateInstanceSync( + HMASTERFILTERINSTANCE DEBUG_PARAM(hMasterFilterInstance)) + { + _ASSERTE(hMasterFilterInstance != NULL); + + return (HFILTERINSTANCE)new StateSync(); + } + /////////////////////////////////////////////////////////////// + static void CALLBACK DeleteInstance( + HFILTERINSTANCE hFilterInstance) + { + _ASSERTE(hFilterInstance != NULL); + + delete (State *)hFilterInstance; + } + /////////////////////////////////////////////////////////////// + static void CALLBACK DeleteInstanceSync( + HFILTERINSTANCE hFilterInstance) + { + _ASSERTE(hFilterInstance != NULL); + + delete (StateSync *)hFilterInstance; + } + /////////////////////////////////////////////////////////////// static BOOL CALLBACK InMethod( HFILTER hFilter, ! HFILTERINSTANCE DEBUG_PARAM(hFilterInstance), HUB_MSG *pInMsg, HUB_MSG **DEBUG_PARAM(ppEchoMsg)) { _ASSERTE(hFilter != NULL); + _ASSERTE(hFilterInstance != NULL); _ASSERTE(pInMsg != NULL); _ASSERTE(ppEchoMsg != NULL); *************** *** 256,260 **** break; ! BYTE tag = (BYTE)((Filter *)hFilter)->inTag; basic_string<BYTE> line_data; --- 480,484 ---- break; ! BYTE tag = (BYTE)((Filter *)hFilter)->tagIn; basic_string<BYTE> line_data; *************** *** 276,284 **** static BOOL CALLBACK OutMethod( HFILTER hFilter, ! HFILTERINSTANCE /*hFilterInstance*/, HMASTERPORT DEBUG_PARAM(hFromPort), HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); _ASSERTE(hFromPort != NULL); _ASSERTE(pOutMsg != NULL); --- 500,509 ---- static BOOL CALLBACK OutMethod( HFILTER hFilter, ! HFILTERINSTANCE hFilterInstance, HMASTERPORT DEBUG_PARAM(hFromPort), HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); + _ASSERTE(hFilterInstance != NULL); _ASSERTE(hFromPort != NULL); _ASSERTE(pOutMsg != NULL); *************** *** 293,298 **** break; ! BYTE tag = (BYTE)((Filter *)hFilter)->outTag; ! Filter::OutTagState tagState = ((Filter *)hFilter)->outTagState; basic_string<BYTE> line_data; --- 518,524 ---- break; ! BYTE tag = (BYTE)((Filter *)hFilter)->tagOut; ! BOOL isValOut = ((State *)hFilterInstance)->isValOut; ! BOOL isMyValOut = ((State *)hFilterInstance)->isMyValOut; basic_string<BYTE> line_data; *************** *** 300,316 **** BYTE ch = *pBuf++; ! switch (tagState) { ! case Filter::No: ! tagState = (ch == tag ? Filter::My : Filter::Alien); ! break; ! case Filter::My: line_data.append(&ch, 1); ! case Filter::Alien: ! tagState = Filter::No; ! break; } } ! ((Filter *)hFilter)->outTagState = tagState; if (!pMsgReplaceBuf(pOutMsg, HUB_MSG_TYPE_LINE_DATA, line_data.data(), (DWORD)line_data.size())) --- 526,542 ---- BYTE ch = *pBuf++; ! if (isValOut) { ! if (isMyValOut) line_data.append(&ch, 1); ! ! isValOut = FALSE; ! } else { ! isMyValOut = (ch == tag); ! isValOut = TRUE; } } ! ((State *)hFilterInstance)->isValOut = isValOut; ! ((State *)hFilterInstance)->isMyValOut = isMyValOut; if (!pMsgReplaceBuf(pOutMsg, HUB_MSG_TYPE_LINE_DATA, line_data.data(), (DWORD)line_data.size())) *************** *** 324,327 **** --- 550,665 ---- } /////////////////////////////////////////////////////////////// + static BOOL CALLBACK InMethodSync( + HFILTER hFilter, + HFILTERINSTANCE hFilterInstance, + HUB_MSG *pInMsg, + HUB_MSG **DEBUG_PARAM(ppEchoMsg)) + { + _ASSERTE(hFilter != NULL); + _ASSERTE(hFilterInstance != NULL); + _ASSERTE(pInMsg != NULL); + _ASSERTE(ppEchoMsg != NULL); + _ASSERTE(*ppEchoMsg == NULL); + + switch (HUB_MSG_T2N(pInMsg->type)) { + case HUB_MSG_T2N(HUB_MSG_TYPE_LINE_DATA): { + _ASSERTE(pInMsg->u.buf.pBuf != NULL || pInMsg->u.buf.size == 0); + + DWORD len = pInMsg->u.buf.size; + + if (len == 0) + break; + + // Discard syncs from stream + + BYTE sync = (BYTE)((FilterSync *)hFilter)->syncIn; + BOOL isValIn = ((StateSync *)hFilterInstance)->isValIn; + basic_string<BYTE> line_data; + + for (const BYTE *pBuf = pInMsg->u.buf.pBuf ; len ; len--) { + BYTE ch = *pBuf++; + + if (isValIn) { + line_data.append(&ch, 1); + isValIn = FALSE; + } else { + if (ch != sync) { + line_data.append(&ch, 1); + isValIn = TRUE; + } + } + } + + ((StateSync *)hFilterInstance)->isValIn = isValIn; + + if (!pMsgReplaceBuf(pInMsg, HUB_MSG_TYPE_LINE_DATA, line_data.data(), (DWORD)line_data.size())) + return FALSE; + + break; + } + } + + return TRUE; + } + /////////////////////////////////////////////////////////////// + static BOOL CALLBACK OutMethodSync( + HFILTER hFilter, + HFILTERINSTANCE hFilterInstance, + HMASTERPORT DEBUG_PARAM(hFromPort), + HUB_MSG *pOutMsg) + { + _ASSERTE(hFilter != NULL); + _ASSERTE(hFilterInstance != NULL); + _ASSERTE(hFromPort != NULL); + _ASSERTE(pOutMsg != NULL); + + switch (HUB_MSG_T2N(pOutMsg->type)) { + case HUB_MSG_T2N(HUB_MSG_TYPE_LINE_DATA): { + _ASSERTE(pOutMsg->u.buf.pBuf != NULL || pOutMsg->u.buf.size == 0); + + DWORD len = pOutMsg->u.buf.size; + + if (len == 0) + break; + + // Add syncs to stream + + BYTE sync = (BYTE)((FilterSync *)hFilter)->syncOut; + BOOL isValOut = ((StateSync *)hFilterInstance)->isValOut; + int periodOut = ((StateSync *)hFilterInstance)->periodOut; + basic_string<BYTE> line_data; + + for (const BYTE *pBuf = pOutMsg->u.buf.pBuf ; len ; len--) { + BYTE ch = *pBuf++; + + if (isValOut) { + line_data.append(&ch, 1); + isValOut = FALSE; + } else { + if (periodOut > 0) { + if (periodOut-- == 1) { + line_data.append(&sync, 1); + periodOut = ((FilterSync *)hFilter)->periodOut; + } + } + + line_data.append(&ch, 1); + isValOut = TRUE; + } + } + + ((StateSync *)hFilterInstance)->isValOut = isValOut; + ((StateSync *)hFilterInstance)->periodOut = periodOut; + + if (!pMsgReplaceBuf(pOutMsg, HUB_MSG_TYPE_LINE_DATA, line_data.data(), (DWORD)line_data.size())) + return FALSE; + + break; + } + } + + return TRUE; + } + /////////////////////////////////////////////////////////////// static const FILTER_ROUTINES_A routines = { sizeof(FILTER_ROUTINES_A), *************** *** 334,345 **** Create, Delete, ! NULL, // CreateInstance ! NULL, // DeleteInstance InMethod, OutMethod, }; static const PLUGIN_ROUTINES_A *const plugins[] = { (const PLUGIN_ROUTINES_A *)&routines, NULL }; --- 672,700 ---- Create, Delete, ! CreateInstance, ! DeleteInstance, InMethod, OutMethod, }; + static const FILTER_ROUTINES_A routinesSync = { + sizeof(FILTER_ROUTINES_A), + GetPluginType, + GetPluginAboutSync, + HelpSync, + NULL, // ConfigStart + NULL, // Config + NULL, // ConfigStop + CreateSync, + DeleteSync, + CreateInstanceSync, + DeleteInstanceSync, + InMethodSync, + OutMethodSync, + }; + static const PLUGIN_ROUTINES_A *const plugins[] = { (const PLUGIN_ROUTINES_A *)&routines, + (const PLUGIN_ROUTINES_A *)&routinesSync, NULL }; |
From: Vyacheslav F. <vf...@us...> - 2011-11-07 14:27:44
|
Update of /cvsroot/com0com/hub4com/examples In directory vz-cvs-4.sog:/tmp/cvs-serv28369 Modified Files: com2tcp-rfc2217.bat Log Message: Added --delay-disconnect option Index: com2tcp-rfc2217.bat =================================================================== RCS file: /cvsroot/com0com/hub4com/examples/com2tcp-rfc2217.bat,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** com2tcp-rfc2217.bat 26 Jul 2011 11:38:09 -0000 1.7 --- com2tcp-rfc2217.bat 7 Nov 2011 14:27:42 -0000 1.8 *************** *** 51,55 **** IF /I "%OPTION%" NEQ "--connect" GOTO END_OPTION_CONNECT ! SET COM_PIN2CON=--create-filter=pin2con,com,connect:%~1 SET PERMANENT= SHIFT /1 --- 51,56 ---- IF /I "%OPTION%" NEQ "--connect" GOTO END_OPTION_CONNECT ! SET COM_PIN2CON=--create-filter=pin2con,com,connect ! SET COM_PIN2CON_OPTIONS=%COM_PIN2CON_OPTIONS% --connect=%~1 SET PERMANENT= SHIFT /1 *************** *** 57,60 **** --- 58,67 ---- :END_OPTION_CONNECT + IF /I "%OPTION%" NEQ "--delay-disconnect" GOTO END_OPTION_DELAY_DISCONNECT + SET COM_PIN2CON_OPTIONS=%COM_PIN2CON_OPTIONS% --delay-disconnect=%~1 + SHIFT /1 + GOTO BEGIN_PARSE_OPTIONS + :END_OPTION_DELAY_DISCONNECT + IF /I "%OPTION%" NEQ "--keep-active" GOTO END_OPTION_KEEP_ACTIVE SET TCP_TELNET_OPTIONS=%TCP_TELNET_OPTIONS% --keep-active=%~1 *************** *** 114,117 **** --- 121,128 ---- :END_QUOTE_TCP_TELNET_OPTIONS + IF "%COM_PIN2CON%" == "" GOTO END_COM_PIN2CON + SET COM_PIN2CON=%COM_PIN2CON%:"%COM_PIN2CON_OPTIONS%" + :END_COM_PIN2CON + %TC% SET OPTIONS=%OPTIONS% --create-filter=trace,com,COM SET OPTIONS=%OPTIONS% --create-filter=escparse,com,parse *************** *** 158,161 **** --- 169,176 ---- ECHO action. By default the connection will be permanent ECHO as it's possible. + ECHO --delay-disconnect ^<t^> + ECHO - delay the disconnect at least for ^<t^> milliseconds. + ECHO Ignore the disconnect if the connect will raised + ECHO again while this delay. ECHO --keep-active ^<s^> - send NOP command every ^<s^> seconds to keep the ECHO connection active if data is not transferred. |
From: Vyacheslav F. <vf...@us...> - 2011-11-07 14:24:18
|
Update of /cvsroot/com0com/hub4com/plugins/pin2con In directory vz-cvs-4.sog:/tmp/cvs-serv28097 Modified Files: filter.cpp Log Message: Added --delay-disconnect option Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/pin2con/filter.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** filter.cpp 2 Feb 2009 15:21:42 -0000 1.16 --- filter.cpp 7 Nov 2011 14:24:16 -0000 1.17 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.17 2011/11/07 14:24:16 vfrolov + * Added --delay-disconnect option + * * Revision 1.16 2009/02/02 15:21:42 vfrolov * Optimized filter's API *************** *** 96,99 **** --- 99,105 ---- static ROUTINE_PORT_NAME_A *pPortName; static ROUTINE_FILTER_NAME_A *pFilterName; + static ROUTINE_TIMER_CREATE *pTimerCreate; + static ROUTINE_TIMER_SET *pTimerSet; + static ROUTINE_TIMER_DELETE *pTimerDelete; static ROUTINE_FILTERPORT *pFilterPort; /////////////////////////////////////////////////////////////// *************** *** 119,126 **** class State { public: ! State(HMASTERPORT hMasterPort) : pName(pPortName(hMasterPort)), connect(FALSE) {} const char *const pName; BOOL connect; }; /////////////////////////////////////////////////////////////// --- 125,150 ---- class State { public: ! State(HMASTERPORT _hMasterPort) ! : hMasterPort(_hMasterPort) ! , pName(pPortName(_hMasterPort)) ! , connect(FALSE) ! , last_connect(FALSE) ! , hDelayDisconnectTimer(NULL) ! { ! } + ~State() + { + if (hDelayDisconnectTimer) + pTimerDelete(hDelayDisconnectTimer); + } + + const HMASTERPORT hMasterPort; const char *const pName; + BOOL connect; + BOOL last_connect; + + HMASTERTIMER hDelayDisconnectTimer; }; /////////////////////////////////////////////////////////////// *************** *** 133,136 **** --- 157,161 ---- DWORD pin; BOOL negative; + DWORD delayDisconnect; private: *************** *** 150,156 **** Filter::Filter(const char *_pName, int argc, const char *const argv[]) ! : pName(_pName), ! pin(GO1_V2O_MODEM_STATUS(MODEM_STATUS_DSR)), ! negative(FALSE) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { --- 175,182 ---- Filter::Filter(const char *_pName, int argc, const char *const argv[]) ! : pName(_pName) ! , pin(GO1_V2O_MODEM_STATUS(MODEM_STATUS_DSR)) ! , negative(FALSE) ! , delayDisconnect(0) { for (const char *const *pArgs = &argv[1] ; argc > 1 ; pArgs++, argc--) { *************** *** 184,188 **** Invalidate(); } ! } else { cerr << "Unknown option " << *pArgs << endl; Invalidate(); --- 210,225 ---- Invalidate(); } ! } ! else ! if ((pParam = GetParam(pArg, "delay-disconnect=")) != NULL) { ! if (isdigit((unsigned char)*pParam)) { ! delayDisconnect = atol(pParam); ! } ! else { ! cerr << "Invalid value in " << pArg << endl; ! exit(1); ! } ! } ! else { cerr << "Unknown option " << *pArgs << endl; Invalidate(); *************** *** 199,203 **** sizeof(PLUGIN_ABOUT_A), "pin2con", ! "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Connect or disconnect on changing of line or modem state filter", --- 236,240 ---- sizeof(PLUGIN_ABOUT_A), "pin2con", ! "Copyright (c) 2008-2011 Vyacheslav Frolov", "GNU General Public License", "Connect or disconnect on changing of line or modem state filter", *************** *** 219,222 **** --- 256,263 ---- << " default). The exclamation sign (!) can be used to" << endl << " invert the value." << endl + << " --delay-disconnect=<t>" << endl + << " - delay the disconnect at least for <t> milliseconds." << endl + << " Ignore the disconnect if the connect will raised" << endl + << " again while this delay." << endl << endl << "IN method input data stream description:" << endl *************** *** 296,306 **** State &state, HUB_MSG *pInMsg, ! BOOL pinState) { ! if (filter.negative) ! pinState = !pinState; ! if (state.connect != pinState) ! pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_CONNECT, state.connect = pinState); return pInMsg; --- 337,395 ---- State &state, HUB_MSG *pInMsg, ! BOOL pinState, ! BOOL timeout = FALSE) { ! _ASSERTE(filter.delayDisconnect || (!timeout && !state.hDelayDisconnectTimer)); ! if (!timeout) ! state.last_connect = filter.negative ? !pinState : pinState; ! ! //cout << "beg timeout=" << timeout << " connect=" << state.connect << " last_connect=" << state.last_connect << endl; ! ! if (state.connect != state.last_connect) { ! if (!state.last_connect && filter.delayDisconnect) { ! if (!timeout) { ! if (!state.hDelayDisconnectTimer) { ! state.hDelayDisconnectTimer = pTimerCreate((HTIMEROWNER)&state); ! ! if (state.hDelayDisconnectTimer) { ! LARGE_INTEGER firstReportTime; ! ! firstReportTime.QuadPart = -10000LL * filter.delayDisconnect; ! ! pTimerSet( ! state.hDelayDisconnectTimer, ! state.hMasterPort, ! &firstReportTime, 0, ! (HTIMERPARAM)state.hDelayDisconnectTimer); ! ! //cout << "pTimerSet" << endl; ! } ! } ! } else { ! pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_CONNECT, state.connect = state.last_connect); ! ! //cout << "HUB_MSG_TYPE_CONNECT connect=" << state.connect << endl; ! ! if (state.hDelayDisconnectTimer) { ! pTimerDelete(state.hDelayDisconnectTimer); ! state.hDelayDisconnectTimer = NULL; ! ! //cout << "pTimerDelete" << endl; ! } ! } ! } else { ! pInMsg = pMsgInsertVal(pInMsg, HUB_MSG_TYPE_CONNECT, state.connect = state.last_connect); ! ! //cout << "HUB_MSG_TYPE_CONNECT connect=" << state.connect << endl; ! } ! } else { ! if (state.hDelayDisconnectTimer) { ! pTimerDelete(state.hDelayDisconnectTimer); ! state.hDelayDisconnectTimer = NULL; ! ! cout << "pTimerDelete" << endl; ! } ! } return pInMsg; *************** *** 348,351 **** --- 437,455 ---- return FALSE; break; + case HUB_MSG_T2N(HUB_MSG_TYPE_TICK): { + if (pInMsg->u.hv2.hVal0 != hFilterInstance) + break; + + HUB_MSG inMsg = *pInMsg; + + // discard owned tick + if (!pMsgReplaceNone(pInMsg, HUB_MSG_TYPE_EMPTY)) + return FALSE; + + if (inMsg.u.hv2.hVal1 == ((State *)hFilterInstance)->hDelayDisconnectTimer) + pInMsg = InsertConnectState(*((Filter *)hFilter), *(State *)hFilterInstance, pInMsg, 0, TRUE); + + break; + } case HUB_MSG_T2N(HUB_MSG_TYPE_MODEM_STATUS): { WORD pin; *************** *** 398,401 **** --- 502,508 ---- !ROUTINE_IS_VALID(pHubRoutines, pPortName) || !ROUTINE_IS_VALID(pHubRoutines, pFilterName) || + !ROUTINE_IS_VALID(pHubRoutines, pTimerCreate) || + !ROUTINE_IS_VALID(pHubRoutines, pTimerSet) || + !ROUTINE_IS_VALID(pHubRoutines, pTimerDelete) || !ROUTINE_IS_VALID(pHubRoutines, pFilterPort)) { *************** *** 407,410 **** --- 514,520 ---- pPortName = pHubRoutines->pPortName; pFilterName = pHubRoutines->pFilterName; + pTimerCreate = pHubRoutines->pTimerCreate; + pTimerSet = pHubRoutines->pTimerSet; + pTimerDelete = pHubRoutines->pTimerDelete; pFilterPort = pHubRoutines->pFilterPort; |
From: Vyacheslav F. <vf...@us...> - 2011-07-28 13:42:22
|
Update of /cvsroot/com0com/hub4com/plugins/telnet In directory vz-cvs-4.sog:/tmp/cvs-serv21630 Modified Files: filter.cpp telnet.cpp telnet.h Log Message: Implemented --ascii-cr-padding option Index: telnet.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/telnet.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** telnet.h 26 Jan 2009 15:07:52 -0000 1.5 --- telnet.h 28 Jul 2011 13:42:20 -0000 1.6 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2011/07/28 13:42:20 vfrolov + * Implemented --ascii-cr-padding option + * * Revision 1.5 2009/01/26 15:07:52 vfrolov * Implemented --keep-active option *************** *** 53,56 **** --- 56,60 ---- void Start(); + void SetAsciiCrPadding(const BYTE_string &padding) { ascii_cr_padding = padding; } HUB_MSG *Decode(HUB_MSG *pMsg); *************** *** 93,96 **** --- 97,102 ---- TelnetOption *options[BYTE(-1)]; + BYTE_string ascii_cr_padding; + BYTE_string streamEncoded; BYTE_string streamDecoded; Index: telnet.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/telnet.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** telnet.cpp 26 Jan 2009 15:07:52 -0000 1.6 --- telnet.cpp 28 Jul 2011 13:42:20 -0000 1.7 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2011/07/28 13:42:20 vfrolov + * Implemented --ascii-cr-padding option + * * Revision 1.6 2009/01/26 15:07:52 vfrolov * Implemented --keep-active option *************** *** 160,163 **** --- 163,171 ---- streamEncoded += ch; + + if (ch == 13 /*CR*/ && ascii_cr_padding.size()) { + if (options[0 /*TRANSMIT-BINARY*/] == NULL || options[0 /*TRANSMIT-BINARY*/]->stateLocal != TelnetOption::osYes) + streamEncoded += ascii_cr_padding; + } } Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/telnet/filter.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** filter.cpp 25 Jul 2011 07:03:55 -0000 1.21 --- filter.cpp 28 Jul 2011 13:42:20 -0000 1.22 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.22 2011/07/28 13:42:20 vfrolov + * Implemented --ascii-cr-padding option + * * Revision 1.21 2011/07/25 07:03:55 vfrolov * Fixed set-ID field assertion *************** *** 226,229 **** --- 229,233 ---- string terminalType; BOOL suppressEcho; + BYTE_string ascii_cr_padding; enum { *************** *** 295,298 **** --- 299,335 ---- } } + else + if ((pParam = GetParam(pArg, "ascii-cr-padding=")) != NULL) { + for (;;) { + unsigned char ch1 = *pParam++; + + if (!ch1) + break; + + unsigned char ch2 = *pParam++; + + if (!ch2 || !isxdigit(ch1) || !isxdigit(ch2)) { + Diag("Invalid value in ", *pArgs); + Invalidate(); + break; + } + + BYTE padding; + + if (isdigit(ch1)) + padding = ch1 - '0'; + else + padding = (BYTE)toupper(ch1) - 'A'; + + padding <<= 4; + + if (isdigit(ch2)) + padding += ch2 - '0'; + else + padding += (BYTE)toupper(ch2) - 'A'; + + ascii_cr_padding += padding; + } + } else { Diag("Unknown option ", *pArgs); *************** *** 334,337 **** --- 371,376 ---- return NULL; + pTelnetProtocol->SetAsciiCrPadding(filter.ascii_cr_padding); + TelnetOption *pTo; *************** *** 398,402 **** sizeof(PLUGIN_ABOUT_A), "telnet", ! "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Telnet protocol filter", --- 437,441 ---- sizeof(PLUGIN_ABOUT_A), "telnet", ! "Copyright (c) 2008-2011 Vyacheslav Frolov", "GNU General Public License", "Telnet protocol filter", *************** *** 424,427 **** --- 463,470 ---- << " --keep-active=<s> - send NOP command every <s> seconds to keep the" << endl << " connection active if data is not transferred." << endl + << " --ascii-cr-padding=<p> - in the default ASCII mode insert padding <p>" << endl + << " following CR while encoding raw data to telnet" << endl + << " protocol data. Where <p> is a sequence of pairs" << endl + << " of hexadecimal digits" << endl << endl << "IN method input data stream description:" << endl |
From: Vyacheslav F. <vf...@us...> - 2011-07-27 17:08:35
|
Update of /cvsroot/com0com/hub4com/plugins/serial In directory vz-cvs-4.sog:/tmp/cvs-serv26047 Modified Files: comio.cpp comio.h comparams.cpp comparams.h comport.cpp comport.h port.cpp Log Message: Implemented serial port share mode Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** comport.cpp 19 May 2011 16:46:59 -0000 1.26 --- comport.cpp 27 Jul 2011 17:08:33 -0000 1.27 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.27 2011/07/27 17:08:33 vfrolov + * Implemented serial port share mode + * * Revision 1.26 2011/05/19 16:46:59 vfrolov * Fixed unexpected assertion *************** *** 308,339 **** [...1026 lines suppressed...] ! ULONG ReceivedCount; ! ULONG TransmittedCount; ! ULONG FrameErrorCount; ! ULONG SerialOverrunErrorCount; ! ULONG BufferOverrunErrorCount; ! ULONG ParityErrorCount; ! } SERIALPERF_STATS, *PSERIALPERF_STATS; ! SERIALPERF_STATS stats; ! DWORD size; ! ! if (DeviceIoControl(pComIo->Handle(), IOCTL_SERIAL_GET_STATS, NULL, 0, &stats, sizeof(stats), &size, NULL)) { ! cout << ", total" ! << " RXOVER=" << stats.BufferOverrunErrorCount ! << " OVERRUN=" << stats.SerialOverrunErrorCount ! << " RXPARITY=" << stats.ParityErrorCount ! << " FRAME=" << stats.FrameErrorCount; ! } } Index: comparams.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comparams.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** comparams.cpp 14 Sep 2010 16:31:50 -0000 1.8 --- comparams.cpp 27 Jul 2011 17:08:33 -0000 1.9 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2011/07/27 17:08:33 vfrolov + * Implemented serial port share mode + * * Revision 1.8 2010/09/14 16:31:50 vfrolov * Implemented --write-limit=0 to disable writing to the port *************** *** 66,80 **** /////////////////////////////////////////////////////////////// ComParams::ComParams() ! : baudRate(CBR_19200), ! byteSize(8), ! parity(NOPARITY), ! stopBits(ONESTOPBIT), ! outCts(1), ! outDsr(0), ! outX(0), ! inX(0), ! inDsr(0), ! intervalTimeout(0), ! writeQueueLimit(256) { } --- 69,84 ---- /////////////////////////////////////////////////////////////// ComParams::ComParams() ! : baudRate(CBR_19200) ! , byteSize(8) ! , parity(NOPARITY) ! , stopBits(ONESTOPBIT) ! , outCts(1) ! , outDsr(0) ! , outX(0) ! , inX(0) ! , inDsr(0) ! , intervalTimeout(0) ! , writeQueueLimit(256) ! , shareMode(0) { } *************** *** 160,164 **** } ! BOOL ComParams::SetFlag(const char *pFlagStr, int *pFlag) { if (_stricmp(pFlagStr, "on") == 0) { --- 164,168 ---- } ! BOOL ComParams::SetFlag(const char *pFlagStr, int *pFlag, BOOL withCurrent) { if (_stricmp(pFlagStr, "on") == 0) { *************** *** 170,174 **** } else ! if (tolower((unsigned char)*pFlagStr) == 'c') { *pFlag = -1; } --- 174,178 ---- } else ! if (withCurrent && tolower((unsigned char)*pFlagStr) == 'c') { *pFlag = -1; } *************** *** 247,256 **** } ! string ComParams::FlagStr(int flag) { switch (flag) { case 1: return "on"; case 0: return "off"; ! case -1: return "current"; } return "?"; --- 251,260 ---- } ! string ComParams::FlagStr(int flag, BOOL withCurrent) { switch (flag) { case 1: return "on"; case 0: return "off"; ! case -1: return withCurrent ? "current" : "?"; } return "?"; *************** *** 287,293 **** } ! const char *ComParams::FlagLst() { ! return "on, off or c[urrent]"; } /////////////////////////////////////////////////////////////// --- 291,297 ---- } ! const char *ComParams::FlagLst(BOOL withCurrent) { ! return withCurrent ? "on, off or c[urrent]" : "on or off"; } /////////////////////////////////////////////////////////////// Index: port.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/port.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** port.cpp 14 Sep 2010 16:31:50 -0000 1.15 --- port.cpp 27 Jul 2011 17:08:33 -0000 1.16 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.16 2011/07/27 17:08:33 vfrolov + * Implemented serial port share mode + * * Revision 1.15 2010/09/14 16:31:50 vfrolov * Implemented --write-limit=0 to disable writing to the port *************** *** 125,129 **** sizeof(PLUGIN_ABOUT_A), "serial", ! "Copyright (c) 2008 Vyacheslav Frolov", "GNU General Public License", "Serial port driver", --- 128,132 ---- sizeof(PLUGIN_ABOUT_A), "serial", ! "Copyright (c) 2008-2011 Vyacheslav Frolov", "GNU General Public License", "Serial port driver", *************** *** 175,178 **** --- 178,183 ---- << " will be purged with data lost on overruning." << endl << " The value 0 will disable writing to the port." << endl + << " --share-mode=<c> - set share mode to <c> (" << ComParams().ShareModeStr() << " by default), where <c>" << endl + << " is " << ComParams::ShareModeLst() << "." << endl << endl << " The value c[urrent] above means to use current COM port settings." << endl *************** *** 182,202 **** << " LINE_DATA(<data>) - write <data> to serial port." << endl << " SET_PIN_STATE(<state>) - set serial port pins to required state." << endl << endl << "Input data stream description:" << endl << " LINE_DATA(<data>) - readed <data> from serial port." << endl ! << " CONNECT(TRUE) - serial port started." << endl << " LINE_STATUS(<val>) - current state of line." << endl << " MODEM_STATUS(<val>) - current state of modem." << endl << endl ! << "Fake read filter input data stream description:" << endl ! << " GET_IN_OPTS(<pOpts>,<mask>)" << endl ! << " - the port removes bits from <mask> in this message" << endl ! << " for locally supported input data stream options." << endl ! << endl ! << "Fake read filter output data stream description:" << endl ! << " GET_IN_OPTS(<pOpts>,<mask>)" << endl ! << " - the port adds this message at detecting the" << endl ! << " GET_IN_OPTS message in the stream to get the" << endl ! << " required input data stream options." << endl << endl << "Examples:" << endl --- 187,204 ---- << " LINE_DATA(<data>) - write <data> to serial port." << endl << " SET_PIN_STATE(<state>) - set serial port pins to required state." << endl + << " CONNECT(TRUE) - increment connection counter." << endl + << " CONNECT(FALSE) - decrement connection counter." << endl << endl << "Input data stream description:" << endl << " LINE_DATA(<data>) - readed <data> from serial port." << endl ! << " CONNECT(TRUE) - serial port was started." << endl ! << " CONNECT(FALSE) - serial port is stopping." << endl << " LINE_STATUS(<val>) - current state of line." << endl << " MODEM_STATUS(<val>) - current state of modem." << endl << endl ! << "In share mode the incrementing of the connection counter will force serial port" << endl ! << "starting and the decrementing of the connection counter to 0 will force serial" << endl ! << "port stopping. The stopped serial port is closed so it allowed to be used by" << endl ! << "other applications." << endl << endl << "Examples:" << endl *************** *** 297,300 **** --- 299,308 ---- exit(1); } + } else + if ((pParam = GetParam(pArg, "--share-mode=")) != NULL) { + if (!comParams.SetShareMode(pParam)) { + Diag("Invalid share mode value in ", pArg); + exit(1); + } } else { return FALSE; Index: comio.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** comio.h 17 Dec 2008 11:52:35 -0000 1.11 --- comio.h 27 Jul 2011 17:08:33 -0000 1.12 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2011/07/27 17:08:33 vfrolov + * Implemented serial port share mode + * * Revision 1.11 2008/12/17 11:52:35 vfrolov * Replaced ComIo::dcb by serialBaudRate, serialLineControl, *************** *** 172,179 **** { public: ! ComIo(ComPort &_port) : port(_port), handle(INVALID_HANDLE_VALUE) {} ! ~ComIo() { Close(); } ! BOOL Open(const char *pPath, const ComParams &comParams); void Close(); --- 175,193 ---- { public: ! ComIo(ComPort &_port, const char *pPath) ! : port(_port) ! , countStartedOverlaps(0) ! , path(pPath) ! , handle(INVALID_HANDLE_VALUE) ! , handleClosing(INVALID_HANDLE_VALUE) ! , notifyOnFree(FALSE) ! , hasExtendedModemControl(FALSE) ! , pinStateValue(0) ! , pinStateMask(0) ! { ! } ! BOOL Open(const ComParams &comParams); ! BOOL Open(); void Close(); *************** *** 202,205 **** --- 216,220 ---- HANDLE Handle() const { return handle; } + const string &Path() const { return path; } DWORD BaudRate() const { return serialBaudRate.BaudRate; } DWORD LineControl() const { *************** *** 214,225 **** --- 229,261 ---- public: ComPort &port; + int countStartedOverlaps; private: + BOOL OpenPath(); + void PrintParams(const char *pPrefix, const char *pSuffix); + + string path; + HANDLE handle; + HANDLE handleClosing; + BOOL notifyOnFree; + BOOL hasExtendedModemControl; + + WORD pinStateValue; + WORD pinStateMask; + SERIAL_BAUD_RATE serialBaudRate; SERIAL_LINE_CONTROL serialLineControl; SERIAL_HANDFLOW serialHandFlow; SERIAL_CHARS serialChars; + COMMTIMEOUTS timeouts; + + #ifdef _DEBUG + private: + ComIo(const ComIo &comIo) : port(comIo.port) {} + ~ComIo() {} + void operator=(const ComIo &) {} + #endif /* _DEBUG */ }; /////////////////////////////////////////////////////////////// *************** *** 244,249 **** { public: #ifdef _DEBUG - WriteOverlapped() : pBuf(NULL) {} ~WriteOverlapped() { _ASSERTE(pBuf == NULL); --- 280,289 ---- { public: + WriteOverlapped(ComIo &_comIo) : comIo(_comIo) { + #ifdef _DEBUG + pBuf = NULL; + #endif + } #ifdef _DEBUG ~WriteOverlapped() { _ASSERTE(pBuf == NULL); *************** *** 251,255 **** #endif ! BOOL StartWrite(ComIo *_pComIo, BYTE *_pBuf, DWORD _len); private: --- 291,295 ---- #endif ! BOOL StartWrite(BYTE *_pBuf, DWORD _len); private: *************** *** 260,273 **** void BufFree(); ! ComIo *pComIo; BYTE *pBuf; DWORD len; }; /////////////////////////////////////////////////////////////// ! class WaitCommEventOverlapped : private OVERLAPPED { public: WaitCommEventOverlapped(ComIo &_comIo); ! ~WaitCommEventOverlapped(); BOOL StartWaitCommEvent(); --- 300,350 ---- void BufFree(); ! ComIo &comIo; BYTE *pBuf; DWORD len; }; /////////////////////////////////////////////////////////////// ! class SafeDelete ! { ! protected: ! SafeDelete() : deleted(FALSE), locked(0) {} ! ! virtual ~SafeDelete() {} ! ! void Delete() { ! _ASSERTE(locked >= 0); ! ! if (locked <= 0) ! delete this; ! else ! deleted = TRUE; ! } ! ! void LockDelete() { locked++; } ! BOOL UnockDelete() { ! locked--; ! ! _ASSERTE(locked >= 0); ! ! if (deleted) { ! if (locked <= 0) ! delete this; ! ! return FALSE; ! } ! ! return TRUE; ! } ! ! private: ! BOOL deleted; ! int locked; ! }; ! /////////////////////////////////////////////////////////////// ! class WaitCommEventOverlapped : private OVERLAPPED, public SafeDelete { public: WaitCommEventOverlapped(ComIo &_comIo); ! void Delete(); BOOL StartWaitCommEvent(); *************** *** 281,284 **** --- 358,366 ---- HANDLE hWait; DWORD eMask; + + #ifdef _DEBUG + private: + ~WaitCommEventOverlapped() {} + #endif /* _DEBUG */ }; /////////////////////////////////////////////////////////////// Index: comparams.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comparams.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comparams.h 27 Nov 2008 13:44:52 -0000 1.3 --- comparams.h 27 Jul 2011 17:08:33 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2011/07/27 17:08:33 vfrolov + * Implemented serial port share mode + * * Revision 1.3 2008/11/27 13:44:52 vfrolov * Added --write-limit option *************** *** 64,67 **** --- 67,71 ---- BOOL SetIntervalTimeout(const char *pIntervalTimeout); BOOL SetWriteQueueLimit(const char *pWriteQueueLimit); + BOOL SetShareMode(const char *pShareMode) { return SetFlag(pShareMode, &shareMode, FALSE); } static string BaudRateStr(long baudRate); *************** *** 76,79 **** --- 80,84 ---- static string IntervalTimeoutStr(long intervalTimeout); static string WriteQueueLimitStr(long writeQueueLimit); + static string ShareModeStr(int shareMode) { return FlagStr(shareMode, FALSE); } string BaudRateStr() const { return BaudRateStr(baudRate); } *************** *** 88,91 **** --- 93,97 ---- string IntervalTimeoutStr() const { return IntervalTimeoutStr(intervalTimeout); } string WriteQueueLimitStr() const { return WriteQueueLimitStr(writeQueueLimit); } + string ShareModeStr() const { return ShareModeStr(shareMode); } static const char *BaudRateLst(); *************** *** 100,103 **** --- 106,110 ---- static const char *IntervalTimeoutLst(); static const char *WriteQueueLimitLst(); + static const char *ShareModeLst() { return FlagLst(FALSE); } long BaudRate() const { return baudRate; } *************** *** 112,120 **** long IntervalTimeout() const { return intervalTimeout; } long WriteQueueLimit() const { return writeQueueLimit; } private: ! BOOL SetFlag(const char *pFlagStr, int *pFlag); ! static string FlagStr(int flag); ! static const char *FlagLst(); long baudRate; --- 119,128 ---- long IntervalTimeout() const { return intervalTimeout; } long WriteQueueLimit() const { return writeQueueLimit; } + int ShareMode() const { return shareMode; } private: ! BOOL SetFlag(const char *pFlagStr, int *pFlag, BOOL withCurrent = TRUE); ! static string FlagStr(int flag, BOOL withCurrent = TRUE); ! static const char *FlagLst(BOOL withCurrent = TRUE); long baudRate; *************** *** 129,132 **** --- 137,141 ---- long intervalTimeout; long writeQueueLimit; + int shareMode; }; /////////////////////////////////////////////////////////////// Index: comport.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comport.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** comport.h 19 May 2011 16:47:00 -0000 1.18 --- comport.h 27 Jul 2011 17:08:33 -0000 1.19 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.19 2011/07/27 17:08:33 vfrolov + * Implemented serial port share mode + * * Revision 1.18 2011/05/19 16:47:00 vfrolov * Fixed unexpected assertion *************** *** 125,131 **** --- 128,137 ---- BOOL FakeReadFilter(HUB_MSG *pInMsg); BOOL Write(HUB_MSG *pMsg); + void OnWrite(WriteOverlapped *pOverlapped, DWORD len, DWORD done); void OnRead(ReadOverlapped *pOverlapped, BYTE *pBuf, DWORD done); void OnCommEvent(WaitCommEventOverlapped *pOverlapped, DWORD eMask); + void OnPortFree() { Update(); } + void LostReport(); *************** *** 136,139 **** --- 142,150 ---- void FlowControlUpdate(); void PurgeWrite(BOOL withLost); + void FilterX(BYTE *pBuf, DWORD &len); + void UpdateOutOptions(DWORD options); + void StartDisconnect(); + void Update(); + BOOL Start(BOOL first); BOOL StartRead(); BOOL StartWaitCommEvent(); *************** *** 143,146 **** --- 154,158 ---- string name; HMASTERPORT hMasterPort; + int countReadOverlapped; int countWaitCommEventOverlapped; *************** *** 149,152 **** --- 161,165 ---- DWORD intercepted_options[2]; DWORD inOptions[2]; + DWORD escapeOptions; DWORD outOptions; #ifdef _DEBUG *************** *** 154,157 **** --- 167,174 ---- #endif + int connectionCounter; + BOOL connectSent; + BOOL permanent; + DWORD writeQueueLimit; DWORD writeQueueLimitSendXoff; *************** *** 166,169 **** --- 183,193 ---- BYTE *pWriteBuf; DWORD lenWriteBuf; + + #ifdef _DEBUG + private: + ComPort(const ComPort &) {} + ~ComPort() {} + void operator=(const ComPort &) {} + #endif /* _DEBUG */ }; /////////////////////////////////////////////////////////////// Index: comio.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/serial/comio.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** comio.cpp 26 Jul 2011 11:57:53 -0000 1.17 --- comio.cpp 27 Jul 2011 17:08:33 -0000 1.18 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.18 2011/07/27 17:08:33 vfrolov + * Implemented serial port share mode + * * Revision 1.17 2011/07/26 11:57:53 vfrolov * Replaced strerror() by FormatMessage() *************** *** 173,179 **** } /////////////////////////////////////////////////////////////// ! static BOOL myGetCommTimeouts(HANDLE handle, COMMTIMEOUTS *timeouts) { ! if (!::GetCommTimeouts(handle, timeouts)) { TraceError(GetLastError(), "GetCommTimeouts()"); return FALSE; --- 176,182 ---- } /////////////////////////////////////////////////////////////// ! static BOOL GetTimeouts(HANDLE handle, COMMTIMEOUTS &timeouts) { ! if (!::GetCommTimeouts(handle, &timeouts)) { TraceError(GetLastError(), "GetCommTimeouts()"); return FALSE; *************** *** 182,193 **** } ! static BOOL mySetCommTimeouts(HANDLE handle, COMMTIMEOUTS *timeouts) { ! if (!::SetCommTimeouts(handle, timeouts)) { TraceError(GetLastError(), "SetCommTimeouts()"); ! myGetCommTimeouts(handle, timeouts); return FALSE; } ! return myGetCommTimeouts(handle, timeouts); } /////////////////////////////////////////////////////////////// --- 185,196 ---- } ! static BOOL SetTimeouts(HANDLE handle, COMMTIMEOUTS &timeouts) { ! if (!::SetCommTimeouts(handle, &timeouts)) { TraceError(GetLastError(), "SetCommTimeouts()"); ! GetTimeouts(handle, timeouts); return FALSE; } ! return GetTimeouts(handle, timeouts); } /////////////////////////////////////////////////////////////// *************** *** 304,325 **** /////////////////////////////////////////////////////////////// static BOOL GetChars(HANDLE handle, SERIAL_CHARS &serialChars); static BOOL GetBaudRate(HANDLE handle, SERIAL_BAUD_RATE &serialBaudRate); static BOOL GetLineControl(HANDLE handle, SERIAL_LINE_CONTROL &serialLineControl); ! ! BOOL ComIo::Open(const char *pPath, const ComParams &comParams) { ! handle = CreateFile( ! pPath, ! GENERIC_READ|GENERIC_WRITE, ! 0, ! NULL, ! OPEN_EXISTING, ! FILE_FLAG_OVERLAPPED, ! NULL); ! ! if (handle == INVALID_HANDLE_VALUE) { ! TraceError(GetLastError(), "ComIo::Open(): CreateFile(\"%s\")", pPath); return FALSE; - } DCB dcb; --- 307,318 ---- /////////////////////////////////////////////////////////////// static BOOL GetChars(HANDLE handle, SERIAL_CHARS &serialChars); + static void SetChars(HANDLE handle, SERIAL_CHARS &serialChars); static BOOL GetBaudRate(HANDLE handle, SERIAL_BAUD_RATE &serialBaudRate); static BOOL GetLineControl(HANDLE handle, SERIAL_LINE_CONTROL &serialLineControl); ! /////////////////////////////////////////////////////////////// ! BOOL ComIo::Open(const ComParams &comParams) { ! if (!OpenPath()) return FALSE; DCB dcb; *************** *** 369,373 **** !GetLineControl(handle, serialLineControl) || !GetChars(handle, serialChars) || ! !GetHandFlow(handle, serialHandFlow)) { Close(); --- 362,367 ---- !GetLineControl(handle, serialLineControl) || !GetChars(handle, serialChars) || ! !GetHandFlow(handle, serialHandFlow) || ! !GetTimeouts(handle, timeouts)) { Close(); *************** *** 375,385 **** } - COMMTIMEOUTS timeouts; - - if (!myGetCommTimeouts(handle, &timeouts)) { - Close(); - return FALSE; - } - if (comParams.IntervalTimeout() > 0) { timeouts.ReadTotalTimeoutMultiplier = 0; --- 369,372 ---- *************** *** 395,418 **** timeouts.WriteTotalTimeoutConstant = 0; ! if (!mySetCommTimeouts(handle, &timeouts)) { Close(); return FALSE; } ! cout ! << "Open(" ! << "\"" << pPath << "\", baud=" << ComParams::BaudRateStr(serialBaudRate.BaudRate) ! << ", data=" << ComParams::ByteSizeStr(serialLineControl.WordLength) ! << ", parity=" << ComParams::ParityStr(serialLineControl.Parity) ! << ", stop=" << ComParams::StopBitsStr(serialLineControl.StopBits) ! << ", octs=" << ComParams::OutCtsStr((serialHandFlow.ControlHandShake & SERIAL_CTS_HANDSHAKE) != 0) ! << ", odsr=" << ComParams::OutDsrStr((serialHandFlow.ControlHandShake & SERIAL_DSR_HANDSHAKE) != 0) ! << ", ox=" << ComParams::OutXStr((serialHandFlow.FlowReplace & SERIAL_AUTO_TRANSMIT) != 0) ! << ", ix=" << ComParams::InXStr((serialHandFlow.FlowReplace & SERIAL_AUTO_RECEIVE) != 0) ! << ", idsr=" << ComParams::InDsrStr((serialHandFlow.ControlHandShake & SERIAL_DSR_SENSITIVITY) != 0) ! << ", ito=" << ComParams::IntervalTimeoutStr(timeouts.ReadIntervalTimeout) ! << ") - OK" << endl; ! hasExtendedModemControl = HasExtendedModemControl(handle); return TRUE; --- 382,444 ---- timeouts.WriteTotalTimeoutConstant = 0; ! if (!SetTimeouts(handle, timeouts)) { Close(); return FALSE; } ! PrintParams("Open(", ") - OK"); ! return TRUE; ! } ! /////////////////////////////////////////////////////////////// ! BOOL ComIo::Open() ! { ! if (handle != INVALID_HANDLE_VALUE || handleClosing != INVALID_HANDLE_VALUE) { ! if (!notifyOnFree) { ! cout << port.Name() << " The port is busy" << endl; ! notifyOnFree = TRUE; ! } ! ! return FALSE; ! } ! ! if (!OpenPath()) ! return FALSE; ! ! _ASSERTE(handle != INVALID_HANDLE_VALUE); ! ! DWORD newBaudRate = BaudRate(); ! GetBaudRate(handle, serialBaudRate); ! DWORD oldBaudRate = BaudRate(); ! ! if (SetBaudRate(newBaudRate) != newBaudRate) { ! cerr << port.Name() << " WARNING: can't change" ! << " baud rate " << oldBaudRate ! << " to " << newBaudRate ! << " (current=" << BaudRate() << ")" ! << endl; ! } ! ! DWORD newLineControl = LineControl(); ! GetLineControl(handle, serialLineControl); ! DWORD oldLineControl = LineControl(); ! ! if (SetLineControl(newLineControl) != newLineControl) { ! cerr << port.Name() << " WARNING: can't change" ! << hex ! << " line control 0x" << oldLineControl ! << " to 0x" << newLineControl ! << " (current=0x" << LineControl() << ")" ! << dec ! << endl; ! } ! ! SetChars(handle, serialChars); ! SetHandFlow(handle, serialHandFlow); ! SetTimeouts(handle, timeouts); ! ! SetPinState(pinStateValue, pinStateMask); ! ! PrintParams("Open(", ") - OK"); return TRUE; *************** *** 421,428 **** void ComIo::Close() { if (handle != INVALID_HANDLE_VALUE) { ! CloseHandle(handle); handle = INVALID_HANDLE_VALUE; } } /////////////////////////////////////////////////////////////// --- 447,522 ---- void ComIo::Close() { + _ASSERTE(handle == INVALID_HANDLE_VALUE || handleClosing == INVALID_HANDLE_VALUE); + + BOOL allowCallback = TRUE; + if (handle != INVALID_HANDLE_VALUE) { ! allowCallback = FALSE; ! ! ::CancelIo(handle); ! ! handleClosing = handle; handle = INVALID_HANDLE_VALUE; } + + if (handleClosing != INVALID_HANDLE_VALUE && countStartedOverlaps <= 0) { + ::CloseHandle(handleClosing); + + handleClosing = INVALID_HANDLE_VALUE; + + PrintParams("Close(", ")"); + + if (notifyOnFree) { + cout << port.Name() << " The port is free" << endl; + notifyOnFree = FALSE; + + if (allowCallback) + port.OnPortFree(); + } + } + } + /////////////////////////////////////////////////////////////// + BOOL ComIo::OpenPath() + { + _ASSERTE(handle == INVALID_HANDLE_VALUE && handleClosing == INVALID_HANDLE_VALUE); + + if (handle != INVALID_HANDLE_VALUE || handleClosing != INVALID_HANDLE_VALUE) + return FALSE; + + handle = ::CreateFile( + path.c_str(), + GENERIC_READ|GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL); + + if (handle == INVALID_HANDLE_VALUE) { + TraceError(GetLastError(), "ComIo::OpenPath(): CreateFile(\"%s\")", path.c_str()); + return FALSE; + } + + hasExtendedModemControl = HasExtendedModemControl(handle); + + return TRUE; + } + /////////////////////////////////////////////////////////////// + void ComIo::PrintParams(const char *pPrefix, const char *pSuffix) + { + cout + << port.Name() << " " << pPrefix + << "\"" << path << "\"" + << ", baud=" << ComParams::BaudRateStr(serialBaudRate.BaudRate) + << ", data=" << ComParams::ByteSizeStr(serialLineControl.WordLength) + << ", parity=" << ComParams::ParityStr(serialLineControl.Parity) + << ", stop=" << ComParams::StopBitsStr(serialLineControl.StopBits) + << ", octs=" << ComParams::OutCtsStr((serialHandFlow.ControlHandShake & SERIAL_CTS_HANDSHAKE) != 0) + << ", odsr=" << ComParams::OutDsrStr((serialHandFlow.ControlHandShake & SERIAL_DSR_HANDSHAKE) != 0) + << ", ox=" << ComParams::OutXStr((serialHandFlow.FlowReplace & SERIAL_AUTO_TRANSMIT) != 0) + << ", ix=" << ComParams::InXStr((serialHandFlow.FlowReplace & SERIAL_AUTO_RECEIVE) != 0) + << ", idsr=" << ComParams::InDsrStr((serialHandFlow.ControlHandShake & SERIAL_DSR_SENSITIVITY) != 0) + << ", ito=" << ComParams::IntervalTimeoutStr(timeouts.ReadIntervalTimeout) + << pSuffix << endl; } /////////////////////////////////////////////////////////////// *************** *** 440,443 **** --- 534,540 ---- void ComIo::SetPinState(WORD value, WORD mask) { + pinStateValue = (pinStateValue & ~mask) | (value & mask); + pinStateMask |= mask; + if (((mask & PIN_STATE_RTS) != 0 && !IsManualRts(serialHandFlow)) || ((mask & PIN_STATE_DTR) != 0 && !IsManualDtr(serialHandFlow))) *************** *** 449,453 **** SetHandFlowDtr(serialHandFlow, (value & PIN_STATE_DTR) ? SERIAL_DTR_CONTROL : 0); ! SetHandFlow(handle, serialHandFlow); mask &= ~(PIN_STATE_RTS|PIN_STATE_DTR); --- 546,551 ---- SetHandFlowDtr(serialHandFlow, (value & PIN_STATE_DTR) ? SERIAL_DTR_CONTROL : 0); ! if (handle != INVALID_HANDLE_VALUE) ! SetHandFlow(handle, serialHandFlow); mask &= ~(PIN_STATE_RTS|PIN_STATE_DTR); *************** *** 455,476 **** if (mask & SPS_V2P_MCR(-1)) { ! if (hasExtendedModemControl) { ! if (!SetModemControl(handle, SPS_P2V_MCR(value), SPS_P2V_MCR(mask))) { ! cerr << port.Name() << " WARNING: can't change MCR state" << endl; ! mask &= ~SPS_V2P_MCR(-1); ! } ! } else { ! _ASSERTE((mask & SPS_V2P_MCR(-1) & ~(PIN_STATE_RTS|PIN_STATE_DTR)) == 0); ! if (mask & PIN_STATE_RTS) { ! if (!CommFunction(handle, (value & PIN_STATE_RTS) ? SETRTS : CLRRTS)) { ! cerr << port.Name() << " WARNING: can't change RTS state" << endl; ! mask &= ~PIN_STATE_RTS; } ! } ! if (mask & PIN_STATE_DTR) { ! if (!CommFunction(handle, (value & PIN_STATE_DTR) ? SETDTR : CLRDTR)) { ! cerr << port.Name() << " WARNING: can't change DTR state" << endl; ! mask &= ~PIN_STATE_DTR; } } --- 553,576 ---- if (mask & SPS_V2P_MCR(-1)) { ! if (handle != INVALID_HANDLE_VALUE) { ! if (hasExtendedModemControl) { ! if (!SetModemControl(handle, SPS_P2V_MCR(value), SPS_P2V_MCR(mask))) { ! cerr << port.Name() << " WARNING: can't change MCR state" << endl; ! mask &= ~SPS_V2P_MCR(-1); ! } ! } else { ! _ASSERTE((mask & SPS_V2P_MCR(-1) & ~(PIN_STATE_RTS|PIN_STATE_DTR)) == 0); ! if (mask & PIN_STATE_RTS) { ! if (!CommFunction(handle, (value & PIN_STATE_RTS) ? SETRTS : CLRRTS)) { ! cerr << port.Name() << " WARNING: can't change RTS state" << endl; ! mask &= ~PIN_STATE_RTS; ! } } ! if (mask & PIN_STATE_DTR) { ! if (!CommFunction(handle, (value & PIN_STATE_DTR) ? SETDTR : CLRDTR)) { ! cerr << port.Name() << " WARNING: can't change DTR state" << endl; ! mask &= ~PIN_STATE_DTR; ! } } } *************** *** 484,488 **** } ! if (mask & PIN_STATE_BREAK) { if (!CommFunction(handle, (value & PIN_STATE_BREAK) ? SETBREAK : CLRBREAK)) cerr << port.Name() << " WARNING: can't change BREAK state" << endl; --- 584,588 ---- } ! if (handle != INVALID_HANDLE_VALUE && (mask & PIN_STATE_BREAK)) { if (!CommFunction(handle, (value & PIN_STATE_BREAK) ? SETBREAK : CLRBREAK)) cerr << port.Name() << " WARNING: can't change BREAK state" << endl; *************** *** 491,494 **** --- 591,595 ---- /////////////////////////////////////////////////////////////// #define IOCTL_SERIAL_GET_CHARS CTL_CODE(FILE_DEVICE_SERIAL_PORT,22,METHOD_BUFFERED,FILE_ANY_ACCESS) + #define IOCTL_SERIAL_SET_CHARS CTL_CODE(FILE_DEVICE_SERIAL_PORT,23,METHOD_BUFFERED,FILE_ANY_ACCESS) static BOOL GetChars(HANDLE handle, SERIAL_CHARS &serialChars) *************** *** 508,511 **** --- 609,628 ---- return TRUE; } + + static void SetChars(HANDLE handle, SERIAL_CHARS &serialChars) + { + DWORD returned; + + if (!DeviceIoControl(handle, + IOCTL_SERIAL_SET_CHARS, + &serialChars, sizeof(serialChars), + NULL, 0, &returned, + NULL)) + { + TraceError(GetLastError(), "IOCTL_SERIAL_SET_CHARS"); + } + + GetChars(handle, serialChars); + } /////////////////////////////////////////////////////////////// #define IOCTL_SERIAL_SET_BAUD_RATE CTL_CODE(FILE_DEVICE_SERIAL_PORT, 1,METHOD_BUFFERED,FILE_ANY_ACCESS) *************** *** 532,542 **** { if (BaudRate() == baudRate) ! return baudRate; ! DWORD returned; ! SERIAL_BAUD_RATE newSerialBaudRate; newSerialBaudRate.BaudRate = baudRate; if (!DeviceIoControl(handle, IOCTL_SERIAL_SET_BAUD_RATE, --- 649,665 ---- { if (BaudRate() == baudRate) ! return BaudRate(); ! SERIAL_BAUD_RATE newSerialBaudRate = serialBaudRate; newSerialBaudRate.BaudRate = baudRate; + if (handle == INVALID_HANDLE_VALUE) { + serialBaudRate = newSerialBaudRate; + return BaudRate(); + } + + DWORD returned; + if (!DeviceIoControl(handle, IOCTL_SERIAL_SET_BAUD_RATE, *************** *** 583,587 **** return lineControl; - DWORD returned; SERIAL_LINE_CONTROL newSerialLineControl = serialLineControl; --- 706,709 ---- *************** *** 601,604 **** --- 723,733 ---- newSerialLineControl.StopBits = serialLineControl.StopBits; + if (handle == INVALID_HANDLE_VALUE) { + serialLineControl = newSerialLineControl; + return LineControl(); + } + + DWORD returned; + if (!DeviceIoControl(handle, IOCTL_SERIAL_SET_LINE_CONTROL, *************** *** 768,777 **** WriteOverlapped *pOver = (WriteOverlapped *)pOverlapped; pOver->BufFree(); if (err != ERROR_SUCCESS && err != ERROR_OPERATION_ABORTED) ! TraceError(err, "WriteOverlapped::OnWrite: %s", pOver->pComIo->port.Name().c_str()); ! pOver->pComIo->port.OnWrite(pOver, pOver->len, done); } --- 897,912 ---- WriteOverlapped *pOver = (WriteOverlapped *)pOverlapped; + _ASSERTE(pOver->comIo.countStartedOverlaps > 0); + pOver->comIo.countStartedOverlaps--; + + if (pOver->comIo.Handle() == INVALID_HANDLE_VALUE) + pOver->comIo.Close(); + pOver->BufFree(); if (err != ERROR_SUCCESS && err != ERROR_OPERATION_ABORTED) ! TraceError(err, "WriteOverlapped::OnWrite: %s", pOver->comIo.port.Name().c_str()); ! pOver->comIo.port.OnWrite(pOver, pOver->len, done); } *************** *** 787,791 **** } ! BOOL WriteOverlapped::StartWrite(ComIo *_pComIo, BYTE *_pBuf, DWORD _len) { _ASSERTE(pBuf == NULL); --- 922,926 ---- } ! BOOL WriteOverlapped::StartWrite(BYTE *_pBuf, DWORD _len) { _ASSERTE(pBuf == NULL); *************** *** 793,806 **** ::memset((OVERLAPPED *)this, 0, sizeof(OVERLAPPED)); - _ASSERTE(_pComIo != NULL); _ASSERTE(_pBuf != NULL); _ASSERTE(_len != 0); ! if (!::WriteFileEx(_pComIo->Handle(), _pBuf, _len, this, OnWrite)) { ! TraceError(GetLastError(), "WriteOverlapped::StartWrite(): WriteFileEx(%x) %s", _pComIo->Handle(), _pComIo->port.Name().c_str()); return FALSE; } ! pComIo = _pComIo; pBuf = _pBuf; len = _len; --- 928,942 ---- ::memset((OVERLAPPED *)this, 0, sizeof(OVERLAPPED)); _ASSERTE(_pBuf != NULL); _ASSERTE(_len != 0); ! if (!::WriteFileEx(comIo.Handle(), _pBuf, _len, this, OnWrite)) { ! TraceError(GetLastError(), "WriteOverlapped::StartWrite(): WriteFileEx(%x) %s", comIo.Handle(), comIo.port.Name().c_str()); return FALSE; } ! comIo.countStartedOverlaps++; ! _ASSERTE(comIo.countStartedOverlaps > 0); ! pBuf = _pBuf; len = _len; *************** *** 827,830 **** --- 963,972 ---- ReadOverlapped *pOver = (ReadOverlapped *)pOverlapped; + _ASSERTE(pOver->comIo.countStartedOverlaps > 0); + pOver->comIo.countStartedOverlaps--; + + if (pOver->comIo.Handle() == INVALID_HANDLE_VALUE) + pOver->comIo.Close(); + if (err != ERROR_SUCCESS) { TraceError(err, "ReadOverlapped::OnRead(): %s", pOver->comIo.port.Name().c_str()); *************** *** 849,868 **** return FALSE; ! if (::ReadFileEx(comIo.Handle(), pBuf, readBufSize, this, OnRead)) ! return TRUE; ! TraceError(GetLastError(), "ReadOverlapped::StartRead(): ReadFileEx() %s", comIo.port.Name().c_str()); ! return FALSE; } /////////////////////////////////////////////////////////////// static HANDLE hThread = INVALID_HANDLE_VALUE; ! WaitCommEventOverlapped::WaitCommEventOverlapped(ComIo &_comIo) ! : comIo(_comIo), ! hWait(INVALID_HANDLE_VALUE) { #ifdef _DEBUG - static DWORD idThread; - if (hThread == INVALID_HANDLE_VALUE) { idThread = ::GetCurrentThreadId(); --- 991,1013 ---- return FALSE; ! if (!::ReadFileEx(comIo.Handle(), pBuf, readBufSize, this, OnRead)) { ! TraceError(GetLastError(), "ReadOverlapped::StartRead(): ReadFileEx() %s", comIo.port.Name().c_str()); ! return FALSE; ! } ! comIo.countStartedOverlaps++; ! _ASSERTE(comIo.countStartedOverlaps > 0); ! ! return TRUE; } /////////////////////////////////////////////////////////////// static HANDLE hThread = INVALID_HANDLE_VALUE; + #ifdef _DEBUG + static DWORD idThread; + #endif /* _DEBUG */ ! static BOOL SetThread() { #ifdef _DEBUG if (hThread == INVALID_HANDLE_VALUE) { idThread = ::GetCurrentThreadId(); *************** *** 885,895 **** TraceError( GetLastError(), ! "WaitCommEventOverlapped::WaitCommEventOverlapped(): DuplicateHandle() %s", ! comIo.port.Name().c_str()); ! return; } } ::memset((OVERLAPPED *)this, 0, sizeof(OVERLAPPED)); --- 1030,1049 ---- TraceError( GetLastError(), ! "SetThread(): DuplicateHandle()"); ! return FALSE; } } + return TRUE; + } + /////////////////////////////////////////////////////////////// + WaitCommEventOverlapped::WaitCommEventOverlapped(ComIo &_comIo) + : comIo(_comIo), + hWait(INVALID_HANDLE_VALUE) + { + if (!SetThread()) + return; + ::memset((OVERLAPPED *)this, 0, sizeof(OVERLAPPED)); *************** *** 917,921 **** } ! WaitCommEventOverlapped::~WaitCommEventOverlapped() { if (hWait != INVALID_HANDLE_VALUE) { --- 1071,1075 ---- } ! void WaitCommEventOverlapped::Delete() { if (hWait != INVALID_HANDLE_VALUE) { *************** *** 923,927 **** TraceError( GetLastError(), ! "WaitCommEventOverlapped::~WaitCommEventOverlapped(): UnregisterWait() %s", comIo.port.Name().c_str()); } --- 1077,1081 ---- TraceError( GetLastError(), ! "WaitCommEventOverlapped::Delete(): UnregisterWait() %s", comIo.port.Name().c_str()); } *************** *** 932,939 **** TraceError( GetLastError(), ! "WaitCommEventOverlapped::~WaitCommEventOverlapped(): CloseHandle(hEvent) %s", comIo.port.Name().c_str()); } } } --- 1086,1095 ---- TraceError( GetLastError(), ! "WaitCommEventOverlapped::Delete(): CloseHandle(hEvent) %s", comIo.port.Name().c_str()); } } + + SafeDelete::Delete(); } *************** *** 942,946 **** BOOLEAN /*timerOrWaitFired*/) { ! ::QueueUserAPC(OnCommEvent, hThread, (ULONG_PTR)pOverlapped); } --- 1098,1104 ---- BOOLEAN /*timerOrWaitFired*/) { ! ((WaitCommEventOverlapped *)pOverlapped)->LockDelete(); ! if (!::QueueUserAPC(OnCommEvent, hThread, (ULONG_PTR)pOverlapped)) ! ((WaitCommEventOverlapped *)pOverlapped)->UnockDelete(); } *************** *** 949,952 **** --- 1107,1122 ---- WaitCommEventOverlapped *pOver = (WaitCommEventOverlapped *)pOverlapped; + if (!pOver->UnockDelete()) + return; + + _ASSERTE(pOver->comIo.countStartedOverlaps > 0); + pOver->comIo.countStartedOverlaps--; + + if (pOver->comIo.Handle() == INVALID_HANDLE_VALUE) { + pOver->comIo.Close(); + pOver->comIo.port.OnCommEvent(pOver, 0); + return; + } + DWORD done; *************** *** 980,983 **** --- 1150,1156 ---- } + comIo.countStartedOverlaps++; + _ASSERTE(comIo.countStartedOverlaps > 0); + return TRUE; } |
From: Vyacheslav F. <vf...@us...> - 2011-07-26 16:07:45
|
Update of /cvsroot/com0com/com0com/sys In directory vz-cvs-4.sog:/tmp/cvs-serv5867 Modified Files: openclos.c Log Message: Fixed double closing Index: openclos.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/openclos.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** openclos.c 2 Dec 2008 16:10:09 -0000 1.25 --- openclos.c 26 Jul 2011 16:07:42 -0000 1.26 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2011 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.26 2011/07/26 16:07:42 vfrolov + * Fixed double closing + * * Revision 1.25 2008/12/02 16:10:09 vfrolov * Separated tracing and debuging *************** *** 121,124 **** --- 124,128 ---- if (InterlockedIncrement(&pDevExt->openCount) != 1) { InterlockedDecrement(&pDevExt->openCount); + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"FdoPortOpen ACCESS_DENIED (openCount > 0)"); return STATUS_ACCESS_DENIED; } *************** *** 128,131 **** --- 132,136 ---- if (pIoPort->plugInMode && !pIoPort->pIoPortRemote->isOpen) { InterlockedDecrement(&pDevExt->openCount); + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"FdoPortOpen ACCESS_DENIED (plugInMode && !pIoPortRemote->isOpen)"); return STATUS_ACCESS_DENIED; } *************** *** 235,240 **** --- 240,261 ---- pIoPort = pDevExt->pIoPortLocal; + KeAcquireSpinLock(pIoPort->pIoLock, &oldIrql); + + if (!pIoPort->isOpen) { + KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); + + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"FdoPortClose INVALID_DEVICE_REQUEST (!isOpen)"); + + pIrp->IoStatus.Information = 0; + pIrp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; + IoCompleteRequest(pIrp, IO_NO_INCREMENT); + + return STATUS_INVALID_DEVICE_REQUEST; + } + pIoPort->isOpen = FALSE; + KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); + if (pIoPort->pIoPortRemote->plugInMode) IoInvalidateDeviceRelations(pIoPort->pIoPortRemote->pPhDevObj, BusRelations); |
From: Vyacheslav F. <vf...@us...> - 2011-07-26 16:06:36
|
Update of /cvsroot/com0com/com0com/sys In directory vz-cvs-4.sog:/tmp/cvs-serv5553 Modified Files: trace.c Log Message: Added PID tracing on IRP_MJ_CLOSE Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/trace.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** trace.c 12 Jul 2011 18:22:02 -0000 1.38 --- trace.c 26 Jul 2011 16:06:33 -0000 1.39 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.39 2011/07/26 16:06:33 vfrolov + * Added PID tracing on IRP_MJ_CLOSE + * * Revision 1.38 2011/07/12 18:22:02 vfrolov * Discarded WDM garbage (fixed timestamp localization) *************** *** 1443,1446 **** --- 1446,1450 ---- switch (major) { case IRP_MJ_CREATE: + case IRP_MJ_CLOSE: pDestStr = AnsiStrFormat(pDestStr, &size, ", PID:%lu", PtrToUlong(PsGetCurrentProcessId())); break; |