summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
committer Michael Krelin <hacker@klever.net>2004-07-05 01:53:09 (UTC)
commit5305ddd8332ebd905ebef3b8365fc0d736858a7a (patch) (side-by-side diff)
treeba6dc874bdcb00bd2e116b377a92f347ab81a733
downloaddipstick-5305ddd8332ebd905ebef3b8365fc0d736858a7a.zip
dipstick-5305ddd8332ebd905ebef3b8365fc0d736858a7a.tar.gz
dipstick-5305ddd8332ebd905ebef3b8365fc0d736858a7a.tar.bz2
initial commit into svn repository
git-svn-id: http://svn.klever.net/kin/dipstick/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitignore36
-rw-r--r--AutoBestDlg.cpp109
-rw-r--r--AutoBestDlg.h48
-rw-r--r--COPYING19
-rw-r--r--CrackURL.cpp139
-rw-r--r--CrackURL.h34
-rw-r--r--DipstickDlg.cpp1586
-rw-r--r--DipstickDlg.h184
-rw-r--r--DragPad.cpp213
-rw-r--r--DragPad.h62
-rw-r--r--DropURL.cpp149
-rw-r--r--DropURL.h54
-rw-r--r--HostNameDlg.cpp49
-rw-r--r--HostNameDlg.h35
-rw-r--r--HostProperties.cpp185
-rw-r--r--HostProperties.h61
-rw-r--r--KTAGS15
-rw-r--r--OptionsDlg.cpp86
-rw-r--r--OptionsDlg.h51
-rw-r--r--README36
-rw-r--r--SelectURLsDlg.cpp164
-rw-r--r--SelectURLsDlg.h50
-rw-r--r--URLSource.cpp32
-rw-r--r--URLSource.h5
-rw-r--r--dipstick.clw266
-rw-r--r--dipstick.cpp73
-rw-r--r--dipstick.h36
-rw-r--r--dipstick.mak1763
-rw-r--r--dipstick.rc567
-rw-r--r--help/dipstick.cnt8
-rw-r--r--help/dipstick.hpj29
-rw-r--r--help/dipstick.rtf139
-rw-r--r--help/dipstick.xml115
-rw-r--r--install/custom.rch10
-rw-r--r--install/install.cpp68
-rw-r--r--install/install.rc182
-rw-r--r--install/resource.h24
-rw-r--r--makehelp.bat33
-rw-r--r--res/best.wavbin0 -> 3674 bytes
-rw-r--r--res/complete.icobin0 -> 1078 bytes
-rw-r--r--res/dipstick.icobin0 -> 1078 bytes
-rw-r--r--res/dipstick.rc213
-rw-r--r--res/kdnd.avibin0 -> 39004 bytes
-rw-r--r--res/kdragurl.avibin0 -> 6144 bytes
-rw-r--r--res/pending.icobin0 -> 1078 bytes
-rw-r--r--res/pinging.icobin0 -> 1078 bytes
-rw-r--r--res/unreach.icobin0 -> 1078 bytes
-rw-r--r--resource.h149
-rw-r--r--shared-code/BTreendex.h595
-rw-r--r--shared-code/BellsNWhistles.h146
-rw-r--r--shared-code/BitSet.h105
-rw-r--r--shared-code/Dynamide.h443
-rw-r--r--shared-code/FindIFace.h125
-rw-r--r--shared-code/LRUCache.h113
-rw-r--r--shared-code/RegEx.cpp1697
-rw-r--r--shared-code/RegEx.h158
-rw-r--r--shared-code/SNMPExtDll.h252
-rw-r--r--shared-code/SNMPOIDs.h221
-rw-r--r--shared-code/SNMPeer.h286
-rw-r--r--shared-code/install.h370
-rw-r--r--shared-code/ip_icmp.h91
-rw-r--r--shared-code/kHelpers.h159
-rw-r--r--shared-code/kICMP.cpp300
-rw-r--r--shared-code/kICMP.h80
-rw-r--r--shared-code/kinhelp.xsl250
-rw-r--r--shared-code/ms_icmp.h77
-rw-r--r--shared-data/browse-icon.icobin0 -> 1078 bytes
-rw-r--r--shared-data/install-icon.icobin0 -> 2998 bytes
-rw-r--r--shared-data/klever-background.bmpbin0 -> 2578 bytes
-rw-r--r--shared-data/play-icon.icobin0 -> 1078 bytes
-rw-r--r--stdafx.cpp6
-rw-r--r--stdafx.h36
72 files changed, 12387 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..31b8754
--- a/dev/null
+++ b/.gitignore
@@ -0,0 +1,36 @@
+
+# /
+/Debug
+/Release
+/Releast
+/debug
+/release
+/releast
+/DEBUG
+/RELEASE
+/RELEAST
+/*.mdp
+/*.ncb
+/*.aps
+/redist
+
+# /help/
+/help/DIPSTICK.HLP
+/help/dipstick.LOG
+/help/dipstick.hm
+/help/dipstick.GID
+
+# /install/
+/install/debug
+/install/pure
+/install/canned
+/install/static
+/install/Debug
+/install/Pure
+/install/Canned
+/install/Static
+/install/DEBUG
+/install/PURE
+/install/CANNED
+/install/STATIC
+/install/*.aps
diff --git a/AutoBestDlg.cpp b/AutoBestDlg.cpp
new file mode 100644
index 0000000..cf18c9c
--- a/dev/null
+++ b/AutoBestDlg.cpp
@@ -0,0 +1,109 @@
+// AutoBestDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Dipstick.h"
+#include "AutoBestDlg.h"
+
+#include "URLSource.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CAutoBestDlg dialog
+
+
+CAutoBestDlg::CAutoBestDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CAutoBestDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CAutoBestDlg)
+ m_PktLoss = _T("");
+ m_RTT = _T("");
+ m_URL = _T("");
+ //}}AFX_DATA_INIT
+}
+
+
+void CAutoBestDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CAutoBestDlg)
+ DDX_Control(pDX, IDC_DROPSOURCE, m_DropSourceCtl);
+ DDX_Control(pDX, IDC_PREV, m_PrevCtl);
+ DDX_Control(pDX, IDC_NEXT, m_NextCtl);
+ DDX_Text(pDX, IDC_PKTLOSS, m_PktLoss);
+ DDX_Text(pDX, IDC_RTT, m_RTT);
+ DDX_Text(pDX, IDC_URL, m_URL);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CAutoBestDlg, CDialog)
+ //{{AFX_MSG_MAP(CAutoBestDlg)
+ ON_BN_CLICKED(IDC_NEXT, OnNext)
+ ON_BN_CLICKED(IDC_PREV, OnPrev)
+ ON_WM_LBUTTONDOWN()
+ ON_BN_CLICKED(IDC_COPYURL, OnCopyurl)
+ ON_WM_HELPINFO()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CAutoBestDlg message handlers
+
+void CAutoBestDlg::OnNext()
+{
+ EndDialog(IDC_NEXT);
+}
+
+void CAutoBestDlg::OnPrev()
+{
+ EndDialog(IDC_PREV);
+}
+
+BOOL CAutoBestDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ m_NextCtl.EnableWindow(m_bNext);
+ m_PrevCtl.EnableWindow(m_bPrev);
+
+ VERIFY(m_DropSourceCtl.Open(IDR_DRAGAVI));
+ SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+CAutoBestDlg::~CAutoBestDlg()
+{
+}
+
+void CAutoBestDlg::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ if(ChildWindowFromPoint(point,CWP_ALL)==&m_DropSourceCtl){
+ TRACE0("Dragging!\n");
+ CURLSource us(m_URL);
+ m_DropSourceCtl.Stop();
+ us.DoDragDrop(DROPEFFECT_COPY|DROPEFFECT_LINK);
+ m_DropSourceCtl.Play(0,-1,-1);
+ }else
+ CDialog::OnLButtonDown(nFlags, point);
+}
+
+void CAutoBestDlg::OnCopyurl()
+{
+CURLSource *us = new CURLSource(m_URL);
+ us->SetClipboard();
+ us->FlushClipboard();
+}
+
+BOOL CAutoBestDlg::OnHelpInfo(HELPINFO* pHelpInfo)
+{
+ WinHelp(IDD|0x20000l);
+ return TRUE;
+}
diff --git a/AutoBestDlg.h b/AutoBestDlg.h
new file mode 100644
index 0000000..fb7ca4c
--- a/dev/null
+++ b/AutoBestDlg.h
@@ -0,0 +1,48 @@
+// AutoBestDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CAutoBestDlg dialog
+
+class CAutoBestDlg : public CDialog
+{
+// Construction
+public:
+ ~CAutoBestDlg();
+ BOOL m_bPrev;
+ BOOL m_bNext;
+ CAutoBestDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CAutoBestDlg)
+ enum { IDD = IDD_AUTOBEST };
+ CAnimateCtrl m_DropSourceCtl;
+ CButton m_PrevCtl;
+ CButton m_NextCtl;
+ CString m_PktLoss;
+ CString m_RTT;
+ CString m_URL;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CAutoBestDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+ // Generated message map functions
+ //{{AFX_MSG(CAutoBestDlg)
+ afx_msg void OnNext();
+ afx_msg void OnPrev();
+ virtual BOOL OnInitDialog();
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnCopyurl();
+ afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..ad23259
--- a/dev/null
+++ b/COPYING
@@ -0,0 +1,19 @@
+Copyright (c) 1996, 1997, 1998, 2002 Klever Group (http://www.klever.net/)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/CrackURL.cpp b/CrackURL.cpp
new file mode 100644
index 0000000..6537b42
--- a/dev/null
+++ b/CrackURL.cpp
@@ -0,0 +1,139 @@
+#include "stdafx.h"
+#include "CrackURL.h"
+
+CCrackURL::CCrackURL()
+{
+ VERIFY(m_reSchema.Compile("([[:alpha:]]+):",CRegEx::regExtended|CRegEx::regIgnoreCase));
+ VERIFY(m_reUPHP.Compile("(([^:]+)?(:([^@]*))?@)?([^:/]+)(:([[:digit:]]+))?",CRegEx::regExtended|CRegEx::regIgnoreCase));
+ VERIFY(m_reHTTPReq.Compile("(.*/)?([^#\\?]*)(#[^\\?]*)?(\\?.*)?",CRegEx::regExtended|CRegEx::regIgnoreCase));
+}
+
+BOOL CCrackURL::Crack(LPCTSTR url)
+{
+ m_URL = url;
+CString rest;
+ if(m_reSchema.Match(url)){
+ m_Schema = m_reSchema.GetMatch(1);
+ rest = m_reSchema.GetMatch(CRegEx::matchPostMatch);
+ }else{
+ m_Schema.Empty();
+ rest = url;
+ }
+ if(rest.Left(2)=="//"){
+ // URL conforms to common syntax
+ rest=rest.Mid(2);
+ ParseUPHP(rest);
+ }else if(!m_Schema.CompareNoCase("mailto")){
+ ParseUPHP(rest);
+ }else{
+ m_User.Empty(); m_Password.Empty(); m_Host.Empty(); m_Port.Empty();
+ }
+ if((!rest.IsEmpty()) && m_reHTTPReq.Match(rest)){
+ m_pathPath = m_reHTTPReq.GetMatch(1);
+ m_pathFile = m_reHTTPReq.GetMatch(2);
+ m_pathAnchor = m_reHTTPReq.GetMatch(3);
+ m_pathQuery = m_reHTTPReq.GetMatch(4);
+ m_URLPath = m_reHTTPReq.GetMatch(CRegEx::matchMatch);
+ rest = m_reHTTPReq.GetMatch(CRegEx::matchPostMatch);
+ }else{
+ m_URLPath.Empty();
+ m_pathPath.Empty();
+ m_pathFile.Empty();
+ m_pathAnchor.Empty();
+ m_pathQuery.Empty();
+ }
+ m_urlRest = rest;
+ return TRUE;
+}
+
+void CCrackURL::ParseUPHP(CString& rest)
+{
+ if(m_reUPHP.Match(rest)){
+ m_User = m_reUPHP.GetMatch(2);
+ m_Password = m_reUPHP.GetMatch(4);
+ m_Host = m_reUPHP.GetMatch(5);
+ m_Port = m_reUPHP.GetMatch(7);
+ if(!m_Port.IsEmpty())
+ m_nPort = atoi(m_Port);
+ rest = m_reUPHP.GetMatch(CRegEx::matchPostMatch);
+ }else{
+ m_User.Empty();
+ m_Password.Empty();
+ m_Host.Empty();
+ m_Port.Empty();
+ }
+}
+
+BOOL CCrackURL::Adjust(LPCTSTR srcURL)
+{
+CCrackURL cracked;
+ VERIFY(cracked.Crack(srcURL));
+ return Adjust(cracked);
+}
+
+BOOL CCrackURL::Adjust(CCrackURL& srcURL)
+{
+ if(m_Schema.IsEmpty()) m_Schema = srcURL.m_Schema;
+ if(m_Host.IsEmpty()){
+ m_Host = srcURL.m_Host;
+ if(m_User.IsEmpty()) m_User = srcURL.m_User;
+ if(m_Password.IsEmpty()) m_Password = srcURL.m_Password;
+ if(m_Port.IsEmpty()) m_Port = srcURL.m_Port, m_nPort = srcURL.m_nPort;
+ }
+ if(m_pathPath.Find('/')==0)
+ return TRUE;
+ m_pathPath = srcURL.m_pathPath+m_pathPath;
+ m_URLPath.Empty();
+ return TRUE;
+}
+
+CString CCrackURL::Build()
+{
+CString rv;
+ if(!m_Schema.IsEmpty())
+ rv+=m_Schema+':';
+ if(!m_Schema.CompareNoCase("mailto")){
+ rv+=m_User+'@'+m_Host;
+ }else{
+ rv+="//";
+ if(!m_User.IsEmpty()){
+ rv+=m_User;
+ if(!m_Password.IsEmpty())
+ rv+=':'+m_Password;
+ rv+='@';
+ }
+ rv+=m_Host;
+ if(!m_Port.IsEmpty())
+ rv+=':'+m_Port;
+ if(!m_URLPath.IsEmpty()){
+ rv+=m_URLPath;
+ }else{
+ rv+=m_pathPath+m_pathFile+m_pathAnchor+m_pathQuery;
+ }
+ }
+ return rv;
+}
+
+CString CCrackURL::InnermostURL(LPCTSTR url)
+{
+static CRegEx reInnerURL;
+ if(!reInnerURL.m_bCompiled)
+ VERIFY(reInnerURL.Compile(".+[^[:alpha:]]([[:alpha:]]+://[^&]+)",CRegEx::regExtended|CRegEx::regIgnoreCase));
+CString rv = url;
+ while(reInnerURL.Match(rv))
+ rv=reInnerURL.GetMatch(1);
+ return rv;
+}
+
+CString CCrackURL::GetHostName(LPCTSTR url)
+{
+static CRegEx reHost;
+ if(!reHost.m_bCompiled)
+ VERIFY(reHost.Compile("^[[:alpha:]]+://([^/:]+)",CRegEx::regExtended|CRegEx::regIgnoreCase));
+CString rv;
+ if(reHost.Match(url))
+ rv = reHost.GetMatch(1);
+ else
+ rv = url;
+ return rv;
+}
diff --git a/CrackURL.h b/CrackURL.h
new file mode 100644
index 0000000..2223740
--- a/dev/null
+++ b/CrackURL.h
@@ -0,0 +1,34 @@
+#ifndef __CRACKURL_H
+#define __CRACKURL_H
+
+#include "shared-code/RegEx.h"
+
+class CCrackURL {
+public:
+ static CString GetHostName(LPCTSTR url);
+ static CString InnermostURL(LPCTSTR url);
+ CString Build();
+ BOOL Adjust(CCrackURL& srcURL);
+ CString m_pathPath;
+ CString m_pathFile;
+ CString m_pathAnchor;
+ CString m_pathQuery;
+ CString m_urlRest;
+ BOOL Adjust(LPCTSTR srcURL);
+ CRegEx m_reHTTPReq;
+ CRegEx m_reUPHP;
+ CString m_URLPath;
+ UINT m_nPort;
+ CString m_Port;
+ CString m_Host;
+ CString m_Password;
+ CString m_User;
+ void ParseUPHP(CString& rest);
+ CString m_Schema;
+ CString m_URL;
+ BOOL Crack(LPCTSTR url);
+ CCrackURL();
+ CRegEx m_reSchema;
+};
+
+#endif // __CRACKURL_H
diff --git a/DipstickDlg.cpp b/DipstickDlg.cpp
new file mode 100644
index 0000000..ace2aff
--- a/dev/null
+++ b/DipstickDlg.cpp
@@ -0,0 +1,1586 @@
+// DipstickDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Dipstick.h"
+#include "DipstickDlg.h"
+#include "DragPad.h"
+#include "OptionsDlg.h"
+#include "HostNameDlg.h"
+#include "HostProperties.h"
+#include "AutoBestDlg.h"
+#include "ddeml.h"
+
+#include "URLSource.h"
+#include "SelectURLsDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CAboutDlg dialog used for App About
+
+class CAboutDlg : public CDialog
+{
+public:
+ CAboutDlg();
+
+// Dialog Data
+ //{{AFX_DATA(CAboutDlg)
+ enum { IDD = IDD_ABOUTBOX };
+ //}}AFX_DATA
+
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CAboutDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ virtual BOOL OnInitDialog();
+ //{{AFX_MSG(CAboutDlg)
+ afx_msg void OnKlevernet();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
+{
+ //{{AFX_DATA_INIT(CAboutDlg)
+ //}}AFX_DATA_INIT
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CAboutDlg)
+ //}}AFX_DATA_MAP
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
+ //{{AFX_MSG_MAP(CAboutDlg)
+ ON_BN_CLICKED(IDC_KLEVERNET, OnKlevernet)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDipstickDlg dialog
+
+CDipstickDlg::CDipstickDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CDipstickDlg::IDD, pParent),
+ m_DragPad(NULL), m_PingsPerHost(10), m_PingSize(32), m_TimeOut(5000), m_Interval(500),
+ m_SortCriteria(sortAvg), m_bShown(FALSE), m_MaxThreads(10), m_bExiting(FALSE),
+ m_bMSWorkAround(TRUE), m_MinSize(-1,-1), m_bAutoBest(TRUE), m_bSmartAdjust(TRUE),
+ m_bAdjustInnermost(TRUE), m_ActiveThreads(0), m_bIgnorelative(TRUE)
+{
+CWinApp *app = AfxGetApp();
+ ASSERT(app);
+WORD hi,lo;
+ hi=app->GetProfileInt("Options","IntervalHi",HIWORD(m_Interval));
+ lo=app->GetProfileInt("Options","IntervalLo",LOWORD(m_Interval));
+ m_Interval=MAKELONG(lo,hi);
+ m_MaxThreads=app->GetProfileInt("Options","MaxThreads",m_MaxThreads);
+ m_PingSize=app->GetProfileInt("Options","PingSize",m_PingSize);
+ m_PingsPerHost=app->GetProfileInt("Options","PingsPerHost",m_PingsPerHost);
+ m_SortCriteria=app->GetProfileInt("Options","SortBy",m_SortCriteria);
+ hi=app->GetProfileInt("Options","TimeOutHi",HIWORD(m_TimeOut));
+ lo=app->GetProfileInt("Options","TimeOutLo",LOWORD(m_TimeOut));
+ m_TimeOut=MAKELONG(lo,hi);
+ m_bMSWorkAround = app->GetProfileInt("Options","InnermostURL",m_bMSWorkAround);
+ m_bAutoBest = app->GetProfileInt("Options","AutoBest",m_bAutoBest);
+ m_bSmartAdjust = app->GetProfileInt("Options","SmartAdjust",m_bSmartAdjust);
+ m_bAdjustInnermost = app->GetProfileInt("Options","AdjustInnermost",m_bAdjustInnermost);
+ m_bIgnorelative = app->GetProfileInt("Options","IgnoreRelative",m_bIgnorelative);
+ m_impexPath = app->GetProfileString("Options","ImportExportPath",m_impexPath);
+ //{{AFX_DATA_INIT(CDipstickDlg)
+ //}}AFX_DATA_INIT
+ // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+ m_bmpBack.LoadBitmap(IDB_DIABACK);
+ m_bmpBack.GetBitmap(&m_bitmapBack);
+CString tmp;
+ VERIFY(tmp.LoadString(IDS_REGEX_HTMLURL));
+ VERIFY(m_reHTMLURL.Compile(tmp,CRegEx::regExtended|CRegEx::regIgnoreCase));
+}
+
+CDipstickDlg::~CDipstickDlg()
+{
+}
+
+void CDipstickDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CDipstickDlg)
+ DDX_Control(pDX, IDC_ADVANCED, m_AdvancedCtl);
+ DDX_Control(pDX, ID_HELP, m_HelpCtl);
+ DDX_Control(pDX, IDC_EXIT, m_ExitCtl);
+ DDX_Control(pDX, IDC_OPTIONS, m_OptionsCtl);
+ DDX_Control(pDX, IDC_MANUALPING, m_ManualPingCtl);
+ DDX_Control(pDX, IDC_REMOVE, m_RemoveCtl);
+ DDX_Control(pDX, IDC_REPINGALL, m_RepingAllCtl);
+ DDX_Control(pDX, IDC_REPING, m_RepingCtl);
+ DDX_Control(pDX, IDC_CLEAR, m_ClearListCtl);
+ DDX_Control(pDX, IDC_HOSTLIST, m_HostList);
+ //}}AFX_DATA_MAP
+}
+
+BEGIN_MESSAGE_MAP(CDipstickDlg, CDialog)
+ //{{AFX_MSG_MAP(CDipstickDlg)
+ ON_WM_SYSCOMMAND()
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ ON_WM_DESTROY()
+ ON_BN_CLICKED(IDC_OPTIONS, OnOptions)
+ ON_MESSAGE(WM_DNP_URLPING, OnUrlPing)
+ ON_MESSAGE(WM_DNP_ACTIVITYCOUNT, OnActivityCount)
+ ON_MESSAGE(WM_DNP_UPDATEHOSTDATA, OnUpdateHostData)
+ ON_MESSAGE(WM_DNP_HTML, OnHTMLTransfer)
+ ON_NOTIFY(LVN_COLUMNCLICK, IDC_HOSTLIST, OnColumnclickHostlist)
+ ON_WM_WINDOWPOSCHANGING()
+ ON_COMMAND(ID_DRAGPAD_OPTIONS, OnDragpadOptions)
+ ON_COMMAND(ID_DRAGPAD_SHOWMAINWINDOW, OnDragpadShowmainwindow)
+ ON_COMMAND(ID_DRAGPAD_HELP, OnDragpadHelp)
+ ON_COMMAND(ID_DRAGPAD_ABOUT, OnDragpadAbout)
+ ON_COMMAND(ID_DRAGPAD_EXIT, OnDragpadExit)
+ ON_BN_CLICKED(IDC_MANUALPING, OnManualping)
+ ON_COMMAND(ID_DRAGPAD_MANUALPING, OnDragpadManualping)
+ ON_COMMAND(ID_DRAGPAD_REPINGALL, OnDragpadRepingAll)
+ ON_COMMAND(ID_DRAGPAD_REMOVEALL, OnDragpadRemoveAll)
+ ON_BN_CLICKED(IDC_REPING, OnReping)
+ ON_BN_CLICKED(IDC_REPINGALL, OnRepingall)
+ ON_BN_CLICKED(IDC_CLEAR, OnClear)
+ ON_NOTIFY(LVN_INSERTITEM, IDC_HOSTLIST, OnInsertitemHostlist)
+ ON_NOTIFY(LVN_DELETEITEM, IDC_HOSTLIST, OnDeleteitemHostlist)
+ ON_NOTIFY(LVN_DELETEALLITEMS, IDC_HOSTLIST, OnDeleteallitemsHostlist)
+ ON_BN_CLICKED(IDC_EXIT, OnExit)
+ ON_NOTIFY(LVN_ITEMCHANGED, IDC_HOSTLIST, OnItemchangedHostlist)
+ ON_BN_CLICKED(IDC_REMOVE, OnRemove)
+ ON_NOTIFY(NM_RCLICK, IDC_HOSTLIST, OnRclickHostlist)
+ ON_COMMAND(ID_HOSTLIST_REPING, OnHostListReping)
+ ON_COMMAND(ID_HOSTLIST_REMOVE, OnHostListRemove)
+ ON_COMMAND(ID_HOSTLIST_REPINGALL, OnHostListRepingAll)
+ ON_COMMAND(ID_HOSTLIST_REMOVEALL, OnHostListRemoveAll)
+ ON_COMMAND(ID_HOSTLIST_OPENURL, OnHostListOpenURL)
+ ON_COMMAND(ID_HOSTLIST_PROPERTIES, OnHostListProperties)
+ ON_NOTIFY(NM_DBLCLK, IDC_HOSTLIST, OnDblclkHostlist)
+ ON_WM_CLOSE()
+ ON_WM_GETMINMAXINFO()
+ ON_WM_SIZE()
+ ON_BN_CLICKED(ID_HELP, OnHelp)
+ ON_NOTIFY(LVN_BEGINDRAG, IDC_HOSTLIST, OnBegindragHostlist)
+ ON_COMMAND(ID_HOSTLIST_PASTEURL, OnPasteurl)
+ ON_COMMAND(ID_HOSTLIST_COPYURL, OnHostlistCopyurl)
+ ON_WM_HELPINFO()
+ ON_WM_DROPFILES()
+ ON_BN_CLICKED(IDC_ADVANCED, OnAdvanced)
+ ON_COMMAND(ID_ADVANCED_EXPORTLIST, OnAdvancedExportlist)
+ ON_COMMAND(ID_ADVANCED_IMPORTLIST, OnAdvancedImportlist)
+ ON_COMMAND(ID_DRAGPAD_PASTEURL, OnPasteurl)
+ ON_COMMAND(ID_DRAGPAD_ADVANCED_EXPORTLIST, OnDragpadAdvancedExportlist)
+ ON_COMMAND(ID_DRAGPAD_ADVANCED_IMPORTLIST, OnDragpadAdvancedImportlist)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDipstickDlg message handlers
+
+BOOL CDipstickDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ // Add "About..." menu item to system menu.
+
+ // IDM_ABOUTBOX must be in the system command range.
+ ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+ ASSERT(IDM_ABOUTBOX < 0xF000);
+
+ CMenu* pSysMenu = GetSystemMenu(FALSE);
+ CString strAboutMenu;
+ strAboutMenu.LoadString(IDS_ABOUTBOX);
+ if (!strAboutMenu.IsEmpty())
+ {
+ pSysMenu->AppendMenu(MF_SEPARATOR);
+ pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+ }
+
+ // Set the icon for this dialog. The framework does this automatically
+ // when the application's main window is not a dialog
+ SetIcon(m_hIcon, TRUE); // Set big icon
+ SetIcon(m_hIcon, FALSE); // Set small icon
+
+CRect wrci, wrco;
+ GetWindowRect(&wrco);
+ GetClientRect(&wrci);
+CRect brc1, brc2, lrc;
+ m_HostList.GetWindowRect(&lrc);
+ ScreenToClient(&lrc);
+ m_ManualPingCtl.GetWindowRect(&brc1);
+ ScreenToClient(brc1);
+ m_RepingCtl.GetWindowRect(&brc2);
+ ScreenToClient(&brc2);
+ m_OverX = lrc.left;
+ m_OverY = lrc.top;
+ m_GapY = brc2.top - brc1.bottom;
+ m_MinSize.cx = m_OverX+m_OverX+m_OverX+brc1.Width()+m_OverX;
+ m_MinSize.cy = m_OverY+(brc1.Height()+m_GapY)*6+(brc1.Height()+m_GapY)*3+m_OverY;
+ m_MinSize.cx+=wrco.Width()-wrci.Width();
+ m_MinSize.cy+=wrco.Height()-wrci.Height();
+
+CWinApp *app = AfxGetApp();
+ ASSERT(app);
+CRect wrc;
+ wrc.top=app->GetProfileInt("Windows","DlgTop",-1);
+ wrc.bottom=app->GetProfileInt("Windows","DlgBottom",-1);
+ wrc.left=app->GetProfileInt("Windows","DlgLeft",-1);
+ wrc.right=app->GetProfileInt("Windows","DlgRight",-1);
+ if((wrc.top!=-1|| wrc.bottom!=-1) && wrc.left!=-1&& wrc.right!=-1)
+ MoveWindow(&wrc);
+
+ RecalcLayout(-1,-1);
+
+ m_DragPad = new CDragPad();
+ m_DragPad->m_Daddy=this;
+ m_DragPad->Create(CDragPad::IDD);
+ m_Images.Create(16,16,TRUE,4,1);
+ m_iPending=m_Images.Add(app->LoadIcon(IDI_PENDING));
+ m_iPinging=m_Images.Add(app->LoadIcon(IDI_PINGING));
+ m_iCompleted=m_Images.Add(app->LoadIcon(IDI_COMPLETED));
+ m_iUnreachable=m_Images.Add(app->LoadIcon(IDI_UNREACHABLE));
+ ASSERT(!(m_iPending<0 || m_iPinging<0 || m_iCompleted<0 || m_iUnreachable<0));
+ m_HostList.SetImageList(&m_Images,LVSIL_NORMAL);
+ m_HostList.SetImageList(&m_Images,LVSIL_SMALL);
+ m_HostList.SetImageList(&m_Images,LVSIL_STATE);
+ m_HostList.SetTextColor(RGB(255,255,0)); // Yellow
+ m_HostList.SetTextBkColor(RGB(12,167,0)); // Green
+ m_HostList.SetBkColor(RGB(12,167,0)); // Green
+CRect listrc;
+ m_HostList.GetClientRect(&listrc);
+ m_HostList.InsertColumn(0,"Host Name",LVCFMT_LEFT,app->GetProfileInt("Columns","HostName",listrc.Width()-(listrc.Width()*2/16)*4-(listrc.Width()*3/16)),subitemHost);
+ m_HostList.InsertColumn(1,"Host IP",LVCFMT_LEFT,app->GetProfileInt("Columns","HostIP",listrc.Width()*3/16),subitemIP);
+ m_HostList.InsertColumn(2,"Min RTT",LVCFMT_RIGHT,app->GetProfileInt("Columns","MinRTT",listrc.Width()*2/16),subitemMin);
+ m_HostList.InsertColumn(3,"Avg RTT",LVCFMT_RIGHT,app->GetProfileInt("Columns","AvgRTT",listrc.Width()*2/16),subitemAvg);
+ m_HostList.InsertColumn(4,"Max RTT",LVCFMT_RIGHT,app->GetProfileInt("Columns","MaxRTT",listrc.Width()*2/16),subitemMax);
+ m_HostList.InsertColumn(5,"Pktloss", LVCFMT_RIGHT,app->GetProfileInt("Columns","PktLoss",listrc.Width()*2/16),subitemPacketloss);
+
+ DragAcceptFiles(TRUE);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+}
+
+void CDipstickDlg::OnSysCommand(UINT nID, LPARAM lParam)
+{
+ if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+ {
+ CAboutDlg dlgAbout;
+ dlgAbout.DoModal();
+ }
+ else
+ {
+ CDialog::OnSysCommand(nID, lParam);
+ }
+}
+
+// If you add a minimize button to your dialog, you will need the code below
+// to draw the icon. For MFC applications using the document/view model,
+// this is automatically done for you by the framework.
+
+void CDipstickDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // device context for painting
+
+ SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
+
+ // Center icon in client rectangle
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // Draw the icon
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ CPaintDC pDC(this);
+ CDC bmpDC;
+ bmpDC.CreateCompatibleDC(&pDC);
+ bmpDC.SelectObject(&m_bmpBack);
+ CRect rc;
+ GetClientRect(&rc);
+ for(int x=-m_bitmapBack.bmWidth*2/4;x<rc.Width();x+=m_bitmapBack.bmWidth)
+ for(int y=-m_bitmapBack.bmHeight*2/4;y<rc.Height();y+=m_bitmapBack.bmHeight)
+ pDC.BitBlt(x,y,m_bitmapBack.bmWidth,m_bitmapBack.bmHeight,&bmpDC,0,0,SRCCOPY);
+ bmpDC.DeleteDC();
+ CDialog::OnPaint();
+ }
+}
+
+// The system calls this to obtain the cursor to display while the user drags
+// the minimized window.
+HCURSOR CDipstickDlg::OnQueryDragIcon()
+{
+ return (HCURSOR) m_hIcon;
+}
+
+//////////////////////////
+
+void CDipstickDlg::OnDestroy()
+{
+ CDialog::OnDestroy();
+ TRACE0("DestroyMain\n");
+ m_DragPad->DestroyWindow();
+ delete m_DragPad;
+ m_DragPad=NULL;
+ // *** Eventually move the following code to separate function
+POSITION p = m_Hosts.GetHeadPosition();
+ while(p){
+ POSITION pp = p;
+ CPingyHost *host = m_Hosts.GetNext(p);
+ ASSERT(host);
+ m_Hosts.RemoveAt(pp);
+ host->Suicide();
+ }
+ ASSERT(m_Hosts.IsEmpty());
+}
+
+void CDipstickDlg::OnOptions()
+{
+COptionsDlg o(this);
+ o.m_Pings = m_PingsPerHost;
+ o.m_PingSize = m_PingSize;
+ o.m_TimeOut = max(1,m_TimeOut/1000);
+ o.m_Interval = max(1,m_Interval/1000);
+ o.m_MaxThreads = m_MaxThreads;
+ o.m_bMSWorkAround = m_bMSWorkAround;
+ o.m_bAutoBest = m_bAutoBest;
+ o.m_bAdjust = m_bSmartAdjust;
+ o.m_bAdjustInn = m_bAdjustInnermost;
+ o.m_bIgnorelative = m_bIgnorelative;
+ if(o.DoModal()==IDOK){
+ m_PingsPerHost = o.m_Pings;
+ m_PingSize = o.m_PingSize;
+ m_TimeOut = o.m_TimeOut*1000;
+ m_Interval = o.m_Interval*1000;
+ m_MaxThreads = o.m_MaxThreads;
+ m_bMSWorkAround = o.m_bMSWorkAround;
+ m_bAutoBest = o.m_bAutoBest;
+ m_bSmartAdjust = o.m_bAdjust;
+ m_bAdjustInnermost = o.m_bAdjustInn;
+ m_bIgnorelative = o.m_bIgnorelative;
+ }
+}
+
+BOOL CDipstickDlg::AddPingyHost(CPingyHost *host)
+{
+ m_Hosts.AddTail(host);
+int i = m_HostList.InsertItem(0,host->m_HostName);
+ m_HostList.SetItemData(i,(DWORD)host);
+ UpdateDragpadTitle();
+ return UpdatePingyHost(host,i); // *** Do someting if failed.
+}
+
+BOOL CDipstickDlg::UpdatePingyHost(CPingyHost *host,int index)
+{
+ UpdateDragpadTitle();
+int i = index;
+ if(i<0){
+ int is = m_HostList.GetItemCount();
+ for(i=0;i<is;i++)
+ if(m_HostList.GetItemData(i)==(DWORD)host)
+ break;
+ if(!(i<is))
+ return FALSE;
+ }
+ ASSERT(m_HostList.GetItemData(i)==(DWORD)host);
+ m_HostList.SetItemText(i,subitemHost,host->m_HostName.IsEmpty()?"...":host->m_HostName);
+ m_HostList.SetItemText(i,subitemIP,host->m_IP?inet_ntoa(*(in_addr*)&host->m_IP):"...");
+ if(host->m_Pinged && host->m_Packetloss>=0){
+ CString tmp;
+ if(host->m_Packetloss==100){
+ m_HostList.SetItemText(i,subitemMin,"-");
+ m_HostList.SetItemText(i,subitemAvg,"-");
+ m_HostList.SetItemText(i,subitemMax,"-");
+ }else{
+ tmp.Format("%lu",host->m_MinRTT);
+ m_HostList.SetItemText(i,subitemMin,tmp);
+ tmp.Format("%lu",host->m_AvgRTT);
+ m_HostList.SetItemText(i,subitemAvg,tmp);
+ tmp.Format("%lu",host->m_MaxRTT);
+ m_HostList.SetItemText(i,subitemMax,tmp);
+ }
+ tmp.Format("%d%%",host->m_Packetloss);
+ m_HostList.SetItemText(i,subitemPacketloss,tmp);
+ }else{
+ m_HostList.SetItemText(i,subitemMin,"...");
+ m_HostList.SetItemText(i,subitemAvg,"...");
+ m_HostList.SetItemText(i,subitemMax,"...");
+ m_HostList.SetItemText(i,subitemPacketloss,"...");
+ }
+ if(host->m_Pinging)
+ m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iPinging,0,0,0);
+ else{
+ if(host->m_bToPing)
+ m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iPending,0,0,0);
+ else{
+ if(host->m_Pinged){
+ if(host->m_Packetloss==100)
+ m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iUnreachable,0,0,0);
+ else
+ m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iCompleted,0,0,0);
+ }else
+ m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iPending,0,0,0);
+ }
+ }
+ m_HostList.SortItems(CompareItems,(DWORD)this);
+ UpdateControlButtons();
+ return TRUE;
+}
+
+BOOL CDipstickDlg::RemovePingyHost(CPingyHost *host,int index)
+{
+ if(host->m_Pinging)
+ return FALSE;
+int i = index;
+ if(i<0){
+ int is = m_HostList.GetItemCount();
+ for(i=0;i<is;i++)
+ if(m_HostList.GetItemData(i)==(DWORD)host)
+ break;
+ if(!(i<is))
+ return FALSE;
+ }
+ ASSERT(m_HostList.GetItemData(i)==(DWORD)host);
+POSITION p = m_Hosts.Find(host,NULL);
+ if(!p)
+ return FALSE;
+ m_HostList.DeleteItem(i);
+ m_Hosts.RemoveAt(p);
+ host->Suicide();
+ UpdateControlButtons();
+ UpdateDragpadTitle();
+ return TRUE;
+}
+
+LRESULT CDipstickDlg::OnUrlPing(WPARAM wP, LPARAM lP)
+{
+ ASSERT(lP);
+CString *u = (CString*)lP;
+CString hn;
+CPingyHost *host;
+ if(m_bMSWorkAround)
+ hn = CCrackURL::InnermostURL(*u);
+ else
+ hn = *u;
+ hn = CCrackURL::GetHostName(hn);
+DWORD ip = inet_addr(hn);
+ if(ip==INADDR_NONE)
+ host = new CPingyHost(this,(char*)(LPCTSTR)hn);
+ else
+ host = new CPingyHost(this,ip);
+ host->m_URL=*u;
+ delete u;
+ AddPingyHost(host);
+ CheckForPendingRequests();
+ return 0;
+}
+
+LRESULT CDipstickDlg::OnActivityCount(WPARAM wP,LPARAM)
+{
+ if(!wP)
+ return 0;
+int crement = (int)wP;
+ m_ActiveThreads+=crement;
+ if(m_ActiveThreads<0){
+ TRACE0("C'est n'est pas possible!\n");
+ m_ActiveThreads=0;
+ }
+ TRACE1("AC: %d\n",m_ActiveThreads);
+ if(m_ActiveThreads){
+ m_DragPad->m_DragNDropTarget.Play(0,(UINT)-1,(UINT)-1);
+ m_ClearListCtl.EnableWindow(FALSE);
+ }else{
+ m_DragPad->m_DragNDropTarget.Stop();
+ m_DragPad->m_DragNDropTarget.Seek(0);
+ if(m_HostList.GetItemCount())
+ m_ClearListCtl.EnableWindow(TRUE);
+ }
+ if(crement>0)
+ return 0;
+ UpdateDragpadTitle();
+int items = m_HostList.GetItemCount();
+ if((!CheckForPendingRequests()) && m_bAutoBest && items && !m_ActiveThreads){
+ // Come up with the best URL..
+ m_SortCriteria=sortAvg;
+ m_HostList.SortItems(CompareItems,(DWORD)this);
+ CPtrArray hs;
+ for(int tmp=0;tmp<items;tmp++){
+ CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
+ ASSERT(!host->m_Pinging);
+ ASSERT(host->m_Pinged);
+ if(host->m_Packetloss==100 || host->m_URL.IsEmpty())
+ continue;
+ hs.Add(host);
+ }
+ if(hs.GetSize()){
+ int item = 0;
+ if(!::PlaySound((LPCTSTR)IDW_BESTURL,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE))
+ MessageBeep(0xFFFFFFFF);
+ for(;;){
+ CPingyHost *host = (CPingyHost*)hs[item];
+ CAutoBestDlg abd;
+ abd.m_bPrev = (item>0);
+ abd.m_bNext = (item<hs.GetUpperBound());
+ abd.m_PktLoss.Format("%d%%",host->m_Packetloss);
+ abd.m_RTT.Format("%lu",host->m_AvgRTT);
+ abd.m_URL=host->m_URL;
+ int rv = abd.DoModal();
+ if(rv==IDOK){
+ ShellExecute(::GetDesktopWindow(),"open",host->m_URL,NULL,NULL,SW_SHOWMAXIMIZED);
+ CString title, text;
+ VERIFY(title.LoadString(IDS_ABEST_TITLE));
+ VERIFY(text.LoadString(IDS_ABEST_CLEANUP));
+ if(MessageBox(text,title,MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL)==IDYES)
+ OnClear();
+ break;
+ }else if(rv==IDCANCEL){
+ break;
+ }else if(rv==IDC_PREV){
+ item--;
+ ASSERT(item>=0);
+ }else if(rv==IDC_NEXT){
+ item++;
+ ASSERT(item<hs.GetSize());
+ }else
+ break;
+ }
+ }else{
+ CString title, text;
+ VERIFY(title.LoadString(IDS_ABEST_TITLE));
+ VERIFY(text.LoadString(IDS_ABEST_NONEFOUND));
+ MessageBox(text,title,MB_OK|MB_ICONEXCLAMATION|MB_APPLMODAL);
+ }
+ }
+ return 0;
+}
+
+LRESULT CDipstickDlg::OnUpdateHostData(WPARAM,LPARAM lP)
+{
+ TRACE0("UpdateHostData\n");
+CPingyHost *host = (CPingyHost*)lP;
+ ASSERT(host);
+ UpdatePingyHost(host);
+ UpdateDragpadTitle();
+ return 0;
+}
+
+int CALLBACK CDipstickDlg::CompareItems(LPARAM lp1, LPARAM lp2, LPARAM lp)
+{
+CDipstickDlg *dlg = (CDipstickDlg*)lp;
+CPingyHost *h1 = (CPingyHost*)lp1;
+CPingyHost *h2 = (CPingyHost*)lp2;
+ ASSERT(dlg);
+ ASSERT(h1);
+ ASSERT(h2);
+int criteria = dlg->m_SortCriteria;
+ switch(criteria){
+ case sortHost:
+ return h1->m_HostName.CompareNoCase(h2->m_HostName);
+ case sortIP:
+ return htonl(h1->m_IP)-htonl(h2->m_IP);
+ default:
+ if(h1->m_Pinged){
+ if(!h2->m_Pinged)
+ return -1;
+ if(h1->m_Packetloss==100){
+ if(h2->m_Packetloss!=100)
+ return 1;
+ return 0;
+ }else{
+ if(h2->m_Packetloss==100)
+ return -1;
+ }
+ }else{
+ if(h2->m_Pinged)
+ return 1;
+ break;
+ }
+ switch(criteria){
+ case sortMin:
+ return h1->m_MinRTT-h2->m_MinRTT;
+ case sortAvg:
+ return h1->m_AvgRTT-h2->m_AvgRTT;
+ case sortMax:
+ return h1->m_MaxRTT-h2->m_MaxRTT;
+ case sortLoss:
+ return h1->m_Packetloss-h2->m_Packetloss;
+ }
+ }
+ return 0;
+}
+
+void CDipstickDlg::OnColumnclickHostlist(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+ switch(pNMListView->iSubItem){
+ case subitemHost: m_SortCriteria=sortHost; break;
+ case subitemIP: m_SortCriteria=sortIP; break;
+ case subitemMin: m_SortCriteria=sortMin; break;
+ case subitemAvg: m_SortCriteria=sortAvg; break;
+ case subitemMax: m_SortCriteria=sortMax; break;
+ case subitemPacketloss: m_SortCriteria=sortLoss; break;
+ }
+ m_HostList.SortItems(CompareItems,(DWORD)this);
+ *pResult = 0;
+}
+
+BOOL CDipstickDlg::PreCreateWindow(CREATESTRUCT& cs)
+{
+ cs.style&=~WS_VISIBLE;
+ return CDialog::PreCreateWindow(cs);
+}
+
+void CDipstickDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
+{
+ CDialog::OnWindowPosChanging(lpwndpos);
+ if(!m_bExiting){
+ if(m_bShown){
+ lpwndpos->flags&=~SWP_HIDEWINDOW;
+ lpwndpos->flags|=SWP_SHOWWINDOW;
+ }else{
+ lpwndpos->flags&=~SWP_SHOWWINDOW;
+ lpwndpos->flags|=SWP_HIDEWINDOW;
+ }
+ }
+}
+
+void CDipstickDlg::OnDragpadOptions()
+{
+ OnOptions();
+}
+void CDipstickDlg::OnDragpadShowmainwindow()
+{
+ m_DragPad->ToggleMainWindowDisplay();
+}
+void CDipstickDlg::OnDragpadHelp()
+{
+ OnHelp();
+}
+void CDipstickDlg::OnDragpadAbout()
+{
+CAboutDlg dlgAbout;
+ dlgAbout.DoModal();
+}
+void CDipstickDlg::OnDragpadExit()
+{
+ // *** More threading-aware
+ OnOK();
+}
+
+int CDipstickDlg::CheckForPendingRequests()
+{
+static BOOL bChecking = FALSE;
+ if(bChecking)
+ return -1;
+ bChecking = TRUE;
+ TRACE1("CFPR: AC: %d\n",m_ActiveThreads);
+int newRequests = m_MaxThreads-m_ActiveThreads;
+POSITION p = m_Hosts.GetHeadPosition();
+int rv = 0;
+ while(newRequests>0 && p){
+ CPingyHost *host = m_Hosts.GetNext(p);
+ ASSERT(host);
+ if(host->m_Pinging)
+ continue;
+ if(!host->m_bToPing)
+ continue;
+ TRACE0("!");
+ host->Ping();
+ newRequests--;
+ rv++;
+ }
+ TRACE0("/CFPR\n");
+ bChecking = FALSE;
+ return rv;
+}
+
+void CAboutDlg::OnKlevernet()
+{
+CString url;
+ url.LoadString(IDS_KLEVERNET_URL);
+ ShellExecute(::GetDesktopWindow(),"open",url,NULL,NULL,SW_SHOWMAXIMIZED);
+}
+
+void CDipstickDlg::OnOK()
+{
+CWinApp *app = AfxGetApp();
+ ASSERT(app);
+ app->WriteProfileInt("Options","IntervalHi",HIWORD(m_Interval));
+ app->WriteProfileInt("Options","IntervalLo",LOWORD(m_Interval));
+ app->WriteProfileInt("Options","MaxThreads",m_MaxThreads);
+ app->WriteProfileInt("Options","PingSize",m_PingSize);
+ app->WriteProfileInt("Options","PingsPerHost",m_PingsPerHost);
+ app->WriteProfileInt("Options","SortBy",m_SortCriteria);
+ app->WriteProfileInt("Options","TimeOutHi",HIWORD(m_TimeOut));
+ app->WriteProfileInt("Options","TimeOutLo",LOWORD(m_TimeOut));
+ app->WriteProfileInt("Options","InnermostURL",m_bMSWorkAround);
+ app->WriteProfileInt("Options","AutoBest",m_bAutoBest);
+ app->WriteProfileInt("Options","SmartAdjust",m_bSmartAdjust);
+ app->WriteProfileInt("Options","AdjustInnermost",m_bAdjustInnermost);
+ app->WriteProfileInt("Options","IgnoreRelative",m_bIgnorelative);
+ app->WriteProfileString("Options","ImportExportPath",m_impexPath);
+CRect rc;
+ GetWindowRect(&rc);
+ app->WriteProfileInt("Windows","DlgTop",rc.top);
+ app->WriteProfileInt("Windows","DlgBottom",rc.bottom);
+ app->WriteProfileInt("Windows","DlgLeft",rc.left);
+ app->WriteProfileInt("Windows","DlgRight",rc.right);
+ m_DragPad->GetWindowRect(&rc);
+ app->WriteProfileInt("Windows","DragPadTop",rc.top);
+ app->WriteProfileInt("Windows","DragPadLeft",rc.left);
+ // Columns
+ app->WriteProfileInt("Columns","HostName",m_HostList.GetColumnWidth(0));
+ app->WriteProfileInt("Columns","HostIP",m_HostList.GetColumnWidth(1));
+ app->WriteProfileInt("Columns","MinRTT",m_HostList.GetColumnWidth(2));
+ app->WriteProfileInt("Columns","AvgRTT",m_HostList.GetColumnWidth(3));
+ app->WriteProfileInt("Columns","MaxRTT",m_HostList.GetColumnWidth(4));
+ app->WriteProfileInt("Columns","PktLoss",m_HostList.GetColumnWidth(5));
+ m_bExiting=TRUE;
+ CDialog::OnOK();
+}
+
+void CDipstickDlg::OnCancel()
+{
+}
+
+void CDipstickDlg::OnManualping()
+{
+CHostNameDlg hnd(this);
+ if(hnd.DoModal()==IDOK && !hnd.m_Host.IsEmpty()){
+ CString *host = new CString(hnd.m_Host);
+ ASSERT(host);
+ PostMessage(WM_DNP_URLPING,0,(LPARAM)host);
+ }
+}
+
+void CDipstickDlg::OnDragpadManualping()
+{
+ OnManualping();
+}
+
+void CDipstickDlg::OnDragpadRepingAll()
+{
+ OnRepingall();
+}
+void CDipstickDlg::OnDragpadRemoveAll()
+{
+ OnClear();
+}
+
+void CDipstickDlg::OnReping()
+{
+ if(!m_HostList.GetSelectedCount())
+ return;
+int items = m_HostList.GetItemCount();
+ for(int tmp=0;tmp<items;tmp++){
+ if(!(m_HostList.GetItemState(tmp,LVIS_SELECTED)&LVIS_SELECTED))
+ continue;
+ CPingyHost *host = (CPingyHost*) m_HostList.GetItemData(tmp);
+ ASSERT(host);
+ if(host->m_Pinged && !host->m_Pinging)
+ host->m_bToPing=TRUE;
+ }
+ UpdateDragpadTitle();
+ CheckForPendingRequests();
+}
+
+void CDipstickDlg::OnRepingall()
+{
+POSITION p = m_Hosts.GetHeadPosition();
+ while(p){
+ CPingyHost *host = m_Hosts.GetNext(p);
+ ASSERT(host);
+ if(host->m_Pinged && !host->m_Pinging)
+ host->m_bToPing=TRUE;
+ }
+ UpdateDragpadTitle();
+ CheckForPendingRequests();
+}
+
+void CDipstickDlg::OnClear()
+{
+ if(m_ActiveThreads)
+ return;
+ m_HostList.DeleteAllItems();
+ // *** Eventually move the following code to separate function
+POSITION p = m_Hosts.GetHeadPosition();
+ while(p){
+ POSITION pp = p;
+ CPingyHost *host = (CPingyHost*)m_Hosts.GetNext(p);
+ ASSERT(host);
+ m_Hosts.RemoveAt(pp);
+ host->Suicide();
+ }
+ ASSERT(m_Hosts.IsEmpty());
+ UpdateDragpadTitle();
+}
+
+void CDipstickDlg::OnInsertitemHostlist(NMHDR* pNMHDR, LRESULT* pResult)
+{
+NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+ m_RepingCtl.EnableWindow(TRUE);
+ m_RepingAllCtl.EnableWindow(TRUE);
+ UpdateDragpadTitle();
+ *pResult = 0;
+}
+
+void CDipstickDlg::OnDeleteitemHostlist(NMHDR* pNMHDR, LRESULT* pResult)
+{
+NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+ if(!m_HostList.GetItemCount()){
+ m_RepingCtl.EnableWindow(FALSE);
+ m_RepingAllCtl.EnableWindow(FALSE);
+ m_ClearListCtl.EnableWindow(FALSE);
+ }
+ UpdateDragpadTitle();
+ *pResult = 0;
+}
+
+void CDipstickDlg::OnDeleteallitemsHostlist(NMHDR* pNMHDR, LRESULT* pResult)
+{
+NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+ m_RepingCtl.EnableWindow(FALSE);
+ m_RepingAllCtl.EnableWindow(FALSE);
+ m_ClearListCtl.EnableWindow(FALSE);
+ UpdateDragpadTitle();
+ *pResult = 0;
+}
+
+void CDipstickDlg::OnExit()
+{
+ OnOK();
+}
+
+void CDipstickDlg::OnItemchangedHostlist(NMHDR* pNMHDR, LRESULT* pResult)
+{
+NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+ if(pNMListView->uChanged&LVIF_STATE && (pNMListView->uOldState&LVIS_SELECTED)!=(pNMListView->uNewState&LVIS_SELECTED))
+ UpdateControlButtons();
+ UpdateDragpadTitle();
+ *pResult = 0;
+}
+
+void CDipstickDlg::UpdateControlButtons()
+{
+int items = m_HostList.GetItemCount();
+ if(!items){
+ m_ClearListCtl.EnableWindow(FALSE);
+ m_RemoveCtl.EnableWindow(FALSE);
+ m_RepingAllCtl.EnableWindow(FALSE);
+ m_RepingCtl.EnableWindow(FALSE);
+ return;
+ }
+BOOL cl = m_ActiveThreads?FALSE:TRUE, rm = FALSE, ra = FALSE, rp = FALSE;
+ for(int tmp=0;tmp<items;tmp++){
+ CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
+ if(!host->m_Pinging){
+ ra=TRUE;
+ if(m_HostList.GetItemState(tmp,LVIS_SELECTED)&LVIS_SELECTED){
+ rp = TRUE;
+ rm = TRUE;
+ break;
+ }
+ }
+ }
+ m_ClearListCtl.EnableWindow(cl);
+ m_RemoveCtl.EnableWindow(rm);
+ m_RepingAllCtl.EnableWindow(ra);
+ m_RepingCtl.EnableWindow(rp);
+}
+
+void CDipstickDlg::OnRemove()
+{
+ if(!m_HostList.GetSelectedCount())
+ return;
+int items = m_HostList.GetItemCount();
+ for(int tmp=0;tmp<items;tmp++){
+ if(!(m_HostList.GetItemState(tmp,LVIS_SELECTED)&LVIS_SELECTED))
+ continue;
+ CPingyHost *host = (CPingyHost*) m_HostList.GetItemData(tmp);
+ ASSERT(host);
+ if(!host->m_Pinging)
+ RemovePingyHost(host,tmp);
+ }
+}
+
+void CDipstickDlg::OnRclickHostlist(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ if(!m_HostList.GetSelectedCount())
+ return;
+int items = m_HostList.GetItemCount();
+int item = -1;
+ for(int tmp=0;tmp<items;tmp++){
+ int s = m_HostList.GetItemState(tmp,LVIS_SELECTED|LVIS_FOCUSED);
+ if(s&LVIS_FOCUSED){
+ item = tmp;
+ break;
+ }
+ if(s&LVIS_SELECTED)
+ item=tmp;
+ }
+ ASSERT(item>=0);
+CPoint p;
+ VERIFY(m_HostList.GetItemPosition(item,&p));
+CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(item);
+ ASSERT(host);
+ m_HostList.ClientToScreen(&p);
+CMenu menus;
+ VERIFY(menus.LoadMenu(IDR_MENU));
+CMenu *popUp = menus.GetSubMenu(1);
+ ASSERT(popUp);
+ UpdateControlButtons();
+ popUp->EnableMenuItem(ID_HOSTLIST_REPING,MF_BYCOMMAND|(m_RepingCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
+ popUp->EnableMenuItem(ID_HOSTLIST_REMOVE,MF_BYCOMMAND|(m_RemoveCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
+ popUp->EnableMenuItem(ID_HOSTLIST_REMOVEALL,MF_BYCOMMAND|(m_ClearListCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
+ popUp->EnableMenuItem(ID_HOSTLIST_REPINGALL,MF_BYCOMMAND|(m_RepingAllCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
+ popUp->EnableMenuItem(ID_HOSTLIST_OPENURL,MF_BYCOMMAND|((m_HostList.GetSelectedCount()==1 && !host->m_URL.IsEmpty())?MF_ENABLED:MF_GRAYED));
+ popUp->EnableMenuItem(ID_HOSTLIST_COPYURL,MF_BYCOMMAND|((m_HostList.GetSelectedCount()==1 && !host->m_URL.IsEmpty())?MF_ENABLED:MF_GRAYED));
+ popUp->EnableMenuItem(ID_HOSTLIST_PROPERTIES,MF_BYCOMMAND|((m_HostList.GetSelectedCount()==1)?MF_ENABLED:MF_GRAYED));
+ popUp->EnableMenuItem(ID_HOSTLIST_PASTEURL,MF_BYCOMMAND|(IsPasteableClipboard()?MF_ENABLED:MF_GRAYED));
+ popUp->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_LEFTBUTTON,p.x,p.y,this);
+ *pResult = 0;
+}
+
+void CDipstickDlg::OnHostListReping()
+{
+ OnReping();
+}
+void CDipstickDlg::OnHostListRemove()
+{
+ OnRemove();
+}
+void CDipstickDlg::OnHostListRepingAll()
+{
+ OnRepingall();
+}
+void CDipstickDlg::OnHostListRemoveAll()
+{
+ OnClear();
+}
+void CDipstickDlg::OnHostListOpenURL()
+{
+ if(m_HostList.GetSelectedCount()!=1)
+ return;
+int items = m_HostList.GetItemCount();
+ for(int tmp=0;tmp<items;tmp++){
+ if((m_HostList.GetItemState(tmp,LVIS_SELECTED|LVIS_FOCUSED))&LVIS_SELECTED)
+ break;
+ }
+ ASSERT(tmp<items);
+CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
+ ASSERT(host);
+ if(!host->m_URL.IsEmpty())
+ ShellExecute(::GetDesktopWindow(),NULL,host->m_URL,NULL,NULL,SW_SHOWMAXIMIZED);
+}
+
+void CDipstickDlg::OnHostListProperties()
+{
+ if(m_HostList.GetSelectedCount()!=1)
+ return;
+int items = m_HostList.GetItemCount();
+ for(int tmp=0;tmp<items;tmp++){
+ if((m_HostList.GetItemState(tmp,LVIS_SELECTED|LVIS_FOCUSED))&LVIS_SELECTED)
+ break;
+ }
+ ASSERT(tmp<items);
+CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
+ ASSERT(host);
+CHostProperties hp(this);
+ hp.SetHost(host);
+ hp.DoModal();
+}
+
+void CDipstickDlg::OnDblclkHostlist(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ OnHostListOpenURL();
+ *pResult = 0;
+}
+
+void CDipstickDlg::OnClose()
+{
+ m_bShown=FALSE;
+ ShowWindow(SW_HIDE);
+}
+
+BOOL CAboutDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+ return TRUE;
+}
+
+void CDipstickDlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
+{
+ CDialog::OnGetMinMaxInfo(lpMMI);
+ if(m_MinSize.cx>0 && m_MinSize.cy>0){
+ lpMMI->ptMinTrackSize.x = m_MinSize.cx;
+ lpMMI->ptMinTrackSize.y = m_MinSize.cy;
+ }
+}
+
+void CDipstickDlg::OnSize(UINT nType, int cx, int cy)
+{
+ CDialog::OnSize(nType, cx, cy);
+ if(nType==SIZE_RESTORED)
+ RecalcLayout(cx,cy);
+}
+
+void CDipstickDlg::RecalcLayout(int,int)
+{
+CRect wrc;
+ GetClientRect(&wrc);
+CRect brc;
+ m_ManualPingCtl.GetWindowRect(&brc);
+ m_HostList.SetWindowPos(NULL,m_OverX,m_OverY,wrc.Width()-m_OverX*3-brc.Width(),wrc.Height()-m_OverY*2,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER);
+int xb = wrc.Width()-m_OverX-brc.Width();
+int cyb = brc.Height()+m_GapY;
+ m_ManualPingCtl.SetWindowPos(NULL,xb,m_OverY,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_RepingCtl.SetWindowPos(NULL,xb,m_OverY+cyb,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_RepingAllCtl.SetWindowPos(NULL,xb,m_OverY+cyb*2,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_RemoveCtl.SetWindowPos(NULL,xb,m_OverY+cyb*3,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_ClearListCtl.SetWindowPos(NULL,xb,m_OverY+cyb*4,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_AdvancedCtl.SetWindowPos(NULL,xb,m_OverY+cyb*5,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_ExitCtl.SetWindowPos(NULL,xb,wrc.Height()-m_OverY-brc.Height(),0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_OptionsCtl.SetWindowPos(NULL,xb,wrc.Height()-m_OverY-cyb-brc.Height(),0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_HelpCtl.SetWindowPos(NULL,xb,wrc.Height()-m_OverY-cyb*2-brc.Height(),0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+}
+
+void CDipstickDlg::OnHelp()
+{
+ WinHelp(0,HELP_FINDER);
+}
+
+void CDipstickDlg::UpdateDragpadTitle()
+{
+int ic = m_HostList.GetItemCount();
+CString title;
+ if(!ic){
+ VERIFY(title.LoadString(IDS_DRAGPAD_TITLE));
+ }else{
+ int ip = 0;
+ POSITION p = m_Hosts.GetHeadPosition();
+ while(p){
+ CPingyHost *host = m_Hosts.GetNext(p);
+ ASSERT(host);
+ if(!(host->m_Pinging || host->m_bToPing))
+ ip++;
+ }
+ title.Format(IDS_DRAGPAD_URLS,ip,ic);
+ }
+ if(m_DragPad)
+ m_DragPad->SetWindowText(title);
+}
+
+void CDipstickDlg::OnBegindragHostlist(NMHDR* pNMHDR, LRESULT* pResult)
+{
+ NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
+
+ if(pNMListView->iItem>=0){
+ CPingyHost *host = (CPingyHost*) m_HostList.GetItemData(pNMListView->iItem);
+ ASSERT(host);
+ if(!host->m_URL.IsEmpty()){
+ CURLSource us(host->m_URL);
+ us.DoDragDrop(DROPEFFECT_COPY|DROPEFFECT_LINK);
+ }
+ }
+
+ *pResult = 0;
+}
+
+void CDipstickDlg::OnPasteurl()
+{
+COleDataObject odo;
+ if(!odo.AttachClipboard())
+ return;
+ CollectURLs(&odo,FALSE);
+}
+
+BOOL CDipstickDlg::IsPasteableClipboard()
+{
+COleDataObject odo;
+ if(!odo.AttachClipboard())
+ return FALSE;
+ if(CollectURLs(&odo,TRUE))
+ return TRUE;
+ return FALSE;
+}
+
+BOOL CDipstickDlg::CollectURLs(COleDataObject* pDO,BOOL bTestOnly)
+{
+UINT cfURL = RegisterClipboardFormat("UniformResourceLocator");
+UINT cfHTML = RegisterClipboardFormat("HTML Format");
+UINT cfNIF = RegisterClipboardFormat("Netscape Image Format");
+ if(pDO->IsDataAvailable(cfURL)){
+ if(!bTestOnly){
+ HGLOBAL hg = pDO->GetGlobalData(cfURL);
+ ASSERT(hg);
+ LPVOID lpv = GlobalLock(hg);
+ ASSERT(lpv);
+ PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString((LPCTSTR)lpv));
+ GlobalUnlock(hg);
+ GlobalFree(hg);
+ }
+ return TRUE;
+ }
+ if(pDO->IsDataAvailable(cfHTML)){
+ HGLOBAL hg = pDO->GetGlobalData(cfHTML);
+ ASSERT(hg);
+ LPCTSTR lps = (LPCTSTR)GlobalLock(hg);
+ ASSERT(lps);
+ BOOL rv = FALSE;
+ do{
+ static LPCTSTR v10 = "Version:1.0\r\n";
+ if(memcmp(v10,lps,strlen(v10)))
+ break;
+ static LPCTSTR strStartSelection = "StartSelection:";
+ static LPCTSTR strEndSelection = "EndSelection:";
+ static LPCTSTR strSourceURL = "SourceURL:";
+ LPTSTR subs = strstr(lps,strStartSelection);
+ if(!subs)
+ break;
+ LONG startSelection = atol(&subs[strlen(strStartSelection)]);
+ if(!startSelection)
+ break;
+ if(!(subs=strstr(lps,strEndSelection)))
+ break;
+ LONG endSelection = atol(&subs[strlen(strEndSelection)]);
+ if(!endSelection)
+ break;
+ if(!(subs=strstr(lps,strSourceURL)))
+ break;
+ subs = &subs[strlen(strSourceURL)];
+ LPTSTR eol = strchr(subs,'\r');
+ if(!eol)
+ break;
+ (*eol)=0;
+ CString sourceURL = subs;
+ if(!sourceURL.GetLength())
+ break;
+ TRACE0("SourceURL = "+sourceURL+"\n");
+ _xferHTML* xf = new _xferHTML;
+ VERIFY(xf->src.Crack(sourceURL));
+ LPTSTR htmlBuff = xf->html.GetBuffer(endSelection-startSelection+2);
+ ASSERT(htmlBuff);
+ memmove(htmlBuff,&lps[startSelection],endSelection-startSelection+1);
+ htmlBuff[endSelection-startSelection+1]=0;
+ xf->html.ReleaseBuffer();
+ if(bTestOnly){
+ rv = m_reHTMLURL.Match(xf->html);
+ delete xf;
+ }else{
+ PostMessage(WM_DNP_HTML,0,(LPARAM)xf);
+ }
+ }while(FALSE);
+ GlobalUnlock(hg);
+ GlobalFree(hg);
+ return rv;
+ }
+ if(pDO->IsDataAvailable(cfNIF)){
+ if(!bTestOnly){
+ HGLOBAL hg = pDO->GetGlobalData(cfNIF);
+ ASSERT(hg);
+ LPVOID lpv = GlobalLock(hg);
+ ASSERT(lpv);
+ struct _nif {
+ BYTE data[0x20];
+ DWORD m_offDescr;
+ DWORD m_offURL;
+ DWORD m_offToImage;
+ } *nif = (_nif*)lpv;
+ PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString((LPCTSTR)&nif->data[nif->m_offURL]));
+ GlobalUnlock(hg);
+ GlobalFree(hg);
+ }
+ return TRUE;
+ }
+ if(pDO->IsDataAvailable(CF_TEXT)){
+ if(!bTestOnly){
+ HGLOBAL hg = pDO->GetGlobalData(CF_TEXT);
+ ASSERT(hg);
+ LPVOID lpv = GlobalLock(hg);
+ ASSERT(lpv);
+ PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString((LPCTSTR)lpv));
+ GlobalUnlock(hg);
+ GlobalFree(hg);
+ }
+ return TRUE;
+ }
+ return FALSE;
+}
+
+LRESULT CDipstickDlg::OnHTMLTransfer(WPARAM wP, LPARAM lP)
+{
+_xferHTML* xf = (_xferHTML*)lP;
+CSelectURLsDlg su;
+ su.m_bAdjust = m_bSmartAdjust;
+ su.m_bAdjustInnermost = m_bAdjustInnermost;
+ BeginWaitCursor();
+ while(m_reHTMLURL.Match(xf->html)){
+ CString url = m_reHTMLURL.GetMatch(1);
+ xf->html = m_reHTMLURL.GetMatch(CRegEx::matchPostMatch);
+ if(CCrackURL::GetHostName(url)==url){
+ if(m_bIgnorelative)
+ continue;
+ CCrackURL cracked;
+ VERIFY(cracked.Crack(url));
+ cracked.Adjust(xf->src);
+ url = cracked.Build();
+ }
+ if(!su.m_URLs.Find(url))
+ VERIFY(su.m_URLs.AddTail(url));
+ }
+ EndWaitCursor();
+ delete xf;
+ if(su.DoModal()==IDOK){
+ POSITION p = su.m_URLs.GetHeadPosition();
+ while(p){
+ CString url = su.m_URLs.GetNext(p);
+ PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString(url));
+ }
+ }
+ return 0;
+}
+
+UINT CPingyHost::PingProc(LPVOID pParam)
+{
+CPingyHost* pThis = (CPingyHost*)pParam;
+ ASSERT(pThis->m_Daddy);
+ return pThis->DoPing();
+}
+
+UINT CPingyHost::DoPing()
+{
+CSingleLock slock(&m_mutex);
+ if(!slock.Lock(2000)){
+ m_Status.LoadString(IDS_PS_FAILEDTOLOCK);
+ return 1;
+ }
+ m_Pinging = TRUE;
+ m_bToPing = FALSE;
+ VERIFY(m_Daddy->m_eveStartup.SetEvent());
+ m_Daddy->PostMessage(WM_DNP_UPDATEHOSTDATA,0,(LPARAM)this);
+in_addr ip;
+UINT packets, lost;
+ packets=lost=0;
+CICMP* pICMP = NULL;
+UINT dataSize = m_Daddy->m_PingSize;
+int ploss = 100;
+ do{
+ if(m_HostName.IsEmpty()){
+ ip.s_addr = m_IP;
+ hostent *he = gethostbyaddr((char*)&ip,4,PF_INET);
+ if(!he)
+ m_HostName.Empty();
+ else
+ m_HostName = he->h_name;
+ }else{
+ hostent *he = gethostbyname(m_HostName);
+ if(!he){
+ m_Status.LoadString(IDS_PS_FAILEDTORESOLVE);
+ m_IP = 0;
+ break;
+ }
+ memmove(&ip.s_addr,he->h_addr,sizeof(ip.s_addr));
+ m_IP = ip.s_addr;
+ }
+ pICMP = CICMP::CreateICMP();
+ if(!(pICMP && pICMP->Initialize())){
+ m_Status.LoadString(IDS_PS_UNABLETOICMP);
+ break;
+ }
+ m_Daddy->PostMessage(WM_DNP_UPDATEHOSTDATA,0,(LPARAM)this);
+ ULONG sum, num, pmin, pmax;
+ sum = num = 0;
+ pmin = 0xFFFFFFFF;
+ pmax = 0;
+ UINT seq;
+ for(seq = 0;seq<m_Daddy->m_PingsPerHost;seq++){
+ INT status;
+ LONG rtt = pICMP->Ping(ip,dataSize,m_Daddy->m_TimeOut,&status);
+ UINT stString = 0;
+ switch(status){
+ case CICMP::ipSuccess:
+ sum+=rtt; num++;
+ if(rtt<pmin)
+ pmin=rtt;
+ if(rtt>pmax)
+ pmax=rtt;
+ break;
+ case CICMP::ipBuffTooSmall: stString = IDS_PS_INTERNALERROR;
+ break;
+ case CICMP::ipDestNetUnreachable: stString = IDS_PS_NETUNREACHABLE;
+ break;
+ case CICMP::ipDestHostUnreachable: stString = IDS_PS_HOSTUNREACHABLE;
+ break;
+ case CICMP::ipDestProtUnreachable: stString = IDS_PS_PROTUNREACHABLE;
+ break;
+ case CICMP::ipDestPortUnreachable: stString = IDS_PS_PORTUNREACHABLE;
+ break;
+ case CICMP::ipNoResources: stString = IDS_PS_NORESOURCES;
+ break;
+ case CICMP::ipBadOption: stString = IDS_PS_INTERNALERROR;
+ break;
+ case CICMP::ipHWError: stString = IDS_PS_HWERROR;
+ break;
+ case CICMP::ipPacketTooBig: stString = IDS_PS_BIGPACKET;
+ break;
+ case CICMP::ipTimeOut: stString = IDS_PS_TIMEOUT;
+ break;
+ case CICMP::ipBadRequest: stString = IDS_PS_INTERNALERROR;
+ break;
+ case CICMP::ipBadRoute: stString = IDS_PS_BADROUTE;
+ break;
+ case CICMP::ipTTLExpiredInTransit: stString = IDS_PS_TTLEXPTRANSIT;
+ break;
+ case CICMP::ipTTLExpiredInReasm: stString = IDS_PS_TTLEXPREASM;
+ break;
+ case CICMP::ipParamProblem: stString = IDS_PS_IPARAMP;
+ break;
+ case CICMP::ipSourceQuench: stString = IDS_PS_SOURCEQUENCH;
+ break;
+ case CICMP::ipOptionTooBig: stString = IDS_PS_BIGOPTION;
+ break;
+ case CICMP::ipBadDest: stString = IDS_PS_BADDEST;
+ break;
+ default:
+ stString = IDS_PS_UNKNOWNERROR;
+ break;
+ }
+ if(stString)
+ m_Status.LoadString(stString);
+ packets++;
+ if(rtt<0)
+ lost++;
+ Sleep(m_Daddy->m_Interval);
+ }
+ if(packets==lost || !packets){
+ ploss=100;
+ }else{
+ ploss = lost*100/packets;
+ m_MinRTT = pmin;
+ m_MaxRTT = pmax;
+ if(sum){
+ ASSERT(num);
+ m_AvgRTT = sum/num;
+ }else{
+ m_AvgRTT = 0;
+ }
+ }
+ }while(FALSE);
+ m_Packetloss=ploss;
+ m_Pinged=TRUE;
+ m_Pinging=FALSE;
+ if(pICMP){
+ pICMP->Deinitialize();
+ delete pICMP;
+ }
+ m_Daddy->PostMessage(WM_DNP_UPDATEHOSTDATA,0,(LPARAM)this);
+ m_Daddy->PostMessage(WM_DNP_ACTIVITYCOUNT,(WPARAM)-1);
+ return 0;
+}
+
+void CPingyHost::Ping()
+{
+ ASSERT(m_Daddy);
+ m_Daddy->m_eveStartup.ResetEvent();
+ if(!AfxBeginThread(CPingyHost::PingProc,this)){
+ ASSERT(FALSE);
+ }else{
+ CSingleLock sl(&m_Daddy->m_eveStartup);
+ sl.Lock();
+ m_Daddy->SendMessage(WM_DNP_ACTIVITYCOUNT,(WPARAM)1); // *** AWFUL! Shouldn't be here!
+ }
+}
+
+void CDipstickDlg::OnHostlistCopyurl()
+{
+ if(m_HostList.GetSelectedCount()!=1)
+ return;
+int items = m_HostList.GetItemCount();
+ for(int tmp=0;tmp<items;tmp++){
+ if((m_HostList.GetItemState(tmp,LVIS_SELECTED|LVIS_FOCUSED))&LVIS_SELECTED)
+ break;
+ }
+ ASSERT(tmp<items);
+CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
+ ASSERT(host);
+ if(!host->m_URL.IsEmpty()){
+ CURLSource *us = new CURLSource(host->m_URL);
+ us->SetClipboard();
+ us->FlushClipboard();
+ }
+}
+
+BOOL CDipstickDlg::OnHelpInfo(HELPINFO* pHelpInfo)
+{
+ WinHelp(IDD|0x20000l);
+ return TRUE;
+}
+
+void CDipstickDlg::OnDropFiles(HDROP hDropInfo)
+{
+ // *** Import only 1st file, but maybe we should fall into prompt mode if multiple files are dropped.
+CString fileName;
+int bufferSize = DragQueryFile(hDropInfo,0,NULL,0);
+ DragQueryFile(hDropInfo,0,fileName.GetBuffer(bufferSize+2),bufferSize+1);
+ fileName.ReleaseBuffer();
+ if(fileName.IsEmpty())
+ CDialog::OnDropFiles(hDropInfo);
+ else
+ ImportLocations(fileName);
+}
+
+BOOL CDipstickDlg::ImportLocations(LPCTSTR file)
+{
+CString fileLine;
+CString q;
+ try{
+ CStdioFile f(file,CFile::modeRead|CFile::typeText|CFile::shareDenyWrite);
+ // *** Cleanup locations..
+ while(f.ReadString(fileLine)){
+ if(fileLine.IsEmpty())
+ continue;
+ if(fileLine[0]=='\"' || fileLine[0]=='\''){
+ TCHAR q = fileLine[0];
+ fileLine=fileLine.Mid(1);
+ for(int tmp=0;tmp<fileLine.GetLength();tmp++){
+ if(fileLine[tmp]!=q)
+ continue;
+ if(!tmp){
+ fileLine.Empty();
+ break;
+ }
+ fileLine=fileLine.Left(tmp);
+ break;
+ }
+ }else{
+ int co = fileLine.Find(',');
+ if(co>=0)
+ fileLine=fileLine.Left(co);
+ }
+ if(fileLine.IsEmpty())
+ continue;
+ if(!fileLine.CompareNoCase("url"))
+ continue;
+ PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString(fileLine));
+ }
+ }catch(CException* e){
+ e->Delete();
+ TRACE0("Failed to import URLList file\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void CDipstickDlg::OnAdvanced()
+{
+CRect rc;
+ m_AdvancedCtl.GetClientRect(rc);
+ m_AdvancedCtl.ClientToScreen(rc);
+CMenu menus;
+ VERIFY(menus.LoadMenu(IDR_MENU));
+CMenu *popUp = menus.GetSubMenu(2);
+ ASSERT(popUp);
+ popUp->EnableMenuItem(ID_ADVANCED_EXPORTLIST,MF_BYCOMMAND|(m_HostList.GetItemCount()?MF_ENABLED:MF_GRAYED));
+ popUp->TrackPopupMenu(TPM_CENTERALIGN|TPM_RIGHTBUTTON|TPM_LEFTBUTTON,(rc.left+rc.right)/2,rc.top,this);
+}
+
+void CDipstickDlg::OnAdvancedExportlist()
+{
+CString filter;
+ filter.LoadString(IDS_CSVFILTER);
+CFileDialog cfd(FALSE,".csv",NULL,OFN_EXPLORER|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST,filter,this);
+ if(!m_impexPath.IsEmpty())
+ SetCurrentDirectory(m_impexPath);
+ if(cfd.DoModal()==IDOK){
+ GetCurrentDirectory(2048,m_impexPath.GetBuffer(2048));
+ m_impexPath.ReleaseBuffer();
+ ExportLocations(cfd.GetPathName());
+ }
+}
+
+void CDipstickDlg::OnAdvancedImportlist()
+{
+CString filter;
+ filter.LoadString(IDS_CSVFILTER);
+CFileDialog cfd(TRUE,".csv",NULL,OFN_EXPLORER|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST,filter,this);
+ if(!m_impexPath.IsEmpty())
+ SetCurrentDirectory(m_impexPath);
+ if(cfd.DoModal()==IDOK){
+ GetCurrentDirectory(2048,m_impexPath.GetBuffer(2048));
+ m_impexPath.ReleaseBuffer();
+ ImportLocations(cfd.GetPathName());
+ }
+}
+
+BOOL CDipstickDlg::ExportLocations(LPCTSTR file)
+{
+ try{
+ CStdioFile f(file,CFile::modeCreate|CFile::modeWrite|CFile::typeText);
+ f.WriteString("URL,Host Name,IP Address, Min RTT,Avg RTT,Max RTT,Pktloss\n");
+ POSITION p = m_Hosts.GetHeadPosition();
+ while(p){
+ CPingyHost *host = m_Hosts.GetNext(p);
+ ASSERT(host);
+ CString ph;
+ ph.Format("\"%s\",%s,%s,%lu,%lu,%lu,%d%%\n",host->m_URL,host->m_HostName,inet_ntoa(*(in_addr*)&host->m_IP),
+ host->m_MinRTT,host->m_AvgRTT,host->m_MaxRTT,host->m_Packetloss
+ );
+ f.WriteString(ph);
+ }
+ f.Close();
+ }catch(CException* e){
+ TRACE0("Failed to export URLList\n");
+ e->Delete();
+ return FALSE;
+ }
+ return TRUE;
+}
+
+void CDipstickDlg::OnDragpadAdvancedExportlist()
+{
+ OnAdvancedExportlist();
+}
+
+void CDipstickDlg::OnDragpadAdvancedImportlist()
+{
+ OnAdvancedImportlist();
+}
+
+void CPingyHost::Suicide()
+{
+CSingleLock sl(&m_mutex);
+ if(sl.Lock(10)){
+ sl.Unlock();
+ delete this;
+ }else{
+ if(!AfxBeginThread(CPingyHost::SuicideProc,this))
+ ASSERT(FALSE);
+ }
+}
+
+UINT CPingyHost::SuicideProc(LPVOID pParam)
+{
+CPingyHost* pThis = (CPingyHost*)pParam;
+CSingleLock sl(&pThis->m_mutex);
+ sl.Lock();
+ VERIFY(sl.Unlock());
+ delete pThis;
+ return 0;
+}
diff --git a/DipstickDlg.h b/DipstickDlg.h
new file mode 100644
index 0000000..ce9ed22
--- a/dev/null
+++ b/DipstickDlg.h
@@ -0,0 +1,184 @@
+// DipstickDlg.h : header file
+//
+
+class CDipstickDlg;
+struct CPingyHost {
+ CPingyHost(CDipstickDlg* daddy) : m_IP(0), m_MinRTT(0), m_AvgRTT(0), m_MaxRTT(0), m_Pinged(FALSE), m_Pinging(FALSE), m_Packetloss(-1), m_bToPing(TRUE), m_Daddy(daddy) {}
+ CPingyHost(CDipstickDlg* daddy,LPTSTR hostname) : m_HostName(hostname), m_IP(0), m_MinRTT(0), m_AvgRTT(0), m_MaxRTT(0), m_Pinged(FALSE), m_Pinging(FALSE), m_Packetloss(-1), m_bToPing(TRUE), m_Daddy(daddy) {}
+ CPingyHost(CDipstickDlg* daddy,LPTSTR hostname,DWORD ip) : m_HostName(hostname), m_IP(ip), m_MinRTT(0), m_AvgRTT(0), m_MaxRTT(0), m_Pinged(FALSE), m_Pinging(FALSE), m_Packetloss(-1), m_bToPing(TRUE), m_Daddy(daddy) {}
+ CPingyHost(CDipstickDlg* daddy,DWORD ip) : m_IP(ip), m_MinRTT(0), m_AvgRTT(0), m_MaxRTT(0), m_Pinged(FALSE), m_Pinging(FALSE), m_Packetloss(-1), m_bToPing(TRUE), m_Daddy(daddy) {}
+public:
+ static UINT SuicideProc(LPVOID pParam);
+ void Suicide();
+ void Ping();
+ UINT DoPing();
+ static UINT PingProc(LPVOID);
+ CDipstickDlg* m_Daddy;
+ CMutex m_mutex;
+ CString m_Descr;
+ CString m_URL;
+ BOOL m_bToPing;
+ BOOL m_Pinging;
+ CString m_HostName;
+ CString m_Status;
+ DWORD m_IP;
+ ULONG m_MinRTT;
+ ULONG m_AvgRTT;
+ ULONG m_MaxRTT;
+ BOOL m_Pinged;
+ int m_Packetloss;
+};
+
+typedef CList<CPingyHost*,CPingyHost*> CHostList;
+
+/////////////////////////////////////////////////////////////////////////////
+// CDipstickDlg dialog
+
+class CDragPad;
+class CDipstickDlg : public CDialog
+{
+// Construction
+ struct _xferHTML {
+ CString html;
+ CCrackURL src;
+ };
+public:
+ BOOL ExportLocations(LPCTSTR file);
+ CString m_impexPath;
+ BOOL ImportLocations(LPCTSTR file);
+ BOOL m_bIgnorelative;
+ CEvent m_eveStartup;
+ UINT volatile m_ActiveThreads;
+ BOOL m_bAdjustInnermost;
+ BOOL m_bSmartAdjust;
+ BOOL CollectURLs(COleDataObject* pDO,BOOL bTestOnly=FALSE);
+ BOOL IsPasteableClipboard();
+ void UpdateDragpadTitle();
+ BOOL m_bAutoBest;
+ void RecalcLayout(int cx,int cy);
+ CSize m_MinSize;
+ UINT m_GapY;
+ UINT m_OverY;
+ UINT m_OverX;
+ BOOL m_bMSWorkAround;
+ CRegEx m_reCrackHost;
+ CRegEx m_reNestedURL;
+ CRegEx m_reHTMLURL; // 1 - URL
+ CRegEx m_reCrackURL; // 3 - schema, 4 - host, 5 - path, 7 - query string
+ BITMAP m_bitmapBack;
+ CBitmap m_bmpBack;
+ int m_iUnreachable;
+ int m_iCompleted;
+ int m_iPinging;
+ int m_iPending;
+ CImageList m_Images;
+ void UpdateControlButtons();
+ BOOL m_bExiting;
+ int CheckForPendingRequests();
+ UINT m_MaxThreads;
+ BOOL m_bShown;
+ enum {
+ sortHost, sortIP, sortMin, sortAvg, sortMax, sortLoss
+ };
+ int m_SortCriteria;
+ static int CALLBACK CompareItems(LPARAM lp1, LPARAM lp2, LPARAM lp);
+ DWORD m_Interval;
+ BOOL RemovePingyHost(CPingyHost *host,int index=-1);
+ BOOL UpdatePingyHost(CPingyHost *host,int index=-1);
+ BOOL AddPingyHost(CPingyHost *host);
+ CHostList m_Hosts;
+ enum {
+ subitemHost = 0, subitemIP, subitemMin,subitemAvg,subitemMax, subitemPacketloss
+ };
+ DWORD m_TimeOut;
+ UINT m_PingSize;
+ UINT m_PingsPerHost;
+ CDragPad * m_DragPad;
+ ~CDipstickDlg();
+ CDipstickDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CDipstickDlg)
+ enum { IDD = IDD_DIPSTICK_DIALOG };
+ CButton m_AdvancedCtl;
+ CButton m_HelpCtl;
+ CButton m_ExitCtl;
+ CButton m_OptionsCtl;
+ CButton m_ManualPingCtl;
+ CButton m_RemoveCtl;
+ CButton m_RepingAllCtl;
+ CButton m_RepingCtl;
+ CButton m_ClearListCtl;
+ CListCtrl m_HostList;
+ //}}AFX_DATA
+
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CDipstickDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ HICON m_hIcon;
+
+ // Generated message map functions
+ //{{AFX_MSG(CDipstickDlg)
+ virtual BOOL OnInitDialog();
+ afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ afx_msg void OnDestroy();
+ afx_msg void OnOptions();
+ afx_msg LRESULT OnUrlPing(WPARAM,LPARAM);
+ afx_msg LRESULT OnActivityCount(WPARAM,LPARAM);
+ afx_msg LRESULT OnUpdateHostData(WPARAM,LPARAM);
+ afx_msg LRESULT OnHTMLTransfer(WPARAM,LPARAM);
+ afx_msg void OnColumnclickHostlist(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
+ afx_msg void OnDragpadOptions();
+ afx_msg void OnDragpadShowmainwindow();
+ afx_msg void OnDragpadHelp();
+ afx_msg void OnDragpadAbout();
+ afx_msg void OnDragpadExit();
+ virtual void OnOK();
+ virtual void OnCancel();
+ afx_msg void OnManualping();
+ afx_msg void OnDragpadManualping();
+ afx_msg void OnDragpadRepingAll();
+ afx_msg void OnDragpadRemoveAll();
+ afx_msg void OnReping();
+ afx_msg void OnRepingall();
+ afx_msg void OnClear();
+ afx_msg void OnInsertitemHostlist(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnDeleteitemHostlist(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnDeleteallitemsHostlist(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnExit();
+ afx_msg void OnItemchangedHostlist(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnRemove();
+ afx_msg void OnRclickHostlist(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnHostListReping();
+ afx_msg void OnHostListRemove();
+ afx_msg void OnHostListRepingAll();
+ afx_msg void OnHostListRemoveAll();
+ afx_msg void OnHostListOpenURL();
+ afx_msg void OnHostListProperties();
+ afx_msg void OnDblclkHostlist(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnClose();
+ afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnHelp();
+ afx_msg void OnBegindragHostlist(NMHDR* pNMHDR, LRESULT* pResult);
+ afx_msg void OnPasteurl();
+ afx_msg void OnHostlistCopyurl();
+ afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
+ afx_msg void OnDropFiles(HDROP hDropInfo);
+ afx_msg void OnAdvanced();
+ afx_msg void OnAdvancedExportlist();
+ afx_msg void OnAdvancedImportlist();
+ afx_msg void OnDragpadAdvancedExportlist();
+ afx_msg void OnDragpadAdvancedImportlist();
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/DragPad.cpp b/DragPad.cpp
new file mode 100644
index 0000000..9b0aa31
--- a/dev/null
+++ b/DragPad.cpp
@@ -0,0 +1,213 @@
+// DragPad.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Dipstick.h"
+#include "DragPad.h"
+#include "DipstickDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CDragPad dialog
+
+
+CDragPad::CDragPad(CWnd* pParent /*=NULL*/)
+ : CDialog(CDragPad::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CDragPad)
+ //}}AFX_DATA_INIT
+ m_DropTarget.m_Pad = this;
+}
+
+CDragPad::~CDragPad()
+{
+}
+
+void CDragPad::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CDragPad)
+ DDX_Control(pDX, IDC_DNDTARGET, m_DragNDropTarget);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CDragPad, CDialog)
+ //{{AFX_MSG_MAP(CDragPad)
+ ON_WM_WINDOWPOSCHANGED()
+ ON_WM_NCACTIVATE()
+ ON_WM_DESTROY()
+ ON_WM_CREATE()
+ ON_WM_LBUTTONDBLCLK()
+ ON_WM_RBUTTONDOWN()
+ ON_WM_LBUTTONDOWN()
+ ON_WM_HELPINFO()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDragPad message handlers
+
+BOOL CDragPad::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ m_DropTarget.Register(&m_DragNDropTarget);
+ m_DragNDropTarget.Open(IDR_DNDAVI);
+CRect rc;
+ m_DragNDropTarget.GetClientRect(rc);
+ m_DragNDropTarget.MoveWindow(rc,FALSE);
+CRect wrc,crc,drc, nrc;
+ GetWindowRect(wrc);
+ GetClientRect(crc);
+ GetDesktopWindow()->GetClientRect(drc);
+ nrc.left = drc.right-(rc.Width()+(wrc.Width()-crc.Width())) - 5;
+ nrc.top = drc.bottom-(rc.Height()+(wrc.Height()-crc.Height())) - 5;
+CWinApp *app = AfxGetApp();
+ ASSERT(app);
+ ScreenToClient(nrc);
+ nrc.top=app->GetProfileInt("Windows","DragPadTop",nrc.top);
+ nrc.left=app->GetProfileInt("Windows","DragPadLeft",nrc.left);
+ nrc.right = nrc.left+(rc.Width()+(wrc.Width()-crc.Width()));
+ nrc.bottom = nrc.top+(rc.Height()+(wrc.Height()-crc.Height()));
+ MoveWindow(nrc,FALSE);
+
+ // CG: The following block was added by the ToolTips component.
+ {
+ // Create the ToolTip control.
+ m_tooltip.Create(this);
+ m_tooltip.Activate(TRUE);
+ }
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CDragPad::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
+{
+ CDialog::OnWindowPosChanged(lpwndpos);
+ if(lpwndpos->hwnd!=m_hWnd)
+ SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
+}
+
+BOOL CDragPad::PreCreateWindow(CREATESTRUCT& cs)
+{
+ cs.dwExStyle|=WS_EX_TOPMOST;
+ return CDialog::PreCreateWindow(cs);
+}
+
+BOOL CDragPad::OnNcActivate(BOOL bActive)
+{
+ if(!bActive)
+ SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
+ return CDialog::OnNcActivate(bActive);
+}
+
+void CDragPad::OnDestroy()
+{
+ CDialog::OnDestroy();
+ TRACE0("DestroyPad\n");
+ RevokeDragDrop(m_DragNDropTarget.m_hWnd);
+}
+
+int CDragPad::OnCreate(LPCREATESTRUCT lpCreateStruct)
+{
+ if (CDialog::OnCreate(lpCreateStruct) == -1)
+ return -1;
+CRect rc,drc, nrc;
+CWinApp *app = AfxGetApp();
+ ASSERT(app);
+ GetWindowRect(rc);
+ GetDesktopWindow()->GetClientRect(drc);
+ nrc.left = drc.right-rc.Width() - 5;
+ nrc.top = drc.bottom-rc.Height() - 5;
+ ScreenToClient(nrc);
+ nrc.top=app->GetProfileInt("Windows","DragPadTop",nrc.top);
+ nrc.left=app->GetProfileInt("Windows","DragPadLeft",nrc.left);
+ nrc.right = nrc.left+rc.Width();
+ nrc.bottom = nrc.top+rc.Height();
+ MoveWindow(nrc);
+ return 0;
+}
+
+void CDragPad::OnLButtonDblClk(UINT nFlags, CPoint point)
+{
+ ToggleMainWindowDisplay();
+ CDialog::OnLButtonDblClk(nFlags, point);
+}
+
+void CDragPad::OnRButtonDown(UINT nFlags, CPoint point)
+{
+CMenu menus;
+ VERIFY(menus.LoadMenu(IDR_MENU));
+CMenu *dpm = menus.GetSubMenu(0); // *** Position?
+ ASSERT(dpm);
+CPoint pt = point;
+ ClientToScreen(&pt);
+ m_Daddy->UpdateControlButtons();
+ dpm->CheckMenuItem(ID_DRAGPAD_SHOWMAINWINDOW,MF_BYCOMMAND|(m_Daddy->m_bShown?MF_CHECKED:MF_UNCHECKED));
+ dpm->EnableMenuItem(ID_DRAGPAD_REPINGALL,MF_BYCOMMAND|(m_Daddy->m_RepingAllCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
+ dpm->EnableMenuItem(ID_DRAGPAD_REMOVEALL,MF_BYCOMMAND|(m_Daddy->m_ClearListCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
+ dpm->EnableMenuItem(ID_DRAGPAD_PASTEURL,MF_BYCOMMAND|(m_Daddy->IsPasteableClipboard()?MF_ENABLED:MF_GRAYED));
+ dpm->EnableMenuItem(ID_DRAGPAD_ADVANCED_EXPORTLIST,MF_BYCOMMAND|(m_Daddy->m_HostList.GetItemCount()?MF_ENABLED:MF_GRAYED));
+ dpm->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,m_Daddy,NULL);
+ CDialog::OnRButtonDown(nFlags, point);
+}
+
+void CDragPad::OnLButtonDown(UINT nFlags, CPoint point)
+{
+ ToggleMainWindowDisplay();
+ CDialog::OnLButtonDown(nFlags, point);
+}
+
+void CDragPad::ToggleMainWindowDisplay()
+{
+ if(m_Daddy->IsWindowVisible()){
+ m_Daddy->m_bShown=FALSE;
+ m_Daddy->ShowWindow(SW_HIDE);
+ }else{
+ m_Daddy->m_bShown=TRUE;
+ m_Daddy->ShowWindow(SW_SHOW);
+ }
+}
+
+BOOL CDragPad::PreTranslateMessage(MSG* pMsg)
+{
+ // CG: The following block was added by the ToolTips component.
+ {
+ // Let the ToolTip process this message.
+ m_tooltip.RelayEvent(pMsg);
+
+ return CDialog::PreTranslateMessage(pMsg);
+ }
+}
+
+DROPEFFECT CDUTarget::OnDragEnter(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt)
+{
+ if(m_Pad->m_Daddy->CollectURLs(pDO,TRUE))
+ return m_dropAsEntered=DROPEFFECT_LINK|DROPEFFECT_COPY|DROPEFFECT_MOVE;
+ else
+ return m_dropAsEntered=DROPEFFECT_NONE;
+}
+DROPEFFECT CDUTarget::OnDragOver(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt)
+{
+ return m_dropAsEntered;
+}
+DROPEFFECT CDUTarget::OnDropEx(CWnd* pWnd,COleDataObject* pDO,DROPEFFECT dropDefault,DROPEFFECT dropList,CPoint pt)
+{
+ if(m_Pad->m_Daddy->CollectURLs(pDO,FALSE))
+ return DROPEFFECT_LINK|DROPEFFECT_COPY|DROPEFFECT_MOVE;
+ else
+ return DROPEFFECT_NONE;
+}
+
+BOOL CDragPad::OnHelpInfo(HELPINFO* pHelpInfo)
+{
+ WinHelp(IDD|0x20000l);
+ return TRUE;
+}
diff --git a/DragPad.h b/DragPad.h
new file mode 100644
index 0000000..b5f67f2
--- a/dev/null
+++ b/DragPad.h
@@ -0,0 +1,62 @@
+// DragPad.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CDragPad dialog
+
+class CDragPad;
+class CDUTarget : public COleDropTarget {
+public:
+ CDragPad* m_Pad;
+ DROPEFFECT m_dropAsEntered;
+
+ virtual DROPEFFECT OnDragEnter(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt);
+ virtual DROPEFFECT OnDragOver(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt);
+ virtual DROPEFFECT OnDropEx(CWnd* pWnd,COleDataObject* pDO,DROPEFFECT dropDefault,DROPEFFECT dropList,CPoint pt);
+};
+
+class CDipstickDlg;
+class CDragPad : public CDialog
+{
+// Construction
+public:
+ CDUTarget m_DropTarget;
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+ void ToggleMainWindowDisplay();
+ CDipstickDlg *m_Daddy;
+ ~CDragPad();
+ CDragPad(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CDragPad)
+ enum { IDD = IDD_DRAGPAD };
+ CAnimateCtrl m_DragNDropTarget;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CDragPad)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ CToolTipCtrl m_tooltip;
+
+ // Generated message map functions
+ //{{AFX_MSG(CDragPad)
+ virtual BOOL OnInitDialog();
+ afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
+ afx_msg BOOL OnNcActivate(BOOL bActive);
+ afx_msg void OnDestroy();
+ afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
+ afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
+ afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
+ afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
+ afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/DropURL.cpp b/DropURL.cpp
new file mode 100644
index 0000000..9394889
--- a/dev/null
+++ b/DropURL.cpp
@@ -0,0 +1,149 @@
+// DropURL.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Dipstick.h"
+#include "DropURL.h"
+#include "DragPad.h"
+#include "Dipstick.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CDropURL
+
+IMPLEMENT_DYNCREATE(CDropURL, CCmdTarget)
+
+CDropURL::CDropURL()
+ : m_Pad(NULL)
+{
+}
+
+CDropURL::~CDropURL()
+{
+}
+
+
+BEGIN_MESSAGE_MAP(CDropURL, CCmdTarget)
+ //{{AFX_MSG_MAP(CDropURL)
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+BEGIN_INTERFACE_MAP(CDropURL, CCmdTarget)
+ INTERFACE_PART(CDropURL, IID_IDropTarget, DDropTarget)
+END_INTERFACE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDropURL message handlers
+
+STDMETHODIMP_(ULONG) CDropURL::XDDropTarget::AddRef()
+{
+ METHOD_PROLOGUE(CDropURL, DDropTarget)
+ return pThis->ExternalAddRef();
+}
+STDMETHODIMP_(ULONG) CDropURL::XDDropTarget::Release()
+{
+ METHOD_PROLOGUE(CDropURL, DDropTarget)
+ return pThis->ExternalRelease();
+}
+STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::QueryInterface(REFIID iid,void FAR* FAR * ppvObj)
+{
+ METHOD_PROLOGUE(CDropURL, DDropTarget)
+ return pThis->ExternalQueryInterface(&iid,ppvObj);
+}
+
+STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::DragEnter(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
+{
+ METHOD_PROLOGUE(CDropURL, DDropTarget)
+ TRACE0("DragEnter\n");
+ return pThis->DragEnter(pDataObject,grfKeyState,pt,pdwEffect);
+}
+STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::DragOver(DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
+{
+ METHOD_PROLOGUE(CDropURL, DDropTarget)
+ return S_OK;
+}
+STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::DragLeave(void)
+{
+ METHOD_PROLOGUE(CDropURL, DDropTarget)
+ TRACE0("DragLeave\n");
+ return S_OK;
+}
+STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::Drop(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
+{
+ METHOD_PROLOGUE(CDropURL, DDropTarget)
+ TRACE0("Drop\n");
+ return pThis->Drop(pDataObject,grfKeyState,pt,pdwEffect);
+}
+
+
+HRESULT CDropURL::DragEnter(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
+{
+CString host = GetHostName(pDataObject);
+ if(host.IsEmpty()){
+ (*pdwEffect)=DROPEFFECT_NONE;
+ return S_FALSE;
+ }else{
+ (*pdwEffect)=DROPEFFECT_LINK;
+ return S_OK;
+ }
+}
+
+CString CDropURL::GetHostName(IDataObject *pDataObject,CString *_url)
+{
+FORMATETC fetc;
+ fetc.cfFormat=CF_TEXT;
+ fetc.ptd=NULL;
+ fetc.dwAspect=DVASPECT_CONTENT;
+ fetc.lindex=-1;
+ fetc.tymed=TYMED_HGLOBAL;
+STGMEDIUM stgm;
+LPVOID globe = NULL;
+CString url;
+CString rv;
+ stgm.pUnkForRelease=NULL;
+ do{
+ if(pDataObject->GetData(&fetc,&stgm)!=S_OK)
+ break;
+ ASSERT(stgm.tymed==TYMED_HGLOBAL);
+ if(GlobalSize(stgm.hGlobal)>=1024)
+ break;
+ VERIFY(globe=GlobalLock(stgm.hGlobal));
+ url=(LPTSTR)globe;
+ TRACE0("["+url+"]\n");
+ if(_url)
+ (*_url) = url;
+ rv = m_Pad->m_Daddy->GetHostName(url);
+ }while(FALSE);
+ if(globe)
+ GlobalUnlock(stgm.hGlobal);
+ if(stgm.pUnkForRelease)
+ stgm.pUnkForRelease->Release();
+ return rv;
+}
+
+HRESULT CDropURL::Drop(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pwdEffect)
+{
+CString url;
+CString host = GetHostName(pDataObject,&url);
+ if(host.IsEmpty())
+ return S_FALSE;
+#ifdef TRUE
+ // URL Mode
+CString *u = new CString(url);
+ m_Pad->m_Daddy->PostMessage(WM_DNP_URLPING,0,(LPARAM)u);
+#else
+CString *hn = new CString(host);
+ m_Pad->m_Daddy->PostMessage(WM_DNP_HOSTPING,0,(LPARAM)hn);
+#endif
+ return S_OK;
+}
+void CDropURL::OnFinalRelease()
+{
+ TRACE0("Final Release\n");
+ CCmdTarget::OnFinalRelease();
+}
diff --git a/DropURL.h b/DropURL.h
new file mode 100644
index 0000000..2f72cd2
--- a/dev/null
+++ b/DropURL.h
@@ -0,0 +1,54 @@
+// DropURL.h : header file
+//
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// CDropURL command target
+
+class CDragPad;
+class CDropURL : public CCmdTarget
+{
+ DECLARE_DYNCREATE(CDropURL)
+
+ CDropURL(); // protected constructor used by dynamic creation
+
+// Attributes
+public:
+ CDragPad* m_Pad;
+ HRESULT Drop(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pwdEffect);
+ CString GetHostName(IDataObject *pDataObject,CString *url = NULL);
+ HRESULT DragEnter(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect);
+
+// Operations
+public:
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CDropURL)
+ public:
+ virtual void OnFinalRelease();
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ virtual ~CDropURL();
+
+ // Generated message map functions
+ //{{AFX_MSG(CDropURL)
+ //}}AFX_MSG
+
+ DECLARE_MESSAGE_MAP()
+
+ DECLARE_INTERFACE_MAP()
+
+ BEGIN_INTERFACE_PART(DDropTarget, IDropTarget)
+ STDMETHOD_(HRESULT, DragEnter)(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect);
+ STDMETHOD_(HRESULT, DragOver)(DWORD grfKeyState,POINTL pt,DWORD *pdwEffect);
+ STDMETHOD_(HRESULT, DragLeave)(void);
+ STDMETHOD_(HRESULT, Drop)(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect);
+ END_INTERFACE_PART(DDropTarget);
+
+};
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/HostNameDlg.cpp b/HostNameDlg.cpp
new file mode 100644
index 0000000..19e3a07
--- a/dev/null
+++ b/HostNameDlg.cpp
@@ -0,0 +1,49 @@
+// HostNameDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Dipstick.h"
+#include "HostNameDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CHostNameDlg dialog
+
+
+CHostNameDlg::CHostNameDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CHostNameDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CHostNameDlg)
+ m_Host = _T("");
+ //}}AFX_DATA_INIT
+}
+
+
+void CHostNameDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CHostNameDlg)
+ DDX_Text(pDX, IDC_HOST, m_Host);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CHostNameDlg, CDialog)
+ //{{AFX_MSG_MAP(CHostNameDlg)
+ ON_WM_HELPINFO()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CHostNameDlg message handlers
+
+BOOL CHostNameDlg::OnHelpInfo(HELPINFO* pHelpInfo)
+{
+ WinHelp(IDD|0x20000l);
+ return TRUE;
+}
diff --git a/HostNameDlg.h b/HostNameDlg.h
new file mode 100644
index 0000000..40fd966
--- a/dev/null
+++ b/HostNameDlg.h
@@ -0,0 +1,35 @@
+// HostNameDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CHostNameDlg dialog
+
+class CHostNameDlg : public CDialog
+{
+// Construction
+public:
+ CHostNameDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CHostNameDlg)
+ enum { IDD = IDD_MANUALHOST };
+ CString m_Host;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CHostNameDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+ // Generated message map functions
+ //{{AFX_MSG(CHostNameDlg)
+ afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/HostProperties.cpp b/HostProperties.cpp
new file mode 100644
index 0000000..6c2a47b
--- a/dev/null
+++ b/HostProperties.cpp
@@ -0,0 +1,185 @@
+// HostProperties.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Dipstick.h"
+#include "HostProperties.h"
+#include "DipstickDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CHostProperties dialog
+
+
+CHostProperties::CHostProperties(CWnd* pParent /*=NULL*/)
+ : CDialog(CHostProperties::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(CHostProperties)
+ m_Host = _T("");
+ m_IP = _T("");
+ m_Loss = _T("");
+ m_Status = _T("");
+ m_Times = _T("");
+ m_URL = _T("");
+ //}}AFX_DATA_INIT
+}
+
+
+void CHostProperties::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CHostProperties)
+ DDX_Control(pDX, IDC_STATE, m_StateCtl);
+ DDX_Control(pDX, IDC_URLCAPTION, m_URLCaptionCtl);
+ DDX_Control(pDX, IDC_URL, m_URLCtl);
+ DDX_Control(pDX, IDC_TIMESCAPTION, m_TimesCaptionCtl);
+ DDX_Control(pDX, IDC_TIMES, m_TimesCtl);
+ DDX_Control(pDX, IDC_STATUSCAPTION, m_StatusCaptionCtl);
+ DDX_Control(pDX, IDC_STATUS, m_StatusCtl);
+ DDX_Control(pDX, IDC_OPENURL, m_OpenURLCtl);
+ DDX_Control(pDX, IDC_LOSSCAPTION, m_LossCaptionCtl);
+ DDX_Control(pDX, IDC_LOSS, m_LossCtl);
+ DDX_Control(pDX, IDC_IPCAPTION, m_IPCaptionCtl);
+ DDX_Control(pDX, IDC_IP, m_IPCtl);
+ DDX_Control(pDX, IDC_HOSTCAPTION, m_HostCaptionCtl);
+ DDX_Control(pDX, IDC_HOST, m_HostCtl);
+ DDX_Text(pDX, IDC_HOST, m_Host);
+ DDX_Text(pDX, IDC_IP, m_IP);
+ DDX_Text(pDX, IDC_LOSS, m_Loss);
+ DDX_Text(pDX, IDC_STATUS, m_Status);
+ DDX_Text(pDX, IDC_TIMES, m_Times);
+ DDX_Text(pDX, IDC_URL, m_URL);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CHostProperties, CDialog)
+ //{{AFX_MSG_MAP(CHostProperties)
+ ON_BN_CLICKED(IDC_OPENURL, OnOpenurl)
+ ON_WM_HELPINFO()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CHostProperties message handlers
+
+BOOL CHostProperties::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ ASSERT(host);
+ if(host->m_HostName.IsEmpty()){
+ m_HostCtl.ShowWindow(SW_HIDE);
+ m_HostCaptionCtl.ShowWindow(SW_HIDE);
+ }else
+ m_Host = host->m_HostName;
+ if(host->m_IP)
+ m_IP = inet_ntoa(*(in_addr*)&host->m_IP);
+ else{
+ m_IPCtl.ShowWindow(SW_HIDE);
+ m_IPCaptionCtl.ShowWindow(SW_HIDE);
+ }
+ if(host->m_Pinged){
+ m_Loss.Format(IDS_FMT_LOSS,host->m_Packetloss);
+ m_Times.Format(IDS_FMT_TIMES,host->m_MinRTT,host->m_AvgRTT,host->m_MaxRTT);
+ }else{
+ m_LossCtl.ShowWindow(SW_HIDE);
+ m_LossCaptionCtl.ShowWindow(SW_HIDE);
+ m_TimesCtl.ShowWindow(SW_HIDE);
+ m_TimesCaptionCtl.ShowWindow(SW_HIDE);
+ }
+ if(host->m_URL.IsEmpty()){
+ m_URLCtl.ShowWindow(SW_HIDE);
+ m_URLCaptionCtl.ShowWindow(SW_HIDE);
+ m_OpenURLCtl.ShowWindow(SW_HIDE);
+ }else
+ m_URL = host->m_URL;
+ if(host->m_Status.IsEmpty()){
+ m_StatusCtl.ShowWindow(SW_HIDE);
+ m_StatusCaptionCtl.ShowWindow(SW_HIDE);
+ }else
+ m_Status = host->m_Status;
+
+ // CG: The following block was added by the ToolTips component.
+ {
+ // Create the ToolTip control.
+ m_tooltip.Create(this);
+ m_tooltip.Activate(TRUE);
+
+ m_tooltip.AddTool(&m_HostCaptionCtl,IDC_HOSTCAPTION);
+ m_tooltip.AddTool(&m_HostCtl,IDC_HOST);
+ m_tooltip.AddTool(&m_IPCaptionCtl,IDC_IPCAPTION);
+ m_tooltip.AddTool(&m_IPCtl,IDC_IPCAPTION);
+ m_tooltip.AddTool(&m_LossCaptionCtl,IDC_LOSSCAPTION);
+ m_tooltip.AddTool(&m_LossCtl,IDC_LOSS);
+ m_tooltip.AddTool(&m_OpenURLCtl,IDC_OPENURL);
+ m_tooltip.AddTool(&m_StatusCaptionCtl,IDC_STATUSCAPTION);
+ m_tooltip.AddTool(&m_StatusCtl,IDC_STATUS);
+ m_tooltip.AddTool(&m_TimesCaptionCtl,IDC_TIMESCAPTION);
+ m_tooltip.AddTool(&m_TimesCtl,IDC_TIMES);
+ m_tooltip.AddTool(&m_URLCaptionCtl,IDC_URLCAPTION);
+ m_tooltip.AddTool(&m_URLCtl,IDC_URL);
+ m_tooltip.AddTool(GetDlgItem(IDOK),IDS_TIP_PROPSOK);
+
+ if(host->m_Pinging){
+ m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PINGING));
+ m_tooltip.AddTool(&m_StateCtl,IDS_TIP_PINGING);
+ }else{
+ if(host->m_bToPing){
+ m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PENDING));
+ m_tooltip.AddTool(&m_StateCtl,IDS_TIP_PENDING);
+ }else{
+ if(host->m_Pinged){
+ if(host->m_Packetloss==100){
+ m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_UNREACHABLE));
+ m_tooltip.AddTool(&m_StateCtl,IDS_TIP_UNREACHABLE);
+ }else{
+ m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_COMPLETED));
+ m_tooltip.AddTool(&m_StateCtl,IDS_TIP_COMPLETE);
+ }
+ }else{
+ m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PENDING));
+ m_tooltip.AddTool(&m_StateCtl,IDS_TIP_PENDING);
+ }
+ }
+ }
+
+ UpdateData(FALSE);
+
+ }
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CHostProperties::SetHost(CPingyHost *host)
+{
+ CHostProperties::host = host;
+}
+
+void CHostProperties::OnOpenurl()
+{
+ ASSERT(!m_URL.IsEmpty());
+ ShellExecute(::GetDesktopWindow(),"open",m_URL,NULL,NULL,SW_SHOWMAXIMIZED);
+}
+
+BOOL CHostProperties::PreTranslateMessage(MSG* pMsg)
+{
+ // CG: The following block was added by the ToolTips component.
+ {
+ // Let the ToolTip process this message.
+ m_tooltip.RelayEvent(pMsg);
+
+ return CDialog::PreTranslateMessage(pMsg);
+ }
+}
+
+BOOL CHostProperties::OnHelpInfo(HELPINFO* pHelpInfo)
+{
+ WinHelp(IDD|0x20000l);
+ return TRUE;
+}
diff --git a/HostProperties.h b/HostProperties.h
new file mode 100644
index 0000000..c59336b
--- a/dev/null
+++ b/HostProperties.h
@@ -0,0 +1,61 @@
+// HostProperties.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CHostProperties dialog
+
+struct CPingyHost;
+class CHostProperties : public CDialog
+{
+// Construction
+public:
+ virtual BOOL PreTranslateMessage(MSG* pMsg);
+ void SetHost(CPingyHost *host);
+ CPingyHost * host;
+ CHostProperties(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CHostProperties)
+ enum { IDD = IDD_PROPS };
+ CStatic m_StateCtl;
+ CStatic m_URLCaptionCtl;
+ CStatic m_URLCtl;
+ CStatic m_TimesCaptionCtl;
+ CStatic m_TimesCtl;
+ CStatic m_StatusCaptionCtl;
+ CStatic m_StatusCtl;
+ CButton m_OpenURLCtl;
+ CStatic m_LossCaptionCtl;
+ CStatic m_LossCtl;
+ CStatic m_IPCaptionCtl;
+ CStatic m_IPCtl;
+ CStatic m_HostCaptionCtl;
+ CStatic m_HostCtl;
+ CString m_Host;
+ CString m_IP;
+ CString m_Loss;
+ CString m_Status;
+ CString m_Times;
+ CString m_URL;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CHostProperties)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ CToolTipCtrl m_tooltip;
+
+ // Generated message map functions
+ //{{AFX_MSG(CHostProperties)
+ virtual BOOL OnInitDialog();
+ afx_msg void OnOpenurl();
+ afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/KTAGS b/KTAGS
new file mode 100644
index 0000000..e3cc88a
--- a/dev/null
+++ b/KTAGS
@@ -0,0 +1,15 @@
+about-date dipstick.rc /LTEXT\s\+"Copyright /;" kind:d
+about-version dipstick.rc /LTEXT\s\+"Dipstick, Version/;" kind:v
+dialog-version dipstick.rc /^CAPTION\s\+" Dipstick/;" kind:v
+dndtarget-version dipstick.rc /IDC_DNDTARGET\s\+"Dipstick /;" kind:v
+dragpad-version dipstick.rc /IDS_DRAGPAD_TITLE\s\+" Dipstick /;" kind:v
+help-license-date ./help/dipstick.xml /<license\s/;" kind:d
+help-news ./help/dipstick.xml /<newsfor\s/
+install-version ./install/install.cpp /^#define\s\+VERSION\s\+"/;" kind:v
+install-vsinfo-date install/install.rc /^\s\+VALUE\s\+"LegalCopyright",/;" kind:d
+install-vsinfo-numeric-version install/install.rc /^\s\+FILEVERSION\s\+/;" kind:v
+install-vsinfo-string-version install/install.rc /^\s\+VALUE\s\+"FileVersion",/;" kind:v
+license-date COPYING :1;" kind:d
+vsinfo-date dipstick.rc /VALUE\s\+"LegalCopyright",/;" kind:d
+vsinfo-numeric-version dipstick.rc /^\s\+FILEVERSION\s\+/;" kind:v
+vsinfo-string-version dipstick.rc /^\s\+VALUE\s\+"FileVersion",/;" kind:v
diff --git a/OptionsDlg.cpp b/OptionsDlg.cpp
new file mode 100644
index 0000000..1ee8da7
--- a/dev/null
+++ b/OptionsDlg.cpp
@@ -0,0 +1,86 @@
+// OptionsDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Dipstick.h"
+#include "OptionsDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// COptionsDlg dialog
+
+
+COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(COptionsDlg::IDD, pParent)
+{
+ //{{AFX_DATA_INIT(COptionsDlg)
+ m_Pings = 0;
+ m_PingSize = 0;
+ m_TimeOut = 0;
+ m_Interval = 0;
+ m_MaxThreads = 0;
+ m_bMSWorkAround = FALSE;
+ m_bAutoBest = FALSE;
+ m_bAdjustInn = FALSE;
+ m_bIgnorelative = FALSE;
+ m_bAdjust = FALSE;
+ //}}AFX_DATA_INIT
+}
+
+
+void COptionsDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(COptionsDlg)
+ DDX_Control(pDX, IDC_SPINTIMEOUT, m_SpinTimeOutCtl);
+ DDX_Control(pDX, IDC_SPINTERVAL, m_SpinIntervalCtl);
+ DDX_Control(pDX, IDC_SPINSIZE, m_SpinPingSizeCtl);
+ DDX_Control(pDX, IDC_SPINPINGS, m_SpinPingsCtl);
+ DDX_Control(pDX, IDC_SPINMAXPINGS, m_SpinMaxThreadsCtl);
+ DDX_Text(pDX, IDC_NPINGS, m_Pings);
+ DDX_Text(pDX, IDC_PACKETSIZE, m_PingSize);
+ DDX_Text(pDX, IDC_TIMEOUT, m_TimeOut);
+ DDX_Text(pDX, IDC_INTERVAL, m_Interval);
+ DDX_Text(pDX, IDC_MAXPINGS, m_MaxThreads);
+ DDV_MinMaxUInt(pDX, m_MaxThreads, 1, 100);
+ DDX_Check(pDX, IDC_MSWORKAROUND, m_bMSWorkAround);
+ DDX_Check(pDX, IDC_AUTOBEST, m_bAutoBest);
+ DDX_Check(pDX, IDC_ADJUSTINN, m_bAdjustInn);
+ DDX_Check(pDX, IDC_IGNORELA, m_bIgnorelative);
+ DDX_Check(pDX, IDC_SMARTADJUST, m_bAdjust);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(COptionsDlg, CDialog)
+ //{{AFX_MSG_MAP(COptionsDlg)
+ ON_WM_HELPINFO()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// COptionsDlg message handlers
+
+BOOL COptionsDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+ m_SpinIntervalCtl.SetRange(0,60);
+ m_SpinMaxThreadsCtl.SetRange(1,50);
+ m_SpinPingsCtl.SetRange(1,100);
+ m_SpinPingSizeCtl.SetRange(0,32767);
+ m_SpinTimeOutCtl.SetRange(1,60);
+
+ return TRUE;
+}
+
+BOOL COptionsDlg::OnHelpInfo(HELPINFO* pHelpInfo)
+{
+ WinHelp(IDD|0x20000l);
+ return TRUE;
+}
diff --git a/OptionsDlg.h b/OptionsDlg.h
new file mode 100644
index 0000000..790a58a
--- a/dev/null
+++ b/OptionsDlg.h
@@ -0,0 +1,51 @@
+// OptionsDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// COptionsDlg dialog
+
+class COptionsDlg : public CDialog
+{
+// Construction
+public:
+ COptionsDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(COptionsDlg)
+ enum { IDD = IDD_OPTIONS };
+ CSpinButtonCtrl m_SpinTimeOutCtl;
+ CSpinButtonCtrl m_SpinIntervalCtl;
+ CSpinButtonCtrl m_SpinPingSizeCtl;
+ CSpinButtonCtrl m_SpinPingsCtl;
+ CSpinButtonCtrl m_SpinMaxThreadsCtl;
+ UINT m_Pings;
+ UINT m_PingSize;
+ DWORD m_TimeOut;
+ DWORD m_Interval;
+ UINT m_MaxThreads;
+ BOOL m_bMSWorkAround;
+ BOOL m_bAutoBest;
+ BOOL m_bAdjustInn;
+ BOOL m_bIgnorelative;
+ BOOL m_bAdjust;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(COptionsDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+ CToolTipCtrl m_tooltip;
+ virtual BOOL OnInitDialog();
+
+ // Generated message map functions
+ //{{AFX_MSG(COptionsDlg)
+ afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/README b/README
new file mode 100644
index 0000000..7dab6ae
--- a/dev/null
+++ b/README
@@ -0,0 +1,36 @@
+
+Before compiling canned install executable the following files should be placed
+in the build tree:
+
+redist/mfc42.dl_
+
+Release checklist:
+ (These are tags stored in KTAGS file. please, keep in sync. Use vim to
+ jump to these tags. I haven't tried it on windows, though).
+
+|help-news| - Release notes in help file
+
+Version number in the following places:
+
+|about-version| - About box
+|dragpad-version| - Dragpad title
+|dndtarget-version| - Drag'n'drop target tooltip
+|dialog-version| - Dipstick's main dialog title
+|vsinfo-numeric-version| - VERSIONINFO numerical File&Prod V
+|vsinfo-string-version| - VERSIONINFO string File&Prod V
+|install-version| - Version used in install
+|install-vsinfo-numeric-version| - install's VERSIONINFO block
+|install-vsinfo-string-version| - install's VERSIONINFO block
+
+If the year flips check these:
+
+|about-date| - About box
+|help-license-date| - license in help file
+|license-date| - license in COPYING file
+|vsinfo-date| - Copyright in VERSIONINFO block
+|install-vsinfo-date| - Copyright in install's VERSIONINFO
+ block
+
+
+This is for vim (don't remove):
+ vim:set tags=KTAGS isk=!-~,^*,^\|,^\" ft=help:
diff --git a/SelectURLsDlg.cpp b/SelectURLsDlg.cpp
new file mode 100644
index 0000000..bad1cc2
--- a/dev/null
+++ b/SelectURLsDlg.cpp
@@ -0,0 +1,164 @@
+// SelectURLsDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "Dipstick.h"
+#include "SelectURLsDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CSelectURLsDlg dialog
+
+
+CSelectURLsDlg::CSelectURLsDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CSelectURLsDlg::IDD, pParent), m_minSize(0,0)
+{
+ //{{AFX_DATA_INIT(CSelectURLsDlg)
+ m_bAdjustInnermost = FALSE;
+ m_bAdjust = FALSE;
+ //}}AFX_DATA_INIT
+}
+
+
+void CSelectURLsDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ //{{AFX_DATA_MAP(CSelectURLsDlg)
+ DDX_Control(pDX, IDC_DOADJUST, m_AdjustCtl);
+ DDX_Control(pDX, IDC_ADJUSTINN, m_AdjustInnCtl);
+ DDX_Control(pDX, IDOK, m_OkCtl);
+ DDX_Control(pDX, IDCANCEL, m_CancelCtl);
+ DDX_Control(pDX, IDC_URLS, m_URLsCtl);
+ DDX_Check(pDX, IDC_ADJUSTINN, m_bAdjustInnermost);
+ DDX_Check(pDX, IDC_DOADJUST, m_bAdjust);
+ //}}AFX_DATA_MAP
+}
+
+
+BEGIN_MESSAGE_MAP(CSelectURLsDlg, CDialog)
+ //{{AFX_MSG_MAP(CSelectURLsDlg)
+ ON_WM_SIZE()
+ ON_WM_GETMINMAXINFO()
+ ON_LBN_SELCHANGE(IDC_URLS, OnSelchangeUrls)
+ ON_WM_HELPINFO()
+ //}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CSelectURLsDlg message handlers
+
+BOOL CSelectURLsDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+
+POSITION p = m_URLs.GetHeadPosition();
+ while(p){
+ CString url = m_URLs.GetNext(p);
+ ASSERT(!url.IsEmpty());
+ m_URLsCtl.AddString(url);
+ }
+CRect rc;
+ GetWindowRect(rc);
+ m_minSize.cx = rc.Width();
+ m_minSize.cy = rc.Height();
+ m_URLsCtl.GetWindowRect(rc);
+ ScreenToClient(rc);
+ m_Gap = CSize(rc.left,rc.top);
+ m_minSize.cy -= rc.Height()-20;
+ m_URLsCtl.SelItemRange(TRUE,0,m_URLsCtl.GetCount()-1);
+
+ return TRUE; // return TRUE unless you set the focus to a control
+ // EXCEPTION: OCX Property Pages should return FALSE
+}
+
+void CSelectURLsDlg::OnSize(UINT nType, int cx, int cy)
+{
+ CDialog::OnSize(nType, cx, cy);
+
+ RecalcLayout(cx,cy);
+
+}
+
+void CSelectURLsDlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
+{
+ CDialog::OnGetMinMaxInfo(lpMMI);
+ if(m_minSize.cx && m_minSize.cy){
+ lpMMI->ptMinTrackSize.x = m_minSize.cx;
+ lpMMI->ptMinTrackSize.y = m_minSize.cy;
+ }
+}
+
+void CSelectURLsDlg::RecalcLayout(int cx,int cy)
+{
+ if(!(m_minSize.cx&&m_minSize.cy))
+ return;
+CRect rcok, rccan, rcadj, rcadjin, rclist;
+ m_OkCtl.GetWindowRect(rcok); ScreenToClient(rcok);
+ m_CancelCtl.GetWindowRect(rccan); ScreenToClient(rccan);
+ m_AdjustCtl.GetWindowRect(rcadj); ScreenToClient(rcadj);
+ m_AdjustInnCtl.GetWindowRect(rcadjin); ScreenToClient(rcadjin);
+ m_URLsCtl.GetWindowRect(rclist); ScreenToClient(rclist);
+ m_CancelCtl.SetWindowPos(NULL,rccan.left,cy-m_Gap.cy-rccan.Height(),0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_OkCtl.SetWindowPos(NULL,rcok.left,cy-m_Gap.cy-rcok.Height()-rccan.bottom+rcok.bottom,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_AdjustCtl.SetWindowPos(NULL,rcadj.left,cy-m_Gap.cy-rccan.bottom+rcadj.bottom-rcadj.Height(),0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_AdjustInnCtl.SetWindowPos(NULL,rcadjin.left,cy-m_Gap.cy-rccan.bottom+rcadjin.bottom-rcadjin.Height(),0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
+ m_URLsCtl.SetWindowPos(NULL,rclist.left,rclist.top,cx-m_Gap.cx*2,cy-m_Gap.cy*2-rccan.bottom+rclist.bottom,SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS);
+}
+
+void CSelectURLsDlg::OnSelchangeUrls()
+{
+ UpdateData(TRUE);
+ if(!m_bAdjust)
+ return;
+ if(m_URLsCtl.GetSelCount()!=1)
+ return;
+INT selection;
+ VERIFY(m_URLsCtl.GetSelItems(1,&selection)==1);
+CCrackURL base;
+CString selectedItem;
+ m_URLsCtl.GetText(selection,selectedItem);
+ VERIFY(base.Crack(selectedItem));
+CCrackURL item;
+int is = m_URLsCtl.GetCount();
+ BeginWaitCursor();
+ for(int i = 0;i<is;i++){
+ if(i==selection)
+ continue;
+ CString it;
+ m_URLsCtl.GetText(i,it);
+ if(m_bAdjustInnermost)
+ it = CCrackURL::InnermostURL(it);
+ VERIFY(item.Crack(it));
+ if(item.m_pathFile==base.m_pathFile)
+ m_URLsCtl.SetSel(i);
+ }
+ EndWaitCursor();
+}
+
+void CSelectURLsDlg::OnOK()
+{
+ m_URLs.RemoveAll();
+int is = m_URLsCtl.GetSelCount();
+ if(is){
+ LPINT items = new INT[is];
+ VERIFY(m_URLsCtl.GetSelItems(is,items)==is);
+ for(int i=0;i<is;i++){
+ CString url;
+ m_URLsCtl.GetText(items[i],url);
+ m_URLs.AddTail(url);
+ }
+ delete items;
+ }
+ CDialog::OnOK();
+}
+
+BOOL CSelectURLsDlg::OnHelpInfo(HELPINFO* pHelpInfo)
+{
+ WinHelp(IDD|0x20000l);
+ return TRUE;
+}
diff --git a/SelectURLsDlg.h b/SelectURLsDlg.h
new file mode 100644
index 0000000..65852a7
--- a/dev/null
+++ b/SelectURLsDlg.h
@@ -0,0 +1,50 @@
+// SelectURLsDlg.h : header file
+//
+
+/////////////////////////////////////////////////////////////////////////////
+// CSelectURLsDlg dialog
+
+class CSelectURLsDlg : public CDialog
+{
+// Construction
+public:
+ void RecalcLayout(int cx,int cy);
+ CSize m_Gap;
+ CSize m_minSize;
+ CStringList m_URLs;
+ CSelectURLsDlg(CWnd* pParent = NULL); // standard constructor
+
+// Dialog Data
+ //{{AFX_DATA(CSelectURLsDlg)
+ enum { IDD = IDD_URLS };
+ CButton m_AdjustCtl;
+ CButton m_AdjustInnCtl;
+ CButton m_OkCtl;
+ CButton m_CancelCtl;
+ CListBox m_URLsCtl;
+ BOOL m_bAdjustInnermost;
+ BOOL m_bAdjust;
+ //}}AFX_DATA
+
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CSelectURLsDlg)
+ protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+ //}}AFX_VIRTUAL
+
+// Implementation
+protected:
+
+ // Generated message map functions
+ //{{AFX_MSG(CSelectURLsDlg)
+ virtual BOOL OnInitDialog();
+ afx_msg void OnSize(UINT nType, int cx, int cy);
+ afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
+ afx_msg void OnSelchangeUrls();
+ virtual void OnOK();
+ afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/URLSource.cpp b/URLSource.cpp
new file mode 100644
index 0000000..7c265b7
--- a/dev/null
+++ b/URLSource.cpp
@@ -0,0 +1,32 @@
+#include "stdafx.h"
+#include "URLSource.h"
+
+#include <intshcut.h>
+#include <initguid.h>
+#include <isguids.h>
+
+CURLSource::CURLSource(LPCTSTR strURL)
+{
+IUniformResourceLocator *lpURL;
+ if(CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_INPROC_SERVER,IID_IUniformResourceLocator,(LPVOID*)&lpURL)==S_OK){
+ ASSERT(lpURL);
+ lpURL->SetURL(strURL,IURL_SETURL_FL_GUESS_PROTOCOL);
+ LPDATAOBJECT lpDO = NULL;
+ VERIFY(lpURL->QueryInterface(IID_IDataObject,(LPVOID*)&lpDO)==S_OK);
+ COleDataObject odo;
+ odo.Attach(lpDO,TRUE);
+ odo.BeginEnumFormats();
+ FORMATETC fe;
+ while(odo.GetNextFormat(&fe)){
+ HGLOBAL hg = odo.GetGlobalData(fe.cfFormat,NULL);
+ if(hg)
+ CacheGlobalData(fe.cfFormat,hg,NULL);
+ }
+ lpURL->Release();
+ }
+HGLOBAL hg = GlobalAlloc(GHND,strlen(strURL)+1);
+LPVOID lpv = GlobalLock(hg);
+ memmove(lpv,strURL,strlen(strURL)+1);
+ GlobalUnlock(hg);
+ CacheGlobalData(CF_TEXT,hg,NULL);
+}
diff --git a/URLSource.h b/URLSource.h
new file mode 100644
index 0000000..d7c9b87
--- a/dev/null
+++ b/URLSource.h
@@ -0,0 +1,5 @@
+
+class CURLSource : public COleDataSource {
+public:
+ CURLSource(LPCTSTR strURL);
+}; \ No newline at end of file
diff --git a/dipstick.clw b/dipstick.clw
new file mode 100644
index 0000000..708ee48
--- a/dev/null
+++ b/dipstick.clw
@@ -0,0 +1,266 @@
+; CLW file contains information for the MFC ClassWizard
+
+[General Info]
+Version=1
+LastClass=CDipstickDlg
+LastTemplate=CDialog
+NewFileInclude1=#include "stdafx.h"
+NewFileInclude2=#include "Dipstick.h"
+
+ClassCount=10
+Class1=CDipstickApp
+Class2=CDipstickDlg
+Class3=CAboutDlg
+
+ResourceCount=10
+Resource1=IDD_PROPS
+Resource2=IDR_MAINFRAME
+Class4=CDropURL
+Resource3=IDD_MANUALHOST
+Class5=CDragPad
+Resource4=IDD_ABOUTBOX
+Class6=COptionsDlg
+Resource5=IDD_OPTIONS
+Resource6=IDD_AUTOBEST
+Class7=CHostNameDlg
+Resource7=IDD_DRAGPAD
+Class8=CHostProperties
+Resource8=IDR_MENU
+Class9=CAutoBestDlg
+Resource9=IDD_DIPSTICK_DIALOG
+Class10=CSelectURLsDlg
+Resource10=IDD_URLS
+
+[CLS:CDipstickApp]
+Type=0
+HeaderFile=Dipstick.h
+ImplementationFile=Dipstick.cpp
+Filter=N
+LastObject=CDipstickApp
+BaseClass=CWinApp
+VirtualFilter=AC
+
+[CLS:CDipstickDlg]
+Type=0
+HeaderFile=DipstickDlg.h
+ImplementationFile=DipstickDlg.cpp
+Filter=W
+BaseClass=CDialog
+VirtualFilter=dWC
+LastObject=CDipstickDlg
+
+[CLS:CAboutDlg]
+Type=0
+HeaderFile=DipstickDlg.h
+ImplementationFile=DipstickDlg.cpp
+Filter=D
+BaseClass=CDialog
+VirtualFilter=dWC
+LastObject=IDC_KLEVERNET
+
+[DLG:IDD_ABOUTBOX]
+Type=1
+Class=CAboutDlg
+ControlCount=5
+Control1=IDC_STATIC,static,1342177283
+Control2=IDC_STATIC,static,1342308480
+Control3=IDC_STATIC,static,1342308352
+Control4=IDOK,button,1342373889
+Control5=IDC_KLEVERNET,button,1342242816
+
+[DLG:IDD_DIPSTICK_DIALOG]
+Type=1
+Class=CDipstickDlg
+ControlCount=11
+Control1=IDC_HOSTLIST,SysListView32,1350631697
+Control2=IDC_MANUALPING,button,1342242816
+Control3=IDC_REPING,button,1476460544
+Control4=IDC_REPINGALL,button,1476460544
+Control5=IDC_REMOVE,button,1476460544
+Control6=IDC_CLEAR,button,1476460544
+Control7=ID_HELP,button,1342242816
+Control8=IDC_OPTIONS,button,1342242816
+Control9=IDC_EXIT,button,1342242816
+Control10=IDCANCEL,button,1208025088
+Control11=IDC_ADVANCED,button,1342242816
+
+[CLS:CDropURL]
+Type=0
+HeaderFile=DropURL.h
+ImplementationFile=DropURL.cpp
+BaseClass=CCmdTarget
+Filter=N
+LastObject=CDropURL
+VirtualFilter=C
+
+[DLG:IDD_DRAGPAD]
+Type=1
+Class=CDragPad
+ControlCount=3
+Control1=IDC_DNDTARGET,SysAnimate32,1342242816
+Control2=IDCANCEL,button,1208025088
+Control3=IDOK,button,1208025089
+
+[CLS:CDragPad]
+Type=0
+HeaderFile=DragPad.h
+ImplementationFile=DragPad.cpp
+BaseClass=CDialog
+Filter=W
+VirtualFilter=dWC
+LastObject=CDragPad
+
+[DLG:IDD_OPTIONS]
+Type=1
+Class=COptionsDlg
+ControlCount=22
+Control1=IDC_STATIC,static,1342308352
+Control2=IDC_NPINGS,edit,1350631552
+Control3=IDC_SPINPINGS,msctls_updown32,1342177463
+Control4=IDC_STATIC,static,1342308352
+Control5=IDC_MAXPINGS,edit,1350631552
+Control6=IDC_SPINMAXPINGS,msctls_updown32,1342177463
+Control7=IDC_STATIC,static,1342308352
+Control8=IDC_TIMEOUT,edit,1350631552
+Control9=IDC_SPINTIMEOUT,msctls_updown32,1342177463
+Control10=IDC_STATIC,static,1342308352
+Control11=IDC_INTERVAL,edit,1350631552
+Control12=IDC_SPINTERVAL,msctls_updown32,1342177463
+Control13=IDC_STATIC,static,1342308352
+Control14=IDC_PACKETSIZE,edit,1350631552
+Control15=IDC_SPINSIZE,msctls_updown32,1342177463
+Control16=IDC_MSWORKAROUND,button,1342259203
+Control17=IDOK,button,1342242817
+Control18=IDCANCEL,button,1342242816
+Control19=IDC_AUTOBEST,button,1342259203
+Control20=IDC_SMARTADJUST,button,1342259203
+Control21=IDC_ADJUSTINN,button,1342259203
+Control22=IDC_IGNORELA,button,1342259203
+
+[CLS:COptionsDlg]
+Type=0
+HeaderFile=OptionsDlg.h
+ImplementationFile=OptionsDlg.cpp
+BaseClass=CDialog
+Filter=W
+VirtualFilter=dWC
+LastObject=COptionsDlg
+
+[MNU:IDR_MENU]
+Type=1
+Class=CDipstickDlg
+Command1=ID_DRAGPAD_MANUALPING
+Command2=ID_DRAGPAD_PASTEURL
+Command3=ID_DRAGPAD_REPINGALL
+Command4=ID_DRAGPAD_REMOVEALL
+Command5=ID_DRAGPAD_OPTIONS
+Command6=ID_DRAGPAD_SHOWMAINWINDOW
+Command7=ID_DRAGPAD_ADVANCED_EXPORTLIST
+Command8=ID_DRAGPAD_ADVANCED_IMPORTLIST
+Command9=ID_DRAGPAD_HELP
+Command10=ID_DRAGPAD_ABOUT
+Command11=ID_DRAGPAD_EXIT
+Command12=ID_HOSTLIST_REPING
+Command13=ID_HOSTLIST_REMOVE
+Command14=ID_HOSTLIST_OPENURL
+Command15=ID_HOSTLIST_COPYURL
+Command16=ID_HOSTLIST_REPINGALL
+Command17=ID_HOSTLIST_REMOVEALL
+Command18=ID_HOSTLIST_PASTEURL
+Command19=ID_HOSTLIST_PROPERTIES
+Command20=ID_ADVANCED_EXPORTLIST
+Command21=ID_ADVANCED_IMPORTLIST
+CommandCount=21
+
+[DLG:IDD_MANUALHOST]
+Type=1
+Class=CHostNameDlg
+ControlCount=4
+Control1=IDC_STATIC,static,1342308352
+Control2=IDC_HOST,edit,1350631568
+Control3=IDOK,button,1342242817
+Control4=IDCANCEL,button,1342242816
+
+[CLS:CHostNameDlg]
+Type=0
+HeaderFile=HostNameDlg.h
+ImplementationFile=HostNameDlg.cpp
+BaseClass=CDialog
+Filter=D
+LastObject=CHostNameDlg
+VirtualFilter=dWC
+
+[DLG:IDD_PROPS]
+Type=1
+Class=CHostProperties
+ControlCount=16
+Control1=IDOK,button,1342242817
+Control2=IDC_URLCAPTION,static,1342308608
+Control3=IDC_URL,static,1342308736
+Control4=IDC_HOSTCAPTION,static,1342308608
+Control5=IDC_HOST,static,1342308736
+Control6=IDC_IPCAPTION,static,1342308608
+Control7=IDC_IP,static,1342308608
+Control8=IDC_TIMESCAPTION,static,1342308608
+Control9=IDC_TIMES,static,1342308608
+Control10=IDC_LOSSCAPTION,static,1342308608
+Control11=IDC_LOSS,static,1342308736
+Control12=IDC_STATUSCAPTION,static,1342308608
+Control13=IDC_STATUS,static,1342308736
+Control14=IDC_OPENURL,button,1342242816
+Control15=IDC_STATE,static,1342180099
+Control16=IDC_COPYURL,button,1342242816
+
+[CLS:CHostProperties]
+Type=0
+HeaderFile=HostProperties.h
+ImplementationFile=HostProperties.cpp
+BaseClass=CDialog
+Filter=D
+VirtualFilter=dWC
+LastObject=CHostProperties
+
+[DLG:IDD_AUTOBEST]
+Type=1
+Class=CAutoBestDlg
+ControlCount=11
+Control1=IDOK,button,1342242817
+Control2=IDC_NEXT,button,1342242816
+Control3=IDC_PREV,button,1342242816
+Control4=IDC_URL,static,1342308481
+Control5=IDC_STATIC,static,1342308352
+Control6=IDC_RTT,static,1342308352
+Control7=IDC_STATIC,static,1342308352
+Control8=IDC_PKTLOSS,static,1342308352
+Control9=IDCANCEL,button,1342242816
+Control10=IDC_DROPSOURCE,SysAnimate32,1342177285
+Control11=IDC_COPYURL,button,1342254848
+
+[CLS:CAutoBestDlg]
+Type=0
+HeaderFile=AutoBestDlg.h
+ImplementationFile=AutoBestDlg.cpp
+BaseClass=CDialog
+Filter=W
+LastObject=CAutoBestDlg
+VirtualFilter=dWC
+
+[DLG:IDD_URLS]
+Type=1
+Class=CSelectURLsDlg
+ControlCount=5
+Control1=IDC_URLS,listbox,1345390851
+Control2=IDOK,button,1342242817
+Control3=IDCANCEL,button,1342242816
+Control4=IDC_DOADJUST,button,1342243843
+Control5=IDC_ADJUSTINN,button,1342252035
+
+[CLS:CSelectURLsDlg]
+Type=0
+HeaderFile=SelectURLsDlg.h
+ImplementationFile=SelectURLsDlg.cpp
+BaseClass=CDialog
+Filter=W
+LastObject=CSelectURLsDlg
+VirtualFilter=dWC
+
diff --git a/dipstick.cpp b/dipstick.cpp
new file mode 100644
index 0000000..7ac3f42
--- a/dev/null
+++ b/dipstick.cpp
@@ -0,0 +1,73 @@
+// Dipstick.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "Dipstick.h"
+#include "DipstickDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+// CDipstickApp
+
+BEGIN_MESSAGE_MAP(CDipstickApp, CWinApp)
+ //{{AFX_MSG_MAP(CDipstickApp)
+ //}}AFX_MSG
+ ON_COMMAND(ID_HELP, CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// CDipstickApp construction
+
+CDipstickApp::CDipstickApp()
+{
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// The one and only CDipstickApp object
+
+CDipstickApp theApp;
+
+/////////////////////////////////////////////////////////////////////////////
+// CDipstickApp initialization
+
+BOOL CDipstickApp::InitInstance()
+{
+ if (!AfxSocketInit())
+ {
+ AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
+ return FALSE;
+ }
+
+ // Standard initialization
+ // If you are not using these features and wish to reduce the size
+ // of your final executable, you should remove from the following
+ // the specific initialization routines you do not need.
+
+#ifdef _AFXDLL
+ Enable3dControls(); // Call this when using MFC in a shared DLL
+#else
+ Enable3dControlsStatic(); // Call this when linking to MFC statically
+#endif
+
+ OleInitialize(NULL);
+
+ SetRegistryKey(IDS_REGISTRYKEY);
+ m_HelpFile = m_pszHelpFilePath;
+ m_HelpFile+=">Standard";
+ m_pszHelpFilePath=m_HelpFile;
+
+CDipstickDlg dlg;
+ m_pMainWnd = &dlg;
+ dlg.DoModal();
+
+ OleUninitialize();
+
+ // Since the dialog has been closed, return FALSE so that we exit the
+ // application, rather than start the application's message pump.
+ return FALSE;
+}
diff --git a/dipstick.h b/dipstick.h
new file mode 100644
index 0000000..dff8edd
--- a/dev/null
+++ b/dipstick.h
@@ -0,0 +1,36 @@
+// Dipstick.h : main header file for the DIPSTICK application
+//
+
+#ifndef __AFXWIN_H__
+ #error include 'stdafx.h' before including this file for PCH
+#endif
+
+#include "resource.h" // main symbols
+
+/////////////////////////////////////////////////////////////////////////////
+// CDipstickApp:
+// See Dipstick.cpp for the implementation of this class
+//
+
+class CDipstickApp : public CWinApp
+{
+public:
+ CString m_HelpFile;
+ CDipstickApp();
+
+// Overrides
+ // ClassWizard generated virtual function overrides
+ //{{AFX_VIRTUAL(CDipstickApp)
+ public:
+ virtual BOOL InitInstance();
+ //}}AFX_VIRTUAL
+
+// Implementation
+
+ //{{AFX_MSG(CDipstickApp)
+ //}}AFX_MSG
+ DECLARE_MESSAGE_MAP()
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/dipstick.mak b/dipstick.mak
new file mode 100644
index 0000000..eb1e8bc
--- a/dev/null
+++ b/dipstick.mak
@@ -0,0 +1,1763 @@
+# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Application" 0x0101
+
+!IF "$(CFG)" == ""
+CFG=Install - Win32 Canned
+!MESSAGE No configuration specified. Defaulting to Install - Win32 Canned.
+!ENDIF
+
+!IF "$(CFG)" != "Dipstick - Win32 Release" && "$(CFG)" !=\
+ "Dipstick - Win32 Debug" && "$(CFG)" != "Dipstick - Win32 Release Static" &&\
+ "$(CFG)" != "Install - Win32 Debug" && "$(CFG)" != "Install - Win32 Pure" &&\
+ "$(CFG)" != "Install - Win32 Static" && "$(CFG)" != "Install - Win32 Canned"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "dipstick.mak" CFG="Install - Win32 Canned"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Dipstick - Win32 Release" (based on "Win32 (x86) Application")
+!MESSAGE "Dipstick - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE "Dipstick - Win32 Release Static" (based on "Win32 (x86) Application")
+!MESSAGE "Install - Win32 Debug" (based on "Win32 (x86) Application")
+!MESSAGE "Install - Win32 Pure" (based on "Win32 (x86) Application")
+!MESSAGE "Install - Win32 Static" (based on "Win32 (x86) Application")
+!MESSAGE "Install - Win32 Canned" (based on "Win32 (x86) Application")
+!MESSAGE
+!ERROR An invalid configuration is specified.
+!ENDIF
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE
+NULL=nul
+!ENDIF
+################################################################################
+# Begin Project
+# PROP Target_Last_Scanned "Dipstick - Win32 Release"
+RSC=rc.exe
+MTL=mktyplib.exe
+CPP=cl.exe
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\Release
+TargetName=dipstick
+# End Custom Macros
+
+ALL : "$(OUTDIR)\dipstick.exe" "$(OUTDIR)\dipstick.ex_"\
+ "$(OUTDIR)\dipstick.hlp" "$(OUTDIR)\dipstick.cnt" "$(OUTDIR)\dipstick.hl_"\
+ "$(OUTDIR)\dipstick.cn_"
+
+CLEAN :
+ -@erase "$(INTDIR)\AutoBestDlg.obj"
+ -@erase "$(INTDIR)\CrackURL.obj"
+ -@erase "$(INTDIR)\dipstick.cn_"
+ -@erase "$(INTDIR)\dipstick.cnt"
+ -@erase "$(INTDIR)\dipstick.hl_"
+ -@erase "$(INTDIR)\dipstick.hlp"
+ -@erase "$(INTDIR)\Dipstick.obj"
+ -@erase "$(INTDIR)\dipstick.pch"
+ -@erase "$(INTDIR)\dipstick.res"
+ -@erase "$(INTDIR)\DipstickDlg.obj"
+ -@erase "$(INTDIR)\DragPad.obj"
+ -@erase "$(INTDIR)\HostNameDlg.obj"
+ -@erase "$(INTDIR)\HostProperties.obj"
+ -@erase "$(INTDIR)\kICMP.obj"
+ -@erase "$(INTDIR)\OptionsDlg.obj"
+ -@erase "$(INTDIR)\RegEx.obj"
+ -@erase "$(INTDIR)\SelectURLsDlg.obj"
+ -@erase "$(INTDIR)\StdAfx.obj"
+ -@erase "$(INTDIR)\URLSource.obj"
+ -@erase "$(OUTDIR)\dipstick.ex_"
+ -@erase "$(OUTDIR)\dipstick.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
+CPP_PROJ=/nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/"\
+ /c
+CPP_OBJS=.\Release/
+CPP_SBRS=.\.
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /win32
+MTL_PROJ=/nologo /D "NDEBUG" /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dipstick.res" /d "NDEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/dipstick.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
+# ADD LINK32 uuid.lib /nologo /subsystem:windows /machine:I386
+LINK32_FLAGS=uuid.lib /nologo /subsystem:windows /incremental:no\
+ /pdb:"$(OUTDIR)/dipstick.pdb" /machine:I386 /out:"$(OUTDIR)/dipstick.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\AutoBestDlg.obj" \
+ "$(INTDIR)\CrackURL.obj" \
+ "$(INTDIR)\Dipstick.obj" \
+ "$(INTDIR)\dipstick.res" \
+ "$(INTDIR)\DipstickDlg.obj" \
+ "$(INTDIR)\DragPad.obj" \
+ "$(INTDIR)\HostNameDlg.obj" \
+ "$(INTDIR)\HostProperties.obj" \
+ "$(INTDIR)\kICMP.obj" \
+ "$(INTDIR)\OptionsDlg.obj" \
+ "$(INTDIR)\RegEx.obj" \
+ "$(INTDIR)\SelectURLsDlg.obj" \
+ "$(INTDIR)\StdAfx.obj" \
+ "$(INTDIR)\URLSource.obj"
+
+"$(OUTDIR)\dipstick.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+# Begin Custom Build
+OutDir=.\Release
+TargetName=dipstick
+InputPath=.\Release\dipstick.exe
+SOURCE=$(InputPath)
+
+"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 6
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+OUTDIR=.\Debug
+INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\Debug
+TargetName=dipstick
+# End Custom Macros
+
+ALL : "$(OUTDIR)\dipstick.exe" "$(OUTDIR)\dipstick.ex_"\
+ "$(OUTDIR)\dipstick.hlp" "$(OUTDIR)\dipstick.cnt" "$(OUTDIR)\dipstick.hl_"\
+ "$(OUTDIR)\dipstick.cn_"
+
+CLEAN :
+ -@erase "$(INTDIR)\AutoBestDlg.obj"
+ -@erase "$(INTDIR)\CrackURL.obj"
+ -@erase "$(INTDIR)\dipstick.cn_"
+ -@erase "$(INTDIR)\dipstick.cnt"
+ -@erase "$(INTDIR)\dipstick.hl_"
+ -@erase "$(INTDIR)\dipstick.hlp"
+ -@erase "$(INTDIR)\Dipstick.obj"
+ -@erase "$(INTDIR)\dipstick.pch"
+ -@erase "$(INTDIR)\dipstick.res"
+ -@erase "$(INTDIR)\DipstickDlg.obj"
+ -@erase "$(INTDIR)\DragPad.obj"
+ -@erase "$(INTDIR)\HostNameDlg.obj"
+ -@erase "$(INTDIR)\HostProperties.obj"
+ -@erase "$(INTDIR)\kICMP.obj"
+ -@erase "$(INTDIR)\OptionsDlg.obj"
+ -@erase "$(INTDIR)\RegEx.obj"
+ -@erase "$(INTDIR)\SelectURLsDlg.obj"
+ -@erase "$(INTDIR)\StdAfx.obj"
+ -@erase "$(INTDIR)\URLSource.obj"
+ -@erase "$(INTDIR)\vc40.idb"
+ -@erase "$(INTDIR)\vc40.pdb"
+ -@erase "$(OUTDIR)\dipstick.ex_"
+ -@erase "$(OUTDIR)\dipstick.exe"
+ -@erase "$(OUTDIR)\dipstick.ilk"
+ -@erase "$(OUTDIR)\dipstick.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
+ /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"stdafx.h"\
+ /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
+CPP_OBJS=.\Debug/
+CPP_SBRS=.\.
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /win32
+MTL_PROJ=/nologo /D "_DEBUG" /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dipstick.res" /d "_DEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/dipstick.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
+# ADD LINK32 uuid.lib /nologo /subsystem:windows /debug /machine:I386
+LINK32_FLAGS=uuid.lib /nologo /subsystem:windows /incremental:yes\
+ /pdb:"$(OUTDIR)/dipstick.pdb" /debug /machine:I386\
+ /out:"$(OUTDIR)/dipstick.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\AutoBestDlg.obj" \
+ "$(INTDIR)\CrackURL.obj" \
+ "$(INTDIR)\Dipstick.obj" \
+ "$(INTDIR)\dipstick.res" \
+ "$(INTDIR)\DipstickDlg.obj" \
+ "$(INTDIR)\DragPad.obj" \
+ "$(INTDIR)\HostNameDlg.obj" \
+ "$(INTDIR)\HostProperties.obj" \
+ "$(INTDIR)\kICMP.obj" \
+ "$(INTDIR)\OptionsDlg.obj" \
+ "$(INTDIR)\RegEx.obj" \
+ "$(INTDIR)\SelectURLsDlg.obj" \
+ "$(INTDIR)\StdAfx.obj" \
+ "$(INTDIR)\URLSource.obj"
+
+"$(OUTDIR)\dipstick.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+# Begin Custom Build
+OutDir=.\Debug
+TargetName=dipstick
+InputPath=.\Debug\dipstick.exe
+SOURCE=$(InputPath)
+
+"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+# PROP BASE Use_MFC 6
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Dipstick_"
+# PROP BASE Intermediate_Dir "Dipstick_"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 5
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Releast"
+# PROP Intermediate_Dir "Releast"
+# PROP Target_Dir ""
+OUTDIR=.\Releast
+INTDIR=.\Releast
+# Begin Custom Macros
+OutDir=.\Releast
+TargetName=dipstick
+# End Custom Macros
+
+ALL : "$(OUTDIR)\dipstick.exe" "$(OUTDIR)\dipstick.ex_"\
+ "$(OUTDIR)\dipstick.hlp" "$(OUTDIR)\dipstick.cnt" "$(OUTDIR)\dipstick.hl_"\
+ "$(OUTDIR)\dipstick.cn_"
+
+CLEAN :
+ -@erase "$(INTDIR)\AutoBestDlg.obj"
+ -@erase "$(INTDIR)\CrackURL.obj"
+ -@erase "$(INTDIR)\dipstick.cn_"
+ -@erase "$(INTDIR)\dipstick.cnt"
+ -@erase "$(INTDIR)\dipstick.hl_"
+ -@erase "$(INTDIR)\dipstick.hlp"
+ -@erase "$(INTDIR)\Dipstick.obj"
+ -@erase "$(INTDIR)\dipstick.pch"
+ -@erase "$(INTDIR)\dipstick.res"
+ -@erase "$(INTDIR)\DipstickDlg.obj"
+ -@erase "$(INTDIR)\DragPad.obj"
+ -@erase "$(INTDIR)\HostNameDlg.obj"
+ -@erase "$(INTDIR)\HostProperties.obj"
+ -@erase "$(INTDIR)\kICMP.obj"
+ -@erase "$(INTDIR)\OptionsDlg.obj"
+ -@erase "$(INTDIR)\RegEx.obj"
+ -@erase "$(INTDIR)\SelectURLsDlg.obj"
+ -@erase "$(INTDIR)\StdAfx.obj"
+ -@erase "$(INTDIR)\URLSource.obj"
+ -@erase "$(OUTDIR)\dipstick.ex_"
+ -@erase "$(OUTDIR)\dipstick.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /MD /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
+# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /c
+CPP_PROJ=/nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\Releast/
+CPP_SBRS=.\.
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /win32
+MTL_PROJ=/nologo /D "NDEBUG" /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x409 /d "NDEBUG"
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dipstick.res" /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/dipstick.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 lib\icmp.lib /nologo /subsystem:windows /machine:I386 /out:"Release/DipStick.exe"
+# ADD LINK32 uuid.lib /nologo /subsystem:windows /machine:I386
+LINK32_FLAGS=uuid.lib /nologo /subsystem:windows /incremental:no\
+ /pdb:"$(OUTDIR)/dipstick.pdb" /machine:I386 /out:"$(OUTDIR)/dipstick.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\AutoBestDlg.obj" \
+ "$(INTDIR)\CrackURL.obj" \
+ "$(INTDIR)\Dipstick.obj" \
+ "$(INTDIR)\dipstick.res" \
+ "$(INTDIR)\DipstickDlg.obj" \
+ "$(INTDIR)\DragPad.obj" \
+ "$(INTDIR)\HostNameDlg.obj" \
+ "$(INTDIR)\HostProperties.obj" \
+ "$(INTDIR)\kICMP.obj" \
+ "$(INTDIR)\OptionsDlg.obj" \
+ "$(INTDIR)\RegEx.obj" \
+ "$(INTDIR)\SelectURLsDlg.obj" \
+ "$(INTDIR)\StdAfx.obj" \
+ "$(INTDIR)\URLSource.obj"
+
+"$(OUTDIR)\dipstick.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+# Begin Custom Build
+OutDir=.\Releast
+TargetName=dipstick
+InputPath=.\Releast\dipstick.exe
+SOURCE=$(InputPath)
+
+"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
+
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Install - Win32 Debug"
+
+# PROP BASE Use_MFC 2
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Install\Debug"
+# PROP BASE Intermediate_Dir "Install\Debug"
+# PROP BASE Target_Dir "Install"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Install\Debug"
+# PROP Intermediate_Dir "Install\Debug"
+# PROP Target_Dir "Install"
+OUTDIR=.\Install\Debug
+INTDIR=.\Install\Debug
+
+ALL : "Dipstick - Win32 Debug" "$(OUTDIR)\Install.exe"
+
+CLEAN :
+ -@erase "$(INTDIR)\install.obj"
+ -@erase "$(INTDIR)\Install.res"
+ -@erase "$(INTDIR)\vc40.idb"
+ -@erase "$(INTDIR)\vc40.pdb"
+ -@erase "$(OUTDIR)\Install.exe"
+ -@erase "$(OUTDIR)\Install.ilk"
+ -@erase "$(OUTDIR)\Install.pdb"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
+CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
+ /D "_MBCS" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
+CPP_OBJS=.\Install\Debug/
+CPP_SBRS=.\.
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /win32
+MTL_PROJ=/nologo /D "_DEBUG" /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x409 /d "_DEBUG"
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /debug /machine:I386
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib version.lib /nologo /subsystem:windows /incremental:yes\
+ /pdb:"$(OUTDIR)/Install.pdb" /debug /machine:I386 /out:"$(OUTDIR)/Install.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\install.obj" \
+ "$(INTDIR)\Install.res"
+
+"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "Install - Win32 Pure"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Install\Pure"
+# PROP BASE Intermediate_Dir "Install\Pure"
+# PROP BASE Target_Dir "Install"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Install\Pure"
+# PROP Intermediate_Dir "Install\Pure"
+# PROP Target_Dir "Install"
+OUTDIR=.\Install\Pure
+INTDIR=.\Install\Pure
+
+ALL : "$(OUTDIR)\Install.exe"
+
+CLEAN :
+ -@erase "$(INTDIR)\install.obj"
+ -@erase "$(INTDIR)\Install.res"
+ -@erase "$(OUTDIR)\Install.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
+# ADD CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_MBCS" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\Install\Pure/
+CPP_SBRS=.\.
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /win32
+MTL_PROJ=/nologo /D "NDEBUG" /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386
+# SUBTRACT LINK32 /debug
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\
+ /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\install.obj" \
+ "$(INTDIR)\Install.res"
+
+"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "Install - Win32 Static"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Install\Static"
+# PROP BASE Intermediate_Dir "Install\Static"
+# PROP BASE Target_Dir "Install"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Install\Static"
+# PROP Intermediate_Dir "Install\Static"
+# PROP Target_Dir "Install"
+OUTDIR=.\Install\Static
+INTDIR=.\Install\Static
+
+ALL : "$(OUTDIR)\Install.exe"
+
+CLEAN :
+ -@erase "$(INTDIR)\install.obj"
+ -@erase "$(INTDIR)\Install.res"
+ -@erase "$(OUTDIR)\Install.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
+# ADD CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "STATI_K" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_MBCS" /D "STATI_K" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\Install\Static/
+CPP_SBRS=.\.
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /D "STATI_K" /win32
+MTL_PROJ=/nologo /D "NDEBUG" /D "STATI_K" /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG" /d "STATI_K"
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "STATI_K"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386 /out:"Install\Pure/Dipstick.exe"
+# SUBTRACT BASE LINK32 /debug
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386
+# SUBTRACT LINK32 /debug
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\
+ /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\install.obj" \
+ "$(INTDIR)\Install.res"
+
+"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF "$(CFG)" == "Install - Win32 Canned"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Install\Canned"
+# PROP BASE Intermediate_Dir "Install\Canned"
+# PROP BASE Target_Dir "Install"
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Install\Canned"
+# PROP Intermediate_Dir "Install\Canned"
+# PROP Target_Dir "Install"
+OUTDIR=.\Install\Canned
+INTDIR=.\Install\Canned
+
+ALL : "$(OUTDIR)\Install.exe"
+
+CLEAN :
+ -@erase "$(INTDIR)\install.obj"
+ -@erase "$(INTDIR)\Install.res"
+ -@erase "$(OUTDIR)\Install.exe"
+
+"$(OUTDIR)" :
+ if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+# ADD BASE CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
+# ADD CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "K_ANNED" /YX /c
+CPP_PROJ=/nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_MBCS" /D "K_ANNED" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c
+CPP_OBJS=.\Install\Canned/
+CPP_SBRS=.\.
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /D "K_ANNED" /win32
+MTL_PROJ=/nologo /D "NDEBUG" /D "K_ANNED" /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG" /d "K_ANNED"
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "K_ANNED"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
+BSC32_SBRS= \
+
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386 /out:"Install\Pure/Dipstick.exe"
+# SUBTRACT BASE LINK32 /debug
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386
+# SUBTRACT LINK32 /debug
+LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
+ odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\
+ /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe"
+LINK32_OBJS= \
+ "$(INTDIR)\install.obj" \
+ "$(INTDIR)\Install.res"
+
+"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ $(LINK32) @<<
+ $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF
+
+.c{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_OBJS)}.obj:
+ $(CPP) $(CPP_PROJ) $<
+
+.c{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cpp{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+.cxx{$(CPP_SBRS)}.sbr:
+ $(CPP) $(CPP_PROJ) $<
+
+################################################################################
+# Begin Target
+
+# Name "Dipstick - Win32 Release"
+# Name "Dipstick - Win32 Debug"
+# Name "Dipstick - Win32 Release Static"
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+!ENDIF
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\Dipstick.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_DIPST=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\Dipstick.obj" : $(SOURCE) $(DEP_CPP_DIPST) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_DIPST=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\Dipstick.obj" : $(SOURCE) $(DEP_CPP_DIPST) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_DIPST=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\Dipstick.obj" : $(SOURCE) $(DEP_CPP_DIPST) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\DipstickDlg.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_DIPSTI=\
+ ".\AutoBestDlg.h"\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\DragPad.h"\
+ ".\HostNameDlg.h"\
+ ".\HostProperties.h"\
+ ".\OptionsDlg.h"\
+ ".\SelectURLsDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+ ".\URLSource.h"\
+
+
+"$(INTDIR)\DipstickDlg.obj" : $(SOURCE) $(DEP_CPP_DIPSTI) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_DIPSTI=\
+ ".\AutoBestDlg.h"\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\DragPad.h"\
+ ".\HostNameDlg.h"\
+ ".\HostProperties.h"\
+ ".\OptionsDlg.h"\
+ ".\SelectURLsDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+ ".\URLSource.h"\
+
+
+"$(INTDIR)\DipstickDlg.obj" : $(SOURCE) $(DEP_CPP_DIPSTI) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_DIPSTI=\
+ ".\AutoBestDlg.h"\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\DragPad.h"\
+ ".\HostNameDlg.h"\
+ ".\HostProperties.h"\
+ ".\OptionsDlg.h"\
+ ".\SelectURLsDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+ ".\URLSource.h"\
+
+
+"$(INTDIR)\DipstickDlg.obj" : $(SOURCE) $(DEP_CPP_DIPSTI) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\StdAfx.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_STDAF=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+# ADD CPP /Yc"stdafx.h"
+
+BuildCmds= \
+ $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/"\
+ /c $(SOURCE) \
+
+
+"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
+ $(BuildCmds)
+
+"$(INTDIR)\dipstick.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
+ $(BuildCmds)
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_STDAF=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+# ADD CPP /Yc"stdafx.h"
+
+BuildCmds= \
+ $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
+ /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yc"stdafx.h"\
+ /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE) \
+
+
+"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
+ $(BuildCmds)
+
+"$(INTDIR)\dipstick.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
+ $(BuildCmds)
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_STDAF=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+# ADD BASE CPP /Yc"stdafx.h"
+# ADD CPP /Yc"stdafx.h"
+
+BuildCmds= \
+ $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS"\
+ /Fp"$(INTDIR)/dipstick.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \
+
+
+"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
+ $(BuildCmds)
+
+"$(INTDIR)\dipstick.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
+ $(BuildCmds)
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\dipstick.rc
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_RSC_DIPSTIC=\
+ ".\res\best.wav"\
+ ".\res\complete.ico"\
+ ".\res\Dipstick.ico"\
+ ".\res\dipstick.rc2"\
+ ".\res\kdnd.avi"\
+ ".\res\Kdragurl.avi"\
+ ".\res\pending.ico"\
+ ".\res\pinging.ico"\
+ ".\res\unreach.ico"\
+ ".\shared-data\klever-background.bmp"\
+
+
+"$(INTDIR)\dipstick.res" : $(SOURCE) $(DEP_RSC_DIPSTIC) "$(INTDIR)"
+ $(RSC) $(RSC_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_RSC_DIPSTIC=\
+ ".\res\background.bmp"\
+ ".\res\best.wav"\
+ ".\res\complete.ico"\
+ ".\res\Dipstick.ico"\
+ ".\res\dipstick.rc2"\
+ ".\res\kdnd.avi"\
+ ".\res\Kdragurl.avi"\
+ ".\res\pending.ico"\
+ ".\res\pinging.ico"\
+ ".\res\unreach.ico"\
+
+
+"$(INTDIR)\dipstick.res" : $(SOURCE) $(DEP_RSC_DIPSTIC) "$(INTDIR)"
+ $(RSC) $(RSC_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_RSC_DIPSTIC=\
+ ".\res\background.bmp"\
+ ".\res\best.wav"\
+ ".\res\complete.ico"\
+ ".\res\Dipstick.ico"\
+ ".\res\dipstick.rc2"\
+ ".\res\kdnd.avi"\
+ ".\res\Kdragurl.avi"\
+ ".\res\pending.ico"\
+ ".\res\pinging.ico"\
+ ".\res\unreach.ico"\
+
+
+"$(INTDIR)\dipstick.res" : $(SOURCE) $(DEP_RSC_DIPSTIC) "$(INTDIR)"
+ $(RSC) $(RSC_PROJ) $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\DragPad.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_DRAGP=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\DragPad.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\DragPad.obj" : $(SOURCE) $(DEP_CPP_DRAGP) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_DRAGP=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\DragPad.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\DragPad.obj" : $(SOURCE) $(DEP_CPP_DRAGP) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_DRAGP=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\DragPad.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\DragPad.obj" : $(SOURCE) $(DEP_CPP_DRAGP) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\OptionsDlg.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_OPTIO=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\OptionsDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) $(DEP_CPP_OPTIO) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_OPTIO=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\OptionsDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) $(DEP_CPP_OPTIO) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_OPTIO=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\OptionsDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) $(DEP_CPP_OPTIO) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\HostNameDlg.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_HOSTN=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\HostNameDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\HostNameDlg.obj" : $(SOURCE) $(DEP_CPP_HOSTN) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_HOSTN=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\HostNameDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\HostNameDlg.obj" : $(SOURCE) $(DEP_CPP_HOSTN) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_HOSTN=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\HostNameDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\HostNameDlg.obj" : $(SOURCE) $(DEP_CPP_HOSTN) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\HostProperties.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_HOSTP=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\HostProperties.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\HostProperties.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_HOSTP=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\HostProperties.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\HostProperties.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_HOSTP=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\DipstickDlg.h"\
+ ".\HostProperties.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\HostProperties.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\Help\DipStick.hpj
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+# Begin Custom Build - Making help file...
+OutDir=.\Release
+ProjDir=.
+TargetName=dipstick
+InputPath=.\help\dipstick.hpj
+
+BuildCmds= \
+ "$(ProjDir)\makehelp.bat" \
+ compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
+ compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
+
+
+"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+# Begin Custom Build - Making help file...
+OutDir=.\Debug
+ProjDir=.
+TargetName=dipstick
+InputPath=.\help\dipstick.hpj
+
+BuildCmds= \
+ "$(ProjDir)\makehelp.bat" \
+ compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
+ compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
+
+
+"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+# Begin Custom Build - Making help file...
+OutDir=.\Releast
+ProjDir=.
+TargetName=dipstick
+InputPath=.\help\dipstick.hpj
+
+BuildCmds= \
+ "$(ProjDir)\makehelp.bat" \
+ compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
+ compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
+
+
+"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\AutoBestDlg.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_AUTOB=\
+ ".\AutoBestDlg.h"\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+ ".\URLSource.h"\
+
+
+"$(INTDIR)\AutoBestDlg.obj" : $(SOURCE) $(DEP_CPP_AUTOB) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_AUTOB=\
+ ".\AutoBestDlg.h"\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+ ".\URLSource.h"\
+
+
+"$(INTDIR)\AutoBestDlg.obj" : $(SOURCE) $(DEP_CPP_AUTOB) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_AUTOB=\
+ ".\AutoBestDlg.h"\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+ ".\URLSource.h"\
+
+
+"$(INTDIR)\AutoBestDlg.obj" : $(SOURCE) $(DEP_CPP_AUTOB) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\URLSource.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_URLSO=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+ ".\URLSource.h"\
+
+
+"$(INTDIR)\URLSource.obj" : $(SOURCE) $(DEP_CPP_URLSO) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_URLSO=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+ ".\URLSource.h"\
+
+
+"$(INTDIR)\URLSource.obj" : $(SOURCE) $(DEP_CPP_URLSO) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_URLSO=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+ ".\URLSource.h"\
+
+
+"$(INTDIR)\URLSource.obj" : $(SOURCE) $(DEP_CPP_URLSO) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\Help\Dipstick.cnt
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\CrackURL.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_CRACK=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\CrackURL.obj" : $(SOURCE) $(DEP_CPP_CRACK) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_CRACK=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\CrackURL.obj" : $(SOURCE) $(DEP_CPP_CRACK) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_CRACK=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\CrackURL.obj" : $(SOURCE) $(DEP_CPP_CRACK) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\SelectURLsDlg.cpp
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_SELEC=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\SelectURLsDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\SelectURLsDlg.obj" : $(SOURCE) $(DEP_CPP_SELEC) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_SELEC=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\SelectURLsDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\SelectURLsDlg.obj" : $(SOURCE) $(DEP_CPP_SELEC) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_SELEC=\
+ ".\CrackURL.h"\
+ ".\Dipstick.h"\
+ ".\SelectURLsDlg.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+
+"$(INTDIR)\SelectURLsDlg.obj" : $(SOURCE) $(DEP_CPP_SELEC) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=".\shared-code\RegEx.cpp"
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_REGEX=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+# ADD CPP /Yu"../stdafx.h"
+
+"$(INTDIR)\RegEx.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+ $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\
+ /Fo"$(INTDIR)/" /c $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_REGEX=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+# ADD CPP /Yu"../stdafx.h"
+
+"$(INTDIR)\RegEx.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+ $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
+ /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\
+ /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_REGEX=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+# ADD CPP /Yu"../stdafx.h"
+
+"$(INTDIR)\RegEx.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+ $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h" /Fo"$(INTDIR)/" /c\
+ $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=".\shared-code\kICMP.cpp"
+
+!IF "$(CFG)" == "Dipstick - Win32 Release"
+
+DEP_CPP_KICMP=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+# ADD CPP /Yu"../stdafx.h"
+
+"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+ $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\
+ /Fo"$(INTDIR)/" /c $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
+
+DEP_CPP_KICMP=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+# ADD CPP /Yu"../stdafx.h"
+
+"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+ $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
+ /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\
+ /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
+
+DEP_CPP_KICMP=\
+ ".\CrackURL.h"\
+ ".\shared-code\ip_icmp.h"\
+ ".\shared-code\kICMP.h"\
+ ".\shared-code\ms_icmp.h"\
+ ".\shared-code\RegEx.h"\
+ ".\stdafx.h"\
+
+# ADD CPP /Yu"../stdafx.h"
+
+"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
+ "$(INTDIR)\dipstick.pch"
+ $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
+ "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h" /Fo"$(INTDIR)/" /c\
+ $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+# End Target
+################################################################################
+# Begin Target
+
+# Name "Install - Win32 Debug"
+# Name "Install - Win32 Pure"
+# Name "Install - Win32 Static"
+# Name "Install - Win32 Canned"
+
+!IF "$(CFG)" == "Install - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "Install - Win32 Pure"
+
+!ELSEIF "$(CFG)" == "Install - Win32 Static"
+
+!ELSEIF "$(CFG)" == "Install - Win32 Canned"
+
+!ENDIF
+
+################################################################################
+# Begin Source File
+
+SOURCE=.\Install\Install.rc
+DEP_RSC_INSTA=\
+ ".\Install\Custom.rch"\
+ ".\shared-data\install-icon.ico"\
+
+
+!IF "$(CFG)" == "Install - Win32 Debug"
+
+
+"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
+ $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "_DEBUG"\
+ $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Install - Win32 Pure"
+
+
+"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
+ $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG"\
+ $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Install - Win32 Static"
+
+
+"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
+ $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG" /d\
+ "STATI_K" $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Install - Win32 Canned"
+
+
+"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
+ $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG" /d\
+ "K_ANNED" $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Source File
+
+SOURCE=.\Install\install.cpp
+DEP_CPP_INSTAL=\
+ ".\shared-code\install.h"\
+
+
+!IF "$(CFG)" == "Install - Win32 Debug"
+
+
+"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Install - Win32 Pure"
+
+
+"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Install - Win32 Static"
+
+
+"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ELSEIF "$(CFG)" == "Install - Win32 Canned"
+
+
+"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+!ENDIF
+
+# End Source File
+################################################################################
+# Begin Project Dependency
+
+# Project_Dep_Name "Dipstick"
+
+!IF "$(CFG)" == "Install - Win32 Debug"
+
+"Dipstick - Win32 Debug" :
+ $(MAKE) /$(MAKEFLAGS) /F ".\dipstick.mak" CFG="Dipstick - Win32 Debug"
+
+!ELSEIF "$(CFG)" == "Install - Win32 Pure"
+
+!ELSEIF "$(CFG)" == "Install - Win32 Static"
+
+!ELSEIF "$(CFG)" == "Install - Win32 Canned"
+
+!ENDIF
+
+# End Project Dependency
+# End Target
+# End Project
+################################################################################
diff --git a/dipstick.rc b/dipstick.rc
new file mode 100644
index 0000000..55b8d98
--- a/dev/null
+++ b/dipstick.rc
@@ -0,0 +1,567 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "#ifdef _WIN32\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#pragma code_page(1252)\r\n"
+ "#endif\r\n"
+ "#include ""res\\Dipstick.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON DISCARDABLE "res\\Dipstick.ico"
+IDI_PINGING ICON DISCARDABLE "res\\pinging.ico"
+IDI_PENDING ICON DISCARDABLE "res\\pending.ico"
+IDI_COMPLETED ICON DISCARDABLE "res\\complete.ico"
+IDI_UNREACHABLE ICON DISCARDABLE "res\\unreach.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 213, 61
+STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "About Dipstick"
+FONT 8, "MS Sans Serif"
+BEGIN
+ ICON IDR_MAINFRAME,IDC_STATIC,11,17,21,20
+ LTEXT "Dipstick, Version 3.00",IDC_STATIC,40,7,89,8,
+ SS_NOPREFIX
+ LTEXT "Copyright © 1996,1997,1998,2002 Klever Group",
+ IDC_STATIC,40,25,166,8
+ DEFPUSHBUTTON "OK",IDOK,174,7,32,14,WS_GROUP
+ PUSHBUTTON "http://www.klever.net/",IDC_KLEVERNET,40,40,91,14
+END
+
+IDD_DIPSTICK_DIALOG DIALOGEX 0, 0, 419, 152
+STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP |
+ WS_EX_APPWINDOW
+CAPTION " Dipstick 3.00"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ CONTROL "List1",IDC_HOSTLIST,"SysListView32",LVS_REPORT |
+ LVS_SORTASCENDING | LVS_AUTOARRANGE | WS_BORDER |
+ WS_TABSTOP,8,8,349,136,WS_EX_CLIENTEDGE
+ PUSHBUTTON "&Manual Ping",IDC_MANUALPING,361,8,50,14
+ PUSHBUTTON "&Reping",IDC_REPING,361,23,50,14,WS_DISABLED
+ PUSHBUTTON "Reping &All",IDC_REPINGALL,361,38,50,14,WS_DISABLED
+ PUSHBUTTON "R&emove",IDC_REMOVE,361,53,50,14,WS_DISABLED
+ PUSHBUTTON "Remove A&ll",IDC_CLEAR,361,68,50,14,WS_DISABLED
+ PUSHBUTTON "&Help",ID_HELP,361,99,50,14
+ PUSHBUTTON "&Options",IDC_OPTIONS,361,114,50,14
+ PUSHBUTTON "E&xit Dipstick",IDC_EXIT,361,129,50,14
+ PUSHBUTTON "",IDCANCEL,411,2,6,6,NOT WS_VISIBLE | WS_DISABLED
+ PUSHBUTTON "Ad&vanced",IDC_ADVANCED,361,83,50,11
+END
+
+IDD_DRAGPAD DIALOGEX 0, 0, 53, 33
+STYLE DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
+EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP
+CAPTION " Drag URL here"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ CONTROL "Animate1",IDC_DNDTARGET,"SysAnimate32",WS_TABSTOP,0,0,
+ 53,33
+ PUSHBUTTON "",IDCANCEL,49,0,6,6,NOT WS_VISIBLE | WS_DISABLED
+ DEFPUSHBUTTON "",IDOK,47,27,6,6,NOT WS_VISIBLE | WS_DISABLED
+END
+
+IDD_OPTIONS DIALOGEX 0, 0, 179, 154
+STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
+EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP
+CAPTION "Dipstick Options"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ LTEXT "Number of pings per &host",IDC_STATIC,50,9,122,10
+ EDITTEXT IDC_NPINGS,7,7,35,14,ES_AUTOHSCROLL
+ CONTROL "Spin1",IDC_SPINPINGS,"msctls_updown32",UDS_WRAP |
+ UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
+ UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,7,11,14
+ LTEXT "&Maximum number of threads",IDC_STATIC,50,23,122,10
+ EDITTEXT IDC_MAXPINGS,7,21,35,14,ES_AUTOHSCROLL
+ CONTROL "Spin1",IDC_SPINMAXPINGS,"msctls_updown32",UDS_WRAP |
+ UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
+ UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,21,11,14
+ LTEXT "Ping &timeout",IDC_STATIC,50,37,122,10
+ EDITTEXT IDC_TIMEOUT,7,35,35,14,ES_AUTOHSCROLL
+ CONTROL "Spin1",IDC_SPINTIMEOUT,"msctls_updown32",UDS_WRAP |
+ UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
+ UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,35,11,14
+ LTEXT "&Interval between pings",IDC_STATIC,50,51,122,10
+ EDITTEXT IDC_INTERVAL,7,49,35,14,ES_AUTOHSCROLL
+ CONTROL "Spin1",IDC_SPINTERVAL,"msctls_updown32",UDS_WRAP |
+ UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
+ UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,49,11,14
+ LTEXT "Ping &size",IDC_STATIC,50,65,122,10
+ EDITTEXT IDC_PACKETSIZE,7,63,35,14,ES_AUTOHSCROLL
+ CONTROL "Spin1",IDC_SPINSIZE,"msctls_updown32",UDS_WRAP |
+ UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
+ UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,63,11,14
+ CONTROL "Test i&nnermost URL",IDC_MSWORKAROUND,"Button",
+ BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,7,80,165,8
+ DEFPUSHBUTTON "OK",IDOK,31,133,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,97,133,50,14
+ CONTROL "Come up with the &best URL",IDC_AUTOBEST,"Button",
+ BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,16,90,156,8
+ CONTROL "When selecting URLs, enable smart adjust",
+ IDC_SMARTADJUST,"Button",BS_AUTOCHECKBOX | BS_NOTIFY |
+ WS_TABSTOP,7,100,165,8
+ CONTROL "When smart-adjusting, use innermost URL",IDC_ADJUSTINN,
+ "Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,16,110,
+ 156,8
+ CONTROL "Ignore relative URLs when dragging selection.",
+ IDC_IGNORELA,"Button",BS_AUTOCHECKBOX | BS_NOTIFY |
+ WS_TABSTOP,7,120,165,8
+END
+
+IDD_MANUALHOST DIALOGEX 0, 0, 187, 54
+STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
+EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
+CAPTION " Manually Test Host"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ LTEXT "Enter &URL, host name or ip address:",IDC_STATIC,7,7,
+ 129,8
+ EDITTEXT IDC_HOST,7,16,173,14,ES_LOWERCASE | ES_AUTOHSCROLL
+ DEFPUSHBUTTON "OK",IDOK,35,33,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,101,33,50,14
+END
+
+IDD_PROPS DIALOGEX 0, 0, 209, 99
+STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
+EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
+CAPTION " Properties"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,152,78,50,14
+ LTEXT "URL:",IDC_URLCAPTION,7,7,18,8,SS_NOTIFY
+ LTEXT "..",IDC_URL,60,7,142,8,SS_NOPREFIX | SS_NOTIFY
+ LTEXT "Host name:",IDC_HOSTCAPTION,7,17,37,8,SS_NOTIFY
+ LTEXT "..",IDC_HOST,60,17,142,8,SS_NOPREFIX | SS_NOTIFY
+ LTEXT "IP:",IDC_IPCAPTION,7,27,10,8,SS_NOTIFY
+ LTEXT "..",IDC_IP,60,27,142,8,SS_NOTIFY
+ LTEXT "Ping times (min/avg/max):",IDC_TIMESCAPTION,7,37,53,17,
+ SS_NOTIFY
+ LTEXT "../../..",IDC_TIMES,60,45,66,8,SS_NOTIFY
+ LTEXT "Packet loss:",IDC_LOSSCAPTION,7,56,40,8,SS_NOTIFY
+ LTEXT "..",IDC_LOSS,60,56,66,8,SS_NOPREFIX | SS_NOTIFY
+ LTEXT "Status:",IDC_STATUSCAPTION,7,66,23,8,SS_NOTIFY
+ LTEXT "..",IDC_STATUS,60,66,142,8,SS_NOPREFIX | SS_NOTIFY
+ PUSHBUTTON "&Open URL",IDC_OPENURL,7,78,50,14
+ ICON IDR_MAINFRAME,IDC_STATE,166,42,18,20,SS_NOTIFY |
+ SS_CENTERIMAGE | SS_REALSIZEIMAGE
+ PUSHBUTTON "&Copy URL",IDC_COPYURL,60,78,50,14
+END
+
+IDD_AUTOBEST DIALOGEX 0, 0, 287, 82
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
+ WS_CAPTION
+EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
+CAPTION " Dipstick - report"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ DEFPUSHBUTTON "Open this URL",IDOK,110,47,68,14
+ PUSHBUTTON "&Next Location",IDC_NEXT,188,47,68,14
+ PUSHBUTTON "&Previous Location",IDC_PREV,32,47,68,14
+ CTEXT "..",IDC_URL,7,7,273,14,SS_NOPREFIX,WS_EX_DLGMODALFRAME |
+ WS_EX_CLIENTEDGE
+ LTEXT "Average Response Time, milliseconds:",IDC_STATIC,7,25,
+ 136,8
+ LTEXT "..",IDC_RTT,143,25,68,8
+ LTEXT "Packet Loss:",IDC_STATIC,7,36,136,8
+ LTEXT "..",IDC_PKTLOSS,143,36,68,8
+ PUSHBUTTON "Cancel",IDCANCEL,118,63,50,12
+ CONTROL "Animate1",IDC_DROPSOURCE,"SysAnimate32",ACS_CENTER |
+ ACS_AUTOPLAY,257,23,23,22,WS_EX_DLGMODALFRAME |
+ WS_EX_STATICEDGE
+ PUSHBUTTON "&Copy URL",IDC_COPYURL,211,23,39,22,BS_CENTER |
+ BS_VCENTER | BS_MULTILINE
+END
+
+IDD_URLS DIALOGEX 0, 0, 176, 192
+STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_MAXIMIZEBOX | WS_POPUP |
+ WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
+EXSTYLE WS_EX_CLIENTEDGE
+CAPTION " Select URLs of interest"
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ LISTBOX IDC_URLS,7,7,162,146,LBS_SORT | LBS_NOINTEGRALHEIGHT |
+ LBS_EXTENDEDSEL | NOT WS_BORDER | WS_VSCROLL |
+ WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
+ DEFPUSHBUTTON "OK",IDOK,7,155,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,7,171,50,14
+ CONTROL "&Smart adjust selection",IDC_DOADJUST,"Button",
+ BS_AUTOCHECKBOX | BS_TOP | WS_TABSTOP,63,157,106,10
+ CONTROL "Adjust by &innermost URL",IDC_ADJUSTINN,"Button",
+ BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,63,
+ 175,106,10
+END
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 3,0,0,0
+ PRODUCTVERSION 3,0,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x9L
+#else
+ FILEFLAGS 0x8L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
+ VALUE "FileDescription", "Dipstick, mirror locator\0"
+ VALUE "FileVersion", "3, 0, 0, 0\0"
+ VALUE "InternalName", "DIPSTICK\0"
+ VALUE "LegalCopyright", "Copyright © 1996, 1997, 1998, 2002 Klever Group (http://www.klever.net/)\0"
+ VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
+ VALUE "OriginalFilename", "DIPSTICK.EXE\0"
+ VALUE "ProductName", "Dipstick\0"
+ VALUE "ProductVersion", "3, 0, 0, 0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ IDD_ABOUTBOX, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 206
+ VERTGUIDE, 40
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 54
+ END
+
+ IDD_DIPSTICK_DIALOG, DIALOG
+ BEGIN
+ VERTGUIDE, 8
+ VERTGUIDE, 411
+ HORZGUIDE, 8
+ HORZGUIDE, 144
+ END
+
+ IDD_OPTIONS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 172
+ VERTGUIDE, 16
+ VERTGUIDE, 50
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 147
+ END
+
+ IDD_MANUALHOST, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 180
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 47
+ END
+
+ IDD_PROPS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 202
+ VERTGUIDE, 60
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 92
+ END
+
+ IDD_AUTOBEST, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 280
+ VERTGUIDE, 143
+ VERTGUIDE, 211
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 75
+ HORZGUIDE, 25
+ HORZGUIDE, 44
+ END
+
+ IDD_URLS, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 169
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 185
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// AVI
+//
+
+IDR_DNDAVI AVI DISCARDABLE "res\\kdnd.avi"
+IDR_DRAGAVI AVI DISCARDABLE "res\\kdragurl.avi"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MENU MENU DISCARDABLE
+BEGIN
+ POPUP "Drag pad"
+ BEGIN
+ MENUITEM "&Manual Ping", ID_DRAGPAD_MANUALPING
+ MENUITEM "&Paste URL(s)", ID_DRAGPAD_PASTEURL
+ MENUITEM "Reping &All", ID_DRAGPAD_REPINGALL
+ MENUITEM "Remove A&ll", ID_DRAGPAD_REMOVEALL
+ MENUITEM SEPARATOR
+ MENUITEM "&Options", ID_DRAGPAD_OPTIONS
+ MENUITEM "&Show main window", ID_DRAGPAD_SHOWMAINWINDOW
+ POPUP "Ad&vanced"
+ BEGIN
+ MENUITEM "&Export List", ID_DRAGPAD_ADVANCED_EXPORTLIST
+
+ MENUITEM "&Import List", ID_DRAGPAD_ADVANCED_IMPORTLIST
+
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "&Help", ID_DRAGPAD_HELP
+ MENUITEM "A&bout Dipstick", ID_DRAGPAD_ABOUT
+ MENUITEM "E&xit Dipstick", ID_DRAGPAD_EXIT
+ END
+ POPUP "Host List"
+ BEGIN
+ MENUITEM "&Reping", ID_HOSTLIST_REPING
+ MENUITEM "R&emove", ID_HOSTLIST_REMOVE
+ MENUITEM "Open URL", ID_HOSTLIST_OPENURL
+ MENUITEM "&Copy URL", ID_HOSTLIST_COPYURL
+ MENUITEM SEPARATOR
+ MENUITEM "Reping &All", ID_HOSTLIST_REPINGALL
+ MENUITEM "Remove A&ll", ID_HOSTLIST_REMOVEALL
+ MENUITEM SEPARATOR
+ MENUITEM "&Paste URL(s)", ID_HOSTLIST_PASTEURL
+ MENUITEM "&Properties", ID_HOSTLIST_PROPERTIES
+ END
+ POPUP "Advanced"
+ BEGIN
+ MENUITEM "&Export List", ID_ADVANCED_EXPORTLIST
+ MENUITEM "&Import List", ID_ADVANCED_IMPORTLIST
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Bitmap
+//
+
+IDB_DIABACK BITMAP DISCARDABLE "shared-data/klever-background.bmp"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// WAVE
+//
+
+IDW_BESTURL WAVE DISCARDABLE "res\\best.wav"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_ABOUTBOX "&About Dipstick.."
+ IDS_PS_FAILEDTOLOCK "Failed to gain access to internal resources. Please, report to Klever."
+ IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed."
+ IDS_CSVEXT ".csv"
+ IDS_HN_BADURL "Bad URL"
+ IDS_ABEST_CLEANUP "Remove all locations from list?"
+ IDS_ABEST_NONEFOUND "No reachable locations were found."
+ IDS_ABEST_TITLE " Dipstick - report"
+ IDS_DRAGPAD_TITLE " Dipstick 3.00"
+ IDS_DRAGPAD_URLS " %d/%d URL(s)"
+ IDS_REGEX_HTMLURL "<A[^[:alpha:]][^>]*href[[:space:]]*=[[:space:]]*""?([^[:space:]>""]+)""?[^>]*>"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_KLEVERNET_URL "http://www.klever.net/"
+ IDS_PS_INTERNALERROR "Internal Error. Please report to Klever."
+ IDS_PS_NETUNREACHABLE "Destination network unreachable"
+ IDS_PS_HOSTUNREACHABLE "Destination host unreachable"
+ IDS_PS_PROTUNREACHABLE "Destination protocol unreachable"
+ IDS_PS_PORTUNREACHABLE "Destination port unreachable"
+ IDS_PS_NORESOURCES "No resources"
+ IDS_PS_HWERROR "Hardware error"
+ IDS_PS_BIGPACKET "Packet size is too big"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDC_DNDTARGET "Dipstick 3.00, click the right mouse button to display main window, left mouse button for menu"
+ IDC_HOST "Host name as specified or resolved by Dipstick"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDC_URLCAPTION "Universal Resource Locator (URL) associated with this location"
+ IDC_URL "Universal Resource Locator (URL) associated with this location"
+ IDC_HOSTCAPTION "Host name as specified or resolved by Dipstick"
+ IDC_IPCAPTION "Host's IP address as specified or resolved by Dipstick"
+ IDC_TIMESCAPTION "Minmum, maximum and average round trip time in milliseconds. The less the better."
+ IDC_TIMES "Minmum, maximum and average round trip time in milliseconds. The less the better."
+ IDC_LOSSCAPTION "IP packets loss"
+ IDC_LOSS "IP packets loss"
+ IDC_STATUSCAPTION "Last error occured during attempt to ping this location"
+ IDC_STATUS "Last error occured during attempt to ping this location"
+ IDC_OPENURL "Open URL in your default browser"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_PS_TIMEOUT "Request timed out"
+ IDS_PS_BADROUTE "Bad route"
+ IDS_PS_TTLEXPTRANSIT "TTL expired in transit"
+ IDS_PS_TTLEXPREASM "TTL expired during reassembly"
+ IDS_PS_IPARAMP "IP parameter problem"
+ IDS_PS_SOURCEQUENCH "Source quench received"
+ IDS_PS_BIGOPTION "Option is too big"
+ IDS_PS_BADDEST "Bad destination"
+ IDS_PS_UNKNOWNERROR "Unknown error"
+ IDS_REGISTRYKEY "Klever Group, Inc."
+ IDS_FMT_TIMES "%lu/%lu/%lu"
+ IDS_FMT_LOSS "%d%%"
+ IDS_TIP_UNREACHABLE "This location seems to be unreachable"
+ IDS_PS_FAILEDTORESOLVE "Unable to resolve host IP"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_PS_UNABLETOICMP "Unable to initialize ICMP services"
+ IDS_TIP_PENDING "This location is waiting for it's turn to get pinged"
+ IDS_TIP_COMPLETE "Pinging of this location has been completed"
+ IDS_TIP_PROPSOK "Click OK if you're done with looking and want to dismiss this window"
+ IDS_TIP_INTERVAL "Interval between ping requests in seconds"
+ IDS_TIP_OPTIONSOK "Click OK to make changes permanent"
+ IDS_TIP_OPTIONSCANCEL "Click CANCEL to leave dialog without making any changes"
+ IDS_TIP_PINGING "This location is being pinged at the moment.."
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDC_MSWORKAROUND "In case of REDIRed URL - test the innermost one"
+END
+
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_CSVFILTER "Comma Separated Values (*.csv)|*.csv|All Files (*.*)|*.*||"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE 9, 1
+#pragma code_page(1252)
+#endif
+#include "res\Dipstick.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/help/dipstick.cnt b/help/dipstick.cnt
new file mode 100644
index 0000000..150117c
--- a/dev/null
+++ b/help/dipstick.cnt
@@ -0,0 +1,8 @@
+:Base DipStick.hlp>Standard
+:Title Dipstick
+1 Dipstick
+2 About Dipstick=About
+2 Using Dipstick=Using
+2 Main Window=MainWindow
+2 Dipstick Options=Options
+2 What's New=News
diff --git a/help/dipstick.hpj b/help/dipstick.hpj
new file mode 100644
index 0000000..6d63b4c
--- a/dev/null
+++ b/help/dipstick.hpj
@@ -0,0 +1,29 @@
+; This file is maintained by HCW. Do not modify this file directly.
+
+[OPTIONS]
+COMPRESS=12 Hall Zeck
+LCID=0x409 0x0 0x0 ;English (United States)
+REPORT=Yes
+CONTENTS=About
+TITLE=Dipstick
+CNT=dipstick.cnt
+HLP=DIPSTICK.HLP
+
+[FILES]
+dipstick.rtf
+
+[ALIAS]
+HIDD_ABOUTBOX=About
+HIDD_AUTOBEST=Autobest
+HIDD_DRAGPAD=Using
+HIDD_MANUALHOST=MainWindowMP
+HIDD_OPTIONS=Options
+HIDD_PROPS=Properties
+HIDD_DIPSTICK_DIALOG=MainWindow
+HIDD_URLS=SelectURLs
+
+[MAP]
+#include dipstick.hm
+
+[WINDOWS]
+Standard="",(471,3,551,849),29444,(r14876671),(r12632256),f2
diff --git a/help/dipstick.rtf b/help/dipstick.rtf
new file mode 100644
index 0000000..a37a39f
--- a/dev/null
+++ b/help/dipstick.rtf
@@ -0,0 +1,139 @@
+{\rtf1\ansi
+@{\footnote
+THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.
+DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD
+}
+{\fonttbl{\f0\froman Times New Roman;}{\f1\fswiss Arial;}{\f3\froman Symbol;}}{\colortbl;
+ \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
+ \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
+ \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
+ \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+
+\pard\plain\keepn
+#{\footnote About}
+${\footnote About Dipstick}
+K{\footnote about}
+{ \f1\fs18\b\sb120 About {\b Dipstick}}
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b Dipstick} is our award-winning freeware that allows you to evaluate {\i mirror sites} to figure out which one has currently the least traffic.
+\par\sa120\sb120\qj\pard \f1\fs18\sb120
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b {\i Enjoy!}}
+{
+\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) 1996, 1997, 1998, 2002 {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")}
+\par\qj\sb120\sa120Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+\par \sa360 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+}
+\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")}
+\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}
+\page
+
+\pard\plain\keepn
+#{\footnote News}
+${\footnote What's new}
+{ \f1\fs18\b\sb120 What's New}
+\par\pard\plain\f1\fs24\qc\cf2\b 3.00 - August 19st, 2002
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Change of {\uldb license}{\v About} and opening the source.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Minor cosmetic changes
+\par\pard\plain\f1\fs24\qc\cf2\b 2.52 - June 3rd, 1998
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Now works properly with Winsock 2 for Windows95. Also may start working with non-Microsoft TCP/IP stacks.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Fixed bug that caused GPF when removing all URLs after testing is over and you picked the URL of your choice.
+\par\pard\plain\f1\fs24\qc\cf2\b 2.5 - December 30th, 1997
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Ability to export/import sets of URLs.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Copy URL menu command in the Main Window and button in the Best URL window.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Multiple URLs dragging or pasting. Works only for MSIE4 browser.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Annoying ToolTips removed.
+\par\pard\plain\f1\fs24\qc\cf2\b 2.00 - July 1st, 1997
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Drag'n'drop source added to the Best URL window.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Completed/Total URLs counter added to {\b Dipstick} drag pad.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet You may now drag'n'drop URLs from main {\b Dipstick} dialog window.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Added ability to paste URLs into {\b Dipstick} instead of dropping.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet New install program now lets you install {\b Dipstick} to the location of your choice.
+\par\pard\plain\f1\fs24\qc\cf2\b 1.01 - March 13th, 1997
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Resizable main {\b Dipstick} dialog window.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Come up with the best URL automatically.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Workaround for redir.dll
+\par\pard\plain\fi0\li0\f1\fs18 \bullet No more {\b\cf6 MSIE} 3.0 requirement.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet Remembers window positions and size as well as columns widths.
+\par\pard\plain\fi0\li0\f1\fs18 \bullet When manually adding locations - you may specify the URL, not host name as it was before (I still wonder how it came to my mind)
+\page
+
+\pard\plain\keepn
+#{\footnote Using}
+${\footnote Using Dipstick}
+{ \f1\fs18\b\sb120 Using {\b Dipstick}}
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 To use {\b Dipstick}, please follow these steps:\pard
+\par \fi0\li0 \bullet Load the page that contains links into your {\b\cf6 MSIE} or {\b\cf6 Netscape} browser.
+\par \fi0\li0 \bullet Drag'n'drop desired links to {\b Dipstick} window.
+\par \fi0\li0 \bullet {#{\footnote UsingManual}}(Optional) you can also manually add as many links as you want by selecting {\b Manual Ping} option. You can enter {\i url}, {\i hostname} or {\i IP address} there.
+\par \fi0\li0 \bullet You will see rain going thought {\b Dipstick} window. After the rain stops, {\b Dipstick} will show you results either by suggesting the best URL or by sorting results in a table (which can be viewed by clicking on {\b Dipstick} window).
+\par \fi0\li0 \bullet After you are done, you can reping all selected URLs by clicking {\uldb {\b Reping All}}{\v MainWindowRA} button in {\b Dipstick} window.\pard
+\par\sa120\sb120\qj\f1\fs16 Small note for newbies (all others, please do not get mad): To drag'n'drop the URL, you need to move your mouse to the link on the web page, press and hold the select (usually - left) mouse button, and drag the mouse (with the selected URL to {\b Dipstick} window and then release mouse button.
+\page
+
+\pard\plain\keepn
+#{\footnote MainWindow}
+${\footnote Main Window}
+{ \f1\fs18\b\sb120 Main Window}
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 The main window consists of -\pard
+\par \fi0\li0 \bullet {\b Brilliant ListView with the following columns:}
+\par \fi0\li0 \bullet Host Name - host name as it was specified in the URL or resolved from IP address.
+\par \fi0\li0 \bullet Host IP address - host IP address as it was specified in the URL or resolved from host name.
+\par \fi0\li0 \bullet Min RTT - Minimum Round Trip Time. {\b Dipstick} sends a few echo requests to remote host and calculates minimum, maximum, and average Round Trip Times. The less the better.
+\par \fi0\li0 \bullet Avg RTT - Average Round Trip Time. About the same meaning as in Min RTT, but this is the average one. The less the better. By default locations are sorted by Avg RTT.
+\par \fi0\li0 \bullet Max RTT - Maximum Round Trip Time. About the same meaning as in Min RTT and Avg RTT, but this is maximum one. The less the better.
+\par \fi0\li0 \bullet Pktloss - Percentage of the requests lost somewhere in the net. The less the better.
+\par \fi0\li0 \bullet {\b Buttons:}
+\par \fi0\li0 \bullet {#{\footnote MainWindowMP}}Manual Ping - lets you add location manually (usually you just drag'n'drop locations into {\b Dipstick} window.
+\par \fi0\li0 \bullet Reping - Test selected location again.
+\par \fi0\li0 \bullet {#{\footnote MainWindowRA}}Reping All - Test again all locations in the list.
+\par \fi0\li0 \bullet Remove - Remove selected location from the list.
+\par \fi0\li0 \bullet Remove All - Remove all locations from the list.
+\par \fi0\li0 \bullet Help - I think you have a clue on what this button does.
+\par \fi0\li0 \bullet Options - Set {\b Dipstick} options
+\par \fi0\li0 \bullet Exit Dipstick - Close {\b Dipstick} program\pard
+\page
+
+\pard\plain\keepn
+#{\footnote Options}
+${\footnote Dipstick Options}
+{ \f1\fs18\b\sb120 {\b Dipstick} Opions}
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 Options are:\pard
+\par \fi0\li0 \bullet {#{\footnote OptionsPPH}}{\b Number of pings per host} - number of echo requests to send for each location.
+\par \fi0\li0 \bullet {\b Maximum number of threads} - number of locations to process at the same time. adjust this if you have unusually fast or slow connection and/or computer.
+\par \fi0\li0 \bullet {\b Ping Timeout} - number of seconds to wait between sending echo requests.
+\par \fi0\li0 \bullet {\b Interval between pings} - number of seconds to wait between sending echo requests.
+\par \fi0\li0 \bullet {\b Ping size} - number of bytes to send in each echo request.
+\par \fi0\li0 \bullet {#{\footnote OptionsIM}}{\b Test innermost URL} - in case of nesting {\b redir}ed URLs test the innermost one. Some strange companies refer to their mirrors using {\b redir.dll} so that the URLs for files located on different machines look like they're all here. Like {\b http://www.punchcards.com/redir.dll?target=http://www.punchcards.mirrordudes.com/file.exe&puchcards=advanced}
+\par \fi0\li0 \bullet {#{\footnote OptionsBU}}{\b Come up with the best URL} - pop up with a suggestion about the best URL (after all locations have been pinged and have nothing left to do other than to start dowloading).\pard
+\page
+
+\pard\plain\keepn
+#{\footnote Properties}
+${\footnote URL properties}
+{ \f1\fs18\b\sb120 URL Properties}
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 URL Properties are:\pard
+\par \fi0\li0 \bullet {\b URL} - the URL itself if present.
+\par \fi0\li0 \bullet {\b Host name} - host name as specified in URL (or the innermost URL in case of {\b redir}ed URLs in the {\uldb appropriate option}{\v OptionsIM} is turned on or resolved by {\b Dipstick}.
+\par \fi0\li0 \bullet {\b Ping times} - minimum, average, and mmaximum round trip times if available.
+\par \fi0\li0 \bullet {\b Packet loss} - percentage of packets lost in transmission.
+\par \fi0\li0 \bullet {\b Status} - description of last error occured (if any).\pard
+\page
+
+\pard\plain\keepn
+#{\footnote SelectURLs}
+${\footnote Select URLs Dialog}
+{ \f1\fs18\b\sb120 Select URLs dialog}
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 If you're dragging or cut'n'pasting selection from {\b\cf6 MSIE4} browser, you're supposed to chose which URLs to test.
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 There are two options you may want to change when selecting URLs from list:\pard
+\par \fi0\li0 \bullet {\b Smart adjust selection} - let {\b Dipstick} adjust current selection when you're clicking URL based on the URL you click.
+\par \fi0\li0 \bullet {\b Adjusst by innermost URL} - use the innermost URL when adjusting selection.\pard
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 The default values for these options are also available from the {\uldb {\b Options}}{\v Options} dialog box.
+\page
+
+\pard\plain\keepn
+#{\footnote Autobest}
+${\footnote Dipstick Report}
+{ \f1\fs18\b\sb120 {\b Dipstick} report}
+\par\sa120\sb120\qj\pard \f1\fs18\sb120 When {\b Dipstick} has finished testing and there's nothing left but to start your download, you're presented with a suggestion about the best URL. From this dialog you may chose to browse to the location you like using {\b Previous Location} and {\b Next Location} buttons, {\b Open this URL}, {\b Copy URL} to clipboard or drag it to wherever you want.
+\page
+} \ No newline at end of file
diff --git a/help/dipstick.xml b/help/dipstick.xml
new file mode 100644
index 0000000..b6e0748
--- a/dev/null
+++ b/help/dipstick.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0"?>
+<winhelp>
+ <topic id="About" title="About Dipstick" keywords="about">
+ <heading scroll="no">About <kin>Dipstick</kin></heading>
+ <p><kin>Dipstick</kin> is our award-winning freeware that allows you to evaluate <term>mirror sites</term> to figure out which one has currently the least traffic.</p>
+ <p/>
+ <p><b><i>Enjoy!</i></b></p>
+ <license years="1996, 1997, 1998, 2002"/>
+ <credits/>
+ </topic>
+ <topic id="News" title="What's new">
+ <heading scroll="no">What's New</heading>
+ <newsfor version="3.00" date="August 19st, 2002">
+ <ni>Change of <a href="#About">license</a> and opening the source.</ni>
+ <ni>Minor cosmetic changes</ni>
+ </newsfor>
+ <newsfor version="2.52" date="June 3rd, 1998">
+ <ni>Now works properly with Winsock 2 for Windows95. Also may start working with non-Microsoft TCP/IP stacks.</ni>
+ <ni>Fixed bug that caused GPF when removing all URLs after testing is over and you picked the URL of your choice.</ni>
+ </newsfor>
+ <newsfor version="2.5" date="December 30th, 1997">
+ <ni>Ability to export/import sets of URLs.</ni>
+ <ni>Copy URL menu command in the Main Window and button in the Best URL window.</ni>
+ <ni>Multiple URLs dragging or pasting. Works only for MSIE4 browser.</ni>
+ <ni>Annoying ToolTips removed.</ni>
+ </newsfor>
+ <newsfor version="2.00" date="July 1st, 1997">
+ <ni>Drag'n'drop source added to the Best URL window.</ni>
+ <ni>Completed/Total URLs counter added to <kin>Dipstick</kin> drag pad.</ni>
+ <ni>You may now drag'n'drop URLs from main <kin>Dipstick</kin> dialog window.</ni>
+ <ni>Added ability to paste URLs into <kin>Dipstick</kin> instead of dropping.</ni>
+ <ni>New install program now lets you install <kin>Dipstick</kin> to the location of your choice.</ni>
+ </newsfor>
+ <newsfor version="1.01" date="March 13th, 1997">
+ <ni>Resizable main <kin>Dipstick</kin> dialog window.</ni>
+ <ni>Come up with the best URL automatically.</ni>
+ <ni>Workaround for redir.dll</ni>
+ <ni>No more <product>MSIE</product> 3.0 requirement.</ni>
+ <ni>Remembers window positions and size as well as columns widths.</ni>
+ <ni>When manually adding locations - you may specify the URL, not host name as it was before (I still wonder how it came to my mind)</ni>
+ </newsfor>
+ </topic>
+ <topic id="Using" title="Using Dipstick">
+ <heading scroll="no">Using <kin>Dipstick</kin></heading>
+ <p>To use <kin>Dipstick</kin>, please follow these steps:</p>
+ <ul>
+ <li>Load the page that contains links into your <product>MSIE</product> or <product>Netscape</product> browser.</li>
+ <li>Drag'n'drop desired links to <kin>Dipstick</kin> window.</li>
+ <li><a name="UsingManual"/>(Optional) you can also manually add as many links as you want by selecting <b>Manual Ping</b> option. You can enter <term>url</term>, <term>hostname</term> or <term>IP address</term> there.</li>
+ <li>You will see rain going thought <kin>Dipstick</kin> window. After the rain stops, <kin>Dipstick</kin> will show you results either by suggesting the best URL or by sorting results in a table (which can be viewed by clicking on <kin>Dipstick</kin> window).</li>
+ <li>After you are done, you can reping all selected URLs by clicking <a href="#MainWindowRA"><b>Reping All</b></a> button in <kin>Dipstick</kin> window.</li>
+ </ul>
+ <note>Small note for newbies (all others, please do not get mad): To drag'n'drop the URL, you need to move your mouse to the link on the web page, press and hold the select (usually - left) mouse button, and drag the mouse (with the selected URL to <kin>Dipstick</kin> window and then release mouse button.</note>
+ </topic>
+ <topic id="MainWindow" title="Main Window">
+ <heading scroll="no">Main Window</heading>
+ <p>The main window consists of -</p>
+ <ul>
+ <li><b>Brilliant ListView with the following columns:</b></li>
+ <li>Host Name - host name as it was specified in the URL or resolved from IP address.</li>
+ <li>Host IP address - host IP address as it was specified in the URL or resolved from host name.</li>
+ <li>Min RTT - Minimum Round Trip Time. <kin>Dipstick</kin> sends a few echo requests to remote host and calculates minimum, maximum, and average Round Trip Times. The less the better.</li>
+ <li>Avg RTT - Average Round Trip Time. About the same meaning as in Min RTT, but this is the average one. The less the better. By default locations are sorted by Avg RTT.</li>
+ <li>Max RTT - Maximum Round Trip Time. About the same meaning as in Min RTT and Avg RTT, but this is maximum one. The less the better.</li>
+ <li>Pktloss - Percentage of the requests lost somewhere in the net. The less the better.</li>
+ <li><b>Buttons:</b></li>
+ <li><a name="MainWindowMP"/>Manual Ping - lets you add location manually (usually you just drag'n'drop locations into <kin>Dipstick</kin> window.</li>
+ <li>Reping - Test selected location again.</li>
+ <li><a name="MainWindowRA"/>Reping All - Test again all locations in the list.</li>
+ <li>Remove - Remove selected location from the list.</li>
+ <li>Remove All - Remove all locations from the list.</li>
+ <li>Help - I think you have a clue on what this button does.</li>
+ <li>Options - Set <kin>Dipstick</kin> options</li>
+ <li>Exit Dipstick - Close <kin>Dipstick</kin> program</li>
+ </ul>
+ </topic>
+ <topic id="Options" title="Dipstick Options">
+ <heading scroll="no"><kin>Dipstick</kin> Opions</heading>
+ <p>Options are:</p>
+ <ul>
+ <li><a name="OptionsPPH"/><b>Number of pings per host</b> - number of echo requests to send for each location.</li>
+ <li><b>Maximum number of threads</b> - number of locations to process at the same time. adjust this if you have unusually fast or slow connection and/or computer.</li>
+ <li><b>Ping Timeout</b> - number of seconds to wait between sending echo requests.</li>
+ <li><b>Interval between pings</b> - number of seconds to wait between sending echo requests.</li>
+ <li><b>Ping size</b> - number of bytes to send in each echo request.</li>
+ <li><a name="OptionsIM"/><b>Test innermost URL</b> - in case of nesting <b>redir</b>ed URLs test the innermost one. Some strange companies refer to their mirrors using <b>redir.dll</b> so that the URLs for files located on different machines look like they're all here. Like <b>http://www.punchcards.com/redir.dll?target=http://www.punchcards.mirrordudes.com/file.exe&amp;puchcards=advanced</b></li>
+ <li><a name="OptionsBU"/><b>Come up with the best URL</b> - pop up with a suggestion about the best URL (after all locations have been pinged and have nothing left to do other than to start dowloading).</li>
+ </ul>
+ </topic>
+ <topic id="Properties" title="URL properties">
+ <heading scroll="no">URL Properties</heading>
+ <p>URL Properties are:</p>
+ <ul>
+ <li><b>URL</b> - the URL itself if present.</li>
+ <li><b>Host name</b> - host name as specified in URL (or the innermost URL in case of <b>redir</b>ed URLs in the <a href="#OptionsIM">appropriate option</a> is turned on or resolved by <kin>Dipstick</kin>.</li>
+ <li><b>Ping times</b> - minimum, average, and mmaximum round trip times if available.</li>
+ <li><b>Packet loss</b> - percentage of packets lost in transmission.</li>
+ <li><b>Status</b> - description of last error occured (if any).</li>
+ </ul>
+ </topic>
+ <topic id="SelectURLs" title="Select URLs Dialog">
+ <heading scroll="no">Select URLs dialog</heading>
+ <p>If you're dragging or cut'n'pasting selection from <product>MSIE4</product> browser, you're supposed to chose which URLs to test.</p>
+ <p>There are two options you may want to change when selecting URLs from list:</p>
+ <ul>
+ <li><b>Smart adjust selection</b> - let <kin>Dipstick</kin> adjust current selection when you're clicking URL based on the URL you click.</li>
+ <li><b>Adjusst by innermost URL</b> - use the innermost URL when adjusting selection.</li>
+ </ul>
+ <p>The default values for these options are also available from the <a href="#Options"><b>Options</b></a> dialog box.</p>
+ </topic>
+ <topic id="Autobest" title="Dipstick Report">
+ <heading scroll="no"><kin>Dipstick</kin> report</heading>
+ <p>When <kin>Dipstick</kin> has finished testing and there's nothing left but to start your download, you're presented with a suggestion about the best URL. From this dialog you may chose to browse to the location you like using <b>Previous Location</b> and <b>Next Location</b> buttons, <b>Open this URL</b>, <b>Copy URL</b> to clipboard or drag it to wherever you want.</p>
+ </topic>
+</winhelp>
diff --git a/install/custom.rch b/install/custom.rch
new file mode 100644
index 0000000..6b8ce9c
--- a/dev/null
+++ b/install/custom.rch
@@ -0,0 +1,10 @@
+#ifdef STATI_K
+dipstick.ex_ rcdata discardable "../releast/dipstick.ex_"
+#else
+dipstick.ex_ rcdata discardable "../release/dipstick.ex_"
+#endif
+dipstick.cn_ rcdata discardable "../release/dipstick.cn_"
+dipstick.hl_ rcdata discardable "../release/dipstick.hl_"
+#ifdef K_ANNED
+mfc42.dl_ rcdata discardable "../redist/mfc42.dl_"
+#endif
diff --git a/install/install.cpp b/install/install.cpp
new file mode 100644
index 0000000..995b78f
--- a/dev/null
+++ b/install/install.cpp
@@ -0,0 +1,68 @@
+#include "resource.h"
+#include "../shared-code/install.h"
+
+#define KINNAME "Dipstick"
+#define KINSHORT KINNAME
+#define VERSION "3.00"
+
+BOOL Install(void)
+{
+STRING dPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",KINSHORT "Path");
+STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath");
+LPCSTR qPath = ((LPCSTR)dPath)?(LPCSTR)dPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings");
+STRING path = REQUESTPATH(" " KINNAME " " VERSION,"\nEnter destination path:",qPath);
+ if(!path)
+ return NULL;
+
+#ifdef K_ANNED
+STRING sysDir(_MAX_PATH);
+ GetSystemDirectory(sysDir,_MAX_PATH);
+ INSTALLFILE("mfc42.dl_",sysDir,"mfc42.dll");
+#endif
+
+ MAKE_PATH(path);
+STRING shortPath = GET_SHORT_PATH(path);
+ if(!shortPath){
+ MessageBox(NULL,"Failed to install " KINNAME " " VERSION " in specified directory",NULL,MB_ICONERROR|MB_OK);
+ return FALSE;
+ }
+
+ if(!(
+ INSTALLFILE("dipstick.ex_",path,"dipstick.exe") &&
+ INSTALLFILE("dipstick.hl_",path,"dipstick.hlp") &&
+ INSTALLFILE("dipstick.cn_",path,"dipstick.cnt")
+ )){
+ MessageBox(NULL,"Failed to install " KINNAME " " VERSION " in specified directory",NULL,MB_ICONERROR|MB_OK);
+ return FALSE;
+ }
+ ADDMENU("Accessories\\Klever Co.",KINNAME,path,"dipstick.exe");
+
+ strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",KINSHORT "Path",path);
+ strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath",path);
+
+FILE* inf=CREATE_INF_FILE(path,KINSHORT ".INF");
+ if(!inf){
+ MessageBox(NULL,"Failed to install " KINNAME " " VERSION,NULL,MB_ICONERROR|MB_OK);
+ return FALSE;
+ }
+ INF_FILE_HEADER(inf);
+ INF_FILE_SECTION(inf,"Uninstall");
+ fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n");
+ INF_FILE_SECTION(inf,"kFiles");
+ INF_REMOVE_ROOT(inf,KINSHORT "Files",path);
+ INF_REMOVE_FILE(inf,KINSHORT "Files","dipstick.exe");
+ INF_REMOVE_HELP_FILE(inf,KINSHORT "Files","dipstick");
+ INF_REMOVE_FILE(inf,KINSHORT "Files",KINSHORT ".INF");
+ INF_FILE_SECTION(inf,"kReg");
+ INF_UNINSTALL_REG(inf,KINSHORT);
+ INF_FILE_SECTION(inf,"kMenu");
+ INF_MENU_GROUP(inf,1,"Accessories\\Klever Co.");
+ INF_MENU_ITEM(inf,1,KINNAME);
+ fclose(inf);
+
+ REG_UNINSTALL_COMMAND(KINSHORT,"Klever " KINNAME " " VERSION,shortPath,KINSHORT ".INF","Uninstall");
+
+ MessageBox(NULL,KINNAME " " VERSION " installed successfully, you may now run it from Programs/Accessories/Klever Co. menu or remove it using Control Panel Add/Remove Programs applet."," Rejoice!",MB_ICONINFORMATION|MB_OK);
+
+ return TRUE;
+}
diff --git a/install/install.rc b/install/install.rc
new file mode 100644
index 0000000..8c86414
--- a/dev/null
+++ b/install/install.rc
@@ -0,0 +1,182 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+#if defined(APSTUDIO_INVOKED) || defined(FALSE)
+#if defined(APSTUDIO_INVOKED)
+IDD_INSTALLING$(FALSE) DIALOGEX 0, 0, 200, 74
+#else
+IDD_INSTALLING DIALOGEX 0, 0, 200, 74
+#endif
+STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ PUSHBUTTON "Cancel",IDCANCEL,143,53,50,14,BS_CENTER | BS_VCENTER |
+ BS_NOTIFY | BS_FLAT,WS_EX_DLGMODALFRAME
+ CONTROL "Animate1",IDC_DISKS,"SysAnimate32",ACS_TRANSPARENT |
+ ACS_AUTOPLAY | WS_TABSTOP,161,7,32,32
+ LTEXT "",IDC_STATE,7,7,150,32,SS_NOPREFIX | SS_NOTIFY
+ CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,45,
+ 186,7,WS_EX_DLGMODALFRAME
+END
+#endif
+
+IDD_PATH DIALOGEX 0, 0, 255, 73
+STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
+ WS_VISIBLE | WS_CAPTION
+EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
+FONT 8, "MS Sans Serif", 0, 0, 0x1
+BEGIN
+ LTEXT "",IDC_PROMPT,7,7,241,30
+ EDITTEXT IDC_PATH,7,37,195,12,ES_AUTOHSCROLL
+ PUSHBUTTON "B&rowse..",IDC_BROWSE,208,37,40,12
+ DEFPUSHBUTTON "OK",IDOK,69,52,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,135,52,50,14
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
+BEGIN
+ "IDD_INSTALLING$(FALSE)", DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 193
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 67
+ HORZGUIDE, 39
+ END
+
+ IDD_PATH, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 248
+ VERTGUIDE, 202
+ VERTGUIDE, 208
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 66
+ HORZGUIDE, 37
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""custom.rch""\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON ICON DISCARDABLE "../shared-data/install-icon.ico"
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 3,0,0,0
+ PRODUCTVERSION 3,0,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
+ VALUE "FileDescription", "INSTALL: Dipstick, mirror locator\0"
+ VALUE "FileVersion", "3, 0, 0, 0\0"
+ VALUE "InternalName", "INSTALL\0"
+ VALUE "LegalCopyright", "Copyright © 1996, 1997, 1998, 2002 Klever Group (http://www.klever.net/)\0"
+ VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
+ VALUE "OriginalFilename", "INSTALL.EXE\0"
+ VALUE "ProductName", "Dipstick\0"
+ VALUE "ProductVersion", "3, 0, 0, 0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#include "custom.rch"
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/install/resource.h b/install/resource.h
new file mode 100644
index 0000000..ebf7991
--- a/dev/null
+++ b/install/resource.h
@@ -0,0 +1,24 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by Install.rc
+//
+#define IDD_INSTALLING 101
+#define IDD_PATH 102
+#define IDI_ICON 105
+#define IDC_DISKS 1000
+#define IDC_STATE 1001
+#define IDC_PROGRESS 1002
+#define IDC_PROMPT 1003
+#define IDC_PATH 1004
+#define IDC_BROWSE 1005
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 107
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1006
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/makehelp.bat b/makehelp.bat
new file mode 100644
index 0000000..df0ff97
--- a/dev/null
+++ b/makehelp.bat
@@ -0,0 +1,33 @@
+@echo off
+REM -- First make map file from Microsoft Visual C++ generated resource.h
+echo // MAKEHELP.BAT generated Help Map file. Used by DIPSTICK.HPJ. >"help\dipstick.hm"
+echo. >>"help\dipstick.hm"
+REM echo // Commands (ID_* and IDM_*) >>"help\dipstick.hm"
+REM makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h >>"help\dipstick.hm"
+REM echo. >>"help\dipstick.hm"
+REM echo // Prompts (IDP_*) >>"help\dipstick.hm"
+REM makehm IDP_,HIDP_,0x30000 resource.h >>"help\dipstick.hm"
+REM echo. >>"help\dipstick.hm"
+REM echo // Resources (IDR_*) >>"help\dipstick.hm"
+REM makehm IDR_,HIDR_,0x20000 resource.h >>"help\dipstick.hm"
+REM echo. >>"help\dipstick.hm"
+echo // Dialogs (IDD_*) >>"help\dipstick.hm"
+makehm IDD_,HIDD_,0x20000 resource.h >>"help\dipstick.hm"
+echo. >>"help\dipstick.hm"
+REM echo // Frame Controls (IDW_*) >>"help\dipstick.hm"
+REM makehm IDW_,HIDW_,0x50000 resource.h >>"help\dipstick.hm"
+makehm IDH_,IDH_,0 resource.h >>"help\dipstick.hm"
+REM -- Make help for Project DIPSTICK
+
+echo Building RTF file
+xsltproc -o help/dipstick.rtf shared-code/kinhelp.xsl help/dipstick.xml
+echo Building Win32 Help files
+start /wait hcrtf -x "help\dipstick.hpj"
+echo.
+if exist Debug\nul copy "help\dipstick.hlp" Debug
+if exist Debug\nul copy "help\dipstick.cnt" Debug
+if exist Release\nul copy "help\dipstick.hlp" Release
+if exist Release\nul copy "help\dipstick.cnt" Release
+if exist Releast\nul copy "help\dipstick.hlp" Releast
+if exist Releast\nul copy "help\dipstick.cnt" Releast
+echo.
diff --git a/res/best.wav b/res/best.wav
new file mode 100644
index 0000000..cadaa04
--- a/dev/null
+++ b/res/best.wav
Binary files differ
diff --git a/res/complete.ico b/res/complete.ico
new file mode 100644
index 0000000..01b7014
--- a/dev/null
+++ b/res/complete.ico
Binary files differ
diff --git a/res/dipstick.ico b/res/dipstick.ico
new file mode 100644
index 0000000..6cc0ee5
--- a/dev/null
+++ b/res/dipstick.ico
Binary files differ
diff --git a/res/dipstick.rc2 b/res/dipstick.rc2
new file mode 100644
index 0000000..c5f3389
--- a/dev/null
+++ b/res/dipstick.rc2
@@ -0,0 +1,13 @@
+//
+// DIPSTICK.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+ #error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/res/kdnd.avi b/res/kdnd.avi
new file mode 100644
index 0000000..e2221db
--- a/dev/null
+++ b/res/kdnd.avi
Binary files differ
diff --git a/res/kdragurl.avi b/res/kdragurl.avi
new file mode 100644
index 0000000..03baf1f
--- a/dev/null
+++ b/res/kdragurl.avi
Binary files differ
diff --git a/res/pending.ico b/res/pending.ico
new file mode 100644
index 0000000..5b978cb
--- a/dev/null
+++ b/res/pending.ico
Binary files differ
diff --git a/res/pinging.ico b/res/pinging.ico
new file mode 100644
index 0000000..38aa6bf
--- a/dev/null
+++ b/res/pinging.ico
Binary files differ
diff --git a/res/unreach.ico b/res/unreach.ico
new file mode 100644
index 0000000..a9ff75a
--- a/dev/null
+++ b/res/unreach.ico
Binary files differ
diff --git a/resource.h b/resource.h
new file mode 100644
index 0000000..2af32cb
--- a/dev/null
+++ b/resource.h
@@ -0,0 +1,149 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by Dipstick.rc
+//
+#define IDM_ABOUTBOX 0x0010
+#define IDD_ABOUTBOX 100
+#define IDS_ABOUTBOX 101
+#define IDD_DIPSTICK_DIALOG 102
+#define IDS_REGEX_NESTEDURL 102
+#define IDS_PS_FAILEDTOLOCK 102
+#define IDP_SOCKETS_INIT_FAILED 103
+#define IDS_REGEX_CRACKHOST 104
+#define IDS_CSVEXT 104
+#define IDS_HN_BADURL 105
+#define IDS_ABEST_CLEANUP 106
+#define IDS_ABEST_NONEFOUND 107
+#define IDS_ABEST_TITLE 108
+#define IDS_DRAGPAD_TITLE 109
+#define IDS_DRAGPAD_URLS 110
+#define IDS_REGEX_HTMLURL 111
+#define IDS_CSVFILTER 112
+#define IDR_MAINFRAME 128
+#define IDD_DRAGPAD 129
+#define IDR_DNDAVI 130
+#define IDD_OPTIONS 132
+#define IDR_MENU 133
+#define IDD_MANUALHOST 134
+#define IDD_PROPS 135
+#define IDI_PINGING 136
+#define IDI_PENDING 137
+#define IDI_COMPLETED 138
+#define IDI_UNREACHABLE 139
+#define IDB_DIABACK 140
+#define IDD_AUTOBEST 141
+#define IDW_BESTURL 142
+#define IDR_DRAGAVI 143
+#define IDD_URLS 145
+#define IDC_HOSTLIST 1002
+#define IDC_DNDTARGET 1011
+#define IDC_OPTIONS 1013
+#define IDC_NPINGS 1014
+#define IDC_PACKETSIZE 1015
+#define IDC_TIMEOUT 1016
+#define IDC_INTERVAL 1017
+#define IDC_KLEVERNET 1017
+#define IDC_MAXPINGS 1018
+#define IDC_MANUALPING 1019
+#define IDC_HOST 1020
+#define IDC_REPING 1021
+#define IDC_IP 1021
+#define IDC_REPINGALL 1022
+#define IDC_CLEAR 1023
+#define IDC_EXIT 1024
+#define IDC_REMOVE 1025
+#define IDC_URLCAPTION 1026
+#define IDC_URL 1027
+#define IDC_HOSTCAPTION 1028
+#define IDC_IPCAPTION 1029
+#define IDC_TIMESCAPTION 1030
+#define IDC_TIMES 1031
+#define IDC_LOSSCAPTION 1032
+#define IDC_LOSS 1033
+#define IDC_STATUSCAPTION 1034
+#define IDC_STATUS 1035
+#define IDC_OPENURL 1036
+#define IDC_STATE 1039
+#define IDC_MSWORKAROUND 1048
+#define IDC_SPINPINGS 1049
+#define IDC_SPINMAXPINGS 1050
+#define IDC_SPINTIMEOUT 1051
+#define IDC_RTT 1051
+#define IDC_SPINTERVAL 1052
+#define IDC_PKTLOSS 1052
+#define IDC_SPINSIZE 1053
+#define IDC_PREV 1053
+#define IDC_AUTOBEST 1054
+#define IDC_NEXT 1054
+#define IDC_SMARTADJUST 1055
+#define IDC_DROPSOURCE 1056
+#define IDC_URLS 1057
+#define IDC_DOADJUST 1058
+#define IDC_ADJUSTINN 1059
+#define IDC_IGNORELA 1060
+#define IDC_COPYURL 1060
+#define IDC_ADVANCED 1061
+#define IDS_KLEVERNET_URL 2102
+#define IDS_PS_INTERNALERROR 2104
+#define IDS_PS_NETUNREACHABLE 2105
+#define IDS_PS_HOSTUNREACHABLE 2106
+#define IDS_PS_PROTUNREACHABLE 2107
+#define IDS_PS_PORTUNREACHABLE 2108
+#define IDS_PS_NORESOURCES 2109
+#define IDS_PS_HWERROR 2110
+#define IDS_PS_BIGPACKET 2111
+#define IDS_PS_TIMEOUT 2112
+#define IDS_PS_BADROUTE 2113
+#define IDS_PS_TTLEXPTRANSIT 2114
+#define IDS_PS_TTLEXPREASM 2115
+#define IDS_PS_IPARAMP 2116
+#define IDS_PS_SOURCEQUENCH 2117
+#define IDS_PS_BIGOPTION 2118
+#define IDS_PS_BADDEST 2119
+#define IDS_PS_UNKNOWNERROR 2120
+#define IDS_REGISTRYKEY 2121
+#define IDS_FMT_TIMES 2122
+#define IDS_FMT_LOSS 2123
+#define IDS_TIP_UNREACHABLE 2124
+#define IDS_PS_FAILEDTORESOLVE 2127
+#define IDS_PS_UNABLETOICMP 2128
+#define IDS_TIP_PENDING 2130
+#define IDS_TIP_COMPLETE 2131
+#define IDS_TIP_PROPSOK 2132
+#define IDS_TIP_INTERVAL 2133
+#define IDS_TIP_OPTIONSOK 2134
+#define IDS_TIP_OPTIONSCANCEL 2135
+#define IDS_TIP_PINGING 2136
+#define ID_DRAGPAD_EXIT 32771
+#define ID_DRAGPAD_SHOWMAINWINDOW 32772
+#define ID_DRAGPAD_OPTIONS 32773
+#define ID_DRAGPAD_ABOUT 32774
+#define ID_DRAGPAD_MANUALPING 32775
+#define ID_HOSTLIST_REPING 32776
+#define ID_HOSTLIST_REMOVE 32777
+#define ID_HOSTLIST_REPINGALL 32778
+#define ID_HOSTLIST_REMOVEALL 32779
+#define ID_HOSTLIST_OPENURL 32780
+#define ID_HOSTLIST_PROPERTIES 32781
+#define ID_DRAGPAD_HELP 32782
+#define ID_DRAGPAD_REPINGALL 32783
+#define ID_DRAGPAD_REMOVEALL 32784
+#define ID_DRAGPAD_PASTEURL 32785
+#define ID_HOSTLIST_PASTEURL 32786
+#define ID_HOSTLIST_COPYURL 32787
+#define ID_ADVANCED_EXPORTLIST 32788
+#define ID_ADVANCED_IMPORTLIST 32789
+#define ID_DRAGPAD_ADVANCED_EXPORTLIST 32790
+#define ID_DRAGPAD_ADVANCED_IMPORTLIST 32791
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 147
+#define _APS_NEXT_COMMAND_VALUE 32792
+#define _APS_NEXT_CONTROL_VALUE 1062
+#define _APS_NEXT_SYMED_VALUE 107
+#endif
+#endif
diff --git a/shared-code/BTreendex.h b/shared-code/BTreendex.h
new file mode 100644
index 0000000..88109ab
--- a/dev/null
+++ b/shared-code/BTreendex.h
@@ -0,0 +1,595 @@
+#ifndef __BTREENDEX_H
+#define __BTREENDEX_H
+
+#include "Dynamide.h"
+
+namespace Klever {
+
+template<class key,class value,int treeOrder,int cluster>
+class CBTreendex : public CObject {
+public:
+ typedef LONG CBTPageRef;
+ struct CBTRecordRef {
+ CBTPageRef m_Page;
+ INT m_Offset;
+ CBTRecordRef(CBTPageRef page=-1,INT offset=-1) : m_Page(page), m_Offset(offset) {}
+ };
+ class CBTRecord : public CObject {
+ public:
+ CBTPageRef m_ptrLeft;
+ CBTPageRef m_ptrRight;
+ key m_Key;
+ value m_Value;
+ CBTRecord() : m_ptrLeft(-1), m_ptrRight(-1) {}
+ CBTRecord(key& _key,value& _value,CBTPageRef left=-1,CBTPageRef right=-1) : m_Key(_key), m_Value(_value), m_ptrLeft(left), m_ptrRight(right) {}
+ CBTRecord(CBTRecord& r) : m_Key(r.m_Key), m_Value(r.m_Value), m_ptrLeft(r.m_ptrLeft), m_ptrRight(r.m_ptrRight) {}
+
+ CBTRecord& operator=(CBTRecord& r) {m_Key=r.m_Key, m_Value=r.m_Value, m_ptrLeft=r.m_ptrLeft, m_ptrRight=r.m_ptrRight;return *this;}
+
+ void Serialize(CArchive& ar) {
+ if(ar.IsStoring()){
+ ar << m_ptrLeft;
+ ar << m_ptrRight;
+ }else{
+ ar >> m_ptrLeft;
+ ar >> m_ptrRight;
+ }
+ SerializeElements(ar,&m_Key,1);
+ SerializeElements(ar,&m_Value,1);
+ }
+ };
+ class CBTPage : public CArray<CBTRecord,CBTRecord&> {
+ public:
+ void Serialize(CArchive& ar) {
+ int nCount = -1;
+ if(ar.IsStoring()){
+ nCount = GetSize();
+ ar << nCount;
+ }else{
+ nCount = 0;
+ ar >> nCount;
+ RemoveAll();
+ SetSize(nCount);
+ }
+ for(int tmp=0;tmp<nCount;tmp++)
+ ElementAt(tmp).Serialize(ar);
+ }
+ };
+ typedef CDynamide<256,cluster> CBTDyna;
+ typedef CBTDyna::CDynaFile CBTDynaFile;
+ typedef CArray<CBTRecordRef,CBTRecordRef&> CBTRStack;
+
+ CBTDyna m_BT;
+ struct _btCrap {
+ BOOL m_bRootSet;
+ CBTPageRef m_Root;
+ } *m_BTCrap;
+ BOOL m_bRO;
+ CBTRStack m_btStack;
+ CBTPage m_stackTop;
+
+ CBTreendex() {}
+ ~CBTreendex() { Close(); }
+ BOOL Attach(CFile* file,BOOL bAutodelete) {
+ m_bRO = FALSE;
+ if(!m_BT.Attach(file,bAutodelete))
+ return FALSE;
+ return Attach();
+ }
+ BOOL Open(LPCTSTR file,BOOL bReadOnly) {
+ if(!m_BT.Open(file,bReadOnly))
+ return FALSE;
+ m_bRO = bReadOnly;
+ return Attach();
+ }
+ BOOL Create(LPCTSTR file) {
+ try{
+ CFile* f = new CFile(file,CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead|CFile::shareDenyWrite|CFile::typeBinary);
+ ASSERT(f);
+ return Attach(f,TRUE);
+ }catch(CException* e){
+ e->Delete();
+ return FALSE;
+ }
+ }
+ BOOL Attach() {
+ ASSERT(m_BT.IsOpened());
+ m_BTCrap = (_btCrap*)m_BT.m_FB.crap;
+ if(!m_BTCrap->m_bRootSet){
+ m_BTCrap->m_Root = AllocatePage();
+ if(m_BTCrap->m_Root<0)
+ return FALSE;
+ m_BTCrap->m_bRootSet = TRUE;
+ m_BT.Write1stBlock();
+ }
+ return TRUE;
+ }
+ BOOL Close() {
+ m_BT.Close();
+ return TRUE;
+ }
+ BOOL IsOpened() {
+ return m_BT.IsOpened();
+ }
+
+ BOOL Lookup(key& _key,value& value) {
+ if(!IsOpened())
+ return FALSE;
+ ASSERT(m_BTCrap->m_bRootSet);
+ if(!SeekToPage(_key))
+ return FALSE;
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(rr.m_Offset<0)
+ return FALSE;
+ ASSERT(rr.m_Offset<m_stackTop.GetSize());
+ if(_key != m_stackTop[rr.m_Offset].m_Key)
+ return FALSE;
+ value = m_stackTop[rr.m_Offset].m_Value;
+ return TRUE;
+ }
+ BOOL Add(key& _key,value& _value) {
+ if(!IsOpened())
+ return FALSE;
+ ASSERT(m_BTCrap->m_bRootSet);
+ if(!SeekToPage(_key))
+ return FALSE;
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ CBTRecord nuRecord(_key,_value);
+ if(rr.m_Offset<0){
+ if(m_stackTop.GetSize())
+ nuRecord.m_ptrLeft = m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight;
+ }else if(rr.m_Offset==0){
+ nuRecord.m_ptrRight = m_stackTop[0].m_ptrLeft;
+ }else{
+ nuRecord.m_ptrLeft = m_stackTop[rr.m_Offset-1].m_ptrRight;
+ nuRecord.m_ptrRight = m_stackTop[rr.m_Offset].m_ptrLeft;
+ }
+// ASSERT(rr.m_Offset==0 || (m_stackTop[rr.m_Offset-1].m_Key<_key && m_stackTop[rr.m_Offset-1].m_ptrRight<0));
+// ASSERT(rr.m_Offset<0 || m_stackTop[rr.m_Offset].m_Key>=_key && m_stackTop[rr.m_Offset].m_ptrLeft<0);
+ if(rr.m_Offset>=0 && m_stackTop[rr.m_Offset].m_Key==_key){
+ // Exact match found - just replace.
+ m_stackTop[rr.m_Offset].m_Value = _value;
+ if(!SavePage(rr.m_Page,m_stackTop))
+ return FALSE;
+ return TRUE;
+ }
+ // Split the page and propagate the split if needed..
+ // Insert new element at rr.m_Offset..
+ BOOL nuisnew = TRUE;
+ for(int sp=m_btStack.GetUpperBound();sp>=0;sp--){
+ CBTPageRef opr = m_btStack[sp].m_Page;
+ int iAt = m_btStack[sp].m_Offset;
+ CBTPage op;
+ VERIFY(LoadPage(opr,op));
+ if(iAt<0)
+ iAt = op.GetSize();
+ else{
+ if(op[iAt].m_Key<nuRecord.m_Key)
+ iAt++;
+ ASSERT(iAt==op.GetSize() || op[iAt].m_Key > nuRecord.m_Key);
+ }
+ op.InsertAt(iAt,nuRecord);
+ if(iAt>0)
+ op[iAt-1].m_ptrRight=nuRecord.m_ptrLeft;
+ if(iAt<op.GetUpperBound())
+ op[iAt+1].m_ptrLeft=nuRecord.m_ptrRight;
+ if(op.GetSize()<=treeOrder*2){
+ // This isn't causing overflow
+ VERIFY(SavePage(opr,op));
+ return TRUE;
+ }
+ TRACE0("Split\n");
+ ASSERT(op.GetSize()==(treeOrder*2+1));
+ CBTPageRef npr = AllocatePage();
+ ASSERT(npr>=0);
+ CBTPage np;
+ ASSERT(LoadPage(npr,np));
+ ASSERT(!np.GetSize());
+ nuRecord = op[treeOrder];
+ if(iAt==treeOrder){
+ // We're inserting central element! - drop out the stack top if this is still new one
+ for(int tmp=0;tmp<treeOrder;tmp++)
+ np.InsertAt(tmp,op[tmp]);
+ op.RemoveAt(0,treeOrder+1);
+ nuRecord.m_ptrLeft = npr;
+ nuRecord.m_ptrRight = opr;
+ if(nuisnew)
+ m_btStack.RemoveAt(m_btStack.GetUpperBound());
+ }else{
+ if(iAt<treeOrder){
+ // We're inserting in the left subtree.
+ // Make newpage the right one and forget it.
+ for(int tmp=0;tmp<treeOrder;tmp++)
+ np.InsertAt(tmp,op[tmp+treeOrder+1]);
+ op.RemoveAt(treeOrder,treeOrder+1);
+ nuRecord.m_ptrLeft = opr;
+ nuRecord.m_ptrRight = npr;
+ }else{
+ // We're inserting in the right subtree.
+ // Make newpage the left one, forget it, but also adjust offset in the stack
+ for(int tmp=0;tmp<treeOrder;tmp++)
+ np.InsertAt(tmp,op[tmp]);
+ op.RemoveAt(0,treeOrder+1);
+ nuRecord.m_ptrLeft = npr;
+ nuRecord.m_ptrRight = opr;
+ m_btStack[sp].m_Offset-=treeOrder+1;
+ }
+ // Note that we're not inserting new element anymore.
+ nuisnew = FALSE;
+ }
+ // Do, excessive sanity checks and save pages
+ ASSERT(op.GetSize());
+ ASSERT(np.GetSize());
+ VERIFY(SavePage(opr,op));
+ VERIFY(SavePage(npr,np));
+ }
+ // Here we have root page overflow, which means that we're simply putting new
+ // record in this brand new root page and also inserting this page on the bottom of the stack
+ CBTPageRef nuroot = AllocatePage();
+ ASSERT(nuroot>=0);
+ CBTPage nurpa;
+ ASSERT(LoadPage(nuroot,nurpa));
+ ASSERT(!nurpa.GetSize());
+ nurpa.Add(nuRecord);
+ VERIFY(SavePage(nuroot,nurpa));
+ m_btStack.InsertAt(0,CBTRecordRef(nuroot,0));
+ m_BTCrap->m_Root = nuroot;
+ m_BT.Write1stBlock();
+ return TRUE;
+ }
+ BOOL Delete(key& _key) {
+ if(!IsOpened())
+ return FALSE;
+ ASSERT(m_BTCrap->m_bRootSet);
+ value _value;
+ if(!Lookup(_key,_value))
+ return FALSE;
+ // Found key, check if it's a leaf
+ {
+ CBTRecordRef* rr = &m_btStack[m_btStack.GetUpperBound()];
+ int rrIdx = m_btStack.GetUpperBound();
+ if(m_stackTop[rr->m_Offset].m_ptrLeft>=0){
+ ASSERT(m_stackTop[rr->m_Offset].m_ptrRight>=0);
+ // It isn't - scan for the _next_ key and do dirty deeds
+ m_btStack.Add(CBTRecordRef(m_stackTop[rr->m_Offset].m_ptrRight,0));
+ for(;;){
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ if(m_stackTop[0].m_ptrLeft<0)
+ break;
+ m_btStack.Add(CBTRecordRef(m_stackTop[0].m_ptrLeft,0));
+ }
+ // We have a leaf node here, replace victim with the first element and kill it.
+ CBTPage uppage;
+ rr = &m_btStack[rrIdx];
+ if(!LoadPage(rr->m_Page,uppage))
+ return FALSE;
+ uppage[rr->m_Offset].m_Key=m_stackTop[0].m_Key; uppage[rr->m_Offset].m_Value=m_stackTop[0].m_Value;
+ m_stackTop.RemoveAt(0);
+ if(!(SavePage(rr->m_Page,uppage) && SavePage(m_btStack[m_btStack.GetUpperBound()].m_Page,m_stackTop)))
+ return FALSE;
+ }else{
+ ASSERT(m_stackTop[rr->m_Offset].m_ptrRight<0);
+ m_stackTop.RemoveAt(rr->m_Offset);
+ if(!SavePage(rr->m_Page,m_stackTop))
+ return FALSE;
+ }
+ }
+ // We have a page to check for underflow at the top of the stack now.
+ for(;;){
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ if(m_stackTop.GetSize()>=treeOrder || m_btStack.GetSize()==1)
+ return TRUE;
+ CBTRecordRef& rr1 = m_btStack[m_btStack.GetUpperBound()-1];
+ CBTPage daddy;
+ if(!LoadPage(rr1.m_Page,daddy))
+ return FALSE;
+ CBTPageRef nPage = daddy[rr1.m_Offset].m_ptrRight;
+ BOOL bRight=TRUE;
+ if(nPage<0 || nPage==rr.m_Page){
+ nPage = daddy[rr1.m_Offset].m_ptrLeft;
+ bRight = FALSE;
+ }
+ ASSERT(nPage>=0 && nPage!=rr.m_Page);
+ CBTPage neighbor;
+ if(!LoadPage(nPage,neighbor))
+ return FALSE;
+ // Here we have possibly two cases:
+ // 1. Neighboring page can share some data with use, then do share and leave
+ // 2. Neighboring page is of treeorder in size, then merge and propagate
+ if(neighbor.GetSize()>treeOrder){
+ TRACE0("Redistributing..\n");
+ // Borrow some data from there.
+ int toBorrow = neighbor.GetSize()-treeOrder;
+ toBorrow=toBorrow/2+1;
+ ASSERT(toBorrow);
+ if(bRight)
+ m_stackTop.Add(CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight,neighbor[0].m_ptrLeft));
+ else
+ m_stackTop.InsertAt(0,CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,neighbor[neighbor.GetUpperBound()].m_ptrRight,m_stackTop[0].m_ptrLeft));
+ for(toBorrow--;toBorrow;toBorrow--){
+ if(bRight){
+ m_stackTop.Add(neighbor[0]);
+ neighbor.RemoveAt(0);
+ }else{
+ m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]);
+ neighbor.RemoveAt(neighbor.GetUpperBound());
+ }
+ }
+ daddy[rr1.m_Offset].m_Key = neighbor[bRight?0:neighbor.GetUpperBound()].m_Key; daddy[rr1.m_Offset].m_Value = neighbor[bRight?0:neighbor.GetUpperBound()].m_Value;
+ neighbor.RemoveAt(bRight?0:neighbor.GetUpperBound());
+ if(!(SavePage(rr1.m_Page,daddy) && SavePage(nPage,neighbor) && SavePage(rr.m_Page,m_stackTop)))
+ return FALSE;
+ rr.m_Offset = -1; // *** Point to the next??
+ return TRUE;
+ }
+ TRACE0("Merging..\n");
+ // We need to merge pages here..
+ // We will merge them at stacktop, then we'll discard neighbor guy..
+ if(bRight)
+ m_stackTop.Add(CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight,neighbor[0].m_ptrLeft));
+ else
+ m_stackTop.InsertAt(0,CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,neighbor[neighbor.GetUpperBound()].m_ptrRight,m_stackTop[0].m_ptrLeft));
+ if(bRight){
+ while(neighbor.GetSize()){
+ m_stackTop.Add(neighbor[0]);
+ neighbor.RemoveAt(0);
+ }
+ }else{
+ while(neighbor.GetSize()){
+ m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]);
+ neighbor.RemoveAt(neighbor.GetUpperBound());
+ }
+ }
+ if(rr1.m_Offset>0)
+ daddy[rr1.m_Offset-1].m_ptrRight=rr.m_Page;
+ if(rr1.m_Offset<daddy.GetUpperBound())
+ daddy[rr1.m_Offset+1].m_ptrLeft=rr.m_Page;
+ daddy.RemoveAt(rr1.m_Offset);
+ if(!(SavePage(rr1.m_Page,daddy) && SavePage(rr.m_Page,m_stackTop)))
+ return FALSE;
+ VERIFY(DeallocatePage(nPage));
+ m_btStack.RemoveAt(m_btStack.GetUpperBound());
+ }
+ return FALSE;
+ }
+ BOOL GoFirst() {
+ if(!IsOpened())
+ return FALSE;
+ ASSERT(m_BTCrap->m_bRootSet);
+ m_btStack.RemoveAll();
+ m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
+ for(;;){
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ if(!m_stackTop.GetSize()){
+ ASSERT(m_btStack.GetSize()==1);
+ return FALSE;
+ }
+ rr.m_Offset = 0;
+ if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
+ return TRUE;
+ m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
+ }
+ }
+ BOOL GoLast() {
+ if(!IsOpened())
+ return FALSE;
+ ASSERT(m_BTCrap->m_bRootSet);
+ m_btStack.RemoveAll();
+ m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
+ for(;;){
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ if(!m_stackTop.GetSize()){
+ ASSERT(m_btStack.GetSize()==1);
+ return FALSE;
+ }
+ rr.m_Offset = m_stackTop.GetUpperBound();
+ if(m_stackTop[rr.m_Offset].m_ptrRight<0)
+ return TRUE;
+ m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1));
+ }
+ }
+ BOOL GoNext() {
+ if(!IsOpened())
+ return FALSE;
+ if(!(m_btStack.GetSize() && m_btStack[m_btStack.GetUpperBound()].m_Offset>=0))
+ return FALSE;
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ ASSERT(rr.m_Offset<m_stackTop.GetSize());
+ if(m_stackTop[rr.m_Offset].m_ptrRight>=0){
+ // Advance pointer in this page and dive into subtree
+ // going left and left until we have nowhere to go.
+// TRACE1("Dive into page %lu",m_stackTop[rr.m_Offset].m_ptrRight);
+ m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,0));
+ for(;;){
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ ASSERT(rr.m_Offset==0);
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
+ break;
+// TRACE1(", %lu",m_stackTop[rr.m_Offset].m_ptrLeft);
+ m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,0));
+ }
+// TRACE0("\n");
+ return TRUE;
+ }else if(rr.m_Offset<m_stackTop.GetUpperBound()){
+ rr.m_Offset++;
+ return TRUE;
+ }
+ // We're at the end of page go up until we're done or we have data.
+ m_btStack.RemoveAt(m_btStack.GetUpperBound());
+// TRACE0("Go up");
+ while(m_btStack.GetSize()){
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ if(rr.m_Offset<m_stackTop.GetSize()){
+// TRACE0("\n");
+ return TRUE;
+ }
+// TRACE0(", up");
+ m_btStack.RemoveAt(m_btStack.GetUpperBound());
+ }
+// TRACE0("\nBtree is done\n");
+ return FALSE;
+ }
+ BOOL GoPrev() {
+ if(!IsOpened())
+ return FALSE;
+ if(!(m_btStack.GetSize() && m_btStack[m_btStack.GetUpperBound()].m_Offset>=0))
+ return FALSE;
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ ASSERT(rr.m_Offset<m_stackTop.GetSize());
+ if(m_stackTop[rr.m_Offset].m_ptrLeft>=0){
+ // Dive in and go right and right from the rightmost until
+ // we have nowhere to go.
+ m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
+ for(;;){
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ rr.m_Offset = m_stackTop.GetUpperBound();
+ if(m_stackTop[rr.m_Offset].m_ptrRight<0)
+ return TRUE;
+ m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1));
+ }
+ return TRUE;
+ }else if(rr.m_Offset>0){
+ rr.m_Offset--;
+ return TRUE;
+ }
+ // We're at the leftmost element in page - go up and left until we're
+ // done or we have data.
+ m_btStack.RemoveAt(m_btStack.GetUpperBound());
+ while(m_btStack.GetSize()){
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ rr.m_Offset--;
+ if(rr.m_Offset>=0)
+ return TRUE;
+ m_btStack.RemoveAt(m_btStack.GetUpperBound());
+ }
+ // No more data - we were at the first element in tree.
+ return FALSE;
+ }
+ BOOL GetThis(key& _key,value& _value) {
+ if(!IsOpened())
+ return FALSE;
+ // *** MORE CHECKING
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ _key = m_stackTop[rr.m_Offset].m_Key;
+ _value = m_stackTop[rr.m_Offset].m_Value;
+ return TRUE;
+ }
+
+ BOOL SeekToPage(const key& _key) {
+ ASSERT(IsOpened());
+ ASSERT(m_BTCrap->m_bRootSet);
+ m_btStack.RemoveAll();
+ m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
+ for(;;){
+ CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
+ if(!LoadPage(rr.m_Page,m_stackTop))
+ return FALSE;
+ ASSERT(m_stackTop.GetSize() || !m_btStack.GetUpperBound());
+ if(!m_stackTop.GetSize()){
+ rr.m_Offset=-1;
+ return TRUE;
+ }
+ for(rr.m_Offset=0;rr.m_Offset<m_stackTop.GetSize();rr.m_Offset++){
+ if(_key == m_stackTop[rr.m_Offset].m_Key)
+ return TRUE;
+ if(_key < m_stackTop[rr.m_Offset].m_Key){
+ ASSERT(rr.m_Offset==0 || m_stackTop[rr.m_Offset].m_ptrLeft==m_stackTop[rr.m_Offset-1].m_ptrRight);
+ if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
+ return TRUE;
+ m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
+ break;
+ }
+ if(rr.m_Offset==m_stackTop.GetUpperBound()){
+ if(m_stackTop[rr.m_Offset].m_ptrRight<0){
+ rr.m_Offset=-1;
+ return TRUE;
+ }
+ m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrRight,-1));
+ break;
+ }
+ }
+ }
+ }
+
+ BOOL LoadPage(CBTPageRef ref,CBTPage& page) {
+ CFile* pageFile = m_BT.OpenFile(ref);
+ if(!pageFile)
+ return FALSE;
+ BOOL rv = TRUE;
+ try{
+ CArchive ar(pageFile,CArchive::load);
+ page.Serialize(ar);
+ if(m_bRO)
+ page.FreeExtra(); // ** ???
+ ar.Close();
+ }catch(CException* e){
+ e->Delete();
+ rv = FALSE;
+ }
+ delete pageFile;
+ return rv;
+ }
+ BOOL SavePage(CBTPageRef ref,CBTPage& page) {
+ CFile* pageFile = m_BT.OpenFile(ref);
+ if(!pageFile)
+ return FALSE;
+ BOOL rv = TRUE;
+ try{
+ CArchive ar(pageFile,CArchive::store);
+ page.Serialize(ar);
+ ar.Close();
+ }catch(CException* e){
+ e->Delete();
+ rv = FALSE;
+ }
+ delete pageFile;
+ return rv;
+ }
+ CBTPageRef AllocatePage() {
+ CBTDynaFile* pageFile = m_BT.CreateFile();
+ if(!pageFile)
+ return -1;
+ CBTPage nothing;
+ CBTPageRef rv = pageFile->GetFile();
+ try{
+ CArchive ar(pageFile,CArchive::store);
+ nothing.Serialize(ar);
+ ar.Close();
+ }catch(CException* e){
+ e->Delete();
+ rv = -1;
+ }
+ delete pageFile;
+ return rv;
+ }
+ BOOL DeallocatePage(CBTPageRef ref) {
+ return m_BT.DeleteFile(ref);
+ }
+
+};
+
+};
+
+#endif // __BTREENDEX_H
diff --git a/shared-code/BellsNWhistles.h b/shared-code/BellsNWhistles.h
new file mode 100644
index 0000000..1de77ae
--- a/dev/null
+++ b/shared-code/BellsNWhistles.h
@@ -0,0 +1,146 @@
+#ifndef __BELLSNWHISTLES_H
+#define __BELLSNWHISTLES_H
+
+class CBellsNWhistles {
+public:
+ class CBang {
+ public:
+ CString m_codeName;
+ enum _bangType {
+ bangNone, bangSpeaker, bangSystem, bangResource,
+ bangWaveform
+ } m_type;
+ BOOL m_bLoop;
+ union {
+ UINT system;
+ LPCTSTR resource;
+ LPCTSTR wave;
+
+ LPCTSTR str;
+ UINT id;
+ };
+ CString m_strWave;
+ CBang() : m_type(bangNone), m_bLoop(FALSE) {}
+ };
+ typedef CTypedPtrMap<CMapStringToPtr,CString,CBang*> CBangs;
+ struct CBelling {
+ LPCSTR snd;
+ HMODULE hm;
+ DWORD flags;
+ CBelling(LPCSTR snd,HMODULE hm,DWORD flags) : snd(snd), hm(hm),
+ flags(flags) {}
+ CBelling(CBelling& s) : snd(s.snd), hm(s.hm), flags(s.flags) {}
+ CBelling& operator=(CBelling& s) {
+ snd=s.snd; hm=s.hm; flags=s.flags;
+ return *this;
+ }
+ };
+ typedef CBelling* Whistling;
+
+ CBangs m_bangs;
+
+ ~CBellsNWhistles() {
+ POSITION p = m_bangs.GetStartPosition();
+ while(p){
+ CString s; CBang* b;
+ m_bangs.GetNextAssoc(p,s,b);
+ delete b;
+ }
+ m_bangs.RemoveAll();
+ }
+
+ BOOL AssignSound(LPCTSTR codeName,LPCTSTR id,CBang::_bangType type=CBang::bangWaveform) {
+ CString cn = codeName;
+ cn.MakeLower();
+ CBang* b;
+ if(!m_bangs.Lookup(cn,b)) {
+ b = new CBang;
+ b->m_codeName=cn;
+ m_bangs[cn]=b;
+ }
+ b->m_type=type;
+ b->str = id;
+ if(type==CBang::bangWaveform){
+ b->m_strWave=id; b->str = b->m_strWave;
+ }
+ return TRUE;
+ }
+ BOOL AssignSound(LPCTSTR codeName,UINT nID,CBang::_bangType type=CBang::bangResource) {
+ CString cn = codeName;
+ cn.MakeLower();
+ CBang* b;
+ if(!m_bangs.Lookup(cn,b)) {
+ b = new CBang;
+ b->m_codeName=cn;
+ m_bangs[cn]=b;
+ }
+ b->m_type=type;
+ b->id = nID;
+ ASSERT(type!=CBang::bangWaveform);
+ return TRUE;
+ }
+ BOOL UnassignSound(LPCTSTR codeName) {
+ CString cn = codeName;
+ cn.MakeLower();
+ CBang* b;
+ if(m_bangs.Lookup(cn,b)) {
+ m_bangs.RemoveKey(cn);
+ delete b;
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ Whistling StartSound(LPCTSTR codeName) {
+ Whistling* rv = NULL;
+ CString cn = codeName;
+ CBang* b;
+ if(!m_bangs.Lookup(cn,b)){
+ ::PlaySound(cn,AfxGetInstanceHandle(),SND_ASYNC|SND_NODEFAULT|SND_NOWAIT|SND_FILENAME);
+ return NULL;
+ }
+ UINT flags = SND_ASYNC|SND_NODEFAULT|SND_NOWAIT;
+ LPCSTR snd = NULL;
+ switch(b->m_type){
+ case CBang::bangNone: return NULL;
+ case CBang::bangSpeaker: MessageBeep(0xFFFFFFFF); return NULL;
+ case CBang::bangSystem: MessageBeep(b->system); return NULL;
+ case CBang::bangResource:
+ snd = b->resource;
+ flags|=SND_RESOURCE; break;
+ case CBang::bangWaveform:
+ snd = b->wave;
+ flags|=SND_FILENAME; break;
+#ifdef _DEBUG
+ default:
+ ASSERT(FALSE); return NULL;
+#endif
+ }
+ if(b->m_bLoop)
+ flags|=SND_LOOP;
+ HMODULE hm = AfxGetInstanceHandle();
+ if(!::PlaySound(snd,hm,flags))
+ return NULL;
+ return b->m_bLoop?new CBelling(snd,hm,flags):NULL;
+ }
+ BOOL StopSound(Whistling whistle) {
+ if(!whistle)
+ return FALSE;
+ ::PlaySound(whistle->snd,whistle->hm,whistle->flags|SND_PURGE);
+ delete whistle;
+ return TRUE;
+ }
+ UINT FillInCombo(CComboBox* combo) {
+ POSITION p = m_bangs.GetStartPosition();
+ UINT rv = 0;
+ while(p) {
+ CString s;
+ CBang* b;
+ m_bangs.GetNextAssoc(p,s,b);
+ combo->AddString(s);
+ }
+ return rv;
+ }
+};
+
+#endif // _BELLSNWHISTLES_H \ No newline at end of file
diff --git a/shared-code/BitSet.h b/shared-code/BitSet.h
new file mode 100644
index 0000000..cf36e3b
--- a/dev/null
+++ b/shared-code/BitSet.h
@@ -0,0 +1,105 @@
+#ifndef __BITSET_H
+#define __BITSET_H
+
+namespace Klever {
+
+class CBitSet : public CObject {
+public:
+ CWordArray m_Bits;
+ ULONG m_BitsInSet;
+ enum {
+ bitsPerWord = sizeof(WORD)*8
+ };
+
+ CBitSet(ULONG size = 0) : m_BitsInSet(0) { SetSize(size); }
+ CBitSet(CBitSet& o) : m_BitsInSet(0) { CopyFrom(o); }
+
+ void SetSize(ULONG size,BOOL bFillOnes=FALSE) {
+ UINT os = m_Bits.GetSize();
+ UINT ns = (size+bitsPerWord-1)/bitsPerWord;
+ if(os==ns){
+ if(os){
+ if(bFillOnes)
+ m_Bits[m_BitsInSet/bitsPerWord]|=(~(WORD)0)<<(m_BitsInSet%bitsPerWord);
+ else
+ m_Bits[m_BitsInSet/bitsPerWord]&=~((~(WORD)0)<<(m_BitsInSet%bitsPerWord));
+ }
+ m_BitsInSet=size;
+ }else{
+ // *?* ASSERT((!os) || (((os-1)*bitsPerWord)<=m_BitsInSet && m_BitsInSet<(os*bitsPerWord)));
+ if(os<ns){
+ m_Bits.SetSize(ns);
+ if(bFillOnes)
+ m_Bits[m_BitsInSet/bitsPerWord]|=(~(WORD)0)<<(m_BitsInSet%bitsPerWord);
+ else
+ m_Bits[m_BitsInSet/bitsPerWord]&=~((~(WORD)0)<<(m_BitsInSet%bitsPerWord));
+ WORD* ws = m_Bits.GetData();
+ ASSERT(ws);
+ memset(&ws[os],bFillOnes?0xFF:0,(ns-os)*sizeof(WORD));
+ m_BitsInSet=size;
+ }else{
+ m_Bits.SetSize(ns);
+ m_BitsInSet=size;
+ }
+ }
+ }
+ BOOL BitSet(UINT bit,BOOL bGrow=TRUE) { return SetBit(bit,TRUE,bGrow); }
+ BOOL BitClear(UINT bit,BOOL bGrow=TRUE) { return SetBit(bit,FALSE,bGrow); }
+ BOOL SetBit(UINT bit,BOOL state,BOOL bGrow=TRUE) {
+ if(m_BitsInSet<=bit){
+ if(!bGrow)
+ return FALSE;
+ SetSize(bit+1);
+ }
+ WORD mask = ((WORD)1)<<(bit%bitsPerWord);
+ if(state)
+ m_Bits[bit/bitsPerWord]|=mask;
+ else
+ m_Bits[bit/bitsPerWord]&=~mask;
+ return TRUE;
+ }
+ BOOL IsSet(UINT bit) {
+ if(m_BitsInSet<=bit)
+ return FALSE;
+ return (m_Bits[bit/bitsPerWord]&(((WORD)1)<<(bit%bitsPerWord)))!=0;
+ }
+ void Invert() {
+ for(int i=m_Bits.GetUpperBound();i>=0;i--)
+ m_Bits[i]=~m_Bits[i];
+ }
+ CBitSet& operator&=(CBitSet& o) {
+ if(o.m_BitsInSet<m_BitsInSet)
+ SetSize(o.m_BitsInSet);
+ for(int i=m_Bits.GetUpperBound();i>=0;i--)
+ m_Bits[i]&=o.m_Bits[i];
+ return *this;
+ }
+ CBitSet& operator|=(CBitSet& o) {
+ if(o.m_BitsInSet>m_BitsInSet)
+ SetSize(o.m_BitsInSet);
+ for(int i=o.m_Bits.GetUpperBound();i>=0;i--)
+ m_Bits[i]|=o.m_Bits[i];
+ return *this;
+ }
+ CBitSet& operator=(CBitSet& o) {
+ CopyFrom(o);
+ return *this;
+ }
+ void CopyFrom(CBitSet& o) {
+ m_BitsInSet=o.m_BitsInSet;
+ m_Bits.Copy(o.m_Bits);
+ }
+ void Serialize(CArchive& ar) {
+ if(ar.IsStoring()){
+ ar << m_BitsInSet;
+ m_Bits.Serialize(ar);
+ }else{
+ ar >> m_BitsInSet;
+ m_Bits.Serialize(ar);
+ }
+ }
+};
+
+};
+
+#endif // __BITSET_H
diff --git a/shared-code/Dynamide.h b/shared-code/Dynamide.h
new file mode 100644
index 0000000..32c93f7
--- a/dev/null
+++ b/shared-code/Dynamide.h
@@ -0,0 +1,443 @@
+#ifndef __DYNAMIDE_H
+#define __DYNAMIDE_H
+
+#include "LRUCache.h"
+
+namespace Klever {
+
+template<int fbSize,int bSize>
+class CDynamide : public CObject {
+ struct firstBlock {
+ LONG freeFile;
+ BYTE crap[fbSize-sizeof(LONG)];
+ };
+ struct theBlock {
+ LONG next;
+ BYTE data[bSize-sizeof(LONG)];
+ };
+public:
+ static firstBlock FirstBlock;
+ static theBlock TheBlock;
+private:
+ class CDynaCache : public CLRUCache<DWORD,DWORD,theBlock> {
+ public:
+ CFile* m_File;
+ BOOL m_bAutodelete;
+ CDynaCache(CFile* file,BOOL bAutodelete=TRUE) : CLRUCache<DWORD,DWORD,theBlock>(64) {
+ m_File=file;
+ m_bAutodelete=bAutodelete;
+ }
+ virtual ~CDynaCache() {
+ Flush();
+ if(m_bAutodelete){
+ m_File->Close();
+ delete m_File;
+ }
+ }
+ virtual BOOL _ReadIn(DWORD idx,theBlock* data) {
+ LONG p = sizeof(firstBlock)+idx*sizeof(theBlock);
+ LONG s = m_File->Seek(p,CFile::begin);
+ if(p==s){
+ UINT rb = m_File->Read(data,sizeof(*data));
+ if(rb==sizeof(*data))
+ return TRUE;
+ if(rb)
+ return FALSE;
+ memset(data,0,sizeof(*data));
+ data->next=-1;
+ try{
+ m_File->Write(data,sizeof(*data));
+ }catch(CException* e){
+ e->Delete();
+ return FALSE;
+ }
+ }else{
+ LONG togo = p-s;
+ ASSERT(togo>0);
+ ASSERT(!(togo%sizeof(theBlock)));
+ memset(data,0,sizeof(*data));
+ data->next=-1;
+ while(togo>=0){
+ try{
+ m_File->Write(data,sizeof(*data));
+ }catch(CException* e){
+ e->Delete();
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+ }
+ virtual BOOL _WriteOut(DWORD idx,theBlock* data) {
+ LONG p = sizeof(firstBlock)+idx*sizeof(theBlock);
+ LONG s = m_File->Seek(p,CFile::begin);
+ if(p!=s)
+ return FALSE;
+ try{
+ m_File->Write(data,sizeof(*data));
+ }catch(CException* e){
+ e->Delete();
+ return FALSE;
+ }
+ return TRUE;
+ }
+ DWORD AllocateNode() {
+ LONG l = m_File->GetLength();
+ ASSERT(!((l-sizeof(firstBlock))%sizeof(theBlock)));
+ m_File->SetLength(l+sizeof(theBlock));
+ return (l-sizeof(firstBlock))/sizeof(theBlock);
+ }
+ BOOL Read1stBlock(firstBlock* fb) {
+ m_File->SeekToBegin();
+ UINT rb = m_File->Read(fb,sizeof(*fb));
+ if(rb==sizeof(*fb))
+ return TRUE;
+ if(rb)
+ return FALSE;
+ memset(fb,0,sizeof(*fb));
+ fb->freeFile = -1;
+ try{
+ m_File->Write(fb,sizeof(*fb));
+ }catch(CException* e){
+ e->Delete();
+ return FALSE;
+ }
+ return TRUE;
+ }
+ BOOL Write1stBlock(firstBlock* fb) {
+ m_File->SeekToBegin();
+ try{
+ m_File->Write(fb,sizeof(*fb));
+ }catch(CException* e){
+ e->Delete();
+ return FALSE;
+ }
+ return TRUE;
+ }
+ };
+public:
+ class CDynaFile : public CFile {
+ public:
+ CDynamide<fbSize,bSize>* m_Daddy;
+ CArray<LONG,LONG> m_Blocks;
+ LONG m_Position;
+
+ CDynaFile(CDynamide<fbSize,bSize>* daddy) : m_Daddy(NULL) { AttachToDaddy(daddy); }
+ virtual ~CDynaFile() { Close(); DetachFromDaddy(); }
+
+ void AttachToDaddy(CDynamide<fbSize,bSize>* daddy) {
+ ASSERT(!m_Daddy);
+ ASSERT(daddy);
+ m_Daddy=daddy;
+ m_Daddy->AttachDynaFile(this);
+ }
+ void DetachFromDaddy() {
+ ASSERT(m_Daddy);
+ ASSERT(!IsOpened());
+ m_Daddy->DetachDynaFile(this);
+ m_Daddy=NULL;
+ }
+
+ BOOL Create() {
+ if(IsOpened())
+ return FALSE;
+ m_Blocks.SetAtGrow(0,m_Daddy->Allocate());
+ ASSERT(m_Blocks[0]>=0);
+ m_Position=0;
+ return TRUE;
+ }
+ BOOL Open(LONG fb) {
+ if(IsOpened())
+ return FALSE;
+ ASSERT(fb>=0);
+ theBlock* b;
+ do{
+ m_Blocks.Add(fb);
+ b = m_Daddy->m_File->GetCached(fb);
+ ASSERT(b);
+ fb=b->next;
+ if(m_Blocks[m_Blocks.GetUpperBound()]==fb)
+ return FALSE;
+ }while(fb>=0);
+ m_Position=0;
+ return TRUE;
+ }
+
+ LONG GetFile() {
+ if(!IsOpened())
+ return -1;
+ return m_Blocks[0];
+ }
+ virtual DWORD GetPosition() const {
+ if(!IsOpened())
+ return 0;
+ if(m_Position<0)
+ return 0;
+ if(m_Position>GetLength())
+ return GetLength();
+ return m_Position;
+ }
+ virtual CString GetFileName() {
+ CString rv;
+ if(IsOpened())
+ rv.Format("0x%08lX",m_Blocks[0]);
+ else
+ rv.Format("None");
+ return rv;
+ }
+ virtual CString GetFileTitle() { return GetFileName(); }
+ virtual CString GetFilePath() { return GetFileName(); }
+ virtual void SetFilePath(LPCTSTR lpszNewName) { ASSERT(FALSE); }
+
+ virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL) { ASSERT(FALSE); return FALSE; }
+ virtual CFile* Duplicate() { ASSERT(FALSE); return NULL; }
+
+ virtual LONG Seek(LONG lOff, UINT nFrom) {
+ if(!IsOpened())
+ return -1;
+ switch(nFrom){
+ case CFile::begin:
+ m_Position=lOff;
+ break;
+ case CFile::current:
+ m_Position+=lOff;
+ break;
+ case CFile::end:
+ m_Position=GetLength()+lOff;
+ break;
+ default:
+ ASSERT(FALSE);
+ return -1;
+ }
+ if(m_Position<0)
+ m_Position=0;
+ if(m_Position>GetLength())
+ m_Position=GetLength();
+ return m_Position;
+ }
+ virtual void SetLength(DWORD dwNewLen) {
+ if(!IsOpened())
+ return;
+ if(dwNewLen<GetLength()){
+ dwNewLen=dwNewLen+sizeof(TheBlock.data);
+ dwNewLen-=dwNewLen%sizeof(TheBlock.data);
+ while(dwNewLen<GetLength() && m_Blocks.GetSize()>1){
+ LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
+ LONG mb1 = m_Blocks[m_Blocks.GetUpperBound()-1];
+ theBlock* b = m_Daddy->m_File->GetCached(mb1);
+ ASSERT(b);
+ ASSERT(b->next==mb);
+ b->next=-1;
+ m_Daddy->m_File->MakeDirty(mb1);
+ m_Daddy->Deallocate(mb);
+ m_Blocks.SetSize(m_Blocks.GetSize()-1);
+ }
+ }else{
+ while(dwNewLen>GetLength()){
+ LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
+ LONG newBlock = m_Daddy->Allocate();
+ ASSERT(newBlock>=0);
+ theBlock* b = m_Daddy->m_File->GetCached(mb);
+ ASSERT(b);
+ ASSERT(b->next<0);
+ b->next=newBlock;
+ m_Daddy->m_File->MakeDirty(mb);
+ m_Blocks.Add(newBlock);
+ }
+ }
+ }
+ virtual DWORD GetLength() const {
+ return ((long)m_Blocks.GetSize())*((long)sizeof(TheBlock.data));
+ }
+
+ virtual UINT Read(void* lpBuf, UINT nCount) {
+ UINT rv = 0;
+ ASSERT(m_Position>=0 && m_Position<=GetLength());
+ LPBYTE data = (LPBYTE)lpBuf;
+ while(nCount && m_Position<GetLength()){
+ UINT bn = m_Position/sizeof(TheBlock.data);
+ UINT bo = m_Position%sizeof(TheBlock.data);
+ theBlock* b = m_Daddy->m_File->GetCached(m_Blocks[bn]);
+ ASSERT(b);
+ UINT bc = min(nCount,sizeof(TheBlock.data)-bo);
+ memmove(data,&b->data[bo],bc);
+ nCount-=bc;
+ data=&data[bc];
+ rv+=bc;
+ m_Position+=bc;
+ }
+ return rv;
+ }
+ virtual void Write(const void* lpBuf, UINT nCount) {
+ ASSERT(m_Position>=0 && m_Position<=GetLength());
+ LPBYTE data = (LPBYTE)lpBuf;
+ while(nCount){
+ UINT bn = m_Position/sizeof(TheBlock.data);
+ UINT bo = m_Position%sizeof(TheBlock.data);
+ while(bn>=m_Blocks.GetSize()){
+ LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
+ LONG newBlock = m_Daddy->Allocate();
+ ASSERT(newBlock>=0);
+ theBlock* b = m_Daddy->m_File->GetCached(mb);
+ ASSERT(b);
+ ASSERT(b->next<0);
+ b->next=newBlock;
+ m_Daddy->m_File->MakeDirty(mb);
+ m_Blocks.Add(newBlock);
+ }
+ theBlock* b = m_Daddy->m_File->GetCached(m_Blocks[bn]);
+ ASSERT(b);
+ UINT bc = min(nCount,sizeof(TheBlock.data)-bo);
+ memmove(&b->data[bo],data,bc);
+ m_Daddy->m_File->MakeDirty(m_Blocks[bn]);
+ nCount-=bc;
+ data=&data[bc];
+ m_Position+=bc;
+ }
+ }
+
+ virtual void LockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); }
+ virtual void UnlockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); }
+
+ virtual void Abort() { ASSERT(FALSE); }
+ virtual void Flush() {
+ m_Daddy->m_File->Flush();
+ }
+ virtual void Close() {
+ m_Blocks.RemoveAll();
+ }
+
+ BOOL IsOpened() const { return m_Blocks.GetSize()!=0; }
+ };
+
+ CDynaCache* m_File;
+ firstBlock m_FB;
+
+ CDynamide() : m_File(NULL) {}
+ ~CDynamide() { Close(); }
+
+ BOOL AttachDynaFile(CDynaFile* f) {
+ // ASSERT(!m_Files.Find(f));
+ // m_Files.AddHead(f);
+ return TRUE;
+ }
+ BOOL DetachDynaFile(CDynaFile* f) {
+ //POSITION p = m_Files.Find(f);
+ // ASSERT(p);
+ // m_Files.RemoveAt(p);
+ return TRUE;
+ }
+
+ BOOL Open(LPCTSTR file,BOOL bRO=FALSE) {
+ Close();
+ try{
+ CFile* f = new CFile(file,CFile::typeBinary|(bRO?CFile::modeRead|CFile::shareDenyWrite:CFile::modeReadWrite|CFile::shareDenyRead));
+ return Attach(f,TRUE);
+ }catch(CException* e){
+ e->Delete();
+ return FALSE;
+ }
+ }
+ BOOL Create(LPCTSTR file) {
+ Close();
+ try{
+ CFile* f = new CFile(file,CFile::typeBinary|CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead);
+ return Attach(f,TRUE);
+ }catch(CException* e){
+ e->Delete();
+ return FALSE;
+ }
+ }
+ BOOL Attach(CFile* file,BOOL bAutodelete=TRUE) {
+ if(IsOpened())
+ return FALSE;
+ m_File = new CDynaCache(file,bAutodelete);
+ if(!m_File->Read1stBlock(&m_FB)){
+ memset(&m_FB,0,sizeof(m_FB));
+ m_FB.freeFile=-1;
+ VERIFY(m_File->Write1stBlock(&m_FB));
+ }
+ return IsOpened();
+ }
+ // CFile* Detach();
+ BOOL Close() {
+ if(!IsOpened())
+ return FALSE;
+ m_File->Write1stBlock(&m_FB);
+ delete m_File;
+ m_File=NULL;
+ return TRUE;
+ }
+ BOOL IsOpened() {
+ return m_File != NULL;
+ }
+ BOOL Write1stBlock(void) {
+ if(!IsOpened())
+ return FALSE;
+ VERIFY(m_File->Write1stBlock(&m_FB));
+ return TRUE;
+ }
+
+ CDynaFile* CreateFile() {
+ CDynaFile* rv = new CDynaFile(this);
+ if(rv->Create())
+ return rv;
+ delete rv;
+ return NULL;
+ }
+ CDynaFile* OpenFile(LONG fb) {
+ CDynaFile* rv = new CDynaFile(this);
+ if(rv->Open(fb))
+ return rv;
+ delete rv;
+ return NULL;
+ }
+ BOOL DeleteFile(LONG fb) {
+ while(fb>=0){
+ theBlock* b = m_File->GetCached(fb);
+ LONG nb = b->next;
+ Deallocate(fb);
+ fb=nb;
+ }
+ return TRUE;
+ }
+
+ LONG Allocate() {
+ if(!IsOpened())
+ return -1;
+ if(m_FB.freeFile<0){
+ LONG rv = m_File->AllocateNode();
+ theBlock *b = m_File->GetCached(rv);
+ b->next=-1;
+ m_File->MakeDirty(rv);
+ return rv;
+ }
+ LONG rv = m_FB.freeFile;
+ theBlock *b = m_File->GetCached(rv);
+ m_FB.freeFile=b->next;
+ b->next=-1;
+ m_File->MakeDirty(rv);
+ m_File->Write1stBlock(&m_FB);
+ return rv;
+ }
+ BOOL Deallocate(LONG bk) {
+ if(!IsOpened())
+ return FALSE;
+ theBlock* b = m_File->GetCached(bk);
+ ASSERT(b);
+ if(m_FB.freeFile<0){
+ b->next=-1;
+ m_FB.freeFile=bk;
+ }else{
+ b->next=m_FB.freeFile;
+ m_FB.freeFile=bk;
+ }
+ m_File->MakeDirty(bk);
+ m_File->Write1stBlock(&m_FB);
+ return TRUE;
+ }
+};
+
+};
+
+#endif // __DYNAMIDE_H
diff --git a/shared-code/FindIFace.h b/shared-code/FindIFace.h
new file mode 100644
index 0000000..8dec8c4
--- a/dev/null
+++ b/shared-code/FindIFace.h
@@ -0,0 +1,125 @@
+#ifndef __FINDIFACE_H
+#define __FINDIFACE_H
+
+#include "SNMPeer.h"
+#include "SNMPExtDLL.h"
+#include "SNMPOIDs.h"
+
+namespace Klever {
+
+inline BOOL FindIFace(in_addr& target,in_addr& source)
+{
+DEFINE_OID(ipRouteDest, OIDipRouteDest);
+DEFINE_OID(ipRouteMask, OIDipRouteMask);
+DEFINE_OID(ipRouteIfIndex, OIDipRouteIfIndex);
+DEFINE_OID(ipRouteMetric1, OIDipRouteMetric1);
+DEFINE_OID(ipAdEntIfIndex, OIDipAdEntIfIndex);
+DEFINE_OID(ipAdEntAddr, OIDipAdEntAddr);
+struct _route {
+ int iface;
+ int metric;
+ DWORD nm;
+} routes[16];
+int nRoutes = 0;
+CSNMPVarBindList vbl;
+ vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteDest,sizeof(ipRouteDest))));
+ vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMask,sizeof(ipRouteMask))));
+ vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteIfIndex,sizeof(ipRouteIfIndex))));
+ vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMetric1,sizeof(ipRouteMetric1))));
+CSNMPExtDLL snmp("INETMIB1");
+ while(nRoutes<(sizeof(routes)/sizeof(routes[0]))){
+ if(
+ snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl)
+ && vbl.GetCount() == 4
+ ){
+ POSITION p = vbl.GetHeadPosition();
+ _route r = {-1,-1};
+ in_addr d, m;
+ BOOL bD = FALSE, bM = FALSE;
+ while(p){
+ CSNMPVarBind& vb = vbl.GetNext(p);
+ if(
+ vb.IsName(ipRouteDest,sizeof(ipRouteDest))
+ && vb.value.type==CASNAny::typeASNIP
+ ){
+ d.s_addr=vb.value.value.ip.s_addr; bD = TRUE;
+ }else if(
+ vb.IsName(ipRouteMask,sizeof(ipRouteMask))
+ && vb.value.type==CASNAny::typeASNIP
+ ){
+ m.s_addr=vb.value.value.ip.s_addr; bM = TRUE;
+ }else if(
+ vb.IsName(ipRouteIfIndex,sizeof(ipRouteIfIndex))
+ && vb.value.type==CASNAny::typeASNInteger
+ ){
+ r.iface=vb.value.value.number;
+ }else if(
+ vb.IsName(ipRouteMetric1,sizeof(ipRouteMetric1))
+ && vb.value.type==CASNAny::typeASNInteger
+ ){
+ r.metric=vb.value.value.number;
+ }else
+ break;
+ }
+ if(r.iface<0 || r.metric<0 || (!bD) || (!bM))
+ break;
+ if((target.s_addr&m.s_addr)==(d.s_addr&m.s_addr)){
+ r.nm=htonl(m.s_addr);
+ memmove(&routes[nRoutes++],&r,sizeof(routes[0]));
+ }
+ }else
+ break;
+ }
+ if(!nRoutes)
+ return FALSE;
+int rn = 0;
+ if(nRoutes>1){
+ for(int tmp=1;tmp<nRoutes;tmp++)
+ if(
+ routes[tmp].metric<routes[rn].metric
+ || routes[tmp].nm>routes[rn].nm
+ )
+ rn = tmp;
+ }
+int iface = routes[rn].iface;
+ vbl.RemoveAll();
+ vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntAddr,sizeof(ipAdEntAddr))));
+ vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntIfIndex,sizeof(ipAdEntIfIndex))));
+ for(;;){
+ if(
+ snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl)
+ && vbl.GetCount()==2
+ ){
+ in_addr a; a.s_addr = INADDR_NONE;
+ int ifn = -1;
+ POSITION p = vbl.GetHeadPosition();
+ while(p){
+ CSNMPVarBind& vb = vbl.GetNext(p);
+ if(
+ vb.IsName(ipAdEntAddr,sizeof(ipAdEntAddr))
+ && vb.value.type==CASNAny::typeASNIP
+ ){
+ a.s_addr=vb.value.value.ip.s_addr;
+ }else if(
+ vb.IsName(ipAdEntIfIndex,sizeof(ipAdEntIfIndex))
+ && vb.value.type==CASNAny::typeASNInteger
+ ){
+ ifn = vb.value.value.number;
+ }else
+ break;
+ }
+ if(ifn<0)
+ break;
+ if(ifn==iface){
+ source.s_addr=a.s_addr;
+ return TRUE;
+ }
+ }else
+ break;
+ }
+ return FALSE;
+}
+
+};
+
+#endif // __FINDIFACE_H
diff --git a/shared-code/LRUCache.h b/shared-code/LRUCache.h
new file mode 100644
index 0000000..569e829
--- a/dev/null
+++ b/shared-code/LRUCache.h
@@ -0,0 +1,113 @@
+#ifndef __LRUCACHE_H
+#define __LRUCACHE_H
+
+namespace Klever {
+
+template<class IDX,class ARGIDX,class DATA>
+class CLRUCache : public CObject {
+public:
+ struct CacheEntry {
+ enum cacheState {
+ cacheClean, cacheDirty, cacheEmpty
+ };
+ cacheState m_State;
+ UINT m_hits;
+
+ IDX m_idx;
+ DATA* m_pData;
+
+ CacheEntry() { m_State=cacheEmpty; VERIFY(m_pData=new DATA); m_hits=0; }
+ virtual ~CacheEntry() { delete m_pData; }
+ };
+ typedef CMap<IDX,ARGIDX,CacheEntry*,CacheEntry*> CCacheMap;
+ typedef CList<CacheEntry*,CacheEntry*> CCacheList;
+
+ CCacheList m_Cache;
+ CCacheMap m_Map;
+
+ CLRUCache(UINT cacheSize) {
+ for(int tmp=0;tmp<cacheSize;tmp++){
+ CacheEntry* p = new CacheEntry;
+ m_Cache.AddTail(p);
+ }
+ }
+ virtual ~CLRUCache() {
+ Flush();
+ POSITION p = m_Cache.GetHeadPosition();
+ while(p){
+ CacheEntry* c = m_Cache.GetNext(p);
+ delete c;
+ }
+ }
+
+ DATA* GetCached(ARGIDX idx,BOOL bLoad=TRUE) {
+ CacheEntry* rv;
+ if(m_Map.Lookup(idx,rv)){
+ rv->m_hits++;
+ PopUp(rv);
+ return rv->m_pData;
+ }
+ if(!bLoad)
+ return NULL;
+ rv = m_Cache.GetTail();
+ ASSERT(rv);
+ switch(rv->m_State){
+ case CacheEntry::cacheDirty:
+ FlushEntry(rv);
+ case CacheEntry::cacheClean:
+ m_Map.RemoveKey(rv->m_idx);
+ rv->m_State=CacheEntry::cacheEmpty;
+ case CacheEntry::cacheEmpty:
+ break;
+ default:
+ ASSERT(FALSE);
+ }
+ if(!_ReadIn(idx,rv->m_pData))
+ return NULL;
+ rv->m_hits=1;
+ rv->m_State=CacheEntry::cacheClean;
+ rv->m_idx=idx;
+ m_Map[idx]=rv;
+ PopUp(rv);
+ return rv->m_pData;
+ }
+ BOOL MakeDirty(ARGIDX idx) {
+ CacheEntry* pEntry;
+ if(m_Map.Lookup(idx,pEntry)){
+ ASSERT(pEntry->m_State==CacheEntry::cacheClean || pEntry->m_State==CacheEntry::cacheDirty);
+ pEntry->m_State=CacheEntry::cacheDirty;
+ return TRUE;
+ }
+ return FALSE;
+ }
+ BOOL Flush() {
+ POSITION p = m_Cache.GetHeadPosition();
+ while(p){
+ CacheEntry* pEntry = m_Cache.GetNext(p);
+ ASSERT(pEntry);
+ FlushEntry(pEntry);
+ }
+ return TRUE;
+ }
+ BOOL FlushEntry(CacheEntry* pEntry) {
+ if(pEntry->m_State==CacheEntry::cacheDirty){
+ BOOL rv = _WriteOut(pEntry->m_idx,pEntry->m_pData);
+ if(rv)
+ pEntry->m_State=CacheEntry::cacheClean;
+ }
+ return FALSE;
+ }
+ void PopUp(CacheEntry* pEntry) {
+ POSITION p = m_Cache.Find(pEntry);
+ ASSERT(p);
+ m_Cache.RemoveAt(p);
+ VERIFY(m_Cache.AddHead(pEntry));
+ }
+
+ virtual BOOL _ReadIn(ARGIDX idx,DATA* data) = 0;
+ virtual BOOL _WriteOut(ARGIDX idx,DATA* data) = 0;
+};
+
+};
+
+#endif // __LRUCACHE_H
diff --git a/shared-code/RegEx.cpp b/shared-code/RegEx.cpp
new file mode 100644
index 0000000..b7bab62
--- a/dev/null
+++ b/shared-code/RegEx.cpp
@@ -0,0 +1,1697 @@
+#include "../stdafx.h"
+#include "RegEx.h"
+
+#define isWordableChar(c) (isalnum(c) || (c)=='_')
+
+BOOL CRegEx::Compile(LPCTSTR regex,int flags)
+{
+ ASSERT(!((flags&regExtended) && (flags&regLiteral)));
+ m_Matches.RemoveAll();
+ m_Strip.RemoveAll();
+ m_Strip.SetSize(0,15);
+ m_Pattern=regex;
+ m_ParsePointer=0;
+ m_Error=0;
+ m_Sets.RemoveAll();
+ m_Flags=flags;
+ m_iFlags=0;
+ m_BOLs=m_EOLs=0;
+ m_Subexps = 0;
+ m_Categories=1; // 0 is 'everything else'
+ m_bBackRefs=FALSE;
+ memset(m_Category,0,sizeof(m_Category));
+
+ // Go ahead.
+ m_Error || m_Strip.Add(CSop(CSop::opEnd));
+ if(flags&regExtended){
+ ParseERE();
+ }else if(flags&regLiteral){
+ ParseLiteral();
+ }else{
+ ParseBRE();
+ }
+ m_Error || m_Strip.Add(CSop(CSop::opEnd));
+ Categorize();
+ m_Strip.FreeExtra();
+ FigureMust();
+ m_Pluses=CountPluses();
+ if(m_iFlags&iflagsBad){
+ m_Error || (m_Error=regeAssert);
+ // ??? point to nuls? ;-)
+ }
+ // We may wish to free some memory here if we're erroneous (ie. m_Error..)
+ m_ParseParens.RemoveAll();
+#ifdef _DEBUG
+ if(m_Error){
+ CString tmp;
+ tmp.Format("RE: ParseError: %d\n",m_Error);
+ TRACE0(tmp);
+ }
+// DumpStrip(afxDump);
+#endif
+ return (m_bCompiled=(!m_Error));
+}
+
+BOOL CRegEx::Match(LPCTSTR src,int flags)
+{
+ if(!m_bCompiled)
+ return FALSE;
+ if(m_iFlags&iflagsBad)
+ return FALSE;
+ m_Input=src;
+ m_mFlags=flags;
+ m_mPointer=m_Input;
+ m_mBegin=m_Input;
+ m_mEnd=&m_mBegin[m_Input.GetLength()];
+ ASSERT(m_mPointer<=m_mEnd);
+ m_Matches.RemoveAll();
+ if(!m_Must.IsEmpty()){
+ if(m_Input.Find(m_Must)<0)
+ return FALSE;
+ }
+ // Go ahead..
+int stripLen = m_Strip.GetSize();
+ m_mLastPos.SetSize(0);
+ for(int tmp=0;tmp<stripLen;tmp++)
+ m_Strip[tmp].m_MatchData=0;
+LPCTSTR beginp = m_mBegin;
+LPCTSTR endp;
+ for(;;){
+ endp = MatchFast(beginp);
+ if(!endp)
+ return FALSE;
+ if((m_mFlags&regNoSubExpressions) && !m_bBackRefs)
+ break;
+ ASSERT(m_cOldP);
+ for(;;){
+ endp = MatchSlow(m_cOldP,m_mEnd,1,stripLen-1);
+ if(endp)
+ break;
+ ASSERT(m_cOldP<m_mEnd);
+ m_cOldP++;
+ }
+ if((m_mFlags&regOneMatch) && !m_bBackRefs)
+ break;
+ // Oh, his, we want the subexpression..
+ m_Matches.SetSize(m_Subexps+1);
+ LPCTSTR dp;
+ if(!m_bBackRefs && !(m_mFlags&regBackRefs)){
+ dp = MatchDissect(m_cOldP,endp,1,stripLen-1);
+ }else{
+ if(m_Pluses>0 && !m_mLastPos.GetSize())
+ m_mLastPos.SetSize(m_Pluses);
+ dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0);
+ }
+ if(dp)
+ break;
+ // Uh.. oh.. we couldn't find a subexpression-level match
+ ASSERT(m_bBackRefs);
+ ASSERT(m_Pluses==0 || m_mLastPos.GetSize());
+ for(;;){
+ if(dp || endp <= m_cOldP)
+ break; // defeat.. ?
+ endp = MatchSlow(m_cOldP,endp-1,1,stripLen-1);
+ if(!endp)
+ break; // defeat.. ?
+ // Try it on a shorter possibility..
+#ifdef _DEBUG
+ for(tmp=1;tmp<=m_Subexps;tmp++)
+ ASSERT(m_Matches[tmp].m_Begin<0 && m_Matches[tmp].m_End<0);
+#endif
+ dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0);
+ }
+ ASSERT((!dp) || dp==endp);
+ if(dp) // Found a shorter one..
+ break;
+ // Despite initial appearances, there is no match here
+ beginp = m_cOldP+1;
+ ASSERT(beginp<=m_mEnd);
+ }
+ // Fill in the detail if so requested..
+ if(!(m_mFlags&regNoSubExpressions)){
+ if(!m_Matches.GetSize())
+ m_Matches.SetSize(1);
+ m_Matches[0].m_Begin=m_cOldP-m_mBegin;
+ m_Matches[0].m_End=endp-m_mBegin;
+ }
+ m_mLastPos.RemoveAll();
+ return TRUE;
+}
+
+CString CRegEx::Replace(LPCTSTR src,LPCTSTR rep,int flags)
+{
+ // ***
+ return CString();
+}
+
+void CRegEx::ParseERE(int stop)
+{
+UCHAR c;
+BOOL first=TRUE;
+int prevF, prevB;
+ for(;;){
+ int co = m_Strip.GetSize();
+ while(m_ParsePointer < m_Pattern.GetLength() && ((c=m_Pattern[m_ParsePointer])!='|') && c!=stop)
+ ParseEREexp();
+ if(m_Strip.GetSize()==co){
+ m_Error || (m_Error=regeEmpty);
+ // ??? point to nuls?
+ }
+ if(m_ParsePointer>=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='|')
+ break;
+ else
+ m_ParsePointer++;
+ if(first){
+ StripInsert(co,CSop(CSop::opChoice0,m_Strip.GetSize()-co+1));
+ prevF = prevB = co;
+ first=FALSE;
+ }
+ m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-prevB));
+ prevB = m_Strip.GetSize()-1;
+ m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF);
+ prevF = m_Strip.GetSize();
+ m_Error || m_Strip.Add(CSop(CSop::opOr1,0)); // offset isn't really right.. very so..
+ }
+ if(!first){
+ m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF);
+ m_Error || m_Strip.Add(CSop(CSop::opChoice1,m_Strip.GetSize()-prevB));
+ }
+ ASSERT(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]==stop);
+}
+
+void CRegEx::ParseEREexp()
+{
+ ASSERT(m_ParsePointer < m_Pattern.GetLength());
+UCHAR c = m_Pattern[m_ParsePointer++];
+int pos = m_Strip.GetSize();
+int subno;
+int count, count2;
+BOOL wascaret=FALSE;
+ switch(c){
+ case '(':
+ if(!(m_ParsePointer<m_Pattern.GetLength())){
+ TRACE0("RE: '(' at the end of the pattern\n");
+ if(!m_Error)
+ m_Error = regeParen;
+ // ??? point to nuls?
+ }
+ m_Subexps++;
+ subno=m_Subexps;
+ m_ParseParens.SetAtGrow(m_Subexps,CParenthesis(m_Strip.GetSize()));
+ m_Error || m_Strip.Add(CSop(CSop::opLeftParen,subno));
+ if(m_ParsePointer>=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!=')')
+ ParseERE(')');
+ VERIFY(m_ParseParens[m_Subexps].m_End = m_Strip.GetSize());
+ m_Error || m_Strip.Add(CSop(CSop::opRightParen,subno));
+ if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer++]!=')'){
+ TRACE0("RE: No matching ')'\n");
+ if(!m_Error)
+ m_Error = regeParen;
+ // ??? point to nuls?
+ }
+ break;
+ case '^':
+ m_Error || m_Strip.Add(CSop(CSop::opBOL));
+ m_iFlags|=iflagsUseBOL;
+ m_BOLs++;
+ wascaret=TRUE;
+ break;
+ case '$':
+ m_Error || m_Strip.Add(CSop(CSop::opEOL));
+ m_iFlags|=iflagsUseEOL;
+ m_EOLs++;
+ break;
+ case '|':
+ TRACE0("RE: '|' outside of expression\n");
+ if(!m_Error)
+ m_Error = regeEmpty;
+ // ??? point to nuls?
+ break;
+ case '*':
+ case '+':
+ case '?':
+ TRACE0("RE: '*'/'+'/'?' with no previous expression\n");
+ if(!m_Error)
+ m_Error = regeBadRepeat;
+ // ??? point to nuls?
+ break;
+ case '.':
+ if(m_Flags&regNewLine)
+ EmitNonNewLineAny();
+ else
+ m_Error || m_Strip.Add(CSop(CSop::opAny));
+ break;
+ case '[':
+ ParseBracket();
+ break;
+ case '\\':
+ if(m_ParsePointer >= m_Pattern.GetLength()){
+ TRACE0("RE: '\\' at the end of the pattern\n");
+ if(!m_Error)
+ m_Error = regeEscape;
+ // ??? point to nuls?
+ }else{
+ c = m_Pattern[m_ParsePointer++];
+ EmitOrdinary(c);
+ }
+ break;
+ case '{':
+ if(m_ParsePointer >= m_Pattern.GetLength() || !isdigit(m_Pattern[m_ParsePointer])){
+ TRACE0("RE: '{' with no repeat count\n");
+ if(!m_Error)
+ m_Error = regeBadRepeat;
+ // ??? point to nuls?
+ }
+ // Fallthrough..
+ default:
+ EmitOrdinary(c);
+ break;
+ }
+ if(m_ParsePointer >= m_Pattern.GetLength())
+ return;
+ c = m_Pattern[m_ParsePointer];
+ // Call a '{' repetition if followed by a digit
+ if (!(c=='*' || c=='+' || c=='?' || ( c=='{' && (m_ParsePointer+1) < m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer+1])) ))
+ return; // No repetitor - done.
+ m_ParsePointer++;
+ if(wascaret){
+ TRACE0("RE: repetitive '^' detected\n");
+ if(!m_Error)
+ m_Error = regeBadRepeat;
+ // ??? point to nuls?
+ }
+ switch(c){
+ case '*': // Implemeted as +?
+ // + expression
+ StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
+ m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
+ // ? expression
+ StripInsert(pos,CSop(CSop::opQuest0,m_Strip.GetSize()-pos+1));
+ m_Error || m_Strip.Add(CSop(CSop::opQuest1,m_Strip.GetSize()-pos));
+ break;
+ case '+':
+ // + expression
+ StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
+ m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
+ break;
+ case '?':
+ // Kludge - emit y? as (y|) until subtle bug gets fixed :-)
+ StripInsert(pos,CSop(CSop::opChoice0,m_Strip.GetSize()-pos+1));
+ m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
+ m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
+ m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
+ m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
+ break;
+ case '{':
+ count = ParseCount();
+ if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==','){
+ m_ParsePointer++;
+ if(isdigit(m_Pattern[m_ParsePointer])){ // HHH Personally, I doubt it is always available
+ count2=ParseCount();
+ if(!(count<=count2)){
+ TRACE0("RE: Disbalanced counts in '{}' repeater\n");
+ m_Error || (m_Error=regeBadBrace);
+ // ??? point to nuls?
+ }
+ }else // Single number with comma
+ count2=256; // Infinity
+ }else // Single number
+ count2=count;
+ EmitRepeat(pos,count,count2);
+ if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='}'){
+ // No '}'..
+ TRACE0("RE: No immediately following '}' of '{' expression\n");
+ while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!='}')
+ m_ParsePointer++;
+ if(m_ParsePointer >= m_Pattern.GetLength()){
+ TRACE0("RE: No closing '}' found\n");
+ m_Error || (m_Error=regeBrace);
+ }else
+ m_Error || (m_Error=regeBadBrace);
+ // ??? point to nuls?
+ }else
+ m_ParsePointer++;
+ break;
+ }
+ if(m_ParsePointer >= m_Pattern.GetLength())
+ return;
+ c = m_Pattern[m_ParsePointer];
+ if(!(c=='*' || c=='+' || c=='?' || (c=='{' && (m_ParsePointer+1)<m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer+1]))))
+ return;
+ TRACE0("RE: Double repeater\n");
+ m_Error || (m_Error=regeBadRepeat);
+ // ??? point to nuls?
+}
+
+void CRegEx::StripInsert(int pos,CSop& sop)
+{
+ if(m_Error)
+ return;
+int sn = m_Strip.GetSize();
+ m_Strip.InsertAt(pos,sop);
+ for(int tmp=1;tmp<m_ParseParens.GetSize();tmp++){
+ if(m_ParseParens[tmp].m_Begin>=pos)
+ m_ParseParens[tmp].m_Begin++;
+ if(m_ParseParens[tmp].m_End>=pos)
+ m_ParseParens[tmp].m_End++;
+ }
+}
+
+void CRegEx::EmitOrdinary(UCHAR c)
+{
+ if(m_Flags&regIgnoreCase && isalpha(c) && (tolower(c) !=toupper(c))){
+ // Emit both cases
+ CString savePattern = m_Pattern;
+ int savePointer = m_ParsePointer;
+ m_Pattern=c;
+ m_Pattern+=']';
+ m_ParsePointer=0;
+ ParseBracket();
+ m_Pattern=savePattern;
+ m_ParsePointer=savePointer;
+ }else{
+ m_Error || m_Strip.Add(CSop(CSop::opChar,c));
+ if(!m_Category[(BYTE)c])
+ m_Category[(BYTE)c]=m_Categories++;
+ }
+}
+
+void CRegEx::EmitNonNewLineAny()
+{
+ // Kludges're going on and on..
+CString savePattern = m_Pattern;
+int savePointer = m_ParsePointer;
+ m_Pattern="^\n]";
+ m_ParsePointer=0;
+ ParseBracket();
+ m_Pattern=savePattern;
+ m_ParsePointer=savePointer;
+}
+
+int CRegEx::ParseCount()
+{
+BOOL nonEmpty=FALSE;
+int rv = 0;
+UCHAR c;
+ while(m_ParsePointer < m_Pattern.GetLength() && isdigit(c=m_Pattern[m_ParsePointer]) && rv <=255){
+ rv = rv*10 + c-'0';
+ nonEmpty=TRUE;
+ m_ParsePointer++;
+ }
+ if(rv>255 || !nonEmpty){
+ m_Error || (m_Error=regeBadBrace);
+ // ??? point to nuls?
+ }
+ return rv;
+}
+
+void CRegEx::ParseBracket()
+{
+ // Dept. of truly sickening special case kludges
+ if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:<]]")){
+ m_Error || m_Strip.Add(CSop(CSop::opBOW));
+ m_ParsePointer+=6;
+ return;
+ }
+ if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:>]]")){
+ m_Error || m_Strip.Add(CSop(CSop::opEOW));
+ m_ParsePointer+=6;
+ return;
+ }
+BOOL invert=TRUE;
+ if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='^')
+ m_ParsePointer++;
+ else
+ invert=FALSE;
+CSet cset;
+ if(m_ParsePointer < m_Pattern.GetLength()){
+ switch(m_Pattern[m_ParsePointer]){
+ case ']':
+ case '-':
+ cset.Add(m_Pattern[m_ParsePointer]);
+ m_ParsePointer++;
+ break;
+ }
+ }
+ while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!=']' && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("-]")))
+ ParseBracketTerm(cset);
+ if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-'){
+ m_ParsePointer++;
+ cset.Add('-');
+ }
+ if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==']')
+ m_ParsePointer++;
+ else{
+ m_Error || (m_Error=regeBracket);
+ // ??? point to nuls?
+ return;
+ }
+ if(m_Flags&regIgnoreCase){
+ for(int tmp=CSet::size-1;tmp>=0;tmp--){
+ if(cset.IsIn(tmp) && isalpha(tmp) && (toupper(tmp)!=tolower(tmp)))
+ cset.Add(isupper(tmp)?tolower(tmp):toupper(tmp));
+ }
+ /*
+ if(!cset->m_Multis.IsEmpty())
+ cset.CollatingCase();
+ */
+ }
+ if(invert){
+ for(int tmp=CSet::size-1;tmp>=0;tmp--)
+ if(cset.IsIn(tmp))
+ cset.Sub(tmp);
+ else
+ cset.Add(tmp);
+ if(m_Flags&regNewLine)
+ cset.Sub('\n');
+ /*
+ if(!cset.m_Multis.IsEmpty())
+ cset.CollatingInvert();
+ */
+ }
+UCHAR c = cset.GetOnly();
+ if(c){
+ EmitOrdinary(c);
+ }else
+ m_Error || m_Strip.Add(CSop(CSop::opAnyOf,StoreSet(cset)));
+}
+
+void CRegEx::CSet::Add(UCHAR c)
+{
+ m_Set[(BYTE)c]=TRUE;
+ m_Hash+=c;
+}
+
+BOOL CRegEx::CSet::IsIn(UCHAR c)
+{
+ return m_Set[(BYTE)c];
+}
+
+void CRegEx::CSet::Sub(UCHAR c)
+{
+ m_Set[(BYTE)c]=FALSE;
+ m_Hash-=c;
+}
+
+UCHAR CRegEx::CSet::GetOnly()
+{
+int rv = 0;
+UCHAR only = 0;
+ for(int tmp=0;tmp<size;tmp++){
+ rv+=m_Set[tmp]?(only=tmp,1):0;
+ }
+ return (rv==1)?only:0;
+}
+
+int CRegEx::StoreSet(CSet& cset)
+{
+ for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
+ if(m_Sets[tmp]==cset)
+ return tmp;
+ return m_Sets.Add(cset);
+}
+
+void CRegEx::ParseBracketTerm(CSet& cset)
+{
+UCHAR c;
+ switch((m_ParsePointer<m_Pattern.GetLength())?m_Pattern[m_ParsePointer]:0){
+ case '[':
+ c = ((m_ParsePointer+1)<m_Pattern.GetLength())?m_Pattern[m_ParsePointer+1]:0;
+ break;
+ case '-':
+ m_Error || (m_Error=regeRange);
+ // ??? point to nuls?
+ return;
+ default:
+ c = 0;
+ break;
+ }
+ switch(c){
+ case ':': // Character class
+ m_ParsePointer+=2;
+ if(m_ParsePointer>=m_Pattern.GetLength()){
+ m_Error || (m_Error=regeBracket);
+ // ??? point to nuls?
+ }
+ c = m_Pattern[m_ParsePointer];
+ if(c== '-' || c==']'){
+ m_Error || (m_Error=regeCType);
+ // ??? point to nuls?
+ }
+ ParseBracketCClass(cset);
+ if(m_ParsePointer>=m_Pattern.GetLength()){
+ m_Error || (m_Error=regeBracket);
+ // ??? point to nuls?
+ }
+ if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare(":]"))){
+ m_Error || (m_Error=regeCType);
+ // ??? point to nuls?
+ }else
+ m_ParsePointer+=2;
+ break;
+ case '=': // Equivalence class
+ m_ParsePointer+=2;
+ if(m_ParsePointer >= m_Pattern.GetLength()){
+ m_Error || (m_Error=regeBracket);
+ // ??? point to nuls?
+ }
+ c = m_Pattern[m_ParsePointer];
+ if(c== '-' || c==']'){
+ m_Error || (m_Error=regeCollate);
+ // ??? point to nuls?
+ }
+ ParseBracketEClass(cset);
+ if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare("=]"))){
+ m_Error || (m_Error=regeCollate);
+ // ??? point to nuls?
+ }else
+ m_ParsePointer+=2;
+ break;
+ default: // Symbol, character or range
+ {
+ UCHAR start, finish;
+ start = ParseBracketSymbol();
+ if((m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-') /*&& (m_ParsePointer+1)<m_Pattern.GetLength() && m_Pattern[m_ParsePointer+1]==']'*/){
+ // I believe the expression above is seetwo..
+ // range.
+ m_ParsePointer++;
+ if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-'){
+ m_ParsePointer++;
+ finish='-';
+ }else
+ finish=ParseBracketSymbol();
+ }else
+ finish=start;
+ if(((BYTE)start)>((BYTE)finish)){
+ m_Error || (m_Error=regeRange);
+ // ??? point to nuls?
+ }
+ for(int tmp=start;tmp<=(BYTE)finish;tmp++)
+ cset.Add(tmp);
+ }
+ break;
+ }
+}
+
+void CRegEx::ParseBracketCClass(CSet& cset)
+{
+static struct {
+ char *className;
+ char *classChars;
+} cc[] = {
+ {"alnum","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},
+ {"alpha","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},
+ {"blank"," \t"},
+ {"cntrl","\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177"},
+ {"digit","0123456789"},
+ {"graph","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"},
+ {"lower","abcdefghijklmnopqrstuvwxyz"},
+ {"print","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ "},
+ {"punct","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"},
+ {"space","\t\n\v\f\r "},
+ {"upper","ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
+ {"xdigit","0123456789ABCDEFabcdef"}
+};
+CString cclass;
+UCHAR c;
+ while(m_ParsePointer < m_Pattern.GetLength() && isalpha(c=m_Pattern[m_ParsePointer])){
+ cclass+=c;
+ m_ParsePointer++;
+ }
+char *classChars = NULL;
+ for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++){
+ if(!cclass.CompareNoCase(cc[tmp].className)){
+ classChars=cc[tmp].classChars;
+ break;
+ }
+ }
+ if(!classChars){
+ m_Error || (m_Error=regeCType);
+ // ??? point to nuls?
+ return;
+ }
+ while(*classChars)
+ cset.Add(*(classChars++));
+ // --- multis
+}
+
+void CRegEx::ParseBracketEClass(CSet& cset)
+{
+ cset.Add(ParseBracketCollatingElement('='));;
+}
+
+UCHAR CRegEx::ParseBracketCollatingElement(UCHAR term)
+{
+static struct {
+ char *entityName;
+ char entity;
+} cc[] = { {"NUL",'\0'},{"SOH",'\001'},{"STX",'\002'},{"ETX",'\003'},{"EOT",'\004'},{"ENQ",'\005'},{"ACK",'\006'},{"BEL",'\007'},{"alert",'\007'},{"BS",'\010'},{"backspace",'\b'},{"HT",'\011'},{"tab",'\t'},{"LF",'\012'},{"newline",'\n'},{"VT",'\013'},{"vertical-tab",'\v'},{"FF",'\014'},{"form-feed",'\f'},{"CR",'\015'},{"carriage-return",'\r'},{"SO",'\016'},{"SI",'\017'},{"DLE",'\020'},{"DC1",'\021'},{"DC2",'\022'},{"DC3",'\023'},{"DC4",'\024'},{"NAK",'\025'},{"SYN",'\026'},{"ETB",'\027'},{"CAN",'\030'},{"EM",'\031'},{"SUB",'\032'},{"ESC",'\033'},{"IS4",'\034'},{"FS",'\034'},{"IS3",'\035'},{"GS",'\035'},{"IS2",'\036'},{"RS",'\036'},{"IS1",'\037'},{"US",'\037'},{"space",' '},{"exclamation-mark",'!'},{"quotation-mark",'"'},{"number-sign",'#'},{"dollar-sign",'$'},{"percent-sign",'%'},{"ampersand",'&'},{"apostrophe",'\''},{"left-parenthesis",'('},{"right-parenthesis",')'},{"asterisk",'*'},{"plus-sign",'+'},{"comma",','},{"hyphen",'-'},{"hyphen-minus",'-'},{"period",'.'},{"full-stop",'.'},{"slash",'/'},{"solidus",'/'},{"zero",'0'},{"one",'1'},{"two",'2'},{"three",'3'},{"four",'4'},{"five",'5'},{"six",'6'},{"seven",'7'},{"eight",'8'},{"nine",'9'},{"colon",':'},{"semicolon",';'},{"less-than-sign",'<'},{"equals-sign",'='},{"greater-than-sign",'>'},{"question-mark",'?'},{"commercial-at",'@'},{"left-square-bracket",'['},{"backslash",'\\'},{"reverse-solidus",'\\'},{"right-square-bracket",']'},{"circumflex",'^'},{"circumflex-accent",'^'},{"underscore",'_'},{"low-line",'_'},{"grave-accent",'`'},{"left-brace",'{'},{"left-curly-bracket",'{'},{"vertical-line",'|'},{"right-brace",'}'},{"right-curly-bracket",'}'},{"tilde",'~'},{"DEL",'\177'} };
+CString seeTwo;
+ seeTwo=term;
+ seeTwo+=']';
+CString entityName;
+ while(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare(seeTwo)))
+ entityName+=m_Pattern[m_ParsePointer++];
+ if(m_ParsePointer>=m_Pattern.GetLength()){
+ m_Error || (m_Error=regeBracket);
+ // ??? point to nuls?
+ return 0;
+ }
+ for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++)
+ if(!entityName.CompareNoCase(cc[tmp].entityName))
+ return cc[tmp].entity;
+ if(entityName.GetLength()==1)
+ return entityName[0];
+ m_Error || (m_Error=regeCollate);
+ // ??? point to nuls?
+ return 0;
+}
+
+UCHAR CRegEx::ParseBracketSymbol()
+{
+ if(m_ParsePointer>=m_Pattern.GetLength()){
+ m_Error || (m_Error=regeBracket);
+ // ??? point to nuls?
+ }
+ if((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("[."))
+ m_ParsePointer+=2;
+ else
+ return m_Pattern[m_ParsePointer++];
+ // Collating symbol
+UCHAR rv = ParseBracketCollatingElement('.');
+ if((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("[."))
+ m_ParsePointer+=2;
+ else{
+ m_Error || (m_Error=regeCollate);
+ // ??? point to nuls?
+ }
+ return rv;
+}
+
+void CRegEx::EmitRepeat(int pos,int from,int to)
+{
+ if(m_Error)
+ return;
+ ASSERT(from<=to);
+int finish = m_Strip.GetSize();
+int copy;
+#define N 2
+#define INF 3
+#define REP(f,t) ((f)*8+(t))
+#define MAP(n) (((n)<=1)?(n):((n)==256)?INF:N)
+ switch(REP(MAP(from),MAP(to))){
+ case REP(0,0): // must be user doing ths??
+ m_Strip.SetSize(pos);
+ break;
+ case REP(0,1): // as in '?'
+ case REP(0,N): // as in '{1,n}?'
+ case REP(0,INF): // as in '{1,}?'
+ // Kludge - emit y? as (y|) until something gets fixed..
+ StripInsert(pos,CSop(CSop::opChoice0,pos));
+ EmitRepeat(pos+1,1,to);
+ m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
+ m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
+ m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
+ m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
+ break;
+ case REP(1,1):
+ break;
+ case REP(1,N): // as in 'x?x{1,n-1}'
+ // Kludge again..
+ StripInsert(pos,CSop(CSop::opChoice0,pos));
+ m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
+ m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
+ m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
+ m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
+ copy = StripDuplicate(pos+1,finish+1);
+ ASSERT(copy==(finish+4));
+ EmitRepeat(copy,1,to-1);
+ break;
+ case REP(1,INF): // as in '+'
+ StripInsert(pos,CSop(CSop::opPlus0,pos));
+ m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
+ break;
+ case REP(N,N): // as in 'xx{from-1,to-1}'
+ copy = StripDuplicate(pos,finish);
+ EmitRepeat(copy,from-1,to-1);
+ break;
+ case REP(N,INF): // as in 'xx{n-1,}'
+ copy = StripDuplicate(pos,finish);
+ EmitRepeat(copy,from-1,to);
+ break;
+#ifndef NDEBUG
+ default:
+ ASSERT(FALSE);
+ break;
+#endif
+ }
+#undef MAP
+#undef REP
+#undef INF
+#undef N
+}
+
+int CRegEx::StripDuplicate(int from,int to)
+{
+int rv = m_Strip.GetSize();
+ ASSERT(from<=to);
+ if(from==to)
+ return rv;
+ // Maybe should be optimized for copying the whole thing.
+ for(int tmp=from;tmp<to;tmp++)
+ m_Strip.Add(m_Strip[tmp]);
+ return rv;
+}
+
+void CRegEx::Categorize()
+{
+ if(m_Error)
+ return;
+ for(int tmp=0;tmp<(sizeof(m_Category)/sizeof(m_Category[0]));tmp++)
+ if((!m_Category[tmp]) && IsInSets(tmp)){
+ int cat = m_Categories++;
+ m_Category[tmp]=cat;
+ for(int c=tmp+1;c<(sizeof(m_Category)/sizeof(m_Category[0]));c++)
+ if((!m_Category[c]) && IsInSameSets(tmp,c))
+ m_Category[c]=cat;
+ }
+}
+
+BOOL CRegEx::IsInSets(UCHAR c)
+{
+ for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
+ if(m_Sets[tmp].IsIn(c))
+ return TRUE;
+ return FALSE;
+}
+
+BOOL CRegEx::IsInSameSets(UCHAR c1,UCHAR c2)
+{
+ for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
+ if(m_Sets[tmp].IsIn(c1)!=m_Sets[tmp].IsIn(c2))
+ return FALSE;
+ return TRUE;
+}
+
+void CRegEx::FigureMust()
+{
+ if(m_Error)
+ return;
+ m_Must.Empty();
+int stripLen = m_Strip.GetSize();
+int seqStart, seqLength = 0;
+int mustStart, mustLength = 0;
+ for(int tmp=1;tmp<stripLen;tmp++){
+ switch(m_Strip[tmp].m_Operator){
+ case CSop::opChar:
+ if(!seqLength)
+ seqStart=tmp;
+ seqLength++;
+ break;
+ case CSop::opPlus0:
+ case CSop::opLeftParen:
+ case CSop::opRightParen:
+ break; // Break, since they don't break the sequence
+ case CSop::opQuest0:
+ case CSop::opChoice0:
+ // These ones we skip.
+ do{
+ tmp+=m_Strip[tmp].m_Operand;
+ // I still think it could be ASSERTed..
+ if(m_Strip[tmp].m_Operator!=CSop::opQuest1 && m_Strip[tmp].m_Operator!=CSop::opChoice1 && m_Strip[tmp].m_Operator!=CSop::opOr1){
+ m_iFlags|=iflagsBad;
+ return;
+ }
+ }while(m_Strip[tmp].m_Operator!=CSop::opQuest1 && m_Strip[tmp].m_Operator!=CSop::opChoice1);
+ // Fallthrough..
+ default:
+ // End of sequence
+ if(seqLength>mustLength){
+ mustStart=seqStart;
+ mustLength=seqLength;
+ }
+ seqLength=0;
+ break;
+ }
+ } // Hmm.. originally it's meant to be do while not opEnd..
+ if(!mustLength)
+ return;
+ // Turn into string, but, wait, personally I'm sure it could be put in the main loop.. or maybe not..
+ for(tmp=0;tmp<seqLength;tmp++){
+ while(m_Strip[seqStart+tmp].m_Operator!=CSop::opChar)
+ ASSERT(tmp<seqLength);
+ m_Must+=m_Strip[tmp].m_Operand;
+ }
+}
+
+int CRegEx::CountPluses()
+{
+ if(m_Error)
+ return 0;
+int stripLen = m_Strip.GetSize();
+int rv = 0;
+int nest = 0;
+ for(int tmp=0;tmp<stripLen;tmp++){
+ switch(m_Strip[tmp].m_Operator){
+ case CSop::opPlus0:
+ nest++;
+ break;
+ case CSop::opPlus1:
+ if(nest>rv)
+ rv = nest;
+ nest--;
+ break;
+ }
+ } // Again, originally we were supposed to scan till opEnd..
+ if(nest)
+ m_iFlags|=iflagsBad; // Could this be an ASSERTion?
+ return rv;
+}
+
+void CRegEx::ParseLiteral()
+{
+ if(!m_Pattern.GetLength()){
+ m_Error || (m_Error=regeEmpty);
+ // ??? point to nuls?
+ }
+ while(m_ParsePointer < m_Pattern.GetLength())
+ EmitOrdinary(m_Pattern[m_ParsePointer++]);
+}
+
+void CRegEx::ParseBRE(int stopa,int stopb)
+{
+int start = m_Strip.GetSize();
+BOOL first=TRUE;
+BOOL wasDollar=FALSE;
+ if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='^'){
+ m_ParsePointer++;
+ m_Error || m_Strip.Add(CSop(CSop::opBOL,0));
+ m_iFlags|=iflagsUseBOL;
+ m_BOLs++;
+ }
+CString stopstr;
+ if(stopa){
+ stopstr+=stopa;
+ if(stopb)
+ stopstr+=stopb;
+ }
+ while(m_ParsePointer < m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare(stopstr))){
+ wasDollar = ParseBREexp(first);
+ first=FALSE;
+ }
+ if(wasDollar){ // Trailing anchor that was..
+ m_Strip.SetSize(m_Strip.GetSize()-1);
+ m_Error || m_Strip.Add(CSop(CSop::opEOL,0));
+ m_iFlags|=iflagsUseEOL;
+ m_EOLs++;
+ }
+ if(m_Strip.GetSize()==start){
+ m_Error || (m_Error=regeEmpty);
+ // ??? point to nuls?
+ }
+}
+
+BOOL CRegEx::ParseBREexp(BOOL ordinaryStar)
+{
+int subno;
+int pos = m_Strip.GetSize();
+ ASSERT(m_ParsePointer<m_Pattern.GetLength());
+int c = m_Pattern[m_ParsePointer++];
+ if(c=='\\'){
+ if(m_ParsePointer>=m_Pattern.GetLength()){
+ m_Error || (m_Error=regeEscape);
+ // ??? point to nuls
+ }else
+ c = 0x100|m_Pattern[m_ParsePointer++];
+ }
+ switch(c){
+ case '.':
+ if(m_Flags&regNewLine)
+ EmitNonNewLineAny();
+ else
+ m_Error || m_Strip.Add(CSop(CSop::opAny,0));
+ break;
+ case '[':
+ ParseBracket();
+ break;
+ case 0x100|'{':
+ m_Error || (m_Error=regeBadRepeat);
+ // ??? point to nuls?
+ break;
+ case 0x100|'(':
+ m_Subexps++;
+ subno=m_Subexps;
+ m_ParseParens.SetAtGrow(m_Subexps,CParenthesis(m_Strip.GetSize()));
+ m_Error || m_Strip.Add(CSop(CSop::opLeftParen,subno));
+ if(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\)")))
+ ParseBRE('\\',')');
+ VERIFY(m_ParseParens[m_Subexps].m_End = m_Strip.GetSize());
+ m_Error || m_Strip.Add(CSop(CSop::opRightParen,subno));
+ if((m_ParsePointer+1) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\)"))
+ m_ParsePointer+=2;
+ else{
+ m_Error || (m_Error=regeParen);
+ // ??? point to nuls?
+ }
+ break;
+ case 0x100|')':
+ case 0x100|'}':
+ // Can this possibly happen?!
+ m_Error || (m_Error=regeParen);
+ // ??? point to nuls?
+ break;
+ case 0x100|'1':
+ case 0x100|'2':
+ case 0x100|'3':
+ case 0x100|'4':
+ case 0x100|'5':
+ case 0x100|'6':
+ case 0x100|'7':
+ case 0x100|'8':
+ case 0x100|'9':
+ {
+ int i = (c&0xFF)-'0';
+ if(i < m_ParseParens.GetSize() && m_ParseParens[i].m_End){
+ m_Error || m_Strip.Add(CSop(CSop::opBackRef0,i));
+ ASSERT(m_ParseParens[i].m_Begin);
+ ASSERT(m_Strip[m_ParseParens[i].m_Begin].m_Operator==CSop::opLeftParen);
+ ASSERT(m_Strip[m_ParseParens[i].m_End].m_Operator==CSop::opRightParen);
+ StripDuplicate(m_ParseParens[i].m_Begin+1,m_ParseParens[i].m_End);
+ m_Error || m_Strip.Add(CSop(CSop::opBackRef1,i));
+ }else{
+ m_Error || (m_Error=regeSubReg);
+ // ??? point to nuls?
+ }
+ m_bBackRefs=TRUE;
+ }
+ break;
+ case '*':
+ if(!ordinaryStar){
+ m_Error || (m_Error=regeBadRepeat);
+ // ??? point to nuls?
+ }
+ // Fallthrough..
+ default:
+ EmitOrdinary(c&0xFF);
+ break;
+ }
+ if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='*'){
+ m_ParsePointer++;
+ // as in '+?'
+ StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
+ m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
+ StripInsert(pos,CSop(CSop::opQuest0,m_Strip.GetSize()-pos+1));
+ m_Error || m_Strip.Add(CSop(CSop::opQuest1,m_Strip.GetSize()-pos));
+ }else if ((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\{")){
+ m_ParsePointer+=2;
+ int count = ParseCount();
+ int count2;
+ if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==','){
+ m_ParsePointer++;
+ if(m_ParsePointer<m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer])){
+ count2=ParseCount();
+ if(count>count2){
+ m_Error || (m_Error=regeBadBrace);
+ // ??? poin to nuls?
+ }
+ }else // Single number with comma
+ count2=256;
+ }else // Single number
+ count2=count;
+ EmitRepeat(pos,count,count2);
+ if((m_ParsePointer+1)>=m_Pattern.GetLength() || m_Pattern.Mid(m_ParsePointer,2).Compare("\\}")){
+ while(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\}")))
+ m_ParsePointer++;
+ if(m_ParsePointer>=m_Pattern.GetLength()){
+ m_Error || (m_Error=regeBrace);
+ // ??? point to nuls?
+ }
+ m_Error || (m_Error=regeBadBrace);
+ }else
+ m_ParsePointer+=2;
+ }else if(c=='$')
+ return TRUE;
+ return FALSE;
+}
+
+CRegEx::CRegEx()
+{
+ m_bCompiled=FALSE;
+}
+
+LPCTSTR CRegEx::MatchFast(LPCTSTR begin)
+{
+ MatchStatesClear(CSop::stCurrent);
+ m_Strip[1].m_MatchData|=CSop::stCurrent;
+int stripLen = m_Strip.GetSize();
+ MatchStep(1,stripLen-1,CSop::stCurrent,charNothing,CSop::stCurrent);
+ MatchStatesCopy(CSop::stFresh,CSop::stCurrent);
+LPCTSTR coldp = NULL;
+LPCTSTR p = begin;
+int c = (begin==m_mBegin)?charOut:((int)(BYTE)m_mPointer[-1]);
+ for(;;){
+ // next character..
+ int lastc = c;
+ c = (p==m_mEnd)?charOut:(int)*(BYTE*)p;
+ if(MatchStatesEqual(CSop::stCurrent,CSop::stFresh))
+ coldp=p;
+ // Is there an EOL and/or BOL between lastc and c? - they ask..
+ int flagc=0;
+ int i = 0;
+ if((lastc=='\n' && m_Flags&regNewLine) || (lastc==charOut && !(m_mFlags&regNotBOL))){
+ flagc=charBOL;
+ i=m_BOLs;
+ }
+ if((c=='\n' && m_Flags&regNewLine) || (c==charOut && !(m_mFlags&regNotEOL))){
+ flagc=(flagc==charBOL)?charBOLEOL:charEOL;
+ i+=m_EOLs;
+ }
+ if(i){
+ for(;i>0;i--)
+ MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent);
+ }
+ // What about a word boundary? - they wonder..
+ if((flagc==charBOL || (lastc!=charOut && !isWordableChar(c))) && (c!=charOut && isWordableChar(c)))
+ flagc = charBOW;
+ if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c))))
+ flagc = charEOW;
+ if(flagc==charBOW || flagc==charEOW){
+ MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent);
+ }
+ // Are we done? Now WE wonder..
+ if((m_Strip[stripLen-1].m_MatchData&CSop::stCurrent) || p==m_mEnd)
+ break; // They insist I need to note break out.. Okay, I do..
+ // Nope, we're not done. We have to face this character..
+ MatchStatesCopy(CSop::stTemp,CSop::stCurrent);
+ MatchStatesCopy(CSop::stCurrent,CSop::stFresh);
+ ASSERT(c!=charOut);
+ MatchStep(1,stripLen-1,CSop::stTemp,c,CSop::stCurrent);
+ p++;
+ }
+ ASSERT(coldp);
+ m_cOldP=coldp; // *** I believe this variable can be changed 'in-place'
+ if(m_Strip[stripLen-1].m_MatchData&CSop::stCurrent)
+ return &p[1];
+ else
+ return NULL;
+}
+
+void CRegEx::MatchStatesClear(BYTE mask)
+{
+int stripLen = m_Strip.GetSize();
+ for(int tmp=0;tmp<stripLen;tmp++)
+ m_Strip[tmp].m_MatchData&=~mask;
+}
+
+void CRegEx::MatchStep(int from,int to,BYTE maskBefore,int charCode,BYTE maskAfter)
+{
+BOOL i;
+int look;
+int here = from;
+ for(int pc=from;pc!=to;pc++,here++){
+ CSop s=m_Strip[pc];
+ switch(s.m_Operator){
+ case CSop::opEnd:
+ ASSERT(pc==(to-1));
+ break;
+ case CSop::opChar:
+ // Only characters can match..
+ ASSERT((charCode<charOut) || charCode!=s.m_Operand);
+ if(charCode==s.m_Operand)
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
+ break;
+ case CSop::opBOL:
+ if(charCode==charBOL || charCode==charBOLEOL)
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
+ break;
+ case CSop::opEOL:
+ if(charCode==charEOL || charCode==charBOLEOL)
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
+ break;
+ case CSop::opBOW:
+ if(charCode==charBOW)
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
+ break;
+ case CSop::opEOW:
+ if(charCode==charEOW)
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
+ break;
+ case CSop::opAny:
+ if(charCode<charOut)
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
+ break;
+ case CSop::opAnyOf:
+ if(charCode<charOut && m_Sets[s.m_Operand].m_Set[charCode])
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
+ break;
+ case CSop::opBackRef0: // Ignored here..
+ case CSop::opBackRef1:
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ break;
+ case CSop::opPlus0:
+ // Forward, this is just an empty, comment says..
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ break;
+ case CSop::opPlus1:
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ i =(m_Strip[here-s.m_Operand].m_MatchData&maskAfter)!=0;
+ m_Strip[here-s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ if(!i && (m_Strip[here-s.m_Operand].m_MatchData&maskAfter)){
+ // oho, must reconsider loop body, comment says.. what's so 'oho' about it?
+ pc-=s.m_Operand+1;
+ here=pc;
+ }
+ break;
+ case CSop::opQuest0:
+ // two branches, both forward..
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ break;
+ case CSop::opQuest1:
+ // just an empty.. aren't we tired of justanempties?
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ break;
+ case CSop::opLeftParen: // they say it's not significan there..
+ case CSop::opRightParen:
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ break;
+ case CSop::opChoice0: // mark the first two branches..
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ ASSERT(m_Strip[pc+s.m_Operand].m_Operator==CSop::opOr1);
+ m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ break;
+ case CSop::opOr0: // done a branch, find the end of choice..
+ if(m_Strip[here].m_MatchData&maskAfter){
+ for(look=1;(s=m_Strip[pc+look]).m_Operator!=CSop::opChoice1;look+=s.m_Operand)
+ ASSERT(s.m_Operator==CSop::opOr1);
+ m_Strip[here+look].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ }
+ break;
+ case CSop::opOr1: // Propagate Choice's marking..
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ if(m_Strip[pc+s.m_Operand].m_Operator!=CSop::opChoice1){
+ ASSERT(m_Strip[pc+s.m_Operand].m_Operator==CSop::opOr1);
+ m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ }
+ break;
+ case CSop::opChoice1: // Just empty.. :-)..
+ m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
+ break;
+#ifdef _DEBUG
+ default:
+ ASSERT(FALSE);
+ break;
+#endif
+ }
+ }
+}
+
+void CRegEx::MatchStatesCopy(BYTE dst,BYTE src)
+{
+int stripLen = m_Strip.GetSize();
+ for(int tmp=0;tmp<stripLen;tmp++){
+ // I believe this can be optimized, easily..
+ m_Strip[tmp].m_MatchData&=~dst;
+ m_Strip[tmp].m_MatchData|=(m_Strip[tmp].m_MatchData&src)?dst:0;
+ }
+}
+
+BOOL CRegEx::MatchStatesEqual(BYTE m1,BYTE m2)
+{
+int stripLen = m_Strip.GetSize();
+ for(int tmp=0;tmp<stripLen;tmp++){
+ BYTE mm = m_Strip[tmp].m_MatchData;
+ if(((mm&m1) && (mm&m2)) || !(mm&(m1|m2)))
+ continue;
+ return FALSE;
+ }
+ return TRUE;
+}
+
+LPCTSTR CRegEx::MatchSlow(LPCTSTR begin,LPCTSTR end,int from,int to)
+{
+ MatchStatesClear(CSop::stCurrent);
+ m_Strip[from].m_MatchData|=CSop::stCurrent;
+ MatchStep(from,to,CSop::stCurrent,charNothing,CSop::stCurrent);
+LPCTSTR mp = NULL;
+int c = (m_mBegin==m_mPointer)?charOut:(int)(BYTE)begin[-1];
+LPCTSTR p = begin;
+ for(;;){
+ // next character..
+ int lastc = c;
+ c = (p==m_mEnd)?charOut:(int)*(BYTE*)p;
+ // Now we start to wonder if there is an EOL and/or BOL between lastc and c
+ int flagc = 0;
+ int i = 0;
+ if((lastc=='\n' && m_Flags&regNewLine) || (lastc==charOut && !(m_mFlags&regNotBOL))){
+ flagc = charBOL;
+ i = m_BOLs;
+ }
+ if((c=='\n' && m_Flags&regNewLine) || (c==charOut && !(m_mFlags&regNotEOL))){
+ flagc = (flagc==charBOL)?charBOLEOL:charEOL;
+ i+=m_EOLs;
+ }
+ if(i){
+ for(;i>0;i--)
+ MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent);
+ }
+ // Now we wonder about word boundaries..
+ if((flagc==charBOL || (lastc!=charOut && !isWordableChar(lastc))) && (c!=charOut && isWordableChar(c)))
+ flagc=charBOW;
+ if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c))))
+ flagc=charEOW;
+ if(flagc==charBOW || flagc==charEOW){
+ MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent);
+ }
+ // Are we done we all wonder??
+ if(m_Strip[to].m_MatchData&CSop::stCurrent)
+ mp=p;
+ if(MatchStatesEqual(CSop::stCurrent,CSop::stEmpty) || p==end)
+ break; // Again, we're obliged to note break out. We do.
+ // Sucks.. we have to face this character..
+ MatchStatesCopy(CSop::stTemp,CSop::stCurrent);
+ MatchStatesCopy(CSop::stCurrent,CSop::stEmpty);
+ ASSERT(c!=charOut);
+ MatchStep(from,to,CSop::stTemp,c,CSop::stCurrent);
+ MatchStep(from,to,CSop::stCurrent,charNothing,CSop::stCurrent);
+ p++;
+ }
+ return mp;
+}
+
+LPCTSTR CRegEx::MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to)
+{
+LPCTSTR sp = begin, dp;
+LPCTSTR stp, rest, tail, ssp, oldssp, sep;
+int ssub, esub;
+int es;
+int i;
+ for(int ss=from;ss<to;ss = es){
+ // Identify end of SubRE
+ es = ss;
+ switch(m_Strip[es].m_Operator){
+ case CSop::opPlus0:
+ case CSop::opQuest0:
+ es+=m_Strip[es].m_Operand;
+ break;
+ case CSop::opChoice0:
+ while(m_Strip[es].m_Operator!=CSop::opChoice1)
+ es+=m_Strip[es].m_Operand;
+ break;
+ }
+ es++;
+ // Figure out what it matched
+ switch(m_Strip[ss].m_Operator){
+ case CSop::opEnd:
+ ASSERT(FALSE);
+ break;
+ case CSop::opChar:
+ sp++;
+ break;
+ case CSop::opBOL:
+ case CSop::opEOL:
+ case CSop::opBOW:
+ case CSop::opEOW:
+ break;
+ case CSop::opAny:
+ case CSop::opAnyOf:
+ sp++;
+ break;
+ case CSop::opBackRef0:
+ case CSop::opBackRef1:
+ ASSERT(FALSE);
+ break;
+ // Cases where lenght of match is hard to find..
+ case CSop::opQuest0:
+ stp=end;
+ for(;;){
+ // How long could this one be??
+ rest = MatchSlow(sp,stp,ss,es);
+ ASSERT(rest); // It did match.. It should've..
+ // Could the rest match the rest? (good question)
+ tail = MatchSlow(rest,end,es,to);
+ if(tail==end)
+ break; // yup.
+ // nope, try a shorter match for this one..
+ stp=rest-1;
+ ASSERT(stp>=sp); // It did work.. It should've..
+ }
+ ssub=ss+1;
+ esub=es-1;
+ // Did innards match?
+ if(MatchSlow(sp,rest,ssub,esub)){
+ dp = MatchDissect(sp,rest,ssub,esub);
+ ASSERT(dp==rest);
+ }else // nope..
+ ASSERT(sp==rest);
+ sp = rest;
+ break;
+ case CSop::opPlus0:
+ stp=end;
+ for(;;){
+ // How long could this one be??
+ rest = MatchSlow(sp,stp,ss,es);
+ ASSERT(rest); // It did.. It should've..
+ // Could the rest match the rest?
+ tail = MatchSlow(rest,end,es,to);
+ if(tail==end)
+ break; // yup.
+ // nope..
+ stp=rest-1;
+ ASSERT(stp>=sp); // It should've worked, we believe..
+ }
+ ssub=ss+1;
+ esub=es-1;
+ ssp=sp;
+ oldssp=ssp;
+ for(;;){ // Find last match of innards..
+ sep = MatchSlow(ssp,rest,ssub,esub);
+ if((!sep) || sep==ssp)
+ break; // Failed or matched nothin'
+ oldssp=ssp;
+ ssp=sep;
+ }
+ if(!sep){
+ // Last successfull..
+ sep=ssp;
+ ssp=oldssp;
+ }
+ ASSERT(sep=rest); // Must exhaust substring they say..
+ VERIFY(MatchSlow(ssp,sep,ssub,esub)==rest); // Assert or verify - that is the question..
+ dp = MatchDissect(ssp,sep,ssub,esub);
+ ASSERT(dp==sep);
+ sp=rest;
+ break;
+ case CSop::opChoice0:
+ stp = end;
+ for(;;){
+ // how long..
+ rest = MatchSlow(sp,stp,ss,es);
+ ASSERT(rest);
+ // Could it..
+ tail = MatchSlow(rest,end,es,to);
+ if(tail==end)
+ break; // y
+ // n
+ stp = rest-1;
+ ASSERT(stp>=sp);
+ }
+ ssub=ss+1;
+ esub=ss+m_Strip[ss].m_Operand-1;
+ ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
+ for(;;){ // Find first matching branch..
+ if(MatchSlow(sp,rest,ssub,esub)==rest)
+ break;
+ // this one missed, try next..
+ ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
+ esub++;
+ ASSERT(m_Strip[esub].m_Operator==CSop::opOr1);
+ ssub=esub+1;
+ esub+=m_Strip[esub].m_Operand;
+ if(m_Strip[esub].m_Operator==CSop::opOr1)
+ esub--;
+ else
+ ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1);
+ }
+ dp = MatchDissect(sp,rest,ssub,esub);
+ ASSERT(dp==rest);
+ sp=rest;
+ break;
+ case CSop::opPlus1:
+ case CSop::opQuest1:
+ case CSop::opOr0:
+ case CSop::opOr1:
+ case CSop::opChoice1:
+ ASSERT(FALSE);
+ break;
+ case CSop::opLeftParen:
+ i = m_Strip[ss].m_Operand;
+ ASSERT(0<i && i<=m_Subexps);
+ m_Matches[i].m_Begin=sp-m_mBegin;
+ break;
+ case CSop::opRightParen:
+ i = m_Strip[ss].m_Operand;
+ ASSERT(0<i && i<=m_Subexps);
+ m_Matches[i].m_End=sp-m_mBegin;
+ break;
+#ifdef _DEBUG
+ default: // Uh.. oh..
+ ASSERT(FALSE);
+ break;
+#endif
+ }
+ }
+ ASSERT(sp==end);
+ return sp;
+}
+
+LPCTSTR CRegEx::MatchBackRef(LPCTSTR begin,LPCTSTR end,int from,int to,int level)
+{
+LPCTSTR sp = begin;
+BOOL hard = FALSE;
+ // Get as far as we can as long as it's easy
+ for(int ss=from;!hard && ss<to;ss++){
+ CSop s = m_Strip[ss];
+ switch(s.m_Operator){
+ case CSop::opChar:
+ if(sp==end || *sp++ != s.m_Operand)
+ return NULL;
+ break;
+ case CSop::opAny:
+ if(sp==end)
+ return NULL;
+ sp++; // I'm sure this ++ could be embedded in previous expression..
+ break;
+ case CSop::opAnyOf:
+ if(sp==end || !m_Sets[s.m_Operand].IsIn(*sp++))
+ return NULL;
+ break;
+ case CSop::opBOL:
+ if(!((sp==m_mBegin && !(m_mFlags&regNotBOL)) || (sp<m_mEnd && *(sp-1)=='\n' && (m_Flags&regNewLine))))
+ return NULL;
+ break;
+ case CSop::opEOL:
+ if(!((sp==m_mEnd && !(m_mFlags&regNotEOL)) || (sp<m_mEnd && *sp=='\n' && (m_Flags&regNewLine))))
+ return NULL;
+ break;
+ case CSop::opBOW:
+ if(!(((sp==m_mBegin && !(m_mFlags&regNotBOL)) || (sp<m_mEnd && *(sp-1)=='\n' && (m_Flags&regNewLine)) || (sp>m_mBegin && !isWordableChar(*(sp-1)))) && (sp<m_mEnd && isWordableChar(*sp))))
+ return NULL;
+ break;
+ case CSop::opEOW:
+ if(!(((sp==m_mEnd && !(m_mFlags&regNotEOL)) || (sp<m_mEnd && *sp=='\n' && (m_Flags&regNewLine)) || (sp<m_mEnd && !isWordableChar(*sp))) && (sp>m_mBegin && isWordableChar(*(sp-1)))))
+ return NULL;
+ break;
+ case CSop::opQuest1:
+ break;
+ case CSop::opOr0: // Matches null, but needs to skip
+ ss++;
+ s = m_Strip[ss];
+ do{
+ ASSERT(s.m_Operator==CSop::opOr1);
+ ss+=s.m_Operand;
+ }while((s=m_Strip[ss]).m_Operator!=CSop::opChoice1);
+ // Now we should note that ss++ gets us past the Choice1..
+ break;
+ default:
+ // Have to make a choice..
+ hard=TRUE;
+ break;
+ }
+ }
+ if(!hard){ // That was it..
+ if(sp!=end)
+ return NULL;
+ return sp;
+ }
+ ss--; // Adjust for ther for's final increment..
+ // Hard stuff.. is going on and on..
+CSop s = m_Strip[ss];
+int i, len, offsave;
+int ssub,esub;
+LPCTSTR ssp, dp;
+ switch(s.m_Operator){
+ case CSop::opBackRef0: // The vilest depths they say.. If I only knew what the 'viles' stands for..
+ i = s.m_Operand;
+ ASSERT(0<i && i<=m_Subexps);
+ if(m_Matches[i].m_End<0)
+ return NULL;
+ ASSERT(m_Matches[i].m_Begin>=0);
+ len = m_Matches[i].GetLength();
+ ASSERT((end-m_mBegin)>=len);
+ if(sp>end-len)
+ return NULL; // Not enough left to match..
+ ssp = m_mBegin+m_Matches[i].m_Begin;
+ if(memcmp(sp,ssp,len))
+ return NULL;
+ while(m_Strip[ss]!=CSop(CSop::opBackRef1,i))
+ ss++;
+ return MatchBackRef(sp+len,end,ss+1,to,level-1);
+ break;
+ case CSop::opQuest0: // to null or not they wonder..
+ dp = MatchBackRef(sp,end,ss+1,to,level);
+ if(dp)
+ return dp; // not..
+ return MatchBackRef(sp,end,ss+s.m_Operand+1,to,level-1);
+ break;
+ case CSop::opPlus0:
+ ASSERT(m_mLastPos.GetSize());
+ ASSERT(level+1 <= m_Pluses);
+ m_mLastPos[level+1]=sp;
+ return MatchBackRef(sp,end,ss+1,to,level+1);
+ break;
+ case CSop::opPlus1:
+ if(sp == m_mLastPos[level]) // Last pass matched null
+ return MatchBackRef(sp,end,ss+1,to,level-1);
+ // Try another pass..
+ m_mLastPos[level]=sp;
+ dp = MatchBackRef(sp,end,ss-s.m_Operand+1,to,level);
+ if(dp)
+ return dp;
+ return MatchBackRef(sp,end,ss+1,to,level-1);
+ break;
+ case CSop::opChoice0: // find the right one, ifany
+ ssub = ss+1;
+ esub = ss+s.m_Operand-1;
+ ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
+ for(;;){ // Find first matching branch.
+ dp = MatchBackRef(sp,end,ssub,esub,level);
+ if(dp)
+ return dp;
+ // This one missed, try next one..
+ if(m_Strip[esub].m_Operator==CSop::opChoice1)
+ return NULL; // There is none..
+ esub++;
+ ASSERT(m_Strip[esub].m_Operator==CSop::opOr1);
+ ssub=esub+1;
+ esub+=m_Strip[esub].m_Operand;
+ if(m_Strip[esub].m_Operator==CSop::opOr1)
+ esub--;
+ else
+ ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1);
+ }
+ break;
+ case CSop::opLeftParen: // Must undo assignment if rest fails..
+ i = s.m_Operand;
+ ASSERT(0<i && i<=m_Subexps);
+ offsave = m_Matches[i].m_Begin;
+ m_Matches[i].m_Begin = sp-m_mBegin;
+ dp = MatchBackRef(sp,end,ss+1,to,level);
+ if(dp)
+ return dp;
+ m_Matches[i].m_Begin=offsave;
+ return NULL;
+ break;
+ case CSop::opRightParen: // Must undo assignment if rest fails..
+ i = s.m_Operand;
+ ASSERT(0<i && i<=m_Subexps);
+ offsave = m_Matches[i].m_End;
+ m_Matches[i].m_End = sp-m_mBegin;
+ dp = MatchBackRef(sp,end,ss+1,to,level);
+ if(dp)
+ return dp;
+ m_Matches[i].m_End = offsave;
+ return NULL;
+ break;
+#ifdef _DEBUG
+ default:
+ ASSERT(FALSE);
+ break;
+#endif
+ }
+ ASSERT(FALSE);
+ return NULL; // Anyway - we can never get here..
+}
+
+#ifdef _DEBUG
+void CRegEx::CSop::Dump(CDumpContext& dc)
+{
+ switch(m_Operator){
+ case opEnd:
+ dc << "end";
+ break;
+ case opChar:
+ dc << "char('" << (char)m_Operand << "')";
+ break;
+ case opBOL:
+ dc << "BOL";
+ break;
+ case opEOL:
+ dc << "EOL";
+ break;
+ case opAny:
+ dc << "any";
+ break;
+ case opAnyOf:
+ dc << "anyOf(" << m_Operand << ")";
+ break;
+ case opBackRef0:
+ dc << "[ backref(" << m_Operand << ")";
+ break;
+ case opBackRef1:
+ dc << "] backref(" << m_Operand << ")";
+ break;
+ case opPlus0:
+ dc << "[ + (" << m_Operand << ")";
+ break;
+ case opPlus1:
+ dc << "] + (" << m_Operand << ")";
+ break;
+ case opQuest0:
+ dc << "[ ? (" << m_Operand << ")";
+ break;
+ case opQuest1:
+ dc << "] ? (" << m_Operand << ")";
+ break;
+ case opLeftParen:
+ dc << "[ ( (" << m_Operand << ")";
+ break;
+ case opRightParen:
+ dc << "] ) (" << m_Operand << ")";
+ break;
+ case opChoice0:
+ dc << "[ choice (" << m_Operand << ")";
+ break;
+ case opOr0:
+ dc << "[ | (" << m_Operand << ")";
+ break;
+ case opOr1:
+ dc << "] | (" << m_Operand << ")";
+ break;
+ case opChoice1:
+ dc << "] choice (" << m_Operand << ")";
+ break;
+ case opBOW:
+ dc << "BOW";
+ break;
+ case opEOW:
+ dc << "EOW";
+ break;
+ }
+}
+void CRegEx::DumpStrip(CDumpContext& dc)
+{
+ for(int tmp=0;tmp<m_Strip.GetSize();tmp++)
+ dc << tmp << ": " << m_Strip[tmp] << ";\n";
+}
+#endif
+
+
+CString CRegEx::GetMatch(int match)
+{
+CString rv;
+ if(!m_Matches.GetSize())
+ return rv;
+ ASSERT(m_Matches[0].m_Begin<m_Input.GetLength() && m_Matches[0].m_End<=m_Input.GetLength());
+ if(match==matchPreMatch)
+ return m_Input.Left(m_Matches[0].m_Begin);
+ if(match==matchPostMatch)
+ return m_Input.Mid(m_Matches[0].m_End);
+ if(match<0 || match >= m_Matches.GetSize())
+ return rv;
+ if(m_Matches[match].m_Begin<0 || m_Matches[match].m_End<0)
+ return rv;
+ ASSERT(m_Matches[match].m_Begin<m_Input.GetLength() && m_Matches[match].m_End<=m_Input.GetLength());
+ rv = m_Input.Mid(m_Matches[match].m_Begin,m_Matches[match].m_End-m_Matches[match].m_Begin);
+ return rv;
+}
diff --git a/shared-code/RegEx.h b/shared-code/RegEx.h
new file mode 100644
index 0000000..2534768
--- a/dev/null
+++ b/shared-code/RegEx.h
@@ -0,0 +1,158 @@
+#ifndef __REGEX_H
+#define __REGEX_H
+
+class CRegEx {
+public:
+ CString GetMatch(int match=0);
+ CString m_Input;
+ struct CMatch {
+ CMatch() : m_Begin(-1), m_End(-1) {}
+ int GetLength() { return m_End-m_Begin; }
+ int m_Begin;
+ int m_End;
+ };
+ typedef CArray<CMatch,CMatch&> CMatchBox;
+ enum {
+ matchMatch = 0,
+ matchPreMatch = -1,
+ matchPostMatch = -2
+ };
+ CMatchBox m_Matches;
+ enum {
+ charOut = 256,
+ charBOL, charEOL, charBOLEOL, charNothing, charBOW, charEOW,
+ charMaxCode = charEOW,
+ charNNChars = (charMaxCode-255)
+ };
+ int m_mFlags;
+ enum {
+ regeSuccess = 0,
+ regeNoMatch = 1, regeBadPattern, regeCollate, regeCType, regeEscape, regeSubReg, regeBracket,
+ regeParen, regeBrace, regeBadBrace, regeRange, regeSpace, regeBadRepeat, regeEmpty, regeAssert,
+ regeInvArg
+ };
+ int m_Error;
+ CRegEx();
+ BOOL m_bCompiled;
+ CString m_Pattern;
+ BOOL m_bBackRefs;
+ int m_Pluses;
+ CString m_Must;
+ BYTE m_Category[CHAR_MAX-CHAR_MIN+1];
+ int m_Categories;
+ int m_EOLs;
+ int m_BOLs;
+ int m_iFlags;
+ int m_Subexps;
+ struct CSop {
+ void Dump(CDumpContext& dc);
+ CSop() {}
+ CSop(BYTE op,DWORD opnd=0) : m_Operator(op), m_Operand(opnd) {}
+ BOOL operator==(CSop& other) {return m_Operator==other.m_Operator && m_Operand==other.m_Operand;}
+ BOOL operator!=(CSop& other) { return !((*this)==other);}
+ enum {
+ opEnd = 1, opChar, opBOL, opEOL, opAny, opAnyOf, opBackRef0, opBackRef1,
+ opPlus0, opPlus1, opQuest0, opQuest1, opLeftParen, opRightParen, opChoice0,
+ opOr0, opOr1, opChoice1, opBOW, opEOW
+ };
+ BYTE m_Operator;
+ DWORD m_Operand;
+ enum {
+ stCurrent = 1, stFresh = 2, stTemp = 4, stEmpty = 8
+ };
+ BYTE m_MatchData;
+ };
+ typedef CArray<CSop,CSop&> CStrip;
+ CStrip m_Strip;
+ int m_Flags;
+ struct CSet {
+ CSet() : m_Hash(0) { memset(m_Set,0,sizeof(m_Set)); }
+ CSet(CSet& src) { (*this)=src; }
+ CSet& operator=(CSet& src) { memmove(this,&src,sizeof(*this)); return *this; }
+ BOOL operator==(CSet& other) { if(m_Hash!=other.m_Hash)return FALSE;return !memcmp(m_Set,other.m_Set,sizeof(m_Set)); }
+ enum {
+ size = (CHAR_MAX-CHAR_MIN+1)
+ };
+ BOOL m_Set[size];
+ BYTE m_Hash;
+ public:
+ UCHAR GetOnly();
+ void Sub(UCHAR c);
+ BOOL IsIn(UCHAR c);
+ void Add(UCHAR c);
+ };
+ typedef CArray<CSet,CSet&> CSets;
+ CSets m_Sets;
+ enum {
+ // Compile flags
+ regBasic = 0, regExtended = 1,
+ regIgnoreCase = 2,
+ regNoSubExpressions = 4, // Also works for matching.
+ regNewLine = 16,
+ regLiteral = 32,
+ // Match Flags
+ regNotBOL = 1,
+ regNotEOL = 2,
+ regOneMatch=64,
+ regBackRefs=128,
+ // iFlags
+ iflagsUseBOL=1, iflagsUseEOL=2, iflagsBad=4
+ };
+ CString Replace(LPCTSTR src,LPCTSTR rep,int flags=0);
+ BOOL Match(LPCTSTR src,int flags=0);
+ BOOL Compile(LPCTSTR regex,int flags=0);
+private:
+#ifdef _DEBUG
+ void DumpStrip(CDumpContext& dc);
+#endif
+ LPCTSTR MatchBackRef(LPCTSTR begin,LPCTSTR end,int from,int to,int level);
+ typedef CArray<LPCTSTR,LPCTSTR> CStrPtrArray;
+ CStrPtrArray m_mLastPos;
+ LPCTSTR MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to);
+ LPCTSTR MatchSlow(LPCTSTR begin,LPCTSTR end,int from,int to);
+ LPCTSTR m_cOldP;
+ BOOL MatchStatesEqual(BYTE m1,BYTE m2);
+ LPCTSTR m_mBegin;
+ void MatchStatesCopy(BYTE dst,BYTE src);
+ void MatchStep(int from,int to,BYTE maskBefore,int charCode,BYTE maskAfter);
+ void MatchStatesClear(BYTE mask);
+ LPCTSTR MatchFast(LPCTSTR begin);
+ LPCTSTR m_mEnd;
+ LPCTSTR m_mPointer;
+ BOOL ParseBREexp(BOOL ordinaryStar);
+ void ParseBRE(int stopa=0,int stopb=0);
+ void ParseLiteral();
+ int CountPluses();
+ void FigureMust();
+ BOOL IsInSameSets(UCHAR c1,UCHAR c2);
+ BOOL IsInSets(UCHAR c);
+ void Categorize();
+ int StripDuplicate(int from,int to);
+ void EmitRepeat(int pos,int from,int to);
+ UCHAR ParseBracketSymbol();
+ UCHAR ParseBracketCollatingElement(UCHAR term);
+ void ParseBracketEClass(CSet& cset);
+ void ParseBracketCClass(CSet& cset);
+ void ParseBracketTerm(CSet& cset);
+ int StoreSet(CSet& cset);
+ void ParseBracket();
+ int ParseCount();
+ void EmitNonNewLineAny();
+ void EmitOrdinary(UCHAR c);
+ void StripInsert(int pos,CSop& sop);
+ void ParseEREexp();
+ void ParseERE(int stop=0);
+ struct CParenthesis {
+ long m_Begin;
+ long m_End;
+ CParenthesis(long b=0,long e=0) : m_Begin(b), m_End(e) {}
+ };
+ typedef CArray<CParenthesis,CParenthesis&> CParens;
+ CParens m_ParseParens;
+ int m_ParsePointer;
+};
+#ifdef _DEBUG
+inline CDumpContext& operator<<(CDumpContext& dc, CRegEx::CSop& sop) { sop.Dump(dc); return dc; }
+#endif
+
+#endif // __REGEX_H \ No newline at end of file
diff --git a/shared-code/SNMPExtDll.h b/shared-code/SNMPExtDll.h
new file mode 100644
index 0000000..14c920d
--- a/dev/null
+++ b/shared-code/SNMPExtDll.h
@@ -0,0 +1,252 @@
+#ifndef __SNMPEXTDLL_H
+#define __SNMPEXTDLL_H
+
+#include "snmpeer.h"
+
+#include <snmp.h>
+
+namespace Klever {
+
+class CSNMPExtDLL : public CSNMPeer {
+public:
+ HINSTANCE m_hInstance;
+ HANDLE m_hEvent;
+ AsnObjectIdentifier m_OID;
+ BOOL (SNMP_FUNC_TYPE *m_extInit)(DWORD dw,HANDLE h,AsnObjectIdentifier* aoid);
+ BOOL (SNMP_FUNC_TYPE *m_extQuery)(BYTE b,RFC1157VarBindList* rvbl,AsnInteger* ai1,AsnInteger* ai2);
+ BOOL (SNMP_FUNC_TYPE *m_extTrap)(AsnObjectIdentifier*,AsnNetworkAddress*,AsnInteger*,AsnInteger*,AsnTimeticks*,RFC1157VarBindList*);
+
+ HINSTANCE m_hSNMPAPI;
+ void (SNMP_FUNC_TYPE *m_snmpOIDFree)(AsnObjectIdentifier*);
+ LPVOID (SNMP_FUNC_TYPE *m_snmpAlloc)(UINT);
+ void (SNMP_FUNC_TYPE *m_snmpFree)(LPVOID);
+ void (SNMP_FUNC_TYPE *m_snmpVBLFree)(RFC1157VarBindList* vbl);
+ void InitSNMP() {
+ m_hSNMPAPI = ::LoadLibraryEx("SNMPAPI",NULL,0);
+ if(!m_hSNMPAPI)
+ return;
+ *(FARPROC*)&m_snmpOIDFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilOidFree");
+ *(FARPROC*)&m_snmpAlloc = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemAlloc");
+ *(FARPROC*)&m_snmpFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemFree");
+ *(FARPROC*)&m_snmpVBLFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilVarBindListFree");
+ if(
+ (m_snmpFree && !m_snmpAlloc) ||
+ (m_snmpAlloc && !m_snmpFree)
+ )
+ DeinitSNMP();
+ }
+ void DeinitSNMP() {
+ if(!m_hSNMPAPI)
+ return;
+ ::FreeLibrary(m_hSNMPAPI);
+ m_hSNMPAPI=NULL;
+ }
+ void SNMPFreeOID(AsnObjectIdentifier* oid) {
+ if(m_hSNMPAPI && m_snmpOIDFree)
+ (*m_snmpOIDFree)(oid);
+ else
+ ::GlobalFree((HGLOBAL)oid->ids);
+ }
+ LPVOID SNMPAlloc(UINT size) {
+ if(m_hSNMPAPI && m_snmpAlloc)
+ return (*m_snmpAlloc)(size);
+ else
+ return ::GlobalAlloc(GMEM_FIXED,size);
+ }
+ void SNMPFree(LPVOID addr) {
+ if(m_hSNMPAPI && m_snmpFree)
+ (*m_snmpFree)(addr);
+ else
+ :: GlobalFree((HGLOBAL)addr);
+ }
+ void SNMPFreeVBL(RFC1157VarBindList& vbl) {
+ if(m_hSNMPAPI && m_snmpVBLFree)
+ (*m_snmpVBLFree)(&vbl);
+ else{
+ for(UINT tmp=0;tmp<vbl.len;tmp++) {
+ SNMPFree(vbl.list[tmp].name.ids);
+ switch(vbl.list[tmp].value.asnType){
+ case ASN_OCTETSTRING:
+ case ASN_SEQUENCE:
+ case ASN_RFC1155_IPADDRESS:
+ case ASN_RFC1155_OPAQUE:
+// case ASN_RFC1213_DISPSTRING:
+ if(vbl.list[tmp].value.asnValue.arbitrary.dynamic)
+ SNMPFree(vbl.list[tmp].value.asnValue.arbitrary.stream);
+ break;
+ case ASN_OBJECTIDENTIFIER:
+ SNMPFree(vbl.list[tmp].value.asnValue.object.ids);
+ break;
+ default:
+ break;
+ }
+ }
+ SNMPFree(vbl.list);
+ }
+ }
+
+ BOOL SNMPBuildVBL(RFC1157VarBindList& vbl,CSNMPVarBindList& in) {
+ vbl.len = in.GetCount();
+ vbl.list = (RFC1157VarBind*)SNMPAlloc(sizeof(RFC1157VarBind)*vbl.len);
+ POSITION p = in.GetHeadPosition();
+ UINT ptr = 0;
+ while(p){
+ CSNMPVarBind& vb = in.GetNext(p);
+ ASSERT(ptr<vbl.len);
+ SNMPBuildVB(vbl.list[ptr++],vb);
+ }
+ return TRUE;
+ }
+ BOOL SNMPBuildVB(RFC1157VarBind& vb,CSNMPVarBind& in) {
+ ASSERT(in.name.type==CASNAny::typeASNOID);
+ return SNMPBuildOID(vb.name,in.name.value.oid) && SNMPBuildAA(vb.value,in.value);
+ }
+ BOOL SNMPBuildAA(AsnAny& aa,CASNAny& in) {
+ aa.asnType=in.type;
+ switch(in.type) {
+ case CASNAny::typeASNInteger:
+ aa.asnValue.number=in.value.number; break;
+ case CASNAny::typeASNOctetString:
+// case CASNAny::typeASNDispString:
+ SNMPBuildOS(aa.asnValue.string,in.value.string); break;
+ case CASNAny::typeASNNull:
+ break;
+ case CASNAny::typeASNOID:
+ SNMPBuildOID(aa.asnValue.object,in.value.oid); break;
+ case CASNAny::typeASNSequence:
+// case CASNAny::typeASNSequenceOf:
+ SNMPBuildOS(aa.asnValue.sequence,in.value.sequence); break;
+ case CASNAny::typeASNIP:
+ SNMPBuildFLOS(aa.asnValue.address,(LPBYTE)&in.value.ip,sizeof(in.value.ip)); break;
+ case CASNAny::typeASNCounter:
+ aa.asnValue.counter = in.value.counter; break;
+ case CASNAny::typeASNGauge:
+ aa.asnValue.gauge = in.value.gauge; break;
+ case CASNAny::typeASNTicks:
+ aa.asnValue.ticks = in.value.ticks; break;
+ case CASNAny::typeASNOpaque:
+ ASSERT(in.storeType==CASNAny::storeDynamic);
+ SNMPBuildOS(aa.asnValue.arbitrary,in.value.data); break;
+ break;
+ default:
+ ASSERT(FALSE);
+ return FALSE;
+ }
+ return TRUE;
+ }
+ BOOL SNMPBuildOS(AsnOctetString& os,CASNAny::asnOctetString& in) {
+ return SNMPBuildFLOS(os,in.data,in.size);
+ }
+ BOOL SNMPBuildOID(AsnObjectIdentifier& oid,CASNAny::asnOID& in) {
+ oid.idLength = in.size/sizeof(UINT);
+ ASSERT(!(in.size%sizeof(UINT)));
+ VERIFY(oid.ids = (UINT*)SNMPAlloc(in.size));
+ memmove(oid.ids,in.data,in.size);
+ return TRUE;
+ }
+ BOOL SNMPBuildFLOS(AsnOctetString& os,LPBYTE data,UINT size) {
+ os.length = size;
+ VERIFY(os.stream = (BYTE*)SNMPAlloc(os.length));
+ os.dynamic=TRUE;
+ memmove(os.stream,data,size);
+ return TRUE;
+ }
+ BOOL SNMPParseVBL(RFC1157VarBindList& vbl,CSNMPVarBindList& ou) {
+ for(UINT tmp=0;tmp<vbl.len;tmp++){
+ CSNMPVarBind vb;
+ SNMPParseVB(vbl.list[tmp],vb);
+ ou.AddTail(vb);
+ }
+ return TRUE;
+ }
+ BOOL SNMPParseVB(RFC1157VarBind& vb,CSNMPVarBind& ou) {
+ ou.name.Set(CASNAny::typeASNOID,(LPBYTE)vb.name.ids,vb.name.idLength*sizeof(UINT));
+ return SNMPParseAA(vb.value,ou.value);
+ }
+ BOOL SNMPParseAA(AsnAny& aa,CASNAny& ou) {
+ switch(aa.asnType){
+ case ASN_INTEGER:
+ ou.Set(CASNAny::typeASNInteger,aa.asnValue.number); break;
+ case ASN_OCTETSTRING:
+// case ASN_RFC1213_DISPSTRING:
+ ou.Set(CASNAny::typeASNOctetString,aa.asnValue.string.stream,aa.asnValue.string.length); break;
+ case ASN_OBJECTIDENTIFIER:
+ ou.Set(CASNAny::typeASNOID,(LPBYTE)aa.asnValue.object.ids,aa.asnValue.object.idLength);
+ SNMPParseOID(aa.asnValue.object,ou.value.oid); break;
+ case ASN_SEQUENCE:
+ ou.Set(CASNAny::typeASNSequence,aa.asnValue.sequence.stream,aa.asnValue.sequence.length); break;
+ case ASN_RFC1155_IPADDRESS:
+ SNMPParseIP(aa.asnValue.address,ou); break;
+ case ASN_RFC1155_COUNTER:
+ ou.Set(CASNAny::typeASNCounter,(LONG)aa.asnValue.counter); break;
+ case ASN_RFC1155_GAUGE:
+ ou.Set(CASNAny::typeASNGauge,(LONG)aa.asnValue.gauge); break;
+ case ASN_RFC1155_TIMETICKS:
+ ou.Set(CASNAny::typeASNTicks,(LONG)aa.asnValue.ticks); break;
+ case ASN_RFC1155_OPAQUE:
+ ou.Set(CASNAny::typeASNOpaque,aa.asnValue.arbitrary.stream,aa.asnValue.arbitrary.length); break;
+ case ASN_NULL:
+ ou.Free(); break;
+ default:
+ ASSERT(FALSE);
+ return FALSE;
+ }
+ return TRUE;
+ }
+ BOOL SNMPParseOID(AsnObjectIdentifier& oid,CASNAny::asnOID& ou) {
+ ASSERT(ou.size==(oid.idLength*sizeof(UINT)));
+ memmove(ou.data,oid.ids,ou.size);
+ return TRUE;
+ }
+ BOOL SNMPParseIP(AsnIPAddress& ip,CASNAny& ou) {
+ in_addr i;
+ if(ip.length>sizeof(i))
+ return FALSE;
+ i.s_addr=0;
+ memmove(&i,ip.stream,ip.length);
+ ou.Set(i);
+ return TRUE;
+ }
+
+
+ CSNMPExtDLL(LPCTSTR dllName) : m_hInstance(NULL) { InitSNMP(); Init(dllName); }
+ ~CSNMPExtDLL() { Deinit(); DeinitSNMP(); }
+
+ BOOL Init(LPCTSTR dllName) {
+ Deinit();
+ m_hInstance = ::LoadLibraryEx(dllName,NULL,0);
+ if(!m_hInstance)
+ return FALSE;
+ *(FARPROC*)&m_extInit = ::GetProcAddress(m_hInstance,"SnmpExtensionInit");
+ *(FARPROC*)&m_extQuery = ::GetProcAddress(m_hInstance,"SnmpExtensionQuery");
+ *(FARPROC*)&m_extTrap = ::GetProcAddress(m_hInstance,"SnmpExtensionTrap");
+ if(!(m_extInit && m_extQuery && m_extTrap)){
+ Deinit();
+ return FALSE;
+ }
+ if(!((*m_extInit)(GetCurrentTime(),&m_hEvent,&m_OID))){
+ Deinit();
+ return FALSE;
+ }
+ return TRUE;
+ }
+ void Deinit() {
+ if(!m_hInstance)
+ return;
+ ::FreeLibrary(m_hInstance);
+ }
+ virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) {
+ RFC1157VarBindList vbl;
+ SNMPBuildVBL(vbl,in);
+ AsnInteger errorStatus, errorIndex;
+ (*m_extQuery)(type,&vbl,&errorStatus,&errorIndex);
+ ou.RemoveAll();
+ SNMPParseVBL(vbl,ou);
+ SNMPFreeVBL(vbl);
+ return TRUE;
+ }
+};
+
+};
+
+#endif // __SNMPEXTDLL_H
diff --git a/shared-code/SNMPOIDs.h b/shared-code/SNMPOIDs.h
new file mode 100644
index 0000000..68ee659
--- a/dev/null
+++ b/shared-code/SNMPOIDs.h
@@ -0,0 +1,221 @@
+#ifndef __SNMPOIDS_H
+#define __SNMPOIDS_H
+
+#define DEFINE_OID(name,oid) static UINT name[] = oid
+
+// MIB-II OIDs
+
+#define OIDccitt {0}
+#define OIDnull {0,0}
+#define OIDiso {1}
+#define OIDorg {1,3}
+#define OIDdod {1,3,6}
+#define OIDinternet {1,3,6,1}
+#define OIDdirectory {1,3,6,1,1}
+#define OIDmgmt {1,3,6,1,2}
+#define OIDmib_2 {1,3,6,1,2,1}
+#define OIDsystem {1,3,6,1,2,1,1}
+#define OIDsysDescr {1,3,6,1,2,1,1,1}
+#define OIDsysObjectID {1,3,6,1,2,1,1,2}
+#define OIDsysUpTime {1,3,6,1,2,1,1,3}
+#define OIDsysContact {1,3,6,1,2,1,1,4}
+#define OIDsysName {1,3,6,1,2,1,1,5}
+#define OIDsysLocation {1,3,6,1,2,1,1,6}
+#define OIDsysServices {1,3,6,1,2,1,1,7}
+#define OIDtransmission {1,3,6,1,2,1,10}
+#define OIDsnmp {1,3,6,1,2,1,11}
+#define OIDsnmpInPkts {1,3,6,1,2,1,11,1}
+#define OIDsnmpInBadValues {1,3,6,1,2,1,11,10}
+#define OIDsnmpInReadOnlys {1,3,6,1,2,1,11,11}
+#define OIDsnmpInGenErrs {1,3,6,1,2,1,11,12}
+#define OIDsnmpInTotalReqVars {1,3,6,1,2,1,11,13}
+#define OIDsnmpInTotalSetVars {1,3,6,1,2,1,11,14}
+#define OIDsnmpInGetRequests {1,3,6,1,2,1,11,15}
+#define OIDsnmpInGetNexts {1,3,6,1,2,1,11,16}
+#define OIDsnmpInSetRequests {1,3,6,1,2,1,11,17}
+#define OIDsnmpInGetResponses {1,3,6,1,2,1,11,18}
+#define OIDsnmpInTraps {1,3,6,1,2,1,11,19}
+#define OIDsnmpOutPkts {1,3,6,1,2,1,11,2}
+#define OIDsnmpOutTooBigs {1,3,6,1,2,1,11,20}
+#define OIDsnmpOutNoSuchNames {1,3,6,1,2,1,11,21}
+#define OIDsnmpOutBadValues {1,3,6,1,2,1,11,22}
+#define OIDsnmpOutGenErrs {1,3,6,1,2,1,11,24}
+#define OIDsnmpOutGetRequests {1,3,6,1,2,1,11,25}
+#define OIDsnmpOutGetNexts {1,3,6,1,2,1,11,26}
+#define OIDsnmpOutSetRequests {1,3,6,1,2,1,11,27}
+#define OIDsnmpOutGetResponses {1,3,6,1,2,1,11,28}
+#define OIDsnmpOutTraps {1,3,6,1,2,1,11,29}
+#define OIDsnmpInBadVersions {1,3,6,1,2,1,11,3}
+#define OIDsnmpEnableAuthenTraps {1,3,6,1,2,1,11,30}
+#define OIDsnmpInBadCommunityNames {1,3,6,1,2,1,11,4}
+#define OIDsnmpInBadCommunityUses {1,3,6,1,2,1,11,5}
+#define OIDsnmpInASNParseErrs {1,3,6,1,2,1,11,6}
+#define OIDsnmpInTooBigs {1,3,6,1,2,1,11,8}
+#define OIDsnmpInNoSuchNames {1,3,6,1,2,1,11,9}
+#define OIDinterfaces {1,3,6,1,2,1,2}
+#define OIDifNumber {1,3,6,1,2,1,2,1}
+#define OIDifTable {1,3,6,1,2,1,2,2}
+#define OIDifEntry {1,3,6,1,2,1,2,2,1}
+#define OIDifIndex {1,3,6,1,2,1,2,2,1,1}
+#define OIDifInOctets {1,3,6,1,2,1,2,2,1,10}
+#define OIDifInUcastPkts {1,3,6,1,2,1,2,2,1,11}
+#define OIDifInNUcastPkts {1,3,6,1,2,1,2,2,1,12}
+#define OIDifInDiscards {1,3,6,1,2,1,2,2,1,13}
+#define OIDifInErrors {1,3,6,1,2,1,2,2,1,14}
+#define OIDifInUnknownProtos {1,3,6,1,2,1,2,2,1,15}
+#define OIDifOutOctets {1,3,6,1,2,1,2,2,1,16}
+#define OIDifOutUcastPkts {1,3,6,1,2,1,2,2,1,17}
+#define OIDifOutNUcastPkts {1,3,6,1,2,1,2,2,1,18}
+#define OIDifOutDiscards {1,3,6,1,2,1,2,2,1,19}
+#define OIDifDescr {1,3,6,1,2,1,2,2,1,2}
+#define OIDifOutErrors {1,3,6,1,2,1,2,2,1,20}
+#define OIDifOutQLen {1,3,6,1,2,1,2,2,1,21}
+#define OIDifSpecific {1,3,6,1,2,1,2,2,1,22}
+#define OIDifType {1,3,6,1,2,1,2,2,1,3}
+#define OIDifMtu {1,3,6,1,2,1,2,2,1,4}
+#define OIDifSpeed {1,3,6,1,2,1,2,2,1,5}
+#define OIDifPhysAddress {1,3,6,1,2,1,2,2,1,6}
+#define OIDifAdminStatus {1,3,6,1,2,1,2,2,1,7}
+#define OIDifOperStatus {1,3,6,1,2,1,2,2,1,8}
+#define OIDifLastChange {1,3,6,1,2,1,2,2,1,9}
+#define OIDat {1,3,6,1,2,1,3}
+#define OIDatTable {1,3,6,1,2,1,3,1}
+#define OIDatEntry {1,3,6,1,2,1,3,1,1}
+#define OIDatIfIndex {1,3,6,1,2,1,3,1,1,1}
+#define OIDatPhysAddress {1,3,6,1,2,1,3,1,1,2}
+#define OIDatNetAddress {1,3,6,1,2,1,3,1,1,3}
+#define OIDip {1,3,6,1,2,1,4}
+#define OIDipForwarding {1,3,6,1,2,1,4,1}
+#define OIDipOutRequests {1,3,6,1,2,1,4,10}
+#define OIDipOutDiscards {1,3,6,1,2,1,4,11}
+#define OIDipOutNoRoutes {1,3,6,1,2,1,4,12}
+#define OIDipReasmTimeout {1,3,6,1,2,1,4,13}
+#define OIDipReasmReqds {1,3,6,1,2,1,4,14}
+#define OIDipReasmOKs {1,3,6,1,2,1,4,15}
+#define OIDipReasmFails {1,3,6,1,2,1,4,16}
+#define OIDipFragOKs {1,3,6,1,2,1,4,17}
+#define OIDipFragFails {1,3,6,1,2,1,4,18}
+#define OIDipFragCreates {1,3,6,1,2,1,4,19}
+#define OIDipDefaultTTL {1,3,6,1,2,1,4,2}
+#define OIDipAddrTable {1,3,6,1,2,1,4,20}
+#define OIDipAddrEntry {1,3,6,1,2,1,4,20,1}
+#define OIDipAdEntAddr {1,3,6,1,2,1,4,20,1,1}
+#define OIDipAdEntIfIndex {1,3,6,1,2,1,4,20,1,2}
+#define OIDipAdEntNetMask {1,3,6,1,2,1,4,20,1,3}
+#define OIDipAdEntBcastAddr {1,3,6,1,2,1,4,20,1,4}
+#define OIDipAdEntReasmMaxSize {1,3,6,1,2,1,4,20,1,5}
+#define OIDipRouteTable {1,3,6,1,2,1,4,21}
+#define OIDipRouteEntry {1,3,6,1,2,1,4,21,1}
+#define OIDipRouteDest {1,3,6,1,2,1,4,21,1,1}
+#define OIDipRouteAge {1,3,6,1,2,1,4,21,1,10}
+#define OIDipRouteMask {1,3,6,1,2,1,4,21,1,11}
+#define OIDipRouteMetric5 {1,3,6,1,2,1,4,21,1,12}
+#define OIDipRouteInfo {1,3,6,1,2,1,4,21,1,13}
+#define OIDipRouteIfIndex {1,3,6,1,2,1,4,21,1,2}
+#define OIDipRouteMetric1 {1,3,6,1,2,1,4,21,1,3}
+#define OIDipRouteMetric2 {1,3,6,1,2,1,4,21,1,4}
+#define OIDipRouteMetric3 {1,3,6,1,2,1,4,21,1,5}
+#define OIDipRouteMetric4 {1,3,6,1,2,1,4,21,1,6}
+#define OIDipRouteNextHop {1,3,6,1,2,1,4,21,1,7}
+#define OIDipRouteType {1,3,6,1,2,1,4,21,1,8}
+#define OIDipRouteProto {1,3,6,1,2,1,4,21,1,9}
+#define OIDipNetToMediaTable {1,3,6,1,2,1,4,22}
+#define OIDipNetToMediaEntry {1,3,6,1,2,1,4,22,1}
+#define OIDipNetToMediaIfIndex {1,3,6,1,2,1,4,22,1,1}
+#define OIDipNetToMediaPhysAddress {1,3,6,1,2,1,4,22,1,2}
+#define OIDipNetToMediaNetAddress {1,3,6,1,2,1,4,22,1,3}
+#define OIDipNetToMediaType {1,3,6,1,2,1,4,22,1,4}
+#define OIDipRoutingDiscards {1,3,6,1,2,1,4,23}
+#define OIDipInReceives {1,3,6,1,2,1,4,3}
+#define OIDipInHdrErrors {1,3,6,1,2,1,4,4}
+#define OIDipInAddrErrors {1,3,6,1,2,1,4,5}
+#define OIDipForwDatagrams {1,3,6,1,2,1,4,6}
+#define OIDipInUnknownProtos {1,3,6,1,2,1,4,7}
+#define OIDipInDiscards {1,3,6,1,2,1,4,8}
+#define OIDipInDelivers {1,3,6,1,2,1,4,9}
+#define OIDicmp {1,3,6,1,2,1,5}
+#define OIDicmpInMsgs {1,3,6,1,2,1,5,1}
+#define OIDicmpInTimestamps {1,3,6,1,2,1,5,10}
+#define OIDicmpInTimestampReps {1,3,6,1,2,1,5,11}
+#define OIDicmpInAddrMasks {1,3,6,1,2,1,5,12}
+#define OIDicmpInAddrMaskReps {1,3,6,1,2,1,5,13}
+#define OIDicmpOutMsgs {1,3,6,1,2,1,5,14}
+#define OIDicmpOutErrors {1,3,6,1,2,1,5,15}
+#define OIDicmpOutDestUnreachs {1,3,6,1,2,1,5,16}
+#define OIDicmpOutTimeExcds {1,3,6,1,2,1,5,17}
+#define OIDicmpOutParmProbs {1,3,6,1,2,1,5,18}
+#define OIDicmpOutSrcQuenchs {1,3,6,1,2,1,5,19}
+#define OIDicmpInErrors {1,3,6,1,2,1,5,2}
+#define OIDicmpOutRedirects {1,3,6,1,2,1,5,20}
+#define OIDicmpOutEchos {1,3,6,1,2,1,5,21}
+#define OIDicmpOutEchoReps {1,3,6,1,2,1,5,22}
+#define OIDicmpOutTimestamps {1,3,6,1,2,1,5,23}
+#define OIDicmpOutTimestampReps {1,3,6,1,2,1,5,24}
+#define OIDicmpOutAddrMasks {1,3,6,1,2,1,5,25}
+#define OIDicmpOutAddrMaskReps {1,3,6,1,2,1,5,26}
+#define OIDicmpInDestUnreachs {1,3,6,1,2,1,5,3}
+#define OIDicmpInTimeExcds {1,3,6,1,2,1,5,4}
+#define OIDicmpInParmProbs {1,3,6,1,2,1,5,5}
+#define OIDicmpInSrcQuenchs {1,3,6,1,2,1,5,6}
+#define OIDicmpInRedirects {1,3,6,1,2,1,5,7}
+#define OIDicmpInEchos {1,3,6,1,2,1,5,8}
+#define OIDicmpInEchoReps {1,3,6,1,2,1,5,9}
+#define OIDtcp {1,3,6,1,2,1,6}
+#define OIDtcpRtoAlgorithm {1,3,6,1,2,1,6,1}
+#define OIDtcpInSegs {1,3,6,1,2,1,6,10}
+#define OIDtcpOutSegs {1,3,6,1,2,1,6,11}
+#define OIDtcpRetransSegs {1,3,6,1,2,1,6,12}
+#define OIDtcpConnTable {1,3,6,1,2,1,6,13}
+#define OIDtcpConnEntry {1,3,6,1,2,1,6,13,1}
+#define OIDtcpConnState {1,3,6,1,2,1,6,13,1,1}
+#define OIDtcpConnLocalAddress {1,3,6,1,2,1,6,13,1,2}
+#define OIDtcpConnLocalPort {1,3,6,1,2,1,6,13,1,3}
+#define OIDtcpConnRemAddress {1,3,6,1,2,1,6,13,1,4}
+#define OIDtcpConnRemPort {1,3,6,1,2,1,6,13,1,5}
+#define OIDtcpInErrs {1,3,6,1,2,1,6,14}
+#define OIDtcpOutRsts {1,3,6,1,2,1,6,15}
+#define OIDtcpRtoMin {1,3,6,1,2,1,6,2}
+#define OIDtcpRtoMax {1,3,6,1,2,1,6,3}
+#define OIDtcpMaxConn {1,3,6,1,2,1,6,4}
+#define OIDtcpActiveOpens {1,3,6,1,2,1,6,5}
+#define OIDtcpPassiveOpens {1,3,6,1,2,1,6,6}
+#define OIDtcpAttemptFails {1,3,6,1,2,1,6,7}
+#define OIDtcpEstabResets {1,3,6,1,2,1,6,8}
+#define OIDtcpCurrEstab {1,3,6,1,2,1,6,9}
+#define OIDudp {1,3,6,1,2,1,7}
+#define OIDudpInDatagrams {1,3,6,1,2,1,7,1}
+#define OIDudpNoPorts {1,3,6,1,2,1,7,2}
+#define OIDudpInErrors {1,3,6,1,2,1,7,3}
+#define OIDudpOutDatagrams {1,3,6,1,2,1,7,4}
+#define OIDudpTable {1,3,6,1,2,1,7,5}
+#define OIDudpEntry {1,3,6,1,2,1,7,5,1}
+#define OIDudpLocalAddress {1,3,6,1,2,1,7,5,1,1}
+#define OIDudpLocalPort {1,3,6,1,2,1,7,5,1,2}
+#define OIDegp {1,3,6,1,2,1,8}
+#define OIDegpInMsgs {1,3,6,1,2,1,8,1}
+#define OIDegpInErrors {1,3,6,1,2,1,8,2}
+#define OIDegpOutMsgs {1,3,6,1,2,1,8,3}
+#define OIDegpOutErrors {1,3,6,1,2,1,8,4}
+#define OIDegpNeighTable {1,3,6,1,2,1,8,5}
+#define OIDegpNeighEntry {1,3,6,1,2,1,8,5,1}
+#define OIDegpNeighState {1,3,6,1,2,1,8,5,1,1}
+#define OIDegpNeighStateUps {1,3,6,1,2,1,8,5,1,10}
+#define OIDegpNeighStateDowns {1,3,6,1,2,1,8,5,1,11}
+#define OIDegpNeighIntervalHello {1,3,6,1,2,1,8,5,1,12}
+#define OIDegpNeighIntervalPoll {1,3,6,1,2,1,8,5,1,13}
+#define OIDegpNeighMode {1,3,6,1,2,1,8,5,1,14}
+#define OIDegpNeighEventTrigger {1,3,6,1,2,1,8,5,1,15}
+#define OIDegpNeighAddr {1,3,6,1,2,1,8,5,1,2}
+#define OIDegpNeighAs {1,3,6,1,2,1,8,5,1,3}
+#define OIDegpNeighInMsgs {1,3,6,1,2,1,8,5,1,4}
+#define OIDegpNeighInErrs {1,3,6,1,2,1,8,5,1,5}
+#define OIDegpNeighOutMsgs {1,3,6,1,2,1,8,5,1,6}
+#define OIDegpNeighOutErrs {1,3,6,1,2,1,8,5,1,7}
+#define OIDegpNeighInErrMsgs {1,3,6,1,2,1,8,5,1,8}
+#define OIDegpNeighOutErrMsgs {1,3,6,1,2,1,8,5,1,9}
+#define OIDegpAs {1,3,6,1,2,1,8,6}
+#define OIDexperimental {1,3,6,1,3}
+#define OIDprivate {1,3,6,1,4}
+#define OIDenterprises {1,3,6,1,4,1}
+
+#endif // __SNMPOIDS_H \ No newline at end of file
diff --git a/shared-code/SNMPeer.h b/shared-code/SNMPeer.h
new file mode 100644
index 0000000..68f2efe
--- a/dev/null
+++ b/shared-code/SNMPeer.h
@@ -0,0 +1,286 @@
+#ifndef __SNMPEER_H
+#define __SNMPEER_H
+
+namespace Klever {
+
+class CASNAny {
+public:
+ enum {
+ asnCls = 0xC0,
+ asnClsUniversal = 0x00,
+ asnClsApplication = 0x40,
+ asnClsContextSpecific = 0x80,
+ asnClsPrivate = 0xC0,
+ asnConstructed = 0x20,
+ asnPrimitive = 0x00,
+ asnTag = 0x1F,
+ // ASN.1 Primitive Tags
+ asnTagInteger = 0x02,
+ asnTagOctetString = 0x04,
+ asnTagNull = 0x05,
+ asnTagOID = 0x06,
+ // ASN.1 Constructed Tags
+ asnTagSequence = 0x10,
+ // RFC1155 Primitive Tags
+ asnTagIP = 0x00,
+ asnTagCounter = 0x01,
+ asnTagGauge = 0x02,
+ asnTagTicks = 0x03,
+ asnTagOpaque = 0x04,
+ // RFC1213 alias
+ asnTagDispString = 0x04, // (ASN.1 Octet string)
+ // RFC1157 Constructed Tags
+ asnTagGetRequest = 0x00,
+ asnTagGetNextRequest = 0x01,
+ asnTagGetResponse = 0x02,
+ asnTagSetRequest = 0x03,
+ asnTagTrap = 0x04
+ };
+ enum {
+ typeASNInteger = (asnClsUniversal|asnPrimitive|asnTagInteger),
+ typeASNOctetString = (asnClsUniversal|asnPrimitive|asnTagOctetString),
+ typeASNNull = (asnClsUniversal|asnPrimitive|asnTagNull),
+ typeASNOID = (asnClsUniversal|asnPrimitive|asnTagOID),
+
+ typeASNSequence = (asnClsUniversal|asnConstructed|asnTagSequence),
+ typeASNSequenceOf = (asnClsUniversal|asnConstructed|asnTagSequence),
+
+ typeASNIP = (asnClsApplication|asnPrimitive|asnTagIP),
+ typeASNCounter = (asnClsApplication|asnPrimitive|asnTagCounter),
+ typeASNGauge = (asnClsApplication|asnPrimitive|asnTagGauge),
+ typeASNTicks = (asnClsApplication|asnPrimitive|asnTagTicks),
+ typeASNOpaque = (asnClsApplication|asnPrimitive|asnTagOpaque),
+ typeASNDispString = (asnClsUniversal|asnPrimitive|asnTagOctetString),
+
+ typeASNGetRequest = (asnClsContextSpecific|asnConstructed|asnTagGetRequest),
+ typeASNGetNextRequest = (asnClsContextSpecific|asnConstructed|asnTagGetNextRequest),
+ typeASNGetResponse = (asnClsContextSpecific|asnConstructed|asnTagGetResponse),
+ typeASNSetRequest = (asnClsContextSpecific|asnConstructed|asnTagSetRequest),
+ typeASNTrap = (asnClsContextSpecific|asnConstructed|asnTagTrap)
+ };
+
+ typedef LONG asnInteger;
+ typedef LARGE_INTEGER asnInteger64;
+ typedef DWORD asnCounter;
+ typedef ULARGE_INTEGER asnCounter64;
+ typedef DWORD asnGauge;
+ typedef ULARGE_INTEGER asnGauge64;
+ typedef DWORD asnTicks;
+ typedef ULARGE_INTEGER asnTicks64;
+ struct asnDynamic {
+ UINT size;
+ LPBYTE data;
+ BOOL Allocate(UINT size) {
+ BOOL rv = Free();
+ if(size)
+ rv=rv&&(data=new BYTE[size]);
+ if(rv)
+ asnDynamic::size=size;
+ return rv;
+ }
+ BOOL Set(LPBYTE data,UINT size) {
+ BOOL rv = Allocate(size);
+ if(rv && size)
+ memmove(asnDynamic::data,data,size);
+ return rv;
+ }
+ BOOL Free() {
+ if(!size)
+ return TRUE;
+ delete data;
+ size=0;
+ data=0;
+ return TRUE;
+ }
+ void Clean() {
+ size=0;
+ data=0;
+ }
+ BOOL Copy(asnDynamic& src) {
+ BOOL rv = Free();
+ if(rv){
+ if(src.size)
+ rv=rv&&(data = new BYTE[src.size]);
+ if(rv){
+ if(size=src.size)
+ memmove(data,src.data,size);
+ }
+ }
+ return rv;
+ }
+ };
+ typedef asnDynamic asnOctetString;
+ typedef asnDynamic asnOID;
+ typedef in_addr asnIP;
+ typedef asnDynamic asnSequence;
+
+ BYTE type;
+ enum _storeType {
+ storeDynamic,
+ storeStatic
+ } storeType;
+ union {
+ asnInteger number;
+ asnInteger64 number64;
+ asnOctetString string;
+ asnOID oid;
+ asnSequence sequence;
+ asnIP ip;
+ asnCounter counter;
+ asnCounter64 counter64;
+ asnGauge gauge;
+ asnGauge64 gauge64;
+ asnTicks ticks;
+ asnTicks64 ticks64;
+ asnDynamic data;
+ } value;
+
+ CASNAny() : type(typeASNNull), storeType(storeStatic) { value.data.Clean(); }
+ CASNAny(CASNAny& src) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Copy(src); }
+ CASNAny(BYTE type) : type(type), storeType(storeStatic) { value.data.Clean(); }
+ CASNAny(BYTE type,LONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); }
+ CASNAny(BYTE type,LONGLONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); }
+ CASNAny(BYTE type,LPCTSTR string) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,string); }
+ CASNAny(BYTE type,LPBYTE data,UINT length) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,data,length); }
+ CASNAny(BYTE type,UINT* data,UINT size) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,(LPBYTE)data,size); }
+ CASNAny(in_addr& ip) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(ip); }
+ ~CASNAny() { Free(); }
+
+ BOOL Set(BYTE type) {
+ BOOL rv = Free();
+ CASNAny::type=type;
+ return rv;
+ }
+ BOOL Set(BYTE type,LONG number) {
+ BOOL rv = Free();
+ CASNAny::type=type;
+ value.number=number;
+ storeType=storeStatic;
+ return rv;
+ }
+ BOOL Set(BYTE type,LONGLONG number) {
+ BOOL rv = Free();
+ CASNAny::type=type;
+ value.number64.QuadPart = number;
+ storeType=storeStatic;
+ return rv;
+ }
+ BOOL Set(BYTE type,LPCTSTR string) {
+ BOOL rv = Free();
+ CASNAny::type=type;
+ rv=rv&&value.string.Set((LPBYTE)string,strlen(string)+1);
+ if(rv){
+ value.string.size--;
+ storeType=storeDynamic;
+ }
+ return rv;
+ }
+ BOOL Set(BYTE type,LPBYTE data,UINT length) {
+ BOOL rv = Free();
+ CASNAny::type=type;
+ rv=rv&&value.data.Set(data,length);
+ if(rv)
+ storeType=storeDynamic;
+ return rv;
+ }
+ BOOL Set(in_addr& ip) {
+ BOOL rv = Free();
+ memmove(&value.ip,&ip,sizeof(value.ip));
+ type=typeASNIP;
+ storeType=storeStatic;
+ return rv;
+ }
+ BOOL Free() {
+ if(storeType==storeDynamic)
+ value.data.Free();
+ else{
+ memset(&value,0,sizeof(value));
+ value.data.Clean();
+ }
+ storeType=storeStatic;
+ type=typeASNNull;
+ return TRUE;
+ }
+ BOOL Copy(CASNAny& src) {
+ BOOL rv = Free();
+ if(src.storeType==storeDynamic){
+ rv=rv&&value.data.Copy(src.value.data);
+ if(rv){
+ type=src.type;
+ storeType=src.storeType;
+ }
+ }else{
+ memmove(this,&src,sizeof(*this));
+ }
+ return rv;
+ }
+ CASNAny& operator=(CASNAny& src) {
+ VERIFY(Copy(src));
+ return *this;
+ }
+
+ // High Level
+ CString GetString() {
+ ASSERT(storeType==storeDynamic);
+ CString rv;
+ LPTSTR b = rv.GetBuffer(value.data.size+1);
+ ASSERT(b);
+ b[value.data.size]=0;
+ memmove(b,value.data.data,value.data.size);
+ rv.ReleaseBuffer();
+ return rv;
+ }
+};
+
+
+class CSNMPVarBind {
+public:
+ CASNAny name;
+ CASNAny value;
+
+ CSNMPVarBind() {}
+ CSNMPVarBind(CASNAny& name,CASNAny& value) : name(name), value(value) {}
+ CSNMPVarBind(CASNAny& name) : name(name) {}
+ CSNMPVarBind(CSNMPVarBind& src) { Copy(src); }
+ BOOL Copy(CSNMPVarBind& src) {
+ name.Copy(src.name);
+ value.Copy(src.value);
+ return TRUE;
+ }
+ CSNMPVarBind& operator=(CSNMPVarBind& src) {
+ Copy(src);
+ return *this;
+ }
+ // High level
+ BOOL IsName(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) {
+ if(name.type!=CASNAny::typeASNOID)
+ return FALSE;
+ if(name.value.oid.size<prefixSize)
+ return FALSE;
+ if(bExact && (name.value.oid.size!=prefixSize))
+ return FALSE;
+ return !memcmp(prefix,name.value.oid.data,prefixSize);
+ }
+};
+
+class CSNMPVarBindList : public CList<CSNMPVarBind,CSNMPVarBind&> {
+public:
+ CSNMPVarBind* GetVarBind(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) {
+ POSITION p = GetHeadPosition();
+ while(p){
+ CSNMPVarBind& vb = GetNext(p);
+ if(vb.IsName(prefix,prefixSize,bExact))
+ return &vb;
+ }
+ return NULL;
+ }
+};
+
+class CSNMPeer {
+public:
+ virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) = 0;
+};
+
+};
+
+#endif // __SNMPEER_H
diff --git a/shared-code/install.h b/shared-code/install.h
new file mode 100644
index 0000000..8c55ca9
--- a/dev/null
+++ b/shared-code/install.h
@@ -0,0 +1,370 @@
+#define WIN32_LEAN_AND_MEAN
+#define VC_EXTRALEAN
+#define WIN32_EXTRALEAN
+#include <windows.h>
+#include <shlobj.h>
+#include <winver.h>
+#include <crtdbg.h>
+#include <string.h>
+#include <stdio.h>
+
+extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID);
+
+template<class T> class Smart {
+public:
+ T *pT;
+
+ Smart() : pT(NULL) {}
+ Smart(int cb) : pT(new T[cb]) {}
+ Smart(T* p) : pT(p) {}
+ ~Smart() { if(pT)delete pT; }
+
+ Smart& operator=(T* p) { if(pT)delete pT; pT=p; return *this; }
+ operator T* () { return pT; }
+
+// T& operator[](int ndx) { return pT[ndx]; }
+
+ T* Detach() { T* rv = pT; pT=NULL; return rv; }
+};
+typedef Smart<char> STRING;
+
+#define APPEND_SLASH(str) if((str)[strlen(str)-1]!='\\')strcat(str,"\\")
+
+HINSTANCE theInstance;
+
+LPSTR strFETCH_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR val)
+{
+HKEY hkey;
+ if(RegOpenKeyEx(hRoot,subKey,0,KEY_QUERY_VALUE,&hkey)!=ERROR_SUCCESS)
+ return NULL;
+DWORD kType,cb=0;
+STRING rv;
+ if(RegQueryValueEx(hkey,val,NULL,&kType,NULL,&cb)==ERROR_SUCCESS && kType==REG_SZ){
+ rv= new char[cb];
+ _ASSERT(rv!=NULL);
+ if(RegQueryValueEx(hkey,val,NULL,&kType,(LPBYTE)(LPSTR)rv,&cb)!=ERROR_SUCCESS)
+ rv=NULL;
+ }
+ RegCloseKey(hkey);
+ return rv.Detach();
+}
+
+BOOL strSET_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR valName,LPCSTR val)
+{
+HKEY hkey;
+DWORD dw;
+ if(RegCreateKeyEx(hRoot,subKey,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&hkey,&dw)!=ERROR_SUCCESS)
+ return FALSE;
+BOOL rv = (RegSetValueEx(hkey,valName,0,REG_SZ,(LPBYTE)val,strlen(val)+1)==ERROR_SUCCESS);
+ RegCloseKey(hkey);
+ return rv;
+}
+
+void MAKE_PATH(LPCSTR path)
+{
+STRING tmp(strlen(path)+1);
+LPCSTR t0=path;
+LPSTR t1=tmp;
+ while(*t0){
+ if((*t0)=='\\'){
+ *t1=0;
+ CreateDirectory(tmp,NULL);
+ }
+ *(t1++)=*(t0++);
+ }
+ *t1=0;
+ CreateDirectory(tmp,NULL);
+}
+
+BOOL ADDMENU(LPCSTR menu,LPCSTR item,LPCSTR path,LPCSTR program)
+{
+STRING stm = strFETCH_REG_KEY(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders","Programs");
+ if(!stm)
+ return FALSE;
+int pil = 1+strlen(path)+1+strlen(program)+1+1;
+STRING pi(pil);
+ strcpy(pi,path);
+ APPEND_SLASH(pi);
+ strcat(pi,program);
+int ipl = strlen(stm)+1+strlen(menu)+1+strlen(item)+4+1;
+STRING ip(ipl);
+ memmove(ip,stm,strlen(stm)+1);
+ APPEND_SLASH(ip);
+ strcat(ip,menu);
+ MAKE_PATH(ip);
+ APPEND_SLASH(ip);
+ strcat(ip,item);
+ strcat(ip,".lnk");
+IShellLink* sl = NULL;
+IPersistFile* pf = NULL;
+BOOL rv = FALSE;
+ do{
+ HRESULT hrv = CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(LPVOID*)&sl);
+ if(!SUCCEEDED(hrv))
+ break;
+ sl->SetDescription(item);
+ sl->SetPath(pi);
+ hrv = sl->QueryInterface(IID_IPersistFile,(LPVOID*)&pf);
+ if(!SUCCEEDED(hrv))
+ break;
+ WORD wsz[MAX_PATH];
+ MultiByteToWideChar(CP_ACP,0,ip,-1,wsz,MAX_PATH);
+ hrv = pf->Save(wsz,TRUE);
+ if(SUCCEEDED(hrv))
+ rv=TRUE;
+ }while(FALSE);
+ if(pf)
+ pf->Release();
+ if(sl)
+ sl->Release();
+ return rv;
+}
+
+FILE* CREATE_INF_FILE(LPCSTR path,LPCSTR file)
+{
+STRING fn(strlen(path)+1+strlen(file)+1);
+ strcpy(fn,path);
+ APPEND_SLASH(fn);
+ strcat(fn,file);
+ return fopen(fn,"wt");
+}
+
+BOOL INSTALLFILE(LPCSTR res,LPCSTR path,LPCSTR file)
+{
+STRING temp(MAX_PATH);
+ if(!GetTempPath(MAX_PATH,temp)) return FALSE;
+STRING tf(MAX_PATH);
+ if(!GetTempFileName(temp,"KGI",0,tf)) return FALSE;
+HRSRC hrsrc = FindResource(NULL,res,MAKEINTRESOURCE(RT_RCDATA));
+ if(!hrsrc) return FALSE;
+DWORD sor = SizeofResource(NULL,hrsrc);
+ if(!sor) return FALSE;
+HGLOBAL hglobal = LoadResource(NULL,hrsrc);
+ if(!hglobal) return FALSE;
+LPVOID lpv = LockResource(hglobal);
+ if(!lpv) return FALSE;
+HANDLE hf = CreateFile(tf,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
+ if(!hf) return FALSE;
+DWORD written = 0;
+ if(!WriteFile(hf,lpv,sor,&written,NULL) || written!=sor){
+ CloseHandle(hf);
+ return FALSE;
+ }
+ CloseHandle(hf);
+STRING toKill(strlen(tf)+1);
+ strcpy(toKill,tf);
+ for(int tmp=strlen(tf)-1;tmp>0 && ((tf[tmp])!='\\');tmp--);
+ if(tf[tmp]=='\\')
+ tf[tmp++]=0;
+STRING nothing(_MAX_PATH);
+UINT nothingLength=_MAX_PATH;
+ if(VerInstallFile(0,&tf[tmp],(LPSTR)file,tf,(LPSTR)path,NULL,nothing,&nothingLength)){
+ DeleteFile(toKill);
+ return FALSE;
+ }
+ DeleteFile(toKill);
+ return TRUE;
+}
+
+LPCSTR pdTitle, pdPrompt;
+char pdPath[_MAX_PATH];
+BOOL CALLBACK pathDlgProc(HWND hwnd,UINT uMsg,WPARAM wP,LPARAM lP)
+{
+ switch(uMsg){
+ case WM_INITDIALOG:
+ SetWindowText(hwnd,pdTitle);
+ SetDlgItemText(hwnd,IDC_PROMPT,pdPrompt);
+ SetDlgItemText(hwnd,IDC_PATH,pdPath);
+ SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
+ return 1;
+ case WM_COMMAND:
+ switch(LOWORD(wP)){ // ID
+ case IDC_BROWSE:
+ switch(HIWORD(wP)){
+ case BN_CLICKED:
+ {
+ BROWSEINFO bi;
+ memset(&bi,0,sizeof(bi));
+ bi.hwndOwner=hwnd;
+ bi.pszDisplayName=pdPath;
+ bi.lpszTitle="Select Folder..";
+ bi.ulFlags=BIF_RETURNONLYFSDIRS;
+ LPITEMIDLIST lpidl=SHBrowseForFolder(&bi);
+ if(lpidl){
+ SHGetPathFromIDList(lpidl,pdPath);
+ SHFree(lpidl);
+ SetDlgItemText(hwnd,IDC_PATH,pdPath);
+ }
+ }
+ return 1;
+ }
+ break;
+ case IDOK:
+ switch(HIWORD(wP)){
+ case BN_CLICKED:
+ if(GetDlgItemText(hwnd,IDC_PATH,pdPath,sizeof(pdPath)))
+ EndDialog(hwnd,IDOK);
+ else
+ // *** Error message
+ EndDialog(hwnd,IDCANCEL);
+ return 1;
+ }
+ break;
+ case IDCANCEL:
+ switch(HIWORD(wP)){
+ case BN_CLICKED:
+ EndDialog(hwnd,IDCANCEL);
+ return 1;
+ }
+ break;
+ };
+ break;
+ }
+ return 0;
+}
+
+LPSTR REQUESTPATH(LPCSTR title,LPCSTR prompt,LPCSTR defPath)
+{
+ pdTitle=title;pdPrompt=prompt;
+ strcpy(pdPath,defPath);
+ if(DialogBox(NULL,MAKEINTRESOURCE(IDD_PATH),NULL/*Parent*/,(DLGPROC)&pathDlgProc)!=IDOK)
+ return NULL;
+STRING rv(strlen(pdPath)+1);
+ strcpy(rv,pdPath);
+ return rv.Detach();
+}
+
+HKEY uninstallKey(LPCSTR regKey) {
+ STRING rk(100+strlen(regKey)+1);
+ sprintf(rk,"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s",regKey);
+ HKEY rv = NULL;
+ DWORD dw;
+ if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,rk,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&rv,&dw)!=ERROR_SUCCESS)
+ return NULL;
+ return rv;
+}
+
+BOOL REG_UNINSTALL_COMMAND(LPCSTR regKey,LPCSTR dName,LPCSTR iPath,LPCSTR iFile,LPCSTR iSection)
+{
+ HKEY hKey = uninstallKey(regKey);
+ if(!hKey)
+ return FALSE;
+ BOOL rv=FALSE;
+ do{
+ if(RegSetValueEx(hKey,"DisplayName",0,REG_SZ,(LPBYTE)dName,strlen(dName)+1)!=ERROR_SUCCESS)
+ break;
+ STRING us(50+strlen(iPath)+1+strlen(iFile)+strlen(iSection)+1);
+ strcpy(us,"RunDll32 setupapi.dll,InstallHinfSection ");
+ strcat(us,iSection);
+ strcat(us," 132 ");
+ strcat(us,iPath);
+ APPEND_SLASH(us);
+ strcat(us,iFile);
+ if(RegSetValueEx(hKey,"UninstallString",0,REG_SZ,(LPBYTE)(LPCSTR)us,strlen(us)+1)!=ERROR_SUCCESS)
+ break;
+ rv=TRUE;
+ }while(FALSE);
+ RegCloseKey(hKey);
+ return rv;
+}
+BOOL REG_UNINSTALL_ICON(LPCSTR regKey,LPCSTR path,LPCSTR file,int n) {
+ HKEY hKey = uninstallKey(regKey);
+ if(!hKey)
+ return FALSE;
+ STRING uis(strlen(path)+1+strlen(file)+7);
+ strcpy(uis,path);
+ APPEND_SLASH(uis);
+ strcat(uis,file);
+ char tmp[8];
+ sprintf(tmp,";%d",n);
+ strcat(uis,tmp);
+ BOOL rv = TRUE;
+ if(RegSetValueEx(hKey,"DisplayIcon",0,REG_SZ,(LPBYTE)(LPCSTR)uis,strlen(uis)+1)!=ERROR_SUCCESS)
+ rv = FALSE;
+ RegCloseKey(hKey);
+ return rv;
+}
+BOOL REG_UNINSTALL_COMMENT(LPCSTR regKey,LPCSTR comment) {
+ HKEY hKey = uninstallKey(regKey);
+ if(!hKey)
+ return FALSE;
+ BOOL rv = TRUE;
+ if(RegSetValueEx(hKey,"lComment",0,REG_SZ,(LPBYTE)comment,strlen(comment)+1)!=ERROR_SUCCESS)
+ rv = FALSE;
+ RegCloseKey(hKey);
+ return rv;
+}
+BOOL REG_UNINSTALL_VERSION(LPCSTR regKey,LPCSTR version) {
+ HKEY hKey = uninstallKey(regKey);
+ if(!hKey)
+ return FALSE;
+ BOOL rv = TRUE;
+ if(RegSetValueEx(hKey,"DisplayVersion",0,REG_SZ,(LPBYTE)version,strlen(version)+1)!=ERROR_SUCCESS)
+ rv = FALSE;
+ RegCloseKey(hKey);
+ return rv;
+}
+BOOL REG_UNINSTALL_LOCATION(LPCSTR regKey,LPCSTR location) {
+ HKEY hKey = uninstallKey(regKey);
+ if(!hKey)
+ return FALSE;
+ BOOL rv = TRUE;
+ if(RegSetValueEx(hKey,"InstallLocation",0,REG_SZ,(LPBYTE)location,strlen(location)+1)!=ERROR_SUCCESS)
+ rv = FALSE;
+ RegCloseKey(hKey);
+ return rv;
+}
+BOOL REG_UNINSTALL_PUBLISHER(LPCSTR regKey,LPCSTR publisher) {
+ HKEY hKey = uninstallKey(regKey);
+ if(!hKey)
+ return FALSE;
+ BOOL rv = TRUE;
+ if(RegSetValueEx(hKey,"Publisher",0,REG_SZ,(LPBYTE)publisher,strlen(publisher)+1)!=ERROR_SUCCESS)
+ rv = FALSE;
+ RegCloseKey(hKey);
+ return rv;
+}
+BOOL REG_UNINSTALL_URLS(LPCSTR regKey,LPCSTR about,LPCSTR update) {
+ HKEY hKey = uninstallKey(regKey);
+ if(!hKey)
+ return FALSE;
+ BOOL rv = TRUE;
+ if(RegSetValueEx(hKey,"URLInfoAbout",0,REG_SZ,(LPBYTE)about,strlen(about)+1)!=ERROR_SUCCESS)
+ rv = FALSE;
+ if(RegSetValueEx(hKey,"URLUpdateInfo",0,REG_SZ,(LPBYTE)update,strlen(update)+1)!=ERROR_SUCCESS)
+ rv = FALSE;
+ RegCloseKey(hKey);
+ return rv;
+}
+
+#define INF_FILE_HEADER(i) fprintf(i,"[Version]\nSignature=\"$CHICAGO$\"\n\n")
+#define INF_FILE_SECTION(i,s) fprintf(i,"\n[%s]\n",s)
+#define INF_UNINSTALL_REG(i,p) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s\nHKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s,DisplayName\nHKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s,UninstallString\n",p,p,p)
+#define INF_MENU_GROUP(i,n,m) fprintf(i,"setup.ini, progman.groups,,\"group%d=%s\"\n",n,m)
+#define INF_MENU_ITEM(i,n,m) fprintf(i,"setup.ini, group%d,, \"\"\"%s\"\"\"\n",n,m);
+#define INF_REMOVE_ROOT(i,g,r) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,,,\"%s\"\n",g,r)
+#define INF_REMOVE_FILE(i,g,f) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,%s,,\"%s\"\n",g,f,f)
+#define INF_REMOVE_HELP_FILE(i,g,f) {INF_REMOVE_FILE(i,g,f".hlp");INF_REMOVE_FILE(i,g,f".cnt");INF_REMOVE_FILE(i,g,f".GID");INF_REMOVE_FILE(i,g,f".FTS");}
+
+LPSTR GET_SHORT_PATH(LPCSTR path)
+{
+char tmp;
+DWORD len = GetShortPathName(path,&tmp,1);
+ if(!len)
+ return NULL;
+STRING rv(len+1);
+ if(!GetShortPathName(path,rv,len+1))
+ return NULL;
+ return rv.Detach();
+}
+
+BOOL Install(void);
+
+int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE,LPSTR,int)
+{
+ theInstance=hInstance;
+ CoInitialize(NULL);
+ Install();
+ CoUninitialize();
+ return 0;
+}
diff --git a/shared-code/ip_icmp.h b/shared-code/ip_icmp.h
new file mode 100644
index 0000000..acaf7e9
--- a/dev/null
+++ b/shared-code/ip_icmp.h
@@ -0,0 +1,91 @@
+#ifndef IP_ICMPHEADER
+
+#define IP_ICMPHEADER
+
+struct icmp {
+ BYTE icmp_type;
+ BYTE icmp_code;
+ WORD icmp_cksum;
+ WORD icmp_id;
+ WORD icmp_seq;
+ char icmp_data[1];
+};
+
+#define SIZE_ICMP_HDR 8
+#define SIZE_TIME_DATA 8
+
+struct ip {
+ BYTE ip_hl:4, /* header length */
+ ip_v:4; /* version */
+ BYTE ip_tos; /* type of service */
+ short ip_len; /* total length */
+ u_short ip_id; /* identification */
+ short ip_off; /* fragment offset field */
+ BYTE ip_ttl; /* time to live */
+ BYTE ip_p; /* protocol */
+ u_short ip_sum; /* checksum */
+ struct in_addr ip_src,ip_dst; /* source and dest address */
+};
+
+#define ICMP_ECHOREPLY 0 /* echo reply */
+#define ICMP_UNREACH 3 /* dest unreachable, codes: */
+#define ICMP_UNREACH_NET 0 /* bad net */
+#define ICMP_UNREACH_HOST 1 /* bad host */
+#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
+#define ICMP_UNREACH_PORT 3 /* bad port */
+#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
+#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
+#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
+#define ICMP_REDIRECT 5 /* shorter route, codes: */
+#define ICMP_REDIRECT_NET 0 /* for network */
+#define ICMP_REDIRECT_HOST 1 /* for host */
+#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
+#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
+#define ICMP_ECHO 8 /* echo service */
+#define ICMP_TIMXCEED 11 /* time exceeded, code: */
+#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
+#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
+#define ICMP_PARAMPROB 12 /* ip header bad */
+#define ICMP_TSTAMP 13 /* timestamp request */
+#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
+#define ICMP_IREQ 15 /* information request */
+#define ICMP_IREQREPLY 16 /* information reply */
+#define ICMP_MASKREQ 17 /* address mask request */
+#define ICMP_MASKREPLY 18 /* address mask reply */
+
+#define ICMP_MAXTYPE 18
+
+#define ICMP_MINLEN 8 /* abs minimum */
+#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
+#define ICMP_MASKLEN 12 /* address mask */
+#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
+#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+
+#define STNORM 0
+
+/* Definition of the lowest telnet byte following an IAC byte */
+#define LOW_TEL_OPT 236
+
+#define TEL_EOF 236
+#define SUSP 237
+#define ABORT 238
+
+#define SE 240
+#define NOP 241
+#define DM 242
+#define BREAK 243
+#define IP 244
+#define AO 245
+#define AYT 246
+#define EC 247
+#define EL 248
+#define GOAHEAD 249
+#define SB 250
+#define WILL 251
+#define WONT 252
+#define DO 253
+#define DONT 254
+#define IAC 255
+
+#endif
+
diff --git a/shared-code/kHelpers.h b/shared-code/kHelpers.h
new file mode 100644
index 0000000..209c6b0
--- a/dev/null
+++ b/shared-code/kHelpers.h
@@ -0,0 +1,159 @@
+#ifndef __KHELPERS_H
+#define __KHELPERS_H
+
+#include <shlobj.h>
+
+extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID);
+
+namespace Klever {
+
+ inline BOOL BrowseForFolder(CString& folder,LPCTSTR title=NULL,CWnd* pParent=NULL) {
+ BROWSEINFO bi;
+ memset(&bi,0,sizeof(bi));
+ if(pParent)
+ bi.hwndOwner=pParent->GetSafeHwnd();
+ CString rv;
+ bi.pszDisplayName=rv.GetBuffer(MAX_PATH);
+ bi.lpszTitle=title;
+ bi.ulFlags=BIF_RETURNONLYFSDIRS;
+ LPITEMIDLIST lpidl = SHBrowseForFolder(&bi);
+ if(lpidl){
+ SHGetPathFromIDList(lpidl,bi.pszDisplayName);
+ SHFree(lpidl);
+ rv.ReleaseBuffer();
+ folder=rv;
+ return TRUE;
+ }
+ rv.ReleaseBuffer();
+ return FALSE;
+ }
+ inline BOOL BrowseForFolder(CString& folder,UINT idTitle,CWnd* pParent=NULL) {
+ CString title;
+ VERIFY(title.LoadString(idTitle));
+ return BrowseForFolder(folder,title,pParent);
+ }
+ inline CString GluePathAndFile(LPCTSTR path,LPCTSTR file) {
+ CString rv = path;
+ while((!rv.IsEmpty()) && rv[rv.GetLength()-1]=='\\')
+ rv=rv.Left(rv.GetLength()-1);
+ rv+='\\';
+ while(*file && *file=='\\')
+ file++;
+ rv+=file;
+ return rv;
+ }
+ inline UINT TokenizeString(CStringList& rv,LPCTSTR string,LPCTSTR delimiter) {
+ CString s = string;
+ int found;
+ int delength = strlen(delimiter);
+ int rvc = 0;
+ while((found=s.Find(delimiter))>=0){
+ rv.AddTail(s.Left(found));
+ rvc++;
+ s=s.Mid(found+delength);
+ }
+ if(!s.IsEmpty()){
+ rv.AddTail(s);
+ rvc++;
+ }
+ return rvc;
+ }
+ inline BOOL LogRecord(LPCTSTR logFile,LPCTSTR logRecord) {
+ try{
+ CFile f(logFile,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite|CFile::shareDenyWrite);
+ f.SeekToEnd();
+ CString s = CTime::GetCurrentTime().Format("[%c] ")+logRecord+"\r\n";
+ f.Write((LPCTSTR)s,s.GetLength());
+ }catch(CException* e){
+ e->Delete();
+ return FALSE;
+ }
+ return TRUE;
+ }
+ inline BOOL ReadString(CFile* file,CString& rv) {
+ rv.Empty();
+ int nBuffer = 256;
+ TCHAR* ch = rv.GetBuffer(nBuffer);
+ int nPos = 0;
+ BOOL bRV = FALSE;
+ for(;;){
+ TCHAR c;
+ try{
+ if(file->Read(&c,sizeof(c))!=sizeof(c))
+ break;
+ bRV=TRUE;
+ }catch(CException* e){
+ e->Delete();
+ TRACE0("Exception in ReadString\n");
+ return FALSE;
+ }
+ if(nPos>=(nBuffer-1)){
+ rv.ReleaseBuffer();
+ ch = rv.GetBuffer(nBuffer=nBuffer+256);
+ ASSERT(ch);
+ }
+ if(c=='\n')
+ break;
+ ch[nPos++]=c;
+ }
+ ch[nPos]=0;
+ for(;;){
+ nPos--;
+ if(nPos<0)
+ break;
+ if(ch[nPos]!='\r')
+ break;
+ ch[nPos]=0;
+ }
+ rv.ReleaseBuffer();
+ rv.FreeExtra();
+ return bRV;
+ }
+
+ inline int LoadStringList(CStringList& list,LPCTSTR section) {
+ CString n;
+ list.RemoveAll();
+ CWinApp* app = AfxGetApp();
+ ASSERT(app);
+ for(int tmp=0;;tmp++){
+ n.Format("%d",tmp);
+ CString str = app->GetProfileString(section,n,NULL);
+ if(str.IsEmpty())
+ break;
+ list.AddTail(str);
+ }
+ return tmp;
+ }
+ inline int SaveStringList(CStringList& list,LPCTSTR section) {
+ CString n;
+ CWinApp* app = AfxGetApp();
+ ASSERT(app);
+ POSITION p = list.GetHeadPosition();
+ for(int tmp=0;p;tmp++){
+ n.Format("%d",tmp);
+ app->WriteProfileString(section,n,list.GetNext(p));
+ }
+ n.Format("%d",tmp);
+ app->WriteProfileString(section,n,NULL);
+ return tmp;
+ }
+
+ inline BOOL WriteProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR str) {
+ CWinApp* app = AfxGetApp();
+ return app->WriteProfileBinary(section,entry,(LPBYTE)str,strlen(str)+1);
+ }
+ inline CString GetProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR defval) {
+ CWinApp* app = AfxGetApp();
+ LPBYTE pData;
+ UINT nCount;
+ CString rv = defval;
+ if(app->GetProfileBinary(section,entry,&pData,&nCount)){
+ rv = (LPCTSTR)pData;
+ delete pData;
+ }
+ return rv;
+ }
+
+};
+
+#endif // __KHELPERS_H
diff --git a/shared-code/kICMP.cpp b/shared-code/kICMP.cpp
new file mode 100644
index 0000000..09a8f94
--- a/dev/null
+++ b/shared-code/kICMP.cpp
@@ -0,0 +1,300 @@
+#include "../stdafx.h"
+#include "kICMP.h"
+
+CICMP::_mechanismus CICMP::m_mechanismus = CICMP::_icmpUndetermined;
+
+BOOL CICMPDll::Initialize()
+{
+ if(m_hICMP!=INVALID_HANDLE_VALUE || m_hICMPDLL)
+ Deinitialize();
+ m_hICMPDLL = ::LoadLibraryEx("ICMP",NULL,0);
+ if(!m_hICMPDLL)
+ return FALSE;
+ *(FARPROC*)&m_icmpCF = ::GetProcAddress(m_hICMPDLL,"IcmpCreateFile");
+ *(FARPROC*)&m_icmpSE = ::GetProcAddress(m_hICMPDLL,"IcmpSendEcho");
+ *(FARPROC*)&m_icmpCH = ::GetProcAddress(m_hICMPDLL,"IcmpCloseHandle");
+ if(!(m_icmpCF && m_icmpSE && m_icmpCH)){
+ Deinitialize(); return FALSE;
+ }
+ m_hICMP = (*m_icmpCF)();
+ if(m_hICMP==INVALID_HANDLE_VALUE){
+ Deinitialize(); return FALSE;
+ }
+ TRACE0("ICMP-DLL Initialized\n");
+ return TRUE;
+}
+void CICMPDll::Deinitialize()
+{
+ if(m_hICMPDLL){
+ if(m_hICMP!=INVALID_HANDLE_VALUE && m_icmpCH)
+ (*m_icmpCH)(m_hICMP);
+ ::FreeLibrary(m_hICMPDLL); m_hICMPDLL = NULL;
+ m_icmpCF = NULL;
+ m_icmpSE = NULL;
+ m_icmpCH = NULL;
+ }
+ m_hICMP=INVALID_HANDLE_VALUE;
+ if(m_sizeOut && m_bsOut){
+ delete m_bsOut;
+ m_bsOut = NULL; m_sizeOut = 0;
+ }
+ if(m_sizeIn && m_bsIn){
+ delete m_bsIn;
+ m_bsIn = NULL; m_sizeIn = 0;
+ }
+}
+
+LONG CICMPDll::Ping(const in_addr host,const UINT packetSize,
+ const UINT timeOut,LPINT pStatus)
+{
+ if(!(m_hICMP && m_hICMPDLL && m_icmpSE)){
+ if(pStatus)
+ (*pStatus) = icmpNotInitialized;
+ return -1;
+ }
+ VERIFY(AdjustBuffers(packetSize));
+IPINFO ipi;
+ memset(&ipi,0,sizeof(ipi));
+ ipi.Ttl = 30;
+ for(UINT tmp=0;tmp<packetSize;tmp++)
+ m_bsOut[tmp]=tmp&0xFF;
+LPICMPECHO pRep = (LPICMPECHO)m_bsIn;
+ pRep->Status = 0xFFFFFFFFl;
+ if((*m_icmpSE)(m_hICMP,host.s_addr,m_bsOut,packetSize,
+ &ipi,pRep,m_sizeIn,timeOut))
+ TRACE0("ICMP-SendEcho succeeded\n");
+ else
+ TRACE0("ICMP-SendEcho failed\n");
+LONG lrv = -1;
+INT rv = ipUnknown;
+ switch(pRep->Status){
+ case IP_SUCCESS:
+ lrv = pRep->RTTime; rv = ipSuccess;
+ break;
+ case IP_BUF_TOO_SMALL: rv = ipBuffTooSmall; break;
+ case IP_DEST_NET_UNREACHABLE: rv = ipDestNetUnreachable; break;
+ case IP_DEST_HOST_UNREACHABLE: rv = ipDestHostUnreachable; break;
+ case IP_DEST_PROT_UNREACHABLE: rv = ipDestProtUnreachable; break;
+ case IP_DEST_PORT_UNREACHABLE: rv = ipDestPortUnreachable; break;
+ case IP_NO_RESOURCES: rv = ipNoResources; break;
+ case IP_BAD_OPTION: rv = ipBadOption; break;
+ case IP_HW_ERROR: rv = ipHWError; break;
+ case IP_PACKET_TOO_BIG: rv = ipPacketTooBig; break;
+ case IP_REQ_TIMED_OUT: rv = ipTimeOut; break;
+ case IP_BAD_REQ: rv = ipBadRequest; break;
+ case IP_BAD_ROUTE: rv = ipBadRoute; break;
+ case IP_TTL_EXPIRED_TRANSIT: rv = ipTTLExpiredInTransit; break;
+ case IP_TTL_EXPIRED_REASSEM: rv = ipTTLExpiredInReasm; break;
+ case IP_PARAM_PROBLEM: rv = ipParamProblem; break;
+ case IP_SOURCE_QUENCH: rv = ipSourceQuench; break;
+ case IP_OPTION_TOO_BIG: rv = ipOptionTooBig; break;
+ case IP_BAD_DESTINATION: rv = ipBadDest; break;
+ }
+ if(pStatus)
+ (*pStatus)=rv;
+ return lrv;
+}
+
+BOOL CICMPDll::AdjustBuffers(UINT packetSize)
+{
+ if(!packetSize)
+ packetSize=1;
+ if(packetSize>m_sizeOut){
+ if(m_sizeOut && m_bsOut)
+ delete m_bsOut;
+ m_bsOut = new BYTE[m_sizeOut=packetSize];
+ if(!m_bsOut)
+ return FALSE;
+ }
+UINT sin = sizeof(ICMPECHO)+SIZE_ICMP_HDR+packetSize;
+ if(sin>m_sizeIn){
+ if(m_sizeIn && m_bsIn)
+ delete m_bsIn;
+ m_bsIn = new BYTE[m_sizeIn=sin];
+ if(!m_bsIn)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+WORD CICMPWS::m_icmpSeq = 0;
+
+BOOL CICMPWS::Initialize()
+{
+ if(m_socket!=INVALID_SOCKET)
+ Deinitialize();
+ m_socket = socket(AF_INET,SOCK_RAW,1/*ICMP*/);
+ if(m_socket==INVALID_SOCKET)
+ return FALSE;
+ TRACE0("ICMP-WS Initialized\n");
+ return TRUE;
+}
+void CICMPWS::Deinitialize()
+{
+ if(m_socket!=INVALID_SOCKET){
+ closesocket(m_socket);
+ m_socket=INVALID_SOCKET;
+ }
+ if(m_sizeOut && m_bsOut){
+ delete m_bsOut;
+ m_bsOut = NULL; m_sizeOut = 0;
+ }
+ if(m_sizeIn && m_bsIn){
+ delete m_bsIn;
+ m_bsIn = NULL; m_sizeIn = 0;
+ }
+}
+LONG CICMPWS::Ping(const in_addr host,const UINT packetSize,
+ const UINT timeOut,LPINT pStatus)
+{
+ if(m_socket==INVALID_SOCKET){
+ if(pStatus)
+ (*pStatus)=icmpNotInitialized;
+ }
+ VERIFY(AdjustBuffers(packetSize));
+icmp* pPacket = (icmp*)m_bsOut;
+ memset(pPacket,0,m_sizeOut);
+ pPacket->icmp_type = ICMP_ECHO;
+ pPacket->icmp_seq = m_icmpSeq++;
+ pPacket->icmp_id = (WORD)(::GetCurrentThreadId()&0xFFFF);
+ for(UINT tmp=0;tmp<packetSize;tmp++)
+ pPacket->icmp_data[tmp]=tmp&0xFF;
+ pPacket->icmp_cksum = cksum(pPacket,SIZE_ICMP_HDR+packetSize);
+sockaddr_in to;
+ memset(&to,0,sizeof(to));
+ to.sin_addr.s_addr = host.s_addr;
+ to.sin_family = AF_INET;
+ if(sendto(m_socket,(char*)pPacket,SIZE_ICMP_HDR+packetSize,0,
+ (SOCKADDR*)&to,sizeof(to)) != (int)(SIZE_ICMP_HDR+packetSize)){
+ TRACE1("sendto: %lu\n",WSAGetLastError());
+ if(pStatus)
+ (*pStatus)=icmpSocketError;
+ return -1;
+ }
+DWORD sentTime = ::GetTickCount();
+sockaddr_in from;
+ memset(&from,0,sizeof(from));
+ from.sin_family=AF_INET;
+ from.sin_addr.s_addr=INADDR_ANY;
+fd_set fds;
+ FD_ZERO(&fds);
+ FD_SET(m_socket,&fds);
+long lrv = -1;
+INT rv = ipTimeOut;
+ for(;;){
+ DWORD ct = ::GetTickCount();
+ if((ct-sentTime)>=timeOut){
+ TRACE0("Timeout\n");
+ break;
+ }
+ timeval tv = {
+ (timeOut-ct+sentTime)/1000,
+ (timeOut-ct+sentTime)%1000
+ }; // tv_sec, tv_usec (secs,microsecs)
+ if(!select(m_socket,&fds,NULL,NULL,&tv)){
+ TRACE1("select: %d\n",WSAGetLastError());
+ break;
+ }
+ DWORD rtime = ::GetTickCount();
+ ASSERT(FD_ISSET(m_socket,&fds));
+ int fl = sizeof(from);
+ int rb = recvfrom(m_socket,(char*)m_bsIn,m_sizeIn,0,(SOCKADDR*)&from,&fl);
+ ip* pIP = (ip*)m_bsIn;
+ icmp* pICMP = (icmp*)&m_bsIn[sizeof(ip)];
+ if(pICMP->icmp_id!=pPacket->icmp_id)
+ continue;
+ if(pICMP->icmp_seq!=pPacket->icmp_seq)
+ continue;
+ if(from.sin_addr.s_addr!=host.s_addr)
+ continue;
+ if(pICMP->icmp_type==ICMP_ECHOREPLY){
+ lrv=rtime-sentTime;
+ rv=ipSuccess;
+ break;
+ }
+ rv = ipUnknown; // ***
+ break;
+ }
+ if(pStatus)
+ (*pStatus)=rv;
+ return lrv;
+}
+
+BOOL CICMPWS::AdjustBuffers(UINT packetSize)
+{
+ if(!packetSize)
+ packetSize=0;
+UINT osize = packetSize+SIZE_ICMP_HDR;
+ if(m_sizeOut<osize){
+ if(m_sizeOut && m_bsOut)
+ delete m_bsOut;
+ m_bsOut = new BYTE[m_sizeOut=osize];
+ if(!m_bsOut)
+ return FALSE;
+ }
+UINT isize = osize+sizeof(ip);
+ if(m_sizeIn<isize){
+ if(m_sizeIn && m_bsIn)
+ delete m_bsIn;
+ m_bsIn = new BYTE[m_sizeIn=isize];
+ if(!m_bsIn)
+ return FALSE;
+ }
+ return TRUE;
+}
+
+WORD CICMPWS::cksum(LPVOID data,int count)
+{
+long lSum = 0;
+WORD *pData = (WORD*)data;
+ while(count>0){
+ if(count>1){
+ lSum+=*(pData++);
+ count-=2;
+ }else{
+ lSum+=((WORD)*(BYTE*)pData)&0xFF;
+ count--;
+ }
+ }
+ lSum = (lSum&0xFFFF)+(lSum>>16);
+ lSum += (lSum>>16);
+ return (~lSum)&0xFFFF;
+}
+
+CICMP* CICMP::CreateICMP()
+{
+ if(m_mechanismus==_icmpUndetermined)
+ GuessMechanismus();
+ switch(m_mechanismus){
+ case _icmpWinsock:
+ return new CICMPWS;
+ break;
+ case _icmpDLL:
+ return new CICMPDll;
+ break;
+ }
+ return NULL;
+}
+
+void CICMP::GuessMechanismus()
+{
+ m_mechanismus=_icmpUndetermined;
+SOCKET testSocket = socket(AF_INET,SOCK_RAW,1);
+ if(testSocket!=INVALID_SOCKET){
+ closesocket(testSocket);
+ m_mechanismus=_icmpWinsock;
+ }else{
+ HINSTANCE hICMP = ::LoadLibraryEx("ICMP",NULL,0);
+ if(!hICMP)
+ return;
+ BOOL isThere = (
+ ::GetProcAddress(hICMP,"IcmpCreateFile")
+ && ::GetProcAddress(hICMP,"IcmpSendEcho")
+ && ::GetProcAddress(hICMP,"IcmpCloseHandle")
+ );
+ ::FreeLibrary(hICMP);
+ if(isThere)
+ m_mechanismus=_icmpDLL;
+ }
+} \ No newline at end of file
diff --git a/shared-code/kICMP.h b/shared-code/kICMP.h
new file mode 100644
index 0000000..7a5ceaa
--- a/dev/null
+++ b/shared-code/kICMP.h
@@ -0,0 +1,80 @@
+#ifndef __KICMP_H
+#define __KICMP_H
+
+class CICMP {
+ enum _mechanismus {
+ _icmpUndetermined = -1,
+ _icmpWinsock = 0, _icmpDLL
+ };
+static _mechanismus m_mechanismus;
+static void GuessMechanismus();
+public:
+static
+ CICMP* CreateICMP();
+
+ enum {
+ ipSuccess = 0,
+ ipBuffTooSmall, ipDestNetUnreachable, ipDestHostUnreachable,
+ ipDestProtUnreachable, ipDestPortUnreachable, ipNoResources,
+ ipBadOption, ipHWError, ipPacketTooBig, ipTimeOut, ipBadRequest,
+ ipBadRoute, ipTTLExpiredInTransit, ipTTLExpiredInReasm,
+ ipParamProblem, ipSourceQuench, ipOptionTooBig, ipBadDest,
+ ipUnknown = -1,
+ icmpNotInitialized = -2,
+ icmpSocketError = -3
+ };
+
+ virtual BOOL Initialize() = 0;
+ virtual void Deinitialize() = 0;
+
+ virtual LONG Ping(const in_addr host,const UINT packetSize=0,
+ const UINT timeOut=10000,LPINT pStatus=NULL) = 0;
+};
+
+class CICMPDll : public CICMP {
+ HANDLE (WINAPI *m_icmpCF)(VOID);
+ BOOL (WINAPI *m_icmpSE)(HANDLE,ULONG,LPVOID,WORD,
+ PIPINFO,LPVOID,DWORD,DWORD);
+ BOOL (WINAPI *m_icmpCH)(HANDLE);
+public:
+ HINSTANCE m_hICMPDLL;
+ HANDLE m_hICMP;
+ LPBYTE m_bsIn, m_bsOut;
+ UINT m_sizeIn, m_sizeOut;
+
+ CICMPDll() : m_hICMP(INVALID_HANDLE_VALUE), m_hICMPDLL(NULL),
+ m_bsIn(NULL), m_bsOut(NULL), m_sizeIn(0), m_sizeOut(0) {}
+ virtual ~CICMPDll() { Deinitialize(); }
+
+ virtual BOOL Initialize();
+ virtual void Deinitialize();
+
+ virtual LONG Ping(const in_addr host,const UINT packetSize=0,
+ const UINT timeOut=10000,LPINT pStatus=NULL);
+
+ BOOL AdjustBuffers(UINT packetSize=0);
+};
+
+class CICMPWS : public CICMP {
+static
+ WORD m_icmpSeq;
+public:
+ SOCKET m_socket;
+ LPBYTE m_bsIn, m_bsOut;
+ UINT m_sizeIn, m_sizeOut;
+
+ CICMPWS() : m_socket(INVALID_SOCKET), m_bsIn(NULL), m_bsOut(NULL),
+ m_sizeIn(0), m_sizeOut(0) {}
+ virtual ~CICMPWS() { Deinitialize(); }
+
+ virtual BOOL Initialize();
+ virtual void Deinitialize();
+
+ virtual LONG Ping(const in_addr host,const UINT packetSize=0,
+ const UINT timeOut=10000,LPINT pStatus=NULL);
+
+ BOOL AdjustBuffers(UINT packetSize=0);
+ WORD cksum(LPVOID data,int count);
+};
+
+#endif // __KICMP_H \ No newline at end of file
diff --git a/shared-code/kinhelp.xsl b/shared-code/kinhelp.xsl
new file mode 100644
index 0000000..0bb384a
--- a/dev/null
+++ b/shared-code/kinhelp.xsl
@@ -0,0 +1,250 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ >
+ <xsl:output
+ method="text"
+ encoding="us-ascii"/>
+ <xsl:strip-space elements="*"/>
+
+ <xsl:template match="winhelp">
+ <xsl:text>{\rtf1\ansi</xsl:text>
+ <xsl:text>&#xA;@{\footnote</xsl:text>
+ <xsl:text>&#xA;THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.</xsl:text>
+ <xsl:text>&#xA;DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD</xsl:text>
+ <xsl:text>&#xA;}&#xA;</xsl:text>
+ <xsl:call-template name="fonttbl"/>
+ <xsl:call-template name="colortbl"/>
+ <xsl:apply-templates/>
+ <xsl:text>}</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="topic">
+ <xsl:text>&#xA;\pard\plain</xsl:text>
+ <xsl:if test="descendant::*[ (@scroll='no') and
+ count(preceding-sibling::*[not(@scroll='no') and (name()!='a' and @name)])=0] ">
+ <xsl:text>\keepn</xsl:text>
+ </xsl:if>
+ <xsl:if test="@id">
+ <xsl:text>&#xA;#{\footnote </xsl:text>
+ <xsl:value-of select="@id"/>
+ <xsl:text>}</xsl:text>
+ </xsl:if>
+ <xsl:if test="@title">
+ <xsl:text>&#xA;${\footnote </xsl:text>
+ <xsl:value-of select="@title"/>
+ <xsl:text>}</xsl:text>
+ </xsl:if>
+ <xsl:if test="@keywords">
+ <xsl:text>&#xA;K{\footnote </xsl:text>
+ <xsl:value-of select="@keywords"/>
+ <xsl:text>}</xsl:text>
+ </xsl:if>
+ <xsl:apply-templates/>
+ <xsl:text>&#xA;\page&#xA;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="a[@name]">
+ <xsl:text>{#{\footnote </xsl:text>
+ <xsl:value-of select="@name"/>
+ <xsl:text>}}</xsl:text>
+ </xsl:template>
+ <xsl:template match="a[@href]">
+ <xsl:call-template name="hyperref">
+ <xsl:with-param name="href" select="@href"/>
+ <xsl:with-param name="inset"><xsl:apply-templates/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:template>
+ <xsl:template name="hyperref">
+ <xsl:param name="href"/>
+ <xsl:param name="inset"/>
+ <xsl:choose>
+ <xsl:when test="starts-with($href,'http:') or starts-with($href,'mailto:') or
+ starts-with($href,'ftp:')">
+ <xsl:text>{\uldb </xsl:text>
+ <xsl:value-of select="$inset"/>
+ <xsl:text>}{\v %!ExecFile("</xsl:text>
+ <xsl:value-of select="$href"/>
+ <xsl:text>")}</xsl:text>
+ </xsl:when>
+ <xsl:when test="starts-with($href,'#')">
+ <xsl:text>{\uldb </xsl:text>
+ <xsl:value-of select="$inset"/>
+ <xsl:text>}{\v </xsl:text>
+ <xsl:value-of select="substring($href,2)"/>
+ <xsl:text>}</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message>Warining: Unqualified hyper-reference. Using as help-internal</xsl:message>
+ <xsl:text>{\uldb </xsl:text>
+ <xsl:value-of select="$inset"/>
+ <xsl:text>}{\v </xsl:text>
+ <xsl:value-of select="$href"/>
+ <xsl:text>}</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template match="heading">
+ <xsl:text>&#xA;</xsl:text>
+ <xsl:if test="@scroll!='no'">
+ <xsl:text>\pard </xsl:text>
+ </xsl:if>
+ <xsl:text>{ \f1\fs18\b\sb120 </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>}</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="p">
+ <xsl:text>&#xA;\par\sa120\sb120\qj</xsl:text>
+ <xsl:if test="@scroll!='no'">
+ <xsl:text>\pard</xsl:text>
+ </xsl:if>
+ <xsl:text> \f1\fs18\sb120 </xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="note">
+ <xsl:text>&#xA;\par\sa120\sb120\qj\f1\fs16 </xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="dedication">
+ <xsl:text>&#xA;\par\sa120\sb120\qr\f1\fs16 </xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="image">
+ <xsl:text>\{bmct </xsl:text>
+ <xsl:value-of select="@source"/>
+ <xsl:text>\}</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="newsfor">
+ <xsl:text>&#xA;\par\pard\plain\f1\fs24\qc\cf2\b </xsl:text>
+ <xsl:value-of select="@version"/>
+ <xsl:text> - </xsl:text>
+ <xsl:value-of select="@date"/>
+ <xsl:apply-templates/>
+ </xsl:template>
+ <xsl:template match="ni">
+ <xsl:text>&#xA;\par\pard\plain\fi0\li0\f1\fs18 \bullet </xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="b">
+ <xsl:text>{\b </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>}</xsl:text>
+ </xsl:template>
+ <xsl:template match="i">
+ <xsl:text>{\i </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>}</xsl:text>
+ </xsl:template>
+ <xsl:template match="u">
+ <xsl:text>{\ul </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>}</xsl:text>
+ </xsl:template>
+ <xsl:template match="strike">
+ <xsl:text>{\strike </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>}</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="kin">
+ <xsl:choose>
+ <xsl:when test="@href">
+ <xsl:call-template name="hyperref">
+ <xsl:with-param name="href" select="@href"/>
+ <xsl:with-param name="inset"><xsl:text>{\b </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>{\b </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>}</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="product">
+ <xsl:choose>
+ <xsl:when test="@href">
+ <xsl:call-template name="hyperref">
+ <xsl:with-param name="href" select="@href"/>
+ <xsl:with-param name="inset"><xsl:text>{\b\cf6 </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>{\b\cf6 </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>}</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+ <xsl:template match="term">
+ <xsl:text>{\i </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>}</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="rfc">
+ <xsl:call-template name="hyperref">
+ <xsl:with-param name="href" select="concat('http://www.rfc-editor.org/rfc/rfc',@num,'.txt')"/>
+ <xsl:with-param name="inset" select="concat('{\b RFC',@num,'}')"/>
+ </xsl:call-template>
+ </xsl:template>
+
+ <xsl:template match="license">
+ <xsl:text>&#xA;{</xsl:text>
+ <xsl:text>&#xA;\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) </xsl:text>
+ <xsl:value-of select="@years"/>
+ <xsl:text> {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")}</xsl:text>
+ <xsl:text>&#xA;\par\qj\sb120\sa120</xsl:text>
+ <xsl:text>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</xsl:text>
+ <xsl:text>&#xA;\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</xsl:text>
+ <xsl:text>&#xA;\par \sa360 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</xsl:text>
+ <xsl:text>&#xA;}</xsl:text>
+ </xsl:template>
+ <xsl:template match="credits">
+ <xsl:text>&#xA;\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")}</xsl:text>
+ <xsl:text>&#xA;\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="ul">
+ <xsl:text>\pard</xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>\pard</xsl:text>
+ </xsl:template>
+ <xsl:template match="li">
+ <!-- TODO: could be done better, but you never know with winhelp.. -->
+ <xsl:variable name="li" select=" count(ancestor::ul) "/>
+ <xsl:text>&#xA;\par \fi0\li</xsl:text><xsl:value-of
+ select="0"/><xsl:text> \bullet </xsl:text>
+ <xsl:apply-templates/>
+ </xsl:template>
+
+ <xsl:template match="topic/text()">
+ <!-- maybe only omit spaces? -->
+ </xsl:template>
+ <xsl:template match="ul/text()">
+ </xsl:template>
+
+ <xsl:template name="colortbl">
+ <xsl:text>{\colortbl;
+ \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
+ \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
+ \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
+ \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+ </xsl:text>
+ </xsl:template>
+ <xsl:template name="fonttbl">
+ <xsl:text>{\fonttbl</xsl:text>
+ <xsl:text>{\f0\froman Times New Roman;}</xsl:text>
+ <xsl:text>{\f1\fswiss Arial;}</xsl:text>
+ <xsl:text>{\f3\froman Symbol;}</xsl:text>
+ <xsl:text>}</xsl:text>
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/shared-code/ms_icmp.h b/shared-code/ms_icmp.h
new file mode 100644
index 0000000..32d97f5
--- a/dev/null
+++ b/shared-code/ms_icmp.h
@@ -0,0 +1,77 @@
+/*------------------------------------------------------------------
+* Filename: MS_ICMP.H
+*
+* Description: Prototypes of Microsoft's ICMP.DLL functions for
+* access to Internet Control Message Protocol (their stacks do
+* not support the standard Berkeley Sockets raw socket API).
+* Use this to do "ping" or "traceroute," although beware that
+* Microsoft discourages its use.
+*/
+
+
+/* Note 2: For the most part, you can refer to RFC 791 for detials on
+* how to fill in values for the IP option information structure. */
+typedef struct ip_option_information {
+ u_char Ttl; /* Time To Live (used for traceroute) */
+ u_char Tos; /* Type Of Service (usually 0) */
+ u_char Flags; /* IP header flags (usually 0) */
+ u_char OptionsSize; /* Size of options data (usually 0, max 40) */
+ u_char FAR *OptionsData;/* Options data buffer */
+} IPINFO, *PIPINFO, FAR *LPIPINFO;
+
+/* Note 1: The Reply Buffer will have an array of ICMP_ECHO_REPLY
+* structures, followed by options and the data in ICMP echo reply
+* datagram received. You must have room for at least one ICMP
+* echo reply structure, plus 8 bytes for an ICMP header. */
+typedef struct icmp_echo_reply {
+ u_long Address; /* source address */
+ u_long Status; /* IP status value (see below) */
+ u_long RTTime; /* Round Trip Time in milliseconds */
+ u_short DataSize; /* reply data size */
+ u_short Reserved; /* */
+ void FAR *Data; /* reply data buffer */
+ typedef struct ip_option_information Options; /* reply options */
+} ICMPECHO, *PICMPECHO, FAR *LPICMPECHO;
+
+#define IP_STATUS_BASE 11000
+#define IP_SUCCESS 0
+#define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1)
+#define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2)
+#define IP_DEST_HOST_UNREACHABLE (IP_STATUS_BASE + 3)
+#define IP_DEST_PROT_UNREACHABLE (IP_STATUS_BASE + 4)
+#define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
+#define IP_NO_RESOURCES (IP_STATUS_BASE + 6)
+#define IP_BAD_OPTION (IP_STATUS_BASE + 7)
+#define IP_HW_ERROR (IP_STATUS_BASE + 8)
+#define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9)
+#define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10)
+#define IP_BAD_REQ (IP_STATUS_BASE + 11)
+#define IP_BAD_ROUTE (IP_STATUS_BASE + 12)
+#define IP_TTL_EXPIRED_TRANSIT (IP_STATUS_BASE + 13)
+#define IP_TTL_EXPIRED_REASSEM (IP_STATUS_BASE + 14)
+#define IP_PARAM_PROBLEM (IP_STATUS_BASE + 15)
+#define IP_SOURCE_QUENCH (IP_STATUS_BASE + 16)
+#define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17)
+#define IP_BAD_DESTINATION (IP_STATUS_BASE + 18)
+#define IP_ADDR_DELETED (IP_STATUS_BASE + 19)
+#define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 20)
+#define IP_MTU_CHANGE (IP_STATUS_BASE + 21)
+#define IP_UNLOAD (IP_STATUS_BASE + 22)
+#define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50)
+#define MAX_IP_STATUS IP_GENERAL_FAILURE
+#define IP_PENDING (IP_STATUS_BASE + 255)
+
+
+HANDLE WINAPI PASCAL IcmpCreateFile(VOID); /* INVALID_HANDLE_VALUE on error */
+BOOL WINAPI PASCAL IcmpCloseHandle(HANDLE IcmpHandle); /* FALSE on error */
+DWORD WINAPI PASCAL IcmpSendEcho(
+ HANDLE IcmpHandle, /* handle returned from IcmpCreateFile() */
+ u_long DestAddress, /* destination IP address (in network order) */
+ LPVOID RequestData, /* pointer to buffer to send */
+ WORD RequestSize, /* length of data in buffer */
+ LPIPINFO RequestOptns, /* see Note 2 below */
+ LPVOID ReplyBuffer, /* see Note 1 below */
+ DWORD ReplySize, /* length of reply (must allow at least 1 reply) */
+ DWORD Timeout /* time in milliseconds to wait for reply */
+);
+
diff --git a/shared-data/browse-icon.ico b/shared-data/browse-icon.ico
new file mode 100644
index 0000000..d2d1b3c
--- a/dev/null
+++ b/shared-data/browse-icon.ico
Binary files differ
diff --git a/shared-data/install-icon.ico b/shared-data/install-icon.ico
new file mode 100644
index 0000000..23e86a6
--- a/dev/null
+++ b/shared-data/install-icon.ico
Binary files differ
diff --git a/shared-data/klever-background.bmp b/shared-data/klever-background.bmp
new file mode 100644
index 0000000..e4d87ec
--- a/dev/null
+++ b/shared-data/klever-background.bmp
Binary files differ
diff --git a/shared-data/play-icon.ico b/shared-data/play-icon.ico
new file mode 100644
index 0000000..3d2a11e
--- a/dev/null
+++ b/shared-data/play-icon.ico
Binary files differ
diff --git a/stdafx.cpp b/stdafx.cpp
new file mode 100644
index 0000000..056a28f
--- a/dev/null
+++ b/stdafx.cpp
@@ -0,0 +1,6 @@
+// stdafx.cpp : source file that includes just the standard includes
+// Dipstick.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
diff --git a/stdafx.h b/stdafx.h
new file mode 100644
index 0000000..06ef43f
--- a/dev/null
+++ b/stdafx.h
@@ -0,0 +1,36 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows 95 Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <afxsock.h> // MFC socket extensions
+
+#include <afxole.h>
+#include <afxtempl.h>
+#include <afxmt.h>
+
+#include <winsock.h>
+#include "shared-code/ms_icmp.h"
+#include "shared-code/ip_icmp.h"
+
+#include "shared-code/kICMP.h"
+#include "shared-code/RegEx.h"
+#include "CrackURL.h"
+
+enum {
+ WM_DNP_ACTIVITYCOUNT = WM_USER+16,
+ WM_DNP_URLPING,
+ WM_DNP_UPDATEHOSTDATA,
+ WM_DNP_HTML
+};
+#include <MMSystem.h>
+// CG: The following line was added by the Windows Multimedia component.
+#pragma comment(lib, "winmm.lib")