com0com-cvs Mailing List for Null-modem emulator (Page 25)
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...> - 2008-03-26 08:36:28
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7982 Added Files: plugins.cpp plugins.h Log Message: Initial revision --- NEW FILE: plugins.cpp --- /* * $Id: plugins.cpp,v 1.1 2008/03/26 08:36:25 vfrolov Exp $ * * Copyright (c) 2008 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: plugins.cpp,v $ * Revision 1.1 2008/03/26 08:36:25 vfrolov * Initial revision * * */ #include "precomp.h" #include "port.h" #include "comhub.h" #include "plugins.h" #include "bufutils.h" #include "hubmsg.h" #include "export.h" /////////////////////////////////////////////////////////////// class PluginEnt { public: PluginEnt(const PLUGIN_ROUTINES_A *_pRoutines); ~PluginEnt(); void Help(const char *pProgPath) const; BOOL Config(const char *pArg) const; #define ABOUT(item) \ string item() const { \ if (!ROUTINE_IS_VALID(pRoutines, pGetPluginAbout)) \ return ""; \ const PLUGIN_ABOUT_A *pAbout = pRoutines->pGetPluginAbout(); \ if (!pAbout || !ROUTINE_IS_VALID(pAbout, p##item)) \ return ""; \ return pAbout->p##item; \ } ABOUT(Name) ABOUT(Copyright) ABOUT(License) ABOUT(Description) #undef ABOUT const PLUGIN_ROUTINES_A *Routines(HCONFIG *phConfig) { inUse = TRUE; *phConfig = hConfig; return pRoutines; } BOOL InUse() const { return inUse; } private: const PLUGIN_ROUTINES_A *pRoutines; BOOL inUse; HCONFIG hConfig; }; PluginEnt::PluginEnt(const PLUGIN_ROUTINES_A *_pRoutines) : pRoutines(_pRoutines), inUse(FALSE), hConfig(NULL) { if (ROUTINE_IS_VALID(pRoutines, pConfigStart)) hConfig = pRoutines->pConfigStart(); } PluginEnt::~PluginEnt() { if (hConfig && ROUTINE_IS_VALID(pRoutines, pConfigStop)) pRoutines->pConfigStop(hConfig); } void PluginEnt::Help(const char *pProgPath) const { if (ROUTINE_IS_VALID(pRoutines, pHelp)) pRoutines->pHelp(pProgPath); else cerr << "No help found." << endl; } BOOL PluginEnt::Config(const char *pArg) const { if (hConfig && ROUTINE_IS_VALID(pRoutines, pConfig)) return pRoutines->pConfig(hConfig, pArg); return FALSE; } /////////////////////////////////////////////////////////////// static string type2str(PLUGIN_TYPE type) { stringstream str; switch (type) { case PLUGIN_TYPE_FILTER: str << "filter"; break; case PLUGIN_TYPE_PORT: str << "port"; break; default: str << type; } return str.str(); } /////////////////////////////////////////////////////////////// static BOOL GetPluginsDir(string &pluginsDir) { DWORD res; char *pPath1 = new char[MAX_PATH]; if (!pPath1) { return FALSE; } res = GetModuleFileName(NULL, pPath1, MAX_PATH); if (!res || res >= MAX_PATH) { delete [] pPath1; return FALSE; } char *pPath2 = new char[MAX_PATH]; if (!pPath2) { delete [] pPath1; return FALSE; } char *pName; res = GetFullPathName(pPath1, MAX_PATH, pPath2, &pName); delete [] pPath1; if (!res || res >= MAX_PATH || !pName) { delete [] pPath2; return FALSE; } *pName = 0; pluginsDir = pPath2; delete [] pPath2; pluginsDir += "plugins\\"; return TRUE; } /////////////////////////////////////////////////////////////// Plugins::Plugins() { string pluginsDir; if (!GetPluginsDir(pluginsDir)) return; string pathWildcard(pluginsDir); pathWildcard += "*.dll"; WIN32_FIND_DATA findFileData; HANDLE hFind = FindFirstFile(pathWildcard.c_str(), &findFileData); if (hFind == INVALID_HANDLE_VALUE) return; do { string pathPlugin(pluginsDir); pathPlugin += findFileData.cFileName; LoadPlugin(pathPlugin); } while (FindNextFile(hFind, &findFileData)); FindClose(hFind); } /////////////////////////////////////////////////////////////// Plugins::~Plugins() { for (DllPluginsArray::const_iterator iDll = dllPluginsArray.begin() ; iDll != dllPluginsArray.end() ; iDll++) { BOOL inUse = FALSE; if (!*iDll) continue; if ((*iDll)->second) { for (PluginArray::const_iterator i = (*iDll)->second->begin() ; i != (*iDll)->second->end() ; i++) { if (*i && (*i)->InUse()) { inUse = TRUE; break; } } delete (*iDll)->second; } if (inUse) (*iDll)->first = NULL; } for (TypePluginsMap::const_iterator iPair = plugins.begin() ; iPair != plugins.end() ; iPair++) { if (iPair->second) { for (PluginArray::const_iterator i = iPair->second->begin() ; i != iPair->second->end() ; i++) { if (*i) delete *i; } delete iPair->second; } } for (DllPluginsArray::const_iterator iDll = dllPluginsArray.begin() ; iDll != dllPluginsArray.end() ; iDll++) { if (!*iDll) continue; if ((*iDll)->first) FreeLibrary((*iDll)->first); } } /////////////////////////////////////////////////////////////// void Plugins::LoadPlugin(const string &pathPlugin) { HMODULE hDll = ::LoadLibrary(pathPlugin.c_str()); if (!hDll) { cerr << "Can't load " << pathPlugin << endl; return; } PLUGIN_INIT_A *pInitProc; pInitProc = (PLUGIN_INIT_A *)::GetProcAddress(hDll, PLUGIN_INIT_PROC_NAME_A); if (!pInitProc) { pInitProc = (PLUGIN_INIT_A *)::GetProcAddress(hDll, PLUGIN_INIT_PROC_NAME); if (!pInitProc) { cerr << "No procedure " << PLUGIN_INIT_PROC_NAME_A << " in " << pathPlugin << endl; FreeLibrary(hDll); return; } } DllPlugins *pDllPlugins = new DllPlugins(hDll, new PluginArray); if (!pDllPlugins || !pDllPlugins->second) { cerr << "No enough memory." << endl; if (pDllPlugins) delete pDllPlugins; FreeLibrary(hDll); return; } InitPlugin(pathPlugin, pInitProc, *pDllPlugins->second); if (pDllPlugins->second->size()) { dllPluginsArray.push_back(pDllPlugins); } else { delete pDllPlugins->second; delete pDllPlugins; FreeLibrary(hDll); } } /////////////////////////////////////////////////////////////// void Plugins::InitPlugin( const string &moduleName, PLUGIN_INIT_A *pInitProc, PluginArray &pluginArray) { for (const PLUGIN_ROUTINES_A *const *ppPlgRoutines = pInitProc(&hubRoutines) ; *ppPlgRoutines ; *ppPlgRoutines++) { PLUGIN_TYPE type = ROUTINE_IS_VALID(*ppPlgRoutines, pGetPluginType) ? (*ppPlgRoutines)->pGetPluginType() : PLUGIN_TYPE_INVALID; if (type == PLUGIN_TYPE_INVALID) { cerr << "Found plugin with invalid type in " << moduleName << endl; continue; } PluginEnt *pPlugin = new PluginEnt(*ppPlgRoutines); if (!pPlugin) { cerr << "No enough memory." << endl; continue; } TypePluginsMap::iterator iPair = plugins.find(type); if (iPair == plugins.end()) { plugins.insert(pair<PLUGIN_TYPE, PluginArray*>(type, NULL)); iPair = plugins.find(type); if (iPair == plugins.end()) { cerr << "Can't add plugin type " << type << endl; delete pPlugin; continue; } } if (!iPair->second) { iPair->second = new PluginArray; if (!iPair->second) { cerr << "No enough memory." << endl; delete pPlugin; continue; } } for (PluginArray::const_iterator i = iPair->second->begin() ; i != iPair->second->end() ; i++) { if (*i && (*i)->Name() == pPlugin->Name()) { cerr << "Plugin " << pPlugin->Name() << " with type " << type << " already exists. Ignored plugin in " << moduleName << endl; delete pPlugin; pPlugin = NULL; } } if (pPlugin) { iPair->second->push_back(pPlugin); pluginArray.push_back(pPlugin); } } } /////////////////////////////////////////////////////////////// void Plugins::List(ostream &o) const { for (TypePluginsMap::const_iterator iPair = plugins.begin() ; iPair != plugins.end() ; iPair++) { if (iPair->second) { o << endl; o << "List of " << type2str(iPair->first) << " modules:" << endl; for (PluginArray::const_iterator i = iPair->second->begin() ; i != iPair->second->end() ; i++) o << " " << (*i)->Name() << " - " << (*i)->Description() << endl; } } } /////////////////////////////////////////////////////////////// void Plugins::Help( const char *pProgPath, const char *pPluginName) const { BOOL found = FALSE; for (TypePluginsMap::const_iterator iPair = plugins.begin() ; iPair != plugins.end() ; iPair++) { if (iPair->second) { for (PluginArray::const_iterator i = iPair->second->begin() ; i != iPair->second->end() ; i++) { if (*i && ((*i)->Name() == pPluginName || string("*") == pPluginName)) { if (found) cerr << "-----------------------------" << endl; cerr << "Type: " << type2str(iPair->first) << endl; cerr << "Name: " << (*i)->Name() << endl; cerr << "Copyright: " << (*i)->Copyright() << endl; cerr << "License: " << (*i)->License() << endl; cerr << "Description: " << (*i)->Description() << endl; cerr << endl; (*i)->Help(pProgPath); found = TRUE; } } } } if (!found) cerr << "The plugin " << pPluginName << " not found." << endl; } /////////////////////////////////////////////////////////////// BOOL Plugins::Config(const char *pArg) const { BOOL res = FALSE; for (TypePluginsMap::const_iterator iPair = plugins.begin() ; iPair != plugins.end() ; iPair++) { if (iPair->second) { for (PluginArray::const_iterator i = iPair->second->begin() ; i != iPair->second->end() ; i++) { if (*i && (*i)->Config(pArg)) res = TRUE; } } } return res; } /////////////////////////////////////////////////////////////// const PLUGIN_ROUTINES_A *Plugins::GetRoutines( PLUGIN_TYPE type, const char *pPluginName, HCONFIG *phConfig) const { TypePluginsMap::const_iterator iPair = plugins.find(type); if (iPair == plugins.end() || !iPair->second) return NULL; for (PluginArray::const_iterator i = iPair->second->begin() ; i != iPair->second->end() ; i++) { if (*i && (*i)->Name() == pPluginName) return (*i)->Routines(phConfig); } return NULL; } /////////////////////////////////////////////////////////////// --- NEW FILE: plugins.h --- /* * $Id: plugins.h,v 1.1 2008/03/26 08:36:25 vfrolov Exp $ * * Copyright (c) 2008 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: plugins.h,v $ * Revision 1.1 2008/03/26 08:36:25 vfrolov * Initial revision * * */ #ifndef _PLUGINS_H #define _PLUGINS_H #include "plugins/plugins_api.h" /////////////////////////////////////////////////////////////// class PluginEnt; /////////////////////////////////////////////////////////////// typedef vector<PluginEnt*> PluginArray; typedef map<PLUGIN_TYPE, PluginArray*> TypePluginsMap; typedef pair<HMODULE, PluginArray*> DllPlugins; typedef vector<DllPlugins*> DllPluginsArray; /////////////////////////////////////////////////////////////// class Plugins { public: Plugins(); ~Plugins(); void List(ostream &o) const; void Help(const char *pProgPath, const char *pPluginName) const; BOOL Config(const char *pArg) const; const PLUGIN_ROUTINES_A *GetRoutines( PLUGIN_TYPE type, const char *pPluginName, HCONFIG *phConfig) const; private: void LoadPlugin(const string &pathPlugin); void InitPlugin( const string &moduleName, PLUGIN_INIT_A *pInitProc, PluginArray &pluginArray); TypePluginsMap plugins; DllPluginsArray dllPluginsArray; }; /////////////////////////////////////////////////////////////// #endif // _PLUGINS_H |
From: Vyacheslav F. <vf...@us...> - 2008-03-26 08:36:09
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7613 Added Files: hubmsg.cpp hubmsg.h Log Message: Initial revision --- NEW FILE: hubmsg.h --- /* * $Id: hubmsg.h,v 1.1 2008/03/26 08:36:03 vfrolov Exp $ * * Copyright (c) 2008 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: hubmsg.h,v $ * Revision 1.1 2008/03/26 08:36:03 vfrolov * Initial revision * * */ #ifndef _HUBMSG_H #define _HUBMSG_H /////////////////////////////////////////////////////////////// #include "plugins/plugins_api.h" /////////////////////////////////////////////////////////////// #define MSG_SIGNATURE 'h4cM' /////////////////////////////////////////////////////////////// class HubMsg : public HUB_MSG { public: HubMsg(); ~HubMsg(); void Clean(); void Merge(HubMsg *pMsg); HubMsg *Clone() const; void Insert(HubMsg *pPrevMsg) { _ASSERTE(signature == MSG_SIGNATURE); _ASSERTE(pPrevMsg->signature == MSG_SIGNATURE); pNext = pPrevMsg->pNext; pPrevMsg->pNext = this; } HubMsg *Next() { _ASSERTE(signature == MSG_SIGNATURE); return pNext; } private: HubMsg *pNext; #ifdef _DEBUG DWORD signature; #endif }; /////////////////////////////////////////////////////////////// #endif /* _HUBMSG_H */ --- NEW FILE: hubmsg.cpp --- /* * $Id: hubmsg.cpp,v 1.1 2008/03/26 08:36:03 vfrolov Exp $ * * Copyright (c) 2008 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: hubmsg.cpp,v $ * Revision 1.1 2008/03/26 08:36:03 vfrolov * Initial revision * * */ #include "precomp.h" #include "hubmsg.h" #include "bufutils.h" /////////////////////////////////////////////////////////////// HubMsg::HubMsg() : pNext(NULL) { #ifdef _DEBUG signature = MSG_SIGNATURE; #endif ::memset((HUB_MSG *)this, 0, sizeof(HUB_MSG)); } /////////////////////////////////////////////////////////////// HubMsg::~HubMsg() { _ASSERTE(signature == MSG_SIGNATURE); if (pNext) delete pNext; Clean(); #ifdef _DEBUG signature = 0; #endif } /////////////////////////////////////////////////////////////// HubMsg *HubMsg::Clone() const { _ASSERTE(signature == MSG_SIGNATURE); HubMsg *pNewMsg = new HubMsg(); if (!pNewMsg) return NULL; if (pNext) { pNewMsg->pNext = pNext->Clone(); if (!pNewMsg->pNext) { delete pNewMsg; return NULL; } } if ((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_BUF) { BufAppend(&pNewMsg->u.buf.pBuf, 0, u.buf.pBuf, u.buf.size); if (pNewMsg->u.buf.pBuf || !u.buf.size) { pNewMsg->type = type; pNewMsg->u.buf.size = u.buf.size; } else { delete pNewMsg; return NULL; } } else { *(HUB_MSG *)pNewMsg = *(const HUB_MSG *)this; } return pNewMsg; } /////////////////////////////////////////////////////////////// void HubMsg::Clean() { _ASSERTE(signature == MSG_SIGNATURE); if ((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_BUF) BufFree(u.buf.pBuf); ::memset((HUB_MSG *)this, 0, sizeof(HUB_MSG)); } /////////////////////////////////////////////////////////////// void HubMsg::Merge(HubMsg *pMsg) { _ASSERTE(signature == MSG_SIGNATURE); _ASSERTE(pMsg == NULL || pMsg->signature == MSG_SIGNATURE); HubMsg **ppNext = &pNext; while (*ppNext) ppNext = &(*ppNext)->pNext; *ppNext = pMsg; } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-03-26 08:35:36
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7586 Added Files: filters.cpp filters.h Log Message: Initial revision --- NEW FILE: filters.h --- /* * $Id: filters.h,v 1.1 2008/03/26 08:35:32 vfrolov Exp $ * * Copyright (c) 2008 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: filters.h,v $ * Revision 1.1 2008/03/26 08:35:32 vfrolov * Initial revision * * */ #ifndef _FILTERS_H #define _FILTERS_H #include "plugins/plugins_api.h" /////////////////////////////////////////////////////////////// class ComHub; class Filter; class FilterMethod; class HubMsg; /////////////////////////////////////////////////////////////// typedef vector<Filter*> FilterArray; typedef vector<FilterMethod*> FilterMethodArray; typedef map<int, FilterMethodArray*> PortFiltersMap; /////////////////////////////////////////////////////////////// class Filters { public: Filters(const ComHub &_hub) : hub(_hub) {} ~Filters(); BOOL CreateFilter( const FILTER_ROUTINES_A *pFltRoutines, const char *pFilterName, HCONFIG hConfig, const char *pArgs); BOOL AddFilter( int iPort, const char *pName, BOOL isInMethod); void Report() const; BOOL Init() const; BOOL InMethod( int nFromPort, HubMsg *pInMsg, HubMsg **ppEchoMsg) const; BOOL OutMethod( int nFromPort, int nToPort, HubMsg *pOutMsg) const; private: const ComHub &hub; FilterArray allFilters; PortFiltersMap portFilters; }; /////////////////////////////////////////////////////////////// #endif // _FILTERS_H --- NEW FILE: filters.cpp --- /* * $Id: filters.cpp,v 1.1 2008/03/26 08:35:32 vfrolov Exp $ * * Copyright (c) 2008 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: filters.cpp,v $ * Revision 1.1 2008/03/26 08:35:32 vfrolov * Initial revision * * */ #include "precomp.h" #include "port.h" #include "comhub.h" #include "filters.h" #include "bufutils.h" #include "hubmsg.h" #include "utils.h" /////////////////////////////////////////////////////////////// class Filter { public: Filter( const char *pName, HFILTER _hFilter, FILTER_INIT *_pInit, FILTER_IN_METHOD *_pInMethod, FILTER_OUT_METHOD *_pOutMethod) : name(pName), hFilter(_hFilter), pInit(_pInit), pInMethod(_pInMethod), pOutMethod(_pOutMethod) {} const string name; const HFILTER hFilter; FILTER_INIT *const pInit; FILTER_IN_METHOD *const pInMethod; FILTER_OUT_METHOD *const pOutMethod; }; /////////////////////////////////////////////////////////////// class FilterMethod { public: FilterMethod(const Filter &_filter, BOOL _isInMethod) : filter(_filter), isInMethod(_isInMethod) {} const Filter &filter; const BOOL isInMethod; }; /////////////////////////////////////////////////////////////// typedef pair<int, FilterMethodArray*> PortFilters; /////////////////////////////////////////////////////////////// Filters::~Filters() { for (PortFiltersMap::const_iterator iPort = portFilters.begin() ; iPort != portFilters.end() ; iPort++) { if (iPort->second) { for (FilterMethodArray::const_iterator i = iPort->second->begin() ; i != iPort->second->end() ; i++) { if (*i) delete *i; } delete iPort->second; } } for (FilterArray::const_iterator i = allFilters.begin() ; i != allFilters.end() ; i++) { if (*i) delete *i; } } /////////////////////////////////////////////////////////////// BOOL Filters::CreateFilter( const FILTER_ROUTINES_A *pFltRoutines, const char *pFilterName, HCONFIG hConfig, const char *pArgs) { if (!ROUTINE_IS_VALID(pFltRoutines, pCreate)) { cerr << "No create routine for filter " << pFilterName << endl; return FALSE; } int argc; const char **argv; void *pTmpArgs; CreateArgsVector(pFilterName, pArgs, &argc, &argv, &pTmpArgs); HFILTER hFilter = pFltRoutines->pCreate(hConfig, argc, argv); FreeArgsVector(argv, pTmpArgs); if (!hFilter) { cerr << "Can't create filter " << pFilterName << endl; return FALSE; } Filter *pFilter = new Filter( pFilterName, hFilter, ROUTINE_GET(pFltRoutines, pInit), ROUTINE_GET(pFltRoutines, pInMethod), ROUTINE_GET(pFltRoutines, pOutMethod)); if (!pFilter) { cerr << "No enough memory." << endl; return FALSE; } allFilters.push_back(pFilter); return TRUE; } /////////////////////////////////////////////////////////////// BOOL Filters::AddFilter( int iPort, const char *pName, BOOL isInMethod) { PortFiltersMap::iterator iPair = portFilters.find(iPort); if (iPair == portFilters.end()) { portFilters.insert(PortFilters(iPort, NULL)); iPair = portFilters.find(iPort); if (iPair == portFilters.end()) { cerr << "Can't add filters for port " << iPort << endl; return FALSE; } } if (!iPair->second) { iPair->second = new FilterMethodArray; if (!iPair->second) { cerr << "No enough memory." << endl; return FALSE; } } BOOL found = FALSE; for (FilterArray::const_iterator i = allFilters.begin() ; i != allFilters.end() ; i++) { if (*i && (*i)->name == pName) { if ((isInMethod && (*i)->pInMethod) || (!isInMethod && (*i)->pOutMethod)) { FilterMethod *pFilterMethod = new FilterMethod(*(*i), isInMethod); if (!pFilterMethod) { cerr << "No enough memory." << endl; return FALSE; } iPair->second->push_back(pFilterMethod); } found = TRUE; } } if (!found) { cerr << "Can't find filter " << pName << endl; return FALSE; } return TRUE; } /////////////////////////////////////////////////////////////// void Filters::Report() const { if (!portFilters.size()) return; cout << "Filters:" << endl; for (PortFiltersMap::const_iterator iPort = portFilters.begin() ; iPort != portFilters.end() ; iPort++) { stringstream bufs[3]; Port *pPort = hub.GetPort(iPort->first); if (pPort) bufs[1] << pPort->Name() << " "; else bufs[1] << iPort->first << " "; for (int i = 0 ; i < 3 ; i++) { string::size_type diff = bufs[1].str().length() - bufs[i].str().length(); for (string::size_type j = 0 ; j < diff ; j++) { bufs[i] << (i == 0 ? " " : "_"); } } cout << bufs[2].str() << endl; bufs[0] << "\\-"; bufs[1] << "| "; bufs[2] << "/<-"; FilterMethodArray *pFilters = iPort->second; if (pFilters) { for (FilterMethodArray::const_iterator i = pFilters->begin() ; i != pFilters->end() ; i++) { if ((*i)->isInMethod) { bufs[0] << ">{" << (*i)->filter.name << ".IN" << "}-"; string::size_type len = (*i)->filter.name.length(); for (int i = 1 ; i < 3 ; i++) { string::size_type diff = bufs[0].str().length() - bufs[i].str().length(); for (string::size_type j = len/2 + 6 ; j < diff ; j++) bufs[i] << (i == 2 ? "-" : " "); } bufs[1] << "/"; bufs[2] << "-"; } else { bufs[2] << "{" << (*i)->filter.name << ".OUT" << "}<-"; string::size_type len = (*i)->filter.name.length(); for (int i = 0 ; i < 2 ; i++) { string::size_type diff = bufs[2].str().length() - bufs[i].str().length(); for (string::size_type j = len/2 + 7 ; j < diff ; j++) bufs[i] << (i == 0 ? "-" : " "); } } } } if (bufs[2].str().length() > bufs[0].str().length()) { string::size_type diff = bufs[2].str().length() - (bufs[0].str().length() + 1); for (string::size_type j = 0 ; j < diff ; j++) bufs[0] << "-"; } else { string::size_type diff = bufs[0].str().length() + 1 - bufs[2].str().length(); for (string::size_type j = 0 ; j < diff ; j++) bufs[2] << "-"; } bufs[0] << ">"; for (int i = 0 ; i < 3 ; i++) { cout << bufs[i].str() << endl; } cout << endl; } } /////////////////////////////////////////////////////////////// BOOL Filters::Init() const { BOOL res = TRUE; for (FilterArray::const_iterator i = allFilters.begin() ; i != allFilters.end() ; i++) { if (*i && (*i)->pInit) { if (!(*i)->pInit((*i)->hFilter, (HHUB)&hub)) res = FALSE; } } return res; } /////////////////////////////////////////////////////////////// static BOOL InMethod( int nFromPort, const FilterMethodArray::const_iterator &i, const FilterMethodArray::const_iterator &iEnd, HubMsg *pInMsg, HubMsg **ppEchoMsg) { _ASSERTE(*ppEchoMsg == NULL); HubMsg *pEchoMsg = NULL; if ((*i)->isInMethod) { FILTER_IN_METHOD *pInMethod = (*i)->filter.pInMethod; HFILTER hFilter = (*i)->filter.hFilter; HubMsg *pNextMsg = pInMsg; for (HubMsg *pCurMsg = pNextMsg ; pCurMsg ; pCurMsg = pNextMsg) { pNextMsg = pNextMsg->Next(); HUB_MSG *pEchoMsgPart = NULL; if (!pInMethod(hFilter, nFromPort, pCurMsg, &pEchoMsgPart)) { if (pEchoMsgPart) delete (HubMsg *)pEchoMsgPart; return FALSE; } if (pEchoMsgPart) { if (pEchoMsg) { pEchoMsg->Merge((HubMsg *)pEchoMsgPart); } else { pEchoMsg = (HubMsg *)pEchoMsgPart; } } } } const FilterMethodArray::const_iterator iNext = i + 1; if (iNext != iEnd) { if (!InMethod(nFromPort, iNext, iEnd, pInMsg, ppEchoMsg)) return FALSE; } if (pEchoMsg) { if (*ppEchoMsg) pEchoMsg->Merge(*ppEchoMsg); *ppEchoMsg = pEchoMsg; } if (!(*i)->isInMethod) { FILTER_OUT_METHOD *pOutMethod = (*i)->filter.pOutMethod; HFILTER hFilter = (*i)->filter.hFilter; HubMsg *pNextMsg = *ppEchoMsg; for (HubMsg *pCurMsg = pNextMsg ; pCurMsg ; pCurMsg = pNextMsg) { pNextMsg = pNextMsg->Next(); if (!pOutMethod(hFilter, nFromPort, nFromPort, pCurMsg)) return FALSE; } } return TRUE; } /////////////////////////////////////////////////////////////// BOOL Filters::InMethod( int nFromPort, HubMsg *pInMsg, HubMsg **ppEchoMsg) const { _ASSERTE(*ppEchoMsg == NULL); PortFiltersMap::const_iterator iPair = portFilters.find(nFromPort); if (iPair == portFilters.end()) return TRUE; FilterMethodArray *pFilters = iPair->second; if (!pFilters) return TRUE; const FilterMethodArray::const_iterator i = pFilters->begin(); if (i != pFilters->end()) { if (!::InMethod(nFromPort, i, pFilters->end(), pInMsg, ppEchoMsg)) return FALSE; } return TRUE; } /////////////////////////////////////////////////////////////// BOOL Filters::OutMethod( int nFromPort, int nToPort, HubMsg *pOutMsg) const { PortFiltersMap::const_iterator iPair = portFilters.find(nToPort); if (iPair == portFilters.end()) return TRUE; FilterMethodArray *pFilters = iPair->second; if (!pFilters) return TRUE; for (FilterMethodArray::const_reverse_iterator i = pFilters->rbegin() ; i != pFilters->rend() ; i++) { if (!(*i)->isInMethod) { FILTER_OUT_METHOD *pOutMethod = (*i)->filter.pOutMethod; HFILTER hFilter = (*i)->filter.hFilter; HubMsg *pNextMsg = pOutMsg; for (HubMsg *pCurMsg = pNextMsg ; pCurMsg ; pCurMsg = pNextMsg) { pNextMsg = pNextMsg->Next(); if (!pOutMethod(hFilter, nFromPort, nToPort, pCurMsg)) return FALSE; } } } return TRUE; } /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-03-26 08:35:08
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7328 Added Files: export.cpp export.h Log Message: Initial revision --- NEW FILE: export.h --- /* * $Id: export.h,v 1.1 2008/03/26 08:35:03 vfrolov Exp $ * * Copyright (c) 2008 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: export.h,v $ * Revision 1.1 2008/03/26 08:35:03 vfrolov * Initial revision * * */ #ifndef _EXPORT_H #define _EXPORT_H #include "plugins/plugins_api.h" /////////////////////////////////////////////////////////////// extern HUB_ROUTINES_A hubRoutines; /////////////////////////////////////////////////////////////// #endif // _EXPORT_H --- NEW FILE: export.cpp --- /* * $Id: export.cpp,v 1.1 2008/03/26 08:35:03 vfrolov Exp $ * * Copyright (c) 2008 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: export.cpp,v $ * Revision 1.1 2008/03/26 08:35:03 vfrolov * Initial revision * * */ #include "precomp.h" #include "export.h" #include "port.h" #include "comhub.h" #include "bufutils.h" #include "hubmsg.h" /////////////////////////////////////////////////////////////// static BYTE * CALLBACK buf_alloc(DWORD size) { return BufAlloc(size); } /////////////////////////////////////////////////////////////// static VOID CALLBACK buf_free(BYTE *pBuf) { BufFree(pBuf); } /////////////////////////////////////////////////////////////// static HUB_MSG *CALLBACK msg_replace_buf(HUB_MSG *pMsg, WORD type, const BYTE *pSrc, DWORD sizeSrc) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_BUF); _ASSERTE(pMsg != NULL); if ((pMsg->type & HUB_MSG_UNION_TYPE_MASK) != HUB_MSG_UNION_TYPE_BUF) ((HubMsg *)pMsg)->Clean(); BufAppend(&pMsg->u.buf.pBuf, 0, pSrc, sizeSrc); if (!pMsg->u.buf.pBuf && sizeSrc) { ((HubMsg *)pMsg)->Clean(); return NULL; } pMsg->u.buf.size = sizeSrc; pMsg->type = type; return pMsg; } /////////////////////////////////////////////////////////////// static HUB_MSG *CALLBACK msg_insert_buf(HUB_MSG *pPrevMsg, WORD type, const BYTE *pSrc, DWORD sizeSrc) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_BUF); if (pPrevMsg && pPrevMsg->type == type) { BufAppend(&pPrevMsg->u.buf.pBuf, pPrevMsg->u.buf.size, pSrc, sizeSrc); return pPrevMsg; } HubMsg *pMsg = new HubMsg(); if (!pMsg) { cerr << "No enough memory." << endl; return NULL; } if (sizeSrc) { BufAppend(&pMsg->u.buf.pBuf, 0, pSrc, sizeSrc); if (!pMsg->u.buf.pBuf) { delete pMsg; return NULL; } } pMsg->u.buf.size = sizeSrc; pMsg->type = type; if (pPrevMsg) pMsg->Insert((HubMsg *)pPrevMsg); return pMsg; } /////////////////////////////////////////////////////////////// static HUB_MSG *CALLBACK msg_replace_val(HUB_MSG *pMsg, WORD type, DWORD val) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_VAL); _ASSERTE(pMsg != NULL); ((HubMsg *)pMsg)->Clean(); pMsg->u.val = val; pMsg->type = type; return pMsg; } /////////////////////////////////////////////////////////////// static HUB_MSG *CALLBACK msg_insert_val(HUB_MSG *pPrevMsg, WORD type, DWORD val) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_VAL); HubMsg *pMsg = new HubMsg(); if (!pMsg) { cerr << "No enough memory." << endl; return NULL; } pMsg->u.val = val; pMsg->type = type; if (pPrevMsg) pMsg->Insert((HubMsg *)pPrevMsg); return pMsg; } /////////////////////////////////////////////////////////////// static HUB_MSG *CALLBACK msg_replace_none(HUB_MSG *pMsg, WORD type) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_NONE); _ASSERTE(pMsg != NULL); ((HubMsg *)pMsg)->Clean(); pMsg->type = type; return pMsg; } /////////////////////////////////////////////////////////////// static HUB_MSG *CALLBACK msg_insert_none(HUB_MSG *pPrevMsg, WORD type) { _ASSERTE((type & HUB_MSG_UNION_TYPE_MASK) == HUB_MSG_UNION_TYPE_NONE); HubMsg *pMsg = new HubMsg(); if (!pMsg) { cerr << "No enough memory." << endl; return NULL; } pMsg->type = type; if (pPrevMsg) pMsg->Insert((HubMsg *)pPrevMsg); return pMsg; } /////////////////////////////////////////////////////////////// static int CALLBACK num_ports(HHUB hHub) { _ASSERTE(hHub != NULL); _ASSERTE(((ComHub *)hHub)->IsValid()); return ((ComHub *)hHub)->NumPorts(); } /////////////////////////////////////////////////////////////// static const char * CALLBACK port_name(HHUB hHub, int n) { _ASSERTE(hHub != NULL); _ASSERTE(((ComHub *)hHub)->IsValid()); Port *pPort = ((ComHub *)hHub)->GetPort(n); if (!pPort) return NULL; return pPort->Name().c_str(); } /////////////////////////////////////////////////////////////// static void CALLBACK on_xoff(HHUB hHub, HMASTERPORT hMasterPort) { _ASSERTE(hHub != NULL); _ASSERTE(((ComHub *)hHub)->IsValid()); _ASSERTE(hMasterPort != NULL); _ASSERTE(((Port *)hMasterPort)->IsValid()); ((ComHub *)hHub)->AddXoff((Port *)hMasterPort); } /////////////////////////////////////////////////////////////// static void CALLBACK on_xon(HHUB hHub, HMASTERPORT hMasterPort) { _ASSERTE(hHub != NULL); _ASSERTE(((ComHub *)hHub)->IsValid()); _ASSERTE(hMasterPort != NULL); _ASSERTE(((Port *)hMasterPort)->IsValid()); ((ComHub *)hHub)->AddXon((Port *)hMasterPort); } /////////////////////////////////////////////////////////////// static void CALLBACK on_read(HHUB hHub, HMASTERPORT hMasterPort, HUB_MSG *pMsg) { _ASSERTE(hHub != NULL); _ASSERTE(((ComHub *)hHub)->IsValid()); _ASSERTE(hMasterPort != NULL); _ASSERTE(((Port *)hMasterPort)->IsValid()); HubMsg msg; *(HUB_MSG *)&msg = *pMsg; ::memset(pMsg, 0, sizeof(*pMsg)); ((ComHub *)hHub)->OnRead((Port *)hMasterPort, &msg); } /////////////////////////////////////////////////////////////// HUB_ROUTINES_A hubRoutines = { sizeof(HUB_ROUTINES_A), buf_alloc, buf_free, msg_replace_buf, msg_insert_buf, msg_replace_val, msg_insert_val, msg_replace_none, msg_insert_none, num_ports, port_name, on_xoff, on_xon, on_read, }; /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-03-26 08:34:43
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7191 Added Files: bufutils.h Log Message: Initial revision --- NEW FILE: bufutils.h --- /* * $Id: bufutils.h,v 1.1 2008/03/26 08:34:39 vfrolov Exp $ * * Copyright (c) 2008 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: bufutils.h,v $ * Revision 1.1 2008/03/26 08:34:39 vfrolov * Initial revision * * */ #ifndef _BUFUTILS_H_ #define _BUFUTILS_H_ /////////////////////////////////////////////////////////////// #define BUF_SIGNATURE 'h4cB' /////////////////////////////////////////////////////////////// inline BYTE *BufAlloc(DWORD size) { if (!size) return NULL; size += 16; BYTE *pBuf = new BYTE[size #ifdef _DEBUG + sizeof(DWORD) #endif + sizeof(DWORD)]; if (!pBuf) return NULL; #ifdef _DEBUG *(DWORD *)pBuf = BUF_SIGNATURE; pBuf += sizeof(DWORD); #endif *(DWORD *)pBuf = size; pBuf += sizeof(DWORD); return pBuf; } /////////////////////////////////////////////////////////////// inline VOID BufFree(BYTE *pBuf) { if (pBuf) { _ASSERTE(*(DWORD *)(pBuf - sizeof(DWORD) - sizeof(DWORD)) == BUF_SIGNATURE); #ifdef _DEBUG *(DWORD *)(pBuf - sizeof(DWORD) - sizeof(DWORD)) = 0; #endif delete [] (pBuf #ifdef _DEBUG - sizeof(DWORD) #endif - sizeof(DWORD)); } } /////////////////////////////////////////////////////////////// inline void BufAppend(BYTE **ppBuf, DWORD offset, const BYTE *pSrc, DWORD sizeSrc) { BYTE *pBuf = *ppBuf; _ASSERTE(!pBuf || (*(DWORD *)(pBuf - sizeof(DWORD) - sizeof(DWORD)) == BUF_SIGNATURE)); DWORD sizeOld = pBuf ? *(DWORD *)(pBuf - sizeof(DWORD)) : 0; DWORD sizeNew = offset + sizeSrc; if (sizeOld < sizeNew) { *ppBuf = BufAlloc(sizeNew); if (sizeOld > offset) sizeOld = offset; if (sizeOld && *ppBuf) memcpy(*ppBuf, pBuf, sizeOld); BufFree(pBuf); pBuf = *ppBuf; } if (sizeSrc && pSrc && pBuf) memcpy(pBuf + offset, pSrc, sizeSrc); } /////////////////////////////////////////////////////////////// #endif /* _BUFUTILS_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-03-26 08:32:13
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv6435 Modified Files: .cvsignore Log Message: Removed *.sln Index: .cvsignore =================================================================== RCS file: /cvsroot/com0com/hub4com/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .cvsignore 6 Feb 2007 11:45:45 -0000 1.2 --- .cvsignore 26 Mar 2008 08:32:08 -0000 1.3 *************** *** 1,4 **** *.ncb - *.sln *.user *.suo --- 1,3 ---- |
From: Vyacheslav F. <vf...@us...> - 2008-03-26 08:15:27
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32465 Modified Files: precomp.h Log Message: Added more includes Index: precomp.h =================================================================== RCS file: /cvsroot/com0com/hub4com/precomp.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** precomp.h 1 Feb 2007 12:14:59 -0000 1.2 --- precomp.h 26 Mar 2008 08:15:24 -0000 1.3 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.3 2008/03/26 08:15:24 vfrolov + * Added more includes + * * Revision 1.2 2007/02/01 12:14:59 vfrolov * Redesigned COM port params *************** *** 33,41 **** #include <windows.h> #include <string> #include <vector> - #include <iostream> #include <map> #include <sstream> --- 36,46 ---- #include <windows.h> + #include <crtdbg.h> #include <string> #include <vector> #include <map> + #include <iostream> + #include <fstream> #include <sstream> |
From: Vyacheslav F. <vf...@us...> - 2008-03-26 08:14:14
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32051 Modified Files: utils.cpp utils.h Log Message: Added - class Args - STRQTOK_R() - CreateArgsVector()/FreeArgsVector() Index: utils.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/utils.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** utils.cpp 23 Jan 2007 09:13:10 -0000 1.1 --- utils.cpp 26 Mar 2008 08:14:09 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,27 **** * * $Log$ * Revision 1.1 2007/01/23 09:13:10 vfrolov * Initial revision * - * */ --- 20,32 ---- * * $Log$ + * Revision 1.2 2008/03/26 08:14:09 vfrolov + * Added + * - class Args + * - STRQTOK_R() + * - CreateArgsVector()/FreeArgsVector() + * * Revision 1.1 2007/01/23 09:13:10 vfrolov * Initial revision * */ *************** *** 30,33 **** --- 35,151 ---- /////////////////////////////////////////////////////////////// + Args::Args(int argc, const char *const argv[]) + : num_recursive(0) + { + for (int i = 0 ; i < argc ; i++) + Add(argv[i], vector<string>()); + } + + void Args::Add(const string &arg, const vector<string> ¶ms) + { + string argBuf = arg; + + for (size_type off = argBuf.find("%%"); off != argBuf.npos ; off = argBuf.find("%%", off)) { + BOOL replaced = FALSE; + + for (size_type i = 0 ; i < params.size() ; i++) { + stringstream par; + + par << (i + 1) << "%%"; + + if (argBuf.compare(off + 2, par.str().length(), par.str()) == 0) { + argBuf.replace(off, par.str().length() + 2, params[i]); + replaced = TRUE; + off += params[i].length(); + break; + } + } + + if (!replaced) + off += 2; + } + + const char *pLoad = GetParam(argBuf.c_str(), "--load="); + + if (!pLoad) { + //cout << "<" << argBuf << ">" << endl; + push_back(argBuf); + return; + } + + char *pTmp = _strdup(pLoad); + + if (!pTmp) { + cerr << "No enough memory." << endl; + exit(2); + } + + char *pSave; + char *pFile = STRQTOK_R(pTmp, ":", &pSave); + + if (!pFile || !*pFile) { + cerr << "No file name in " << arg << endl; + exit(1); + } + + ifstream ifile(pFile); + + if (ifile.fail()) { + cerr << "Can't open file " << pFile << endl; + exit(1); + } + + vector<string> paramsLoad; + + for (char *p = STRQTOK_R(NULL, ",", &pSave) ; p ; p = STRQTOK_R(NULL, ",", &pSave)) + paramsLoad.push_back(p); + + free(pTmp); + + while (ifile.good()) { + stringstream line; + + ifile.get(*line.rdbuf()); + + if (!ifile.fail()) { + string str = line.str(); + string::size_type first_non_space = string::npos; + string::size_type last_non_space = string::npos; + + for (string::size_type i = 0 ; i < str.length() ; i++) { + if (!isspace(str[i])) { + if (first_non_space == string::npos) { + if (str[i] == '#') + break; + + first_non_space = i; + } + + last_non_space = i; + } + } + + if (first_non_space != string::npos) { + str = str.substr(first_non_space, last_non_space + 1 - first_non_space); + + if (num_recursive > 256) { + cerr << "Too many recursive options " << arg << endl; + exit(1); + } + + num_recursive++; + Add(str, paramsLoad); + num_recursive--; + } + } else { + ifile.clear(); + } + + char ch; + + ifile.get(ch); + } + } + /////////////////////////////////////////////////////////////// static BOOL IsDelim(char c, const char *pDelims) { *************** *** 39,43 **** return FALSE; } ! char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave) { --- 157,161 ---- return FALSE; } ! /////////////////////////////////////////////////////////////// char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave) { *************** *** 66,69 **** --- 184,233 ---- } /////////////////////////////////////////////////////////////// + char *STRQTOK_R(char *pStr, const char *pDelims, char **ppSave) + { + if (!pStr) + pStr = *ppSave; + + while (IsDelim(*pStr, pDelims)) + pStr++; + + if (!*pStr) { + *ppSave = pStr; + return NULL; + } + + char *pToken = pStr; + BOOL quoted = FALSE; + int cntMask = 0; + + while (*pStr && (quoted || !IsDelim(*pStr, pDelims))) { + if (*pStr == '\"') { + if (cntMask%2 == 0) { + memmove(pStr, pStr + 1, strlen(pStr + 1) + 1); + quoted = !quoted; + } else { + memmove(pStr - (cntMask/2 + 1), pStr, strlen(pStr) + 1); + pStr -= cntMask/2; + } + cntMask = 0; + continue; + } + + if (*pStr == '\\') + cntMask++; + else + cntMask = 0; + + pStr++; + } + + if (*pStr) + *pStr++ = 0; + + *ppSave = pStr; + + return pToken; + } + /////////////////////////////////////////////////////////////// BOOL StrToInt(const char *pStr, int *pNum) { *************** *** 119,120 **** --- 283,346 ---- } /////////////////////////////////////////////////////////////// + void CreateArgsVector( + const char *pName, + const char *pArgs, + int *pArgc, + const char ***pArgv, + void **ppTmp) + { + int argc = 1; + const char **argv = (const char **)malloc((argc + 1) * sizeof(argv[0])); + + if (!argv) { + cerr << "No enough memory." << endl; + exit(2); + } + + argv[0] = pName; + + char *pTmp; + + if (pArgs) { + pTmp = _strdup(pArgs); + + if (!pTmp) { + cerr << "No enough memory." << endl; + exit(2); + } + + char *pSave; + + for (argv[argc] = STRQTOK_R(pTmp, " ", &pSave) ; + argv[argc] ; + argv[argc] = STRQTOK_R(NULL, " ", &pSave)) + { + argc++; + argv = (const char **)realloc(argv, (argc + 1) * sizeof(argv[0])); + + if (!argv) { + cerr << "No enough memory." << endl; + exit(2); + } + } + } else { + pTmp = NULL; + argv[argc] = NULL; + } + + *pArgc = argc; + *pArgv = argv; + *ppTmp = pTmp; + } + + void FreeArgsVector( + const char **argv, + void *pTmp) + { + if (argv) + free(argv); + + if (pTmp) + free(pTmp); + } + /////////////////////////////////////////////////////////////// Index: utils.h =================================================================== RCS file: /cvsroot/com0com/hub4com/utils.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** utils.h 23 Jan 2007 09:13:10 -0000 1.1 --- utils.h 26 Mar 2008 08:14:09 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,35 **** * * $Log$ * Revision 1.1 2007/01/23 09:13:10 vfrolov * Initial revision * - * */ ! #ifndef _C0C_UTILS_H_ ! #define _C0C_UTILS_H_ char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave); BOOL StrToInt(const char *pStr, int *pNum); const char *GetParam(const char *pArg, const char *pPattern); ! #endif /* _C0C_UTILS_H_ */ --- 20,63 ---- * * $Log$ + * Revision 1.2 2008/03/26 08:14:09 vfrolov + * Added + * - class Args + * - STRQTOK_R() + * - CreateArgsVector()/FreeArgsVector() + * * Revision 1.1 2007/01/23 09:13:10 vfrolov * Initial revision * */ ! #ifndef _UTILS_H_ ! #define _UTILS_H_ ! ! /////////////////////////////////////////////////////////////// ! class Args : public vector<string> ! { ! public: ! Args(int argc, const char *const argv[]); + private: + void Add(const string &arg, const vector<string> ¶ms); + + int num_recursive; + }; + /////////////////////////////////////////////////////////////// char *STRTOK_R(char *pStr, const char *pDelims, char **ppSave); + char *STRQTOK_R(char *pStr, const char *pDelims, char **ppSave); BOOL StrToInt(const char *pStr, int *pNum); const char *GetParam(const char *pArg, const char *pPattern); + void CreateArgsVector( + const char *pName, + const char *pArgs, + int *pArgc, + const char ***pArgv, + void **ppTmp); + void FreeArgsVector( + const char **argv, + void *pTmp); + /////////////////////////////////////////////////////////////// ! #endif /* _UTILS_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-03-26 08:10:24
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30578 Modified Files: version.h Log Message: Post-tagging version change Index: version.h =================================================================== RCS file: /cvsroot/com0com/hub4com/version.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** version.h 14 Mar 2008 11:50:07 -0000 1.3 --- version.h 26 Mar 2008 08:10:14 -0000 1.4 *************** *** 28,32 **** #define H4C_V2 1 #define H4C_V3 0 ! #define H4C_V4 0 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 --- 28,32 ---- #define H4C_V2 1 #define H4C_V3 0 ! #define H4C_V4 1 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 |
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15450/sys Modified Files: adddev.c com0com.h delay.c delay.h io.c ioctl.c openclos.c timeout.c timeout.h trace.c wmi.c Log Message: Implemented ability to get paired port settings with extended IOCTL_SERIAL_LSRMST_INSERT Index: openclos.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/openclos.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** openclos.c 17 Sep 2007 14:31:06 -0000 1.20 --- openclos.c 14 Mar 2008 15:28:39 -0000 1.21 *************** *** 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-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.21 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.20 2007/09/17 14:31:06 vfrolov * Implemented pseudo pin OPEN *************** *** 165,169 **** pIoPort->waitMask = 0; pIoPort->eventMask = 0; - pIoPort->escapeChar = 0; RtlZeroMemory(&pIoPort->perfStats, sizeof(pIoPort->perfStats)); pIoPort->handFlow.XoffLimit = size >> 3; --- 169,172 ---- *************** *** 224,227 **** --- 227,231 ---- KeAcquireSpinLock(pIoPort->pIoLock, &oldIrql); + pIoPort->escapeChar = 0; pIoPort->writeHoldingRemote = 0; pIoPort->sendXonXoff = 0; Index: ioctl.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/ioctl.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** ioctl.c 17 Sep 2007 14:31:06 -0000 1.33 --- ioctl.c 14 Mar 2008 15:28:39 -0000 1.34 *************** *** 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-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.34 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.33 2007/09/17 14:31:06 vfrolov * Implemented pseudo pin OPEN *************** *** 135,138 **** --- 139,143 ---- #include "handflow.h" #include "commprop.h" + #include "../include/cncext.h" NTSTATUS FdoPortIoCtl( *************** *** 177,181 **** &queueToComplete); ! if (pIoPortLocal->pIoPortRemote->tryWrite) { ReadWrite( pIoPortLocal, FALSE, --- 182,186 ---- &queueToComplete); ! if (pIoPortLocal->pIoPortRemote->tryWrite || pIoPortLocal->tryWrite) { ReadWrite( pIoPortLocal, FALSE, *************** *** 184,194 **** } - if (pIoPortLocal->tryWrite) { - ReadWrite( - pIoPortLocal->pIoPortRemote, FALSE, - pIoPortLocal, FALSE, - &queueToComplete); - } - KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); FdoPortCompleteQueue(&queueToComplete); --- 189,192 ---- *************** *** 215,219 **** &queueToComplete); ! if (pIoPortLocal->pIoPortRemote->tryWrite) { ReadWrite( pIoPortLocal, FALSE, --- 213,217 ---- &queueToComplete); ! if (pIoPortLocal->pIoPortRemote->tryWrite || pIoPortLocal->tryWrite) { ReadWrite( pIoPortLocal, FALSE, *************** *** 222,232 **** } - if (pIoPortLocal->tryWrite) { - ReadWrite( - pIoPortLocal->pIoPortRemote, FALSE, - pIoPortLocal, FALSE, - &queueToComplete); - } - KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); FdoPortCompleteQueue(&queueToComplete); --- 220,223 ---- *************** *** 251,255 **** &queueToComplete); ! if (pIoPortLocal->pIoPortRemote->tryWrite) { ReadWrite( pIoPortLocal, FALSE, --- 242,246 ---- &queueToComplete); ! if (pIoPortLocal->pIoPortRemote->tryWrite || pIoPortLocal->tryWrite) { ReadWrite( pIoPortLocal, FALSE, *************** *** 258,268 **** } - if (pIoPortLocal->tryWrite) { - ReadWrite( - pIoPortLocal->pIoPortRemote, FALSE, - pIoPortLocal, FALSE, - &queueToComplete); - } - KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); FdoPortCompleteQueue(&queueToComplete); --- 249,252 ---- *************** *** 522,529 **** break; case IOCTL_SERIAL_SET_TIMEOUTS: ! status = FdoPortSetTimeouts(pDevExt, pIrp, pIrpStack); break; case IOCTL_SERIAL_GET_TIMEOUTS: ! status = FdoPortGetTimeouts(pDevExt, pIrp, pIrpStack); TraceIrp("FdoPortIoCtl", pIrp, &status, TRACE_FLAG_RESULTS); break; --- 506,513 ---- break; case IOCTL_SERIAL_SET_TIMEOUTS: ! status = FdoPortSetTimeouts(pIoPortLocal, pIrp, pIrpStack); break; case IOCTL_SERIAL_GET_TIMEOUTS: ! status = FdoPortGetTimeouts(pIoPortLocal, pIrp, pIrpStack); TraceIrp("FdoPortIoCtl", pIrp, &status, TRACE_FLAG_RESULTS); break; *************** *** 568,579 **** break; case IOCTL_SERIAL_LSRMST_INSERT: { UCHAR escapeChar; ! if (pIrpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(UCHAR)) { status = STATUS_BUFFER_TOO_SMALL; break; } ! escapeChar = *(PUCHAR)pIrp->AssociatedIrp.SystemBuffer; KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); --- 552,630 ---- break; case IOCTL_SERIAL_LSRMST_INSERT: { + ULONG Information; + ULONG optsAndBits; UCHAR escapeChar; + PUCHAR pSysBuf; + ULONG InputBufferLength; + BOOLEAN extended; ! InputBufferLength = pIrpStack->Parameters.DeviceIoControl.InputBufferLength; ! ! if (InputBufferLength < sizeof(UCHAR)) { status = STATUS_BUFFER_TOO_SMALL; break; } ! Information = 0; ! pSysBuf = (PUCHAR)pIrp->AssociatedIrp.SystemBuffer; ! escapeChar = *pSysBuf; ! ! if (InputBufferLength >= (sizeof(UCHAR) + C0CE_SIGNATURE_SIZE + sizeof(ULONG)) && ! RtlEqualMemory(pSysBuf + 1, C0CE_SIGNATURE, C0CE_SIGNATURE_SIZE)) ! { ! extended = TRUE; ! optsAndBits = *(ULONG *)(pSysBuf + 1 + C0CE_SIGNATURE_SIZE); ! ! #define C0CE_INSERT_OPTS ( \ ! C0CE_INSERT_IOCTL_GET| \ ! C0CE_INSERT_IOCTL_RXCLEAR) ! ! #define C0CE_INSERT_BITS ( \ ! C0CE_INSERT_ENABLE_LSR| \ ! C0CE_INSERT_ENABLE_MST| \ ! C0CE_INSERT_ENABLE_RBR| \ ! C0CE_INSERT_ENABLE_RLC) ! ! #define C0CE_INSERT_CAPS (C0CE_INSERT_OPTS|C0CE_INSERT_BITS) ! ! if (optsAndBits == C0CE_INSERT_IOCTL_CAPS) { ! optsAndBits = (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_MST); ! optsAndBits = 0; ! ! Information += C0CE_SIGNATURE_SIZE + sizeof(ULONG); ! ! if (pIrpStack->Parameters.DeviceIoControl.OutputBufferLength < Information) { ! status = STATUS_BUFFER_TOO_SMALL; ! break; ! } ! ! RtlCopyMemory(pSysBuf, C0CE_SIGNATURE, C0CE_SIGNATURE_SIZE); ! *(ULONG *)(pSysBuf + C0CE_SIGNATURE_SIZE) = C0CE_INSERT_CAPS; ! } else { ! if (optsAndBits & ~C0CE_INSERT_CAPS) { ! status = STATUS_INVALID_PARAMETER; ! break; ! } ! ! if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & C0CE_INSERT_ENABLE_LSR) ! Information += sizeof(UCHAR)*2 + sizeof(UCHAR); ! if (optsAndBits & C0CE_INSERT_ENABLE_MST) ! Information += sizeof(UCHAR)*2 + sizeof(UCHAR); ! if (optsAndBits & C0CE_INSERT_ENABLE_RBR) ! Information += sizeof(UCHAR)*2 + sizeof(ULONG); ! if (optsAndBits & C0CE_INSERT_ENABLE_RLC) ! Information += sizeof(UCHAR)*2 + sizeof(UCHAR)*3; ! } ! ! if (pIrpStack->Parameters.DeviceIoControl.OutputBufferLength < Information) { ! status = STATUS_BUFFER_TOO_SMALL; ! break; ! } ! } ! } else { ! extended = FALSE; ! optsAndBits = (C0CE_INSERT_ENABLE_LSR|C0CE_INSERT_ENABLE_MST); ! } KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); *************** *** 584,596 **** { status = STATUS_INVALID_PARAMETER; } ! if (status == STATUS_SUCCESS) ! pIoPortLocal->escapeChar = escapeChar; KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); break; } ! case IOCTL_SERIAL_SET_LINE_CONTROL: if (pIrpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(SERIAL_LINE_CONTROL)) { status = STATUS_BUFFER_TOO_SMALL; --- 635,710 ---- { status = STATUS_INVALID_PARAMETER; + KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); + break; } ! pIoPortLocal->insertMask = optsAndBits & C0CE_INSERT_BITS; ! pIoPortLocal->escapeChar = escapeChar; ! ! if (extended) { ! LIST_ENTRY queueToComplete; ! ! InitializeListHead(&queueToComplete); ! ! if (optsAndBits & C0CE_INSERT_IOCTL_GET) { ! if (optsAndBits & C0CE_INSERT_ENABLE_LSR) { ! UCHAR lsr = 0x10; /* break interrupt indicator */ ! ! if (!pIoPortLocal->amountInWriteQueue || pIoPortLocal->writeHolding) ! lsr |= 0x60; /* transmit holding register empty and transmitter empty indicators */ ! ! *pSysBuf++ = escapeChar; ! *pSysBuf++ = SERIAL_LSRMST_LSR_NODATA; ! *pSysBuf++ = lsr; ! } ! ! if (optsAndBits & C0CE_INSERT_ENABLE_MST) { ! *pSysBuf++ = escapeChar; ! *pSysBuf++ = SERIAL_LSRMST_MST; ! *pSysBuf++ = pIoPortLocal->modemStatus; ! } ! ! if (optsAndBits & C0CE_INSERT_ENABLE_RBR) { ! *pSysBuf++ = escapeChar; ! *pSysBuf++ = C0CE_INSERT_RBR; ! *(ULONG *)pSysBuf = pIoPortLocal->pIoPortRemote->baudRate.BaudRate; ! pSysBuf += sizeof(ULONG); ! } ! ! if (optsAndBits & C0CE_INSERT_ENABLE_RLC) { ! *pSysBuf++ = escapeChar; ! *pSysBuf++ = C0CE_INSERT_RLC; ! *pSysBuf++ = pIoPortLocal->pIoPortRemote->lineControl.WordLength; ! *pSysBuf++ = pIoPortLocal->pIoPortRemote->lineControl.Parity; ! *pSysBuf++ = pIoPortLocal->pIoPortRemote->lineControl.StopBits; ! } ! } ! ! pIrp->IoStatus.Information = Information; ! ! if (optsAndBits & C0CE_INSERT_IOCTL_RXCLEAR) { ! PurgeBuffer(&pIoPortLocal->readBuf); ! UpdateHandFlow(pIoPortLocal, TRUE, &queueToComplete); ! if (pIoPortLocal->tryWrite || pIoPortLocal->pIoPortRemote->tryWrite) { ! ReadWrite( ! pIoPortLocal, FALSE, ! pIoPortLocal->pIoPortRemote, FALSE, ! &queueToComplete); ! } ! } ! ! KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); ! FdoPortCompleteQueue(&queueToComplete); ! ! TraceIrp("FdoPortIoCtl", pIrp, &status, TRACE_FLAG_RESULTS); ! break; ! } KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); break; } ! case IOCTL_SERIAL_SET_LINE_CONTROL: { ! PSERIAL_LINE_CONTROL pLineControl; ! if (pIrpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(SERIAL_LINE_CONTROL)) { status = STATUS_BUFFER_TOO_SMALL; *************** *** 598,607 **** } ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); ! pDevExt->lineControl = *(PSERIAL_LINE_CONTROL)pIrp->AssociatedIrp.SystemBuffer; ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); ! SetWriteDelay(pDevExt); break; case IOCTL_SERIAL_GET_LINE_CONTROL: if (pIrpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(SERIAL_LINE_CONTROL)) { --- 712,751 ---- } ! pLineControl = (PSERIAL_LINE_CONTROL)pIrp->AssociatedIrp.SystemBuffer; ! KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! if (pIoPortLocal->lineControl.StopBits != pLineControl->StopBits || ! pIoPortLocal->lineControl.Parity != pLineControl->Parity || ! pIoPortLocal->lineControl.WordLength != pLineControl->WordLength) ! { ! PC0C_IO_PORT pIoPortRemote; ! ! pIoPortLocal->lineControl = *pLineControl; ! SetWriteDelay(pIoPortLocal); ! ! pIoPortRemote = pIoPortLocal->pIoPortRemote; ! ! if (pIoPortRemote->escapeChar && (pIoPortRemote->insertMask & C0CE_INSERT_ENABLE_RLC)) { ! LIST_ENTRY queueToComplete; ! ! InitializeListHead(&queueToComplete); ! ! InsertRemoteLc(pIoPortRemote, &queueToComplete); ! ! if (pIoPortLocal->pIoPortRemote->tryWrite || pIoPortLocal->tryWrite) { ! ReadWrite( ! pIoPortLocal, FALSE, ! pIoPortLocal->pIoPortRemote, FALSE, ! &queueToComplete); ! } ! ! KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); ! FdoPortCompleteQueue(&queueToComplete); ! break; ! } ! } ! KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); break; + } case IOCTL_SERIAL_GET_LINE_CONTROL: if (pIrpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(SERIAL_LINE_CONTROL)) { *************** *** 610,621 **** } ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); ! *(PSERIAL_LINE_CONTROL)pIrp->AssociatedIrp.SystemBuffer = pDevExt->lineControl; ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); pIrp->IoStatus.Information = sizeof(SERIAL_LINE_CONTROL); TraceIrp("FdoPortIoCtl", pIrp, &status, TRACE_FLAG_RESULTS); break; ! case IOCTL_SERIAL_SET_BAUD_RATE: if (pIrpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(SERIAL_BAUD_RATE)) { status = STATUS_BUFFER_TOO_SMALL; --- 754,767 ---- } ! KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! *(PSERIAL_LINE_CONTROL)pIrp->AssociatedIrp.SystemBuffer = pIoPortLocal->lineControl; ! KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); pIrp->IoStatus.Information = sizeof(SERIAL_LINE_CONTROL); TraceIrp("FdoPortIoCtl", pIrp, &status, TRACE_FLAG_RESULTS); break; ! case IOCTL_SERIAL_SET_BAUD_RATE: { ! PSERIAL_BAUD_RATE pBaudRate; ! if (pIrpStack->Parameters.DeviceIoControl.InputBufferLength < sizeof(SERIAL_BAUD_RATE)) { status = STATUS_BUFFER_TOO_SMALL; *************** *** 623,632 **** } ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); ! pDevExt->baudRate = *(PSERIAL_BAUD_RATE)pIrp->AssociatedIrp.SystemBuffer; ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); ! SetWriteDelay(pDevExt); break; case IOCTL_SERIAL_GET_BAUD_RATE: if (pIrpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(SERIAL_BAUD_RATE)) { --- 769,805 ---- } ! pBaudRate = (PSERIAL_BAUD_RATE)pIrp->AssociatedIrp.SystemBuffer; ! KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! if (pIoPortLocal->baudRate.BaudRate != pBaudRate->BaudRate) { ! PC0C_IO_PORT pIoPortRemote; ! ! pIoPortLocal->baudRate = *pBaudRate; ! SetWriteDelay(pIoPortLocal); ! ! pIoPortRemote = pIoPortLocal->pIoPortRemote; ! ! if (pIoPortRemote->escapeChar && (pIoPortRemote->insertMask & C0CE_INSERT_ENABLE_RBR)) { ! LIST_ENTRY queueToComplete; ! ! InitializeListHead(&queueToComplete); ! ! InsertRemoteBr(pIoPortRemote, &queueToComplete); ! ! if (pIoPortLocal->pIoPortRemote->tryWrite || pIoPortLocal->tryWrite) { ! ReadWrite( ! pIoPortLocal, FALSE, ! pIoPortLocal->pIoPortRemote, FALSE, ! &queueToComplete); ! } ! ! KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); ! FdoPortCompleteQueue(&queueToComplete); ! break; ! } ! } ! KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); break; + } case IOCTL_SERIAL_GET_BAUD_RATE: if (pIrpStack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(SERIAL_BAUD_RATE)) { *************** *** 635,641 **** } ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); ! *(PSERIAL_BAUD_RATE)pIrp->AssociatedIrp.SystemBuffer = pDevExt->baudRate; ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); pIrp->IoStatus.Information = sizeof(SERIAL_BAUD_RATE); --- 808,814 ---- } ! KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); ! *(PSERIAL_BAUD_RATE)pIrp->AssociatedIrp.SystemBuffer = pIoPortLocal->baudRate; ! KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); pIrp->IoStatus.Information = sizeof(SERIAL_BAUD_RATE); *************** *** 719,725 **** } ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); *(PSERIALPERF_STATS)pIrp->AssociatedIrp.SystemBuffer = pIoPortLocal->perfStats; ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); pIrp->IoStatus.Information = sizeof(SERIALPERF_STATS); --- 892,898 ---- } ! KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); *(PSERIALPERF_STATS)pIrp->AssociatedIrp.SystemBuffer = pIoPortLocal->perfStats; ! KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); pIrp->IoStatus.Information = sizeof(SERIALPERF_STATS); *************** *** 727,733 **** break; case IOCTL_SERIAL_CLEAR_STATS: ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); RtlZeroMemory(&pIoPortLocal->perfStats, sizeof(pIoPortLocal->perfStats)); ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); break; default: --- 900,906 ---- break; case IOCTL_SERIAL_CLEAR_STATS: ! KeAcquireSpinLock(pIoPortLocal->pIoLock, &oldIrql); RtlZeroMemory(&pIoPortLocal->perfStats, sizeof(pIoPortLocal->perfStats)); ! KeReleaseSpinLock(pIoPortLocal->pIoLock, oldIrql); break; default: Index: trace.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/trace.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** trace.c 20 Jun 2007 10:32:44 -0000 1.28 --- trace.c 14 Mar 2008 15:28:39 -0000 1.29 *************** *** 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-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.29 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.28 2007/06/20 10:32:44 vfrolov * Added PID tracing on IRP_MJ_CREATE *************** *** 1509,1514 **** break; case IOCTL_SERIAL_LSRMST_INSERT: ! if ((flags & TRACE_FLAG_PARAMS) && inLength >= sizeof(UCHAR)) ! pDestStr = AnsiStrFormat(pDestStr, &size, " escapeChar=0x%02X", (int)(*(PUCHAR)pSysBuf & 0xFF)); break; case IOCTL_SERIAL_GET_STATS: --- 1513,1524 ---- break; case IOCTL_SERIAL_LSRMST_INSERT: ! if (flags & TRACE_FLAG_PARAMS) { ! pDestStr = AnsiStrCopyStr(pDestStr, &size, " "); ! pDestStr = AnsiStrCopyDump(pDestStr, &size, pSysBuf, inLength); ! } ! if (flags & TRACE_FLAG_RESULTS) { ! pDestStr = AnsiStrCopyStr(pDestStr, &size, " "); ! pDestStr = AnsiStrCopyDump(pDestStr, &size, pSysBuf, inform); ! } break; case IOCTL_SERIAL_GET_STATS: Index: com0com.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/com0com.h,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** com0com.h 23 Nov 2007 08:30:50 -0000 1.39 --- com0com.h 14 Mar 2008 15:28:39 -0000 1.40 *************** *** 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-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.40 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.39 2007/11/23 08:30:50 vfrolov * Increased size of TX buffer to typical default for Windows *************** *** 194,198 **** typedef struct _C0C_RAW_DATA { UCHAR size; ! UCHAR data[7]; } C0C_RAW_DATA, *PC0C_RAW_DATA; --- 198,202 ---- typedef struct _C0C_RAW_DATA { UCHAR size; ! UCHAR data[3 + sizeof(ULONG)]; } C0C_RAW_DATA, *PC0C_RAW_DATA; *************** *** 273,276 **** --- 277,284 ---- KDPC timerCloseDpc; + SERIAL_BAUD_RATE baudRate; + SERIAL_LINE_CONTROL lineControl; + SERIAL_TIMEOUTS timeouts; + struct _C0C_ADAPTIVE_DELAY *pWriteDelay; *************** *** 290,293 **** --- 298,302 ---- ULONG waitMask; ULONG eventMask; + ULONG insertMask; UCHAR escapeChar; SERIALPERF_STATS perfStats; *************** *** 348,357 **** LONG openCount; - KSPIN_LOCK controlLock; - - SERIAL_BAUD_RATE baudRate; - SERIAL_LINE_CONTROL lineControl; - SERIAL_TIMEOUTS timeouts; - } C0C_FDOPORT_EXTENSION, *PC0C_FDOPORT_EXTENSION; --- 357,360 ---- *************** *** 498,501 **** --- 501,512 ---- IN ULONG pinRI); + VOID InsertRemoteBr( + PC0C_IO_PORT pIoPortRead, + PLIST_ENTRY pQueueToComplete); + + VOID InsertRemoteLc( + PC0C_IO_PORT pIoPortRead, + PLIST_ENTRY pQueueToComplete); + #define C0C_TAG 'c0c' #define C0C_ALLOCATE_POOL(PoolType, NumberOfBytes) \ Index: io.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/io.c,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** io.c 12 Sep 2007 12:32:53 -0000 1.36 --- io.c 14 Mar 2008 15:28:39 -0000 1.37 *************** *** 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-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.37 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.36 2007/09/12 12:32:53 vfrolov * Fixed TX buffer *************** *** 141,144 **** --- 145,149 ---- #include "bufutils.h" #include "handflow.h" + #include "../include/cncext.h" /* *************** *** 846,849 **** --- 851,902 ---- } + VOID InsertRemoteBr( + PC0C_IO_PORT pIoPortRead, + PLIST_ENTRY pQueueToComplete) + { + C0C_RAW_DATA insertData; + + insertData.size = 2 + sizeof(ULONG); + insertData.data[0] = pIoPortRead->escapeChar; + insertData.data[1] = C0CE_INSERT_RBR; + *(ULONG *)&insertData.data[2] = pIoPortRead->pIoPortRemote->baudRate.BaudRate; + + if (FdoPortIo( + C0C_IO_TYPE_INSERT, + &insertData, + pIoPortRead, + &pIoPortRead->irpQueues[C0C_QUEUE_READ], + pQueueToComplete) == STATUS_PENDING) + { + AlertOverrun(pIoPortRead, pQueueToComplete); + Trace0((PC0C_COMMON_EXTENSION)pIoPortRead->pDevExt, L"WARNING: Lost C0CE_INSERT_RBR"); + } + } + + VOID InsertRemoteLc( + PC0C_IO_PORT pIoPortRead, + PLIST_ENTRY pQueueToComplete) + { + C0C_RAW_DATA insertData; + + insertData.size = 5; + insertData.data[0] = pIoPortRead->escapeChar; + insertData.data[1] = C0CE_INSERT_RLC; + insertData.data[2] = pIoPortRead->pIoPortRemote->lineControl.WordLength; + insertData.data[3] = pIoPortRead->pIoPortRemote->lineControl.Parity; + insertData.data[4] = pIoPortRead->pIoPortRemote->lineControl.StopBits; + + if (FdoPortIo( + C0C_IO_TYPE_INSERT, + &insertData, + pIoPortRead, + &pIoPortRead->irpQueues[C0C_QUEUE_READ], + pQueueToComplete) == STATUS_PENDING) + { + AlertOverrun(pIoPortRead, pQueueToComplete); + Trace0((PC0C_COMMON_EXTENSION)pIoPortRead->pDevExt, L"WARNING: Lost C0CE_INSERT_RLC"); + } + } + NTSTATUS TryReadWrite( PC0C_IO_PORT pIoPortRead, *************** *** 1203,1207 **** WaitComplete(pIoPortRead, pQueueToComplete); ! if (pIoPortRead->escapeChar) { UCHAR lsr = 0x10; /* break interrupt indicator */ --- 1256,1260 ---- WaitComplete(pIoPortRead, pQueueToComplete); ! if (pIoPortRead->escapeChar && (pIoPortRead->insertMask & C0CE_INSERT_ENABLE_LSR)) { UCHAR lsr = 0x10; /* break interrupt indicator */ *************** *** 1376,1380 **** SetModemStatusHolding(pIoPort); ! if (pIoPort->escapeChar) InsertLsrMst(pIoPort, TRUE, (UCHAR)(pIoPort->modemStatus | (modemStatusChanged >> 4)), pQueueToComplete); --- 1429,1433 ---- SetModemStatusHolding(pIoPort); ! if (pIoPort->escapeChar && (pIoPort->insertMask & C0CE_INSERT_ENABLE_MST)) InsertLsrMst(pIoPort, TRUE, (UCHAR)(pIoPort->modemStatus | (modemStatusChanged >> 4)), pQueueToComplete); Index: adddev.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/adddev.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** adddev.c 19 Oct 2007 16:03:41 -0000 1.31 --- adddev.c 14 Mar 2008 15:28:39 -0000 1.32 *************** *** 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-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.32 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.31 2007/10/19 16:03:41 vfrolov * Added default values *************** *** 389,394 **** AllocTimeouts(pDevExt->pIoPortLocal); - KeInitializeSpinLock(&pDevExt->controlLock); - RtlZeroMemory(&pDevExt->pIoPortLocal->specialChars, sizeof(pDevExt->pIoPortLocal->specialChars)); pDevExt->pIoPortLocal->specialChars.XonChar = 0x11; --- 393,396 ---- *************** *** 399,408 **** pDevExt->pIoPortLocal->handFlow.FlowReplace = SERIAL_RTS_CONTROL; ! pDevExt->lineControl.WordLength = 7; ! pDevExt->lineControl.Parity = EVEN_PARITY; ! pDevExt->lineControl.StopBits = STOP_BIT_1; ! pDevExt->baudRate.BaudRate = 1200; ! SetWriteDelay(pDevExt); SetTxBuffer(&pDevExt->pIoPortLocal->txBuf, 1, TRUE); --- 401,410 ---- pDevExt->pIoPortLocal->handFlow.FlowReplace = SERIAL_RTS_CONTROL; ! pDevExt->pIoPortLocal->lineControl.WordLength = 7; ! pDevExt->pIoPortLocal->lineControl.Parity = EVEN_PARITY; ! pDevExt->pIoPortLocal->lineControl.StopBits = STOP_BIT_1; ! pDevExt->pIoPortLocal->baudRate.BaudRate = 1200; ! SetWriteDelay(pDevExt->pIoPortLocal); SetTxBuffer(&pDevExt->pIoPortLocal->txBuf, 1, TRUE); Index: wmi.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/wmi.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** wmi.c 1 Jun 2007 16:22:40 -0000 1.4 --- wmi.c 14 Mar 2008 15:28:39 -0000 1.5 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.5 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.4 2007/06/01 16:22:40 vfrolov * Implemented plug-in and exclusive modes *************** *** 116,119 **** --- 120,124 ---- KIRQL oldIrql; PC0C_FDOPORT_EXTENSION pDevExt = (PC0C_FDOPORT_EXTENSION)pDevObj->DeviceExtension; + PC0C_IO_PORT pIoPort = pDevExt->pIoPortLocal; UNREFERENCED_PARAMETER(instanceIndex); *************** *** 148,159 **** } ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); ! ((PSERIAL_WMI_COMM_DATA)pBuf)->BaudRate = pDevExt->baudRate.BaudRate; ! ((PSERIAL_WMI_COMM_DATA)pBuf)->BitsPerByte = pDevExt->lineControl.WordLength; ((PSERIAL_WMI_COMM_DATA)pBuf)->ParityCheckEnable = TRUE; ! switch (pDevExt->lineControl.Parity) { default: case NO_PARITY: --- 153,164 ---- } ! KeAcquireSpinLock(pIoPort->pIoLock, &oldIrql); ! ((PSERIAL_WMI_COMM_DATA)pBuf)->BaudRate = pIoPort->baudRate.BaudRate; ! ((PSERIAL_WMI_COMM_DATA)pBuf)->BitsPerByte = pIoPort->lineControl.WordLength; ((PSERIAL_WMI_COMM_DATA)pBuf)->ParityCheckEnable = TRUE; ! switch (pIoPort->lineControl.Parity) { default: case NO_PARITY: *************** *** 175,179 **** } ! switch (pDevExt->lineControl.StopBits) { default: case STOP_BIT_1: --- 180,184 ---- } ! switch (pIoPort->lineControl.StopBits) { default: case STOP_BIT_1: *************** *** 188,201 **** } ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); ! ! KeAcquireSpinLock(pDevExt->pIoPortLocal->pIoLock, &oldIrql); ! ! ((PSERIAL_WMI_COMM_DATA)pBuf)->XoffCharacter = pDevExt->pIoPortLocal->specialChars.XoffChar; ! ((PSERIAL_WMI_COMM_DATA)pBuf)->XoffXmitThreshold = pDevExt->pIoPortLocal->handFlow.XoffLimit; ! ((PSERIAL_WMI_COMM_DATA)pBuf)->XonCharacter = pDevExt->pIoPortLocal->specialChars.XonChar; ! ((PSERIAL_WMI_COMM_DATA)pBuf)->XonXmitThreshold = pDevExt->pIoPortLocal->handFlow.XonLimit; ! KeReleaseSpinLock(pDevExt->pIoPortLocal->pIoLock, oldIrql); ((PSERIAL_WMI_COMM_DATA)pBuf)->MaximumBaudRate = 128L * 1024L; --- 193,202 ---- } ! ((PSERIAL_WMI_COMM_DATA)pBuf)->XoffCharacter = pIoPort->specialChars.XoffChar; ! ((PSERIAL_WMI_COMM_DATA)pBuf)->XoffXmitThreshold = pIoPort->handFlow.XoffLimit; ! ((PSERIAL_WMI_COMM_DATA)pBuf)->XonCharacter = pIoPort->specialChars.XonChar; ! ((PSERIAL_WMI_COMM_DATA)pBuf)->XonXmitThreshold = pIoPort->handFlow.XonLimit; ! KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); ((PSERIAL_WMI_COMM_DATA)pBuf)->MaximumBaudRate = 128L * 1024L; *************** *** 250,263 **** } ! KeAcquireSpinLock(pDevExt->pIoPortLocal->pIoLock, &oldIrql); ! ((PSERIAL_WMI_PERF_DATA)pBuf)->ReceivedCount = pDevExt->pIoPortLocal->perfStats.ReceivedCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->TransmittedCount = pDevExt->pIoPortLocal->perfStats.TransmittedCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->FrameErrorCount = pDevExt->pIoPortLocal->perfStats.FrameErrorCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->SerialOverrunErrorCount = pDevExt->pIoPortLocal->perfStats.SerialOverrunErrorCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->BufferOverrunErrorCount = pDevExt->pIoPortLocal->perfStats.BufferOverrunErrorCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->ParityErrorCount = pDevExt->pIoPortLocal->perfStats.ParityErrorCount; ! KeReleaseSpinLock(pDevExt->pIoPortLocal->pIoLock, oldIrql); status = STATUS_SUCCESS; --- 251,264 ---- } ! KeAcquireSpinLock(pIoPort->pIoLock, &oldIrql); ! ((PSERIAL_WMI_PERF_DATA)pBuf)->ReceivedCount = pIoPort->perfStats.ReceivedCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->TransmittedCount = pIoPort->perfStats.TransmittedCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->FrameErrorCount = pIoPort->perfStats.FrameErrorCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->SerialOverrunErrorCount = pIoPort->perfStats.SerialOverrunErrorCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->BufferOverrunErrorCount = pIoPort->perfStats.BufferOverrunErrorCount; ! ((PSERIAL_WMI_PERF_DATA)pBuf)->ParityErrorCount = pIoPort->perfStats.ParityErrorCount; ! KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); status = STATUS_SUCCESS; Index: timeout.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/timeout.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** timeout.h 4 Jun 2007 15:24:33 -0000 1.6 --- timeout.h 14 Mar 2008 15:28:39 -0000 1.7 *************** *** 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-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.7 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.6 2007/06/04 15:24:33 vfrolov * Fixed open reject just after close in exclusiveMode *************** *** 61,72 **** NTSTATUS FdoPortSetTimeouts( ! IN PC0C_FDOPORT_EXTENSION pDevExt, ! IN PIRP pIrp, ! IN PIO_STACK_LOCATION pIrpStack); NTSTATUS FdoPortGetTimeouts( ! IN PC0C_FDOPORT_EXTENSION pDevExt, ! IN PIRP pIrp, ! IN PIO_STACK_LOCATION pIrpStack); #endif /* _C0C_TIMEOUT_H_ */ --- 65,76 ---- NTSTATUS FdoPortSetTimeouts( ! PC0C_IO_PORT pIoPort, ! PIRP pIrp, ! PIO_STACK_LOCATION pIrpStack); NTSTATUS FdoPortGetTimeouts( ! PC0C_IO_PORT pIoPort, ! PIRP pIrp, ! PIO_STACK_LOCATION pIrpStack); #endif /* _C0C_TIMEOUT_H_ */ Index: delay.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/delay.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** delay.c 20 Jul 2007 07:59:20 -0000 1.9 --- delay.c 14 Mar 2008 15:28:39 -0000 1.10 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.10 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.9 2007/07/20 07:59:20 vfrolov * Fixed idleCount *************** *** 158,184 **** } ! VOID SetWriteDelay(PC0C_FDOPORT_EXTENSION pDevExt) { PC0C_ADAPTIVE_DELAY pWriteDelay; - KIRQL oldIrql; C0C_DELAY_PARAMS params; - SERIAL_LINE_CONTROL lineControl; ! pWriteDelay = pDevExt->pIoPortLocal->pWriteDelay; if (!pWriteDelay) return; ! KeAcquireSpinLock(pDevExt->pIoPortLocal->pIoLock, &oldIrql); ! ! KeAcquireSpinLockAtDpcLevel(&pDevExt->controlLock); ! lineControl = pDevExt->lineControl; ! params.baudRate = pDevExt->baudRate.BaudRate; ! KeReleaseSpinLockFromDpcLevel(&pDevExt->controlLock); /* Startbit + WordLength */ ! params.decibits_per_frame = (1 + lineControl.WordLength) * 10; ! switch (lineControl.Parity) { case NO_PARITY: break; --- 162,181 ---- } ! VOID SetWriteDelay(PC0C_IO_PORT pIoPort) { PC0C_ADAPTIVE_DELAY pWriteDelay; C0C_DELAY_PARAMS params; ! pWriteDelay = pIoPort->pWriteDelay; if (!pWriteDelay) return; ! params.baudRate = pIoPort->baudRate.BaudRate; /* Startbit + WordLength */ ! params.decibits_per_frame = (1 + pIoPort->lineControl.WordLength) * 10; ! switch (pIoPort->lineControl.Parity) { case NO_PARITY: break; *************** *** 192,196 **** } ! switch (lineControl.StopBits) { default: case STOP_BIT_1: --- 189,193 ---- } ! switch (pIoPort->lineControl.StopBits) { default: case STOP_BIT_1: *************** *** 214,219 **** } } - - KeReleaseSpinLock(pDevExt->pIoPortLocal->pIoLock, oldIrql); } --- 211,214 ---- Index: delay.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/delay.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** delay.h 9 Jun 2007 08:49:47 -0000 1.5 --- delay.h 14 Mar 2008 15:28:39 -0000 1.6 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.6 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.5 2007/06/09 08:49:47 vfrolov * Improved baudrate emulation *************** *** 61,65 **** VOID FreeWriteDelay(PC0C_IO_PORT pIoPort); SIZE_T GetWriteLimit(PC0C_ADAPTIVE_DELAY pWriteDelay); ! VOID SetWriteDelay(PC0C_FDOPORT_EXTENSION pDevExt); VOID StartWriteDelayTimer(PC0C_ADAPTIVE_DELAY pWriteDelay); VOID StopWriteDelayTimer(PC0C_ADAPTIVE_DELAY pWriteDelay); --- 65,69 ---- VOID FreeWriteDelay(PC0C_IO_PORT pIoPort); SIZE_T GetWriteLimit(PC0C_ADAPTIVE_DELAY pWriteDelay); ! VOID SetWriteDelay(PC0C_IO_PORT pIoPort); VOID StartWriteDelayTimer(PC0C_ADAPTIVE_DELAY pWriteDelay); VOID StopWriteDelayTimer(PC0C_ADAPTIVE_DELAY pWriteDelay); Index: timeout.c =================================================================== RCS file: /cvsroot/com0com/com0com/sys/timeout.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** timeout.c 4 Jun 2007 15:24:33 -0000 1.9 --- timeout.c 14 Mar 2008 15:28:39 -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-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,27 ---- * * $Log$ + * Revision 1.10 2008/03/14 15:28:39 vfrolov + * Implemented ability to get paired port settings with + * extended IOCTL_SERIAL_LSRMST_INSERT + * * Revision 1.9 2007/06/04 15:24:33 vfrolov * Fixed open reject just after close in exclusiveMode *************** *** 107,111 **** ULONG constant; PC0C_IRP_STATE pState; - PC0C_FDOPORT_EXTENSION pDevExt; KeCancelTimer(&pIoPort->timerReadTotal); --- 111,114 ---- *************** *** 115,124 **** HALT_UNLESS(pState); ! pDevExt = pIoPort->pDevExt; ! HALT_UNLESS(pDevExt); ! ! KeAcquireSpinLockAtDpcLevel(&pDevExt->controlLock); ! timeouts = pDevExt->timeouts; ! KeReleaseSpinLockFromDpcLevel(&pDevExt->controlLock); if (timeouts.ReadIntervalTimeout == MAXULONG && --- 118,122 ---- HALT_UNLESS(pState); ! timeouts = pIoPort->timeouts; if (timeouts.ReadIntervalTimeout == MAXULONG && *************** *** 187,200 **** ULONG multiplier; ULONG constant; - PC0C_FDOPORT_EXTENSION pDevExt; KeCancelTimer(&pIoPort->timerWriteTotal); ! pDevExt = pIoPort->pDevExt; ! HALT_UNLESS(pDevExt); ! ! KeAcquireSpinLockAtDpcLevel(&pDevExt->controlLock); ! timeouts = pDevExt->timeouts; ! KeReleaseSpinLockFromDpcLevel(&pDevExt->controlLock); setTotal = FALSE; --- 185,192 ---- ULONG multiplier; ULONG constant; KeCancelTimer(&pIoPort->timerWriteTotal); ! timeouts = pIoPort->timeouts; setTotal = FALSE; *************** *** 370,376 **** NTSTATUS FdoPortSetTimeouts( ! IN PC0C_FDOPORT_EXTENSION pDevExt, ! IN PIRP pIrp, ! IN PIO_STACK_LOCATION pIrpStack) { KIRQL oldIrql; --- 362,368 ---- NTSTATUS FdoPortSetTimeouts( ! PC0C_IO_PORT pIoPort, ! PIRP pIrp, ! PIO_STACK_LOCATION pIrpStack) { KIRQL oldIrql; *************** *** 387,393 **** return STATUS_INVALID_PARAMETER; ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); ! pDevExt->timeouts = *pSysBuf; ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); return STATUS_SUCCESS; --- 379,385 ---- return STATUS_INVALID_PARAMETER; ! KeAcquireSpinLock(pIoPort->pIoLock, &oldIrql); ! pIoPort->timeouts = *pSysBuf; ! KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); return STATUS_SUCCESS; *************** *** 395,401 **** NTSTATUS FdoPortGetTimeouts( ! IN PC0C_FDOPORT_EXTENSION pDevExt, ! IN PIRP pIrp, ! IN PIO_STACK_LOCATION pIrpStack) { KIRQL oldIrql; --- 387,393 ---- NTSTATUS FdoPortGetTimeouts( ! PC0C_IO_PORT pIoPort, ! PIRP pIrp, ! PIO_STACK_LOCATION pIrpStack) { KIRQL oldIrql; *************** *** 407,413 **** pSysBuf = (PSERIAL_TIMEOUTS)pIrp->AssociatedIrp.SystemBuffer; ! KeAcquireSpinLock(&pDevExt->controlLock, &oldIrql); ! *pSysBuf = pDevExt->timeouts; ! KeReleaseSpinLock(&pDevExt->controlLock, oldIrql); pIrp->IoStatus.Information = sizeof(SERIAL_TIMEOUTS); --- 399,405 ---- pSysBuf = (PSERIAL_TIMEOUTS)pIrp->AssociatedIrp.SystemBuffer; ! KeAcquireSpinLock(pIoPort->pIoLock, &oldIrql); ! *pSysBuf = pIoPort->timeouts; ! KeReleaseSpinLock(pIoPort->pIoLock, oldIrql); pIrp->IoStatus.Information = sizeof(SERIAL_TIMEOUTS); |
From: Vyacheslav F. <vf...@us...> - 2008-03-14 15:28:44
|
Update of /cvsroot/com0com/com0com/include In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv15450/include Added Files: cncext.h Log Message: Implemented ability to get paired port settings with extended IOCTL_SERIAL_LSRMST_INSERT --- NEW FILE: cncext.h --- /* * $Id: cncext.h,v 1.1 2008/03/14 15:28:39 vfrolov Exp $ * * Copyright (c) 2008 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: cncext.h,v $ * Revision 1.1 2008/03/14 15:28:39 vfrolov * Implemented ability to get paired port settings with * extended IOCTL_SERIAL_LSRMST_INSERT * * */ #ifndef _INCLUDE_C0C_CNCEXT_H_ #define _INCLUDE_C0C_CNCEXT_H_ #define C0CE_SIGNATURE "c0c" #define C0CE_SIGNATURE_SIZE (sizeof(UCHAR)*4) /* Following this value is the baud rate (ULONG) of paired port */ #define C0CE_INSERT_RBR 16 /* Following this value is the byte size (UCHAR), parity (UCHAR) and stop bits (UCHAR) of paired port */ #define C0CE_INSERT_RLC 17 #define C0CE_INSERT_IOCTL_CAPS 0xFFFFFFFF /* IOCTL returns signature and all possible options */ #define C0CE_INSERT_IOCTL_GET 0x01000000 /* IOCTL returns current values */ #define C0CE_INSERT_IOCTL_RXCLEAR 0x02000000 /* IOCTL clears the driver's input buffer */ #define C0CE_INSERT_ENABLE_LSR 0x00000001 /* enable SERIAL_LSRMST_LSR_[NO]DATA insertion */ #define C0CE_INSERT_ENABLE_MST 0x00000002 /* enable SERIAL_LSRMST_MST insertion */ #define C0CE_INSERT_ENABLE_RBR 0x00000100 /* enable C0CE_INSERT_RBR insertion */ #define C0CE_INSERT_ENABLE_RLC 0x00000200 /* enable C0CE_INSERT_RLC insertion */ #endif /* _INCLUDE_C0C_CNCEXT_H_ */ |
From: Vyacheslav F. <vf...@us...> - 2008-03-14 15:19:53
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12034 Modified Files: version.h Log Message: Post-tagging version change Index: version.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/version.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** version.h 30 Nov 2007 09:56:50 -0000 1.12 --- version.h 14 Mar 2008 15:19:48 -0000 1.13 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 23,32 **** #define _C0C_VERSION_H_ ! #define C0C_COPYRIGHT_YEARS "2004-2007" #define C0C_V1 2 #define C0C_V2 0 #define C0C_V3 0 ! #define C0C_V4 0 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 --- 23,32 ---- #define _C0C_VERSION_H_ ! #define C0C_COPYRIGHT_YEARS "2004-2008" #define C0C_V1 2 #define C0C_V2 0 #define C0C_V3 0 ! #define C0C_V4 1 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 |
From: Vyacheslav F. <vf...@us...> - 2008-03-14 11:50:19
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29330 Modified Files: version.h Log Message: Pre-tagging version change Index: version.h =================================================================== RCS file: /cvsroot/com0com/hub4com/version.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** version.h 16 Apr 2007 07:29:22 -0000 1.2 --- version.h 14 Mar 2008 11:50:07 -0000 1.3 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 23,32 **** #define _H4C_VERSION_H_ ! #define H4C_COPYRIGHT_YEARS "2006-2007" #define H4C_V1 1 ! #define H4C_V2 0 #define H4C_V3 0 ! #define H4C_V4 1 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 --- 23,32 ---- #define _H4C_VERSION_H_ ! #define H4C_COPYRIGHT_YEARS "2006-2008" #define H4C_V1 1 ! #define H4C_V2 1 #define H4C_V3 0 ! #define H4C_V4 0 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 |
From: Vyacheslav F. <vf...@us...> - 2008-03-05 13:24:28
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8892 Modified Files: comport.cpp Log Message: Added restoring base 10 notation Index: comport.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/comport.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** comport.cpp 16 Apr 2007 07:33:38 -0000 1.4 --- comport.cpp 5 Mar 2008 13:24:19 -0000 1.5 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/03/05 13:24:19 vfrolov + * Added restoring base 10 notation + * * Revision 1.4 2007/04/16 07:33:38 vfrolov * Fixed LostReport() *************** *** 209,213 **** if (errors & CE_BREAK) { cout << " BREAK"; errors &= ~CE_BREAK; } if (errors & CE_TXFULL) { cout << " TXFULL"; errors &= ~CE_TXFULL; } ! if (errors) { cout << " 0x" << hex << errors; } #define IOCTL_SERIAL_GET_STATS CTL_CODE(FILE_DEVICE_SERIAL_PORT,35,METHOD_BUFFERED,FILE_ANY_ACCESS) --- 212,216 ---- if (errors & CE_BREAK) { cout << " BREAK"; errors &= ~CE_BREAK; } if (errors & CE_TXFULL) { cout << " TXFULL"; errors &= ~CE_TXFULL; } ! if (errors) { cout << " 0x" << hex << errors << dec; } #define IOCTL_SERIAL_GET_STATS CTL_CODE(FILE_DEVICE_SERIAL_PORT,35,METHOD_BUFFERED,FILE_ANY_ACCESS) |
From: Vyacheslav F. <vf...@us...> - 2008-02-22 12:56:52
|
Update of /cvsroot/com0com/com2tcp In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv12428 Modified Files: com2tcp.cpp utils.cxx utils.h Log Message: Implemented --connect-dtr option Index: com2tcp.cpp =================================================================== RCS file: /cvsroot/com0com/com2tcp/com2tcp.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** com2tcp.cpp 16 Nov 2006 12:51:43 -0000 1.10 --- com2tcp.cpp 22 Feb 2008 12:56:42 -0000 1.11 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2008/02/22 12:56:42 vfrolov + * Implemented --connect-dtr option + * * Revision 1.10 2006/11/16 12:51:43 vfrolov * Added ability to set COM port parameters *************** *** 563,567 **** dcb.fDsrSensitivity = !comParams.IgnoreDSR(); dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; ! dcb.fDtrControl = DTR_CONTROL_ENABLE; dcb.fOutX = FALSE; dcb.fInX = TRUE; --- 566,570 ---- dcb.fDsrSensitivity = !comParams.IgnoreDSR(); dcb.fRtsControl = RTS_CONTROL_HANDSHAKE; ! dcb.fDtrControl = comParams.ConnectDTR() ? DTR_CONTROL_DISABLE : DTR_CONTROL_ENABLE; dcb.fOutX = FALSE; dcb.fInX = TRUE; *************** *** 739,743 **** --- 742,753 ---- if (hC0C != INVALID_HANDLE_VALUE) { + if (comParams.ConnectDTR()) + EscapeCommFunction(hC0C, SETDTR); + InOut(hC0C, hSock, protocol, comParams.IgnoreDSR(), hSockListen); + + if (comParams.ConnectDTR()) + EscapeCommFunction(hC0C, CLRDTR); + CloseHandle(hC0C); } *************** *** 798,803 **** --- 808,819 ---- break; + if (comParams.ConnectDTR()) + EscapeCommFunction(hC0C, SETDTR); + InOut(hC0C, hSock, protocol, comParams.IgnoreDSR()); + if (comParams.ConnectDTR()) + EscapeCommFunction(hC0C, CLRDTR); + Disconnect(hSock); } *************** *** 842,845 **** --- 858,863 ---- fprintf(stderr, " DSR is OFF and do not ignore any bytes received\n"); fprintf(stderr, " while DSR is OFF).\n"); + fprintf(stderr, " --connect-dtr - set DTR to ON/OFF on opening/closing connection to\n"); + fprintf(stderr, " host.\n"); fprintf(stderr, "\n"); fprintf(stderr, " The value d[efault] above means to use current COM port settings.\n"); *************** *** 882,885 **** --- 900,908 ---- comParams.SetIgnoreDSR(TRUE); } else + if (!strcmp(*pArgs, "--connect-dtr")) { + pArgs++; + argc--; + comParams.SetConnectDTR(TRUE); + } else if (argc < 3) { Usage(argv[0]); Index: utils.cxx =================================================================== RCS file: /cvsroot/com0com/com2tcp/utils.cxx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** utils.cxx 16 Nov 2006 12:51:43 -0000 1.4 --- utils.cxx 22 Feb 2008 12:56:42 -0000 1.5 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2006 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2008/02/22 12:56:42 vfrolov + * Implemented --connect-dtr option + * * Revision 1.4 2006/11/16 12:51:43 vfrolov * Added ability to set COM port parameters *************** *** 188,192 **** parity(NOPARITY), stopBits(ONESTOPBIT), ! ignoreDSR(FALSE) { } --- 191,196 ---- parity(NOPARITY), stopBits(ONESTOPBIT), ! ignoreDSR(FALSE), ! connectDTR(FALSE) { } Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com2tcp/utils.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** utils.h 8 Feb 2008 16:40:56 -0000 1.7 --- utils.h 22 Feb 2008 12:56:42 -0000 1.8 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.8 2008/02/22 12:56:42 vfrolov + * Implemented --connect-dtr option + * * Revision 1.7 2008/02/08 16:40:56 vfrolov * Protected SendRaw() and WriteRaw() Protocol's methods *************** *** 143,146 **** --- 146,150 ---- BOOL SetStopBits(const char *pStopBits); void SetIgnoreDSR(BOOL val) { ignoreDSR = val; } + void SetConnectDTR(BOOL val) { connectDTR = val; } static const char *ParityStr(int parity); *************** *** 157,160 **** --- 161,165 ---- int StopBits() const { return stopBits; } BOOL IgnoreDSR() const { return ignoreDSR; } + BOOL ConnectDTR() const { return connectDTR; } private: *************** *** 164,167 **** --- 169,173 ---- int stopBits; BOOL ignoreDSR; + BOOL connectDTR; }; /////////////////////////////////////////////////////////////// |
From: Vyacheslav F. <vf...@us...> - 2008-02-08 16:41:02
|
Update of /cvsroot/com0com/com2tcp In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv29863 Modified Files: utils.h Log Message: Protected SendRaw() and WriteRaw() Protocol's methods Index: utils.h =================================================================== RCS file: /cvsroot/com0com/com2tcp/utils.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** utils.h 20 Jul 2007 09:23:48 -0000 1.6 --- utils.h 8 Feb 2008 16:40:56 -0000 1.7 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2005-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2005-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/02/08 16:40:56 vfrolov + * Protected SendRaw() and WriteRaw() Protocol's methods + * * Revision 1.6 2007/07/20 09:23:48 vfrolov * Added virtual ~Protocol() *************** *** 110,114 **** virtual int Send(const void *pBuf, int count); - int SendRaw(const void *pBuf, int count) { return streamSendRead.PutData(pBuf, count); } void SendEof() { streamSendRead.PutEof(); } BOOL isSendFull() const { return streamSendRead.isFull(); } --- 113,116 ---- *************** *** 116,125 **** virtual int Write(const void *pBuf, int count); - int WriteRaw(const void *pBuf, int count) { return streamWriteRecv.PutData(pBuf, count); } void WriteEof() { streamWriteRecv.PutEof(); } BOOL isWriteFull() const { return streamWriteRecv.isFull(); } int Recv(void *pBuf, int count) { return streamWriteRecv.GetData(pBuf, count); } virtual void Clean(); private: DataStream streamSendRead; --- 118,131 ---- virtual int Write(const void *pBuf, int count); void WriteEof() { streamWriteRecv.PutEof(); } BOOL isWriteFull() const { return streamWriteRecv.isFull(); } int Recv(void *pBuf, int count) { return streamWriteRecv.GetData(pBuf, count); } + virtual void Clean(); + protected: + int SendRaw(const void *pBuf, int count) { return streamSendRead.PutData(pBuf, count); } + int WriteRaw(const void *pBuf, int count) { return streamWriteRecv.PutData(pBuf, count); } + private: DataStream streamSendRead; |
From: Vyacheslav F. <vf...@us...> - 2008-02-04 10:09:05
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv22226 Modified Files: hub4com.cpp Log Message: Fixed <LstR>:<LstL> parsing bug Index: hub4com.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** hub4com.cpp 19 Dec 2007 13:46:36 -0000 1.6 --- hub4com.cpp 4 Feb 2008 10:08:49 -0000 1.7 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2006-2007 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2006-2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.7 2008/02/04 10:08:49 vfrolov + * Fixed <LstR>:<LstL> parsing bug + * * Revision 1.6 2007/12/19 13:46:36 vfrolov * Added ability to send data received from port to the same port *************** *** 148,154 **** { char *pTmpListFrom = _strdup(pListFrom); - char *pTmpListTo = _strdup(pListTo); ! if (!pTmpListFrom || !pTmpListTo) { cerr << "No enough memory." << endl; exit(2); --- 151,156 ---- { char *pTmpListFrom = _strdup(pListFrom); ! if (!pTmpListFrom) { cerr << "No enough memory." << endl; exit(2); *************** *** 168,171 **** --- 170,180 ---- } + char *pTmpListTo = _strdup(pListTo); + + if (!pTmpListTo) { + cerr << "No enough memory." << endl; + exit(2); + } + char *pSave2; *************** *** 182,188 **** hub.RouteData(iFrom, iTo, noRoute, TRUE); } } - free(pTmpListTo); free(pTmpListFrom); --- 191,198 ---- hub.RouteData(iFrom, iTo, noRoute, TRUE); } + + free(pTmpListTo); } free(pTmpListFrom); |
From: Vyacheslav F. <vf...@us...> - 2007-12-19 13:46:43
|
Update of /cvsroot/com0com/hub4com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv5379 Modified Files: comhub.cpp comhub.h hub4com.cpp Log Message: Added ability to send data received from port to the same port Index: hub4com.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/hub4com.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** hub4com.cpp 14 May 2007 12:06:37 -0000 1.5 --- hub4com.cpp 19 Dec 2007 13:46:36 -0000 1.6 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.6 2007/12/19 13:46:36 vfrolov + * Added ability to send data received from port to the same port + * * Revision 1.5 2007/05/14 12:06:37 vfrolov * Added read interval timeout option *************** *** 36,40 **** * Initial revision * - * */ --- 39,42 ---- *************** *** 49,53 **** cerr << "Usage:" << endl ! << " " << pProgName << " [options] \\\\.\\<port0> [options] \\\\.\\<port1> ..." << endl << endl << "Common options:" << endl --- 51,55 ---- cerr << "Usage:" << endl ! << " " << pProgName << " [options] \\\\.\\<port0> [options] [\\\\.\\<port1> ...]" << endl << endl << "Common options:" << endl *************** *** 88,99 **** << endl << "Route options:" << endl ! << " --route=<LstR>:<LstL> - send data received from any ports from <LstR> to" << endl ! << " all ports from <LstL>." << endl ! << " --bi-route=<LstR>:<LstL> - send data received from any ports from <LstR> to" << endl ! << " all ports from <LstL> and vice versa." << endl ! << " --no-route=<LstR>:<LstL> - do not send data received from any ports from" << endl << " <LstR> to ports from <LstL>." << endl << endl ! << " The syntax of <LstR> and <LstL> above: <P1>[,<P2>...]" << endl << " The <Pn> above is a zero based position number of port or All." << endl << " If no any route option specified, then the options --route=0:All --route=1:0" << endl --- 90,104 ---- << endl << "Route options:" << endl ! << " --route=<LstR>:<LstL> - send data received from any port from <LstR> to" << endl ! << " all ports (except this port) from <LstL>." << endl ! << " --bi-route=<LstR>:<LstL> - send data received from any port from <LstR> to" << endl ! << " all ports (except this port) from <LstL> and vice" << endl ! << " versa." << endl ! << " --echo-route=<Lst> - send data received from any port from <Lst> back" << endl ! << " to this port." << endl ! << " --no-route=<LstR>:<LstL> - do not send data received from any port from" << endl << " <LstR> to ports from <LstL>." << endl << endl ! << " The syntax of <LstR>, <LstL> and <Lst> above: <P1>[,<P2>...]" << endl << " The <Pn> above is a zero based position number of port or All." << endl << " If no any route option specified, then the options --route=0:All --route=1:0" << endl *************** *** 105,112 **** --- 110,148 ---- << " " << pProgName << " --route=All:All \\\\.\\CNCB0 \\\\.\\CNCB1 \\\\.\\CNCB2" << endl << " " << pProgName << " --baud=9600 \\\\.\\COM1 --baud=19200 \\\\.\\CNCB1" << endl + << " " << pProgName << " --echo-route=0 \\\\.\\COM2" << endl ; exit(1); } /////////////////////////////////////////////////////////////// + static BOOL EchoRoute(ComHub &hub, const char *pList) + { + char *pTmpList = _strdup(pList); + + if (!pTmpList) { + cerr << "No enough memory." << endl; + exit(2); + } + + BOOL res = TRUE; + char *pSave; + + for (char *p = STRTOK_R(pTmpList, ",", &pSave) ; p ; p = STRTOK_R(NULL, ",", &pSave)) { + int i; + + if (_stricmp(p, "All") == 0) { + i = -1; + } else if (!StrToInt(p, &i) || i < 0 || i >= hub.NumPorts()) { + res = FALSE; + break; + } + + hub.RouteData(i, i, FALSE, FALSE); + } + + free(pTmpList); + + return res; + } + /////////////////////////////////////////////////////////////// static BOOL Route(ComHub &hub, const char *pListFrom, const char *pListTo, BOOL noRoute) { *************** *** 144,148 **** } ! hub.RouteData(iFrom, iTo, noRoute); } } --- 180,184 ---- } ! hub.RouteData(iFrom, iTo, noRoute, TRUE); } } *************** *** 284,287 **** --- 320,327 ---- defaultRouteData = FALSE; Route(hub, pParam, FALSE, TRUE); + } else + if ((pParam = GetParam(pArg, "echo-route=")) != NULL) { + defaultRouteData = FALSE; + EchoRoute(hub, pParam); } else { cerr << "Unknown option " << pArg << endl; *************** *** 290,299 **** } ! if (plugged < 2) ! Usage(argv[0]); ! if (defaultRouteData) { ! hub.RouteData(0, -1, FALSE); ! hub.RouteData(1, 0, FALSE); } --- 330,341 ---- } ! if (plugged < 2) { ! if (plugged < 1) ! Usage(argv[0]); ! } ! else if (defaultRouteData) { ! hub.RouteData(0, -1, FALSE, TRUE); ! hub.RouteData(1, 0, FALSE, TRUE); } Index: comhub.h =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comhub.h 5 Feb 2007 09:33:20 -0000 1.3 --- comhub.h 19 Dec 2007 13:46:36 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2007/12/19 13:46:36 vfrolov + * Added ability to send data received from port to the same port + * * Revision 1.3 2007/02/05 09:33:20 vfrolov * Implemented internal flow control *************** *** 29,33 **** * Initial revision * - * */ --- 32,35 ---- *************** *** 54,63 **** void LostReport() const; ! void RouteData(int iFrom, int iTo, BOOL noRoute) { ! Route(routeDataMap, iFrom, iTo, noRoute); } ! void RouteFlowControl(int iFrom, int iTo, BOOL noRoute) { ! Route(routeFlowControlMap, iFrom, iTo, noRoute); } --- 56,65 ---- void LostReport() const; ! void RouteData(int iFrom, int iTo, BOOL noRoute, BOOL noEcho) { ! Route(routeDataMap, iFrom, iTo, noRoute, noEcho); } ! void RouteFlowControl(int iFrom, int iTo, BOOL noRoute, BOOL noEcho) { ! Route(routeFlowControlMap, iFrom, iTo, noRoute, noEcho); } *************** *** 67,71 **** private: ! void Route(ComPortMap &map, int iFrom, int iTo, BOOL noRoute) const; ComPorts ports; --- 69,73 ---- private: ! void Route(ComPortMap &map, int iFrom, int iTo, BOOL noRoute, BOOL noEcho) const; ComPorts ports; Index: comhub.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/comhub.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** comhub.cpp 5 Feb 2007 09:33:20 -0000 1.3 --- comhub.cpp 19 Dec 2007 13:46:36 -0000 1.4 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.4 2007/12/19 13:46:36 vfrolov + * Added ability to send data received from port to the same port + * * Revision 1.3 2007/02/05 09:33:20 vfrolov * Implemented internal flow control *************** *** 29,33 **** * Initial revision * - * */ --- 32,35 ---- *************** *** 132,136 **** } ! void ComHub::Route(ComPortMap &map, int iFrom, int iTo, BOOL noRoute) const { if (iFrom < 0) { --- 134,138 ---- } ! void ComHub::Route(ComPortMap &map, int iFrom, int iTo, BOOL noRoute, BOOL noEcho) const { if (iFrom < 0) { *************** *** 138,144 **** if(iTo < 0) { for (int iT = 0 ; iT < (int)ports.size() ; iT++) ! Route(map, iF, iT, noRoute); } else { ! Route(map, iF, iTo, noRoute); } } --- 140,146 ---- if(iTo < 0) { for (int iT = 0 ; iT < (int)ports.size() ; iT++) ! Route(map, iF, iT, noRoute, noEcho); } else { ! Route(map, iF, iTo, noRoute, noEcho); } } *************** *** 146,153 **** if(iTo < 0) { for (int iT = 0 ; iT < (int)ports.size() ; iT++) ! Route(map, iFrom, iT, noRoute); } else ! if (iFrom != iTo || noRoute) { ComPortPair pair(ports.at(iFrom), ports.at(iTo)); --- 148,155 ---- if(iTo < 0) { for (int iT = 0 ; iT < (int)ports.size() ; iT++) ! Route(map, iFrom, iT, noRoute, noEcho); } else ! if (iFrom != iTo || !noEcho || noRoute) { ComPortPair pair(ports.at(iFrom), ports.at(iTo)); |
From: Vyacheslav F. <vf...@us...> - 2007-11-30 09:56:56
|
Update of /cvsroot/com0com/com0com/sys In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv8656 Modified Files: version.h Log Message: Pre-tagging version change Index: version.h =================================================================== RCS file: /cvsroot/com0com/com0com/sys/version.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** version.h 20 Jun 2007 10:30:48 -0000 1.11 --- version.h 30 Nov 2007 09:56:50 -0000 1.12 *************** *** 25,32 **** #define C0C_COPYRIGHT_YEARS "2004-2007" ! #define C0C_V1 1 ! #define C0C_V2 8 #define C0C_V3 0 ! #define C0C_V4 1 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 --- 25,32 ---- #define C0C_COPYRIGHT_YEARS "2004-2007" ! #define C0C_V1 2 ! #define C0C_V2 0 #define C0C_V3 0 ! #define C0C_V4 0 #define MK_VERSION_STR1(V1, V2, V3, V4) #V1 "." #V2 "." #V3 "." #V4 |
From: Vyacheslav F. <vf...@us...> - 2007-11-30 09:53:41
|
Update of /cvsroot/com0com/com0com/NSIS In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7521 Modified Files: install.nsi Log Message: Added license page Index: install.nsi =================================================================== RCS file: /cvsroot/com0com/com0com/NSIS/install.nsi,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** install.nsi 23 Nov 2007 08:23:29 -0000 1.11 --- install.nsi 30 Nov 2007 09:53:37 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.12 2007/11/30 09:53:37 vfrolov + * Added license page + * * Revision 1.11 2007/11/23 08:23:29 vfrolov * Added popup for uncompatible CPU *************** *** 185,188 **** --- 188,192 ---- !insertmacro MUI_PAGE_WELCOME + !insertmacro MUI_PAGE_LICENSE "..\license.txt" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY |
From: Vyacheslav F. <vf...@us...> - 2007-11-30 09:52:26
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv7123 Modified Files: ReadMe.txt Log Message: Added security note Index: ReadMe.txt =================================================================== RCS file: /cvsroot/com0com/com0com/ReadMe.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ReadMe.txt 22 Nov 2007 12:39:15 -0000 1.15 --- ReadMe.txt 30 Nov 2007 09:52:23 -0000 1.16 *************** *** 37,40 **** --- 37,43 ---- BCDedit command: bcdedit.exe -set TESTSIGNING ON + NOTE: + Turning off UAC or enabling test signing will impair computer security. + Simply run the installer (setup.exe). An installation wizard will guide you through the required steps. |
From: Vyacheslav F. <vf...@us...> - 2007-11-30 09:50:29
|
Update of /cvsroot/com0com/com0com In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv6338 Added Files: license.txt Log Message: Initial revision --- NEW FILE: license.txt --- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS |
From: Vyacheslav F. <vf...@us...> - 2007-11-27 16:35:53
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv4427 Modified Files: devutils.cpp Log Message: Added state check before enabling Index: devutils.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/devutils.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** devutils.cpp 1 Oct 2007 15:01:35 -0000 1.8 --- devutils.cpp 27 Nov 2007 16:35:49 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2007/11/27 16:35:49 vfrolov + * Added state check before enabling + * * Revision 1.8 2007/10/01 15:01:35 vfrolov * Added pDevInstID parameter to InstallDevice() *************** *** 285,288 **** --- 288,302 ---- } /////////////////////////////////////////////////////////////// + static BOOL IsEnabled(PSP_DEVINFO_DATA pDevInfoData) + { + ULONG status = 0; + ULONG problem = 0; + + if (CM_Get_DevNode_Status(&status, &problem, pDevInfoData->DevInst, 0) != CR_SUCCESS) + return FALSE; + + return (status & DN_HAS_PROBLEM) == 0; + } + /////////////////////////////////////////////////////////////// static int EnumDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { *************** *** 439,442 **** --- 453,459 ---- static int EnableDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pDevInfoData, PDevParams pDevParams) { + if (IsEnabled(pDevInfoData)) + return IDCONTINUE; + if (ChangeState(hDevInfo, pDevInfoData, DICS_ENABLE)) { Trace("Enabled %s %s %s\n", |
From: Vyacheslav F. <vf...@us...> - 2007-11-27 16:33:01
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3265 Modified Files: setup.cpp Log Message: Added disable and enable options Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** setup.cpp 19 Oct 2007 16:09:55 -0000 1.21 --- setup.cpp 27 Nov 2007 16:32:54 -0000 1.22 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.22 2007/11/27 16:32:54 vfrolov + * Added disable and enable options + * * Revision 1.21 2007/10/19 16:09:55 vfrolov * Implemented --detail-prms option *************** *** 519,522 **** --- 522,560 ---- SetupPromptReboot(NULL, NULL, FALSE); + return 0; + } + /////////////////////////////////////////////////////////////// + int Disable(InfFile &infFile) + { + BOOL rebootRequired = FALSE; + + DevProperties devProperties; + if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) + return 1; + + if (!DisableDevices(infFile, &devProperties, &rebootRequired, NULL)) + return 1; + + if (rebootRequired) + SetupPromptReboot(NULL, NULL, FALSE); + + return 0; + } + /////////////////////////////////////////////////////////////// + int Enable(InfFile &infFile) + { + BOOL rebootRequired = FALSE; + + DevProperties devProperties; + if (!devProperties.DevId(C0C_BUS_DEVICE_ID)) + return 1; + + if (!EnableDevices(infFile, &devProperties, &rebootRequired)) { + return 1; + } + + if (rebootRequired) + SetupPromptReboot(NULL, NULL, FALSE); + return 0; } *************** *** 923,926 **** --- 961,966 ---- " identifiers " C0C_PREF_PORT_NAME_A "<n> and " C0C_PREF_PORT_NAME_B "<n>\n" + " disable all - disable all ports in current hardware profile\n" + " enable all - enable all ports in current hardware profile\n" " change <portid> <prms> - set parameters <prms> for port with\n" " identifier <portid>\n" *************** *** 1062,1065 **** --- 1102,1119 ---- } else + if (argc == 3 && !lstrcmpi(argv[1], "disable")) { + SetTitle(C0C_SETUP_TITLE " (DISABLE)"); + + if (!lstrcmpi(argv[2], "all")) + return Disable(infFile); + } + else + if (argc == 3 && !lstrcmpi(argv[1], "enable")) { + SetTitle(C0C_SETUP_TITLE " (ENABLE)"); + + if (!lstrcmpi(argv[2], "all")) + return Enable(infFile); + } + else if (argc == 2 && !lstrcmpi(argv[1], "preinstall")) { SetTitle(C0C_SETUP_TITLE " (PREINSTALL)"); |
From: Vyacheslav F. <vf...@us...> - 2007-11-26 09:40:59
|
Update of /cvsroot/com0com/com0com/setupc In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv32006 Modified Files: sources Log Message: Added low case comparison for targets Index: sources =================================================================== RCS file: /cvsroot/com0com/com0com/setupc/sources,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sources 30 Oct 2007 12:47:51 -0000 1.2 --- sources 26 Nov 2007 09:40:52 -0000 1.3 *************** *** 14,21 **** TARGET_CPU=i386 !ELSE ! !IF "$(BUILD_DEFAULT_TARGETS)" == "-IA64" TARGET_CPU=ia64 !ELSE ! !IF "$(BUILD_DEFAULT_TARGETS)" == "-AMD64" TARGET_CPU=amd64 !ENDIF --- 14,21 ---- TARGET_CPU=i386 !ELSE ! !IF "$(BUILD_DEFAULT_TARGETS)" == "-IA64" || "$(BUILD_DEFAULT_TARGETS)" == "-ia64" TARGET_CPU=ia64 !ELSE ! !IF "$(BUILD_DEFAULT_TARGETS)" == "-AMD64" || "$(BUILD_DEFAULT_TARGETS)" == "-amd64" TARGET_CPU=amd64 !ENDIF |