com0com-cvs Mailing List for Null-modem emulator (Page 5)
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...> - 2010-07-29 12:18:51
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv21488 Modified Files: devutils.cpp devutils.h setup.cpp Log Message: Fixed waiting stuff Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** devutils.h 15 Jul 2010 18:11:10 -0000 1.10 --- devutils.h 29 Jul 2010 12:18:43 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2010/07/29 12:18:43 vfrolov + * Fixed waiting stuff + * * Revision 1.10 2010/07/15 18:11:10 vfrolov * Fixed --wait option for Ports class *************** *** 156,160 **** BOOL *pRebootRequired); ! int WaitNoPendingInstallEvents( int timeLimit); /////////////////////////////////////////////////////////////// --- 159,163 ---- BOOL *pRebootRequired); ! BOOL WaitNoPendingInstallEvents( int timeLimit); /////////////////////////////////////////////////////////////// Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** setup.cpp 19 Jul 2010 11:23:54 -0000 1.42 --- setup.cpp 29 Jul 2010 12:18:43 -0000 1.43 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.43 2010/07/29 12:18:43 vfrolov + * Fixed waiting stuff + * * Revision 1.42 2010/07/19 11:23:54 vfrolov * Added install command w/o prms to update driver *************** *** 384,387 **** --- 387,391 ---- } /////////////////////////////////////////////////////////////// + /* static int SleepTillPortNotFound( const char *pPortName, *************** *** 391,394 **** --- 395,401 ---- return 0; + if (int(DWORD(timeLimit * 1000)/1000) != timeLimit) + timeLimit = -1; + DWORD startTime = GetTickCount(); char path[40]; *************** *** 412,416 **** Trace("."); ! if (GetTickCount() - startTime >= DWORD(timeLimit * 1000)) { Trace(" timeout\n"); return -1; --- 419,423 ---- Trace("."); ! if (timeLimit != -1 && GetTickCount() - startTime >= DWORD(timeLimit * 1000)) { Trace(" timeout\n"); return -1; *************** *** 424,427 **** --- 431,435 ---- return int((GetTickCount() - startTime) / 1000); } + */ /////////////////////////////////////////////////////////////// static VOID CleanDevPropertiesStack( *************** *** 1008,1033 **** ComDbSync(EnumFilter); ! if (timeout > 0) { ! int timeElapsed = WaitNoPendingInstallEvents(timeout); ! ! if (!no_update) { for (int j = 0 ; j < 2 ; j++) { ! if (timeElapsed < 0) ! break; ! ! timeout -= timeElapsed; ! if (timeout < 0) timeout = 0; ! timeElapsed = SleepTillPortNotFound(portName[j], timeout); } } - - if (timeElapsed < 0 || timeout < timeElapsed) - timeout = 0; - else - timeout -= timeElapsed; } return TRUE; --- 1016,1037 ---- ComDbSync(EnumFilter); ! /* ! if (timeout > 0 && !no_update) { ! if (WaitNoPendingInstallEvents(timeout)) { ! timeout = 0; ! } else { for (int j = 0 ; j < 2 ; j++) { ! int timeElapsed = SleepTillPortNotFound(portName[j], timeout); ! if (timeElapsed < 0 || timeout < timeElapsed) { timeout = 0; + break; + } ! timeout -= timeElapsed; } } } + */ return TRUE; Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** devutils.cpp 15 Jul 2010 18:11:09 -0000 1.16 --- devutils.cpp 29 Jul 2010 12:18:43 -0000 1.17 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.17 2010/07/29 12:18:43 vfrolov + * Fixed waiting stuff + * * Revision 1.16 2010/07/15 18:11:09 vfrolov * Fixed --wait option for Ports class *************** *** 499,503 **** return FALSE; ! Sleep(1000); return TRUE; --- 502,507 ---- return FALSE; ! if (!WaitNoPendingInstallEvents(10)) ! Sleep(1000); return TRUE; *************** *** 909,913 **** } /////////////////////////////////////////////////////////////// ! int WaitNoPendingInstallEvents(int timeLimit) { typedef DWORD (WINAPI *PWAITNOPENDINGINSTALLEVENTS)(IN DWORD); --- 913,917 ---- } /////////////////////////////////////////////////////////////// ! BOOL WaitNoPendingInstallEvents(int timeLimit) { typedef DWORD (WINAPI *PWAITNOPENDINGINSTALLEVENTS)(IN DWORD); *************** *** 918,934 **** if (!hModule) ! return 0; pWaitNoPendingInstallEvents = (PWAITNOPENDINGINSTALLEVENTS)GetProcAddress(hModule, "CMP_WaitNoPendingInstallEvents"); } ! if (!pWaitNoPendingInstallEvents) ! return 0; DWORD startTime = GetTickCount(); - Trace("Wating for no pending device installation activities "); - for (BOOL count = 0 ;;) { DWORD res = pWaitNoPendingInstallEvents(0); --- 922,940 ---- if (!hModule) ! return FALSE; pWaitNoPendingInstallEvents = (PWAITNOPENDINGINSTALLEVENTS)GetProcAddress(hModule, "CMP_WaitNoPendingInstallEvents"); + + if (!pWaitNoPendingInstallEvents) + return FALSE; } ! if (int(DWORD(timeLimit * 1000)/1000) != timeLimit) ! timeLimit = -1; + BOOL inTrace = FALSE; DWORD startTime = GetTickCount(); for (BOOL count = 0 ;;) { DWORD res = pWaitNoPendingInstallEvents(0); *************** *** 940,944 **** } ! Trace(". OK\n"); break; } --- 946,952 ---- } ! if (inTrace) ! Trace(" OK\n"); ! SetLastError(ERROR_SUCCESS); break; } *************** *** 947,965 **** if (res != WAIT_TIMEOUT) { ! Trace(". FAIL\n"); ! break; } ! Trace("."); ! if (GetTickCount() - startTime >= DWORD(timeLimit * 1000)) { ! Trace(" timeout\n"); ! return -1; } Sleep(1000); } ! return int((GetTickCount() - startTime) / 1000); } /////////////////////////////////////////////////////////////// --- 955,984 ---- if (res != WAIT_TIMEOUT) { ! ShowLastError(MB_OK|MB_ICONWARNING, "CMP_WaitNoPendingInstallEvents()"); ! if (inTrace) ! Trace(" FAIL\n"); ! return FALSE; } ! DWORD timeElapsed = GetTickCount() - startTime; ! if (timeLimit != -1 && timeElapsed >= DWORD(timeLimit * 1000)) { ! if (inTrace) ! Trace(" timeout\n"); ! SetLastError(ERROR_TIMEOUT); ! break; ! } ! ! if (!inTrace) { ! Trace("Wating for no pending device installation activities "); ! inTrace = TRUE; } Sleep(1000); + + Trace("."); } ! return TRUE; } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2010-07-29 12:10:15
|
Update of /cvsroot/com0com/com0com/sys In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv20575 Modified Files: pnp.c Log Message: Added handling of IRPs that must be handled Index: pnp.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/pnp.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pnp.c 21 Jul 2010 07:39:01 -0000 1.12 --- pnp.c 29 Jul 2010 12:10:04 -0000 1.13 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2010/07/29 12:10:04 vfrolov + * Added handling of IRPs that must be handled + * * Revision 1.12 2010/07/21 07:39:01 vfrolov * Added handling of IRPs that all PnP drivers must handle *************** *** 250,253 **** --- 253,259 ---- pCaps->UniqueID = TRUE; + pCaps->Address = pCaps->UINumber = + (pDevExt->pIoPortLocal == &pDevExt->pBusExt->childs[0].ioPort ? 0 : 1); + return STATUS_SUCCESS; } *************** *** 317,321 **** IN PIRP pIrp) { ! NTSTATUS status; PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(pIrp); --- 323,327 ---- IN PIRP pIrp) { ! NTSTATUS status = pIrp->IoStatus.Status; PIO_STACK_LOCATION pIrpStack = IoGetCurrentIrpStackLocation(pIrp); *************** *** 335,349 **** case IRP_MN_QUERY_DEVICE_RELATIONS: switch (pIrpStack->Parameters.QueryDeviceRelations.Type) { ! case RemovalRelations: status = STATUS_SUCCESS; break; case BusRelations: case EjectionRelations: case PowerRelations: - case TargetDeviceRelation: default: ! status = pIrp->IoStatus.Status; } break; case IRP_MN_REMOVE_DEVICE: case IRP_MN_START_DEVICE: --- 341,377 ---- case IRP_MN_QUERY_DEVICE_RELATIONS: switch (pIrpStack->Parameters.QueryDeviceRelations.Type) { ! case TargetDeviceRelation: { ! PDEVICE_RELATIONS pRelations; ! ! HALT_UNLESS(pIrp->IoStatus.Information == 0); ! ! if (pIrp->IoStatus.Information != 0) ! break; ! ! pRelations = (PDEVICE_RELATIONS)C0C_ALLOCATE_POOL(PagedPool, sizeof(DEVICE_RELATIONS)); ! ! if (!pRelations) { ! status = STATUS_INSUFFICIENT_RESOURCES; ! break; ! } ! ! pRelations->Count = 1; ! pRelations->Objects[0] = pDevExt->pDevObj; ! ObReferenceObject(pDevExt->pDevObj); ! pIrp->IoStatus.Information = (ULONG_PTR)pRelations; status = STATUS_SUCCESS; break; + } + case RemovalRelations: case BusRelations: case EjectionRelations: case PowerRelations: default: ! break; } break; + case IRP_MN_DEVICE_USAGE_NOTIFICATION: + status = STATUS_UNSUCCESSFUL; + break; case IRP_MN_REMOVE_DEVICE: case IRP_MN_START_DEVICE: *************** *** 358,362 **** break; default: ! status = pIrp->IoStatus.Status; } --- 386,390 ---- break; default: ! break; } |
From: Vyacheslav F. <vf...@us...> - 2010-07-21 07:39:09
|
Update of /cvsroot/com0com/com0com/sys In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv8417 Modified Files: pnp.c Log Message: Added handling of IRPs that all PnP drivers must handle Index: pnp.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/pnp.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pnp.c 20 Jul 2010 07:00:16 -0000 1.11 --- pnp.c 21 Jul 2010 07:39:01 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2010/07/21 07:39:01 vfrolov + * Added handling of IRPs that all PnP drivers must handle + * * Revision 1.11 2010/07/20 07:00:16 vfrolov * Fixed memory leak *************** *** 167,170 **** --- 170,183 ---- RemoveFdoBus(pDevExt); pDevExt = NULL; + pIrp->IoStatus.Status = STATUS_SUCCESS; + break; + case IRP_MN_START_DEVICE: + case IRP_MN_STOP_DEVICE: + case IRP_MN_QUERY_STOP_DEVICE: + case IRP_MN_CANCEL_STOP_DEVICE: + case IRP_MN_QUERY_REMOVE_DEVICE: + case IRP_MN_CANCEL_REMOVE_DEVICE: + case IRP_MN_SURPRISE_REMOVAL: + pIrp->IoStatus.Status = STATUS_SUCCESS; break; } *************** *** 399,406 **** --- 412,429 ---- if (pDevExt->openCount) status = STATUS_DEVICE_BUSY; + else + pIrp->IoStatus.Status = STATUS_SUCCESS; break; case IRP_MN_REMOVE_DEVICE: RemoveFdoPort(pDevExt); pDevExt = NULL; + pIrp->IoStatus.Status = STATUS_SUCCESS; + break; + case IRP_MN_START_DEVICE: + case IRP_MN_STOP_DEVICE: + case IRP_MN_QUERY_STOP_DEVICE: + case IRP_MN_CANCEL_STOP_DEVICE: + case IRP_MN_SURPRISE_REMOVAL: + pIrp->IoStatus.Status = STATUS_SUCCESS; break; } |
From: Vyacheslav F. <vf...@us...> - 2010-07-20 07:00:24
|
Update of /cvsroot/com0com/com0com/sys In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv15872 Modified Files: pnp.c Log Message: Fixed memory leak Index: pnp.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/pnp.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pnp.c 27 May 2010 11:16:46 -0000 1.10 --- pnp.c 20 Jul 2010 07:00:16 -0000 1.11 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2010/07/20 07:00:16 vfrolov + * Fixed memory leak + * * Revision 1.10 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 121,126 **** if (pPhDevExt) { if (!pDevExt->childs[i].ioPort.pDevExt) { - UNICODE_STRING portRegistryPath; UNICODE_STRING portName; RtlInitUnicodeString(&portRegistryPath, NULL); --- 124,129 ---- if (pPhDevExt) { if (!pDevExt->childs[i].ioPort.pDevExt) { UNICODE_STRING portName; + UNICODE_STRING portRegistryPath; RtlInitUnicodeString(&portRegistryPath, NULL); *************** *** 130,133 **** --- 133,138 ---- StrAppendParameterPortName(&status, &portName, portRegistryPath.Buffer); + StrFree(&portRegistryPath); + if (NT_SUCCESS(status) && portName.Length && _wcsicmp(C0C_PORT_NAME_COMCLASS, portName.Buffer) == 0) *************** *** 140,143 **** --- 145,150 ---- } + StrFree(&portName); + status = STATUS_SUCCESS; } *************** *** 151,155 **** if (pRelationsPrev) ! C0C_FREE_POOL(pRelationsPrev); pIrp->IoStatus.Information = (ULONG_PTR)pRelations; --- 158,162 ---- if (pRelationsPrev) ! ExFreePool(pRelationsPrev); pIrp->IoStatus.Information = (ULONG_PTR)pRelations; |
From: Vyacheslav F. <vf...@us...> - 2010-07-19 11:24:42
|
Update of /cvsroot/com0com/com0com In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14882 Modified Files: ReadMe.txt Log Message: Added install command w/o prms to update driver Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ReadMe.txt 7 Jun 2010 07:06:10 -0000 1.26 --- ReadMe.txt 19 Jul 2010 11:24:33 -0000 1.27 *************** *** 306,311 **** A. It's because the installing of each next port pair requires to update driver for all installed pairs. You can speed up installing of multiple com port ! pairs by using install commands with --no-update option and finish them by ! update command, for example: command> --no-update install - - --- 306,311 ---- A. It's because the installing of each next port pair requires to update driver for all installed pairs. You can speed up installing of multiple com port ! pairs by using install commands with --no-update option and then use ! install command w/o --no-update option, for example: command> --no-update install - - *************** *** 313,323 **** ... command> --no-update install - - ! command> update ! Another example: ! > cd /D "%ProgramFiles%\com0com" ! > FOR /L %i IN (0,1,249) DO setupc --no-update install - - ! > setupc update Q. I am using the 64-bit version of com0com and I am having trouble. I'd like --- 313,323 ---- ... command> --no-update install - - ! command> install ! The example of the batch program: ! cd /D "%ProgramFiles%\com0com" ! FOR /L %%i IN (0,1,249) DO setupc --no-update install - - ! setupc install Q. I am using the 64-bit version of com0com and I am having trouble. I'd like |
From: Vyacheslav F. <vf...@us...> - 2010-07-19 11:24:02
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14554 Modified Files: setup.cpp Log Message: Added install command w/o prms to update driver Added ability to use --wait option with any command Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** setup.cpp 15 Jul 2010 18:11:10 -0000 1.41 --- setup.cpp 19 Jul 2010 11:23:54 -0000 1.42 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.42 2010/07/19 11:23:54 vfrolov + * Added install command w/o prms to update driver + * Added ability to use --wait option with any command + * * Revision 1.41 2010/07/15 18:11:10 vfrolov * Fixed --wait option for Ports class *************** *** 576,580 **** } ! int Change(const char *pPhPortName, const char *pParameters) { BOOL rebootRequired = FALSE; --- 580,584 ---- } ! BOOL Change(const char *pPhPortName, const char *pParameters) { BOOL rebootRequired = FALSE; *************** *** 583,587 **** DevProperties devProperties; if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return 1; EnumDevices(EnumFilter, &devProperties, &rebootRequired, ChangeDevice, ¶ms); --- 587,591 ---- DevProperties devProperties; if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return FALSE; EnumDevices(EnumFilter, &devProperties, &rebootRequired, ChangeDevice, ¶ms); *************** *** 593,597 **** PromptReboot(); ! return 0; } /////////////////////////////////////////////////////////////// --- 597,601 ---- PromptReboot(); ! return TRUE; } /////////////////////////////////////////////////////////////// *************** *** 625,629 **** } ! int Remove(int num) { int res; --- 629,633 ---- } ! BOOL Remove(int num) { int res; *************** *** 635,639 **** DevProperties devProperties; if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return 1; EnumDevices(EnumFilter, &devProperties, &rebootRequired, RemoveDevice, &removeDeviceParams); --- 639,643 ---- DevProperties devProperties; if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return FALSE; EnumDevices(EnumFilter, &devProperties, &rebootRequired, RemoveDevice, &removeDeviceParams); *************** *** 653,659 **** if (!devProperties.DevId(C0C_PORT_DEVICE_ID)) ! return 1; if (!devProperties.Location(phPortName)) ! return 1; RemoveDevices(EnumFilter, &devProperties, NULL); --- 657,664 ---- if (!devProperties.DevId(C0C_PORT_DEVICE_ID)) ! return FALSE; ! if (!devProperties.Location(phPortName)) ! return FALSE; RemoveDevices(EnumFilter, &devProperties, NULL); *************** *** 666,676 **** PromptReboot(); ! if (res != IDCONTINUE) ! return 1; ! ! return 0; } /////////////////////////////////////////////////////////////// ! int Preinstall(const InfFileInstall *pInfFileInstallList) { for ( --- 671,678 ---- PromptReboot(); ! return (res == IDCONTINUE); } /////////////////////////////////////////////////////////////// ! BOOL Preinstall(const InfFileInstall *pInfFileInstallList) { for ( *************** *** 702,706 **** } ! return 0; err: --- 704,708 ---- } ! return TRUE; err: *************** *** 708,715 **** Trace("\nPreinstall not completed!\n"); ! return 1; } /////////////////////////////////////////////////////////////// ! int Reload( const char *pHardwareId, const char *pInfFilePath, --- 710,717 ---- Trace("\nPreinstall not completed!\n"); ! return FALSE; } /////////////////////////////////////////////////////////////// ! BOOL Reload( const char *pHardwareId, const char *pInfFilePath, *************** *** 721,729 **** DevProperties devProperties; if (!devProperties.DevId(pHardwareId)) ! return 1; if (!DisableDevices(EnumFilter, &devProperties, &rebootRequired, &stack)) { CleanDevPropertiesStack(stack, TRUE, &rebootRequired); ! return 1; } --- 723,731 ---- DevProperties devProperties; if (!devProperties.DevId(pHardwareId)) ! return FALSE; if (!DisableDevices(EnumFilter, &devProperties, &rebootRequired, &stack)) { CleanDevPropertiesStack(stack, TRUE, &rebootRequired); ! return FALSE; } *************** *** 737,741 **** if (res != IDCONTINUE) { CleanDevPropertiesStack(stack, TRUE, &rebootRequired); ! return 1; } } --- 739,743 ---- if (res != IDCONTINUE) { CleanDevPropertiesStack(stack, TRUE, &rebootRequired); ! return FALSE; } } *************** *** 752,761 **** } ! return 0; } /////////////////////////////////////////////////////////////// ! int Update(const InfFileInstall *pInfFileInstallList) { ! int res = 0; BOOL rebootRequired = FALSE; --- 754,763 ---- } ! return TRUE; } /////////////////////////////////////////////////////////////// ! BOOL Update(const InfFileInstall *pInfFileInstallList) { ! BOOL ok = TRUE; BOOL rebootRequired = FALSE; *************** *** 767,775 **** InfFile infFile(pInfFileInstall->pInfName, pInfFileInstall->pInfName); ! if (Reload(pInfFileInstall->pHardwareId, infFile.Path(), &rebootRequired) != 0) ! res = 1; } ! if (res != 0) { Trace("\nUpdate not completed!\n"); } --- 769,777 ---- InfFile infFile(pInfFileInstall->pInfName, pInfFileInstall->pInfName); ! if (!Reload(pInfFileInstall->pHardwareId, infFile.Path(), &rebootRequired)) ! ok = FALSE; } ! if (!ok) { Trace("\nUpdate not completed!\n"); } *************** *** 779,786 **** } ! return res; } /////////////////////////////////////////////////////////////// ! int Disable() { BOOL rebootRequired = FALSE; --- 781,788 ---- } ! return ok; } /////////////////////////////////////////////////////////////// ! BOOL Disable() { BOOL rebootRequired = FALSE; *************** *** 788,803 **** DevProperties devProperties; if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return 1; if (!DisableDevices(EnumFilter, &devProperties, &rebootRequired, NULL)) ! return 1; if (rebootRequired) PromptReboot(); ! return 0; } /////////////////////////////////////////////////////////////// ! int Enable() { BOOL rebootRequired = FALSE; --- 790,805 ---- DevProperties devProperties; if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return FALSE; if (!DisableDevices(EnumFilter, &devProperties, &rebootRequired, NULL)) ! return FALSE; if (rebootRequired) PromptReboot(); ! return TRUE; } /////////////////////////////////////////////////////////////// ! BOOL Enable() { BOOL rebootRequired = FALSE; *************** *** 805,812 **** DevProperties devProperties; if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return 1; if (!EnableDevices(EnumFilter, &devProperties, &rebootRequired)) { ! return 1; } --- 807,814 ---- DevProperties devProperties; if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) ! return FALSE; if (!EnableDevices(EnumFilter, &devProperties, &rebootRequired)) { ! return FALSE; } *************** *** 814,818 **** PromptReboot(); ! return 0; } /////////////////////////////////////////////////////////////// --- 816,844 ---- PromptReboot(); ! return TRUE; ! } ! /////////////////////////////////////////////////////////////// ! BOOL Install(const char *pInfFilePath) ! { ! if (no_update) ! return TRUE; ! ! BOOL rebootRequired = FALSE; ! ! int res; ! ! do { ! res = UpdateDriver(pInfFilePath, C0C_BUS_DEVICE_ID, 0, &rebootRequired); ! } while (res == IDTRYAGAIN); ! ! if (res != IDCONTINUE) ! return FALSE; ! ! ComDbSync(EnumFilter); ! ! if (rebootRequired) ! PromptReboot(); ! ! return TRUE; } /////////////////////////////////////////////////////////////// *************** *** 895,899 **** } ! int Install(const char *pInfFilePath, const char *pParametersA, const char *pParametersB, int num) { int i; --- 921,925 ---- } ! BOOL Install(const char *pInfFilePath, const char *pParametersA, const char *pParametersB, int num) { int i; *************** *** 983,988 **** if (timeout > 0) { ! int timeLimit = timeout; ! int timeElapsed = WaitNoPendingInstallEvents(timeLimit); if (!no_update) { --- 1009,1013 ---- if (timeout > 0) { ! int timeElapsed = WaitNoPendingInstallEvents(timeout); if (!no_update) { *************** *** 991,1005 **** break; ! timeLimit -= timeElapsed; ! if (timeLimit < 0) ! timeLimit = 0; ! timeElapsed = SleepTillPortNotFound(portName[j], timeLimit); } } } ! return 0; err: --- 1016,1035 ---- break; ! timeout -= timeElapsed; ! if (timeout < 0) ! timeout = 0; ! timeElapsed = SleepTillPortNotFound(portName[j], timeout); } } + + if (timeElapsed < 0 || timeout < timeElapsed) + timeout = 0; + else + timeout -= timeElapsed; } ! return TRUE; err: *************** *** 1007,1014 **** Trace("\nInstall not completed!\n"); ! return 1; } /////////////////////////////////////////////////////////////// ! int Uninstall( const InfFileInstall *pInfFileInstallList, const InfFile::InfFileUninstall *pInfFileUninstallList) --- 1037,1044 ---- Trace("\nInstall not completed!\n"); ! return FALSE; } /////////////////////////////////////////////////////////////// ! BOOL Uninstall( const InfFileInstall *pInfFileInstallList, const InfFile::InfFileUninstall *pInfFileUninstallList) *************** *** 1237,1241 **** goto err; ! return 0; err: --- 1267,1271 ---- goto err; ! return TRUE; err: *************** *** 1243,1254 **** Trace("\nUninstall not completed!\n"); ! return 1; } /////////////////////////////////////////////////////////////// ! int InfClean( const InfFileInstall *pInfFileInstallList, const InfFile::InfFileUninstall *pInfFileUninstallList) { ! int res = 0; InfFile **pInfFiles = NULL; const char **ppOemPathExcludeList = NULL; --- 1273,1284 ---- Trace("\nUninstall not completed!\n"); ! return FALSE; } /////////////////////////////////////////////////////////////// ! BOOL InfClean( const InfFileInstall *pInfFileInstallList, const InfFile::InfFileUninstall *pInfFileUninstallList) { ! BOOL ok = TRUE; InfFile **pInfFiles = NULL; const char **ppOemPathExcludeList = NULL; *************** *** 1276,1280 **** if (!pNewInfFiles) { ShowError(MB_OK|MB_ICONSTOP, ERROR_NOT_ENOUGH_MEMORY, "LocalAlloc(%lu)", (numInfFiles + 1) * sizeof(InfFile *)); ! res = 1; goto end; } --- 1306,1310 ---- if (!pNewInfFiles) { ShowError(MB_OK|MB_ICONSTOP, ERROR_NOT_ENOUGH_MEMORY, "LocalAlloc(%lu)", (numInfFiles + 1) * sizeof(InfFile *)); ! ok = FALSE; goto end; } *************** *** 1289,1293 **** if (!ppOemPathExcludeList) { ShowError(MB_OK|MB_ICONSTOP, ERROR_NOT_ENOUGH_MEMORY, "LocalAlloc(%lu)", (numInfFiles + 1) * sizeof(const char *)); ! res = 1; goto end; } --- 1319,1323 ---- if (!ppOemPathExcludeList) { ShowError(MB_OK|MB_ICONSTOP, ERROR_NOT_ENOUGH_MEMORY, "LocalAlloc(%lu)", (numInfFiles + 1) * sizeof(const char *)); ! ok = FALSE; goto end; } *************** *** 1299,1303 **** if (!InfFile::UninstallAllInfFiles(pInfFileUninstallList, ppOemPathExcludeList)) { ! res = 1; goto end; } --- 1329,1333 ---- if (!InfFile::UninstallAllInfFiles(pInfFileUninstallList, ppOemPathExcludeList)) { ! ok = FALSE; goto end; } *************** *** 1316,1326 **** } ! if (res != 0) Trace("\nCleaning not completed!\n"); ! return res; } /////////////////////////////////////////////////////////////// ! int ShowBusyNames(const char *pPattern) { char *pPatternUp; --- 1346,1356 ---- } ! if (!ok) Trace("\nCleaning not completed!\n"); ! return ok; } /////////////////////////////////////////////////////////////// ! BOOL ShowBusyNames(const char *pPattern) { char *pPatternUp; *************** *** 1333,1337 **** if (!pPatternUp) { ShowError(MB_OK|MB_ICONSTOP, ERROR_NOT_ENOUGH_MEMORY, "LocalAlloc(%lu)", (unsigned long)sizePattern); ! return 1; } --- 1363,1367 ---- if (!pPatternUp) { ShowError(MB_OK|MB_ICONSTOP, ERROR_NOT_ENOUGH_MEMORY, "LocalAlloc(%lu)", (unsigned long)sizePattern); ! return FALSE; } *************** *** 1364,1368 **** LocalFree(pPatternUp); ! return 1; } --- 1394,1398 ---- LocalFree(pPatternUp); ! return FALSE; } *************** *** 1393,1397 **** LocalFree(pPatternUp); ! return 1; } --- 1423,1427 ---- LocalFree(pPatternUp); ! return FALSE; } *************** *** 1445,1449 **** LocalFree(pPatternUp); ! return 1; } --- 1475,1479 ---- LocalFree(pPatternUp); ! return FALSE; } *************** *** 1471,1478 **** LocalFree(pPatternUp); ! return 0; } /////////////////////////////////////////////////////////////// ! int Help(const char *pProgName) { SetTitle(C0C_SETUP_TITLE " (HELP)"); --- 1501,1508 ---- LocalFree(pPatternUp); ! return TRUE; } /////////////////////////////////////////////////////////////// ! void Help(const char *pProgName) { SetTitle(C0C_SETUP_TITLE " (HELP)"); *************** *** 1494,1498 **** " --silent - suppress dialogs if possible\n" " --no-update - do not update driver while install command\n" ! " execution (update command expected later)\n" ); ConsoleWrite( --- 1524,1529 ---- " --silent - suppress dialogs if possible\n" " --no-update - do not update driver while install command\n" ! " execution (the other install command w/o this\n" ! " option expected later)\n" ); ConsoleWrite( *************** *** 1504,1507 **** --- 1535,1540 ---- " install <prmsA> <prmsB> (by default <n> is the first not used number),\n" " set their parameters to <prmsA> and <prmsB>\n" + " install - can be used to update driver after execution\n" + " of install commands with --no-update option\n" " remove <n> - remove a pair of linked ports with\n" " identifiers " C0C_PREF_PORT_NAME_A "<n> and " *************** *** 1572,1579 **** ConsoleWrite( "\n"); return 1; } ! /////////////////////////////////////////////////////////////// int Main(int argc, const char* argv[]) { --- 1605,1622 ---- ConsoleWrite( "\n"); + } + /////////////////////////////////////////////////////////////// + static int Complete(BOOL ok) + { + if (ok) { + if (timeout > 0) + WaitNoPendingInstallEvents(timeout); + + return 0; + } return 1; } ! int Main(int argc, const char* argv[]) { *************** *** 1582,1585 **** --- 1625,1629 ---- Silent(FALSE); + timeout = 0; detailPrms = FALSE; no_update = FALSE; *************** *** 1635,1663 **** if (argc == 1) { ! return 0; } else if (argc == 2 && !lstrcmpi(argv[1], "help")) { Help(argv[0]); ! return 0; } else if (argc == 2 && !lstrcmpi(argv[1], "quit")) { ! return 0; } else if (argc == 3 && !lstrcmpi(argv[1], "busynames")) { SetTitle(C0C_SETUP_TITLE " (BUSY NAMES)"); ! return ShowBusyNames(argv[2]); } else if (argc == 2 && !lstrcmpi(argv[1], "list")) { SetTitle(C0C_SETUP_TITLE " (LIST)"); ! return Change(NULL, NULL); } else if (argc == 4 && !lstrcmpi(argv[1], "change")) { SetTitle(C0C_SETUP_TITLE " (CHANGE)"); ! return Change(argv[2], argv[3]); } else --- 1679,1707 ---- if (argc == 1) { ! return Complete(TRUE); } else if (argc == 2 && !lstrcmpi(argv[1], "help")) { Help(argv[0]); ! return Complete(TRUE); } else if (argc == 2 && !lstrcmpi(argv[1], "quit")) { ! return Complete(TRUE); } else if (argc == 3 && !lstrcmpi(argv[1], "busynames")) { SetTitle(C0C_SETUP_TITLE " (BUSY NAMES)"); ! return Complete(ShowBusyNames(argv[2])); } else if (argc == 2 && !lstrcmpi(argv[1], "list")) { SetTitle(C0C_SETUP_TITLE " (LIST)"); ! return Complete(Change(NULL, NULL)); } else if (argc == 4 && !lstrcmpi(argv[1], "change")) { SetTitle(C0C_SETUP_TITLE " (CHANGE)"); ! return Complete(Change(argv[2], argv[3])); } else *************** *** 1668,1672 **** if (StrToInt(argv[2], &num) && num >= 0) ! return Remove(num); } else --- 1712,1716 ---- if (StrToInt(argv[2], &num) && num >= 0) ! return Complete(Remove(num)); } else *************** *** 1675,1679 **** if (!lstrcmpi(argv[2], "all")) ! return Disable(); } else --- 1719,1723 ---- if (!lstrcmpi(argv[2], "all")) ! return Complete(Disable()); } else *************** *** 1682,1691 **** if (!lstrcmpi(argv[2], "all")) ! return Enable(); } else if (argc == 2 && !lstrcmpi(argv[1], "reload")) { SetTitle(C0C_SETUP_TITLE " (RELOAD)"); ! return Reload(C0C_BUS_DEVICE_ID, NULL, NULL); } --- 1726,1735 ---- if (!lstrcmpi(argv[2], "all")) ! return Complete(Enable()); } else if (argc == 2 && !lstrcmpi(argv[1], "reload")) { SetTitle(C0C_SETUP_TITLE " (RELOAD)"); ! return Complete(Reload(C0C_BUS_DEVICE_ID, NULL, NULL)); } *************** *** 1702,1721 **** if (argc == 2 && !lstrcmpi(argv[1], "preinstall")) { SetTitle(C0C_SETUP_TITLE " (PREINSTALL)"); ! return Preinstall(infFileInstallList); } else if (argc == 2 && !lstrcmpi(argv[1], "uninstall")) { SetTitle(C0C_SETUP_TITLE " (UNINSTALL)"); ! return Uninstall(infFileInstallList, infFileUnnstallList); } else if (argc == 2 && !lstrcmpi(argv[1], "infclean")) { SetTitle(C0C_SETUP_TITLE " (INF CLEAN)"); ! return InfClean(infFileInstallList, infFileUnnstallList); } else if (argc == 2 && !lstrcmpi(argv[1], "update")) { SetTitle(C0C_SETUP_TITLE " (UPDATE)"); ! return Update(infFileInstallList); } --- 1746,1765 ---- if (argc == 2 && !lstrcmpi(argv[1], "preinstall")) { SetTitle(C0C_SETUP_TITLE " (PREINSTALL)"); ! return Complete(Preinstall(infFileInstallList)); } else if (argc == 2 && !lstrcmpi(argv[1], "uninstall")) { SetTitle(C0C_SETUP_TITLE " (UNINSTALL)"); ! return Complete(Uninstall(infFileInstallList, infFileUnnstallList)); } else if (argc == 2 && !lstrcmpi(argv[1], "infclean")) { SetTitle(C0C_SETUP_TITLE " (INF CLEAN)"); ! return Complete(InfClean(infFileInstallList, infFileUnnstallList)); } else if (argc == 2 && !lstrcmpi(argv[1], "update")) { SetTitle(C0C_SETUP_TITLE " (UPDATE)"); ! return Complete(Update(infFileInstallList)); } *************** *** 1727,1733 **** return 1; if (argc == 4 && !lstrcmpi(argv[1], "install")) { SetTitle(C0C_SETUP_TITLE " (INSTALL)"); ! return Install(pPath, argv[2], argv[3], -1); } else --- 1771,1782 ---- return 1; + if (argc == 2 && !lstrcmpi(argv[1], "install")) { + SetTitle(C0C_SETUP_TITLE " (INSTALL)"); + return Complete(Install(pPath)); + } + else if (argc == 4 && !lstrcmpi(argv[1], "install")) { SetTitle(C0C_SETUP_TITLE " (INSTALL)"); ! return Complete(Install(pPath, argv[2], argv[3], -1)); } else *************** *** 1738,1742 **** if (StrToInt(argv[2], &num) && num >= 0) ! return Install(pPath, argv[3], argv[4], num); } --- 1787,1791 ---- if (StrToInt(argv[2], &num) && num >= 0) ! return Complete(Install(pPath, argv[3], argv[4], num)); } |
From: Vyacheslav F. <vf...@us...> - 2010-07-16 07:47:22
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv12507 Modified Files: inffile.cpp Log Message: Added using SetupUninstallOEMInf() if it exists in setupapi.dll Index: inffile.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/inffile.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** inffile.cpp 27 May 2010 11:16:46 -0000 1.8 --- inffile.cpp 16 Jul 2010 07:47:13 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2010/07/16 07:47:13 vfrolov + * Added using SetupUninstallOEMInf() if it exists in setupapi.dll + * * Revision 1.8 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 439,443 **** } /////////////////////////////////////////////////////////////// - #ifndef HAVE_SetupUninstallOEMInf static BOOL UninstallFile(const char *pPath) { --- 442,445 ---- *************** *** 448,452 **** if (DeleteFile(pPath)) { ! Trace("Deleted File %s\n", pPath); } else --- 450,454 ---- if (DeleteFile(pPath)) { ! Trace("Deleted %s\n", pPath); } else *************** *** 464,468 **** return TRUE; } - #endif /* HAVE_SetupUninstallOEMInf */ static BOOL UninstallInf(const char *pPath) --- 466,469 ---- *************** *** 479,495 **** if (SNPRINTF(infPathDest, sizeof(infPathDest)/sizeof(infPathDest[0]), "%s", pPath) > 0) { ! #ifdef HAVE_SetupUninstallOEMInf ! char *pInfNameDest, *p; ! for (pInfNameDest = p = infPathDest ; *p ; p++) ! if (*p == '\\') ! pInfNameDest = p + 1; ! if (SetupUninstallOEMInf(pInfNameDest, 0, NULL)) { ! Trace("Deleted %s\n", pInfNameDest); ! } else { ! res = ShowLastError(MB_CANCELTRYCONTINUE, "SetupUninstallOEMInf(%s)", pInfNameDest); } ! #else /* HAVE_SetupUninstallOEMInf */ if (UninstallFile(infPathDest)) { int infPathDestLen = lstrlen(infPathDest); --- 480,509 ---- if (SNPRINTF(infPathDest, sizeof(infPathDest)/sizeof(infPathDest[0]), "%s", pPath) > 0) { ! typedef BOOL (WINAPI *PSETUPUNINSTALLOEMINFA)(IN PCSTR, IN DWORD, IN PVOID); ! static PSETUPUNINSTALLOEMINFA pSetupUninstallOEMInf = NULL; ! if(!pSetupUninstallOEMInf) { ! HMODULE hModule = GetModuleHandle("setupapi.dll"); ! if (hModule) { ! pSetupUninstallOEMInf = ! (PSETUPUNINSTALLOEMINFA)GetProcAddress(hModule, "SetupUninstallOEMInfA"); ! } } ! ! if (pSetupUninstallOEMInf) { ! char *pInfNameDest, *p; ! ! for (pInfNameDest = p = infPathDest ; *p ; p++) ! if (*p == '\\') ! pInfNameDest = p + 1; ! ! if (pSetupUninstallOEMInf(pInfNameDest, 0, NULL)) { ! Trace("Uninstalled %s\n", pInfNameDest); ! } else { ! res = ShowLastError(MB_CANCELTRYCONTINUE, "SetupUninstallOEMInf(%s)", pInfNameDest); ! } ! } ! else if (UninstallFile(infPathDest)) { int infPathDestLen = lstrlen(infPathDest); *************** *** 508,512 **** res = IDCANCEL; } - #endif /* HAVE_SetupUninstallOEMInf */ } else { Trace("Can't uninstall %s\n", pPath); --- 522,525 ---- |
From: Vyacheslav F. <vf...@us...> - 2010-07-15 18:11:21
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv21383 Modified Files: devutils.cpp devutils.h setup.cpp Log Message: Fixed --wait option for Ports class Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** devutils.h 7 Jun 2010 07:03:31 -0000 1.9 --- devutils.h 15 Jul 2010 18:11:10 -0000 1.10 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2010/07/15 18:11:10 vfrolov + * Fixed --wait option for Ports class + * * Revision 1.9 2010/06/07 07:03:31 vfrolov * Added wrapper UpdateDriver() for UpdateDriverForPlugAndPlayDevices() *************** *** 152,155 **** --- 155,161 ---- BOOL updateDriver, BOOL *pRebootRequired); + + int WaitNoPendingInstallEvents( + int timeLimit); /////////////////////////////////////////////////////////////// Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** setup.cpp 12 Jul 2010 18:14:44 -0000 1.40 --- setup.cpp 15 Jul 2010 18:11:10 -0000 1.41 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.41 2010/07/15 18:11:10 vfrolov + * Fixed --wait option for Ports class + * * Revision 1.40 2010/07/12 18:14:44 vfrolov * Fixed driver update duplication *************** *** 381,384 **** --- 384,390 ---- int timeLimit) { + if (lstrcmpi(C0C_PORT_NAME_COMCLASS, pPortName) == 0) + return 0; + DWORD startTime = GetTickCount(); char path[40]; *************** *** 386,390 **** SNPRINTF(path, sizeof(path)/sizeof(path[0]), "\\\\.\\%s", pPortName); ! Trace("Wating %s ", path); for (;;) { --- 392,396 ---- SNPRINTF(path, sizeof(path)/sizeof(path[0]), "\\\\.\\%s", pPortName); ! Trace("Wating for %s ", path); for (;;) { *************** *** 410,414 **** } ! Trace(" OK\n"); return int((GetTickCount() - startTime) / 1000); --- 416,420 ---- } ! Trace(". OK\n"); return int((GetTickCount() - startTime) / 1000); *************** *** 976,990 **** ComDbSync(EnumFilter); ! if (!no_update && timeout > 0) { ! for (int j = 0, timeLimit = timeout ; j < 2 ; j++) { ! int timeElapsed = SleepTillPortNotFound(portName[j], timeLimit); ! if (timeElapsed < 0) ! break; ! timeLimit -= timeElapsed; ! if (timeLimit < 0) ! timeLimit = 0; } } --- 982,1001 ---- ComDbSync(EnumFilter); ! if (timeout > 0) { ! int timeLimit = timeout; ! int timeElapsed = WaitNoPendingInstallEvents(timeLimit); ! if (!no_update) { ! for (int j = 0 ; j < 2 ; j++) { ! if (timeElapsed < 0) ! break; ! timeLimit -= timeElapsed; ! if (timeLimit < 0) ! timeLimit = 0; ! ! timeElapsed = SleepTillPortNotFound(portName[j], timeLimit); ! } } } Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** devutils.cpp 12 Jul 2010 18:14:44 -0000 1.15 --- devutils.cpp 15 Jul 2010 18:11:09 -0000 1.16 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.16 2010/07/15 18:11:09 vfrolov + * Fixed --wait option for Ports class + * * Revision 1.15 2010/07/12 18:14:44 vfrolov * Fixed driver update duplication *************** *** 906,907 **** --- 909,965 ---- } /////////////////////////////////////////////////////////////// + int WaitNoPendingInstallEvents(int timeLimit) + { + typedef DWORD (WINAPI *PWAITNOPENDINGINSTALLEVENTS)(IN DWORD); + static PWAITNOPENDINGINSTALLEVENTS pWaitNoPendingInstallEvents = NULL; + + if(!pWaitNoPendingInstallEvents) { + HMODULE hModule = GetModuleHandle("setupapi.dll"); + + if (!hModule) + return 0; + + pWaitNoPendingInstallEvents = + (PWAITNOPENDINGINSTALLEVENTS)GetProcAddress(hModule, "CMP_WaitNoPendingInstallEvents"); + } + + if (!pWaitNoPendingInstallEvents) + return 0; + + DWORD startTime = GetTickCount(); + + Trace("Wating for no pending device installation activities "); + + for (BOOL count = 0 ;;) { + DWORD res = pWaitNoPendingInstallEvents(0); + + if (res == WAIT_OBJECT_0) { + if (++count < 5) { + Sleep(100); + continue; + } + + Trace(". OK\n"); + break; + } + + count = 0; + + if (res != WAIT_TIMEOUT) { + Trace(". FAIL\n"); + break; + } + + Trace("."); + + if (GetTickCount() - startTime >= DWORD(timeLimit * 1000)) { + Trace(" timeout\n"); + return -1; + } + + Sleep(1000); + } + + return int((GetTickCount() - startTime) / 1000); + } + /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2010-07-12 18:14:53
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11683 Modified Files: devutils.cpp setup.cpp Log Message: Fixed driver update duplication Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** setup.cpp 7 Jun 2010 07:03:31 -0000 1.39 --- setup.cpp 12 Jul 2010 18:14:44 -0000 1.40 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.40 2010/07/12 18:14:44 vfrolov + * Fixed driver update duplication + * * Revision 1.39 2010/06/07 07:03:31 vfrolov * Added wrapper UpdateDriver() for UpdateDriverForPlugAndPlayDevices() *************** *** 200,204 **** const char *pInfName; const char *CopyDriversSection; - const char *pDeviceId; const char *pHardwareId; BOOL preinstallClass; --- 203,206 ---- *************** *** 207,213 **** static const InfFileInstall infFileInstallList[] = { ! { C0C_INF_NAME, C0C_COPY_DRIVERS_SECTION, C0C_BUS_DEVICE_ID, C0C_BUS_DEVICE_ID, TRUE, requiredFieldsInfBusInstall }, ! { C0C_INF_NAME_CNCPORT, NULL, C0C_PORT_DEVICE_ID, C0C_PORT_HW_ID_CNCCLASS, FALSE, requiredFieldsInfCNCPortInstall }, ! { C0C_INF_NAME_COMPORT, NULL, C0C_PORT_DEVICE_ID, C0C_PORT_HW_ID_COMCLASS, FALSE, requiredFieldsInfCOMPortInstall }, { NULL }, }; --- 209,215 ---- static const InfFileInstall infFileInstallList[] = { ! { C0C_INF_NAME, C0C_COPY_DRIVERS_SECTION, C0C_BUS_DEVICE_ID, TRUE, requiredFieldsInfBusInstall }, ! { C0C_INF_NAME_CNCPORT, NULL, C0C_PORT_HW_ID_CNCCLASS, FALSE, requiredFieldsInfCNCPortInstall }, ! { C0C_INF_NAME_COMPORT, NULL, C0C_PORT_HW_ID_COMCLASS, FALSE, requiredFieldsInfCOMPortInstall }, { NULL }, }; *************** *** 704,708 **** /////////////////////////////////////////////////////////////// int Reload( - const char *pDeviceId, const char *pHardwareId, const char *pInfFilePath, --- 706,709 ---- *************** *** 713,717 **** DevProperties devProperties; ! if (!devProperties.DevId(pDeviceId)) return 1; --- 714,718 ---- DevProperties devProperties; ! if (!devProperties.DevId(pHardwareId)) return 1; *************** *** 760,764 **** InfFile infFile(pInfFileInstall->pInfName, pInfFileInstall->pInfName); ! if (Reload(pInfFileInstall->pDeviceId, pInfFileInstall->pHardwareId, infFile.Path(), &rebootRequired) != 0) res = 1; } --- 761,765 ---- InfFile infFile(pInfFileInstall->pInfName, pInfFileInstall->pInfName); ! if (Reload(pInfFileInstall->pHardwareId, infFile.Path(), &rebootRequired) != 0) res = 1; } *************** *** 1675,1679 **** if (argc == 2 && !lstrcmpi(argv[1], "reload")) { SetTitle(C0C_SETUP_TITLE " (RELOAD)"); ! return Reload(C0C_BUS_DEVICE_ID, NULL, NULL, NULL); } --- 1676,1680 ---- if (argc == 2 && !lstrcmpi(argv[1], "reload")) { SetTitle(C0C_SETUP_TITLE " (RELOAD)"); ! return Reload(C0C_BUS_DEVICE_ID, NULL, NULL); } Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** devutils.cpp 7 Jun 2010 07:03:31 -0000 1.14 --- devutils.cpp 12 Jul 2010 18:14:44 -0000 1.15 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.15 2010/07/12 18:14:44 vfrolov + * Fixed driver update duplication + * * Revision 1.14 2010/06/07 07:03:31 vfrolov * Added wrapper UpdateDriver() for UpdateDriverForPlugAndPlayDevices() *************** *** 167,171 **** if (!SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, NULL, (PBYTE)hardwareId, sizeof(hardwareId), NULL)) { memset(hardwareId, 0, sizeof(hardwareId)); ! SNPRINTF(hardwareId, sizeof(hardwareId)/sizeof(hardwareId[0]), "UNKNOWN HARDWAREID"); } --- 170,174 ---- if (!SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, NULL, (PBYTE)hardwareId, sizeof(hardwareId), NULL)) { memset(hardwareId, 0, sizeof(hardwareId)); ! SNPRINTF(hardwareId, sizeof(hardwareId)/sizeof(hardwareId[0]), "UNKNOWN HARDWAREID" "\0"); } *************** *** 173,190 **** continue; DevParams devParams(pEnumParams); ! if (!devParams.devProperties.DevId(hardwareId)) { res = IDCANCEL; break; } - if (pEnumParams->pDevProperties && - pEnumParams->pDevProperties->DevId() && (!devParams.devProperties.DevId() || - lstrcmpi(devParams.devProperties.DevId(), pEnumParams->pDevProperties->DevId()))) - { - continue; - } - char location[40]; --- 176,202 ---- continue; + const char *pHardwareId = hardwareId; + + if (pEnumParams->pDevProperties && pEnumParams->pDevProperties->DevId()) { + while (lstrcmpi(pHardwareId, pEnumParams->pDevProperties->DevId()) != 0) { + pHardwareId = pHardwareId + lstrlen(pHardwareId) + 1; + + if (!*pHardwareId) { + pHardwareId = NULL; + break; + } + } + + if (!pHardwareId) + continue; + } + DevParams devParams(pEnumParams); ! if (!devParams.devProperties.DevId(pHardwareId)) { res = IDCANCEL; break; } char location[40]; |
From: Vyacheslav F. <vf...@us...> - 2010-06-07 14:54:57
|
Update of /cvsroot/com0com/hub4com/plugins/tcp In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv30269 Modified Files: comport.cpp Log Message: Added "Connected" and "Disconnected" messages (feature request #3010158) Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/tcp/comport.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** comport.cpp 14 Sep 2009 09:08:48 -0000 1.19 --- comport.cpp 7 Jun 2010 14:54:48 -0000 1.20 *************** *** 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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.20 2010/06/07 14:54:48 vfrolov + * Added "Connected" and "Disconnected" messages (feature request #3010158) + * * Revision 1.19 2009/09/14 09:08:48 vfrolov * Added discarding owned tick (for optimization) *************** *** 628,631 **** --- 631,636 ---- void ComPort::OnDisconnect() { + cout << name << ": Disconnected" << endl; + Close(name.c_str(), hSock); hSock = INVALID_SOCKET; *************** *** 711,714 **** --- 716,721 ---- _ASSERTE(hSock != INVALID_SOCKET); + cout << name << ": Connected" << endl; + isConnected = TRUE; |
From: Vyacheslav F. <vf...@us...> - 2010-06-07 07:06:18
|
Update of /cvsroot/com0com/com0com In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv5471 Modified Files: ReadMe.txt cncport.inf com0com.inf comport.inf Log Message: Added serenum filter Index: comport.inf =================================================================== RCS file: /cvsroot/com0com/com0com/comport.inf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** comport.inf 27 May 2010 11:08:18 -0000 1.1 --- comport.inf 7 Jun 2010 07:06:10 -0000 1.2 *************** *** 12,19 **** Signature = "$Windows NT$" Provider = %VF% ! Class = CNCPorts ClassGUID = {4D36E978-E325-11CE-BFC1-08002BE10318} CatalogFile = com0com.cat ! DriverVer = 05/22/2010,3.0.0.0 UninstallInfTag = {df799e12-3c56-421b-b298-b6d3642bc878} --- 12,20 ---- Signature = "$Windows NT$" Provider = %VF% ! Class = Ports ClassGUID = {4D36E978-E325-11CE-BFC1-08002BE10318} CatalogFile = com0com.cat ! ; MM/DD/YYYY ! DriverVer = 06/07/2010,3.0.0.0 UninstallInfTag = {df799e12-3c56-421b-b298-b6d3642bc878} *************** *** 50,60 **** [com0com_inst_port] AddReg = com0com_AddReg [com0com_inst_port.Services] AddService = com0com, %SPSVCINST_ASSOCSERVICE%, com0com_Service_Inst, com0com_EventLog_Inst [com0com_AddReg] HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" ! HKR,,PortDriver,,com0com.sys ;****************************************************************************** --- 51,71 ---- [com0com_inst_port] AddReg = com0com_AddReg + Include = msports.inf + Needs = SerialEnumerator.NT [com0com_inst_port.Services] AddService = com0com, %SPSVCINST_ASSOCSERVICE%, com0com_Service_Inst, com0com_EventLog_Inst + Include = msports.inf + Needs = SerialEnumerator.NT.Services + + [com0com_inst_port.HW] + AddReg = com0com_HW_AddReg [com0com_AddReg] + HKR,,PortSubClass,1,01 HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider" ! ! [com0com_HW_AddReg] ! HKR,,"UpperFilters",0x00010000,"serenum" ;****************************************************************************** Index: com0com.inf =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.inf,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** com0com.inf 27 May 2010 11:16:45 -0000 1.5 --- com0com.inf 7 Jun 2010 07:06:10 -0000 1.6 *************** *** 15,19 **** ClassGUID = {df799e12-3c56-421b-b298-b6d3642bc878} CatalogFile = com0com.cat ! DriverVer = 05/21/2010,3.0.0.0 UninstallInfTag = {df799e12-3c56-421b-b298-b6d3642bc878} --- 15,20 ---- ClassGUID = {df799e12-3c56-421b-b298-b6d3642bc878} CatalogFile = com0com.cat ! ; MM/DD/YYYY ! DriverVer = 06/07/2010,3.0.0.0 UninstallInfTag = {df799e12-3c56-421b-b298-b6d3642bc878} *************** *** 85,89 **** [com0com_AddReg] - HKR,,PortDriver,,com0com.sys ;****************************************************************************** --- 86,89 ---- Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ReadMe.txt 31 May 2010 07:58:14 -0000 1.25 --- ReadMe.txt 7 Jun 2010 07:06:10 -0000 1.26 *************** *** 266,269 **** --- 266,285 ---- command> install PortName=COM# - + Q. I have to somehow add a "fake" PNP device in device manager and have it + connected under COM3. I use PNPComSimulator (http://www.bds.dogma.net/pnp_part2.htm), + which can fake a PNP Serial device's response when polled by DevManager. + Is it possible to have the device manager look for PNP equipement via com0com? + A. Yes, it is. The simplest way is to put the port to the Ports class, for example: + + 1. Launch the Setup Command Prompt shortcut. + 2. Install the pair of ports, were one of them has name COM#, for example: + + command> install 0 PortName=COM# - + + After installing the Ports class port you can invoke the system-supplied advanced + settings dialog box to change the port name to COM3 by this way: + + command> change CNCA0 PortName=? + Q. Is it possible to configure the com0com to randomly corrupt the data? It would be nice to have this feature so that we can test our application Index: cncport.inf =================================================================== RCS file: /cvsroot/com0com/com0com/cncport.inf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cncport.inf 27 May 2010 11:08:18 -0000 1.1 --- cncport.inf 7 Jun 2010 07:06:10 -0000 1.2 *************** *** 15,19 **** ClassGUID = {df799e12-3c56-421b-b298-b6d3642bc878} CatalogFile = com0com.cat ! DriverVer = 05/21/2010,3.0.0.0 UninstallInfTag = {df799e12-3c56-421b-b298-b6d3642bc878} --- 15,20 ---- ClassGUID = {df799e12-3c56-421b-b298-b6d3642bc878} CatalogFile = com0com.cat ! ; MM/DD/YYYY ! DriverVer = 06/07/2010,3.0.0.0 UninstallInfTag = {df799e12-3c56-421b-b298-b6d3642bc878} *************** *** 50,59 **** [com0com_inst_port] AddReg = com0com_AddReg [com0com_inst_port.Services] AddService = com0com, %SPSVCINST_ASSOCSERVICE%, com0com_Service_Inst, com0com_EventLog_Inst [com0com_AddReg] ! HKR,,PortDriver,,com0com.sys ;****************************************************************************** --- 51,69 ---- [com0com_inst_port] AddReg = com0com_AddReg + ;Include = msports.inf + ;Needs = SerialEnumerator.NT [com0com_inst_port.Services] AddService = com0com, %SPSVCINST_ASSOCSERVICE%, com0com_Service_Inst, com0com_EventLog_Inst + ;Include = msports.inf + ;Needs = SerialEnumerator.NT.Services + + [com0com_inst_port.HW] + AddReg = com0com_HW_AddReg [com0com_AddReg] ! ! [com0com_HW_AddReg] ! ;HKR,,"UpperFilters",0x00010000,"serenum" ;****************************************************************************** |
From: Vyacheslav F. <vf...@us...> - 2010-06-07 07:03:40
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4810 Modified Files: devutils.cpp devutils.h setup.cpp Log Message: Added wrapper UpdateDriver() for UpdateDriverForPlugAndPlayDevices() Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** devutils.h 27 May 2010 11:16:46 -0000 1.8 --- devutils.h 7 Jun 2010 07:03:31 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2010/06/07 07:03:31 vfrolov + * Added wrapper UpdateDriver() for UpdateDriverForPlugAndPlayDevices() + * * Revision 1.8 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 135,138 **** --- 138,147 ---- PSP_DEVINFO_DATA pDevInfoData); + int UpdateDriver( + const char *pInfFilePath, + const char *pHardwareId, + DWORD flags, + BOOL *pRebootRequired); + BOOL InstallDevice( const char *pInfFilePath, *************** *** 141,145 **** PDEVCALLBACK pDevCallBack, void *pCallBackParam, ! BOOL update); /////////////////////////////////////////////////////////////// --- 150,155 ---- PDEVCALLBACK pDevCallBack, void *pCallBackParam, ! BOOL updateDriver, ! BOOL *pRebootRequired); /////////////////////////////////////////////////////////////// Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** setup.cpp 1 Jun 2010 06:14:10 -0000 1.38 --- setup.cpp 7 Jun 2010 07:03:31 -0000 1.39 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.39 2010/06/07 07:03:31 vfrolov + * Added wrapper UpdateDriver() for UpdateDriverForPlugAndPlayDevices() + * * Revision 1.38 2010/06/01 06:14:10 vfrolov * Improved driver updating *************** *** 718,725 **** } - BOOL rr = FALSE; - if (pHardwareId && pInfFilePath && !no_update) { ! if (!UpdateDriverForPlugAndPlayDevices(0, pHardwareId, pInfFilePath, INSTALLFLAG_FORCE, &rr)) { CleanDevPropertiesStack(stack, TRUE, &rebootRequired); return 1; --- 721,732 ---- } if (pHardwareId && pInfFilePath && !no_update) { ! int res; ! ! do { ! res = UpdateDriver(pInfFilePath, pHardwareId, INSTALLFLAG_FORCE, &rebootRequired); ! } while (res == IDTRYAGAIN); ! ! if (res != IDCONTINUE) { CleanDevPropertiesStack(stack, TRUE, &rebootRequired); return 1; *************** *** 731,735 **** ComDbSync(EnumFilter); ! if (rebootRequired || rr) { if (pRebootRequired != NULL) *pRebootRequired = TRUE; --- 738,742 ---- ComDbSync(EnumFilter); ! if (rebootRequired) { if (pRebootRequired != NULL) *pRebootRequired = TRUE; *************** *** 837,841 **** static BOOL InstallBusDevice(const char *pInfFilePath, int num) { ! return InstallDevice(pInfFilePath, C0C_BUS_DEVICE_ID, NULL, InstallDeviceCallBack, &num, !no_update); } --- 844,856 ---- static BOOL InstallBusDevice(const char *pInfFilePath, int num) { ! BOOL rebootRequired = FALSE; ! ! if (!InstallDevice(pInfFilePath, C0C_BUS_DEVICE_ID, NULL, InstallDeviceCallBack, &num, !no_update, &rebootRequired)) ! return FALSE; ! ! if (rebootRequired) ! PromptReboot(); ! ! return TRUE; } Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** devutils.cpp 27 May 2010 11:16:46 -0000 1.13 --- devutils.cpp 7 Jun 2010 07:03:31 -0000 1.14 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.14 2010/06/07 07:03:31 vfrolov + * Added wrapper UpdateDriver() for UpdateDriverForPlugAndPlayDevices() + * * Revision 1.13 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 656,659 **** --- 659,735 ---- } /////////////////////////////////////////////////////////////// + int UpdateDriver( + const char *pInfFilePath, + const char *pHardwareId, + DWORD flags, + BOOL *pRebootRequired) + { + DWORD updateErr = ERROR_SUCCESS; + + for (int i = 0 ; i < 10 ; i++) { + if (UpdateDriverForPlugAndPlayDevices(0, pHardwareId, pInfFilePath, flags, pRebootRequired)) + { + updateErr = ERROR_SUCCESS; + } else { + updateErr = GetLastError(); + + if (updateErr == ERROR_NO_SUCH_DEVINST) { + updateErr = ERROR_SUCCESS; + } + else + if (updateErr == ERROR_SHARING_VIOLATION) { + Trace("."); + Sleep(1000); + continue; + } + } + + if (i) + Trace("\n"); + + break; + } + + if (updateErr != ERROR_SUCCESS) { + if (updateErr == ERROR_FILE_NOT_FOUND) { + LONG err; + HKEY hKey; + + err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_RUNONCE, 0, KEY_READ, &hKey); + + if (err == ERROR_SUCCESS) + RegCloseKey(hKey); + + if (err == ERROR_FILE_NOT_FOUND) { + int res = ShowMsg(MB_CANCELTRYCONTINUE, + "Can't update driver. Possible it's because your Windows registry is corrupted and\n" + "there is not the following key:\n" + "\n" + "HKEY_LOCAL_MACHINE\\" REGSTR_PATH_RUNONCE "\n" + "\n" + "Continue to add the key to the registry.\n"); + + if (res == IDCONTINUE) { + err = RegCreateKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_RUNONCE, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL); + + if (err == ERROR_SUCCESS) { + RegCloseKey(hKey); + return IDTRYAGAIN; + } else { + ShowLastError(MB_OK|MB_ICONSTOP, "RegCreateKeyEx()"); + return IDCANCEL; + } + } + + return res; + } + } + + return ShowError(MB_CANCELTRYCONTINUE, updateErr, "UpdateDriverForPlugAndPlayDevices()"); + } + + return IDCONTINUE; + } + /////////////////////////////////////////////////////////////// static int TryInstallDevice( const char *pInfFilePath, *************** *** 662,672 **** PDEVCALLBACK pDevCallBack, void *pCallBackParam, ! BOOL update) { GUID classGUID; char className[32]; - DWORD updateErr; - - updateErr = ERROR_SUCCESS; if (!SetupDiGetINFClass(pInfFilePath, &classGUID, className, sizeof(className)/sizeof(className[0]), 0)) { --- 738,746 ---- PDEVCALLBACK pDevCallBack, void *pCallBackParam, ! BOOL updateDriver, ! BOOL *pRebootRequired) { GUID classGUID; char className[32]; if (!SetupDiGetINFClass(pInfFilePath, &classGUID, className, sizeof(className)/sizeof(className[0]), 0)) { *************** *** 686,690 **** } ! BOOL res; SP_DEVINFO_DATA devInfoData; --- 760,764 ---- } ! int res = IDCONTINUE; SP_DEVINFO_DATA devInfoData; *************** *** 697,704 **** */ ! res = SetupDiCreateDeviceInfo(hDevInfo, pDevId + 5, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData); } else { SetLastError(ERROR_INVALID_DEVINST_NAME); ! res = FALSE; } } --- 771,779 ---- */ ! if (!SetupDiCreateDeviceInfo(hDevInfo, pDevId + 5, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData)) ! res = IDCANCEL; } else { SetLastError(ERROR_INVALID_DEVINST_NAME); ! res = IDCANCEL; } } *************** *** 709,715 **** */ ! res = SetupDiCreateDeviceInfo(hDevInfo, pDevInstID, &classGUID, NULL, 0, 0, &devInfoData); ! if (!res && GetLastError() == ERROR_DEVINST_ALREADY_EXISTS) { char *pTmpDevInstID = NULL; --- 784,791 ---- */ ! if (!SetupDiCreateDeviceInfo(hDevInfo, pDevInstID, &classGUID, NULL, 0, 0, &devInfoData)) ! res = IDCANCEL; ! if (res != IDCONTINUE && GetLastError() == ERROR_DEVINST_ALREADY_EXISTS) { char *pTmpDevInstID = NULL; *************** *** 723,727 **** p = STRTOK_R(NULL, "\\", &pSave); ! res = SetupDiCreateDeviceInfo(hDevInfo, p, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData); } --- 799,804 ---- p = STRTOK_R(NULL, "\\", &pSave); ! if (SetupDiCreateDeviceInfo(hDevInfo, p, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData)) ! res = IDCONTINUE; } *************** *** 736,745 **** */ ! res = SetupDiCreateDeviceInfo(hDevInfo, pDevInstID, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData); } ! if (!res) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCreateDeviceInfo()"); ! goto err; } --- 813,823 ---- */ ! if (!SetupDiCreateDeviceInfo(hDevInfo, pDevInstID, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData)) ! res = IDCANCEL; } ! if (res != IDCONTINUE) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCreateDeviceInfo()"); ! goto exit1; } *************** *** 753,768 **** hardwareId[hardwareIdLen - 1] = 0; ! res = SetupDiSetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, ! (LPBYTE)hardwareId, hardwareIdLen * sizeof(hardwareId[0])); ! if (!res) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiSetDeviceRegistryProperty()"); ! goto err; } ! res = SetupDiCallClassInstaller(DIF_REGISTERDEVICE, hDevInfo, &devInfoData); ! ! if (!res) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCallClassInstaller()"); ! goto err; } --- 831,846 ---- hardwareId[hardwareIdLen - 1] = 0; ! if (!SetupDiSetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, ! (LPBYTE)hardwareId, hardwareIdLen * sizeof(hardwareId[0]))) ! { ! res = IDCANCEL; ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiSetDeviceRegistryProperty()"); ! goto exit1; } ! if (!SetupDiCallClassInstaller(DIF_REGISTERDEVICE, hDevInfo, &devInfoData)) { ! res = IDCANCEL; ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiCallClassInstaller()"); ! goto exit1; } *************** *** 771,863 **** if (!devProperties.DevId(pDevId)) { ! res = FALSE; ! goto err1; ! } ! ! res = pDevCallBack(hDevInfo, &devInfoData, &devProperties, NULL, pCallBackParam); ! ! if (!res) ! goto err1; ! } ! ! int i; ! ! for (i = 0 ; i < 10 ; i++) { ! if (update) { ! BOOL rebootRequired; ! ! res = UpdateDriverForPlugAndPlayDevices(0, pDevId, pInfFilePath, 0, &rebootRequired); ! } else { ! res = TRUE; } ! if (res) { ! updateErr = ERROR_SUCCESS; ! } else { ! updateErr = GetLastError(); ! ! if (updateErr == ERROR_SHARING_VIOLATION) { ! Trace("."); ! Sleep(1000); ! continue; ! } } - - if (i) - Trace("\n"); - - break; } ! if (updateErr != ERROR_SUCCESS) { ! err1: if (!SetupDiCallClassInstaller(DIF_REMOVE, hDevInfo, &devInfoData)) ShowLastError(MB_OK|MB_ICONWARNING, "SetupDiCallClassInstaller()"); } ! err: SetupDiDestroyDeviceInfoList(hDevInfo); ! if (updateErr != ERROR_SUCCESS) { ! if (updateErr == ERROR_FILE_NOT_FOUND) { ! LONG err; ! HKEY hKey; ! ! err = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_RUNONCE, 0, KEY_READ, &hKey); ! ! if (err == ERROR_SUCCESS) ! RegCloseKey(hKey); ! ! if (err == ERROR_FILE_NOT_FOUND) { ! int res2 = ShowMsg(MB_CANCELTRYCONTINUE, ! "Can't update driver. Possible it's because your Windows registry is corrupted and\n" ! "there is not the following key:\n" ! "\n" ! "HKEY_LOCAL_MACHINE\\" REGSTR_PATH_RUNONCE "\n" ! "\n" ! "Continue to add the key to the registry.\n"); ! ! if (res2 == IDCONTINUE) { ! err = RegCreateKeyEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_RUNONCE, 0, NULL, 0, KEY_WRITE, NULL, &hKey, NULL); ! ! if (err == ERROR_SUCCESS) { ! RegCloseKey(hKey); ! return IDTRYAGAIN; ! } else { ! ShowLastError(MB_OK|MB_ICONSTOP, "RegCreateKeyEx()"); ! return IDCANCEL; ! } ! } ! ! return res2; ! } ! } ! ! return ShowError(MB_CANCELTRYCONTINUE, updateErr, "UpdateDriverForPlugAndPlayDevices()"); ! } ! ! return res ? IDCONTINUE : IDCANCEL; } --- 849,877 ---- if (!devProperties.DevId(pDevId)) { ! res = IDCANCEL; ! goto exit2; } ! if (!pDevCallBack(hDevInfo, &devInfoData, &devProperties, NULL, pCallBackParam)) { ! res = IDCANCEL; ! goto exit2; } } ! if (updateDriver) ! res = UpdateDriver(pInfFilePath, pDevId, 0, pRebootRequired); + exit2: + + if (res != IDCONTINUE) { if (!SetupDiCallClassInstaller(DIF_REMOVE, hDevInfo, &devInfoData)) ShowLastError(MB_OK|MB_ICONWARNING, "SetupDiCallClassInstaller()"); } ! exit1: SetupDiDestroyDeviceInfoList(hDevInfo); ! return res; } *************** *** 868,877 **** PDEVCALLBACK pDevCallBack, void *pCallBackParam, ! BOOL update) { int res; do { ! res = TryInstallDevice(pInfFilePath, pDevId, pDevInstID, pDevCallBack, pCallBackParam, update); } while (res == IDTRYAGAIN); --- 882,892 ---- PDEVCALLBACK pDevCallBack, void *pCallBackParam, ! BOOL updateDriver, ! BOOL *pRebootRequired) { int res; do { ! res = TryInstallDevice(pInfFilePath, pDevId, pDevInstID, pDevCallBack, pCallBackParam, updateDriver, pRebootRequired); } while (res == IDTRYAGAIN); |
From: Vyacheslav F. <vf...@us...> - 2010-06-01 13:09:55
|
Update of /cvsroot/com0com/com0com/setupg In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv31561 Modified Files: Form1.resx Log Message: Added more help Index: Form1.resx =================================================================== RCS file: /cvsroot/com0com/com0com/setupg/Form1.resx,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Form1.resx 27 May 2010 11:16:46 -0000 1.7 --- Form1.resx 1 Jun 2010 13:09:45 -0000 1.8 *************** *** 140,144 **** The name is red if it's already in use by other device. Enter '-' to reset the name to the default. ! Enter 'COM#' to manage port by Ports class installer.</value> </data> <data name=">>PortNameB.Name" xml:space="preserve"> --- 140,146 ---- The name is red if it's already in use by other device. Enter '-' to reset the name to the default. ! Enter 'COM#' to manage the port by Ports class installer. ! Enter '?' to invoke the system-supplied advanced ! settings dialog box for Ports class port.</value> </data> <data name=">>PortNameB.Name" xml:space="preserve"> *************** *** 167,171 **** The name is red if it's already in use by other device. Enter '-' to reset the name to the default. ! Enter 'COM#' to manage port by Ports class installer.</value> </data> <data name=">>PortNameA.Name" xml:space="preserve"> --- 169,175 ---- The name is red if it's already in use by other device. Enter '-' to reset the name to the default. ! Enter 'COM#' to manage the port by Ports class installer. ! Enter '?' to invoke the system-supplied advanced ! settings dialog box for Ports class port.</value> </data> <data name=">>PortNameA.Name" xml:space="preserve"> |
From: Vyacheslav F. <vf...@us...> - 2010-06-01 12:54:26
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv28764 Modified Files: params.cpp Log Message: Fixed bit settings Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** params.cpp 31 May 2010 07:58:14 -0000 1.17 --- params.cpp 1 Jun 2010 12:54:12 -0000 1.18 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.18 2010/06/01 12:54:12 vfrolov + * Fixed bit settings + * * Revision 1.17 2010/05/31 07:58:14 vfrolov * Added ability to invoke the system-supplied advanced settings dialog box *************** *** 470,477 **** } ! if ((maskExplicit & bit.bit) == 0) { maskExplicit |= bit.bit; - maskChanged |= bit.bit; - } return TRUE; --- 473,478 ---- } ! if (maskChanged & bit.bit) maskExplicit |= bit.bit; return TRUE; |
From: Vyacheslav F. <vf...@us...> - 2010-06-01 06:14:18
|
Update of /cvsroot/com0com/com0com/sys In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv16787/sys Modified Files: com0com.h Log Message: Improved driver updating Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** com0com.h 27 May 2010 11:16:46 -0000 1.48 --- com0com.h 1 Jun 2010 06:14:10 -0000 1.49 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.49 2010/06/01 06:14:10 vfrolov + * Improved driver updating + * * Revision 1.48 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 185,190 **** #define C0C_PREF_WIN32_DEVICE_NAME L"\\DosDevices\\" ! #define C0C_PORT_HARDWARE_IDS_CNCCLASS C0C_PORT_DEVICE_ID L"\0" L"com0com\\cncport" L"\0" ! #define C0C_PORT_HARDWARE_IDS_COMCLASS C0C_PORT_DEVICE_ID L"\0" L"com0com\\comport" L"\0" #define C0C_DOTYPE_FB ((unsigned)0xC0C1) --- 188,193 ---- #define C0C_PREF_WIN32_DEVICE_NAME L"\\DosDevices\\" ! #define C0C_PORT_HARDWARE_IDS_CNCCLASS C0C_PORT_DEVICE_ID L"\0" C0C_PORT_HW_ID_CNCCLASS L"\0" ! #define C0C_PORT_HARDWARE_IDS_COMCLASS C0C_PORT_DEVICE_ID L"\0" C0C_PORT_HW_ID_COMCLASS L"\0" #define C0C_DOTYPE_FB ((unsigned)0xC0C1) |
From: Vyacheslav F. <vf...@us...> - 2010-06-01 06:14:18
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv16787/setup Modified Files: setup.cpp Log Message: Improved driver updating Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** setup.cpp 31 May 2010 07:58:14 -0000 1.37 --- setup.cpp 1 Jun 2010 06:14:10 -0000 1.38 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.38 2010/06/01 06:14:10 vfrolov + * Improved driver updating + * * Revision 1.37 2010/05/31 07:58:14 vfrolov * Added ability to invoke the system-supplied advanced settings dialog box *************** *** 194,197 **** --- 197,202 ---- const char *pInfName; const char *CopyDriversSection; + const char *pDeviceId; + const char *pHardwareId; BOOL preinstallClass; const InfFile::InfFileField *pRequiredFields; *************** *** 199,205 **** static const InfFileInstall infFileInstallList[] = { ! { C0C_INF_NAME, C0C_COPY_DRIVERS_SECTION, TRUE, requiredFieldsInfBusInstall }, ! { C0C_INF_NAME_CNCPORT, NULL, FALSE, requiredFieldsInfCNCPortInstall }, ! { C0C_INF_NAME_COMPORT, NULL, FALSE, requiredFieldsInfCOMPortInstall }, { NULL }, }; --- 204,210 ---- static const InfFileInstall infFileInstallList[] = { ! { C0C_INF_NAME, C0C_COPY_DRIVERS_SECTION, C0C_BUS_DEVICE_ID, C0C_BUS_DEVICE_ID, TRUE, requiredFieldsInfBusInstall }, ! { C0C_INF_NAME_CNCPORT, NULL, C0C_PORT_DEVICE_ID, C0C_PORT_HW_ID_CNCCLASS, FALSE, requiredFieldsInfCNCPortInstall }, ! { C0C_INF_NAME_COMPORT, NULL, C0C_PORT_DEVICE_ID, C0C_PORT_HW_ID_COMCLASS, FALSE, requiredFieldsInfCOMPortInstall }, { NULL }, }; *************** *** 695,699 **** } /////////////////////////////////////////////////////////////// ! int Reload(const char *pInfFilePath) { Stack stack; --- 700,708 ---- } /////////////////////////////////////////////////////////////// ! int Reload( ! const char *pDeviceId, ! const char *pHardwareId, ! const char *pInfFilePath, ! BOOL *pRebootRequired) { Stack stack; *************** *** 701,705 **** DevProperties devProperties; ! if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) return 1; --- 710,714 ---- DevProperties devProperties; ! if (!devProperties.DevId(pDeviceId)) return 1; *************** *** 711,716 **** BOOL rr = FALSE; ! if (pInfFilePath && !no_update) { ! if (!UpdateDriverForPlugAndPlayDevices(0, C0C_BUS_DEVICE_ID, pInfFilePath, INSTALLFLAG_FORCE, &rr)) { CleanDevPropertiesStack(stack, TRUE, &rebootRequired); return 1; --- 720,725 ---- BOOL rr = FALSE; ! if (pHardwareId && pInfFilePath && !no_update) { ! if (!UpdateDriverForPlugAndPlayDevices(0, pHardwareId, pInfFilePath, INSTALLFLAG_FORCE, &rr)) { CleanDevPropertiesStack(stack, TRUE, &rebootRequired); return 1; *************** *** 722,731 **** ComDbSync(EnumFilter); ! if (rebootRequired || rr) ! PromptReboot(); return 0; } /////////////////////////////////////////////////////////////// int Disable() { --- 731,771 ---- ComDbSync(EnumFilter); ! if (rebootRequired || rr) { ! if (pRebootRequired != NULL) ! *pRebootRequired = TRUE; ! else ! PromptReboot(); ! } return 0; } /////////////////////////////////////////////////////////////// + int Update(const InfFileInstall *pInfFileInstallList) + { + int res = 0; + BOOL rebootRequired = FALSE; + + for ( + const InfFileInstall *pInfFileInstall = pInfFileInstallList ; + pInfFileInstall->pInfName != NULL ; + pInfFileInstall++) + { + InfFile infFile(pInfFileInstall->pInfName, pInfFileInstall->pInfName); + + if (Reload(pInfFileInstall->pDeviceId, pInfFileInstall->pHardwareId, infFile.Path(), &rebootRequired) != 0) + res = 1; + } + + if (res != 0) { + Trace("\nUpdate not completed!\n"); + } + else + if (rebootRequired) { + PromptReboot(); + } + + return res; + } + /////////////////////////////////////////////////////////////// int Disable() { *************** *** 1620,1624 **** if (argc == 2 && !lstrcmpi(argv[1], "reload")) { SetTitle(C0C_SETUP_TITLE " (RELOAD)"); ! return Reload(NULL); } --- 1660,1664 ---- if (argc == 2 && !lstrcmpi(argv[1], "reload")) { SetTitle(C0C_SETUP_TITLE " (RELOAD)"); ! return Reload(C0C_BUS_DEVICE_ID, NULL, NULL, NULL); } *************** *** 1647,1650 **** --- 1687,1695 ---- return InfClean(infFileInstallList, infFileUnnstallList); } + else + if (argc == 2 && !lstrcmpi(argv[1], "update")) { + SetTitle(C0C_SETUP_TITLE " (UPDATE)"); + return Update(infFileInstallList); + } InfFile infFile(C0C_INF_NAME, C0C_INF_NAME); *************** *** 1668,1676 **** return Install(pPath, argv[3], argv[4], num); } - else - if (argc == 2 && !lstrcmpi(argv[1], "update")) { - SetTitle(C0C_SETUP_TITLE " (UPDATE)"); - return Reload(pPath); - } ConsoleWrite("Invalid command\n"); --- 1713,1716 ---- |
From: Vyacheslav F. <vf...@us...> - 2010-06-01 06:14:18
|
Update of /cvsroot/com0com/com0com/NSIS In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv16787/NSIS Modified Files: install.nsi Log Message: Improved driver updating Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** install.nsi 27 May 2010 11:16:46 -0000 1.18 --- install.nsi 1 Jun 2010 06:14:09 -0000 1.19 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.19 2010/06/01 06:14:09 vfrolov + * Improved driver updating + * * Revision 1.18 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 340,346 **** StrCpy $1 "--silent" - ExecWait "setupc.exe $1 --output $0 infclean" - !insertmacro MoveFileToDetails $0 - ExecWait "setupc.exe $1 --output $0 preinstall" !insertmacro MoveFileToDetails $0 --- 343,346 ---- *************** *** 349,352 **** --- 349,355 ---- !insertmacro MoveFileToDetails $0 + ExecWait "setupc.exe $1 --output $0 infclean" + !insertmacro MoveFileToDetails $0 + SectionEnd |
From: Vyacheslav F. <vf...@us...> - 2010-06-01 06:14:18
|
Update of /cvsroot/com0com/com0com/include In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv16787/include Modified Files: com0com.h Log Message: Improved driver updating Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/include/com0com.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** com0com.h 27 May 2010 11:16:46 -0000 1.11 --- com0com.h 1 Jun 2010 06:14:10 -0000 1.12 *************** *** 25,28 **** --- 25,30 ---- #define C0C_BUS_DEVICE_ID TEXT_PREF"root\\com0com" #define C0C_PORT_DEVICE_ID TEXT_PREF"com0com\\port" + #define C0C_PORT_HW_ID_CNCCLASS TEXT_PREF"com0com\\cncport" + #define C0C_PORT_HW_ID_COMCLASS TEXT_PREF"com0com\\comport" #define C0C_SERVICE TEXT_PREF"com0com" #define C0C_PREF_NT_DEVICE_NAME TEXT_PREF"\\Device\\" |
From: Vyacheslav F. <vf...@us...> - 2010-05-31 07:58:25
|
Update of /cvsroot/com0com/com0com In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11241 Modified Files: ReadMe.txt Log Message: Added ability to invoke the system-supplied advanced settings dialog box Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** ReadMe.txt 27 May 2010 11:16:45 -0000 1.24 --- ReadMe.txt 31 May 2010 07:58:14 -0000 1.25 *************** *** 134,137 **** --- 134,142 ---- The Ports class installer selects the COM port number and sets the port name to COM<n>, where <n> is the selected port number. + After installing the Ports class ports you can invoke the system-supplied advanced + settings dialog box to change the port number by this way: + + command> change CNCA0 PortName=? + command> change CNCB0 PortName=? Q. The baud rate setting does not seem to make a difference: data is always |
From: Vyacheslav F. <vf...@us...> - 2010-05-31 07:58:22
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11241/setup Modified Files: params.cpp params.h setup.cpp Log Message: Added ability to invoke the system-supplied advanced settings dialog box Index: params.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** params.h 17 Sep 2008 07:58:32 -0000 1.8 --- params.h 31 May 2010 07:58:14 -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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2010/05/31 07:58:14 vfrolov + * Added ability to invoke the system-supplied advanced settings dialog box + * * Revision 1.8 2008/09/17 07:58:32 vfrolov * Added AddRTTO and AddRITO parameters *************** *** 62,65 **** --- 65,70 ---- 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(); *************** *** 78,81 **** --- 83,88 ---- 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.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** params.cpp 27 May 2010 11:16:46 -0000 1.16 --- params.cpp 31 May 2010 07:58:14 -0000 1.17 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.17 2010/05/31 07:58:14 vfrolov + * Added ability to invoke the system-supplied advanced settings dialog box + * * Revision 1.16 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 148,151 **** --- 151,156 ---- addRITO = 0; + classChanged = FALSE; + dialogRequested = FALSE; maskChanged = 0; maskExplicit = 0; *************** *** 154,161 **** BOOL PortParameters::SetPortName(const char *pNewPortName) { ! if (lstrcmpi(portName, pNewPortName)) { SNPRINTF(portName, sizeof(portName)/sizeof(portName[0]), "%s", pNewPortName); CharUpper(portName); - maskChanged |= m_portName; } --- 159,172 ---- BOOL PortParameters::SetPortName(const char *pNewPortName) { ! if (lstrcmpi(pNewPortName, "?") == 0) { ! dialogRequested = TRUE; ! } ! else ! if (lstrcmpi(portName, pNewPortName) != 0) { ! classChanged = ((lstrcmpi(C0C_PORT_NAME_COMCLASS, portName) == 0) != ! (lstrcmpi(C0C_PORT_NAME_COMCLASS, pNewPortName) == 0)); ! maskChanged |= m_portName; SNPRINTF(portName, sizeof(portName)/sizeof(portName[0]), "%s", pNewPortName); CharUpper(portName); } *************** *** 860,864 **** "Parameters:\n" " PortName=<portname> - set port name to <portname>\n" ! " (port identifier by default).\n" " EmuBR={yes|no} - enable/disable baud rate emulation in the direction\n" " to the paired port (disabled by default)\n" --- 871,875 ---- "Parameters:\n" " PortName=<portname> - set port name to <portname>\n" ! " (port identifier by default)\n" " EmuBR={yes|no} - enable/disable baud rate emulation in the direction\n" " to the paired port (disabled by default)\n" *************** *** 893,896 **** --- 904,909 ---- "manage port name. The Ports class installer selects the COM port number and\n" "sets the port name to COM<n>, where <n> is the selected port number.\n" + "Use 'PortName=?' to invoke the system-supplied advanced settings dialog box to\n" + "change the port number.\n" "\n" "Special values:\n" Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** setup.cpp 27 May 2010 11:16:46 -0000 1.36 --- setup.cpp 31 May 2010 07:58:14 -0000 1.37 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.37 2010/05/31 07:58:14 vfrolov + * Added ability to invoke the system-supplied advanced settings dialog box + * * Revision 1.36 2010/05/27 11:16:46 vfrolov * Added ability to put the port to the Ports class *************** *** 147,150 **** --- 150,155 ---- #include "portnum.h" #include "comdb.h" + #define SERIAL_ADVANCED_SETTINGS 1 + #include <msports.h> #define TEXT_PREF *************** *** 435,438 **** --- 440,456 ---- }; + static BOOL ShowDialog( + HDEVINFO hDevInfo, + PSP_DEVINFO_DATA pDevInfoData, + PCDevProperties /*pDevProperties*/, + BOOL * /*pRebootRequired*/, + void * /*pParam*/) + { + if (SerialDisplayAdvancedSettings(NULL, hDevInfo, pDevInfoData) != ERROR_SUCCESS) + return FALSE; + + return TRUE; + } + static BOOL ChangeDevice( HDEVINFO hDevInfo, *************** *** 464,468 **** if (err == ERROR_SUCCESS) { ! if (pPhPortName && !lstrcmpi(pPhPortName, phPortName)) { char portNameOld[20]; --- 482,486 ---- if (err == ERROR_SUCCESS) { ! if (pPhPortName && lstrcmpi(pPhPortName, phPortName) == 0 && pParameters) { char portNameOld[20]; *************** *** 480,483 **** --- 498,519 ---- portParameters.FillPortName(portName, sizeof(portName)/sizeof(portName[0])); + if (!Silent() && portParameters.DialogRequested()) { + if (lstrcmpi(C0C_PORT_NAME_COMCLASS, portName) == 0) { + if (!portParameters.ClassChanged()) { + DevProperties devProperties; + if (!devProperties.DevId(C0C_PORT_DEVICE_ID)) + return FALSE; + if (!devProperties.PhObjName(phDevName)) + return FALSE; + + EnumDevices(EnumFilter, &devProperties, pRebootRequired, ShowDialog, NULL); + } else { + ShowMsg(MB_OK|MB_ICONWARNING, "Can't display the dialog while changing the class of port"); + } + } else { + ShowMsg(MB_OK|MB_ICONWARNING, "Can't display the dialog for non Ports class port"); + } + } + if (portParameters.Changed() && (!lstrcmpi(portName, portNameOld) || IsValidPortName(portName))) *************** *** 499,507 **** return FALSE; ! ! if ((lstrcmpi(C0C_PORT_NAME_COMCLASS, portName) == 0 ? 1 : 0) ^ ! (lstrcmpi(C0C_PORT_NAME_COMCLASS, portNameOld) == 0) ? 1 : 0) ! { ! Trace("Changed port class for %s PortName (%s -> %s)\n", phPortName, portNameOld, portName); DisableDevices(EnumFilter, &devProperties, pRebootRequired, NULL); // show msg if in use RemoveDevices(EnumFilter, &devProperties, pRebootRequired); --- 535,540 ---- return FALSE; ! if (portParameters.ClassChanged()) { ! Trace("Changed port class for %s (%s -> %s)\n", phPortName, portNameOld, portName); DisableDevices(EnumFilter, &devProperties, pRebootRequired, NULL); // show msg if in use RemoveDevices(EnumFilter, &devProperties, pRebootRequired); *************** *** 852,855 **** --- 885,891 ---- goto err; + if (!Silent() && portParameters.DialogRequested()) + ShowMsg(MB_OK|MB_ICONWARNING, "Can't display the dialog while installing a pair of linked ports"); + if (portParameters.Changed()) { err = portParameters.Save(); |
From: Vyacheslav F. <vf...@us...> - 2010-05-27 11:16:56
|
Update of /cvsroot/com0com/com0com/setupg In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4421/setupg Modified Files: Form1.h Form1.resx Log Message: Added ability to put the port to the Ports class Index: Form1.h =================================================================== RCS file: /cvsroot/com0com/com0com/setupg/Form1.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Form1.h 12 Jan 2009 13:04:07 -0000 1.5 --- Form1.h 27 May 2010 11:16:46 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.5 2009/01/12 13:04:07 vfrolov * Added red painting InUse portnames *************** *** 214,221 **** this->toolTip1->SetToolTip(this->picturePinMap, resources->GetString(L"picturePinMap.ToolTip")); this->picturePinMap->MouseLeave += gcnew System::EventHandler(this, &Form1::picturePinMap_MouseLeave); - this->picturePinMap->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::picturePinMap_MouseDown); this->picturePinMap->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::picturePinMap_MouseMove); - this->picturePinMap->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::picturePinMap_Paint); this->picturePinMap->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::picturePinMap_MouseDoubleClick); this->picturePinMap->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::picturePinMap_MouseUp); // --- 217,224 ---- this->toolTip1->SetToolTip(this->picturePinMap, resources->GetString(L"picturePinMap.ToolTip")); this->picturePinMap->MouseLeave += gcnew System::EventHandler(this, &Form1::picturePinMap_MouseLeave); this->picturePinMap->MouseMove += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::picturePinMap_MouseMove); this->picturePinMap->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::picturePinMap_MouseDoubleClick); + this->picturePinMap->MouseDown += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::picturePinMap_MouseDown); + this->picturePinMap->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::picturePinMap_Paint); this->picturePinMap->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &Form1::picturePinMap_MouseUp); // Index: Form1.resx =================================================================== RCS file: /cvsroot/com0com/com0com/setupg/Form1.resx,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Form1.resx 22 May 2009 11:49:06 -0000 1.6 --- Form1.resx 27 May 2010 11:16:46 -0000 1.7 *************** *** 138,144 **** <data name="PortNameB.ToolTip" xml:space="preserve"> <value>Port name. Enter '-' to reset the name to the default. ! The name is red if it's already in use by ! other device.</value> </data> <data name=">>PortNameB.Name" xml:space="preserve"> --- 138,144 ---- <data name="PortNameB.ToolTip" xml:space="preserve"> <value>Port name. + The name is red if it's already in use by other device. Enter '-' to reset the name to the default. ! Enter 'COM#' to manage port by Ports class installer.</value> </data> <data name=">>PortNameB.Name" xml:space="preserve"> *************** *** 165,171 **** <data name="PortNameA.ToolTip" xml:space="preserve"> <value>Port name. Enter '-' to reset the name to the default. ! The name is red if it's already in use by ! other device.</value> </data> <data name=">>PortNameA.Name" xml:space="preserve"> --- 165,171 ---- <data name="PortNameA.ToolTip" xml:space="preserve"> <value>Port name. + The name is red if it's already in use by other device. Enter '-' to reset the name to the default. ! Enter 'COM#' to manage port by Ports class installer.</value> </data> <data name=">>PortNameA.Name" xml:space="preserve"> *************** *** 494,497 **** --- 494,564 ---- <value>27</value> </data> + <data name="HiddenModeA.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> + <value>NoControl</value> + </data> + <data name="HiddenModeA.Location" type="System.Drawing.Point, System.Drawing"> + <value>225, 107</value> + </data> + <data name="HiddenModeA.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms"> + <value>Yes</value> + </data> + <data name="HiddenModeA.Size" type="System.Drawing.Size, System.Drawing"> + <value>180, 21</value> + </data> + <data name="HiddenModeA.TabIndex" type="System.Int32, mscorlib"> + <value>57</value> + </data> + <data name="HiddenModeA.Text" xml:space="preserve"> + <value>enable hidden mode</value> + </data> + <data name="HiddenModeA.ToolTip" xml:space="preserve"> + <value>Enable/disable hidden mode. + The hidden mode port is hidden as + it is possible for port enumerators.</value> + </data> + <data name=">>HiddenModeA.Name" xml:space="preserve"> + <value>HiddenModeA</value> + </data> + <data name=">>HiddenModeA.Type" xml:space="preserve"> + <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name=">>HiddenModeA.Parent" xml:space="preserve"> + <value>$this</value> + </data> + <data name=">>HiddenModeA.ZOrder" xml:space="preserve"> + <value>0</value> + </data> + <data name="HiddenModeB.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> + <value>NoControl</value> + </data> + <data name="HiddenModeB.Location" type="System.Drawing.Point, System.Drawing"> + <value>411, 107</value> + </data> + <data name="HiddenModeB.Size" type="System.Drawing.Size, System.Drawing"> + <value>180, 21</value> + </data> + <data name="HiddenModeB.TabIndex" type="System.Int32, mscorlib"> + <value>56</value> + </data> + <data name="HiddenModeB.Text" xml:space="preserve"> + <value>enable hidden mode</value> + </data> + <data name="HiddenModeB.ToolTip" xml:space="preserve"> + <value>Enable/disable hidden mode. + The hidden mode port is hidden as + it is possible for port enumerators.</value> + </data> + <data name=">>HiddenModeB.Name" xml:space="preserve"> + <value>HiddenModeB</value> + </data> + <data name=">>HiddenModeB.Type" xml:space="preserve"> + <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </data> + <data name=">>HiddenModeB.Parent" xml:space="preserve"> + <value>$this</value> + </data> + <data name=">>HiddenModeB.ZOrder" xml:space="preserve"> + <value>1</value> + </data> <data name="pinNameA_RX.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> <value>NoControl</value> *************** *** 1220,1290 **** <value>12</value> </data> - <data name="HiddenModeA.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> - <value>NoControl</value> - </data> - <data name="HiddenModeA.Location" type="System.Drawing.Point, System.Drawing"> - <value>225, 107</value> - </data> - <data name="HiddenModeA.RightToLeft" type="System.Windows.Forms.RightToLeft, System.Windows.Forms"> - <value>Yes</value> - </data> - <data name="HiddenModeA.Size" type="System.Drawing.Size, System.Drawing"> - <value>180, 21</value> - </data> - <data name="HiddenModeA.TabIndex" type="System.Int32, mscorlib"> - <value>57</value> - </data> - <data name="HiddenModeA.Text" xml:space="preserve"> - <value>enable hidden mode</value> - </data> - <data name="HiddenModeA.ToolTip" xml:space="preserve"> - <value>Enable/disable hidden mode. - The hidden mode port is hidden as - it is possible for port enumerators.</value> - </data> - <data name=">>HiddenModeA.Name" xml:space="preserve"> - <value>HiddenModeA</value> - </data> - <data name=">>HiddenModeA.Type" xml:space="preserve"> - <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </data> - <data name=">>HiddenModeA.Parent" xml:space="preserve"> - <value>$this</value> - </data> - <data name=">>HiddenModeA.ZOrder" xml:space="preserve"> - <value>0</value> - </data> - <data name="HiddenModeB.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms"> - <value>NoControl</value> - </data> - <data name="HiddenModeB.Location" type="System.Drawing.Point, System.Drawing"> - <value>411, 107</value> - </data> - <data name="HiddenModeB.Size" type="System.Drawing.Size, System.Drawing"> - <value>180, 21</value> - </data> - <data name="HiddenModeB.TabIndex" type="System.Int32, mscorlib"> - <value>56</value> - </data> - <data name="HiddenModeB.Text" xml:space="preserve"> - <value>enable hidden mode</value> - </data> - <data name="HiddenModeB.ToolTip" xml:space="preserve"> - <value>Enable/disable hidden mode. - The hidden mode port is hidden as - it is possible for port enumerators.</value> - </data> - <data name=">>HiddenModeB.Name" xml:space="preserve"> - <value>HiddenModeB</value> - </data> - <data name=">>HiddenModeB.Type" xml:space="preserve"> - <value>System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> - </data> - <data name=">>HiddenModeB.Parent" xml:space="preserve"> - <value>$this</value> - </data> - <data name=">>HiddenModeB.ZOrder" xml:space="preserve"> - <value>1</value> - </data> <data name="pairList.Location" type="System.Drawing.Point, System.Drawing"> <value>12, 12</value> --- 1287,1290 ---- |
From: Vyacheslav F. <vf...@us...> - 2010-05-27 11:16:56
|
Update of /cvsroot/com0com/com0com/setup In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4421/setup Modified Files: comdb.cpp comdb.h devutils.cpp devutils.h inffile.cpp inffile.h params.cpp setup.cpp Log Message: Added ability to put the port to the Ports class Index: inffile.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/inffile.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** inffile.h 19 Oct 2006 13:28:50 -0000 1.2 --- inffile.h 27 May 2010 11:16:46 -0000 1.3 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.2 2006/10/19 13:28:50 vfrolov * Added InfFile::UninstallAllInfFiles() *************** *** 34,50 **** class InfFile { public: InfFile(const char *pInfName, const char *pNearPath); ~InfFile(); const char *Path() const { return pPath; } const char *ClassGUID(BOOL showErrors = TRUE) const; const char *Class(BOOL showErrors = TRUE) const; const char *Provider(BOOL showErrors = TRUE) const; ! ! BOOL Compare( ! const char *_pClassGUID, ! const char *_pClass, ! const char *_pProvider, ! BOOL showErrors = TRUE) const; BOOL UninstallFiles(const char *pFilesSection) const; --- 37,65 ---- class InfFile { public: + struct InfFileField { + const char *pSection; + const char *pKey; + int nField; + const char *pFieldValue; + }; + + struct InfFileUninstall { + const InfFile::InfFileField *pRequiredFields; + BOOL queryConfirmation; + }; + + public: InfFile(const char *pInfName, const char *pNearPath); ~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; *************** *** 54,65 **** static BOOL UninstallAllInfFiles( ! const char *_pClassGUID, ! const char *_pClass, ! const char *_pProvider); protected: char *pPath; ! char *pClassGUID; ! char *pClass; ! char *pProvider; }; --- 69,84 ---- static BOOL UninstallAllInfFiles( ! const InfFileUninstall *pInfFileUninstallList, ! const char *const *ppOemPathExcludeList); ! protected: char *pPath; ! mutable char *pOemPath; ! mutable char *pClassGUID; ! mutable char *pClass; ! mutable char *pProvider; ! mutable char *pDriverVer; ! mutable char *pUninstallInfTag; ! mutable HINF hInf; }; Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** params.cpp 25 Dec 2008 16:55:23 -0000 1.15 --- params.cpp 27 May 2010 11:16:46 -0000 1.16 *************** *** 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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.16 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.15 2008/12/25 16:55:23 vfrolov * Added converting portnames to uppercase *************** *** 856,861 **** "\n" "Parameters:\n" ! " PortName=<name> - set port name to <name>\n" ! " (port identifier by default)\n" " EmuBR={yes|no} - enable/disable baud rate emulation in the direction\n" " to the paired port (disabled by default)\n" --- 859,864 ---- "\n" "Parameters:\n" ! " PortName=<portname> - set port name to <portname>\n" ! " (port identifier by default).\n" " EmuBR={yes|no} - enable/disable baud rate emulation in the direction\n" " to the paired port (disabled by default)\n" *************** *** 887,890 **** --- 890,897 ---- "used to invert the value.\n" "\n" + "If <portname> above is '" C0C_PORT_NAME_COMCLASS "' then the Ports class installer will be used to\n" + "manage port name. The Ports class installer selects the COM port number and\n" + "sets the port name to COM<n>, where <n> is the selected port number.\n" + "\n" "Special values:\n" " - - use driver's default value\n" Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** devutils.cpp 21 Sep 2009 08:54:05 -0000 1.12 --- devutils.cpp 27 May 2010 11:16:46 -0000 1.13 *************** *** 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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.13 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.12 2009/09/21 08:54:05 vfrolov * Added DI_NEEDRESTART check *************** *** 63,67 **** #include "precomp.h" - #include "inffile.h" #include "msg.h" #include "devutils.h" --- 66,69 ---- *************** *** 137,141 **** /////////////////////////////////////////////////////////////// static int EnumDevices( ! InfFile &infFile, DWORD flags, BOOL (* pFunk)(HDEVINFO, PSP_DEVINFO_DATA, PDevParams), --- 139,143 ---- /////////////////////////////////////////////////////////////// static int EnumDevices( ! C0C_ENUM_FILTER pFilter, DWORD flags, BOOL (* pFunk)(HDEVINFO, PSP_DEVINFO_DATA, PDevParams), *************** *** 158,186 **** for (int i = 0 ; SetupDiEnumDeviceInfo(hDevInfo, i, &devInfoData) ; i++) { ! char classGUID[100]; ! if (!SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_CLASSGUID, NULL, (PBYTE)classGUID, sizeof(classGUID), NULL)) ! continue; ! if (lstrcmpi(classGUID, infFile.ClassGUID())) continue; - char provider[100]; - - if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_MFG, NULL, (PBYTE)provider, sizeof(provider), NULL)) { - // check provider if exists - if (lstrcmpi(provider, infFile.Provider())) - continue; - } - DevParams devParams(pEnumParams); ! char hwid[40]; ! ! if (SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, NULL, (PBYTE)hwid, sizeof(hwid), NULL)) { ! if (!devParams.devProperties.DevId(hwid)) { ! res = IDCANCEL; ! break; ! } } --- 160,178 ---- for (int i = 0 ; SetupDiEnumDeviceInfo(hDevInfo, i, &devInfoData) ; i++) { ! char hardwareId[40]; ! if (!SetupDiGetDeviceRegistryProperty(hDevInfo, &devInfoData, SPDRP_HARDWAREID, NULL, (PBYTE)hardwareId, sizeof(hardwareId), NULL)) { ! memset(hardwareId, 0, sizeof(hardwareId)); ! SNPRINTF(hardwareId, sizeof(hardwareId)/sizeof(hardwareId[0]), "UNKNOWN HARDWAREID"); ! } ! if (!pFilter(hardwareId)) continue; DevParams devParams(pEnumParams); ! if (!devParams.devProperties.DevId(hardwareId)) { ! res = IDCANCEL; ! break; } *************** *** 352,356 **** int EnumDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired, --- 344,348 ---- int EnumDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, *************** *** 365,369 **** enumParams.pParam2 = pCallBackParam; ! if (EnumDevices(infFile, DIGCF_PRESENT, EnumDevice, &enumParams) != IDCONTINUE) return -1; --- 357,361 ---- enumParams.pParam2 = pCallBackParam; ! if (EnumDevices(pFilter, DIGCF_PRESENT, EnumDevice, &enumParams) != IDCONTINUE) return -1; *************** *** 469,473 **** BOOL DisableDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired, --- 461,465 ---- BOOL DisableDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, *************** *** 483,487 **** do { ! res = EnumDevices(infFile, DIGCF_PRESENT, DisableDevice, &enumParams); } while (res == IDTRYAGAIN); --- 475,479 ---- do { ! res = EnumDevices(pFilter, DIGCF_PRESENT, DisableDevice, &enumParams); } while (res == IDTRYAGAIN); *************** *** 512,516 **** BOOL EnableDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired) --- 504,508 ---- BOOL EnableDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired) *************** *** 524,528 **** do { ! res = EnumDevices(infFile, DIGCF_PRESENT, EnableDevice, &enumParams); } while (res == IDTRYAGAIN); --- 516,520 ---- do { ! res = EnumDevices(pFilter, DIGCF_PRESENT, EnableDevice, &enumParams); } while (res == IDTRYAGAIN); *************** *** 586,590 **** BOOL RestartDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired) --- 578,582 ---- BOOL RestartDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired) *************** *** 598,602 **** do { ! res = EnumDevices(infFile, DIGCF_PRESENT, RestartDevice, &enumParams); } while (res == IDTRYAGAIN); --- 590,594 ---- do { ! res = EnumDevices(pFilter, DIGCF_PRESENT, RestartDevice, &enumParams); } while (res == IDTRYAGAIN); *************** *** 635,639 **** BOOL RemoveDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired) --- 627,631 ---- BOOL RemoveDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired) *************** *** 647,651 **** do { ! res = EnumDevices(infFile, 0, RemoveDevice, &enumParams); } while (res == IDTRYAGAIN); --- 639,643 ---- do { ! res = EnumDevices(pFilter, 0, RemoveDevice, &enumParams); } while (res == IDTRYAGAIN); *************** *** 659,664 **** } /////////////////////////////////////////////////////////////// static int TryInstallDevice( ! InfFile &infFile, const char *pDevId, const char *pDevInstID, --- 651,661 ---- } /////////////////////////////////////////////////////////////// + BOOL ReenumerateDeviceNode(PSP_DEVINFO_DATA pDevInfoData) + { + return CM_Reenumerate_DevNode(pDevInfoData->DevInst, 0) == CR_SUCCESS; + } + /////////////////////////////////////////////////////////////// static int TryInstallDevice( ! const char *pInfFilePath, const char *pDevId, const char *pDevInstID, *************** *** 673,678 **** updateErr = ERROR_SUCCESS; ! if (!SetupDiGetINFClass(infFile.Path(), &classGUID, className, sizeof(className)/sizeof(className[0]), 0)) { ! ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiGetINFClass(%s)", infFile.Path()); return IDCANCEL; } --- 670,675 ---- updateErr = ERROR_SUCCESS; ! if (!SetupDiGetINFClass(pInfFilePath, &classGUID, className, sizeof(className)/sizeof(className[0]), 0)) { ! ShowLastError(MB_OK|MB_ICONSTOP, "SetupDiGetINFClass(%s)", pInfFilePath); return IDCANCEL; } *************** *** 694,697 **** --- 691,707 ---- devInfoData.cbSize = sizeof(devInfoData); + if (!pDevInstID) { + if (StrCmpNI(pDevId, "root\\", 5) == 0) { + /* + * root\<enumerator-specific-device-ID> + */ + + res = SetupDiCreateDeviceInfo(hDevInfo, pDevId + 5, &classGUID, NULL, 0, DICD_GENERATE_ID, &devInfoData); + } else { + SetLastError(ERROR_INVALID_DEVINST_NAME); + res = FALSE; + } + } + else if (StrChr(pDevInstID, '\\')) { /* *************** *** 777,781 **** BOOL rebootRequired; ! res = UpdateDriverForPlugAndPlayDevices(0, pDevId, infFile.Path(), 0, &rebootRequired); } else { res = TRUE; --- 787,791 ---- BOOL rebootRequired; ! res = UpdateDriverForPlugAndPlayDevices(0, pDevId, pInfFilePath, 0, &rebootRequired); } else { res = TRUE; *************** *** 853,857 **** BOOL InstallDevice( ! InfFile &infFile, const char *pDevId, const char *pDevInstID, --- 863,867 ---- BOOL InstallDevice( ! const char *pInfFilePath, const char *pDevId, const char *pDevInstID, *************** *** 863,867 **** do { ! res = TryInstallDevice(infFile, pDevId, pDevInstID, pDevCallBack, pCallBackParam, update); } while (res == IDTRYAGAIN); --- 873,877 ---- do { ! res = TryInstallDevice(pInfFilePath, pDevId, pDevInstID, pDevCallBack, pCallBackParam, update); } while (res == IDTRYAGAIN); Index: comdb.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/comdb.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** comdb.h 25 Dec 2008 16:57:33 -0000 1.2 --- comdb.h 27 May 2010 11:16:46 -0000 1.3 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.2 2008/12/25 16:57:33 vfrolov * Added ComDbQueryNames() *************** *** 32,39 **** /////////////////////////////////////////////////////////////// ! class InfFile; /////////////////////////////////////////////////////////////// BOOL ComDbGetInUse(const char *pPortName, BOOL &inUse); ! void ComDbSync(InfFile &infFile); DWORD ComDbQueryNames(char *pBuf, DWORD maxChars); /////////////////////////////////////////////////////////////// --- 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); /////////////////////////////////////////////////////////////// Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** setup.cpp 30 Mar 2010 08:05:15 -0000 1.35 --- setup.cpp 27 May 2010 11:16:46 -0000 1.36 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.36 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.35 2010/03/30 08:05:15 vfrolov * Fixed bugs item #2979007 "setupc command line limited to 200 chars" *************** *** 149,154 **** [...983 lines suppressed...] ! ! if (argc == 4 && !lstrcmpi(argv[1], "install")) { ! SetTitle(C0C_SETUP_TITLE " (INSTALL)"); ! return Install(pPath, argv[2], argv[3], -1); } else ! if (argc == 5 && !lstrcmpi(argv[1], "install")) { ! SetTitle(C0C_SETUP_TITLE " (INSTALL)"); ! ! int num; ! ! if (StrToInt(argv[2], &num) && num >= 0) ! return Install(pPath, argv[3], argv[4], num); ! } ! else ! if (argc == 2 && !lstrcmpi(argv[1], "update")) { ! SetTitle(C0C_SETUP_TITLE " (UPDATE)"); ! return Reload(pPath); } Index: comdb.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/comdb.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** comdb.cpp 25 Dec 2008 16:57:33 -0000 1.2 --- comdb.cpp 27 May 2010 11:16:46 -0000 1.3 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.2 2008/12/25 16:57:33 vfrolov * Added ComDbQueryNames() *************** *** 303,307 **** } ! static BOOL LoadComNames(InfFile &infFile, BusyMask &comDb) { comDb.Clear(); --- 306,310 ---- } ! static BOOL LoadComNames(C0C_ENUM_FILTER pFilter, BusyMask &comDb) { comDb.Clear(); *************** *** 312,316 **** return FALSE; ! if (EnumDevices(infFile, &devProperties, NULL, AddComNames, &comDb) < 0) return FALSE; --- 315,319 ---- return FALSE; ! if (EnumDevices(pFilter, &devProperties, NULL, AddComNames, &comDb) < 0) return FALSE; *************** *** 418,426 **** } /////////////////////////////////////////////////////////////// ! void ComDbSync(InfFile &infFile) { BusyMask comNames; ! if (!LoadComNames(infFile, comNames)) return; --- 421,429 ---- } /////////////////////////////////////////////////////////////// ! void ComDbSync(C0C_ENUM_FILTER pFilter) { BusyMask comNames; ! if (!LoadComNames(pFilter, comNames)) return; Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** devutils.h 11 Feb 2009 07:35:22 -0000 1.7 --- devutils.h 27 May 2010 11:16:46 -0000 1.8 *************** *** 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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.7 2009/02/11 07:35:22 vfrolov * Added --no-update option *************** *** 48,52 **** /////////////////////////////////////////////////////////////// - class DevProperties { public: --- 51,54 ---- *************** *** 78,82 **** typedef const DevProperties *PCDevProperties; - class InfFile; class Stack; --- 80,83 ---- *************** *** 87,95 **** BOOL *pRebootRequired, void *pParam); - /////////////////////////////////////////////////////////////// ! int EnumDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired, --- 88,96 ---- BOOL *pRebootRequired, void *pParam); /////////////////////////////////////////////////////////////// ! typedef BOOL (* C0C_ENUM_FILTER)(const char *pHardwareId); ! /////////////////////////////////////////////////////////////// int EnumDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, *************** *** 105,109 **** BOOL DisableDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired, --- 106,110 ---- BOOL DisableDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired, *************** *** 111,120 **** BOOL EnableDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired); BOOL RestartDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired); --- 112,121 ---- BOOL EnableDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired); BOOL RestartDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired); *************** *** 127,136 **** BOOL RemoveDevices( ! InfFile &infFile, PCDevProperties pDevProperties, BOOL *pRebootRequired); BOOL InstallDevice( ! InfFile &infFile, const char *pDevId, const char *pDevInstID, --- 128,140 ---- BOOL RemoveDevices( ! C0C_ENUM_FILTER pFilter, PCDevProperties pDevProperties, BOOL *pRebootRequired); + BOOL ReenumerateDeviceNode( + PSP_DEVINFO_DATA pDevInfoData); + BOOL InstallDevice( ! const char *pInfFilePath, const char *pDevId, const char *pDevInstID, *************** *** 138,142 **** void *pCallBackParam, BOOL update); - /////////////////////////////////////////////////////////////// --- 142,145 ---- Index: inffile.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/inffile.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** inffile.cpp 16 Feb 2009 10:36:16 -0000 1.7 --- inffile.cpp 27 May 2010 11:16:46 -0000 1.8 *************** *** 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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.7 2009/02/16 10:36:16 vfrolov * Done --silent option more silent *************** *** 57,73 **** return TRUE; ! char buf[4000]; ! if (!SetupGetInfInformation(pInfPath, INFINFO_INF_NAME_IS_ABSOLUTE, (PSP_INF_INFORMATION)buf, sizeof(buf), NULL)) { if (showErrors) ! ShowLastError(MB_OK|MB_ICONSTOP, "SetupGetInfInformation(%s)", pInfPath); return FALSE; } ! DWORD size; ! if (!SetupQueryInfVersionInformation((PSP_INF_INFORMATION)buf, 0, pKey, NULL, 0, &size)) { if (showErrors) ShowLastError(MB_OK|MB_ICONSTOP, "SetupQueryInfVersionInformation(%s) for %s", pKey, pInfPath); return FALSE; } --- 60,91 ---- return TRUE; ! DWORD size; ! PSP_INF_INFORMATION pInformation; ! if (!SetupGetInfInformation(pInfPath, INFINFO_INF_NAME_IS_ABSOLUTE, NULL, 0, &size)) { if (showErrors) ! ShowLastError(MB_OK|MB_ICONSTOP, "SetupGetInfInformation() for %s", pInfPath); return FALSE; } ! pInformation = (PSP_INF_INFORMATION)LocalAlloc(LPTR, size); ! if (pInformation) { ! if (!SetupGetInfInformation(pInfPath, INFINFO_INF_NAME_IS_ABSOLUTE, pInformation, size, NULL)) { ! if (showErrors) ! ShowLastError(MB_OK|MB_ICONSTOP, "SetupGetInfInformation() for %s", pInfPath); ! LocalFree(pInformation); ! return FALSE; ! } ! } else { ! SetLastError(ERROR_NOT_ENOUGH_MEMORY); ! ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc(%lu)", (unsigned long)size); ! return FALSE; ! } ! ! if (!SetupQueryInfVersionInformation(pInformation, 0, pKey, NULL, 0, &size)) { if (showErrors) ShowLastError(MB_OK|MB_ICONSTOP, "SetupQueryInfVersionInformation(%s) for %s", pKey, pInfPath); + LocalFree(pInformation); return FALSE; } *************** *** 76,84 **** if (*ppValue) { ! if (!SetupQueryInfVersionInformation((PSP_INF_INFORMATION)buf, 0, pKey, *ppValue, size, NULL)) { if (showErrors) ShowLastError(MB_OK|MB_ICONSTOP, "SetupQueryInfVersionInformation(%s) for %s", pKey, pInfPath); LocalFree(*ppValue); *ppValue = NULL; return FALSE; } --- 94,103 ---- if (*ppValue) { ! if (!SetupQueryInfVersionInformation(pInformation, 0, pKey, *ppValue, size, NULL)) { if (showErrors) ShowLastError(MB_OK|MB_ICONSTOP, "SetupQueryInfVersionInformation(%s) for %s", pKey, pInfPath); LocalFree(*ppValue); *ppValue = NULL; + LocalFree(pInformation); return FALSE; } *************** *** 86,95 **** --- 105,157 ---- SetLastError(ERROR_NOT_ENOUGH_MEMORY); ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc(%lu)", (unsigned long)(size*sizeof(*ppValue[0]))); + LocalFree(pInformation); return FALSE; } + LocalFree(pInformation); return TRUE; } /////////////////////////////////////////////////////////////// + static BOOL Open(const char *pInfPath, HINF *phInf, BOOL showErrors) + { + if (*phInf != INVALID_HANDLE_VALUE) + return TRUE; + + int res; + + do { + res = IDCONTINUE; + + UINT errLine; + *phInf = SetupOpenInfFile(pInfPath, NULL, INF_STYLE_WIN4, &errLine); + + if (*phInf == INVALID_HANDLE_VALUE) { + if (!showErrors) + break; + + res = ShowLastError(MB_CANCELTRYCONTINUE, + "SetupOpenInfFile(%s) on line %u", + pInfPath, errLine); + } + } while (res == IDTRYAGAIN); + + return *phInf != INVALID_HANDLE_VALUE; + } + /////////////////////////////////////////////////////////////// + static BOOL IsPathInList( + const char *pPath, + const char *const *ppList) + { + if (pPath == NULL || ppList == NULL) + return FALSE; + + while (*ppList) { + if (lstrcmpi(*ppList++, pPath) == 0) + return TRUE; + } + + return FALSE; + } + /////////////////////////////////////////////////////////////// static BOOL GetFilePath( const char *pFileName, *************** *** 143,152 **** InfFile::InfFile(const char *pInfName, const char *pNearPath) ! : pPath(NULL), ! pClassGUID(NULL), ! pClass(NULL), ! pProvider(NULL) { ! char path[MAX_PATH]; if (GetFilePath(pInfName, pNearPath, path, sizeof(path)/sizeof(path[0]))) { --- 205,218 ---- InfFile::InfFile(const char *pInfName, const char *pNearPath) ! : pPath(NULL) ! , pOemPath(NULL) ! , pClassGUID(NULL) ! , pClass(NULL) ! , pProvider(NULL) ! , pDriverVer(NULL) ! , pUninstallInfTag(NULL) ! , hInf(INVALID_HANDLE_VALUE) { ! char path[MAX_PATH + 1]; if (GetFilePath(pInfName, pNearPath, path, sizeof(path)/sizeof(path[0]))) { *************** *** 168,171 **** --- 234,239 ---- if (pPath) LocalFree((HLOCAL)pPath); + if (pOemPath) + LocalFree((HLOCAL)pOemPath); if (pClassGUID) LocalFree((HLOCAL)pClassGUID); *************** *** 174,182 **** if (pProvider) LocalFree((HLOCAL)pProvider); } /////////////////////////////////////////////////////////////// const char *InfFile::ClassGUID(BOOL showErrors) const { ! GetVersionInfo(pPath, "ClassGUID", &(char *)pClassGUID, showErrors); return pClassGUID; --- 242,326 ---- if (pProvider) LocalFree((HLOCAL)pProvider); + if (pUninstallInfTag) + LocalFree((HLOCAL)pUninstallInfTag); + if (pDriverVer) + LocalFree((HLOCAL)pDriverVer); + if (hInf != INVALID_HANDLE_VALUE) + SetupCloseInfFile(hInf); + } + /////////////////////////////////////////////////////////////// + BOOL InfFile::Test(const InfFileField *pFields, BOOL showErrors) const + { + if (!Open(pPath, &hInf, showErrors)) + return FALSE; + + for (const InfFileField *pField = pFields ; pField->pSection != NULL ; pField++) { + INFCONTEXT context; + + if (!SetupFindFirstLine(hInf, pField->pSection, pField->pKey, &context)) + return FALSE; + + for (;;) { + DWORD size; + + if (!SetupGetStringField(&context, pField->nField, NULL, 0, &size)) + return FALSE; + + char *pValue = (char *)LocalAlloc(LPTR, size*sizeof(pValue[0])); + + if (pValue == NULL) { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc(%lu)", (unsigned long)(size*sizeof(pValue[0]))); + return FALSE; + } + + if (!SetupGetStringField(&context, pField->nField, pValue, size, NULL)) { + LocalFree(pValue); + return FALSE; + } + + if (lstrcmpi(pValue, pField->pFieldValue) == 0) { + LocalFree(pValue); + break; + } + + LocalFree(pValue); + + if (!SetupFindNextMatchLine(&context, pField->pKey, &context)) + return FALSE; + } + } + + return TRUE; + } + /////////////////////////////////////////////////////////////// + const char *InfFile::OemPath(BOOL showErrors) const + { + if (!pOemPath) { + char path[MAX_PATH + 1]; + + if (SetupCopyOEMInf(pPath, NULL, SPOST_NONE, SP_COPY_REPLACEONLY, path, + sizeof(path)/sizeof(path[0]), NULL, NULL)) + { + int len = lstrlen(path) + 1; + + pOemPath = (char *)LocalAlloc(LPTR, len*sizeof(pOemPath[0])); + + if (pOemPath != NULL) { + SNPRINTF(pOemPath, len, "%s", path); + } else { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + if (showErrors) + ShowLastError(MB_OK|MB_ICONSTOP, "LocalAlloc(%lu)", (unsigned long)(len*sizeof(pOemPath[0]))); + } + } + } + + return pOemPath; } /////////////////////////////////////////////////////////////// const char *InfFile::ClassGUID(BOOL showErrors) const { ! GetVersionInfo(pPath, "ClassGUID", &pClassGUID, showErrors); return pClassGUID; *************** *** 185,189 **** const char *InfFile::Class(BOOL showErrors) const { ! GetVersionInfo(pPath, "Class", &(char *)pClass, showErrors); return pClass; --- 329,333 ---- const char *InfFile::Class(BOOL showErrors) const { ! GetVersionInfo(pPath, "Class", &pClass, showErrors); return pClass; *************** *** 192,209 **** const char *InfFile::Provider(BOOL showErrors) const { ! GetVersionInfo(pPath, "Provider", &(char *)pProvider, showErrors); return pProvider; } /////////////////////////////////////////////////////////////// ! BOOL InfFile::Compare( ! const char *_pClassGUID, ! const char *_pClass, ! const char *_pProvider, ! BOOL showErrors) const { ! return (!_pClassGUID || (ClassGUID(showErrors) && !lstrcmpi(pClassGUID, _pClassGUID))) && ! (!_pClass || (Class(showErrors) && !lstrcmpi(pClass, _pClass))) && ! (!_pProvider || (Provider(showErrors) && !lstrcmpi(pProvider, _pProvider))); } /////////////////////////////////////////////////////////////// --- 336,356 ---- const char *InfFile::Provider(BOOL showErrors) const { ! GetVersionInfo(pPath, "Provider", &pProvider, showErrors); return pProvider; } /////////////////////////////////////////////////////////////// ! const char *InfFile::DriverVer(BOOL showErrors) const { ! GetVersionInfo(pPath, "DriverVer", &pDriverVer, showErrors); ! ! return pDriverVer; ! } ! /////////////////////////////////////////////////////////////// ! const char *InfFile::UninstallInfTag(BOOL showErrors) const ! { ! GetVersionInfo(pPath, "UninstallInfTag", &pUninstallInfTag, showErrors); ! ! return pUninstallInfTag; } /////////////////////////////////////////////////////////////// *************** *** 237,256 **** return FALSE; ! int res; ! HINF hInf; ! ! do { ! res = IDCONTINUE; ! ! UINT errLine; ! hInf = SetupOpenInfFile(pPath, NULL, INF_STYLE_WIN4, &errLine); ! ! if (hInf == INVALID_HANDLE_VALUE) ! res = ShowLastError(MB_CANCELTRYCONTINUE, "SetupOpenInfFile(%s) on line %u", pPath, errLine); ! } while (res == IDTRYAGAIN); ! ! if (res != IDCONTINUE) return FALSE; do { res = IDCONTINUE; --- 384,392 ---- return FALSE; ! if (!Open(pPath, &hInf, TRUE)) return FALSE; + int res; + do { res = IDCONTINUE; *************** *** 280,285 **** } while (res == IDTRYAGAIN); - SetupCloseInfFile(hInf); - if (res != IDCONTINUE) return FALSE; --- 416,419 ---- *************** *** 293,307 **** return FALSE; ! if (!SetupCopyOEMInf(pPath, NULL, SPOST_PATH, SP_COPY_REPLACEONLY, NULL, 0, NULL, NULL)) { ! char infPathDest[MAX_PATH]; ! ! if (!SetupCopyOEMInf(pPath, NULL, SPOST_PATH, 0, infPathDest, ! sizeof(infPathDest)/sizeof(infPathDest[0]), NULL, NULL)) ! { ShowLastError(MB_OK|MB_ICONSTOP, "SetupCopyOEMInf(%s)", pPath); return FALSE; } ! Trace("Installed %s to %s\n", pPath, infPathDest); } --- 427,437 ---- return FALSE; ! if (!OemPath()) { ! if (!SetupCopyOEMInf(pPath, NULL, SPOST_PATH, 0, NULL, 0, NULL, NULL)) { ShowLastError(MB_OK|MB_ICONSTOP, "SetupCopyOEMInf(%s)", pPath); return FALSE; } ! Trace("Installed %s to %s\n", pPath, OemPath()); } *************** *** 338,341 **** --- 468,474 ---- static BOOL UninstallInf(const char *pPath) { + if (pPath == NULL) + return FALSE; + int res; *************** *** 343,347 **** res = IDCONTINUE; ! char infPathDest[MAX_PATH]; if (SNPRINTF(infPathDest, sizeof(infPathDest)/sizeof(infPathDest[0]), "%s", pPath) > 0) { --- 476,480 ---- res = IDCONTINUE; ! char infPathDest[MAX_PATH + 1]; if (SNPRINTF(infPathDest, sizeof(infPathDest)/sizeof(infPathDest[0]), "%s", pPath) > 0) { *************** *** 398,407 **** res = IDCONTINUE; ! char infPathDest[MAX_PATH]; ! ! if (SetupCopyOEMInf(pPath, NULL, SPOST_NONE, SP_COPY_REPLACEONLY, infPathDest, ! sizeof(infPathDest)/sizeof(infPathDest[0]), NULL, NULL)) ! { ! UninstallInf(infPathDest); } else { if (GetLastError() == ERROR_FILE_NOT_FOUND) { --- 531,536 ---- res = IDCONTINUE; ! if (OemPath()) { ! UninstallInf(OemPath()); } else { if (GetLastError() == ERROR_FILE_NOT_FOUND) { *************** *** 419,426 **** } /////////////////////////////////////////////////////////////// BOOL InfFile::UninstallAllInfFiles( ! const char *_pClassGUID, ! const char *_pClass, ! const char *_pProvider) { Trace("Scan INF files ."); --- 548,574 ---- } /////////////////////////////////////////////////////////////// + static BOOL TestUninstall( + const InfFile &infFile, + const InfFile::InfFileUninstall *pInfFileUninstallList, + BOOL queryConfirmation) + { + for ( + const InfFile::InfFileUninstall *pInfFileUninstall = pInfFileUninstallList ; + pInfFileUninstall->pRequiredFields != NULL ; + pInfFileUninstall++) + { + if (pInfFileUninstall->queryConfirmation != queryConfirmation) + continue; + + if (infFile.Test(pInfFileUninstall->pRequiredFields, FALSE)) + return TRUE; + } + + return FALSE; + } + BOOL InfFile::UninstallAllInfFiles( ! const InfFileUninstall *pInfFileUninstallList, ! const char *const *ppOemPathExcludeList) { Trace("Scan INF files ."); *************** *** 462,466 **** Trace("."); ! char windir[MAX_PATH]; size = GetEnvironmentVariable("windir", windir, sizeof(windir)/sizeof(windir[0])); --- 610,614 ---- Trace("."); ! char windir[MAX_PATH + 1]; size = GetEnvironmentVariable("windir", windir, sizeof(windir)/sizeof(windir[0])); *************** *** 499,508 **** Trace("."); ! char infPath[MAX_PATH]; if (SNPRINTF(infPath, sizeof(infPath)/sizeof(infPath[0]), "%s\\inf\\%s", windir, p) > 0) { InfFile infFile(infPath, NULL); ! if (infFile.Compare(_pClassGUID, _pClass, _pProvider, FALSE)) { int res; --- 647,666 ---- Trace("."); ! char infPath[MAX_PATH + 1]; if (SNPRINTF(infPath, sizeof(infPath)/sizeof(infPath[0]), "%s\\inf\\%s", windir, p) > 0) { InfFile infFile(infPath, NULL); + BOOL doUninstall; ! if (IsPathInList(infFile.Path(), ppOemPathExcludeList)) { ! //Trace("\nSkipped %s\n", infFile.Path()); ! doUninstall = FALSE; ! } ! else ! if (TestUninstall(infFile, pInfFileUninstallList, FALSE)) { ! doUninstall = TRUE; ! } ! else ! if (TestUninstall(infFile, pInfFileUninstallList, TRUE)) { int res; *************** *** 515,518 **** --- 673,678 ---- " Class = %s\n" " Provider = %s\n" + " DriverVer = %s\n" + " UninstallInfTag = %s\n" "\n" "Would you like to delete it?\n", *************** *** 521,542 **** infFile.ClassGUID(FALSE), infFile.Class(FALSE), ! infFile.Provider(FALSE)); } else { ! Trace("\nThe file %s possible should be deleted too\n" " ClassGUID = %s\n" " Class = %s\n" ! " Provider = %s\n", infFile.Path(), infFile.ClassGUID(FALSE), infFile.Class(FALSE), ! infFile.Provider(FALSE)); res = IDNO; } ! if (res == IDYES) { ! Trace("\n"); ! UninstallInf(infFile.Path()); } } } --- 681,718 ---- infFile.ClassGUID(FALSE), infFile.Class(FALSE), ! infFile.Provider(FALSE), ! infFile.DriverVer(FALSE), ! infFile.UninstallInfTag(FALSE)); } else { ! Trace("\nThe file %s possible should be deleted too:\n" " ClassGUID = %s\n" " Class = %s\n" ! " Provider = %s\n" ! " DriverVer = %s\n" ! " UninstallInfTag = %s\n", infFile.Path(), infFile.ClassGUID(FALSE), infFile.Class(FALSE), ! infFile.Provider(FALSE), ! infFile.DriverVer(FALSE), ! infFile.UninstallInfTag(FALSE)); res = IDNO; } ! doUninstall = (res == IDYES); ! } else { ! doUninstall = FALSE; ! } ! ! if (doUninstall) { ! Trace("\n"); ! ! if (infFile.hInf != INVALID_HANDLE_VALUE) { ! SetupCloseInfFile(infFile.hInf); ! infFile.hInf = INVALID_HANDLE_VALUE; } + + UninstallInf(infFile.Path()); } } |
From: Vyacheslav F. <vf...@us...> - 2010-05-27 11:16:54
|
Update of /cvsroot/com0com/com0com In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4421 Modified Files: ReadMe.txt com0com.inf Log Message: Added ability to put the port to the Ports class Index: com0com.inf =================================================================== RCS file: /cvsroot/com0com/com0com/com0com.inf,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** com0com.inf 15 Nov 2007 12:13:55 -0000 1.4 --- com0com.inf 27 May 2010 11:16:45 -0000 1.5 *************** *** 5,9 **** ; Installation file for the Null-modem emulator driver. ; ! ; Copyright (c) 2004-2007 Vyacheslav Frolov ; ;****************************************************************************** --- 5,9 ---- ; Installation file for the Null-modem emulator driver. ; ! ; Copyright (c) 2004-2010 Vyacheslav Frolov ; ;****************************************************************************** *************** *** 15,19 **** ClassGUID = {df799e12-3c56-421b-b298-b6d3642bc878} CatalogFile = com0com.cat ! DriverVer = 12/05/2007,2.0.0.0 ;****************************************************************************** --- 15,20 ---- ClassGUID = {df799e12-3c56-421b-b298-b6d3642bc878} CatalogFile = com0com.cat ! DriverVer = 05/21/2010,3.0.0.0 ! UninstallInfTag = {df799e12-3c56-421b-b298-b6d3642bc878} ;****************************************************************************** *************** *** 57,78 **** %VF% = com0com, NTx86, NTia64, NTamd64 - [ControlFlags] - ExcludeFromSelect = com0com\port - [com0com] %com0com.BusDesc% = com0com_inst, root\com0com - %com0com.PortDesc% = com0com_inst_port, com0com\port [com0com.NTx86] %com0com.BusDesc% = com0com_inst, root\com0com - %com0com.PortDesc% = com0com_inst_port, com0com\port [com0com.NTia64] %com0com.BusDesc% = com0com_inst, root\com0com - %com0com.PortDesc% = com0com_inst_port, com0com\port [com0com.NTamd64] %com0com.BusDesc% = com0com_inst, root\com0com - %com0com.PortDesc% = com0com_inst_port, com0com\port ;****************************************************************************** --- 58,72 ---- *************** *** 85,103 **** AddReg = com0com_AddReg CopyFiles = com0com_CopyDrivers [com0com_inst.Services] AddService = com0com, %SPSVCINST_ASSOCSERVICE%, com0com_Service_Inst, com0com_EventLog_Inst ! ;****************************************************************************** ! ; ! ; Port install section ! ; ! ;****************************************************************************** ! ! [com0com_inst_port] ! AddReg = com0com_AddReg ! ! [com0com_inst_port.Services] ! AddService = com0com, %SPSVCINST_ASSOCSERVICE%, com0com_Service_Inst, com0com_EventLog_Inst ;****************************************************************************** --- 79,89 ---- AddReg = com0com_AddReg CopyFiles = com0com_CopyDrivers + CopyINF = cncport.inf, comport.inf [com0com_inst.Services] AddService = com0com, %SPSVCINST_ASSOCSERVICE%, com0com_Service_Inst, com0com_EventLog_Inst ! [com0com_AddReg] ! HKR,,PortDriver,,com0com.sys ;****************************************************************************** *************** *** 107,113 **** ;****************************************************************************** - [com0com_AddReg] - HKR,,PortDriver,,com0com.sys - [com0com_Service_Inst] DisplayName = %com0com.SrvDesc% --- 93,96 ---- *************** *** 144,148 **** VF = "Vyacheslav Frolov" com0com.BusDesc = "com0com - bus for serial port pair emulator" - com0com.PortDesc = "com0com - serial port emulator" com0com.SrvDesc = "com0com - emulates the serial ports interconnected via a null-modem cable" ClassName = "com0com - serial port emulators" --- 127,130 ---- Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** ReadMe.txt 31 Jul 2009 12:35:19 -0000 1.23 --- ReadMe.txt 27 May 2010 11:16:45 -0000 1.24 *************** *** 126,129 **** --- 126,138 ---- command> change CNCB0 PortName=COM3 + Alternatively you can set names to 'COM#', for example: + + command> change CNCA0 PortName=COM# + command> change CNCB0 PortName=COM# + + In the last case the Ports class installer will be used to manage port names. + The Ports class installer selects the COM port number and sets the port + name to COM<n>, where <n> is the selected port number. + Q. The baud rate setting does not seem to make a difference: data is always transferred at the same speed. How to enable the baud rate emulation? *************** *** 215,219 **** Q. What version am I running? A. In the device manager, the driver properties page shows the version and date ! of the com0com.inf file, while the driver details page shows a version of com0com.sys file. The version of com0com.sys file is the version that you are running. --- 224,228 ---- Q. What version am I running? A. In the device manager, the driver properties page shows the version and date ! of the INF files, while the driver details page shows a version of com0com.sys file. The version of com0com.sys file is the version that you are running. *************** *** 245,261 **** though I have changed it's name to COMx. Is there a com0com settings that will make the port appear to be a "real" com port? ! A. No, there is not, but you can "deceive" the application this way: ! ! 1. With the "Add/Remove Hardware" wizard install new standard serial port. ! You don't need a real serial hardware to do it. Select non conflicted ! IO/IRQ resources. ! 2. With the "Device Manager" disable the newly created port (let it be ! COM4). ! 3. Launch the Setup Command Prompt shortcut. ! 4. Install the pair of ports, were one of them has name COM4, for example: ! command> install PortName=COM4 - ! Ignore a warning about the COM4 is "in use" (press Continue). Q. Is it possible to configure the com0com to randomly corrupt the data? It --- 254,263 ---- though I have changed it's name to COMx. Is there a com0com settings that will make the port appear to be a "real" com port? ! A. Yes, it is. You should put the port to the Ports class, for example: ! 1. Launch the Setup Command Prompt shortcut. ! 2. Install the pair of ports, were one of them has name COM#, for example: ! command> install PortName=COM# - Q. Is it possible to configure the com0com to randomly corrupt the data? It |
From: Vyacheslav F. <vf...@us...> - 2010-05-27 11:16:54
|
Update of /cvsroot/com0com/com0com/sys In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4421/sys Modified Files: adddev.c com0com.h pnp.c showport.c tracetbl.c Log Message: Added ability to put the port to the Ports class Index: showport.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/showport.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** showport.c 2 Dec 2008 16:10:09 -0000 1.3 --- showport.c 27 May 2010 11:16:46 -0000 1.4 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2007-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2007-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.3 2008/12/02 16:10:09 vfrolov * Separated tracing and debuging *************** *** 50,53 **** --- 53,59 ---- NTSTATUS status; + if (pDevExt->pIoPortLocal->isComClass) + return TRUE; + res = TRUE; *************** *** 64,68 **** status = ZwDeleteValueKey(hKey, &keyName); ! if (!NT_SUCCESS(status) && (pDevExt->shown & C0C_SHOW_SETNAME) != 0) { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePortName ZwDeleteValueKey(PortName) FAIL"); --- 70,78 ---- status = ZwDeleteValueKey(hKey, &keyName); ! if (NT_SUCCESS(status)) { ! Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Hidden PORTNAME"); ! } ! else ! if ((pDevExt->shown & C0C_SHOW_PORTNAME) != 0) { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePortName ZwDeleteValueKey(PortName) FAIL"); *************** *** 72,81 **** } else ! if ((pDevExt->shown & C0C_SHOW_SETNAME) != 0) { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePortName IoOpenDeviceRegistryKey(PLUGPLAY_REGKEY_DEVICE) FAIL"); } ! pDevExt->shown &= ~C0C_SHOW_SETNAME; return res; --- 82,91 ---- } else ! if ((pDevExt->shown & C0C_SHOW_PORTNAME) != 0) { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePortName IoOpenDeviceRegistryKey(PLUGPLAY_REGKEY_DEVICE) FAIL"); } ! pDevExt->shown &= ~C0C_SHOW_PORTNAME; return res; *************** *** 96,100 **** pDevExt->shown &= ~C0C_SHOW_WMIREG; ! if (!NT_SUCCESS(status)) { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePort IoWMIRegistrationControl FAIL"); --- 106,112 ---- pDevExt->shown &= ~C0C_SHOW_WMIREG; ! if (NT_SUCCESS(status)) { ! Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Hidden WMIREG"); ! } else { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePort IoWMIRegistrationControl FAIL"); *************** *** 106,110 **** pDevExt->shown &= ~C0C_SHOW_INTERFACE; ! if (!NT_SUCCESS(status)) { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePort IoSetDeviceInterfaceState FAIL"); --- 118,124 ---- pDevExt->shown &= ~C0C_SHOW_INTERFACE; ! if (NT_SUCCESS(status)) { ! Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Hidden INTERFACE"); ! } else { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePort IoSetDeviceInterfaceState FAIL"); *************** *** 117,121 **** pDevExt->shown &= ~C0C_SHOW_DEVICEMAP; ! if (!NT_SUCCESS(status)) { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePort RtlDeleteRegistryValue " C0C_SERIAL_DEVICEMAP L" FAIL"); --- 131,137 ---- pDevExt->shown &= ~C0C_SHOW_DEVICEMAP; ! if (NT_SUCCESS(status)) { ! Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Hidden DEVICEMAP"); ! } else { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePort RtlDeleteRegistryValue " C0C_SERIAL_DEVICEMAP L" FAIL"); *************** *** 127,131 **** pDevExt->shown &= ~C0C_SHOW_SYMLINK; ! if (!NT_SUCCESS(status)) { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePort IoDeleteSymbolicLink FAIL"); --- 143,149 ---- pDevExt->shown &= ~C0C_SHOW_SYMLINK; ! if (NT_SUCCESS(status)) { ! Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Hidden SYMLINK"); ! } else { res = FALSE; Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"HidePort IoDeleteSymbolicLink FAIL"); *************** *** 133,137 **** } ! if ((pDevExt->shown & C0C_SHOW_SETNAME) != 0) res = (HidePortName(pDevExt) && res); --- 151,155 ---- } ! if ((pDevExt->shown & C0C_SHOW_PORTNAME) != 0) res = (HidePortName(pDevExt) && res); *************** *** 153,157 **** res = TRUE; ! if ((pDevExt->shown & C0C_SHOW_SETNAME) == 0 && (pDevExt->hide & C0C_SHOW_SETNAME) == 0) { HANDLE hKey; --- 171,178 ---- res = TRUE; ! if (!pDevExt->pIoPortLocal->isComClass && ! (pDevExt->shown & C0C_SHOW_PORTNAME) == 0 && ! (pDevExt->hide & C0C_SHOW_PORTNAME) == 0) ! { HANDLE hKey; *************** *** 161,165 **** &hKey); ! if (status == STATUS_SUCCESS) { UNICODE_STRING keyName; --- 182,186 ---- &hKey); ! if (NT_SUCCESS(status)) { UNICODE_STRING keyName; *************** *** 174,178 **** if (NT_SUCCESS(status)) { ! pDevExt->shown |= C0C_SHOW_SETNAME; } else { res = FALSE; --- 195,200 ---- if (NT_SUCCESS(status)) { ! pDevExt->shown |= C0C_SHOW_PORTNAME; ! Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Shown PORTNAME"); } else { res = FALSE; *************** *** 196,199 **** --- 218,222 ---- if (NT_SUCCESS(status)) { pDevExt->shown |= C0C_SHOW_SYMLINK; + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Shown SYMLINK"); } else { res = FALSE; *************** *** 213,216 **** --- 236,240 ---- if (NT_SUCCESS(status)) { pDevExt->shown |= C0C_SHOW_DEVICEMAP; + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Shown DEVICEMAP"); } else { res = FALSE; *************** *** 228,231 **** --- 252,256 ---- if (NT_SUCCESS(status)) { pDevExt->shown |= C0C_SHOW_INTERFACE; + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Shown INTERFACE"); } else { res = FALSE; *************** *** 239,242 **** --- 264,268 ---- if (NT_SUCCESS(status)) { pDevExt->shown |= C0C_SHOW_WMIREG; + Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"Shown WMIREG"); } else { res = FALSE; *************** *** 255,259 **** { if (hiddenMode == 0xFFFFFFFF) ! pDevExt->hide = (C0C_SHOW_SETNAME|C0C_SHOW_DEVICEMAP|C0C_SHOW_WMIREG); else pDevExt->hide = (UCHAR)hiddenMode; --- 281,285 ---- { if (hiddenMode == 0xFFFFFFFF) ! pDevExt->hide = (C0C_SHOW_PORTNAME|C0C_SHOW_DEVICEMAP|C0C_SHOW_WMIREG); else pDevExt->hide = (UCHAR)hiddenMode; Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** com0com.h 30 Oct 2008 07:54:37 -0000 1.47 --- com0com.h 27 May 2010 11:16:46 -0000 1.48 *************** *** 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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.48 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.47 2008/10/30 07:54:37 vfrolov * Improved BREAK emulation *************** *** 182,187 **** #define C0C_PREF_WIN32_DEVICE_NAME L"\\DosDevices\\" ! #define C0C_PORT_HARDWARE_IDS C0C_PORT_DEVICE_ID L"\0" ! #define C0C_PORT_COMPATIBLE_IDS L"\0" #define C0C_DOTYPE_FB ((unsigned)0xC0C1) --- 185,190 ---- #define C0C_PREF_WIN32_DEVICE_NAME L"\\DosDevices\\" ! #define C0C_PORT_HARDWARE_IDS_CNCCLASS C0C_PORT_DEVICE_ID L"\0" L"com0com\\cncport" L"\0" ! #define C0C_PORT_HARDWARE_IDS_COMCLASS C0C_PORT_DEVICE_ID L"\0" L"com0com\\comport" L"\0" #define C0C_DOTYPE_FB ((unsigned)0xC0C1) *************** *** 360,363 **** --- 363,367 ---- BOOLEAN plugInMode; BOOLEAN exclusiveMode; + BOOLEAN isComClass; } C0C_IO_PORT, *PC0C_IO_PORT; *************** *** 382,386 **** UNICODE_STRING symbolicLinkName; ! #define C0C_SHOW_SETNAME 0x01 #define C0C_SHOW_SYMLINK 0x02 #define C0C_SHOW_DEVICEMAP 0x04 --- 386,390 ---- UNICODE_STRING symbolicLinkName; ! #define C0C_SHOW_PORTNAME 0x01 #define C0C_SHOW_SYMLINK 0x02 #define C0C_SHOW_DEVICEMAP 0x04 Index: tracetbl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/tracetbl.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** tracetbl.c 2 Dec 2008 16:10:09 -0000 1.15 --- tracetbl.c 27 May 2010 11:16:46 -0000 1.16 *************** *** 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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.16 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.15 2008/12/02 16:10:09 vfrolov * Separated tracing and debuging *************** *** 446,450 **** CODE2NAME codeNameTableShowPort[] = { ! TOCODE2NAME(C0C_SHOW_, SETNAME), TOCODE2NAME(C0C_SHOW_, SYMLINK), TOCODE2NAME(C0C_SHOW_, DEVICEMAP), --- 449,453 ---- CODE2NAME codeNameTableShowPort[] = { ! TOCODE2NAME(C0C_SHOW_, PORTNAME), TOCODE2NAME(C0C_SHOW_, SYMLINK), TOCODE2NAME(C0C_SHOW_, DEVICEMAP), Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** adddev.c 2 Dec 2008 16:10:08 -0000 1.36 --- adddev.c 27 May 2010 11:16:46 -0000 1.37 *************** *** 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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.37 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.36 2008/12/02 16:10:08 vfrolov * Separated tracing and debuging *************** *** 203,207 **** ULONG pinCTS, pinDSR, pinDCD, pinRI; UNICODE_STRING ntDeviceName; ! PWCHAR pPortName; status = STATUS_SUCCESS; --- 206,210 ---- ULONG pinCTS, pinDSR, pinDCD, pinRI; UNICODE_STRING ntDeviceName; ! PWCHAR pPhPortName; status = STATUS_SUCCESS; *************** *** 227,233 **** Trace00((PC0C_COMMON_EXTENSION)pPhDevExt, L"AddFdoPort for ", ntDeviceName.Buffer); ! pPortName = pPhDevExt->portName; ! if (!*pPortName) { status = STATUS_UNSUCCESSFUL; SysLog(pPhDevObj, status, L"AddFdoPort FAIL. The PDO has invalid port name"); --- 230,236 ---- Trace00((PC0C_COMMON_EXTENSION)pPhDevExt, L"AddFdoPort for ", ntDeviceName.Buffer); ! pPhPortName = pPhDevExt->portName; ! if (!*pPhPortName) { status = STATUS_UNSUCCESSFUL; SysLog(pPhDevObj, status, L"AddFdoPort FAIL. The PDO has invalid port name"); *************** *** 239,276 **** RtlInitUnicodeString(&portRegistryPath, NULL); ! StrAppendStr(&status, &portRegistryPath, c0cGlobal.registryPath.Buffer, c0cGlobal.registryPath.Length); ! StrAppendStr0(&status, &portRegistryPath, L"\\Parameters\\"); ! StrAppendStr0(&status, &portRegistryPath, pPortName); ! if (NT_SUCCESS(status)) { ! WCHAR portNameBuf[C0C_PORT_NAME_LEN + 1]; ! UNICODE_STRING portNameTmp; ! RTL_QUERY_REGISTRY_TABLE queryTable[2]; ! RtlZeroMemory(queryTable, sizeof(queryTable)); ! portNameTmp.Length = 0; ! portNameTmp.MaximumLength = sizeof(portNameBuf); ! portNameTmp.Buffer = portNameBuf; ! queryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED; ! queryTable[0].Name = L"PortName"; ! queryTable[0].EntryContext = &portNameTmp; ! status = RtlQueryRegistryValues( ! RTL_REGISTRY_ABSOLUTE, ! portRegistryPath.Buffer, ! queryTable, ! NULL, ! NULL); ! if (!NT_SUCCESS(status) || !portNameTmp.Length) { status = STATUS_SUCCESS; ! StrAppendStr0(&status, &portName, pPortName); } else { - StrAppendStr(&status, &portName, portNameTmp.Buffer, portNameTmp.Length); Trace00((PC0C_COMMON_EXTENSION)pPhDevExt, L"PortName set to ", portName.Buffer); } } emuBR = C0C_DEFAULT_EMUBR; --- 242,304 ---- RtlInitUnicodeString(&portRegistryPath, NULL); ! StrAppendPortParametersRegistryPath(&status, &portRegistryPath, pPhPortName); ! if (!NT_SUCCESS(status)) { ! } ! else ! if (pPhDevExt->pIoPortLocal->isComClass) { ! HANDLE hKey; ! status = IoOpenDeviceRegistryKey(pPhDevObj, ! PLUGPLAY_REGKEY_DEVICE, ! STANDARD_RIGHTS_READ, ! &hKey); ! if (NT_SUCCESS(status)) { ! UNICODE_STRING keyName; ! PKEY_VALUE_FULL_INFORMATION pInfo; ! ULONG len; ! RtlInitUnicodeString(&keyName, L"PortName"); ! len = sizeof(*pInfo) + sizeof(L"PortName") + (C0C_PORT_NAME_LEN + 1) * sizeof(WCHAR); ! pInfo = C0C_ALLOCATE_POOL(PagedPool, len); ! ! if (pInfo) { ! status = ZwQueryValueKey(hKey, &keyName, KeyValueFullInformation, pInfo, len, &len); ! ! if (NT_SUCCESS(status) && pInfo->DataLength <= ((C0C_PORT_NAME_LEN + 1) * sizeof(WCHAR))) { ! StrAppendStr( ! &status, ! &portName, ! (PWCHAR)(((PUCHAR)pInfo) + pInfo->DataOffset), ! (USHORT)(pInfo->DataLength - sizeof(WCHAR))); ! } ! ! C0C_FREE_POOL(pInfo); ! } ! ! ZwClose(hKey); ! } ! ! if (!portName.Length) { ! Trace0((PC0C_COMMON_EXTENSION)pPhDevExt, L"WARNING: Can't get PortName from COM class device node"); status = STATUS_SUCCESS; ! StrAppendStr0(&status, &portName, pPhPortName); } else { Trace00((PC0C_COMMON_EXTENSION)pPhDevExt, L"PortName set to ", portName.Buffer); } } + else { + StrAppendParameterPortName(&status, &portName, portRegistryPath.Buffer); + + if (NT_SUCCESS(status) && portName.Length) { + Trace00((PC0C_COMMON_EXTENSION)pPhDevExt, L"PortName set to ", portName.Buffer); + } else { + status = STATUS_SUCCESS; + StrAppendStr0(&status, &portName, pPhPortName); + } + } emuBR = C0C_DEFAULT_EMUBR; *************** *** 726,730 **** &hKey); ! if (status == STATUS_SUCCESS) { UNICODE_STRING keyName; PKEY_VALUE_PARTIAL_INFORMATION pInfo; --- 754,758 ---- &hKey); ! if (NT_SUCCESS(status)) { UNICODE_STRING keyName; PKEY_VALUE_PARTIAL_INFORMATION pInfo; *************** *** 733,737 **** RtlInitUnicodeString(&keyName, C0C_REGSTR_VAL_PORT_NUM); ! len = sizeof(KEY_VALUE_FULL_INFORMATION) + sizeof(ULONG); pInfo = C0C_ALLOCATE_POOL(PagedPool, len); --- 761,765 ---- RtlInitUnicodeString(&keyName, C0C_REGSTR_VAL_PORT_NUM); ! len = sizeof(*pInfo) + sizeof(ULONG); pInfo = C0C_ALLOCATE_POOL(PagedPool, len); Index: pnp.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/pnp.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pnp.c 23 Nov 2007 08:58:48 -0000 1.9 --- pnp.c 27 May 2010 11:16:46 -0000 1.10 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2004-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2004-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.10 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.9 2007/11/23 08:58:48 vfrolov * Added UniqueID capability *************** *** 92,95 **** --- 95,99 ---- countPdos++; } + if (!countPdos) break; *************** *** 111,117 **** for (i = 0 ; i < 2 ; i++) { ! if (pDevExt->childs[i].pDevExt) { ! pRelations->Objects[countRelations++] = pDevExt->childs[i].pDevExt->pDevObj; ! ObReferenceObject(pDevExt->childs[i].pDevExt->pDevObj); } } --- 115,148 ---- for (i = 0 ; i < 2 ; i++) { ! PC0C_PDOPORT_EXTENSION pPhDevExt; ! ! pPhDevExt = pDevExt->childs[i].pDevExt; ! ! if (pPhDevExt) { ! if (!pDevExt->childs[i].ioPort.pDevExt) { ! UNICODE_STRING portRegistryPath; ! UNICODE_STRING portName; ! ! RtlInitUnicodeString(&portRegistryPath, NULL); ! StrAppendPortParametersRegistryPath(&status, &portRegistryPath, pPhDevExt->portName); ! ! RtlInitUnicodeString(&portName, NULL); ! StrAppendParameterPortName(&status, &portName, portRegistryPath.Buffer); ! ! if (NT_SUCCESS(status) && portName.Length && ! _wcsicmp(C0C_PORT_NAME_COMCLASS, portName.Buffer) == 0) ! { ! pDevExt->childs[i].ioPort.isComClass = TRUE; ! Trace0((PC0C_COMMON_EXTENSION)pPhDevExt, L"Port class set to COM"); ! } else { ! pDevExt->childs[i].ioPort.isComClass = FALSE; ! Trace0((PC0C_COMMON_EXTENSION)pPhDevExt, L"Port class set to CNC"); ! } ! ! status = STATUS_SUCCESS; ! } ! ! pRelations->Objects[countRelations++] = pPhDevExt->pDevObj; ! ObReferenceObject(pPhDevExt->pDevObj); } } *************** *** 162,169 **** break; case BusQueryHardwareIDs: ! status = DupStrW(&pIDs, C0C_PORT_HARDWARE_IDS, TRUE); break; case BusQueryCompatibleIDs: ! status = DupStrW(&pIDs, C0C_PORT_COMPATIBLE_IDS, TRUE); break; case BusQueryInstanceID: --- 193,205 ---- break; case BusQueryHardwareIDs: ! status = DupStrW( ! &pIDs, ! (pDevExt->pIoPortLocal && pDevExt->pIoPortLocal->isComClass) ? ! C0C_PORT_HARDWARE_IDS_COMCLASS : ! C0C_PORT_HARDWARE_IDS_CNCCLASS, ! TRUE); break; case BusQueryCompatibleIDs: ! status = DupStrW(&pIDs, L"\0", TRUE); break; case BusQueryInstanceID: |
From: Vyacheslav F. <vf...@us...> - 2010-05-27 11:16:53
|
Update of /cvsroot/com0com/com0com/NSIS In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv4421/NSIS Modified Files: install.nsi Log Message: Added ability to put the port to the Ports class Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** install.nsi 22 May 2009 11:32:52 -0000 1.17 --- install.nsi 27 May 2010 11:16:46 -0000 1.18 *************** *** 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-2010 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.18 2010/05/27 11:16:46 vfrolov + * Added ability to put the port to the Ports class + * * Revision 1.17 2009/05/22 11:32:52 vfrolov * Added URLInfoAbout, InstallLocation, InstallSource, Language, Version *************** *** 263,266 **** --- 266,271 ---- File "..\ReadMe.txt" File "..\com0com.inf" + File "..\cncport.inf" + File "..\comport.inf" File "..\${TARGET_CPU}\com0com.sys" File "..\${TARGET_CPU}\setup.dll" *************** *** 306,309 **** --- 311,318 ---- ${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 *************** *** 331,334 **** --- 340,349 ---- StrCpy $1 "--silent" + ExecWait "setupc.exe $1 --output $0 infclean" + !insertmacro MoveFileToDetails $0 + + ExecWait "setupc.exe $1 --output $0 preinstall" + !insertmacro MoveFileToDetails $0 + ExecWait "setupc.exe $1 --output $0 update" !insertmacro MoveFileToDetails $0 *************** *** 350,354 **** ;-------------------------------- ! Section "CNCA0<->CNCB0" sec_ports GetTempFileName $0 --- 365,369 ---- ;-------------------------------- ! Section "CNCA0 <-> CNCB0" sec_CNCxCNC_ports GetTempFileName $0 *************** *** 365,368 **** --- 380,398 ---- ;-------------------------------- + Section "COM# <-> COM#" sec_COMxCOM_ports + + GetTempFileName $0 + + StrCpy $1 "" + IfSilent 0 +2 + StrCpy $1 "--silent" + + ExecWait "setupc.exe $1 --output $0 install PortName=COM# PortName=COM#" + !insertmacro MoveFileToDetails $0 + + SectionEnd + + ;-------------------------------- + Function .onInit *************** *** 396,404 **** ; Disable installing a pair of linked ports if silent ! IfSilent 0 +5 ! SectionGetFlags ${sec_ports} $0 IntOp $1 ${SF_SELECTED} ~ IntOp $0 $0 & $1 ! SectionSetFlags ${sec_ports} $0 FunctionEnd --- 426,438 ---- ; Disable installing a pair of linked ports if silent ! IfSilent 0 +9 ! SectionGetFlags ${sec_CNCxCNC_ports} $0 IntOp $1 ${SF_SELECTED} ~ IntOp $0 $0 & $1 ! SectionSetFlags ${sec_CNCxCNC_ports} $0 ! SectionGetFlags ${sec_COMxCOM_ports} $0 ! IntOp $1 ${SF_SELECTED} ~ ! IntOp $0 $0 & $1 ! SectionSetFlags ${sec_COMxCOM_ports} $0 FunctionEnd *************** *** 434,437 **** --- 468,473 ---- Delete $INSTDIR\ReadMe.txt Delete $INSTDIR\com0com.inf + Delete $INSTDIR\cncport.inf + Delete $INSTDIR\comport.inf Delete $INSTDIR\com0com.sys Delete $INSTDIR\setup.dll *************** *** 453,459 **** ;Language strings ! LangString DESC_sec_com0com ${LANG_ENGLISH} "Install com0com files." ! LangString DESC_sec_shortcuts ${LANG_ENGLISH} "Add shortcuts to the Start Menu." ! LangString DESC_sec_ports ${LANG_ENGLISH} "Install a pair of linked ports with identifiers CNCA0 and CNCB0." ;Assign language strings to sections --- 489,507 ---- ;Language strings ! LangString DESC_sec_com0com ${LANG_ENGLISH} "\ ! Install com0com files. \ ! " ! LangString DESC_sec_shortcuts ${LANG_ENGLISH} "\ ! Add shortcuts to the Start Menu. \ ! " ! LangString DESC_sec_CNCxCNC_ports ${LANG_ENGLISH} "\ ! Install a pair of linked ports by CNCPorts class installer. \ ! The CNCPorts class installer sets the port names to CNCA0 and CNCB0. \ ! " ! LangString DESC_sec_COMxCOM_ports ${LANG_ENGLISH} "\ ! Install a pair of linked ports by Ports class installer. \ ! The Ports class installer selects the COM port number for each port and \ ! sets the port name to COM#, where # is the selected port number. \ ! " ;Assign language strings to sections *************** *** 461,465 **** !insertmacro MUI_DESCRIPTION_TEXT ${sec_com0com} $(DESC_sec_com0com) !insertmacro MUI_DESCRIPTION_TEXT ${sec_shortcuts} $(DESC_sec_shortcuts) ! !insertmacro MUI_DESCRIPTION_TEXT ${sec_ports} $(DESC_sec_ports) !insertmacro MUI_FUNCTION_DESCRIPTION_END --- 509,514 ---- !insertmacro MUI_DESCRIPTION_TEXT ${sec_com0com} $(DESC_sec_com0com) !insertmacro MUI_DESCRIPTION_TEXT ${sec_shortcuts} $(DESC_sec_shortcuts) ! !insertmacro MUI_DESCRIPTION_TEXT ${sec_CNCxCNC_ports} $(DESC_sec_CNCxCNC_ports) ! !insertmacro MUI_DESCRIPTION_TEXT ${sec_COMxCOM_ports} $(DESC_sec_COMxCOM_ports) !insertmacro MUI_FUNCTION_DESCRIPTION_END |