com0com-cvs Mailing List for Null-modem emulator (Page 31)
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...> - 2006-11-03 13:22:11
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16902 Modified Files: setup.cpp Log Message: Added checking of BusyMask::AddNum() return value Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** setup.cpp 2 Nov 2006 16:20:44 -0000 1.7 --- setup.cpp 3 Nov 2006 13:22:07 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2006/11/03 13:22:07 vfrolov + * Added checking of BusyMask::AddNum() return value + * * Revision 1.7 2006/11/02 16:20:44 vfrolov * Added usage the fixed port numbers *************** *** 230,237 **** res = IDCONTINUE; ! LONG err = SetPortNum(hDevInfo, pDevInfoData, (int)pParam); if (err != ERROR_SUCCESS) ! res = ShowError(MB_CANCELTRYCONTINUE, err, "SetPortNum(%d)", (int)pParam); } while (res == IDTRYAGAIN); --- 233,240 ---- res = IDCONTINUE; ! LONG err = SetPortNum(hDevInfo, pDevInfoData, *(int *)pParam); if (err != ERROR_SUCCESS) ! res = ShowError(MB_CANCELTRYCONTINUE, err, "SetPortNum(%d)", *(int *)pParam); } while (res == IDTRYAGAIN); *************** *** 243,246 **** --- 246,254 ---- } + static BOOL InstallBusDevice(InfFile &infFile, int num) + { + return InstallDevice(infFile, C0C_BUS_DEVICE_ID, SetPortNum, &num); + } + static BOOL AddDeviceToBusyMask( HDEVINFO hDevInfo, *************** *** 251,256 **** int i = GetPortNum(hDevInfo, pDevInfoData); ! if (i >= 0) ! ((BusyMask *)pParam)->AddNum(i); return TRUE; --- 259,268 ---- int i = GetPortNum(hDevInfo, pDevInfoData); ! if (i >= 0) { ! if (!((BusyMask *)pParam)->AddNum(i)) { ! if (ShowLastError(MB_OKCANCEL|MB_ICONWARNING, "AddDeviceToBusyMask(%d)", i) == IDCANCEL) ! return FALSE; ! } ! } return TRUE; *************** *** 261,265 **** BusyMask busyMask; ! EnumDevices(infFile, C0C_BUS_DEVICE_ID, NULL, AddDeviceToBusyMask, &busyMask); return busyMask.IsFreeNum(num) ? num : busyMask.GetFirstFreeNum(); --- 273,278 ---- BusyMask busyMask; ! if (EnumDevices(infFile, C0C_BUS_DEVICE_ID, NULL, AddDeviceToBusyMask, &busyMask) < 0) ! return -1; return busyMask.IsFreeNum(num) ? num : busyMask.GetFirstFreeNum(); *************** *** 276,279 **** --- 289,295 ---- i = AllocPortNum(infFile, num >= 0 ? num : 0); + if (i < 0) + goto err; + if (num >= 0 && num != i) { res = ShowMsg(MB_CANCELTRYCONTINUE|MB_ICONWARNING, *************** *** 329,333 **** } ! if (!InstallDevice(infFile, C0C_BUS_DEVICE_ID, SetPortNum, (void *)i)) goto err; --- 345,349 ---- } ! if (!InstallBusDevice(infFile, i)) goto err; |
From: Vyacheslav F. <vf...@us...> - 2006-11-03 13:17:36
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15042 Modified Files: utils.cpp utils.h Log Message: Fixed LocalReAlloc() usage Added return value to BusyMask::AddNum() Index: utils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** utils.cpp 2 Nov 2006 16:09:13 -0000 1.2 --- utils.cpp 3 Nov 2006 13:17:28 -0000 1.3 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.3 2006/11/03 13:17:28 vfrolov + * Fixed LocalReAlloc() usage + * Added return value to BusyMask::AddNum() + * * Revision 1.2 2006/11/02 16:09:13 vfrolov * Added StrToInt() and class BusyMask *************** *** 26,30 **** * Initial revision * - * */ --- 30,33 ---- *************** *** 109,113 **** } ! void BusyMask::AddNum(int num) { ULONG maskNum = num/(sizeof(*pBusyMask)*8); --- 112,116 ---- } ! BOOL BusyMask::AddNum(int num) { ULONG maskNum = num/(sizeof(*pBusyMask)*8); *************** *** 120,124 **** pNewBusyMask = (PBYTE)LocalAlloc(LPTR, newBusyMaskLen); else ! pNewBusyMask = (PBYTE)LocalReAlloc(pBusyMask, newBusyMaskLen, LMEM_ZEROINIT); if (pNewBusyMask) { --- 123,127 ---- pNewBusyMask = (PBYTE)LocalAlloc(LPTR, newBusyMaskLen); else ! pNewBusyMask = (PBYTE)LocalReAlloc(pBusyMask, newBusyMaskLen, LMEM_ZEROINIT|LMEM_MOVEABLE); if (pNewBusyMask) { *************** *** 126,130 **** busyMaskLen = newBusyMaskLen; } else { ! return; } } --- 129,133 ---- busyMaskLen = newBusyMaskLen; } else { ! return FALSE; } } *************** *** 133,136 **** --- 136,141 ---- pBusyMask[maskNum] |= mask; + + return TRUE; } Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** utils.h 2 Nov 2006 16:09:13 -0000 1.2 --- utils.h 3 Nov 2006 13:17:28 -0000 1.3 *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.3 2006/11/03 13:17:28 vfrolov + * Fixed LocalReAlloc() usage + * Added return value to BusyMask::AddNum() + * * Revision 1.2 2006/11/02 16:09:13 vfrolov * Added StrToInt() and class BusyMask *************** *** 26,30 **** * Initial revision * - * */ --- 30,33 ---- *************** *** 41,45 **** ~BusyMask(); ! void AddNum(int num); BOOL IsFreeNum(int num) const; int GetFirstFreeNum() const; --- 44,48 ---- ~BusyMask(); ! BOOL AddNum(int num); BOOL IsFreeNum(int num) const; int GetFirstFreeNum() const; |
From: Vyacheslav F. <vf...@us...> - 2006-11-03 13:13:36
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv13493 Modified Files: adddev.c strutils.c strutils.h Log Message: CopyStrW() now gets size in characters (not in bytes) Index: strutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/strutils.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** strutils.h 27 Mar 2006 09:37:28 -0000 1.3 --- strutils.h 3 Nov 2006 13:13:26 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2006/11/03 13:13:26 vfrolov + * CopyStrW() now gets size in characters (not in bytes) + * * Revision 1.3 2006/03/27 09:37:28 vfrolov * Added StrAppendDeviceProperty() *************** *** 34,38 **** #define _C0C_STRUTILS_H_ ! NTSTATUS CopyStrW(OUT PWCHAR pDestStr, IN SIZE_T size, IN PWCHAR pStr); NTSTATUS DupStrW(OUT PWCHAR *ppDestStr, IN PWCHAR pStr, IN BOOLEAN multiStr); --- 37,41 ---- #define _C0C_STRUTILS_H_ ! NTSTATUS CopyStrW(OUT PWCHAR pDestStr, IN LONG size, IN PWCHAR pStr); NTSTATUS DupStrW(OUT PWCHAR *ppDestStr, IN PWCHAR pStr, IN BOOLEAN multiStr); Index: strutils.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/strutils.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** strutils.c 27 Mar 2006 09:37:28 -0000 1.2 --- strutils.c 3 Nov 2006 13:13:26 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2006/11/03 13:13:26 vfrolov + * CopyStrW() now gets size in characters (not in bytes) + * * Revision 1.2 2006/03/27 09:37:28 vfrolov * Added StrAppendDeviceProperty() *************** *** 31,38 **** #include "strutils.h" ! NTSTATUS CopyStrW(OUT PWCHAR pDestStr, IN SIZE_T size, IN PWCHAR pStr) { NTSTATUS status; ! SIZE_T len; PWCHAR pStrTmp; --- 34,41 ---- #include "strutils.h" ! NTSTATUS CopyStrW(OUT PWCHAR pDestStr, IN LONG size, IN PWCHAR pStr) { NTSTATUS status; ! LONG len; PWCHAR pStrTmp; *************** *** 42,49 **** ; ! len = (pStrTmp - pStr) * sizeof(WCHAR); if (len > size) { ! len = (size/sizeof(WCHAR)) * sizeof(WCHAR); status = STATUS_BUFFER_TOO_SMALL; } else { --- 45,52 ---- ; ! len = (LONG)(pStrTmp - pStr); if (len > size) { ! len = size; status = STATUS_BUFFER_TOO_SMALL; } else { *************** *** 51,57 **** } ! if (len) { ! RtlCopyMemory(pDestStr, pStr, len); ! pDestStr[(len / sizeof(WCHAR)) - 1] = 0; } --- 54,60 ---- } ! if (len > 0) { ! RtlCopyMemory(pDestStr, pStr, len * sizeof(WCHAR)); ! pDestStr[len - 1] = 0; } *************** *** 116,120 **** if (!NT_SUCCESS(status) || !pSrc || !lenSrc) ! return; old = *pDest; --- 119,123 ---- if (!NT_SUCCESS(status) || !pSrc || !lenSrc) ! return; old = *pDest; *************** *** 130,134 **** RtlZeroMemory(pDest->Buffer, pDest->MaximumLength + sizeof(WCHAR)); status = RtlAppendUnicodeStringToString(pDest, &old); ! if (NT_SUCCESS(status)) { PWCHAR pSrc0; --- 133,137 ---- RtlZeroMemory(pDest->Buffer, pDest->MaximumLength + sizeof(WCHAR)); status = RtlAppendUnicodeStringToString(pDest, &old); ! if (NT_SUCCESS(status)) { PWCHAR pSrc0; *************** *** 171,175 **** if (!NT_SUCCESS(*pStatus)) ! return; RtlInitUnicodeString(&numStr, NULL); --- 174,178 ---- if (!NT_SUCCESS(*pStatus)) ! return; RtlInitUnicodeString(&numStr, NULL); *************** *** 179,183 **** if (StrFreeBad(*pStatus, pDest)) ! return; StrAppendStr(pStatus, pDest, numStr.Buffer, numStr.Length); --- 182,186 ---- if (StrFreeBad(*pStatus, pDest)) ! return; StrAppendStr(pStatus, pDest, numStr.Buffer, numStr.Length); *************** *** 196,204 **** if (!NT_SUCCESS(status)) ! return; status = IoGetDeviceProperty(pDevObj, deviceProperty, ! 0, NULL, &len); --- 199,207 ---- if (!NT_SUCCESS(status)) ! return; status = IoGetDeviceProperty(pDevObj, deviceProperty, ! 0, NULL, &len); *************** *** 212,216 **** status = IoGetDeviceProperty(pDevObj, deviceProperty, ! len, pStrTmp, &len); --- 215,219 ---- status = IoGetDeviceProperty(pDevObj, deviceProperty, ! len, pStrTmp, &len); Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** adddev.c 2 Nov 2006 16:04:50 -0000 1.21 --- adddev.c 3 Nov 2006 13:13:26 -0000 1.22 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.22 2006/11/03 13:13:26 vfrolov + * CopyStrW() now gets size in characters (not in bytes) + * * Revision 1.21 2006/11/02 16:04:50 vfrolov * Added using fixed port numbers *************** *** 108,112 **** pDevExt->pDevObj = pDevObj; pDevExt->doType = doType; ! return CopyStrW(pDevExt->portName, sizeof(pDevExt->portName), pPortName); } --- 111,115 ---- pDevExt->pDevObj = pDevObj; pDevExt->doType = doType; ! return CopyStrW(pDevExt->portName, sizeof(pDevExt->portName)/sizeof(pDevExt->portName[0]), pPortName); } *************** *** 195,199 **** if (NT_SUCCESS(status)) { ! WCHAR portNameBuf[C0C_PORT_NAME_LEN]; UNICODE_STRING portNameTmp; RTL_QUERY_REGISTRY_TABLE queryTable[2]; --- 198,202 ---- if (NT_SUCCESS(status)) { ! WCHAR portNameBuf[C0C_PORT_NAME_LEN + 1]; UNICODE_STRING portNameTmp; RTL_QUERY_REGISTRY_TABLE queryTable[2]; *************** *** 613,617 **** UNICODE_STRING keyName; PKEY_VALUE_PARTIAL_INFORMATION pInfo; ! SIZE_T len; RtlInitUnicodeString(&keyName, C0C_REGSTR_VAL_PORT_NUM); --- 616,620 ---- UNICODE_STRING keyName; PKEY_VALUE_PARTIAL_INFORMATION pInfo; ! ULONG len; RtlInitUnicodeString(&keyName, C0C_REGSTR_VAL_PORT_NUM); *************** *** 693,697 **** if (!NT_SUCCESS(status)) { ! SysLog(pDrvObj, status, L"AddFdoBus FAIL"); goto clean; } --- 696,700 ---- if (!NT_SUCCESS(status)) { ! SysLog(pDrvObj, status, L"AddFdoBus InitCommonExt FAIL"); goto clean; } |
From: Vyacheslav F. <vf...@us...> - 2006-11-03 13:08:01
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv11291 Modified Files: com0com.h Log Message: Moved C0C_PORT_NAME_LEN from sys/com0com.h to include/com0com.h Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** com0com.h 16 Oct 2006 08:30:45 -0000 1.30 --- com0com.h 3 Nov 2006 13:07:58 -0000 1.31 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.31 2006/11/03 13:07:58 vfrolov + * Moved C0C_PORT_NAME_LEN from sys/com0com.h to include/com0com.h + * * Revision 1.30 2006/10/16 08:30:45 vfrolov * Added the device interface registration *************** *** 129,141 **** #define C0C_DOTYPE_FB ((unsigned)0xC0C1) ! #define C0C_DOTYPE_PP ((unsigned)0xC0C2) #define C0C_DOTYPE_FP ((unsigned)0xC0C3) - #define C0C_PORT_NAME_LEN 12 - #define COMMON_EXTENSION \ unsigned short doType; \ PDEVICE_OBJECT pDevObj; \ ! WCHAR portName[C0C_PORT_NAME_LEN]; \ #define FDO_EXTENSION \ --- 132,142 ---- #define C0C_DOTYPE_FB ((unsigned)0xC0C1) ! #define C0C_DOTYPE_PP ((unsigned)0xC0C2) #define C0C_DOTYPE_FP ((unsigned)0xC0C3) #define COMMON_EXTENSION \ unsigned short doType; \ PDEVICE_OBJECT pDevObj; \ ! WCHAR portName[C0C_PORT_NAME_LEN + 1]; \ #define FDO_EXTENSION \ |
From: Vyacheslav F. <vf...@us...> - 2006-11-03 13:06:39
|
Update of /cvsroot/com0com/com0com/include In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10889 Modified Files: com0com.h Log Message: Moved C0C_PORT_NAME_LEN from sys/com0com.h to include/com0com.h Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/include/com0com.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** com0com.h 2 Nov 2006 15:56:38 -0000 1.2 --- com0com.h 3 Nov 2006 13:06:33 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2006/11/03 13:06:33 vfrolov + * Moved C0C_PORT_NAME_LEN from sys/com0com.h to include/com0com.h + * * Revision 1.2 2006/11/02 15:56:38 vfrolov * Defined C0C_REGSTR_VAL_PORT_NUM *************** *** 26,30 **** * Initial revision * - * */ --- 29,32 ---- *************** *** 37,40 **** --- 39,43 ---- #define C0C_PREF_NT_DEVICE_NAME TEXT_PREF"\\Device\\" + #define C0C_PORT_NAME_LEN 12 #define C0C_PREF_BUS_NAME TEXT_PREF"CNCBUS" #define C0C_PREF_PORT_NAME_A TEXT_PREF"CNCA" |
From: Vyacheslav F. <vf...@us...> - 2006-11-02 16:20:56
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2822 Modified Files: devutils.cpp devutils.h setup.cpp Log Message: Added usage the fixed port numbers Index: devutils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** devutils.h 28 Jul 2006 12:16:43 -0000 1.1 --- devutils.h 2 Nov 2006 16:20:44 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2006/11/02 16:20:44 vfrolov + * Added usage the fixed port numbers + * * Revision 1.1 2006/07/28 12:16:43 vfrolov * Initial revision *************** *** 31,37 **** class InfFile; ! int CountDevices( InfFile &infFile, ! const char *pDevId); BOOL DisableDevices( --- 34,49 ---- class InfFile; ! typedef BOOL (* PDEVCALLBACK)( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! BOOL *pRebootRequired, ! void *pParam); ! ! int EnumDevices( InfFile &infFile, ! const char *pDevId, ! BOOL *pRebootRequired, ! PDEVCALLBACK pDevCallBack, ! void *pCallBackParam); BOOL DisableDevices( *************** *** 53,57 **** BOOL InstallDevice( InfFile &infFile, ! const char *pDevId); #endif /* _C0C_DEVUTILS_H_ */ --- 65,71 ---- BOOL InstallDevice( InfFile &infFile, ! const char *pDevId, ! PDEVCALLBACK pDevCallBack, ! void *pCallBackParam); #endif /* _C0C_DEVUTILS_H_ */ Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** setup.cpp 27 Oct 2006 13:23:49 -0000 1.6 --- setup.cpp 2 Nov 2006 16:20:44 -0000 1.7 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2006/11/02 16:20:44 vfrolov + * Added usage the fixed port numbers + * * Revision 1.6 2006/10/27 13:23:49 vfrolov * Added check if port name is already used for other device *************** *** 44,48 **** * Initial revision * - * */ --- 47,50 ---- *************** *** 53,56 **** --- 55,59 ---- #include "msg.h" #include "utils.h" + #include "portnum.h" #define TEXT_PREF *************** *** 66,72 **** #define C0C_SETUP_TITLE "Setup for com0com" - /////////////////////////////////////////////////////////////// ! BOOL IsValidPortName( const char *pPortName, const char *pPhDevName) --- 69,74 ---- #define C0C_SETUP_TITLE "Setup for com0com" /////////////////////////////////////////////////////////////// ! static BOOL IsValidPortName( const char *pPortName, const char *pPhDevName) *************** *** 101,112 **** } /////////////////////////////////////////////////////////////// ! int Change(InfFile &infFile, const char *pPhPortName, const char *pParameters) { ! BOOL rebootRequired = FALSE; ! int numPairs = CountDevices(infFile, C0C_BUS_DEVICE_ID); ! //Trace("Found %d pairs\n", numPairs); - for (int i = 0 ; i < numPairs ; i++) { for (int j = 0 ; j < 2 ; j++) { char phPortName[20]; --- 103,128 ---- } /////////////////////////////////////////////////////////////// ! struct ChangeDeviceParams { ! ChangeDeviceParams(InfFile &_infFile, const char *_pPhPortName, const char *_pParameters) ! : pInfFile(&_infFile), pPhPortName(_pPhPortName), pParameters(_pParameters) {} ! ! InfFile *pInfFile; ! const char *pPhPortName; ! const char *pParameters; ! }; ! ! static BOOL ChangeDevice( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! BOOL *pRebootRequired, ! void *pParam) { ! int i = GetPortNum(hDevInfo, pDevInfoData); ! if (i >= 0) { ! InfFile &infFile = *((ChangeDeviceParams *)pParam)->pInfFile; ! const char *pPhPortName = ((ChangeDeviceParams *)pParam)->pPhPortName; ! const char *pParameters = ((ChangeDeviceParams *)pParam)->pParameters; for (int j = 0 ; j < 2 ; j++) { char phPortName[20]; *************** *** 144,148 **** Trace("change %s %s\n", phPortName, buf); ! RestartDevices(infFile, C0C_PORT_DEVICE_ID, phDevName, &rebootRequired); } else { ShowError(MB_OK|MB_ICONWARNING, err, "portParameters.Save(%s)", phPortName); --- 160,164 ---- Trace("change %s %s\n", phPortName, buf); ! RestartDevices(infFile, C0C_PORT_DEVICE_ID, phDevName, pRebootRequired); } else { ShowError(MB_OK|MB_ICONWARNING, err, "portParameters.Save(%s)", phPortName); *************** *** 156,159 **** --- 172,185 ---- } + return TRUE; + } + + int Change(InfFile &infFile, const char *pPhPortName, const char *pParameters) + { + BOOL rebootRequired = FALSE; + ChangeDeviceParams params(infFile, pPhPortName, pParameters); + + EnumDevices(infFile, C0C_BUS_DEVICE_ID, &rebootRequired, ChangeDevice, ¶ms); + if (rebootRequired) SetupPromptReboot(NULL, NULL, FALSE); *************** *** 193,199 **** } /////////////////////////////////////////////////////////////// ! int Install(InfFile &infFile, const char *pParametersA, const char *pParametersB) { ! int i = CountDevices(infFile, C0C_BUS_DEVICE_ID); for (int j = 0 ; j < 2 ; j++) { --- 219,291 ---- } /////////////////////////////////////////////////////////////// ! static BOOL SetPortNum( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! BOOL * /* pRebootRequired */, ! void *pParam) { ! int res; ! ! do { ! res = IDCONTINUE; ! ! LONG err = SetPortNum(hDevInfo, pDevInfoData, (int)pParam); ! ! if (err != ERROR_SUCCESS) ! res = ShowError(MB_CANCELTRYCONTINUE, err, "SetPortNum(%d)", (int)pParam); ! ! } while (res == IDTRYAGAIN); ! ! if (res != IDCONTINUE) ! return FALSE; ! ! return TRUE; ! } ! ! static BOOL AddDeviceToBusyMask( ! HDEVINFO hDevInfo, ! PSP_DEVINFO_DATA pDevInfoData, ! BOOL * /* pRebootRequired */, ! void *pParam) ! { ! int i = GetPortNum(hDevInfo, pDevInfoData); ! ! if (i >= 0) ! ((BusyMask *)pParam)->AddNum(i); ! ! return TRUE; ! } ! ! static int AllocPortNum(InfFile &infFile, int num) ! { ! BusyMask busyMask; ! ! EnumDevices(infFile, C0C_BUS_DEVICE_ID, NULL, AddDeviceToBusyMask, &busyMask); ! ! return busyMask.IsFreeNum(num) ? num : busyMask.GetFirstFreeNum(); ! } ! ! int Install(InfFile &infFile, const char *pParametersA, const char *pParametersB, int num) ! { ! int i; ! int res; ! ! do { ! res = IDCONTINUE; ! ! i = AllocPortNum(infFile, num >= 0 ? num : 0); ! ! if (num >= 0 && num != i) { ! res = ShowMsg(MB_CANCELTRYCONTINUE|MB_ICONWARNING, ! "The identifiers " C0C_PREF_PORT_NAME_A "%d and " ! C0C_PREF_PORT_NAME_B "%d are already used for other ports\n" ! "so ports with identifiers " C0C_PREF_PORT_NAME_A "%d and " ! C0C_PREF_PORT_NAME_B "%d will be installed instead.\n", ! num, num, i, i); ! } ! } while (res == IDTRYAGAIN); ! ! if (res != IDCONTINUE) ! goto err; for (int j = 0 ; j < 2 ; j++) { *************** *** 213,227 **** portParameters.ParseParametersStr(pParameters); - char phDevName[40]; - - SNPRINTF(phDevName, sizeof(phDevName)/sizeof(phDevName[0]), "%s%d", - j ? C0C_PREF_DEVICE_NAME_B : C0C_PREF_DEVICE_NAME_A, i); - char portName[20]; portParameters.FillPortName(portName, sizeof(portName)/sizeof(portName[0])); ! if (!IsValidPortName(portName, phDevName)) ! return 1; if (portParameters.Changed()) { --- 305,314 ---- portParameters.ParseParametersStr(pParameters); char portName[20]; portParameters.FillPortName(portName, sizeof(portName)/sizeof(portName[0])); ! if (!IsValidPortName(portName, NULL)) ! goto err; if (portParameters.Changed()) { *************** *** 242,249 **** } ! if (!InstallDevice(infFile, C0C_BUS_DEVICE_ID)) ! return 1; return 0; } /////////////////////////////////////////////////////////////// --- 329,342 ---- } ! if (!InstallDevice(infFile, C0C_BUS_DEVICE_ID, SetPortNum, (void *)i)) ! goto err; return 0; + + err: + + Trace("\nInstall not completed!\n"); + + return 1; } /////////////////////////////////////////////////////////////// *************** *** 460,472 **** "\n" "Commands:\n" ! " list - for each port show parameters\n" ! " change <port> <params> - set parameters for port\n" ! " install <paramsA> <paramsB> - install a pair of ports\n" " preinstall - preinstall driver\n" " update - update driver\n" ! " uninstall - uninstall all pairs and driver\n" " quit - quit\n" " help - print this help\n" - "\n" ); Trace( --- 553,570 ---- "\n" "Commands:\n" ! " install <n> <prmsA> <prmsB> - install a pair of linked ports with\n" ! " or identifiers " C0C_PREF_PORT_NAME_A "<n> and " ! C0C_PREF_PORT_NAME_B "<n>\n" ! " install <prmsA> <prmsB> (by default <n> is the first not used number),\n" ! " set their parameters to <prmsA> and <prmsB>\n" ! " change <portid> <prms> - set parameters <prms> for port with\n" ! " identifier <portid>\n" ! " list - for each port show its identifier and\n" ! " parameters\n" " preinstall - preinstall driver\n" " update - update driver\n" ! " uninstall - uninstall all ports and the driver\n" " quit - quit\n" " help - print this help\n" ); Trace( *************** *** 482,485 **** --- 580,586 ---- , pCmdPref); Trace( + " %sinstall 5 * *\n" + , pCmdPref); + Trace( " %sinstall PortName=COM2 PortName=COM4\n" , pCmdPref); *************** *** 534,538 **** if (argc == 4 && !lstrcmpi(argv[1], "install")) { SetTitle(C0C_SETUP_TITLE " (INSTALL)"); ! return Install(infFile, argv[2], argv[3]); } else --- 635,648 ---- if (argc == 4 && !lstrcmpi(argv[1], "install")) { SetTitle(C0C_SETUP_TITLE " (INSTALL)"); ! return Install(infFile, 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(infFile, argv[3], argv[4], num); } else *************** *** 592,596 **** int argc; ! const char* argv[5]; argc = ParseCmd(cmd, argv + 1, sizeof(argv)/sizeof(argv[0]) - 1) + 1; --- 702,706 ---- int argc; ! const char* argv[10]; argc = ParseCmd(cmd, argv + 1, sizeof(argv)/sizeof(argv[0]) - 1) + 1; Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** devutils.cpp 13 Oct 2006 10:26:35 -0000 1.2 --- devutils.cpp 2 Nov 2006 16:20:44 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2006/11/02 16:20:44 vfrolov + * Added usage the fixed port numbers + * * Revision 1.2 2006/10/13 10:26:35 vfrolov * Some defines moved to ../include/com0com.h *************** *** 27,31 **** * Initial revision * - * */ --- 30,33 ---- *************** *** 41,44 **** --- 43,48 ---- pDevId = NULL; pPhObjName = NULL; + pParam1 = NULL; + pParam2 = NULL; count = 0; *************** *** 48,51 **** --- 52,57 ---- const char *pDevId; const char *pPhObjName; + void *pParam1; + void *pParam2; int count; *************** *** 189,210 **** } /////////////////////////////////////////////////////////////// ! static int CountDevice(HDEVINFO /*hDevInfo*/, PSP_DEVINFO_DATA /*pDevInfoData*/, PDevParams pDevParams) { ! //Trace("Counted %s %s\n", pDevParams->pDevId, pDevParams->pPhObjName); pDevParams->pEnumParams->count++; ! return IDCONTINUE; } ! int CountDevices( InfFile &infFile, ! const char *pDevId) { EnumParams enumParams; enumParams.pDevId = pDevId; ! if (EnumDevices(infFile, DIGCF_PRESENT, CountDevice, &enumParams) != IDCONTINUE) return -1; --- 195,234 ---- } /////////////////////////////////////////////////////////////// ! static int EnumDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { ! //Trace("Enumerated %s %s\n", pDevParams->pDevId, pDevParams->pPhObjName); ! ! int res = IDCONTINUE; ! ! if (pDevParams->pEnumParams->pParam1) { ! if (!PDEVCALLBACK(pDevParams->pEnumParams->pParam1)(hDevInfo, ! pDevInfoData, ! pDevParams->pEnumParams->pRebootRequired, ! pDevParams->pEnumParams->pParam2)) ! { ! res = IDCANCEL; ! } ! } pDevParams->pEnumParams->count++; ! return res; } ! int EnumDevices( InfFile &infFile, ! const char *pDevId, ! BOOL *pRebootRequired, ! PDEVCALLBACK pDevCallBack, ! void *pCallBackParam) { EnumParams enumParams; enumParams.pDevId = pDevId; + enumParams.pRebootRequired = pRebootRequired; + enumParams.pParam1 = pDevCallBack; + enumParams.pParam2 = pCallBackParam; ! if (EnumDevices(infFile, DIGCF_PRESENT, EnumDevice, &enumParams) != IDCONTINUE) return -1; *************** *** 376,380 **** } /////////////////////////////////////////////////////////////// ! BOOL InstallDevice(InfFile &infFile, const char *pDevId) { GUID classGUID; --- 400,408 ---- } /////////////////////////////////////////////////////////////// ! BOOL InstallDevice( ! InfFile &infFile, ! const char *pDevId, ! PDEVCALLBACK pDevCallBack, ! void *pCallBackParam) { GUID classGUID; *************** *** 432,435 **** --- 460,470 ---- } + if (pDevCallBack) { + res = pDevCallBack(hDevInfo, &devInfoData, NULL, pCallBackParam); + + if (!res) + goto err1; + } + BOOL rebootRequired; res = UpdateDriverForPlugAndPlayDevices(0, pDevId, infFile.Path(), INSTALLFLAG_FORCE, &rebootRequired); *************** *** 438,449 **** ShowLastError(MB_OK|MB_ICONSTOP, "UpdateDriverForPlugAndPlayDevices()"); if (!SetupDiCallClassInstaller(DIF_REMOVE, hDevInfo, &devInfoData)) ShowLastError(MB_OK|MB_ICONWARNING, "SetupDiCallClassInstaller()"); - - goto err; } - res = TRUE; - err: --- 473,482 ---- ShowLastError(MB_OK|MB_ICONSTOP, "UpdateDriverForPlugAndPlayDevices()"); + err1: + if (!SetupDiCallClassInstaller(DIF_REMOVE, hDevInfo, &devInfoData)) ShowLastError(MB_OK|MB_ICONWARNING, "SetupDiCallClassInstaller()"); } err: |
From: Vyacheslav F. <vf...@us...> - 2006-11-02 16:13:06
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32357 Modified Files: sources Log Message: Added portnum.cpp Index: sources =================================================================== RCS file: /cvsroot/com0com/com0com/setup/sources,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sources 23 Oct 2006 12:01:49 -0000 1.2 --- sources 2 Nov 2006 16:13:03 -0000 1.3 *************** *** 10,13 **** --- 10,14 ---- params.cpp \ devutils.cpp \ + portnum.cpp \ msg.cpp \ utils.cpp \ |
From: Vyacheslav F. <vf...@us...> - 2006-11-02 16:12:08
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv31763 Modified Files: params.cpp Log Message: Added default values to help text Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** params.cpp 27 Oct 2006 13:11:58 -0000 1.2 --- params.cpp 2 Nov 2006 16:11:58 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2006/11/02 16:11:58 vfrolov + * Added default values to help text + * * Revision 1.2 2006/10/27 13:11:58 vfrolov * Added PortParameters::FillPortName() *************** *** 26,30 **** * Initial revision * - * */ --- 29,32 ---- *************** *** 441,446 **** --- 443,451 ---- "Parameters:\n" " PortName=<name> - set port name to <name>\n" + " (port identifier by default)\n" " EmuBR={yes|no} - enable/disable baud rate emulation\n" + " (disabled by default)\n" " EmuOverrun={yes|no} - enable/disable buffer overrun\n" + " (disabled by default)\n" "\n" "Special values:\n" |
From: Vyacheslav F. <vf...@us...> - 2006-11-02 16:09:29
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30930 Modified Files: utils.cpp utils.h Log Message: Added StrToInt() and class BusyMask Index: utils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** utils.cpp 28 Jul 2006 12:16:43 -0000 1.1 --- utils.cpp 2 Nov 2006 16:09:13 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2006/11/02 16:09:13 vfrolov + * Added StrToInt() and class BusyMask + * * Revision 1.1 2006/07/28 12:16:43 vfrolov * Initial revision *************** *** 57,58 **** --- 60,158 ---- } /////////////////////////////////////////////////////////////// + BOOL StrToInt(const char *pStr, int *pNum) + { + BOOL res = FALSE; + int num; + int sign = 1; + + switch (*pStr) { + case '-': + sign = -1; + case '+': + pStr++; + break; + } + + for (num = 0 ;; pStr++) { + switch (*pStr) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + num = num*10 + (*pStr - '0'); + res = TRUE; + continue; + case 0: + break; + default: + res = FALSE; + } + break; + } + + if (pNum) + *pNum = num*sign; + + return res; + } + /////////////////////////////////////////////////////////////// + BusyMask::~BusyMask() + { + if (pBusyMask) + LocalFree(pBusyMask); + } + + void BusyMask::AddNum(int num) + { + ULONG maskNum = num/(sizeof(*pBusyMask)*8); + + if (maskNum >= busyMaskLen) { + SIZE_T newBusyMaskLen = maskNum + 1; + PBYTE pNewBusyMask; + + if (!pBusyMask) + pNewBusyMask = (PBYTE)LocalAlloc(LPTR, newBusyMaskLen); + else + pNewBusyMask = (PBYTE)LocalReAlloc(pBusyMask, newBusyMaskLen, LMEM_ZEROINIT); + + if (pNewBusyMask) { + pBusyMask = pNewBusyMask; + busyMaskLen = newBusyMaskLen; + } else { + return; + } + } + + ULONG mask = 1 << (num%(sizeof(*pBusyMask)*8)); + + pBusyMask[maskNum] |= mask; + } + + BOOL BusyMask::IsFreeNum(int num) const + { + ULONG maskNum = num/(sizeof(*pBusyMask)*8); + + if (maskNum >= busyMaskLen) + return TRUE; + + ULONG mask = 1 << (num%(sizeof(*pBusyMask)*8)); + + return (pBusyMask[maskNum] & mask) == 0; + } + + int BusyMask::GetFirstFreeNum() const + { + int num; + + for (num = 0 ; !IsFreeNum(num) ; num++) + ; + + return num; + } + /////////////////////////////////////////////////////////////// Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/utils.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** utils.h 28 Jul 2006 12:16:43 -0000 1.1 --- utils.h 2 Nov 2006 16:09:13 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2006/11/02 16:09:13 vfrolov + * Added StrToInt() and class BusyMask + * * Revision 1.1 2006/07/28 12:16:43 vfrolov * Initial revision *************** *** 31,34 **** --- 34,51 ---- int VSNPRINTF(char *pBuf, int size, const char *pFmt, va_list va); int SNPRINTF(char *pBuf, int size, const char *pFmt, ...); + BOOL StrToInt(const char *pStr, int *pNum); + + class BusyMask { + public: + BusyMask() : pBusyMask(NULL), busyMaskLen(0) {} + ~BusyMask(); + + void AddNum(int num); + BOOL IsFreeNum(int num) const; + int GetFirstFreeNum() const; + private: + PBYTE pBusyMask; + SIZE_T busyMaskLen; + }; #endif /* _C0C_UTILS_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2006-11-02 16:07:11
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29818 Added Files: portnum.cpp portnum.h Log Message: Initial revision --- NEW FILE: portnum.h --- /* * $Id: portnum.h,v 1.1 2006/11/02 16:07:02 vfrolov Exp $ * * Copyright (c) 2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: portnum.h,v $ * Revision 1.1 2006/11/02 16:07:02 vfrolov * Initial revision * * */ #ifndef _C0C_PORTNUM_H_ #define _C0C_PORTNUM_H_ int GetPortNum( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData); LONG SetPortNum( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, int num); #endif /* _C0C_PORTNUM_H_ */ --- NEW FILE: portnum.cpp --- /* * $Id: portnum.cpp,v 1.1 2006/11/02 16:07:02 vfrolov Exp $ * * Copyright (c) 2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: portnum.cpp,v $ * Revision 1.1 2006/11/02 16:07:02 vfrolov * Initial revision * * */ #include "precomp.h" #include "portnum.h" #define TEXT_PREF #include "../include/com0com.h" /////////////////////////////////////////////////////////////// int GetPortNum( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData) { HKEY hKey; hKey = SetupDiOpenDevRegKey(hDevInfo, pDevInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ); if (hKey == INVALID_HANDLE_VALUE) return -1; int num; DWORD len; DWORD portNum; len = sizeof(portNum); if (RegQueryValueEx(hKey, C0C_REGSTR_VAL_PORT_NUM, NULL, NULL, (PBYTE)&portNum, &len) == ERROR_SUCCESS) num = portNum; else num = -1; RegCloseKey(hKey); return num; } /////////////////////////////////////////////////////////////// LONG SetPortNum( HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, int num) { HKEY hKey; hKey = SetupDiCreateDevRegKey(hDevInfo, pDevInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, NULL, NULL); if (hKey == INVALID_HANDLE_VALUE) return GetLastError(); DWORD portNum = num; LONG err = RegSetValueEx(hKey, C0C_REGSTR_VAL_PORT_NUM, NULL, REG_DWORD, (PBYTE)&portNum, sizeof(portNum)); RegCloseKey(hKey); return err; } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2006-11-02 16:04:59
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29025 Modified Files: adddev.c Log Message: Added using fixed port numbers Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** adddev.c 16 Oct 2006 08:30:45 -0000 1.20 --- adddev.c 2 Nov 2006 16:04:50 -0000 1.21 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.21 2006/11/02 16:04:50 vfrolov + * Added using fixed port numbers + * * Revision 1.20 2006/10/16 08:30:45 vfrolov * Added the device interface registration *************** *** 135,139 **** if (pDevExt->pLowDevObj) ! IoDetachDevice(pDevExt->pLowDevObj); Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"RemoveFdoPort"); --- 138,142 ---- if (pDevExt->pLowDevObj) ! IoDetachDevice(pDevExt->pLowDevObj); Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"RemoveFdoPort"); *************** *** 525,545 **** } ! ULONG AllocPortNum(IN PDRIVER_OBJECT pDrvObj) { - static ULONG numNext = 0; - PDEVICE_OBJECT pDevObj; ! ULONG num; PCHAR pBusyMask; SIZE_T busyMaskLen; ! if (!numNext) ! return numNext++; - busyMaskLen = numNext; pBusyMask = ExAllocatePool(PagedPool, busyMaskLen); ! if (!pBusyMask) ! return numNext++; RtlZeroMemory(pBusyMask, busyMaskLen); --- 528,565 ---- } ! ULONG AllocPortNum(IN PDRIVER_OBJECT pDrvObj, ULONG num) { PDEVICE_OBJECT pDevObj; ! ULONG numNext; PCHAR pBusyMask; SIZE_T busyMaskLen; + ULONG maskNum; + ULONG mask; ! numNext = 0; ! ! for (pDevObj = pDrvObj->DeviceObject ; pDevObj ; pDevObj = pDevObj->NextDevice) { ! if (((PC0C_COMMON_EXTENSION)pDevObj->DeviceExtension)->doType == C0C_DOTYPE_FB) { ! ULONG portNum = ((PC0C_FDOBUS_EXTENSION)pDevObj->DeviceExtension)->portNum; ! ! if (portNum >= numNext) ! numNext = portNum + 1; ! } ! } ! ! if (num == (ULONG)-1) ! num = 0; ! ! if (num >= numNext) ! return num; ! ! busyMaskLen = (numNext + (sizeof(*pBusyMask)*8 - 1))/(sizeof(*pBusyMask)*8); pBusyMask = ExAllocatePool(PagedPool, busyMaskLen); ! if (!pBusyMask) { ! SysLog(pDrvObj, STATUS_INSUFFICIENT_RESOURCES, L"AllocPortNum ExAllocatePool FAIL"); ! return numNext; ! } RtlZeroMemory(pBusyMask, busyMaskLen); *************** *** 547,566 **** for (pDevObj = pDrvObj->DeviceObject ; pDevObj ; pDevObj = pDevObj->NextDevice) { if (((PC0C_COMMON_EXTENSION)pDevObj->DeviceExtension)->doType == C0C_DOTYPE_FB) { ! ULONG num = ((PC0C_FDOBUS_EXTENSION)pDevObj->DeviceExtension)->portNum; ! HALT_UNLESS3(num < busyMaskLen, num, busyMaskLen, numNext); ! pBusyMask[num] = 1; } } ! for (num = 0 ; num < busyMaskLen ; num++) { ! if (!pBusyMask[num]) ! break; } ExFreePool(pBusyMask); ! if (num >= busyMaskLen) ! return numNext++; return num; --- 567,648 ---- for (pDevObj = pDrvObj->DeviceObject ; pDevObj ; pDevObj = pDevObj->NextDevice) { if (((PC0C_COMMON_EXTENSION)pDevObj->DeviceExtension)->doType == C0C_DOTYPE_FB) { ! ULONG portNum = ((PC0C_FDOBUS_EXTENSION)pDevObj->DeviceExtension)->portNum; ! maskNum = portNum/(sizeof(*pBusyMask)*8); ! mask = 1 << (portNum%(sizeof(*pBusyMask)*8)); ! ! HALT_UNLESS3(maskNum < busyMaskLen, portNum, busyMaskLen, numNext); ! pBusyMask[maskNum] |= mask; } } ! maskNum = num/(sizeof(*pBusyMask)*8); ! mask = 1 << (num%(sizeof(*pBusyMask)*8)); ! ! if ((pBusyMask[maskNum] & mask) != 0) { ! for (num = 0 ; num < numNext ; num++) { ! maskNum = num/(sizeof(*pBusyMask)*8); ! mask = 1 << (num%(sizeof(*pBusyMask)*8)); ! ! HALT_UNLESS3(maskNum < busyMaskLen, num, busyMaskLen, numNext); ! if ((pBusyMask[maskNum] & mask) == 0) ! break; ! } } ExFreePool(pBusyMask); ! return num; ! } ! ! ULONG GetPortNum(IN PDRIVER_OBJECT pDrvObj, IN PDEVICE_OBJECT pPhDevObj) ! { ! ULONG num; ! ULONG numPref; ! HANDLE hKey; ! NTSTATUS status; ! ! numPref = (ULONG)-1; ! ! status = IoOpenDeviceRegistryKey(pPhDevObj, ! PLUGPLAY_REGKEY_DEVICE, ! STANDARD_RIGHTS_READ, ! &hKey); ! ! if (status == STATUS_SUCCESS) { ! UNICODE_STRING keyName; ! PKEY_VALUE_PARTIAL_INFORMATION pInfo; ! SIZE_T len; ! ! RtlInitUnicodeString(&keyName, C0C_REGSTR_VAL_PORT_NUM); ! ! len = sizeof(KEY_VALUE_FULL_INFORMATION) + sizeof(ULONG); ! ! pInfo = ExAllocatePool(PagedPool, len); ! ! if (pInfo) { ! status = ZwQueryValueKey(hKey, &keyName, KeyValuePartialInformation, pInfo, len, &len); ! ! if (NT_SUCCESS(status) && pInfo->DataLength == sizeof(ULONG)) ! numPref = *(PULONG)pInfo->Data; ! ! ExFreePool(pInfo); ! } ! ! num = AllocPortNum(pDrvObj, numPref); ! ! if (num != numPref) { ! status = ZwSetValueKey(hKey, &keyName, 0, REG_DWORD, &num, sizeof(num)); ! ! if (!NT_SUCCESS(status)) ! SysLog(pPhDevObj, status, L"ZwSetValueKey(PortName) FAIL"); ! } ! ! ZwClose(hKey); ! } else { ! SysLog(pPhDevObj, status, L"GetPortNum IoOpenDeviceRegistryKey(PLUGPLAY_REGKEY_DEVICE) FAIL"); ! ! num = AllocPortNum(pDrvObj, numPref); ! } return num; *************** *** 577,581 **** int i; ! num = AllocPortNum(pDrvObj); RtlInitUnicodeString(&portName, NULL); --- 659,663 ---- int i; ! num = GetPortNum(pDrvObj, pPhDevObj); RtlInitUnicodeString(&portName, NULL); *************** *** 684,688 **** if (NT_SUCCESS(status)) ! Trace00(NULL, L"c0cAddDevice for ", property.Buffer); else { SysLog(pDrvObj, status, L"c0cAddDevice IoGetDeviceProperty FAIL"); --- 766,770 ---- if (NT_SUCCESS(status)) ! Trace00(NULL, L"c0cAddDevice for ", property.Buffer); else { SysLog(pDrvObj, status, L"c0cAddDevice IoGetDeviceProperty FAIL"); |
From: Vyacheslav F. <vf...@us...> - 2006-11-02 15:56:49
|
Update of /cvsroot/com0com/com0com/include In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv25961 Modified Files: com0com.h Log Message: Defined C0C_REGSTR_VAL_PORT_NUM Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/include/com0com.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** com0com.h 13 Oct 2006 10:06:13 -0000 1.1 --- com0com.h 2 Nov 2006 15:56:38 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2006/11/02 15:56:38 vfrolov + * Defined C0C_REGSTR_VAL_PORT_NUM + * * Revision 1.1 2006/10/13 10:06:13 vfrolov * Initial revision *************** *** 40,42 **** --- 43,47 ---- #define C0C_PREF_DEVICE_NAME_B C0C_PREF_NT_DEVICE_NAME C0C_SERVICE TEXT_PREF"2" + #define C0C_REGSTR_VAL_PORT_NUM TEXT_PREF"PortNum" + #endif /* _INCLUDE_C0C_COM0COM_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2006-10-27 13:23:55
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv21160 Modified Files: setup.cpp Log Message: Added check if port name is already used for other device Fixed incorrect port restart Fixed prompts Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** setup.cpp 23 Oct 2006 12:08:31 -0000 1.5 --- setup.cpp 27 Oct 2006 13:23:49 -0000 1.6 *************** *** 20,23 **** --- 20,28 ---- * * $Log$ + * Revision 1.6 2006/10/27 13:23:49 vfrolov + * Added check if port name is already used for other device + * Fixed incorrect port restart + * Fixed prompts + * * Revision 1.5 2006/10/23 12:08:31 vfrolov * Added interactive mode *************** *** 61,64 **** --- 66,103 ---- #define C0C_SETUP_TITLE "Setup for com0com" + + /////////////////////////////////////////////////////////////// + BOOL IsValidPortName( + const char *pPortName, + const char *pPhDevName) + { + int res; + + do { + res = IDCONTINUE; + + char phDevName[80]; + + if (!QueryDosDevice(pPortName, phDevName, sizeof(phDevName)/sizeof(phDevName[0]))) { + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) + break; + + phDevName[0] = 0; + } + + if (pPhDevName && !lstrcmpi(pPhDevName, phDevName)) + break; + + res = ShowMsg(MB_CANCELTRYCONTINUE, + "Port name %s is already used for other device %s.", + pPortName, phDevName); + + } while (res == IDTRYAGAIN); + + if (res != IDCONTINUE) + return FALSE; + + return TRUE; + } /////////////////////////////////////////////////////////////// int Change(InfFile &infFile, const char *pPhPortName, const char *pParameters) *************** *** 86,107 **** if (err == ERROR_SUCCESS) { ! if (pPhPortName && !lstrcmpi(pPhPortName, phPortName)) portParameters.ParseParametersStr(pParameters); ! if (portParameters.Changed()) { ! err = portParameters.Save(); ! if (err == ERROR_SUCCESS) { ! portParameters.FillParametersStr(buf, sizeof(buf)/sizeof(buf[0])); ! Trace("change %s %s\n", phPortName, buf); ! char phDevDevName[40]; ! SNPRINTF(phDevDevName, sizeof(phDevDevName)/sizeof(phDevDevName[0]), "%s%d", ! j ? C0C_PREF_DEVICE_NAME_A : C0C_PREF_DEVICE_NAME_B, i); ! RestartDevices(infFile, C0C_PORT_DEVICE_ID, phDevDevName, &rebootRequired); ! } else { ! ShowError(MB_OK|MB_ICONWARNING, err, "portParameters.Save(%s)", phPortName); } } --- 125,151 ---- if (err == ERROR_SUCCESS) { ! if (pPhPortName && !lstrcmpi(pPhPortName, phPortName)) { portParameters.ParseParametersStr(pParameters); ! char phDevName[40]; ! SNPRINTF(phDevName, sizeof(phDevName)/sizeof(phDevName[0]), "%s%d", ! j ? C0C_PREF_DEVICE_NAME_B : C0C_PREF_DEVICE_NAME_A, i); ! char portName[20]; ! portParameters.FillPortName(portName, sizeof(portName)/sizeof(portName[0])); ! if (IsValidPortName(portName, phDevName) && portParameters.Changed()) { ! err = portParameters.Save(); ! ! if (err == ERROR_SUCCESS) { ! portParameters.FillParametersStr(buf, sizeof(buf)/sizeof(buf[0])); ! Trace("change %s %s\n", phPortName, buf); ! ! RestartDevices(infFile, C0C_PORT_DEVICE_ID, phDevName, &rebootRequired); ! } else { ! ShowError(MB_OK|MB_ICONWARNING, err, "portParameters.Save(%s)", phPortName); ! } } } *************** *** 169,172 **** --- 213,228 ---- portParameters.ParseParametersStr(pParameters); + char phDevName[40]; + + SNPRINTF(phDevName, sizeof(phDevName)/sizeof(phDevName[0]), "%s%d", + j ? C0C_PREF_DEVICE_NAME_B : C0C_PREF_DEVICE_NAME_A, i); + + char portName[20]; + + portParameters.FillPortName(portName, sizeof(portName)/sizeof(portName[0])); + + if (!IsValidPortName(portName, phDevName)) + return 1; + if (portParameters.Changed()) { err = portParameters.Save(); *************** *** 496,501 **** } ! Trace("Unknown command. For more info enter: '%shelp'.\n", ! argv[0]); return 1; --- 552,556 ---- } ! Trace("Invalid command\n"); return 1; *************** *** 542,545 **** --- 597,602 ---- if (argc == 1) { + Trace("Enter 'help' to get info about usage of " C0C_SETUP_TITLE ".\n\n"); + argv[0] = ""; *************** *** 562,571 **** int res = Main(argc, argv); ! ConsoleWriteRead(cmd, sizeof(cmd)/sizeof(cmd[0]), ! "\n" ! "result = %d\n" ! "\n" ! "Press <RETURN> to continue\n", ! res); return res; --- 619,623 ---- int res = Main(argc, argv); ! ConsoleWriteRead(cmd, sizeof(cmd)/sizeof(cmd[0]), "\nPress <RETURN> to continue\n"); return res; |
From: Vyacheslav F. <vf...@us...> - 2006-10-27 13:12:06
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16531 Modified Files: params.cpp params.h Log Message: Added PortParameters::FillPortName() Index: params.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** params.h 28 Jul 2006 12:16:43 -0000 1.1 --- params.h 27 Oct 2006 13:11:58 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2006/10/27 13:11:58 vfrolov + * Added PortParameters::FillPortName() + * * Revision 1.1 2006/07/28 12:16:43 vfrolov * Initial revision *************** *** 38,41 **** --- 41,45 ---- BOOL ParseParametersStr(const char *pParameters); BOOL FillParametersStr(char *pParameters, int size); + BOOL FillPortName(char *pPortName, int size); BOOL Changed() const { return maskChanged != 0; } Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** params.cpp 28 Jul 2006 12:16:43 -0000 1.1 --- params.cpp 27 Oct 2006 13:11:58 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2006/10/27 13:11:58 vfrolov + * Added PortParameters::FillPortName() + * * Revision 1.1 2006/07/28 12:16:43 vfrolov * Initial revision *************** *** 418,421 **** --- 421,434 ---- } /////////////////////////////////////////////////////////////// + BOOL PortParameters::FillPortName(char *pPortName, int size) + { + int len; + + len = SNPRINTF(pPortName, size, "%s", + (maskExplicit & m_portName) ? portName : phPortName); + + return len >= 0; + } + /////////////////////////////////////////////////////////////// const char *PortParameters::GetHelp() { |
From: Vyacheslav F. <vf...@us...> - 2006-10-27 13:08:09
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15032 Modified Files: .cvsignore Log Message: Added * Index: .cvsignore =================================================================== RCS file: /cvsroot/com0com/com0com/setup/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 13 Oct 2006 11:20:28 -0000 1.1 --- .cvsignore 27 Oct 2006 13:08:05 -0000 1.2 *************** *** 1,3 **** obj ! objchk ! objfre --- 1,3 ---- obj ! objchk* ! objfre* |
From: Vyacheslav F. <vf...@us...> - 2006-10-27 12:59:08
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv10930 Modified Files: .cvsignore Log Message: Added * Index: .cvsignore =================================================================== RCS file: /cvsroot/com0com/com0com/sys/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** .cvsignore 17 May 2006 15:25:48 -0000 1.1 --- .cvsignore 27 Oct 2006 12:58:02 -0000 1.2 *************** *** 4,7 **** c0clog.rc obj ! objchk ! objfre --- 4,7 ---- c0clog.rc obj ! objchk* ! objfre* |
From: Vyacheslav F. <vf...@us...> - 2006-10-27 12:44:22
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv6145 Modified Files: wmi.c Log Message: Fixed typecasting Index: wmi.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/wmi.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** wmi.c 17 Oct 2006 06:54:37 -0000 1.2 --- wmi.c 27 Oct 2006 12:44:14 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2006/10/27 12:44:14 vfrolov + * Fixed typecasting + * * Revision 1.2 2006/10/17 06:54:37 vfrolov * Disabled SERIAL_PORT_WMI_HW_GUID for binary compatibility with *************** *** 118,122 **** Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"QueryWmiDataBlock PORT_NAME"); ! size = wcslen(pDevExt->portName) * sizeof(pDevExt->portName[0]); if (bufSize < (size + sizeof(USHORT))) { --- 121,125 ---- Trace0((PC0C_COMMON_EXTENSION)pDevExt, L"QueryWmiDataBlock PORT_NAME"); ! size = (ULONG)wcslen(pDevExt->portName) * sizeof(pDevExt->portName[0]); if (bufSize < (size + sizeof(USHORT))) { |
From: Vyacheslav F. <vf...@us...> - 2006-10-27 12:37:19
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3123 Modified Files: trace.c Log Message: Removed unnecessary InterlockedExchange*() Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/trace.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** trace.c 23 Aug 2006 13:05:43 -0000 1.21 --- trace.c 27 Oct 2006 12:36:58 -0000 1.22 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.22 2006/10/27 12:36:58 vfrolov + * Removed unnecessary InterlockedExchange*() + * * Revision 1.21 2006/08/23 13:05:43 vfrolov * Added ability to trace w/o table *************** *** 935,939 **** } ! InterlockedExchange(&strOldFreeInd, (LONG)(sizeof(strOld) - size)); KeReleaseSpinLock(&strOldLock, oldIrql); --- 938,942 ---- } ! strOldFreeInd = (LONG)(sizeof(strOld) - size); KeReleaseSpinLock(&strOldLock, oldIrql); *************** *** 976,980 **** pDestStr = pBuf->buf; ! while (InterlockedExchangeAdd(&strOldFreeInd, 0)) { SIZE_T lenBuf; KIRQL oldIrql; --- 979,983 ---- pDestStr = pBuf->buf; ! while (strOldFreeInd) { SIZE_T lenBuf; KIRQL oldIrql; *************** *** 990,994 **** HALT_UNLESS3(strOldBusyInd <= strOldFreeInd, strOldFreeInd, strOldBusyInd, lenBuf); if (strOldBusyInd == strOldFreeInd) ! InterlockedExchange(&strOldFreeInd, strOldBusyInd = 0); } KeReleaseSpinLock(&strOldLock, oldIrql); --- 993,997 ---- HALT_UNLESS3(strOldBusyInd <= strOldFreeInd, strOldFreeInd, strOldBusyInd, lenBuf); if (strOldBusyInd == strOldFreeInd) ! strOldFreeInd = strOldBusyInd = 0; } KeReleaseSpinLock(&strOldLock, oldIrql); |
From: Vyacheslav F. <vf...@us...> - 2006-10-23 12:26:08
|
Update of /cvsroot/com0com/com0com/NSIS In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv24389 Added Files: install.nsi Log Message: Initial revision --- NEW FILE: install.nsi --- /* * $Id: install.nsi,v 1.1 2006/10/23 12:26:02 vfrolov Exp $ * * Copyright (c) 2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * * $Log: install.nsi,v $ * Revision 1.1 2006/10/23 12:26:02 vfrolov * Initial revision * * */ ;-------------------------------- ; The name of the installer Name "Null-modem emulator (com0com)" ; The file to write OutFile "setup.exe" ; The default installation directory InstallDir $PROGRAMFILES\com0com ; Registry key to check for directory (so if you install again, it will ; overwrite the old one automatically) InstallDirRegKey HKLM "Software\com0com" "Install_Dir" ;-------------------------------- ; Pages Page components Page directory Page instfiles UninstPage uninstConfirm UninstPage instfiles ;-------------------------------- ; The stuff to install Section "Install com0com" SectionIn RO ; Set output path to the installation directory. SetOutPath $INSTDIR ; Put files there File "..\ReadMe.txt" File "..\com0com.inf" File "..\i386\com0com.sys" File "..\i386\setup.dll" File "..\setup\setup.bat" ; Write the installation path into the registry WriteRegStr HKLM SOFTWARE\com0com "Install_Dir" "$INSTDIR" ; Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "DisplayName" "Null-modem emulator (com0com)" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "URLInfoAbout" "http://com0com.sourceforge.net/" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" "NoRepair" 1 WriteUninstaller "uninstall.exe" SectionEnd ; Optional section (can be disabled by the user) Section "Start Menu Shortcuts" CreateDirectory "$SMPROGRAMS\com0com" CreateShortCut "$SMPROGRAMS\com0com\setup.lnk" "$INSTDIR\setup.bat" CreateShortCut "$SMPROGRAMS\com0com\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 SectionEnd ;-------------------------------- ; Uninstaller Section "Uninstall" ExecWait "RunDll32 setup,RunDll uninstall" ; Remove registry keys DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\com0com" DeleteRegKey HKLM SOFTWARE\com0com ; Remove files and uninstaller Delete $INSTDIR\ReadMe.txt Delete $INSTDIR\com0com.inf Delete $INSTDIR\com0com.sys Delete $INSTDIR\setup.dll Delete $INSTDIR\setup.bat Delete $INSTDIR\uninstall.exe ; Remove shortcuts, if any Delete "$SMPROGRAMS\com0com\*.*" ; Remove directories used RMDir "$SMPROGRAMS\com0com" RMDir "$INSTDIR" SectionEnd |
From: Vyacheslav F. <vf...@us...> - 2006-10-23 12:24:19
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv23965 Added Files: .cvsignore Log Message: Initial revision --- NEW FILE: .cvsignore --- *.log |
From: Vyacheslav F. <vf...@us...> - 2006-10-23 12:21:20
|
Update of /cvsroot/com0com/com0com/NSIS In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv22416/NSIS Log Message: Directory /cvsroot/com0com/com0com/NSIS added to the repository |
From: Vyacheslav F. <vf...@us...> - 2006-10-23 12:20:35
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv22351 Modified Files: ReadMe.txt Log Message: Added setup.dll usage Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ReadMe.txt 28 Jun 2006 13:59:03 -0000 1.9 --- ReadMe.txt 23 Oct 2006 12:20:32 -0000 1.10 *************** *** 29,34 **** 1. Set up the DDK environment on your machine. 2. Run the build -wcZ command in the com0com directory to build ! com0com.sys. ! 3. Copy com0com.inf and com0com.sys files to a temporary directory. --- 29,35 ---- 1. Set up the DDK environment on your machine. 2. Run the build -wcZ command in the com0com directory to build ! com0com.sys and setup.dll. ! 3. Copy com0com.inf, %CPU%\com0com.sys, %CPU%\setup.dll and setup\setup.bat ! files to a temporary directory. *************** *** 36,39 **** --- 37,62 ---- ========== + With setup.dll + -------------- + + 1. Run the setup.bat in the directory with com0com.inf, com0com.sys and + setup.dll files. + 2. Enter install command, for example: + + command> install - - + + The system will create 3 new virtual devices. One of the devices has + name "com0com - bus for serial port pair emulator" and other two of + them have name "com0com - serial port emulator" and located on CNCA0 + and CNCB0 ports (or CNCA1 and CNCB1 or ...). + + To get more info enter help command, for example: + + command> help + + + Manually + -------- + 1. Start the "Add/Remove Hardware" wizard in Control Panel. 2. Click "Add/Troubleshoot a Device". *************** *** 68,71 **** --- 91,107 ---- ============ + With setup.dll + -------------- + + 1. Run the setup.bat in the directory with com0com.inf, com0com.sys and + setup.dll files. + 2. Enter uninstall command: + + command> uninstall + + + Manually + -------- + Start Device Manager this way: *************** *** 73,77 **** %SystemRoot%\system32\devmgmt.msc ! Click View and select "Show hidden devices". Remove all "com0com" divices. Remove the following subtrees from the registry: --- 109,113 ---- %SystemRoot%\system32\devmgmt.msc ! Click View and select "Show hidden devices". Remove all "com0com" devices. Remove the following subtrees from the registry: |
From: Vyacheslav F. <vf...@us...> - 2006-10-23 12:10:47
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv18507 Added Files: setup.bat Log Message: Initial revision --- NEW FILE: setup.bat --- @start RunDll32 setup,RunDll %1 %2 %3 %4 %5 %6 %7 %8 %9 |
From: Vyacheslav F. <vf...@us...> - 2006-10-23 12:08:37
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv17752 Modified Files: setup.cpp Log Message: Added interactive mode Added more help Added SetTitle() calls Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** setup.cpp 19 Oct 2006 13:28:50 -0000 1.4 --- setup.cpp 23 Oct 2006 12:08:31 -0000 1.5 *************** *** 20,23 **** --- 20,28 ---- * * $Log$ + * Revision 1.5 2006/10/23 12:08:31 vfrolov + * Added interactive mode + * Added more help + * Added SetTitle() calls + * * Revision 1.4 2006/10/19 13:28:50 vfrolov * Added InfFile::UninstallAllInfFiles() *************** *** 54,57 **** --- 59,64 ---- #define C0C_COPY_DRIVERS_SECTION "com0com_CopyDrivers" + #define C0C_SETUP_TITLE "Setup for com0com" + /////////////////////////////////////////////////////////////// int Change(InfFile &infFile, const char *pPhPortName, const char *pParameters) *************** *** 383,392 **** } /////////////////////////////////////////////////////////////// ! int Help(const char *pProgName) { Trace( "Usage:\n" ! " %s <command>\n" ! , pProgName); Trace( "\n" --- 390,404 ---- } /////////////////////////////////////////////////////////////// ! int Help(const char *pCmdPref) { + SetTitle(C0C_SETUP_TITLE " (HELP)"); + + Trace( + C0C_SETUP_TITLE "\n" + "\n"); Trace( "Usage:\n" ! " %s<command>\n" ! , pCmdPref); Trace( "\n" *************** *** 398,401 **** --- 410,415 ---- " update - update driver\n" " uninstall - uninstall all pairs and driver\n" + " quit - quit\n" + " help - print this help\n" "\n" ); *************** *** 409,420 **** ); Trace( ! " %s install - -\n" ! , pProgName); Trace( ! " %s install PortName=COM2 PortName=COM4\n" ! , pProgName); Trace( ! " %s change " C0C_PREF_PORT_NAME_A "0 EmuBR=yes,EmuOverrun=yes\n" ! , pProgName); return 1; --- 423,445 ---- ); Trace( ! " %sinstall - -\n" ! , pCmdPref); Trace( ! " %sinstall PortName=COM2 PortName=COM4\n" ! , pCmdPref); Trace( ! " %sinstall PortName=COM5,EmuBR=yes,EmuOverrun=yes -\n" ! , pCmdPref); ! Trace( ! " %schange " C0C_PREF_PORT_NAME_A "0 EmuBR=yes,EmuOverrun=yes\n" ! , pCmdPref); ! Trace( ! " %slist\n" ! , pCmdPref); ! Trace( ! " %suninstall\n" ! , pCmdPref); ! Trace( ! "\n"); return 1; *************** *** 423,426 **** --- 448,464 ---- int Main(int argc, const char* argv[]) { + 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; + } + InfFile infFile(C0C_INF_NAME, C0C_INF_NAME); *************** *** 429,484 **** if (argc == 2 && !lstrcmpi(argv[1], "list")) { return Change(infFile, NULL, NULL); } else if (argc == 4 && !lstrcmpi(argv[1], "change")) { return Change(infFile, argv[2], argv[3]); } else if (argc == 4 && !lstrcmpi(argv[1], "install")) { return Install(infFile, argv[2], argv[3]); } else if (argc == 2 && !lstrcmpi(argv[1], "preinstall")) { return Preinstall(infFile); } else if (argc == 2 && !lstrcmpi(argv[1], "update")) { return Update(infFile); } else if (argc == 2 && !lstrcmpi(argv[1], "uninstall")) { return Uninstall(infFile); } ! return Help(argv[0]); } /////////////////////////////////////////////////////////////// ! int CALLBACK RunDllA(HWND /*hWnd*/, HINSTANCE /*hInst*/, LPSTR pCmdLine, int /*nCmdShow*/) { int argc; - const char* argv[5]; argc = 0; ! argv[argc++] = "rundll32 setup,RunDll"; argv[argc] = NULL; char cmd[200]; lstrcpyn(cmd, pCmdLine, sizeof(cmd)/sizeof(cmd[0])); ! for (const char *pArg = strtok(cmd, " \t") ; pArg ; pArg = strtok(NULL, " \t")) { ! if ((argc + 2) > sizeof(argv)/sizeof(argv[0])) ! break; ! argv[argc++] = pArg; ! argv[argc] = NULL; } ! int res = Main(argc, argv); ! char buf[2]; ! ConsoleWriteRead(buf, sizeof(buf)/sizeof(buf[0]), "\nresult = %d\n\nPress <RETURN> to continue\n", res); return res; --- 467,571 ---- if (argc == 2 && !lstrcmpi(argv[1], "list")) { + SetTitle(C0C_SETUP_TITLE " (LIST)"); return Change(infFile, NULL, NULL); } else if (argc == 4 && !lstrcmpi(argv[1], "change")) { + SetTitle(C0C_SETUP_TITLE " (CHANGE)"); return Change(infFile, argv[2], argv[3]); } else if (argc == 4 && !lstrcmpi(argv[1], "install")) { + SetTitle(C0C_SETUP_TITLE " (INSTALL)"); return Install(infFile, argv[2], argv[3]); } else if (argc == 2 && !lstrcmpi(argv[1], "preinstall")) { + SetTitle(C0C_SETUP_TITLE " (PREINSTALL)"); return Preinstall(infFile); } else if (argc == 2 && !lstrcmpi(argv[1], "update")) { + SetTitle(C0C_SETUP_TITLE " (UPDATE)"); return Update(infFile); } else if (argc == 2 && !lstrcmpi(argv[1], "uninstall")) { + SetTitle(C0C_SETUP_TITLE " (UNINSTALL)"); return Uninstall(infFile); } ! Trace("Unknown command. For more info enter: '%shelp'.\n", ! argv[0]); ! ! return 1; } /////////////////////////////////////////////////////////////// ! static int ParseCmd(char *pCmd, const char* argv[], int sizeArgv) { int argc; argc = 0; ! ! for (char *pArg = strtok(pCmd, " \t\r\n") ; pArg ; pArg = strtok(NULL, " \t\r\n")) { ! if ((argc + 2) > sizeArgv) ! break; ! ! if (*pArg == '"') ! pArg++; ! ! char *pEnd = pArg + lstrlen(pArg); ! ! if (pEnd-- != pArg && *pEnd == '"') ! *pEnd = 0; ! ! argv[argc++] = pArg; ! } ! argv[argc] = NULL; + return argc; + } + /////////////////////////////////////////////////////////////// + int CALLBACK RunDllA(HWND /*hWnd*/, HINSTANCE /*hInst*/, LPSTR pCmdLine, int /*nCmdShow*/) + { + SetTitle(C0C_SETUP_TITLE); + char cmd[200]; lstrcpyn(cmd, pCmdLine, sizeof(cmd)/sizeof(cmd[0])); ! int argc; ! const char* argv[5]; ! argc = ParseCmd(cmd, argv + 1, sizeof(argv)/sizeof(argv[0]) - 1) + 1; ! ! if (argc == 1) { ! argv[0] = ""; ! ! for (;;) { ! argv[1] = NULL; ! ! ConsoleWriteRead(cmd, sizeof(cmd)/sizeof(cmd[0]), "command> "); ! ! argc = ParseCmd(cmd, argv + 1, sizeof(argv)/sizeof(argv[0]) - 1) + 1; ! ! if (argc == 2 && !lstrcmpi(argv[1], "quit")) ! return 0; ! ! Main(argc, argv); ! } } ! argv[0] = "rundll32 setup,RunDll "; ! int res = Main(argc, argv); ! ConsoleWriteRead(cmd, sizeof(cmd)/sizeof(cmd[0]), ! "\n" ! "result = %d\n" ! "\n" ! "Press <RETURN> to continue\n", ! res); return res; |
From: Vyacheslav F. <vf...@us...> - 2006-10-23 12:04:28
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16274 Modified Files: msg.cpp msg.h Log Message: Added SetTitle() Index: msg.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/msg.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** msg.h 28 Jul 2006 12:16:42 -0000 1.1 --- msg.h 23 Oct 2006 12:04:23 -0000 1.2 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2006/10/23 12:04:23 vfrolov + * Added SetTitle() + * * Revision 1.1 2006/07/28 12:16:42 vfrolov * Initial revision *************** *** 34,37 **** --- 37,41 ---- void Trace(const char *pFmt, ...); void ConsoleWriteRead(char *pReadBuf, int lenReadBuf, const char *pFmt, ...); + void SetTitle(const char *pTitle); #endif /* _C0C_MSG_H_ */ Index: msg.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/msg.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** msg.cpp 17 Oct 2006 10:03:59 -0000 1.2 --- msg.cpp 23 Oct 2006 12:04:23 -0000 1.3 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2006/10/23 12:04:23 vfrolov + * Added SetTitle() + * * Revision 1.2 2006/10/17 10:03:59 vfrolov * Added MB_SETFOREGROUND flag to MessageBox() *************** *** 32,42 **** #include "utils.h" /////////////////////////////////////////////////////////////// ! static int ShowMsgDefault(LPCSTR pText, LPCSTR pCaption, UINT type) { ! return MessageBox(NULL, pText, pCaption, type|MB_SETFOREGROUND); } ! static int (* pShowMsg)(LPCSTR pText, LPCSTR pCaption, UINT type) = ShowMsgDefault; /////////////////////////////////////////////////////////////// static void ConsoleWriteReadDefault(LPSTR pReadBuf, DWORD lenReadBuf, LPCSTR pText) --- 35,47 ---- #include "utils.h" + char title[80] = ""; + /////////////////////////////////////////////////////////////// ! static int ShowMsgDefault(LPCSTR pText, UINT type) { ! return MessageBox(NULL, pText, title, type|MB_SETFOREGROUND); } ! static int (* pShowMsg)(LPCSTR pText, UINT type) = ShowMsgDefault; /////////////////////////////////////////////////////////////// static void ConsoleWriteReadDefault(LPSTR pReadBuf, DWORD lenReadBuf, LPCSTR pText) *************** *** 47,50 **** --- 52,56 ---- AllocConsole(); handle = GetStdHandle(STD_OUTPUT_HANDLE); + SetConsoleTitle(title); } *************** *** 78,82 **** VSNPRINTF(buf, sizeof(buf)/sizeof(buf[0]), pFmt, va); ! return pShowMsg(buf, NULL, type); } /////////////////////////////////////////////////////////////// --- 84,88 ---- VSNPRINTF(buf, sizeof(buf)/sizeof(buf[0]), pFmt, va); ! return pShowMsg(buf, type); } /////////////////////////////////////////////////////////////// *************** *** 104,108 **** LocalFree(pMsgBuf); ! return pShowMsg(buf, NULL, type); } /////////////////////////////////////////////////////////////// --- 110,114 ---- LocalFree(pMsgBuf); ! return pShowMsg(buf, type); } /////////////////////////////////////////////////////////////// *************** *** 176,177 **** --- 182,188 ---- } /////////////////////////////////////////////////////////////// + void SetTitle(const char *pTitle) + { + lstrcpyn(title, pTitle, sizeof(title)/sizeof(title[0])); + } + /////////////////////////////////////////////////////////////// |