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) (unidiff)
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 @@
1
2# /
3/Debug
4/Release
5/Releast
6/debug
7/release
8/releast
9/DEBUG
10/RELEASE
11/RELEAST
12/*.mdp
13/*.ncb
14/*.aps
15/redist
16
17# /help/
18/help/DIPSTICK.HLP
19/help/dipstick.LOG
20/help/dipstick.hm
21/help/dipstick.GID
22
23# /install/
24/install/debug
25/install/pure
26/install/canned
27/install/static
28/install/Debug
29/install/Pure
30/install/Canned
31/install/Static
32/install/DEBUG
33/install/PURE
34/install/CANNED
35/install/STATIC
36/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 @@
1// AutoBestDlg.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "Dipstick.h"
6#include "AutoBestDlg.h"
7
8#include "URLSource.h"
9
10#ifdef _DEBUG
11#define new DEBUG_NEW
12#undef THIS_FILE
13static char THIS_FILE[] = __FILE__;
14#endif
15
16/////////////////////////////////////////////////////////////////////////////
17// CAutoBestDlg dialog
18
19
20CAutoBestDlg::CAutoBestDlg(CWnd* pParent /*=NULL*/)
21 : CDialog(CAutoBestDlg::IDD, pParent)
22{
23 //{{AFX_DATA_INIT(CAutoBestDlg)
24 m_PktLoss = _T("");
25 m_RTT = _T("");
26 m_URL = _T("");
27 //}}AFX_DATA_INIT
28}
29
30
31void CAutoBestDlg::DoDataExchange(CDataExchange* pDX)
32{
33 CDialog::DoDataExchange(pDX);
34 //{{AFX_DATA_MAP(CAutoBestDlg)
35 DDX_Control(pDX, IDC_DROPSOURCE, m_DropSourceCtl);
36 DDX_Control(pDX, IDC_PREV, m_PrevCtl);
37 DDX_Control(pDX, IDC_NEXT, m_NextCtl);
38 DDX_Text(pDX, IDC_PKTLOSS, m_PktLoss);
39 DDX_Text(pDX, IDC_RTT, m_RTT);
40 DDX_Text(pDX, IDC_URL, m_URL);
41 //}}AFX_DATA_MAP
42}
43
44
45BEGIN_MESSAGE_MAP(CAutoBestDlg, CDialog)
46 //{{AFX_MSG_MAP(CAutoBestDlg)
47 ON_BN_CLICKED(IDC_NEXT, OnNext)
48 ON_BN_CLICKED(IDC_PREV, OnPrev)
49 ON_WM_LBUTTONDOWN()
50 ON_BN_CLICKED(IDC_COPYURL, OnCopyurl)
51 ON_WM_HELPINFO()
52 //}}AFX_MSG_MAP
53END_MESSAGE_MAP()
54
55/////////////////////////////////////////////////////////////////////////////
56// CAutoBestDlg message handlers
57
58void CAutoBestDlg::OnNext()
59{
60 EndDialog(IDC_NEXT);
61}
62
63void CAutoBestDlg::OnPrev()
64{
65 EndDialog(IDC_PREV);
66}
67
68BOOL CAutoBestDlg::OnInitDialog()
69{
70 CDialog::OnInitDialog();
71
72 m_NextCtl.EnableWindow(m_bNext);
73 m_PrevCtl.EnableWindow(m_bPrev);
74
75 VERIFY(m_DropSourceCtl.Open(IDR_DRAGAVI));
76 SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
77
78 return TRUE; // return TRUE unless you set the focus to a control
79 // EXCEPTION: OCX Property Pages should return FALSE
80}
81
82CAutoBestDlg::~CAutoBestDlg()
83{
84}
85
86void CAutoBestDlg::OnLButtonDown(UINT nFlags, CPoint point)
87{
88 if(ChildWindowFromPoint(point,CWP_ALL)==&m_DropSourceCtl){
89 TRACE0("Dragging!\n");
90 CURLSource us(m_URL);
91 m_DropSourceCtl.Stop();
92 us.DoDragDrop(DROPEFFECT_COPY|DROPEFFECT_LINK);
93 m_DropSourceCtl.Play(0,-1,-1);
94 }else
95 CDialog::OnLButtonDown(nFlags, point);
96}
97
98void CAutoBestDlg::OnCopyurl()
99{
100CURLSource *us = new CURLSource(m_URL);
101 us->SetClipboard();
102 us->FlushClipboard();
103}
104
105BOOL CAutoBestDlg::OnHelpInfo(HELPINFO* pHelpInfo)
106{
107 WinHelp(IDD|0x20000l);
108 return TRUE;
109}
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 @@
1// AutoBestDlg.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CAutoBestDlg dialog
6
7class CAutoBestDlg : public CDialog
8{
9// Construction
10public:
11 ~CAutoBestDlg();
12 BOOL m_bPrev;
13 BOOL m_bNext;
14 CAutoBestDlg(CWnd* pParent = NULL); // standard constructor
15
16// Dialog Data
17 //{{AFX_DATA(CAutoBestDlg)
18 enum { IDD = IDD_AUTOBEST };
19 CAnimateCtrlm_DropSourceCtl;
20 CButtonm_PrevCtl;
21 CButtonm_NextCtl;
22 CStringm_PktLoss;
23 CStringm_RTT;
24 CStringm_URL;
25 //}}AFX_DATA
26
27
28// Overrides
29 // ClassWizard generated virtual function overrides
30 //{{AFX_VIRTUAL(CAutoBestDlg)
31 protected:
32 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
33 //}}AFX_VIRTUAL
34
35// Implementation
36protected:
37
38 // Generated message map functions
39 //{{AFX_MSG(CAutoBestDlg)
40 afx_msg void OnNext();
41 afx_msg void OnPrev();
42 virtual BOOL OnInitDialog();
43 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
44 afx_msg void OnCopyurl();
45 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
46 //}}AFX_MSG
47 DECLARE_MESSAGE_MAP()
48};
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..ad23259
--- a/dev/null
+++ b/COPYING
@@ -0,0 +1,19 @@
1Copyright (c) 1996, 1997, 1998, 2002 Klever Group (http://www.klever.net/)
2
3Permission is hereby granted, free of charge, to any person obtaining a copy of
4this software and associated documentation files (the "Software"), to deal in
5the Software without restriction, including without limitation the rights to
6use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7of the Software, and to permit persons to whom the Software is furnished to do
8so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in all
11copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19SOFTWARE.
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 @@
1#include "stdafx.h"
2#include "CrackURL.h"
3
4CCrackURL::CCrackURL()
5{
6 VERIFY(m_reSchema.Compile("([[:alpha:]]+):",CRegEx::regExtended|CRegEx::regIgnoreCase));
7 VERIFY(m_reUPHP.Compile("(([^:]+)?(:([^@]*))?@)?([^:/]+)(:([[:digit:]]+))?",CRegEx::regExtended|CRegEx::regIgnoreCase));
8 VERIFY(m_reHTTPReq.Compile("(.*/)?([^#\\?]*)(#[^\\?]*)?(\\?.*)?",CRegEx::regExtended|CRegEx::regIgnoreCase));
9}
10
11BOOL CCrackURL::Crack(LPCTSTR url)
12{
13 m_URL = url;
14CString rest;
15 if(m_reSchema.Match(url)){
16 m_Schema = m_reSchema.GetMatch(1);
17 rest = m_reSchema.GetMatch(CRegEx::matchPostMatch);
18 }else{
19 m_Schema.Empty();
20 rest = url;
21 }
22 if(rest.Left(2)=="//"){
23 // URL conforms to common syntax
24 rest=rest.Mid(2);
25 ParseUPHP(rest);
26 }else if(!m_Schema.CompareNoCase("mailto")){
27 ParseUPHP(rest);
28 }else{
29 m_User.Empty(); m_Password.Empty(); m_Host.Empty(); m_Port.Empty();
30 }
31 if((!rest.IsEmpty()) && m_reHTTPReq.Match(rest)){
32 m_pathPath = m_reHTTPReq.GetMatch(1);
33 m_pathFile = m_reHTTPReq.GetMatch(2);
34 m_pathAnchor = m_reHTTPReq.GetMatch(3);
35 m_pathQuery = m_reHTTPReq.GetMatch(4);
36 m_URLPath = m_reHTTPReq.GetMatch(CRegEx::matchMatch);
37 rest = m_reHTTPReq.GetMatch(CRegEx::matchPostMatch);
38 }else{
39 m_URLPath.Empty();
40 m_pathPath.Empty();
41 m_pathFile.Empty();
42 m_pathAnchor.Empty();
43 m_pathQuery.Empty();
44 }
45 m_urlRest = rest;
46 return TRUE;
47}
48
49void CCrackURL::ParseUPHP(CString& rest)
50{
51 if(m_reUPHP.Match(rest)){
52 m_User = m_reUPHP.GetMatch(2);
53 m_Password = m_reUPHP.GetMatch(4);
54 m_Host = m_reUPHP.GetMatch(5);
55 m_Port = m_reUPHP.GetMatch(7);
56 if(!m_Port.IsEmpty())
57 m_nPort = atoi(m_Port);
58 rest = m_reUPHP.GetMatch(CRegEx::matchPostMatch);
59 }else{
60 m_User.Empty();
61 m_Password.Empty();
62 m_Host.Empty();
63 m_Port.Empty();
64 }
65}
66
67BOOL CCrackURL::Adjust(LPCTSTR srcURL)
68{
69CCrackURL cracked;
70 VERIFY(cracked.Crack(srcURL));
71 return Adjust(cracked);
72}
73
74BOOL CCrackURL::Adjust(CCrackURL& srcURL)
75{
76 if(m_Schema.IsEmpty()) m_Schema = srcURL.m_Schema;
77 if(m_Host.IsEmpty()){
78 m_Host = srcURL.m_Host;
79 if(m_User.IsEmpty()) m_User = srcURL.m_User;
80 if(m_Password.IsEmpty()) m_Password = srcURL.m_Password;
81 if(m_Port.IsEmpty()) m_Port = srcURL.m_Port, m_nPort = srcURL.m_nPort;
82 }
83 if(m_pathPath.Find('/')==0)
84 return TRUE;
85 m_pathPath = srcURL.m_pathPath+m_pathPath;
86 m_URLPath.Empty();
87 return TRUE;
88}
89
90CString CCrackURL::Build()
91{
92CString rv;
93 if(!m_Schema.IsEmpty())
94 rv+=m_Schema+':';
95 if(!m_Schema.CompareNoCase("mailto")){
96 rv+=m_User+'@'+m_Host;
97 }else{
98 rv+="//";
99 if(!m_User.IsEmpty()){
100 rv+=m_User;
101 if(!m_Password.IsEmpty())
102 rv+=':'+m_Password;
103 rv+='@';
104 }
105 rv+=m_Host;
106 if(!m_Port.IsEmpty())
107 rv+=':'+m_Port;
108 if(!m_URLPath.IsEmpty()){
109 rv+=m_URLPath;
110 }else{
111 rv+=m_pathPath+m_pathFile+m_pathAnchor+m_pathQuery;
112 }
113 }
114 return rv;
115}
116
117CString CCrackURL::InnermostURL(LPCTSTR url)
118{
119static CRegEx reInnerURL;
120 if(!reInnerURL.m_bCompiled)
121 VERIFY(reInnerURL.Compile(".+[^[:alpha:]]([[:alpha:]]+://[^&]+)",CRegEx::regExtended|CRegEx::regIgnoreCase));
122CString rv = url;
123 while(reInnerURL.Match(rv))
124 rv=reInnerURL.GetMatch(1);
125 return rv;
126}
127
128CString CCrackURL::GetHostName(LPCTSTR url)
129{
130static CRegEx reHost;
131 if(!reHost.m_bCompiled)
132 VERIFY(reHost.Compile("^[[:alpha:]]+://([^/:]+)",CRegEx::regExtended|CRegEx::regIgnoreCase));
133CString rv;
134 if(reHost.Match(url))
135 rv = reHost.GetMatch(1);
136 else
137 rv = url;
138 return rv;
139}
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 @@
1 #ifndef__CRACKURL_H
2 #define__CRACKURL_H
3
4#include "shared-code/RegEx.h"
5
6 class CCrackURL{
7public:
8 static CString GetHostName(LPCTSTR url);
9 static CString InnermostURL(LPCTSTR url);
10 CString Build();
11 BOOL Adjust(CCrackURL& srcURL);
12 CString m_pathPath;
13 CString m_pathFile;
14 CString m_pathAnchor;
15 CString m_pathQuery;
16 CString m_urlRest;
17 BOOL Adjust(LPCTSTR srcURL);
18 CRegEx m_reHTTPReq;
19 CRegEx m_reUPHP;
20 CString m_URLPath;
21 UINT m_nPort;
22 CString m_Port;
23 CString m_Host;
24 CString m_Password;
25 CString m_User;
26 void ParseUPHP(CString& rest);
27 CString m_Schema;
28 CString m_URL;
29 BOOL Crack(LPCTSTR url);
30 CCrackURL();
31 CRegExm_reSchema;
32};
33
34 #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 @@
1// DipstickDlg.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "Dipstick.h"
6#include "DipstickDlg.h"
7#include "DragPad.h"
8#include "OptionsDlg.h"
9#include "HostNameDlg.h"
10#include "HostProperties.h"
11#include "AutoBestDlg.h"
12#include "ddeml.h"
13
14#include "URLSource.h"
15#include "SelectURLsDlg.h"
16
17#ifdef _DEBUG
18#define new DEBUG_NEW
19#undef THIS_FILE
20static char THIS_FILE[] = __FILE__;
21#endif
22
23/////////////////////////////////////////////////////////////////////////////
24// CAboutDlg dialog used for App About
25
26class CAboutDlg : public CDialog
27{
28public:
29 CAboutDlg();
30
31// Dialog Data
32 //{{AFX_DATA(CAboutDlg)
33 enum { IDD = IDD_ABOUTBOX };
34 //}}AFX_DATA
35
36 // ClassWizard generated virtual function overrides
37 //{{AFX_VIRTUAL(CAboutDlg)
38 protected:
39 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
40 //}}AFX_VIRTUAL
41
42// Implementation
43protected:
44 virtual BOOL OnInitDialog();
45 //{{AFX_MSG(CAboutDlg)
46 afx_msg void OnKlevernet();
47 //}}AFX_MSG
48 DECLARE_MESSAGE_MAP()
49};
50
51CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
52{
53 //{{AFX_DATA_INIT(CAboutDlg)
54 //}}AFX_DATA_INIT
55}
56
57void CAboutDlg::DoDataExchange(CDataExchange* pDX)
58{
59 CDialog::DoDataExchange(pDX);
60 //{{AFX_DATA_MAP(CAboutDlg)
61 //}}AFX_DATA_MAP
62}
63
64BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
65 //{{AFX_MSG_MAP(CAboutDlg)
66 ON_BN_CLICKED(IDC_KLEVERNET, OnKlevernet)
67 //}}AFX_MSG_MAP
68END_MESSAGE_MAP()
69
70/////////////////////////////////////////////////////////////////////////////
71// CDipstickDlg dialog
72
73CDipstickDlg::CDipstickDlg(CWnd* pParent /*=NULL*/)
74 : CDialog(CDipstickDlg::IDD, pParent),
75 m_DragPad(NULL), m_PingsPerHost(10), m_PingSize(32), m_TimeOut(5000), m_Interval(500),
76 m_SortCriteria(sortAvg), m_bShown(FALSE), m_MaxThreads(10), m_bExiting(FALSE),
77 m_bMSWorkAround(TRUE), m_MinSize(-1,-1), m_bAutoBest(TRUE), m_bSmartAdjust(TRUE),
78 m_bAdjustInnermost(TRUE), m_ActiveThreads(0), m_bIgnorelative(TRUE)
79{
80CWinApp *app = AfxGetApp();
81 ASSERT(app);
82WORD hi,lo;
83 hi=app->GetProfileInt("Options","IntervalHi",HIWORD(m_Interval));
84 lo=app->GetProfileInt("Options","IntervalLo",LOWORD(m_Interval));
85 m_Interval=MAKELONG(lo,hi);
86 m_MaxThreads=app->GetProfileInt("Options","MaxThreads",m_MaxThreads);
87 m_PingSize=app->GetProfileInt("Options","PingSize",m_PingSize);
88 m_PingsPerHost=app->GetProfileInt("Options","PingsPerHost",m_PingsPerHost);
89 m_SortCriteria=app->GetProfileInt("Options","SortBy",m_SortCriteria);
90 hi=app->GetProfileInt("Options","TimeOutHi",HIWORD(m_TimeOut));
91 lo=app->GetProfileInt("Options","TimeOutLo",LOWORD(m_TimeOut));
92 m_TimeOut=MAKELONG(lo,hi);
93 m_bMSWorkAround = app->GetProfileInt("Options","InnermostURL",m_bMSWorkAround);
94 m_bAutoBest = app->GetProfileInt("Options","AutoBest",m_bAutoBest);
95 m_bSmartAdjust = app->GetProfileInt("Options","SmartAdjust",m_bSmartAdjust);
96 m_bAdjustInnermost = app->GetProfileInt("Options","AdjustInnermost",m_bAdjustInnermost);
97 m_bIgnorelative = app->GetProfileInt("Options","IgnoreRelative",m_bIgnorelative);
98 m_impexPath = app->GetProfileString("Options","ImportExportPath",m_impexPath);
99 //{{AFX_DATA_INIT(CDipstickDlg)
100 //}}AFX_DATA_INIT
101 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
102 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
103 m_bmpBack.LoadBitmap(IDB_DIABACK);
104 m_bmpBack.GetBitmap(&m_bitmapBack);
105CString tmp;
106 VERIFY(tmp.LoadString(IDS_REGEX_HTMLURL));
107 VERIFY(m_reHTMLURL.Compile(tmp,CRegEx::regExtended|CRegEx::regIgnoreCase));
108}
109
110CDipstickDlg::~CDipstickDlg()
111{
112}
113
114void CDipstickDlg::DoDataExchange(CDataExchange* pDX)
115{
116 CDialog::DoDataExchange(pDX);
117 //{{AFX_DATA_MAP(CDipstickDlg)
118 DDX_Control(pDX, IDC_ADVANCED, m_AdvancedCtl);
119 DDX_Control(pDX, ID_HELP, m_HelpCtl);
120 DDX_Control(pDX, IDC_EXIT, m_ExitCtl);
121 DDX_Control(pDX, IDC_OPTIONS, m_OptionsCtl);
122 DDX_Control(pDX, IDC_MANUALPING, m_ManualPingCtl);
123 DDX_Control(pDX, IDC_REMOVE, m_RemoveCtl);
124 DDX_Control(pDX, IDC_REPINGALL, m_RepingAllCtl);
125 DDX_Control(pDX, IDC_REPING, m_RepingCtl);
126 DDX_Control(pDX, IDC_CLEAR, m_ClearListCtl);
127 DDX_Control(pDX, IDC_HOSTLIST, m_HostList);
128 //}}AFX_DATA_MAP
129}
130
131BEGIN_MESSAGE_MAP(CDipstickDlg, CDialog)
132 //{{AFX_MSG_MAP(CDipstickDlg)
133 ON_WM_SYSCOMMAND()
134 ON_WM_PAINT()
135 ON_WM_QUERYDRAGICON()
136 ON_WM_DESTROY()
137 ON_BN_CLICKED(IDC_OPTIONS, OnOptions)
138 ON_MESSAGE(WM_DNP_URLPING, OnUrlPing)
139 ON_MESSAGE(WM_DNP_ACTIVITYCOUNT, OnActivityCount)
140 ON_MESSAGE(WM_DNP_UPDATEHOSTDATA, OnUpdateHostData)
141 ON_MESSAGE(WM_DNP_HTML, OnHTMLTransfer)
142 ON_NOTIFY(LVN_COLUMNCLICK, IDC_HOSTLIST, OnColumnclickHostlist)
143 ON_WM_WINDOWPOSCHANGING()
144 ON_COMMAND(ID_DRAGPAD_OPTIONS, OnDragpadOptions)
145 ON_COMMAND(ID_DRAGPAD_SHOWMAINWINDOW, OnDragpadShowmainwindow)
146 ON_COMMAND(ID_DRAGPAD_HELP, OnDragpadHelp)
147 ON_COMMAND(ID_DRAGPAD_ABOUT, OnDragpadAbout)
148 ON_COMMAND(ID_DRAGPAD_EXIT, OnDragpadExit)
149 ON_BN_CLICKED(IDC_MANUALPING, OnManualping)
150 ON_COMMAND(ID_DRAGPAD_MANUALPING, OnDragpadManualping)
151 ON_COMMAND(ID_DRAGPAD_REPINGALL, OnDragpadRepingAll)
152 ON_COMMAND(ID_DRAGPAD_REMOVEALL, OnDragpadRemoveAll)
153 ON_BN_CLICKED(IDC_REPING, OnReping)
154 ON_BN_CLICKED(IDC_REPINGALL, OnRepingall)
155 ON_BN_CLICKED(IDC_CLEAR, OnClear)
156 ON_NOTIFY(LVN_INSERTITEM, IDC_HOSTLIST, OnInsertitemHostlist)
157 ON_NOTIFY(LVN_DELETEITEM, IDC_HOSTLIST, OnDeleteitemHostlist)
158 ON_NOTIFY(LVN_DELETEALLITEMS, IDC_HOSTLIST, OnDeleteallitemsHostlist)
159 ON_BN_CLICKED(IDC_EXIT, OnExit)
160 ON_NOTIFY(LVN_ITEMCHANGED, IDC_HOSTLIST, OnItemchangedHostlist)
161 ON_BN_CLICKED(IDC_REMOVE, OnRemove)
162 ON_NOTIFY(NM_RCLICK, IDC_HOSTLIST, OnRclickHostlist)
163 ON_COMMAND(ID_HOSTLIST_REPING, OnHostListReping)
164 ON_COMMAND(ID_HOSTLIST_REMOVE, OnHostListRemove)
165 ON_COMMAND(ID_HOSTLIST_REPINGALL, OnHostListRepingAll)
166 ON_COMMAND(ID_HOSTLIST_REMOVEALL, OnHostListRemoveAll)
167 ON_COMMAND(ID_HOSTLIST_OPENURL, OnHostListOpenURL)
168 ON_COMMAND(ID_HOSTLIST_PROPERTIES, OnHostListProperties)
169 ON_NOTIFY(NM_DBLCLK, IDC_HOSTLIST, OnDblclkHostlist)
170 ON_WM_CLOSE()
171 ON_WM_GETMINMAXINFO()
172 ON_WM_SIZE()
173 ON_BN_CLICKED(ID_HELP, OnHelp)
174 ON_NOTIFY(LVN_BEGINDRAG, IDC_HOSTLIST, OnBegindragHostlist)
175 ON_COMMAND(ID_HOSTLIST_PASTEURL, OnPasteurl)
176 ON_COMMAND(ID_HOSTLIST_COPYURL, OnHostlistCopyurl)
177 ON_WM_HELPINFO()
178 ON_WM_DROPFILES()
179 ON_BN_CLICKED(IDC_ADVANCED, OnAdvanced)
180 ON_COMMAND(ID_ADVANCED_EXPORTLIST, OnAdvancedExportlist)
181 ON_COMMAND(ID_ADVANCED_IMPORTLIST, OnAdvancedImportlist)
182 ON_COMMAND(ID_DRAGPAD_PASTEURL, OnPasteurl)
183 ON_COMMAND(ID_DRAGPAD_ADVANCED_EXPORTLIST, OnDragpadAdvancedExportlist)
184 ON_COMMAND(ID_DRAGPAD_ADVANCED_IMPORTLIST, OnDragpadAdvancedImportlist)
185 //}}AFX_MSG_MAP
186END_MESSAGE_MAP()
187
188/////////////////////////////////////////////////////////////////////////////
189// CDipstickDlg message handlers
190
191BOOL CDipstickDlg::OnInitDialog()
192{
193 CDialog::OnInitDialog();
194
195 // Add "About..." menu item to system menu.
196
197 // IDM_ABOUTBOX must be in the system command range.
198 ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
199 ASSERT(IDM_ABOUTBOX < 0xF000);
200
201 CMenu* pSysMenu = GetSystemMenu(FALSE);
202 CString strAboutMenu;
203 strAboutMenu.LoadString(IDS_ABOUTBOX);
204 if (!strAboutMenu.IsEmpty())
205 {
206 pSysMenu->AppendMenu(MF_SEPARATOR);
207 pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
208 }
209
210 // Set the icon for this dialog. The framework does this automatically
211 // when the application's main window is not a dialog
212 SetIcon(m_hIcon, TRUE); // Set big icon
213 SetIcon(m_hIcon, FALSE); // Set small icon
214
215CRect wrci, wrco;
216 GetWindowRect(&wrco);
217 GetClientRect(&wrci);
218CRect brc1, brc2, lrc;
219 m_HostList.GetWindowRect(&lrc);
220 ScreenToClient(&lrc);
221 m_ManualPingCtl.GetWindowRect(&brc1);
222 ScreenToClient(brc1);
223 m_RepingCtl.GetWindowRect(&brc2);
224 ScreenToClient(&brc2);
225 m_OverX = lrc.left;
226 m_OverY = lrc.top;
227 m_GapY = brc2.top - brc1.bottom;
228 m_MinSize.cx = m_OverX+m_OverX+m_OverX+brc1.Width()+m_OverX;
229 m_MinSize.cy = m_OverY+(brc1.Height()+m_GapY)*6+(brc1.Height()+m_GapY)*3+m_OverY;
230 m_MinSize.cx+=wrco.Width()-wrci.Width();
231 m_MinSize.cy+=wrco.Height()-wrci.Height();
232
233CWinApp *app = AfxGetApp();
234 ASSERT(app);
235CRect wrc;
236 wrc.top=app->GetProfileInt("Windows","DlgTop",-1);
237 wrc.bottom=app->GetProfileInt("Windows","DlgBottom",-1);
238 wrc.left=app->GetProfileInt("Windows","DlgLeft",-1);
239 wrc.right=app->GetProfileInt("Windows","DlgRight",-1);
240 if((wrc.top!=-1|| wrc.bottom!=-1) && wrc.left!=-1&& wrc.right!=-1)
241 MoveWindow(&wrc);
242
243 RecalcLayout(-1,-1);
244
245 m_DragPad = new CDragPad();
246 m_DragPad->m_Daddy=this;
247 m_DragPad->Create(CDragPad::IDD);
248 m_Images.Create(16,16,TRUE,4,1);
249 m_iPending=m_Images.Add(app->LoadIcon(IDI_PENDING));
250 m_iPinging=m_Images.Add(app->LoadIcon(IDI_PINGING));
251 m_iCompleted=m_Images.Add(app->LoadIcon(IDI_COMPLETED));
252 m_iUnreachable=m_Images.Add(app->LoadIcon(IDI_UNREACHABLE));
253 ASSERT(!(m_iPending<0 || m_iPinging<0 || m_iCompleted<0 || m_iUnreachable<0));
254 m_HostList.SetImageList(&m_Images,LVSIL_NORMAL);
255 m_HostList.SetImageList(&m_Images,LVSIL_SMALL);
256 m_HostList.SetImageList(&m_Images,LVSIL_STATE);
257 m_HostList.SetTextColor(RGB(255,255,0));// Yellow
258 m_HostList.SetTextBkColor(RGB(12,167,0));// Green
259 m_HostList.SetBkColor(RGB(12,167,0)); // Green
260CRect listrc;
261 m_HostList.GetClientRect(&listrc);
262 m_HostList.InsertColumn(0,"Host Name",LVCFMT_LEFT,app->GetProfileInt("Columns","HostName",listrc.Width()-(listrc.Width()*2/16)*4-(listrc.Width()*3/16)),subitemHost);
263 m_HostList.InsertColumn(1,"Host IP",LVCFMT_LEFT,app->GetProfileInt("Columns","HostIP",listrc.Width()*3/16),subitemIP);
264 m_HostList.InsertColumn(2,"Min RTT",LVCFMT_RIGHT,app->GetProfileInt("Columns","MinRTT",listrc.Width()*2/16),subitemMin);
265 m_HostList.InsertColumn(3,"Avg RTT",LVCFMT_RIGHT,app->GetProfileInt("Columns","AvgRTT",listrc.Width()*2/16),subitemAvg);
266 m_HostList.InsertColumn(4,"Max RTT",LVCFMT_RIGHT,app->GetProfileInt("Columns","MaxRTT",listrc.Width()*2/16),subitemMax);
267 m_HostList.InsertColumn(5,"Pktloss", LVCFMT_RIGHT,app->GetProfileInt("Columns","PktLoss",listrc.Width()*2/16),subitemPacketloss);
268
269 DragAcceptFiles(TRUE);
270
271 return TRUE; // return TRUE unless you set the focus to a control
272}
273
274void CDipstickDlg::OnSysCommand(UINT nID, LPARAM lParam)
275{
276 if ((nID & 0xFFF0) == IDM_ABOUTBOX)
277 {
278 CAboutDlg dlgAbout;
279 dlgAbout.DoModal();
280 }
281 else
282 {
283 CDialog::OnSysCommand(nID, lParam);
284 }
285}
286
287// If you add a minimize button to your dialog, you will need the code below
288// to draw the icon. For MFC applications using the document/view model,
289// this is automatically done for you by the framework.
290
291void CDipstickDlg::OnPaint()
292{
293 if (IsIconic())
294 {
295 CPaintDC dc(this); // device context for painting
296
297 SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
298
299 // Center icon in client rectangle
300 int cxIcon = GetSystemMetrics(SM_CXICON);
301 int cyIcon = GetSystemMetrics(SM_CYICON);
302 CRect rect;
303 GetClientRect(&rect);
304 int x = (rect.Width() - cxIcon + 1) / 2;
305 int y = (rect.Height() - cyIcon + 1) / 2;
306
307 // Draw the icon
308 dc.DrawIcon(x, y, m_hIcon);
309 }
310 else
311 {
312 CPaintDC pDC(this);
313 CDC bmpDC;
314 bmpDC.CreateCompatibleDC(&pDC);
315 bmpDC.SelectObject(&m_bmpBack);
316 CRect rc;
317 GetClientRect(&rc);
318 for(int x=-m_bitmapBack.bmWidth*2/4;x<rc.Width();x+=m_bitmapBack.bmWidth)
319 for(int y=-m_bitmapBack.bmHeight*2/4;y<rc.Height();y+=m_bitmapBack.bmHeight)
320 pDC.BitBlt(x,y,m_bitmapBack.bmWidth,m_bitmapBack.bmHeight,&bmpDC,0,0,SRCCOPY);
321 bmpDC.DeleteDC();
322 CDialog::OnPaint();
323 }
324}
325
326// The system calls this to obtain the cursor to display while the user drags
327// the minimized window.
328HCURSOR CDipstickDlg::OnQueryDragIcon()
329{
330 return (HCURSOR) m_hIcon;
331}
332
333//////////////////////////
334
335void CDipstickDlg::OnDestroy()
336{
337 CDialog::OnDestroy();
338 TRACE0("DestroyMain\n");
339 m_DragPad->DestroyWindow();
340 delete m_DragPad;
341 m_DragPad=NULL;
342 // *** Eventually move the following code to separate function
343POSITION p = m_Hosts.GetHeadPosition();
344 while(p){
345 POSITION pp = p;
346 CPingyHost *host = m_Hosts.GetNext(p);
347 ASSERT(host);
348 m_Hosts.RemoveAt(pp);
349 host->Suicide();
350 }
351 ASSERT(m_Hosts.IsEmpty());
352}
353
354void CDipstickDlg::OnOptions()
355{
356COptionsDlg o(this);
357 o.m_Pings = m_PingsPerHost;
358 o.m_PingSize = m_PingSize;
359 o.m_TimeOut = max(1,m_TimeOut/1000);
360 o.m_Interval = max(1,m_Interval/1000);
361 o.m_MaxThreads = m_MaxThreads;
362 o.m_bMSWorkAround = m_bMSWorkAround;
363 o.m_bAutoBest = m_bAutoBest;
364 o.m_bAdjust = m_bSmartAdjust;
365 o.m_bAdjustInn = m_bAdjustInnermost;
366 o.m_bIgnorelative = m_bIgnorelative;
367 if(o.DoModal()==IDOK){
368 m_PingsPerHost = o.m_Pings;
369 m_PingSize = o.m_PingSize;
370 m_TimeOut = o.m_TimeOut*1000;
371 m_Interval = o.m_Interval*1000;
372 m_MaxThreads = o.m_MaxThreads;
373 m_bMSWorkAround = o.m_bMSWorkAround;
374 m_bAutoBest = o.m_bAutoBest;
375 m_bSmartAdjust = o.m_bAdjust;
376 m_bAdjustInnermost = o.m_bAdjustInn;
377 m_bIgnorelative = o.m_bIgnorelative;
378 }
379}
380
381BOOL CDipstickDlg::AddPingyHost(CPingyHost *host)
382{
383 m_Hosts.AddTail(host);
384int i = m_HostList.InsertItem(0,host->m_HostName);
385 m_HostList.SetItemData(i,(DWORD)host);
386 UpdateDragpadTitle();
387 return UpdatePingyHost(host,i);// *** Do someting if failed.
388}
389
390BOOL CDipstickDlg::UpdatePingyHost(CPingyHost *host,int index)
391{
392 UpdateDragpadTitle();
393int i = index;
394 if(i<0){
395 int is = m_HostList.GetItemCount();
396 for(i=0;i<is;i++)
397 if(m_HostList.GetItemData(i)==(DWORD)host)
398 break;
399 if(!(i<is))
400 return FALSE;
401 }
402 ASSERT(m_HostList.GetItemData(i)==(DWORD)host);
403 m_HostList.SetItemText(i,subitemHost,host->m_HostName.IsEmpty()?"...":host->m_HostName);
404 m_HostList.SetItemText(i,subitemIP,host->m_IP?inet_ntoa(*(in_addr*)&host->m_IP):"...");
405 if(host->m_Pinged && host->m_Packetloss>=0){
406 CString tmp;
407 if(host->m_Packetloss==100){
408 m_HostList.SetItemText(i,subitemMin,"-");
409 m_HostList.SetItemText(i,subitemAvg,"-");
410 m_HostList.SetItemText(i,subitemMax,"-");
411 }else{
412 tmp.Format("%lu",host->m_MinRTT);
413 m_HostList.SetItemText(i,subitemMin,tmp);
414 tmp.Format("%lu",host->m_AvgRTT);
415 m_HostList.SetItemText(i,subitemAvg,tmp);
416 tmp.Format("%lu",host->m_MaxRTT);
417 m_HostList.SetItemText(i,subitemMax,tmp);
418 }
419 tmp.Format("%d%%",host->m_Packetloss);
420 m_HostList.SetItemText(i,subitemPacketloss,tmp);
421 }else{
422 m_HostList.SetItemText(i,subitemMin,"...");
423 m_HostList.SetItemText(i,subitemAvg,"...");
424 m_HostList.SetItemText(i,subitemMax,"...");
425 m_HostList.SetItemText(i,subitemPacketloss,"...");
426 }
427 if(host->m_Pinging)
428 m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iPinging,0,0,0);
429 else{
430 if(host->m_bToPing)
431 m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iPending,0,0,0);
432 else{
433 if(host->m_Pinged){
434 if(host->m_Packetloss==100)
435 m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iUnreachable,0,0,0);
436 else
437 m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iCompleted,0,0,0);
438 }else
439 m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iPending,0,0,0);
440 }
441 }
442 m_HostList.SortItems(CompareItems,(DWORD)this);
443 UpdateControlButtons();
444 return TRUE;
445}
446
447BOOL CDipstickDlg::RemovePingyHost(CPingyHost *host,int index)
448{
449 if(host->m_Pinging)
450 return FALSE;
451int i = index;
452 if(i<0){
453 int is = m_HostList.GetItemCount();
454 for(i=0;i<is;i++)
455 if(m_HostList.GetItemData(i)==(DWORD)host)
456 break;
457 if(!(i<is))
458 return FALSE;
459 }
460 ASSERT(m_HostList.GetItemData(i)==(DWORD)host);
461POSITION p = m_Hosts.Find(host,NULL);
462 if(!p)
463 return FALSE;
464 m_HostList.DeleteItem(i);
465 m_Hosts.RemoveAt(p);
466 host->Suicide();
467 UpdateControlButtons();
468 UpdateDragpadTitle();
469 return TRUE;
470}
471
472LRESULT CDipstickDlg::OnUrlPing(WPARAM wP, LPARAM lP)
473{
474 ASSERT(lP);
475CString *u = (CString*)lP;
476CString hn;
477CPingyHost *host;
478 if(m_bMSWorkAround)
479 hn = CCrackURL::InnermostURL(*u);
480 else
481 hn = *u;
482 hn = CCrackURL::GetHostName(hn);
483DWORD ip = inet_addr(hn);
484 if(ip==INADDR_NONE)
485 host = new CPingyHost(this,(char*)(LPCTSTR)hn);
486 else
487 host = new CPingyHost(this,ip);
488 host->m_URL=*u;
489 delete u;
490 AddPingyHost(host);
491 CheckForPendingRequests();
492 return 0;
493}
494
495LRESULT CDipstickDlg::OnActivityCount(WPARAM wP,LPARAM)
496{
497 if(!wP)
498 return 0;
499 intcrement = (int)wP;
500 m_ActiveThreads+=crement;
501 if(m_ActiveThreads<0){
502 TRACE0("C'est n'est pas possible!\n");
503 m_ActiveThreads=0;
504 }
505 TRACE1("AC: %d\n",m_ActiveThreads);
506 if(m_ActiveThreads){
507 m_DragPad->m_DragNDropTarget.Play(0,(UINT)-1,(UINT)-1);
508 m_ClearListCtl.EnableWindow(FALSE);
509 }else{
510 m_DragPad->m_DragNDropTarget.Stop();
511 m_DragPad->m_DragNDropTarget.Seek(0);
512 if(m_HostList.GetItemCount())
513 m_ClearListCtl.EnableWindow(TRUE);
514 }
515 if(crement>0)
516 return 0;
517 UpdateDragpadTitle();
518int items = m_HostList.GetItemCount();
519 if((!CheckForPendingRequests()) && m_bAutoBest && items && !m_ActiveThreads){
520 // Come up with the best URL..
521 m_SortCriteria=sortAvg;
522 m_HostList.SortItems(CompareItems,(DWORD)this);
523 CPtrArray hs;
524 for(int tmp=0;tmp<items;tmp++){
525 CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
526 ASSERT(!host->m_Pinging);
527 ASSERT(host->m_Pinged);
528 if(host->m_Packetloss==100 || host->m_URL.IsEmpty())
529 continue;
530 hs.Add(host);
531 }
532 if(hs.GetSize()){
533 int item = 0;
534 if(!::PlaySound((LPCTSTR)IDW_BESTURL,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE))
535 MessageBeep(0xFFFFFFFF);
536 for(;;){
537 CPingyHost *host = (CPingyHost*)hs[item];
538 CAutoBestDlg abd;
539 abd.m_bPrev = (item>0);
540 abd.m_bNext = (item<hs.GetUpperBound());
541 abd.m_PktLoss.Format("%d%%",host->m_Packetloss);
542 abd.m_RTT.Format("%lu",host->m_AvgRTT);
543 abd.m_URL=host->m_URL;
544 int rv = abd.DoModal();
545 if(rv==IDOK){
546 ShellExecute(::GetDesktopWindow(),"open",host->m_URL,NULL,NULL,SW_SHOWMAXIMIZED);
547 CString title, text;
548 VERIFY(title.LoadString(IDS_ABEST_TITLE));
549 VERIFY(text.LoadString(IDS_ABEST_CLEANUP));
550 if(MessageBox(text,title,MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL)==IDYES)
551 OnClear();
552 break;
553 }else if(rv==IDCANCEL){
554 break;
555 }else if(rv==IDC_PREV){
556 item--;
557 ASSERT(item>=0);
558 }else if(rv==IDC_NEXT){
559 item++;
560 ASSERT(item<hs.GetSize());
561 }else
562 break;
563 }
564 }else{
565 CString title, text;
566 VERIFY(title.LoadString(IDS_ABEST_TITLE));
567 VERIFY(text.LoadString(IDS_ABEST_NONEFOUND));
568 MessageBox(text,title,MB_OK|MB_ICONEXCLAMATION|MB_APPLMODAL);
569 }
570 }
571 return 0;
572}
573
574LRESULT CDipstickDlg::OnUpdateHostData(WPARAM,LPARAM lP)
575{
576 TRACE0("UpdateHostData\n");
577CPingyHost *host = (CPingyHost*)lP;
578 ASSERT(host);
579 UpdatePingyHost(host);
580 UpdateDragpadTitle();
581 return 0;
582}
583
584int CALLBACK CDipstickDlg::CompareItems(LPARAM lp1, LPARAM lp2, LPARAM lp)
585{
586CDipstickDlg *dlg = (CDipstickDlg*)lp;
587CPingyHost *h1 = (CPingyHost*)lp1;
588CPingyHost *h2 = (CPingyHost*)lp2;
589 ASSERT(dlg);
590 ASSERT(h1);
591 ASSERT(h2);
592int criteria = dlg->m_SortCriteria;
593 switch(criteria){
594 case sortHost:
595 return h1->m_HostName.CompareNoCase(h2->m_HostName);
596 case sortIP:
597 return htonl(h1->m_IP)-htonl(h2->m_IP);
598 default:
599 if(h1->m_Pinged){
600 if(!h2->m_Pinged)
601 return -1;
602 if(h1->m_Packetloss==100){
603 if(h2->m_Packetloss!=100)
604 return 1;
605 return 0;
606 }else{
607 if(h2->m_Packetloss==100)
608 return -1;
609 }
610 }else{
611 if(h2->m_Pinged)
612 return 1;
613 break;
614 }
615 switch(criteria){
616 case sortMin:
617 return h1->m_MinRTT-h2->m_MinRTT;
618 case sortAvg:
619 return h1->m_AvgRTT-h2->m_AvgRTT;
620 case sortMax:
621 return h1->m_MaxRTT-h2->m_MaxRTT;
622 case sortLoss:
623 return h1->m_Packetloss-h2->m_Packetloss;
624 }
625 }
626 return 0;
627}
628
629void CDipstickDlg::OnColumnclickHostlist(NMHDR* pNMHDR, LRESULT* pResult)
630{
631 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
632 switch(pNMListView->iSubItem){
633 case subitemHost: m_SortCriteria=sortHost; break;
634 case subitemIP: m_SortCriteria=sortIP; break;
635 case subitemMin: m_SortCriteria=sortMin; break;
636 case subitemAvg: m_SortCriteria=sortAvg; break;
637 case subitemMax: m_SortCriteria=sortMax; break;
638 case subitemPacketloss: m_SortCriteria=sortLoss; break;
639 }
640 m_HostList.SortItems(CompareItems,(DWORD)this);
641 *pResult = 0;
642}
643
644BOOL CDipstickDlg::PreCreateWindow(CREATESTRUCT& cs)
645{
646 cs.style&=~WS_VISIBLE;
647 return CDialog::PreCreateWindow(cs);
648}
649
650void CDipstickDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
651{
652 CDialog::OnWindowPosChanging(lpwndpos);
653 if(!m_bExiting){
654 if(m_bShown){
655 lpwndpos->flags&=~SWP_HIDEWINDOW;
656 lpwndpos->flags|=SWP_SHOWWINDOW;
657 }else{
658 lpwndpos->flags&=~SWP_SHOWWINDOW;
659 lpwndpos->flags|=SWP_HIDEWINDOW;
660 }
661 }
662}
663
664void CDipstickDlg::OnDragpadOptions()
665{
666 OnOptions();
667}
668void CDipstickDlg::OnDragpadShowmainwindow()
669{
670 m_DragPad->ToggleMainWindowDisplay();
671}
672void CDipstickDlg::OnDragpadHelp()
673{
674 OnHelp();
675}
676void CDipstickDlg::OnDragpadAbout()
677{
678CAboutDlg dlgAbout;
679 dlgAbout.DoModal();
680}
681void CDipstickDlg::OnDragpadExit()
682{
683 // *** More threading-aware
684 OnOK();
685}
686
687int CDipstickDlg::CheckForPendingRequests()
688{
689static BOOL bChecking = FALSE;
690 if(bChecking)
691 return -1;
692 bChecking = TRUE;
693 TRACE1("CFPR: AC: %d\n",m_ActiveThreads);
694int newRequests = m_MaxThreads-m_ActiveThreads;
695POSITION p = m_Hosts.GetHeadPosition();
696int rv = 0;
697 while(newRequests>0 && p){
698 CPingyHost *host = m_Hosts.GetNext(p);
699 ASSERT(host);
700 if(host->m_Pinging)
701 continue;
702 if(!host->m_bToPing)
703 continue;
704 TRACE0("!");
705 host->Ping();
706 newRequests--;
707 rv++;
708 }
709 TRACE0("/CFPR\n");
710 bChecking = FALSE;
711 return rv;
712}
713
714void CAboutDlg::OnKlevernet()
715{
716CString url;
717 url.LoadString(IDS_KLEVERNET_URL);
718 ShellExecute(::GetDesktopWindow(),"open",url,NULL,NULL,SW_SHOWMAXIMIZED);
719}
720
721void CDipstickDlg::OnOK()
722{
723CWinApp *app = AfxGetApp();
724 ASSERT(app);
725 app->WriteProfileInt("Options","IntervalHi",HIWORD(m_Interval));
726 app->WriteProfileInt("Options","IntervalLo",LOWORD(m_Interval));
727 app->WriteProfileInt("Options","MaxThreads",m_MaxThreads);
728 app->WriteProfileInt("Options","PingSize",m_PingSize);
729 app->WriteProfileInt("Options","PingsPerHost",m_PingsPerHost);
730 app->WriteProfileInt("Options","SortBy",m_SortCriteria);
731 app->WriteProfileInt("Options","TimeOutHi",HIWORD(m_TimeOut));
732 app->WriteProfileInt("Options","TimeOutLo",LOWORD(m_TimeOut));
733 app->WriteProfileInt("Options","InnermostURL",m_bMSWorkAround);
734 app->WriteProfileInt("Options","AutoBest",m_bAutoBest);
735 app->WriteProfileInt("Options","SmartAdjust",m_bSmartAdjust);
736 app->WriteProfileInt("Options","AdjustInnermost",m_bAdjustInnermost);
737 app->WriteProfileInt("Options","IgnoreRelative",m_bIgnorelative);
738 app->WriteProfileString("Options","ImportExportPath",m_impexPath);
739CRect rc;
740 GetWindowRect(&rc);
741 app->WriteProfileInt("Windows","DlgTop",rc.top);
742 app->WriteProfileInt("Windows","DlgBottom",rc.bottom);
743 app->WriteProfileInt("Windows","DlgLeft",rc.left);
744 app->WriteProfileInt("Windows","DlgRight",rc.right);
745 m_DragPad->GetWindowRect(&rc);
746 app->WriteProfileInt("Windows","DragPadTop",rc.top);
747 app->WriteProfileInt("Windows","DragPadLeft",rc.left);
748 // Columns
749 app->WriteProfileInt("Columns","HostName",m_HostList.GetColumnWidth(0));
750 app->WriteProfileInt("Columns","HostIP",m_HostList.GetColumnWidth(1));
751 app->WriteProfileInt("Columns","MinRTT",m_HostList.GetColumnWidth(2));
752 app->WriteProfileInt("Columns","AvgRTT",m_HostList.GetColumnWidth(3));
753 app->WriteProfileInt("Columns","MaxRTT",m_HostList.GetColumnWidth(4));
754 app->WriteProfileInt("Columns","PktLoss",m_HostList.GetColumnWidth(5));
755 m_bExiting=TRUE;
756 CDialog::OnOK();
757}
758
759void CDipstickDlg::OnCancel()
760{
761}
762
763void CDipstickDlg::OnManualping()
764{
765CHostNameDlg hnd(this);
766 if(hnd.DoModal()==IDOK && !hnd.m_Host.IsEmpty()){
767 CString *host = new CString(hnd.m_Host);
768 ASSERT(host);
769 PostMessage(WM_DNP_URLPING,0,(LPARAM)host);
770 }
771}
772
773void CDipstickDlg::OnDragpadManualping()
774{
775 OnManualping();
776}
777
778void CDipstickDlg::OnDragpadRepingAll()
779{
780 OnRepingall();
781}
782void CDipstickDlg::OnDragpadRemoveAll()
783{
784 OnClear();
785}
786
787void CDipstickDlg::OnReping()
788{
789 if(!m_HostList.GetSelectedCount())
790 return;
791 intitems = m_HostList.GetItemCount();
792 for(int tmp=0;tmp<items;tmp++){
793 if(!(m_HostList.GetItemState(tmp,LVIS_SELECTED)&LVIS_SELECTED))
794 continue;
795 CPingyHost *host = (CPingyHost*) m_HostList.GetItemData(tmp);
796 ASSERT(host);
797 if(host->m_Pinged && !host->m_Pinging)
798 host->m_bToPing=TRUE;
799 }
800 UpdateDragpadTitle();
801 CheckForPendingRequests();
802}
803
804void CDipstickDlg::OnRepingall()
805{
806POSITION p = m_Hosts.GetHeadPosition();
807 while(p){
808 CPingyHost *host = m_Hosts.GetNext(p);
809 ASSERT(host);
810 if(host->m_Pinged && !host->m_Pinging)
811 host->m_bToPing=TRUE;
812 }
813 UpdateDragpadTitle();
814 CheckForPendingRequests();
815}
816
817void CDipstickDlg::OnClear()
818{
819 if(m_ActiveThreads)
820 return;
821 m_HostList.DeleteAllItems();
822 // *** Eventually move the following code to separate function
823POSITION p = m_Hosts.GetHeadPosition();
824 while(p){
825 POSITION pp = p;
826 CPingyHost *host = (CPingyHost*)m_Hosts.GetNext(p);
827 ASSERT(host);
828 m_Hosts.RemoveAt(pp);
829 host->Suicide();
830 }
831 ASSERT(m_Hosts.IsEmpty());
832 UpdateDragpadTitle();
833}
834
835void CDipstickDlg::OnInsertitemHostlist(NMHDR* pNMHDR, LRESULT* pResult)
836{
837NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
838 m_RepingCtl.EnableWindow(TRUE);
839 m_RepingAllCtl.EnableWindow(TRUE);
840 UpdateDragpadTitle();
841 *pResult = 0;
842}
843
844void CDipstickDlg::OnDeleteitemHostlist(NMHDR* pNMHDR, LRESULT* pResult)
845{
846NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
847 if(!m_HostList.GetItemCount()){
848 m_RepingCtl.EnableWindow(FALSE);
849 m_RepingAllCtl.EnableWindow(FALSE);
850 m_ClearListCtl.EnableWindow(FALSE);
851 }
852 UpdateDragpadTitle();
853 *pResult = 0;
854}
855
856void CDipstickDlg::OnDeleteallitemsHostlist(NMHDR* pNMHDR, LRESULT* pResult)
857{
858NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
859 m_RepingCtl.EnableWindow(FALSE);
860 m_RepingAllCtl.EnableWindow(FALSE);
861 m_ClearListCtl.EnableWindow(FALSE);
862 UpdateDragpadTitle();
863 *pResult = 0;
864}
865
866void CDipstickDlg::OnExit()
867{
868 OnOK();
869}
870
871void CDipstickDlg::OnItemchangedHostlist(NMHDR* pNMHDR, LRESULT* pResult)
872{
873NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
874 if(pNMListView->uChanged&LVIF_STATE && (pNMListView->uOldState&LVIS_SELECTED)!=(pNMListView->uNewState&LVIS_SELECTED))
875 UpdateControlButtons();
876 UpdateDragpadTitle();
877 *pResult = 0;
878}
879
880void CDipstickDlg::UpdateControlButtons()
881{
882int items = m_HostList.GetItemCount();
883 if(!items){
884 m_ClearListCtl.EnableWindow(FALSE);
885 m_RemoveCtl.EnableWindow(FALSE);
886 m_RepingAllCtl.EnableWindow(FALSE);
887 m_RepingCtl.EnableWindow(FALSE);
888 return;
889 }
890BOOL cl = m_ActiveThreads?FALSE:TRUE, rm = FALSE, ra = FALSE, rp = FALSE;
891 for(int tmp=0;tmp<items;tmp++){
892 CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
893 if(!host->m_Pinging){
894 ra=TRUE;
895 if(m_HostList.GetItemState(tmp,LVIS_SELECTED)&LVIS_SELECTED){
896 rp = TRUE;
897 rm = TRUE;
898 break;
899 }
900 }
901 }
902 m_ClearListCtl.EnableWindow(cl);
903 m_RemoveCtl.EnableWindow(rm);
904 m_RepingAllCtl.EnableWindow(ra);
905 m_RepingCtl.EnableWindow(rp);
906}
907
908void CDipstickDlg::OnRemove()
909{
910 if(!m_HostList.GetSelectedCount())
911 return;
912 intitems = m_HostList.GetItemCount();
913 for(int tmp=0;tmp<items;tmp++){
914 if(!(m_HostList.GetItemState(tmp,LVIS_SELECTED)&LVIS_SELECTED))
915 continue;
916 CPingyHost *host = (CPingyHost*) m_HostList.GetItemData(tmp);
917 ASSERT(host);
918 if(!host->m_Pinging)
919 RemovePingyHost(host,tmp);
920 }
921}
922
923void CDipstickDlg::OnRclickHostlist(NMHDR* pNMHDR, LRESULT* pResult)
924{
925 if(!m_HostList.GetSelectedCount())
926 return;
927int items = m_HostList.GetItemCount();
928int item = -1;
929 for(int tmp=0;tmp<items;tmp++){
930 ints = m_HostList.GetItemState(tmp,LVIS_SELECTED|LVIS_FOCUSED);
931 if(s&LVIS_FOCUSED){
932 item = tmp;
933 break;
934 }
935 if(s&LVIS_SELECTED)
936 item=tmp;
937 }
938 ASSERT(item>=0);
939CPoint p;
940 VERIFY(m_HostList.GetItemPosition(item,&p));
941CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(item);
942 ASSERT(host);
943 m_HostList.ClientToScreen(&p);
944CMenu menus;
945 VERIFY(menus.LoadMenu(IDR_MENU));
946CMenu *popUp = menus.GetSubMenu(1);
947 ASSERT(popUp);
948 UpdateControlButtons();
949 popUp->EnableMenuItem(ID_HOSTLIST_REPING,MF_BYCOMMAND|(m_RepingCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
950 popUp->EnableMenuItem(ID_HOSTLIST_REMOVE,MF_BYCOMMAND|(m_RemoveCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
951 popUp->EnableMenuItem(ID_HOSTLIST_REMOVEALL,MF_BYCOMMAND|(m_ClearListCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
952 popUp->EnableMenuItem(ID_HOSTLIST_REPINGALL,MF_BYCOMMAND|(m_RepingAllCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
953 popUp->EnableMenuItem(ID_HOSTLIST_OPENURL,MF_BYCOMMAND|((m_HostList.GetSelectedCount()==1 && !host->m_URL.IsEmpty())?MF_ENABLED:MF_GRAYED));
954 popUp->EnableMenuItem(ID_HOSTLIST_COPYURL,MF_BYCOMMAND|((m_HostList.GetSelectedCount()==1 && !host->m_URL.IsEmpty())?MF_ENABLED:MF_GRAYED));
955 popUp->EnableMenuItem(ID_HOSTLIST_PROPERTIES,MF_BYCOMMAND|((m_HostList.GetSelectedCount()==1)?MF_ENABLED:MF_GRAYED));
956 popUp->EnableMenuItem(ID_HOSTLIST_PASTEURL,MF_BYCOMMAND|(IsPasteableClipboard()?MF_ENABLED:MF_GRAYED));
957 popUp->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_LEFTBUTTON,p.x,p.y,this);
958 *pResult = 0;
959}
960
961void CDipstickDlg::OnHostListReping()
962{
963 OnReping();
964}
965void CDipstickDlg::OnHostListRemove()
966{
967 OnRemove();
968}
969void CDipstickDlg::OnHostListRepingAll()
970{
971 OnRepingall();
972}
973void CDipstickDlg::OnHostListRemoveAll()
974{
975 OnClear();
976}
977void CDipstickDlg::OnHostListOpenURL()
978{
979 if(m_HostList.GetSelectedCount()!=1)
980 return;
981int items = m_HostList.GetItemCount();
982 for(int tmp=0;tmp<items;tmp++){
983 if((m_HostList.GetItemState(tmp,LVIS_SELECTED|LVIS_FOCUSED))&LVIS_SELECTED)
984 break;
985 }
986 ASSERT(tmp<items);
987CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
988 ASSERT(host);
989 if(!host->m_URL.IsEmpty())
990 ShellExecute(::GetDesktopWindow(),NULL,host->m_URL,NULL,NULL,SW_SHOWMAXIMIZED);
991}
992
993void CDipstickDlg::OnHostListProperties()
994{
995 if(m_HostList.GetSelectedCount()!=1)
996 return;
997int items = m_HostList.GetItemCount();
998 for(int tmp=0;tmp<items;tmp++){
999 if((m_HostList.GetItemState(tmp,LVIS_SELECTED|LVIS_FOCUSED))&LVIS_SELECTED)
1000 break;
1001 }
1002 ASSERT(tmp<items);
1003CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
1004 ASSERT(host);
1005CHostProperties hp(this);
1006 hp.SetHost(host);
1007 hp.DoModal();
1008}
1009
1010void CDipstickDlg::OnDblclkHostlist(NMHDR* pNMHDR, LRESULT* pResult)
1011{
1012 OnHostListOpenURL();
1013 *pResult = 0;
1014}
1015
1016void CDipstickDlg::OnClose()
1017{
1018 m_bShown=FALSE;
1019 ShowWindow(SW_HIDE);
1020}
1021
1022BOOL CAboutDlg::OnInitDialog()
1023{
1024 CDialog::OnInitDialog();
1025 return TRUE;
1026}
1027
1028void CDipstickDlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
1029{
1030 CDialog::OnGetMinMaxInfo(lpMMI);
1031 if(m_MinSize.cx>0 && m_MinSize.cy>0){
1032 lpMMI->ptMinTrackSize.x = m_MinSize.cx;
1033 lpMMI->ptMinTrackSize.y = m_MinSize.cy;
1034 }
1035}
1036
1037void CDipstickDlg::OnSize(UINT nType, int cx, int cy)
1038{
1039 CDialog::OnSize(nType, cx, cy);
1040 if(nType==SIZE_RESTORED)
1041 RecalcLayout(cx,cy);
1042}
1043
1044void CDipstickDlg::RecalcLayout(int,int)
1045{
1046CRect wrc;
1047 GetClientRect(&wrc);
1048CRect brc;
1049 m_ManualPingCtl.GetWindowRect(&brc);
1050 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);
1051int xb = wrc.Width()-m_OverX-brc.Width();
1052int cyb = brc.Height()+m_GapY;
1053 m_ManualPingCtl.SetWindowPos(NULL,xb,m_OverY,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
1054 m_RepingCtl.SetWindowPos(NULL,xb,m_OverY+cyb,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
1055 m_RepingAllCtl.SetWindowPos(NULL,xb,m_OverY+cyb*2,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
1056 m_RemoveCtl.SetWindowPos(NULL,xb,m_OverY+cyb*3,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
1057 m_ClearListCtl.SetWindowPos(NULL,xb,m_OverY+cyb*4,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
1058 m_AdvancedCtl.SetWindowPos(NULL,xb,m_OverY+cyb*5,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
1059 m_ExitCtl.SetWindowPos(NULL,xb,wrc.Height()-m_OverY-brc.Height(),0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
1060 m_OptionsCtl.SetWindowPos(NULL,xb,wrc.Height()-m_OverY-cyb-brc.Height(),0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
1061 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);
1062}
1063
1064void CDipstickDlg::OnHelp()
1065{
1066 WinHelp(0,HELP_FINDER);
1067}
1068
1069void CDipstickDlg::UpdateDragpadTitle()
1070{
1071int ic = m_HostList.GetItemCount();
1072CString title;
1073 if(!ic){
1074 VERIFY(title.LoadString(IDS_DRAGPAD_TITLE));
1075 }else{
1076 int ip = 0;
1077 POSITION p = m_Hosts.GetHeadPosition();
1078 while(p){
1079 CPingyHost *host = m_Hosts.GetNext(p);
1080 ASSERT(host);
1081 if(!(host->m_Pinging || host->m_bToPing))
1082 ip++;
1083 }
1084 title.Format(IDS_DRAGPAD_URLS,ip,ic);
1085 }
1086 if(m_DragPad)
1087 m_DragPad->SetWindowText(title);
1088}
1089
1090void CDipstickDlg::OnBegindragHostlist(NMHDR* pNMHDR, LRESULT* pResult)
1091{
1092 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
1093
1094 if(pNMListView->iItem>=0){
1095 CPingyHost *host = (CPingyHost*) m_HostList.GetItemData(pNMListView->iItem);
1096 ASSERT(host);
1097 if(!host->m_URL.IsEmpty()){
1098 CURLSource us(host->m_URL);
1099 us.DoDragDrop(DROPEFFECT_COPY|DROPEFFECT_LINK);
1100 }
1101 }
1102
1103 *pResult = 0;
1104}
1105
1106void CDipstickDlg::OnPasteurl()
1107{
1108COleDataObject odo;
1109 if(!odo.AttachClipboard())
1110 return;
1111 CollectURLs(&odo,FALSE);
1112}
1113
1114BOOL CDipstickDlg::IsPasteableClipboard()
1115{
1116COleDataObject odo;
1117 if(!odo.AttachClipboard())
1118 return FALSE;
1119 if(CollectURLs(&odo,TRUE))
1120 return TRUE;
1121 return FALSE;
1122}
1123
1124BOOL CDipstickDlg::CollectURLs(COleDataObject* pDO,BOOL bTestOnly)
1125{
1126 UINTcfURL = RegisterClipboardFormat("UniformResourceLocator");
1127 UINTcfHTML = RegisterClipboardFormat("HTML Format");
1128 UINTcfNIF = RegisterClipboardFormat("Netscape Image Format");
1129 if(pDO->IsDataAvailable(cfURL)){
1130 if(!bTestOnly){
1131 HGLOBAL hg = pDO->GetGlobalData(cfURL);
1132 ASSERT(hg);
1133 LPVOID lpv = GlobalLock(hg);
1134 ASSERT(lpv);
1135 PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString((LPCTSTR)lpv));
1136 GlobalUnlock(hg);
1137 GlobalFree(hg);
1138 }
1139 return TRUE;
1140 }
1141 if(pDO->IsDataAvailable(cfHTML)){
1142 HGLOBAL hg = pDO->GetGlobalData(cfHTML);
1143 ASSERT(hg);
1144 LPCTSTR lps = (LPCTSTR)GlobalLock(hg);
1145 ASSERT(lps);
1146 BOOL rv = FALSE;
1147 do{
1148 static LPCTSTR v10 = "Version:1.0\r\n";
1149 if(memcmp(v10,lps,strlen(v10)))
1150 break;
1151 static LPCTSTR strStartSelection = "StartSelection:";
1152 static LPCTSTR strEndSelection = "EndSelection:";
1153 static LPCTSTR strSourceURL = "SourceURL:";
1154 LPTSTR subs = strstr(lps,strStartSelection);
1155 if(!subs)
1156 break;
1157 LONG startSelection = atol(&subs[strlen(strStartSelection)]);
1158 if(!startSelection)
1159 break;
1160 if(!(subs=strstr(lps,strEndSelection)))
1161 break;
1162 LONG endSelection = atol(&subs[strlen(strEndSelection)]);
1163 if(!endSelection)
1164 break;
1165 if(!(subs=strstr(lps,strSourceURL)))
1166 break;
1167 subs = &subs[strlen(strSourceURL)];
1168 LPTSTR eol = strchr(subs,'\r');
1169 if(!eol)
1170 break;
1171 (*eol)=0;
1172 CString sourceURL = subs;
1173 if(!sourceURL.GetLength())
1174 break;
1175 TRACE0("SourceURL = "+sourceURL+"\n");
1176 _xferHTML* xf = new _xferHTML;
1177 VERIFY(xf->src.Crack(sourceURL));
1178 LPTSTR htmlBuff = xf->html.GetBuffer(endSelection-startSelection+2);
1179 ASSERT(htmlBuff);
1180 memmove(htmlBuff,&lps[startSelection],endSelection-startSelection+1);
1181 htmlBuff[endSelection-startSelection+1]=0;
1182 xf->html.ReleaseBuffer();
1183 if(bTestOnly){
1184 rv = m_reHTMLURL.Match(xf->html);
1185 delete xf;
1186 }else{
1187 PostMessage(WM_DNP_HTML,0,(LPARAM)xf);
1188 }
1189 }while(FALSE);
1190 GlobalUnlock(hg);
1191 GlobalFree(hg);
1192 return rv;
1193 }
1194 if(pDO->IsDataAvailable(cfNIF)){
1195 if(!bTestOnly){
1196 HGLOBAL hg = pDO->GetGlobalData(cfNIF);
1197 ASSERT(hg);
1198 LPVOID lpv = GlobalLock(hg);
1199 ASSERT(lpv);
1200 struct _nif{
1201 BYTE data[0x20];
1202 DWORD m_offDescr;
1203 DWORD m_offURL;
1204 DWORD m_offToImage;
1205 } *nif = (_nif*)lpv;
1206 PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString((LPCTSTR)&nif->data[nif->m_offURL]));
1207 GlobalUnlock(hg);
1208 GlobalFree(hg);
1209 }
1210 return TRUE;
1211 }
1212 if(pDO->IsDataAvailable(CF_TEXT)){
1213 if(!bTestOnly){
1214 HGLOBAL hg = pDO->GetGlobalData(CF_TEXT);
1215 ASSERT(hg);
1216 LPVOID lpv = GlobalLock(hg);
1217 ASSERT(lpv);
1218 PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString((LPCTSTR)lpv));
1219 GlobalUnlock(hg);
1220 GlobalFree(hg);
1221 }
1222 return TRUE;
1223 }
1224 return FALSE;
1225}
1226
1227LRESULT CDipstickDlg::OnHTMLTransfer(WPARAM wP, LPARAM lP)
1228{
1229_xferHTML* xf = (_xferHTML*)lP;
1230CSelectURLsDlg su;
1231 su.m_bAdjust = m_bSmartAdjust;
1232 su.m_bAdjustInnermost = m_bAdjustInnermost;
1233 BeginWaitCursor();
1234 while(m_reHTMLURL.Match(xf->html)){
1235 CString url = m_reHTMLURL.GetMatch(1);
1236 xf->html = m_reHTMLURL.GetMatch(CRegEx::matchPostMatch);
1237 if(CCrackURL::GetHostName(url)==url){
1238 if(m_bIgnorelative)
1239 continue;
1240 CCrackURL cracked;
1241 VERIFY(cracked.Crack(url));
1242 cracked.Adjust(xf->src);
1243 url = cracked.Build();
1244 }
1245 if(!su.m_URLs.Find(url))
1246 VERIFY(su.m_URLs.AddTail(url));
1247 }
1248 EndWaitCursor();
1249 delete xf;
1250 if(su.DoModal()==IDOK){
1251 POSITION p = su.m_URLs.GetHeadPosition();
1252 while(p){
1253 CString url = su.m_URLs.GetNext(p);
1254 PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString(url));
1255 }
1256 }
1257 return 0;
1258}
1259
1260UINT CPingyHost::PingProc(LPVOID pParam)
1261{
1262CPingyHost* pThis = (CPingyHost*)pParam;
1263 ASSERT(pThis->m_Daddy);
1264 return pThis->DoPing();
1265}
1266
1267UINT CPingyHost::DoPing()
1268{
1269CSingleLock slock(&m_mutex);
1270 if(!slock.Lock(2000)){
1271 m_Status.LoadString(IDS_PS_FAILEDTOLOCK);
1272 return 1;
1273 }
1274 m_Pinging = TRUE;
1275 m_bToPing = FALSE;
1276 VERIFY(m_Daddy->m_eveStartup.SetEvent());
1277 m_Daddy->PostMessage(WM_DNP_UPDATEHOSTDATA,0,(LPARAM)this);
1278in_addr ip;
1279UINT packets, lost;
1280 packets=lost=0;
1281CICMP* pICMP = NULL;
1282UINT dataSize = m_Daddy->m_PingSize;
1283 intploss = 100;
1284 do{
1285 if(m_HostName.IsEmpty()){
1286 ip.s_addr = m_IP;
1287 hostent *he = gethostbyaddr((char*)&ip,4,PF_INET);
1288 if(!he)
1289 m_HostName.Empty();
1290 else
1291 m_HostName = he->h_name;
1292 }else{
1293 hostent *he = gethostbyname(m_HostName);
1294 if(!he){
1295 m_Status.LoadString(IDS_PS_FAILEDTORESOLVE);
1296 m_IP = 0;
1297 break;
1298 }
1299 memmove(&ip.s_addr,he->h_addr,sizeof(ip.s_addr));
1300 m_IP = ip.s_addr;
1301 }
1302 pICMP = CICMP::CreateICMP();
1303 if(!(pICMP && pICMP->Initialize())){
1304 m_Status.LoadString(IDS_PS_UNABLETOICMP);
1305 break;
1306 }
1307 m_Daddy->PostMessage(WM_DNP_UPDATEHOSTDATA,0,(LPARAM)this);
1308 ULONG sum, num, pmin, pmax;
1309 sum = num = 0;
1310 pmin = 0xFFFFFFFF;
1311 pmax = 0;
1312 UINT seq;
1313 for(seq = 0;seq<m_Daddy->m_PingsPerHost;seq++){
1314 INT status;
1315 LONG rtt = pICMP->Ping(ip,dataSize,m_Daddy->m_TimeOut,&status);
1316 UINT stString = 0;
1317 switch(status){
1318 case CICMP::ipSuccess:
1319 sum+=rtt; num++;
1320 if(rtt<pmin)
1321 pmin=rtt;
1322 if(rtt>pmax)
1323 pmax=rtt;
1324 break;
1325 case CICMP::ipBuffTooSmall: stString = IDS_PS_INTERNALERROR;
1326 break;
1327 case CICMP::ipDestNetUnreachable: stString = IDS_PS_NETUNREACHABLE;
1328 break;
1329 case CICMP::ipDestHostUnreachable: stString = IDS_PS_HOSTUNREACHABLE;
1330 break;
1331 case CICMP::ipDestProtUnreachable: stString = IDS_PS_PROTUNREACHABLE;
1332 break;
1333 case CICMP::ipDestPortUnreachable: stString = IDS_PS_PORTUNREACHABLE;
1334 break;
1335 case CICMP::ipNoResources: stString = IDS_PS_NORESOURCES;
1336 break;
1337 case CICMP::ipBadOption: stString = IDS_PS_INTERNALERROR;
1338 break;
1339 case CICMP::ipHWError: stString = IDS_PS_HWERROR;
1340 break;
1341 case CICMP::ipPacketTooBig: stString = IDS_PS_BIGPACKET;
1342 break;
1343 case CICMP::ipTimeOut: stString = IDS_PS_TIMEOUT;
1344 break;
1345 case CICMP::ipBadRequest: stString = IDS_PS_INTERNALERROR;
1346 break;
1347 case CICMP::ipBadRoute: stString = IDS_PS_BADROUTE;
1348 break;
1349 case CICMP::ipTTLExpiredInTransit: stString = IDS_PS_TTLEXPTRANSIT;
1350 break;
1351 case CICMP::ipTTLExpiredInReasm: stString = IDS_PS_TTLEXPREASM;
1352 break;
1353 case CICMP::ipParamProblem: stString = IDS_PS_IPARAMP;
1354 break;
1355 case CICMP::ipSourceQuench: stString = IDS_PS_SOURCEQUENCH;
1356 break;
1357 case CICMP::ipOptionTooBig: stString = IDS_PS_BIGOPTION;
1358 break;
1359 case CICMP::ipBadDest: stString = IDS_PS_BADDEST;
1360 break;
1361 default:
1362 stString = IDS_PS_UNKNOWNERROR;
1363 break;
1364 }
1365 if(stString)
1366 m_Status.LoadString(stString);
1367 packets++;
1368 if(rtt<0)
1369 lost++;
1370 Sleep(m_Daddy->m_Interval);
1371 }
1372 if(packets==lost || !packets){
1373 ploss=100;
1374 }else{
1375 ploss = lost*100/packets;
1376 m_MinRTT = pmin;
1377 m_MaxRTT = pmax;
1378 if(sum){
1379 ASSERT(num);
1380 m_AvgRTT = sum/num;
1381 }else{
1382 m_AvgRTT = 0;
1383 }
1384 }
1385 }while(FALSE);
1386 m_Packetloss=ploss;
1387 m_Pinged=TRUE;
1388 m_Pinging=FALSE;
1389 if(pICMP){
1390 pICMP->Deinitialize();
1391 delete pICMP;
1392 }
1393 m_Daddy->PostMessage(WM_DNP_UPDATEHOSTDATA,0,(LPARAM)this);
1394 m_Daddy->PostMessage(WM_DNP_ACTIVITYCOUNT,(WPARAM)-1);
1395 return 0;
1396}
1397
1398void CPingyHost::Ping()
1399{
1400 ASSERT(m_Daddy);
1401 m_Daddy->m_eveStartup.ResetEvent();
1402 if(!AfxBeginThread(CPingyHost::PingProc,this)){
1403 ASSERT(FALSE);
1404 }else{
1405 CSingleLock sl(&m_Daddy->m_eveStartup);
1406 sl.Lock();
1407 m_Daddy->SendMessage(WM_DNP_ACTIVITYCOUNT,(WPARAM)1);// *** AWFUL! Shouldn't be here!
1408 }
1409}
1410
1411void CDipstickDlg::OnHostlistCopyurl()
1412{
1413 if(m_HostList.GetSelectedCount()!=1)
1414 return;
1415int items = m_HostList.GetItemCount();
1416 for(int tmp=0;tmp<items;tmp++){
1417 if((m_HostList.GetItemState(tmp,LVIS_SELECTED|LVIS_FOCUSED))&LVIS_SELECTED)
1418 break;
1419 }
1420 ASSERT(tmp<items);
1421CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(tmp);
1422 ASSERT(host);
1423 if(!host->m_URL.IsEmpty()){
1424 CURLSource *us = new CURLSource(host->m_URL);
1425 us->SetClipboard();
1426 us->FlushClipboard();
1427 }
1428}
1429
1430BOOL CDipstickDlg::OnHelpInfo(HELPINFO* pHelpInfo)
1431{
1432 WinHelp(IDD|0x20000l);
1433 return TRUE;
1434}
1435
1436void CDipstickDlg::OnDropFiles(HDROP hDropInfo)
1437{
1438 // *** Import only 1st file, but maybe we should fall into prompt mode if multiple files are dropped.
1439CString fileName;
1440int bufferSize = DragQueryFile(hDropInfo,0,NULL,0);
1441 DragQueryFile(hDropInfo,0,fileName.GetBuffer(bufferSize+2),bufferSize+1);
1442 fileName.ReleaseBuffer();
1443 if(fileName.IsEmpty())
1444 CDialog::OnDropFiles(hDropInfo);
1445 else
1446 ImportLocations(fileName);
1447}
1448
1449BOOL CDipstickDlg::ImportLocations(LPCTSTR file)
1450{
1451CString fileLine;
1452CString q;
1453 try{
1454 CStdioFile f(file,CFile::modeRead|CFile::typeText|CFile::shareDenyWrite);
1455 // *** Cleanup locations..
1456 while(f.ReadString(fileLine)){
1457 if(fileLine.IsEmpty())
1458 continue;
1459 if(fileLine[0]=='\"' || fileLine[0]=='\''){
1460 TCHAR q = fileLine[0];
1461 fileLine=fileLine.Mid(1);
1462 for(int tmp=0;tmp<fileLine.GetLength();tmp++){
1463 if(fileLine[tmp]!=q)
1464 continue;
1465 if(!tmp){
1466 fileLine.Empty();
1467 break;
1468 }
1469 fileLine=fileLine.Left(tmp);
1470 break;
1471 }
1472 }else{
1473 int co = fileLine.Find(',');
1474 if(co>=0)
1475 fileLine=fileLine.Left(co);
1476 }
1477 if(fileLine.IsEmpty())
1478 continue;
1479 if(!fileLine.CompareNoCase("url"))
1480 continue;
1481 PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString(fileLine));
1482 }
1483 }catch(CException* e){
1484 e->Delete();
1485 TRACE0("Failed to import URLList file\n");
1486 return FALSE;
1487 }
1488 return TRUE;
1489}
1490
1491void CDipstickDlg::OnAdvanced()
1492{
1493CRect rc;
1494 m_AdvancedCtl.GetClientRect(rc);
1495 m_AdvancedCtl.ClientToScreen(rc);
1496CMenu menus;
1497 VERIFY(menus.LoadMenu(IDR_MENU));
1498CMenu *popUp = menus.GetSubMenu(2);
1499 ASSERT(popUp);
1500 popUp->EnableMenuItem(ID_ADVANCED_EXPORTLIST,MF_BYCOMMAND|(m_HostList.GetItemCount()?MF_ENABLED:MF_GRAYED));
1501 popUp->TrackPopupMenu(TPM_CENTERALIGN|TPM_RIGHTBUTTON|TPM_LEFTBUTTON,(rc.left+rc.right)/2,rc.top,this);
1502}
1503
1504void CDipstickDlg::OnAdvancedExportlist()
1505{
1506CString filter;
1507 filter.LoadString(IDS_CSVFILTER);
1508CFileDialog cfd(FALSE,".csv",NULL,OFN_EXPLORER|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST,filter,this);
1509 if(!m_impexPath.IsEmpty())
1510 SetCurrentDirectory(m_impexPath);
1511 if(cfd.DoModal()==IDOK){
1512 GetCurrentDirectory(2048,m_impexPath.GetBuffer(2048));
1513 m_impexPath.ReleaseBuffer();
1514 ExportLocations(cfd.GetPathName());
1515 }
1516}
1517
1518void CDipstickDlg::OnAdvancedImportlist()
1519{
1520CString filter;
1521 filter.LoadString(IDS_CSVFILTER);
1522CFileDialog cfd(TRUE,".csv",NULL,OFN_EXPLORER|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST,filter,this);
1523 if(!m_impexPath.IsEmpty())
1524 SetCurrentDirectory(m_impexPath);
1525 if(cfd.DoModal()==IDOK){
1526 GetCurrentDirectory(2048,m_impexPath.GetBuffer(2048));
1527 m_impexPath.ReleaseBuffer();
1528 ImportLocations(cfd.GetPathName());
1529 }
1530}
1531
1532BOOL CDipstickDlg::ExportLocations(LPCTSTR file)
1533{
1534 try{
1535 CStdioFile f(file,CFile::modeCreate|CFile::modeWrite|CFile::typeText);
1536 f.WriteString("URL,Host Name,IP Address, Min RTT,Avg RTT,Max RTT,Pktloss\n");
1537 POSITION p = m_Hosts.GetHeadPosition();
1538 while(p){
1539 CPingyHost *host = m_Hosts.GetNext(p);
1540 ASSERT(host);
1541 CString ph;
1542 ph.Format("\"%s\",%s,%s,%lu,%lu,%lu,%d%%\n",host->m_URL,host->m_HostName,inet_ntoa(*(in_addr*)&host->m_IP),
1543 host->m_MinRTT,host->m_AvgRTT,host->m_MaxRTT,host->m_Packetloss
1544 );
1545 f.WriteString(ph);
1546 }
1547 f.Close();
1548 }catch(CException* e){
1549 TRACE0("Failed to export URLList\n");
1550 e->Delete();
1551 return FALSE;
1552 }
1553 return TRUE;
1554}
1555
1556void CDipstickDlg::OnDragpadAdvancedExportlist()
1557{
1558 OnAdvancedExportlist();
1559}
1560
1561void CDipstickDlg::OnDragpadAdvancedImportlist()
1562{
1563 OnAdvancedImportlist();
1564}
1565
1566void CPingyHost::Suicide()
1567{
1568CSingleLock sl(&m_mutex);
1569 if(sl.Lock(10)){
1570 sl.Unlock();
1571 delete this;
1572 }else{
1573 if(!AfxBeginThread(CPingyHost::SuicideProc,this))
1574 ASSERT(FALSE);
1575 }
1576}
1577
1578UINT CPingyHost::SuicideProc(LPVOID pParam)
1579{
1580CPingyHost* pThis = (CPingyHost*)pParam;
1581CSingleLock sl(&pThis->m_mutex);
1582 sl.Lock();
1583 VERIFY(sl.Unlock());
1584 delete pThis;
1585 return 0;
1586}
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 @@
1// DipstickDlg.h : header file
2//
3
4class CDipstickDlg;
5 struct CPingyHost{
6 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){}
7 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){}
8 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){}
9 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){}
10public:
11 static UINT SuicideProc(LPVOID pParam);
12 void Suicide();
13 void Ping();
14 UINT DoPing();
15 static UINT PingProc(LPVOID);
16 CDipstickDlg* m_Daddy;
17 CMutex m_mutex;
18 CString m_Descr;
19 CString m_URL;
20 BOOL m_bToPing;
21 BOOL m_Pinging;
22 CStringm_HostName;
23 CString m_Status;
24 DWORD m_IP;
25 ULONG m_MinRTT;
26 ULONG m_AvgRTT;
27 ULONG m_MaxRTT;
28 BOOL m_Pinged;
29 int m_Packetloss;
30};
31
32 typedef CList<CPingyHost*,CPingyHost*>CHostList;
33
34/////////////////////////////////////////////////////////////////////////////
35// CDipstickDlg dialog
36
37class CDragPad;
38class CDipstickDlg : public CDialog
39{
40// Construction
41 struct _xferHTML{
42 CString html;
43 CCrackURL src;
44 };
45public:
46 BOOL ExportLocations(LPCTSTR file);
47 CString m_impexPath;
48 BOOL ImportLocations(LPCTSTR file);
49 BOOL m_bIgnorelative;
50 CEvent m_eveStartup;
51 UINT volatile m_ActiveThreads;
52 BOOL m_bAdjustInnermost;
53 BOOL m_bSmartAdjust;
54 BOOL CollectURLs(COleDataObject* pDO,BOOL bTestOnly=FALSE);
55 BOOL IsPasteableClipboard();
56 void UpdateDragpadTitle();
57 BOOL m_bAutoBest;
58 void RecalcLayout(int cx,int cy);
59 CSize m_MinSize;
60 UINT m_GapY;
61 UINT m_OverY;
62 UINT m_OverX;
63 BOOL m_bMSWorkAround;
64 CRegEx m_reCrackHost;
65 CRegEx m_reNestedURL;
66 CRegEx m_reHTMLURL; // 1 - URL
67 CRegEx m_reCrackURL; //3 - schema, 4 - host, 5 - path, 7 - query string
68 BITMAP m_bitmapBack;
69 CBitmap m_bmpBack;
70 int m_iUnreachable;
71 int m_iCompleted;
72 int m_iPinging;
73 int m_iPending;
74 CImageList m_Images;
75 void UpdateControlButtons();
76 BOOL m_bExiting;
77 int CheckForPendingRequests();
78 UINT m_MaxThreads;
79 BOOL m_bShown;
80 enum{
81 sortHost, sortIP, sortMin, sortAvg, sortMax, sortLoss
82 };
83 int m_SortCriteria;
84 static int CALLBACK CompareItems(LPARAM lp1, LPARAM lp2, LPARAM lp);
85 DWORD m_Interval;
86 BOOL RemovePingyHost(CPingyHost *host,int index=-1);
87 BOOL UpdatePingyHost(CPingyHost *host,int index=-1);
88 BOOL AddPingyHost(CPingyHost *host);
89 CHostList m_Hosts;
90 enum{
91 subitemHost = 0, subitemIP, subitemMin,subitemAvg,subitemMax, subitemPacketloss
92 };
93 DWORD m_TimeOut;
94 UINT m_PingSize;
95 UINT m_PingsPerHost;
96 CDragPad * m_DragPad;
97 ~CDipstickDlg();
98 CDipstickDlg(CWnd* pParent = NULL);// standard constructor
99
100// Dialog Data
101 //{{AFX_DATA(CDipstickDlg)
102 enum { IDD = IDD_DIPSTICK_DIALOG };
103 CButtonm_AdvancedCtl;
104 CButtonm_HelpCtl;
105 CButtonm_ExitCtl;
106 CButtonm_OptionsCtl;
107 CButtonm_ManualPingCtl;
108 CButtonm_RemoveCtl;
109 CButtonm_RepingAllCtl;
110 CButtonm_RepingCtl;
111 CButtonm_ClearListCtl;
112 CListCtrlm_HostList;
113 //}}AFX_DATA
114
115 // ClassWizard generated virtual function overrides
116 //{{AFX_VIRTUAL(CDipstickDlg)
117 protected:
118 virtual void DoDataExchange(CDataExchange* pDX);// DDX/DDV support
119 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
120 //}}AFX_VIRTUAL
121
122// Implementation
123protected:
124 HICON m_hIcon;
125
126 // Generated message map functions
127 //{{AFX_MSG(CDipstickDlg)
128 virtual BOOL OnInitDialog();
129 afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
130 afx_msg void OnPaint();
131 afx_msg HCURSOR OnQueryDragIcon();
132 afx_msg void OnDestroy();
133 afx_msg void OnOptions();
134 afx_msg LRESULT OnUrlPing(WPARAM,LPARAM);
135 afx_msg LRESULT OnActivityCount(WPARAM,LPARAM);
136 afx_msg LRESULT OnUpdateHostData(WPARAM,LPARAM);
137 afx_msg LRESULT OnHTMLTransfer(WPARAM,LPARAM);
138 afx_msg void OnColumnclickHostlist(NMHDR* pNMHDR, LRESULT* pResult);
139 afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
140 afx_msg void OnDragpadOptions();
141 afx_msg void OnDragpadShowmainwindow();
142 afx_msg void OnDragpadHelp();
143 afx_msg void OnDragpadAbout();
144 afx_msg void OnDragpadExit();
145 virtual void OnOK();
146 virtual void OnCancel();
147 afx_msg void OnManualping();
148 afx_msg void OnDragpadManualping();
149 afx_msg void OnDragpadRepingAll();
150 afx_msg void OnDragpadRemoveAll();
151 afx_msg void OnReping();
152 afx_msg void OnRepingall();
153 afx_msg void OnClear();
154 afx_msg void OnInsertitemHostlist(NMHDR* pNMHDR, LRESULT* pResult);
155 afx_msg void OnDeleteitemHostlist(NMHDR* pNMHDR, LRESULT* pResult);
156 afx_msg void OnDeleteallitemsHostlist(NMHDR* pNMHDR, LRESULT* pResult);
157 afx_msg void OnExit();
158 afx_msg void OnItemchangedHostlist(NMHDR* pNMHDR, LRESULT* pResult);
159 afx_msg void OnRemove();
160 afx_msg void OnRclickHostlist(NMHDR* pNMHDR, LRESULT* pResult);
161 afx_msg void OnHostListReping();
162 afx_msg void OnHostListRemove();
163 afx_msg void OnHostListRepingAll();
164 afx_msg void OnHostListRemoveAll();
165 afx_msg void OnHostListOpenURL();
166 afx_msg void OnHostListProperties();
167 afx_msg void OnDblclkHostlist(NMHDR* pNMHDR, LRESULT* pResult);
168 afx_msg void OnClose();
169 afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
170 afx_msg void OnSize(UINT nType, int cx, int cy);
171 afx_msg void OnHelp();
172 afx_msg void OnBegindragHostlist(NMHDR* pNMHDR, LRESULT* pResult);
173 afx_msg void OnPasteurl();
174 afx_msg void OnHostlistCopyurl();
175 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
176 afx_msg void OnDropFiles(HDROP hDropInfo);
177 afx_msg void OnAdvanced();
178 afx_msg void OnAdvancedExportlist();
179 afx_msg void OnAdvancedImportlist();
180 afx_msg void OnDragpadAdvancedExportlist();
181 afx_msg void OnDragpadAdvancedImportlist();
182 //}}AFX_MSG
183 DECLARE_MESSAGE_MAP()
184};
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 @@
1// DragPad.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "Dipstick.h"
6#include "DragPad.h"
7#include "DipstickDlg.h"
8
9#ifdef _DEBUG
10#define new DEBUG_NEW
11#undef THIS_FILE
12static char THIS_FILE[] = __FILE__;
13#endif
14
15/////////////////////////////////////////////////////////////////////////////
16// CDragPad dialog
17
18
19CDragPad::CDragPad(CWnd* pParent /*=NULL*/)
20 : CDialog(CDragPad::IDD, pParent)
21{
22 //{{AFX_DATA_INIT(CDragPad)
23 //}}AFX_DATA_INIT
24 m_DropTarget.m_Pad = this;
25}
26
27CDragPad::~CDragPad()
28{
29}
30
31void CDragPad::DoDataExchange(CDataExchange* pDX)
32{
33 CDialog::DoDataExchange(pDX);
34 //{{AFX_DATA_MAP(CDragPad)
35 DDX_Control(pDX, IDC_DNDTARGET, m_DragNDropTarget);
36 //}}AFX_DATA_MAP
37}
38
39
40BEGIN_MESSAGE_MAP(CDragPad, CDialog)
41 //{{AFX_MSG_MAP(CDragPad)
42 ON_WM_WINDOWPOSCHANGED()
43 ON_WM_NCACTIVATE()
44 ON_WM_DESTROY()
45 ON_WM_CREATE()
46 ON_WM_LBUTTONDBLCLK()
47 ON_WM_RBUTTONDOWN()
48 ON_WM_LBUTTONDOWN()
49 ON_WM_HELPINFO()
50 //}}AFX_MSG_MAP
51END_MESSAGE_MAP()
52
53/////////////////////////////////////////////////////////////////////////////
54// CDragPad message handlers
55
56BOOL CDragPad::OnInitDialog()
57{
58 CDialog::OnInitDialog();
59
60 m_DropTarget.Register(&m_DragNDropTarget);
61 m_DragNDropTarget.Open(IDR_DNDAVI);
62CRect rc;
63 m_DragNDropTarget.GetClientRect(rc);
64 m_DragNDropTarget.MoveWindow(rc,FALSE);
65CRect wrc,crc,drc, nrc;
66 GetWindowRect(wrc);
67 GetClientRect(crc);
68 GetDesktopWindow()->GetClientRect(drc);
69 nrc.left = drc.right-(rc.Width()+(wrc.Width()-crc.Width())) - 5;
70 nrc.top = drc.bottom-(rc.Height()+(wrc.Height()-crc.Height())) - 5;
71CWinApp *app = AfxGetApp();
72 ASSERT(app);
73 ScreenToClient(nrc);
74 nrc.top=app->GetProfileInt("Windows","DragPadTop",nrc.top);
75 nrc.left=app->GetProfileInt("Windows","DragPadLeft",nrc.left);
76 nrc.right = nrc.left+(rc.Width()+(wrc.Width()-crc.Width()));
77 nrc.bottom = nrc.top+(rc.Height()+(wrc.Height()-crc.Height()));
78 MoveWindow(nrc,FALSE);
79
80 // CG: The following block was added by the ToolTips component.
81 {
82 // Create the ToolTip control.
83 m_tooltip.Create(this);
84 m_tooltip.Activate(TRUE);
85 }
86
87 return TRUE; // return TRUE unless you set the focus to a control
88 // EXCEPTION: OCX Property Pages should return FALSE
89}
90
91void CDragPad::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos)
92{
93 CDialog::OnWindowPosChanged(lpwndpos);
94 if(lpwndpos->hwnd!=m_hWnd)
95 SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
96}
97
98BOOL CDragPad::PreCreateWindow(CREATESTRUCT& cs)
99{
100 cs.dwExStyle|=WS_EX_TOPMOST;
101 return CDialog::PreCreateWindow(cs);
102}
103
104BOOL CDragPad::OnNcActivate(BOOL bActive)
105{
106 if(!bActive)
107 SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE);
108 return CDialog::OnNcActivate(bActive);
109}
110
111void CDragPad::OnDestroy()
112{
113 CDialog::OnDestroy();
114 TRACE0("DestroyPad\n");
115 RevokeDragDrop(m_DragNDropTarget.m_hWnd);
116}
117
118int CDragPad::OnCreate(LPCREATESTRUCT lpCreateStruct)
119{
120 if (CDialog::OnCreate(lpCreateStruct) == -1)
121 return -1;
122CRect rc,drc, nrc;
123CWinApp *app = AfxGetApp();
124 ASSERT(app);
125 GetWindowRect(rc);
126 GetDesktopWindow()->GetClientRect(drc);
127 nrc.left = drc.right-rc.Width() - 5;
128 nrc.top = drc.bottom-rc.Height() - 5;
129 ScreenToClient(nrc);
130 nrc.top=app->GetProfileInt("Windows","DragPadTop",nrc.top);
131 nrc.left=app->GetProfileInt("Windows","DragPadLeft",nrc.left);
132 nrc.right = nrc.left+rc.Width();
133 nrc.bottom = nrc.top+rc.Height();
134 MoveWindow(nrc);
135 return 0;
136}
137
138void CDragPad::OnLButtonDblClk(UINT nFlags, CPoint point)
139{
140 ToggleMainWindowDisplay();
141 CDialog::OnLButtonDblClk(nFlags, point);
142}
143
144void CDragPad::OnRButtonDown(UINT nFlags, CPoint point)
145{
146CMenu menus;
147 VERIFY(menus.LoadMenu(IDR_MENU));
148 CMenu *dpm = menus.GetSubMenu(0);// *** Position?
149 ASSERT(dpm);
150CPoint pt = point;
151 ClientToScreen(&pt);
152 m_Daddy->UpdateControlButtons();
153 dpm->CheckMenuItem(ID_DRAGPAD_SHOWMAINWINDOW,MF_BYCOMMAND|(m_Daddy->m_bShown?MF_CHECKED:MF_UNCHECKED));
154 dpm->EnableMenuItem(ID_DRAGPAD_REPINGALL,MF_BYCOMMAND|(m_Daddy->m_RepingAllCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
155 dpm->EnableMenuItem(ID_DRAGPAD_REMOVEALL,MF_BYCOMMAND|(m_Daddy->m_ClearListCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED));
156 dpm->EnableMenuItem(ID_DRAGPAD_PASTEURL,MF_BYCOMMAND|(m_Daddy->IsPasteableClipboard()?MF_ENABLED:MF_GRAYED));
157 dpm->EnableMenuItem(ID_DRAGPAD_ADVANCED_EXPORTLIST,MF_BYCOMMAND|(m_Daddy->m_HostList.GetItemCount()?MF_ENABLED:MF_GRAYED));
158 dpm->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,m_Daddy,NULL);
159 CDialog::OnRButtonDown(nFlags, point);
160}
161
162void CDragPad::OnLButtonDown(UINT nFlags, CPoint point)
163{
164 ToggleMainWindowDisplay();
165 CDialog::OnLButtonDown(nFlags, point);
166}
167
168void CDragPad::ToggleMainWindowDisplay()
169{
170 if(m_Daddy->IsWindowVisible()){
171 m_Daddy->m_bShown=FALSE;
172 m_Daddy->ShowWindow(SW_HIDE);
173 }else{
174 m_Daddy->m_bShown=TRUE;
175 m_Daddy->ShowWindow(SW_SHOW);
176 }
177}
178
179BOOL CDragPad::PreTranslateMessage(MSG* pMsg)
180{
181 // CG: The following block was added by the ToolTips component.
182 {
183 // Let the ToolTip process this message.
184 m_tooltip.RelayEvent(pMsg);
185
186 return CDialog::PreTranslateMessage(pMsg);
187 }
188}
189
190DROPEFFECT CDUTarget::OnDragEnter(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt)
191{
192 if(m_Pad->m_Daddy->CollectURLs(pDO,TRUE))
193 return m_dropAsEntered=DROPEFFECT_LINK|DROPEFFECT_COPY|DROPEFFECT_MOVE;
194 else
195 return m_dropAsEntered=DROPEFFECT_NONE;
196}
197DROPEFFECT CDUTarget::OnDragOver(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt)
198{
199 return m_dropAsEntered;
200}
201DROPEFFECT CDUTarget::OnDropEx(CWnd* pWnd,COleDataObject* pDO,DROPEFFECT dropDefault,DROPEFFECT dropList,CPoint pt)
202{
203 if(m_Pad->m_Daddy->CollectURLs(pDO,FALSE))
204 return DROPEFFECT_LINK|DROPEFFECT_COPY|DROPEFFECT_MOVE;
205 else
206 return DROPEFFECT_NONE;
207}
208
209BOOL CDragPad::OnHelpInfo(HELPINFO* pHelpInfo)
210{
211 WinHelp(IDD|0x20000l);
212 return TRUE;
213}
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 @@
1// DragPad.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CDragPad dialog
6
7class CDragPad;
8 class CDUTarget : public COleDropTarget{
9public:
10 CDragPad* m_Pad;
11 DROPEFFECT m_dropAsEntered;
12
13 virtual DROPEFFECT OnDragEnter(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt);
14 virtual DROPEFFECT OnDragOver(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt);
15 virtual DROPEFFECT OnDropEx(CWnd* pWnd,COleDataObject* pDO,DROPEFFECT dropDefault,DROPEFFECT dropList,CPoint pt);
16};
17
18class CDipstickDlg;
19class CDragPad : public CDialog
20{
21// Construction
22public:
23 CDUTarget m_DropTarget;
24 virtual BOOL PreTranslateMessage(MSG* pMsg);
25 void ToggleMainWindowDisplay();
26 CDipstickDlg *m_Daddy;
27 ~CDragPad();
28 CDragPad(CWnd* pParent = NULL); // standard constructor
29
30// Dialog Data
31 //{{AFX_DATA(CDragPad)
32 enum { IDD = IDD_DRAGPAD };
33 CAnimateCtrlm_DragNDropTarget;
34 //}}AFX_DATA
35
36
37// Overrides
38 // ClassWizard generated virtual function overrides
39 //{{AFX_VIRTUAL(CDragPad)
40 protected:
41 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
42 virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
43 //}}AFX_VIRTUAL
44
45// Implementation
46protected:
47 CToolTipCtrl m_tooltip;
48
49 // Generated message map functions
50 //{{AFX_MSG(CDragPad)
51 virtual BOOL OnInitDialog();
52 afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
53 afx_msg BOOL OnNcActivate(BOOL bActive);
54 afx_msg void OnDestroy();
55 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
56 afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
57 afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
58 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
59 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
60 //}}AFX_MSG
61 DECLARE_MESSAGE_MAP()
62};
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 @@
1// DropURL.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "Dipstick.h"
6#include "DropURL.h"
7#include "DragPad.h"
8#include "Dipstick.h"
9
10#ifdef _DEBUG
11#define new DEBUG_NEW
12#undef THIS_FILE
13static char THIS_FILE[] = __FILE__;
14#endif
15
16/////////////////////////////////////////////////////////////////////////////
17// CDropURL
18
19IMPLEMENT_DYNCREATE(CDropURL, CCmdTarget)
20
21CDropURL::CDropURL()
22 : m_Pad(NULL)
23{
24}
25
26CDropURL::~CDropURL()
27{
28}
29
30
31BEGIN_MESSAGE_MAP(CDropURL, CCmdTarget)
32 //{{AFX_MSG_MAP(CDropURL)
33 //}}AFX_MSG_MAP
34END_MESSAGE_MAP()
35
36BEGIN_INTERFACE_MAP(CDropURL, CCmdTarget)
37 INTERFACE_PART(CDropURL, IID_IDropTarget, DDropTarget)
38END_INTERFACE_MAP()
39
40/////////////////////////////////////////////////////////////////////////////
41// CDropURL message handlers
42
43STDMETHODIMP_(ULONG) CDropURL::XDDropTarget::AddRef()
44{
45 METHOD_PROLOGUE(CDropURL, DDropTarget)
46 return pThis->ExternalAddRef();
47}
48STDMETHODIMP_(ULONG) CDropURL::XDDropTarget::Release()
49{
50 METHOD_PROLOGUE(CDropURL, DDropTarget)
51 return pThis->ExternalRelease();
52}
53STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::QueryInterface(REFIID iid,void FAR* FAR * ppvObj)
54{
55 METHOD_PROLOGUE(CDropURL, DDropTarget)
56 return pThis->ExternalQueryInterface(&iid,ppvObj);
57}
58
59STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::DragEnter(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
60{
61 METHOD_PROLOGUE(CDropURL, DDropTarget)
62 TRACE0("DragEnter\n");
63 return pThis->DragEnter(pDataObject,grfKeyState,pt,pdwEffect);
64}
65STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::DragOver(DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
66{
67 METHOD_PROLOGUE(CDropURL, DDropTarget)
68 return S_OK;
69}
70STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::DragLeave(void)
71{
72 METHOD_PROLOGUE(CDropURL, DDropTarget)
73 TRACE0("DragLeave\n");
74 return S_OK;
75}
76STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::Drop(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
77{
78 METHOD_PROLOGUE(CDropURL, DDropTarget)
79 TRACE0("Drop\n");
80 return pThis->Drop(pDataObject,grfKeyState,pt,pdwEffect);
81}
82
83
84HRESULT CDropURL::DragEnter(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect)
85{
86CString host = GetHostName(pDataObject);
87 if(host.IsEmpty()){
88 (*pdwEffect)=DROPEFFECT_NONE;
89 return S_FALSE;
90 }else{
91 (*pdwEffect)=DROPEFFECT_LINK;
92 return S_OK;
93 }
94}
95
96CString CDropURL::GetHostName(IDataObject *pDataObject,CString *_url)
97{
98FORMATETC fetc;
99 fetc.cfFormat=CF_TEXT;
100 fetc.ptd=NULL;
101 fetc.dwAspect=DVASPECT_CONTENT;
102 fetc.lindex=-1;
103 fetc.tymed=TYMED_HGLOBAL;
104STGMEDIUM stgm;
105 LPVOIDglobe = NULL;
106 CStringurl;
107CString rv;
108 stgm.pUnkForRelease=NULL;
109 do{
110 if(pDataObject->GetData(&fetc,&stgm)!=S_OK)
111 break;
112 ASSERT(stgm.tymed==TYMED_HGLOBAL);
113 if(GlobalSize(stgm.hGlobal)>=1024)
114 break;
115 VERIFY(globe=GlobalLock(stgm.hGlobal));
116 url=(LPTSTR)globe;
117 TRACE0("["+url+"]\n");
118 if(_url)
119 (*_url) = url;
120 rv = m_Pad->m_Daddy->GetHostName(url);
121 }while(FALSE);
122 if(globe)
123 GlobalUnlock(stgm.hGlobal);
124 if(stgm.pUnkForRelease)
125 stgm.pUnkForRelease->Release();
126 return rv;
127}
128
129HRESULT CDropURL::Drop(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pwdEffect)
130{
131CString url;
132CString host = GetHostName(pDataObject,&url);
133 if(host.IsEmpty())
134 return S_FALSE;
135 #ifdefTRUE
136 // URL Mode
137CString *u = new CString(url);
138 m_Pad->m_Daddy->PostMessage(WM_DNP_URLPING,0,(LPARAM)u);
139#else
140CString *hn = new CString(host);
141 m_Pad->m_Daddy->PostMessage(WM_DNP_HOSTPING,0,(LPARAM)hn);
142#endif
143 return S_OK;
144}
145void CDropURL::OnFinalRelease()
146{
147 TRACE0("Final Release\n");
148 CCmdTarget::OnFinalRelease();
149}
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 @@
1// DropURL.h : header file
2//
3
4
5
6/////////////////////////////////////////////////////////////////////////////
7// CDropURL command target
8
9class CDragPad;
10class CDropURL : public CCmdTarget
11{
12 DECLARE_DYNCREATE(CDropURL)
13
14 CDropURL(); // protected constructor used by dynamic creation
15
16// Attributes
17public:
18 CDragPad* m_Pad;
19 HRESULT Drop(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pwdEffect);
20 CString GetHostName(IDataObject *pDataObject,CString *url = NULL);
21 HRESULT DragEnter(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect);
22
23// Operations
24public:
25
26// Overrides
27 // ClassWizard generated virtual function overrides
28 //{{AFX_VIRTUAL(CDropURL)
29 public:
30 virtual void OnFinalRelease();
31 //}}AFX_VIRTUAL
32
33// Implementation
34protected:
35 virtual ~CDropURL();
36
37 // Generated message map functions
38 //{{AFX_MSG(CDropURL)
39 //}}AFX_MSG
40
41 DECLARE_MESSAGE_MAP()
42
43 DECLARE_INTERFACE_MAP()
44
45 BEGIN_INTERFACE_PART(DDropTarget, IDropTarget)
46 STDMETHOD_(HRESULT, DragEnter)(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect);
47 STDMETHOD_(HRESULT, DragOver)(DWORD grfKeyState,POINTL pt,DWORD *pdwEffect);
48 STDMETHOD_(HRESULT, DragLeave)(void);
49 STDMETHOD_(HRESULT, Drop)(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect);
50 END_INTERFACE_PART(DDropTarget);
51
52};
53
54/////////////////////////////////////////////////////////////////////////////
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 @@
1// HostNameDlg.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "Dipstick.h"
6#include "HostNameDlg.h"
7
8#ifdef _DEBUG
9#define new DEBUG_NEW
10#undef THIS_FILE
11static char THIS_FILE[] = __FILE__;
12#endif
13
14/////////////////////////////////////////////////////////////////////////////
15// CHostNameDlg dialog
16
17
18CHostNameDlg::CHostNameDlg(CWnd* pParent /*=NULL*/)
19 : CDialog(CHostNameDlg::IDD, pParent)
20{
21 //{{AFX_DATA_INIT(CHostNameDlg)
22 m_Host = _T("");
23 //}}AFX_DATA_INIT
24}
25
26
27void CHostNameDlg::DoDataExchange(CDataExchange* pDX)
28{
29 CDialog::DoDataExchange(pDX);
30 //{{AFX_DATA_MAP(CHostNameDlg)
31 DDX_Text(pDX, IDC_HOST, m_Host);
32 //}}AFX_DATA_MAP
33}
34
35
36BEGIN_MESSAGE_MAP(CHostNameDlg, CDialog)
37 //{{AFX_MSG_MAP(CHostNameDlg)
38 ON_WM_HELPINFO()
39 //}}AFX_MSG_MAP
40END_MESSAGE_MAP()
41
42/////////////////////////////////////////////////////////////////////////////
43// CHostNameDlg message handlers
44
45BOOL CHostNameDlg::OnHelpInfo(HELPINFO* pHelpInfo)
46{
47 WinHelp(IDD|0x20000l);
48 return TRUE;
49}
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 @@
1// HostNameDlg.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CHostNameDlg dialog
6
7class CHostNameDlg : public CDialog
8{
9// Construction
10public:
11 CHostNameDlg(CWnd* pParent = NULL); // standard constructor
12
13// Dialog Data
14 //{{AFX_DATA(CHostNameDlg)
15 enum { IDD = IDD_MANUALHOST };
16 CStringm_Host;
17 //}}AFX_DATA
18
19
20// Overrides
21 // ClassWizard generated virtual function overrides
22 //{{AFX_VIRTUAL(CHostNameDlg)
23 protected:
24 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
25 //}}AFX_VIRTUAL
26
27// Implementation
28protected:
29
30 // Generated message map functions
31 //{{AFX_MSG(CHostNameDlg)
32 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
33 //}}AFX_MSG
34 DECLARE_MESSAGE_MAP()
35};
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 @@
1// HostProperties.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "Dipstick.h"
6#include "HostProperties.h"
7#include "DipstickDlg.h"
8
9#ifdef _DEBUG
10#define new DEBUG_NEW
11#undef THIS_FILE
12static char THIS_FILE[] = __FILE__;
13#endif
14
15/////////////////////////////////////////////////////////////////////////////
16// CHostProperties dialog
17
18
19CHostProperties::CHostProperties(CWnd* pParent /*=NULL*/)
20 : CDialog(CHostProperties::IDD, pParent)
21{
22 //{{AFX_DATA_INIT(CHostProperties)
23 m_Host = _T("");
24 m_IP = _T("");
25 m_Loss = _T("");
26 m_Status = _T("");
27 m_Times = _T("");
28 m_URL = _T("");
29 //}}AFX_DATA_INIT
30}
31
32
33void CHostProperties::DoDataExchange(CDataExchange* pDX)
34{
35 CDialog::DoDataExchange(pDX);
36 //{{AFX_DATA_MAP(CHostProperties)
37 DDX_Control(pDX, IDC_STATE, m_StateCtl);
38 DDX_Control(pDX, IDC_URLCAPTION, m_URLCaptionCtl);
39 DDX_Control(pDX, IDC_URL, m_URLCtl);
40 DDX_Control(pDX, IDC_TIMESCAPTION, m_TimesCaptionCtl);
41 DDX_Control(pDX, IDC_TIMES, m_TimesCtl);
42 DDX_Control(pDX, IDC_STATUSCAPTION, m_StatusCaptionCtl);
43 DDX_Control(pDX, IDC_STATUS, m_StatusCtl);
44 DDX_Control(pDX, IDC_OPENURL, m_OpenURLCtl);
45 DDX_Control(pDX, IDC_LOSSCAPTION, m_LossCaptionCtl);
46 DDX_Control(pDX, IDC_LOSS, m_LossCtl);
47 DDX_Control(pDX, IDC_IPCAPTION, m_IPCaptionCtl);
48 DDX_Control(pDX, IDC_IP, m_IPCtl);
49 DDX_Control(pDX, IDC_HOSTCAPTION, m_HostCaptionCtl);
50 DDX_Control(pDX, IDC_HOST, m_HostCtl);
51 DDX_Text(pDX, IDC_HOST, m_Host);
52 DDX_Text(pDX, IDC_IP, m_IP);
53 DDX_Text(pDX, IDC_LOSS, m_Loss);
54 DDX_Text(pDX, IDC_STATUS, m_Status);
55 DDX_Text(pDX, IDC_TIMES, m_Times);
56 DDX_Text(pDX, IDC_URL, m_URL);
57 //}}AFX_DATA_MAP
58}
59
60
61BEGIN_MESSAGE_MAP(CHostProperties, CDialog)
62 //{{AFX_MSG_MAP(CHostProperties)
63 ON_BN_CLICKED(IDC_OPENURL, OnOpenurl)
64 ON_WM_HELPINFO()
65 //}}AFX_MSG_MAP
66END_MESSAGE_MAP()
67
68/////////////////////////////////////////////////////////////////////////////
69// CHostProperties message handlers
70
71BOOL CHostProperties::OnInitDialog()
72{
73 CDialog::OnInitDialog();
74
75 ASSERT(host);
76 if(host->m_HostName.IsEmpty()){
77 m_HostCtl.ShowWindow(SW_HIDE);
78 m_HostCaptionCtl.ShowWindow(SW_HIDE);
79 }else
80 m_Host = host->m_HostName;
81 if(host->m_IP)
82 m_IP = inet_ntoa(*(in_addr*)&host->m_IP);
83 else{
84 m_IPCtl.ShowWindow(SW_HIDE);
85 m_IPCaptionCtl.ShowWindow(SW_HIDE);
86 }
87 if(host->m_Pinged){
88 m_Loss.Format(IDS_FMT_LOSS,host->m_Packetloss);
89 m_Times.Format(IDS_FMT_TIMES,host->m_MinRTT,host->m_AvgRTT,host->m_MaxRTT);
90 }else{
91 m_LossCtl.ShowWindow(SW_HIDE);
92 m_LossCaptionCtl.ShowWindow(SW_HIDE);
93 m_TimesCtl.ShowWindow(SW_HIDE);
94 m_TimesCaptionCtl.ShowWindow(SW_HIDE);
95 }
96 if(host->m_URL.IsEmpty()){
97 m_URLCtl.ShowWindow(SW_HIDE);
98 m_URLCaptionCtl.ShowWindow(SW_HIDE);
99 m_OpenURLCtl.ShowWindow(SW_HIDE);
100 }else
101 m_URL = host->m_URL;
102 if(host->m_Status.IsEmpty()){
103 m_StatusCtl.ShowWindow(SW_HIDE);
104 m_StatusCaptionCtl.ShowWindow(SW_HIDE);
105 }else
106 m_Status = host->m_Status;
107
108 // CG: The following block was added by the ToolTips component.
109 {
110 // Create the ToolTip control.
111 m_tooltip.Create(this);
112 m_tooltip.Activate(TRUE);
113
114 m_tooltip.AddTool(&m_HostCaptionCtl,IDC_HOSTCAPTION);
115 m_tooltip.AddTool(&m_HostCtl,IDC_HOST);
116 m_tooltip.AddTool(&m_IPCaptionCtl,IDC_IPCAPTION);
117 m_tooltip.AddTool(&m_IPCtl,IDC_IPCAPTION);
118 m_tooltip.AddTool(&m_LossCaptionCtl,IDC_LOSSCAPTION);
119 m_tooltip.AddTool(&m_LossCtl,IDC_LOSS);
120 m_tooltip.AddTool(&m_OpenURLCtl,IDC_OPENURL);
121 m_tooltip.AddTool(&m_StatusCaptionCtl,IDC_STATUSCAPTION);
122 m_tooltip.AddTool(&m_StatusCtl,IDC_STATUS);
123 m_tooltip.AddTool(&m_TimesCaptionCtl,IDC_TIMESCAPTION);
124 m_tooltip.AddTool(&m_TimesCtl,IDC_TIMES);
125 m_tooltip.AddTool(&m_URLCaptionCtl,IDC_URLCAPTION);
126 m_tooltip.AddTool(&m_URLCtl,IDC_URL);
127 m_tooltip.AddTool(GetDlgItem(IDOK),IDS_TIP_PROPSOK);
128
129 if(host->m_Pinging){
130 m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PINGING));
131 m_tooltip.AddTool(&m_StateCtl,IDS_TIP_PINGING);
132 }else{
133 if(host->m_bToPing){
134 m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PENDING));
135 m_tooltip.AddTool(&m_StateCtl,IDS_TIP_PENDING);
136 }else{
137 if(host->m_Pinged){
138 if(host->m_Packetloss==100){
139 m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_UNREACHABLE));
140 m_tooltip.AddTool(&m_StateCtl,IDS_TIP_UNREACHABLE);
141 }else{
142 m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_COMPLETED));
143 m_tooltip.AddTool(&m_StateCtl,IDS_TIP_COMPLETE);
144 }
145 }else{
146 m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PENDING));
147 m_tooltip.AddTool(&m_StateCtl,IDS_TIP_PENDING);
148 }
149 }
150 }
151
152 UpdateData(FALSE);
153
154 }
155 return TRUE; // return TRUE unless you set the focus to a control
156 // EXCEPTION: OCX Property Pages should return FALSE
157}
158
159void CHostProperties::SetHost(CPingyHost *host)
160{
161 CHostProperties::host = host;
162}
163
164void CHostProperties::OnOpenurl()
165{
166 ASSERT(!m_URL.IsEmpty());
167 ShellExecute(::GetDesktopWindow(),"open",m_URL,NULL,NULL,SW_SHOWMAXIMIZED);
168}
169
170BOOL CHostProperties::PreTranslateMessage(MSG* pMsg)
171{
172 // CG: The following block was added by the ToolTips component.
173 {
174 // Let the ToolTip process this message.
175 m_tooltip.RelayEvent(pMsg);
176
177 return CDialog::PreTranslateMessage(pMsg);
178 }
179}
180
181BOOL CHostProperties::OnHelpInfo(HELPINFO* pHelpInfo)
182{
183 WinHelp(IDD|0x20000l);
184 return TRUE;
185}
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 @@
1// HostProperties.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CHostProperties dialog
6
7struct CPingyHost;
8class CHostProperties : public CDialog
9{
10// Construction
11public:
12 virtual BOOL PreTranslateMessage(MSG* pMsg);
13 void SetHost(CPingyHost *host);
14 CPingyHost * host;
15 CHostProperties(CWnd* pParent = NULL); // standard constructor
16
17// Dialog Data
18 //{{AFX_DATA(CHostProperties)
19 enum { IDD = IDD_PROPS };
20 CStaticm_StateCtl;
21 CStaticm_URLCaptionCtl;
22 CStaticm_URLCtl;
23 CStaticm_TimesCaptionCtl;
24 CStaticm_TimesCtl;
25 CStaticm_StatusCaptionCtl;
26 CStaticm_StatusCtl;
27 CButtonm_OpenURLCtl;
28 CStaticm_LossCaptionCtl;
29 CStaticm_LossCtl;
30 CStaticm_IPCaptionCtl;
31 CStaticm_IPCtl;
32 CStaticm_HostCaptionCtl;
33 CStaticm_HostCtl;
34 CStringm_Host;
35 CStringm_IP;
36 CStringm_Loss;
37 CStringm_Status;
38 CStringm_Times;
39 CStringm_URL;
40 //}}AFX_DATA
41
42
43// Overrides
44 // ClassWizard generated virtual function overrides
45 //{{AFX_VIRTUAL(CHostProperties)
46 protected:
47 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
48 //}}AFX_VIRTUAL
49
50// Implementation
51protected:
52 CToolTipCtrl m_tooltip;
53
54 // Generated message map functions
55 //{{AFX_MSG(CHostProperties)
56 virtual BOOL OnInitDialog();
57 afx_msg void OnOpenurl();
58 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
59 //}}AFX_MSG
60 DECLARE_MESSAGE_MAP()
61};
diff --git a/KTAGS b/KTAGS
new file mode 100644
index 0000000..e3cc88a
--- a/dev/null
+++ b/KTAGS
@@ -0,0 +1,15 @@
1 about-date dipstick.rc /LTEXT\s\+"Copyright /;"kind:d
2 about-version dipstick.rc /LTEXT\s\+"Dipstick, Version/;"kind:v
3 dialog-version dipstick.rc /^CAPTION\s\+" Dipstick/;"kind:v
4 dndtarget-version dipstick.rc /IDC_DNDTARGET\s\+"Dipstick /;"kind:v
5 dragpad-version dipstick.rc /IDS_DRAGPAD_TITLE\s\+" Dipstick /;"kind:v
6 help-license-date ./help/dipstick.xml /<license\s/;"kind:d
7 help-news ./help/dipstick.xml/<newsfor\s/
8 install-version ./install/install.cpp /^#define\s\+VERSION\s\+"/;"kind:v
9 install-vsinfo-date install/install.rc /^\s\+VALUE\s\+"LegalCopyright",/;"kind:d
10 install-vsinfo-numeric-version install/install.rc /^\s\+FILEVERSION\s\+/;"kind:v
11 install-vsinfo-string-version install/install.rc /^\s\+VALUE\s\+"FileVersion",/;"kind:v
12 license-date COPYING :1;"kind:d
13 vsinfo-date dipstick.rc /VALUE\s\+"LegalCopyright",/;"kind:d
14 vsinfo-numeric-version dipstick.rc /^\s\+FILEVERSION\s\+/;"kind:v
15 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 @@
1// OptionsDlg.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "Dipstick.h"
6#include "OptionsDlg.h"
7
8#ifdef _DEBUG
9#define new DEBUG_NEW
10#undef THIS_FILE
11static char THIS_FILE[] = __FILE__;
12#endif
13
14/////////////////////////////////////////////////////////////////////////////
15// COptionsDlg dialog
16
17
18COptionsDlg::COptionsDlg(CWnd* pParent /*=NULL*/)
19 : CDialog(COptionsDlg::IDD, pParent)
20{
21 //{{AFX_DATA_INIT(COptionsDlg)
22 m_Pings = 0;
23 m_PingSize = 0;
24 m_TimeOut = 0;
25 m_Interval = 0;
26 m_MaxThreads = 0;
27 m_bMSWorkAround = FALSE;
28 m_bAutoBest = FALSE;
29 m_bAdjustInn = FALSE;
30 m_bIgnorelative = FALSE;
31 m_bAdjust = FALSE;
32 //}}AFX_DATA_INIT
33}
34
35
36void COptionsDlg::DoDataExchange(CDataExchange* pDX)
37{
38 CDialog::DoDataExchange(pDX);
39 //{{AFX_DATA_MAP(COptionsDlg)
40 DDX_Control(pDX, IDC_SPINTIMEOUT, m_SpinTimeOutCtl);
41 DDX_Control(pDX, IDC_SPINTERVAL, m_SpinIntervalCtl);
42 DDX_Control(pDX, IDC_SPINSIZE, m_SpinPingSizeCtl);
43 DDX_Control(pDX, IDC_SPINPINGS, m_SpinPingsCtl);
44 DDX_Control(pDX, IDC_SPINMAXPINGS, m_SpinMaxThreadsCtl);
45 DDX_Text(pDX, IDC_NPINGS, m_Pings);
46 DDX_Text(pDX, IDC_PACKETSIZE, m_PingSize);
47 DDX_Text(pDX, IDC_TIMEOUT, m_TimeOut);
48 DDX_Text(pDX, IDC_INTERVAL, m_Interval);
49 DDX_Text(pDX, IDC_MAXPINGS, m_MaxThreads);
50 DDV_MinMaxUInt(pDX, m_MaxThreads, 1, 100);
51 DDX_Check(pDX, IDC_MSWORKAROUND, m_bMSWorkAround);
52 DDX_Check(pDX, IDC_AUTOBEST, m_bAutoBest);
53 DDX_Check(pDX, IDC_ADJUSTINN, m_bAdjustInn);
54 DDX_Check(pDX, IDC_IGNORELA, m_bIgnorelative);
55 DDX_Check(pDX, IDC_SMARTADJUST, m_bAdjust);
56 //}}AFX_DATA_MAP
57}
58
59
60BEGIN_MESSAGE_MAP(COptionsDlg, CDialog)
61 //{{AFX_MSG_MAP(COptionsDlg)
62 ON_WM_HELPINFO()
63 //}}AFX_MSG_MAP
64END_MESSAGE_MAP()
65
66/////////////////////////////////////////////////////////////////////////////
67// COptionsDlg message handlers
68
69BOOL COptionsDlg::OnInitDialog()
70{
71 CDialog::OnInitDialog();
72
73 m_SpinIntervalCtl.SetRange(0,60);
74 m_SpinMaxThreadsCtl.SetRange(1,50);
75 m_SpinPingsCtl.SetRange(1,100);
76 m_SpinPingSizeCtl.SetRange(0,32767);
77 m_SpinTimeOutCtl.SetRange(1,60);
78
79 return TRUE;
80}
81
82BOOL COptionsDlg::OnHelpInfo(HELPINFO* pHelpInfo)
83{
84 WinHelp(IDD|0x20000l);
85 return TRUE;
86}
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 @@
1// OptionsDlg.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// COptionsDlg dialog
6
7class COptionsDlg : public CDialog
8{
9// Construction
10public:
11 COptionsDlg(CWnd* pParent = NULL); // standard constructor
12
13// Dialog Data
14 //{{AFX_DATA(COptionsDlg)
15 enum { IDD = IDD_OPTIONS };
16 CSpinButtonCtrlm_SpinTimeOutCtl;
17 CSpinButtonCtrlm_SpinIntervalCtl;
18 CSpinButtonCtrlm_SpinPingSizeCtl;
19 CSpinButtonCtrlm_SpinPingsCtl;
20 CSpinButtonCtrlm_SpinMaxThreadsCtl;
21 UINTm_Pings;
22 UINTm_PingSize;
23 DWORDm_TimeOut;
24 DWORDm_Interval;
25 UINTm_MaxThreads;
26 BOOLm_bMSWorkAround;
27 BOOLm_bAutoBest;
28 BOOLm_bAdjustInn;
29 BOOLm_bIgnorelative;
30 BOOLm_bAdjust;
31 //}}AFX_DATA
32
33
34// Overrides
35 // ClassWizard generated virtual function overrides
36 //{{AFX_VIRTUAL(COptionsDlg)
37 protected:
38 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
39 //}}AFX_VIRTUAL
40
41// Implementation
42protected:
43 CToolTipCtrl m_tooltip;
44 virtual BOOL OnInitDialog();
45
46 // Generated message map functions
47 //{{AFX_MSG(COptionsDlg)
48 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
49 //}}AFX_MSG
50 DECLARE_MESSAGE_MAP()
51};
diff --git a/README b/README
new file mode 100644
index 0000000..7dab6ae
--- a/dev/null
+++ b/README
@@ -0,0 +1,36 @@
1
2Before compiling canned install executable the following files should be placed
3in the build tree:
4
5redist/mfc42.dl_
6
7Release checklist:
8 (These are tags stored in KTAGS file. please, keep in sync. Use vim to
9 jump to these tags. I haven't tried it on windows, though).
10
11 |help-news| - Release notes in help file
12
13Version number in the following places:
14
15 |about-version| - About box
16 |dragpad-version| - Dragpad title
17 |dndtarget-version| - Drag'n'drop target tooltip
18 |dialog-version| - Dipstick's main dialog title
19 |vsinfo-numeric-version| - VERSIONINFO numerical File&Prod V
20 |vsinfo-string-version| - VERSIONINFO string File&Prod V
21 |install-version| - Version used in install
22 |install-vsinfo-numeric-version|- install's VERSIONINFO block
23 |install-vsinfo-string-version| - install's VERSIONINFO block
24
25If the year flips check these:
26
27 |about-date| - About box
28 |help-license-date| - license in help file
29 |license-date| - license in COPYING file
30 |vsinfo-date| - Copyright in VERSIONINFO block
31 |install-vsinfo-date| - Copyright in install's VERSIONINFO
32 block
33
34
35This is for vim (don't remove):
36 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 @@
1// SelectURLsDlg.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "Dipstick.h"
6#include "SelectURLsDlg.h"
7
8#ifdef _DEBUG
9#define new DEBUG_NEW
10#undef THIS_FILE
11static char THIS_FILE[] = __FILE__;
12#endif
13
14/////////////////////////////////////////////////////////////////////////////
15// CSelectURLsDlg dialog
16
17
18CSelectURLsDlg::CSelectURLsDlg(CWnd* pParent /*=NULL*/)
19 : CDialog(CSelectURLsDlg::IDD, pParent), m_minSize(0,0)
20{
21 //{{AFX_DATA_INIT(CSelectURLsDlg)
22 m_bAdjustInnermost = FALSE;
23 m_bAdjust = FALSE;
24 //}}AFX_DATA_INIT
25}
26
27
28void CSelectURLsDlg::DoDataExchange(CDataExchange* pDX)
29{
30 CDialog::DoDataExchange(pDX);
31 //{{AFX_DATA_MAP(CSelectURLsDlg)
32 DDX_Control(pDX, IDC_DOADJUST, m_AdjustCtl);
33 DDX_Control(pDX, IDC_ADJUSTINN, m_AdjustInnCtl);
34 DDX_Control(pDX, IDOK, m_OkCtl);
35 DDX_Control(pDX, IDCANCEL, m_CancelCtl);
36 DDX_Control(pDX, IDC_URLS, m_URLsCtl);
37 DDX_Check(pDX, IDC_ADJUSTINN, m_bAdjustInnermost);
38 DDX_Check(pDX, IDC_DOADJUST, m_bAdjust);
39 //}}AFX_DATA_MAP
40}
41
42
43BEGIN_MESSAGE_MAP(CSelectURLsDlg, CDialog)
44 //{{AFX_MSG_MAP(CSelectURLsDlg)
45 ON_WM_SIZE()
46 ON_WM_GETMINMAXINFO()
47 ON_LBN_SELCHANGE(IDC_URLS, OnSelchangeUrls)
48 ON_WM_HELPINFO()
49 //}}AFX_MSG_MAP
50END_MESSAGE_MAP()
51
52/////////////////////////////////////////////////////////////////////////////
53// CSelectURLsDlg message handlers
54
55BOOL CSelectURLsDlg::OnInitDialog()
56{
57 CDialog::OnInitDialog();
58
59POSITION p = m_URLs.GetHeadPosition();
60 while(p){
61 CString url = m_URLs.GetNext(p);
62 ASSERT(!url.IsEmpty());
63 m_URLsCtl.AddString(url);
64 }
65CRect rc;
66 GetWindowRect(rc);
67 m_minSize.cx = rc.Width();
68 m_minSize.cy = rc.Height();
69 m_URLsCtl.GetWindowRect(rc);
70 ScreenToClient(rc);
71 m_Gap = CSize(rc.left,rc.top);
72 m_minSize.cy -= rc.Height()-20;
73 m_URLsCtl.SelItemRange(TRUE,0,m_URLsCtl.GetCount()-1);
74
75 return TRUE; // return TRUE unless you set the focus to a control
76 // EXCEPTION: OCX Property Pages should return FALSE
77}
78
79void CSelectURLsDlg::OnSize(UINT nType, int cx, int cy)
80{
81 CDialog::OnSize(nType, cx, cy);
82
83 RecalcLayout(cx,cy);
84
85}
86
87void CSelectURLsDlg::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
88{
89 CDialog::OnGetMinMaxInfo(lpMMI);
90 if(m_minSize.cx && m_minSize.cy){
91 lpMMI->ptMinTrackSize.x = m_minSize.cx;
92 lpMMI->ptMinTrackSize.y = m_minSize.cy;
93 }
94}
95
96void CSelectURLsDlg::RecalcLayout(int cx,int cy)
97{
98 if(!(m_minSize.cx&&m_minSize.cy))
99 return;
100CRect rcok, rccan, rcadj, rcadjin, rclist;
101 m_OkCtl.GetWindowRect(rcok); ScreenToClient(rcok);
102 m_CancelCtl.GetWindowRect(rccan); ScreenToClient(rccan);
103 m_AdjustCtl.GetWindowRect(rcadj); ScreenToClient(rcadj);
104 m_AdjustInnCtl.GetWindowRect(rcadjin); ScreenToClient(rcadjin);
105 m_URLsCtl.GetWindowRect(rclist); ScreenToClient(rclist);
106 m_CancelCtl.SetWindowPos(NULL,rccan.left,cy-m_Gap.cy-rccan.Height(),0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS);
107 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);
108 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);
109 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);
110 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);
111}
112
113void CSelectURLsDlg::OnSelchangeUrls()
114{
115 UpdateData(TRUE);
116 if(!m_bAdjust)
117 return;
118 if(m_URLsCtl.GetSelCount()!=1)
119 return;
120 INTselection;
121 VERIFY(m_URLsCtl.GetSelItems(1,&selection)==1);
122CCrackURL base;
123CString selectedItem;
124 m_URLsCtl.GetText(selection,selectedItem);
125 VERIFY(base.Crack(selectedItem));
126CCrackURL item;
127int is = m_URLsCtl.GetCount();
128 BeginWaitCursor();
129 for(int i = 0;i<is;i++){
130 if(i==selection)
131 continue;
132 CString it;
133 m_URLsCtl.GetText(i,it);
134 if(m_bAdjustInnermost)
135 it = CCrackURL::InnermostURL(it);
136 VERIFY(item.Crack(it));
137 if(item.m_pathFile==base.m_pathFile)
138 m_URLsCtl.SetSel(i);
139 }
140 EndWaitCursor();
141}
142
143void CSelectURLsDlg::OnOK()
144{
145 m_URLs.RemoveAll();
146int is = m_URLsCtl.GetSelCount();
147 if(is){
148 LPINTitems = new INT[is];
149 VERIFY(m_URLsCtl.GetSelItems(is,items)==is);
150 for(int i=0;i<is;i++){
151 CString url;
152 m_URLsCtl.GetText(items[i],url);
153 m_URLs.AddTail(url);
154 }
155 delete items;
156 }
157 CDialog::OnOK();
158}
159
160BOOL CSelectURLsDlg::OnHelpInfo(HELPINFO* pHelpInfo)
161{
162 WinHelp(IDD|0x20000l);
163 return TRUE;
164}
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 @@
1// SelectURLsDlg.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CSelectURLsDlg dialog
6
7class CSelectURLsDlg : public CDialog
8{
9// Construction
10public:
11 void RecalcLayout(int cx,int cy);
12 CSize m_Gap;
13 CSize m_minSize;
14 CStringList m_URLs;
15 CSelectURLsDlg(CWnd* pParent = NULL); // standard constructor
16
17// Dialog Data
18 //{{AFX_DATA(CSelectURLsDlg)
19 enum { IDD = IDD_URLS };
20 CButtonm_AdjustCtl;
21 CButtonm_AdjustInnCtl;
22 CButtonm_OkCtl;
23 CButtonm_CancelCtl;
24 CListBoxm_URLsCtl;
25 BOOLm_bAdjustInnermost;
26 BOOLm_bAdjust;
27 //}}AFX_DATA
28
29
30// Overrides
31 // ClassWizard generated virtual function overrides
32 //{{AFX_VIRTUAL(CSelectURLsDlg)
33 protected:
34 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
35 //}}AFX_VIRTUAL
36
37// Implementation
38protected:
39
40 // Generated message map functions
41 //{{AFX_MSG(CSelectURLsDlg)
42 virtual BOOL OnInitDialog();
43 afx_msg void OnSize(UINT nType, int cx, int cy);
44 afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
45 afx_msg void OnSelchangeUrls();
46 virtual void OnOK();
47 afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
48 //}}AFX_MSG
49 DECLARE_MESSAGE_MAP()
50};
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 @@
1#include "stdafx.h"
2#include "URLSource.h"
3
4#include <intshcut.h>
5#include <initguid.h>
6#include <isguids.h>
7
8CURLSource::CURLSource(LPCTSTR strURL)
9{
10IUniformResourceLocator *lpURL;
11 if(CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_INPROC_SERVER,IID_IUniformResourceLocator,(LPVOID*)&lpURL)==S_OK){
12 ASSERT(lpURL);
13 lpURL->SetURL(strURL,IURL_SETURL_FL_GUESS_PROTOCOL);
14 LPDATAOBJECT lpDO = NULL;
15 VERIFY(lpURL->QueryInterface(IID_IDataObject,(LPVOID*)&lpDO)==S_OK);
16 COleDataObject odo;
17 odo.Attach(lpDO,TRUE);
18 odo.BeginEnumFormats();
19 FORMATETC fe;
20 while(odo.GetNextFormat(&fe)){
21 HGLOBAL hg = odo.GetGlobalData(fe.cfFormat,NULL);
22 if(hg)
23 CacheGlobalData(fe.cfFormat,hg,NULL);
24 }
25 lpURL->Release();
26 }
27HGLOBAL hg = GlobalAlloc(GHND,strlen(strURL)+1);
28LPVOID lpv = GlobalLock(hg);
29 memmove(lpv,strURL,strlen(strURL)+1);
30 GlobalUnlock(hg);
31 CacheGlobalData(CF_TEXT,hg,NULL);
32}
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 @@
1
2 class CURLSource : public COleDataSource{
3public:
4 CURLSource(LPCTSTR strURL);
5}; \ 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 @@
1; CLW file contains information for the MFC ClassWizard
2
3[General Info]
4Version=1
5LastClass=CDipstickDlg
6LastTemplate=CDialog
7NewFileInclude1=#include "stdafx.h"
8NewFileInclude2=#include "Dipstick.h"
9
10ClassCount=10
11Class1=CDipstickApp
12Class2=CDipstickDlg
13Class3=CAboutDlg
14
15ResourceCount=10
16Resource1=IDD_PROPS
17Resource2=IDR_MAINFRAME
18Class4=CDropURL
19Resource3=IDD_MANUALHOST
20Class5=CDragPad
21Resource4=IDD_ABOUTBOX
22Class6=COptionsDlg
23Resource5=IDD_OPTIONS
24Resource6=IDD_AUTOBEST
25Class7=CHostNameDlg
26Resource7=IDD_DRAGPAD
27Class8=CHostProperties
28Resource8=IDR_MENU
29Class9=CAutoBestDlg
30Resource9=IDD_DIPSTICK_DIALOG
31Class10=CSelectURLsDlg
32Resource10=IDD_URLS
33
34[CLS:CDipstickApp]
35Type=0
36HeaderFile=Dipstick.h
37ImplementationFile=Dipstick.cpp
38Filter=N
39LastObject=CDipstickApp
40BaseClass=CWinApp
41VirtualFilter=AC
42
43[CLS:CDipstickDlg]
44Type=0
45HeaderFile=DipstickDlg.h
46ImplementationFile=DipstickDlg.cpp
47Filter=W
48BaseClass=CDialog
49VirtualFilter=dWC
50LastObject=CDipstickDlg
51
52[CLS:CAboutDlg]
53Type=0
54HeaderFile=DipstickDlg.h
55ImplementationFile=DipstickDlg.cpp
56Filter=D
57BaseClass=CDialog
58VirtualFilter=dWC
59LastObject=IDC_KLEVERNET
60
61[DLG:IDD_ABOUTBOX]
62Type=1
63Class=CAboutDlg
64ControlCount=5
65Control1=IDC_STATIC,static,1342177283
66Control2=IDC_STATIC,static,1342308480
67Control3=IDC_STATIC,static,1342308352
68Control4=IDOK,button,1342373889
69Control5=IDC_KLEVERNET,button,1342242816
70
71[DLG:IDD_DIPSTICK_DIALOG]
72Type=1
73Class=CDipstickDlg
74ControlCount=11
75Control1=IDC_HOSTLIST,SysListView32,1350631697
76Control2=IDC_MANUALPING,button,1342242816
77Control3=IDC_REPING,button,1476460544
78Control4=IDC_REPINGALL,button,1476460544
79Control5=IDC_REMOVE,button,1476460544
80Control6=IDC_CLEAR,button,1476460544
81Control7=ID_HELP,button,1342242816
82Control8=IDC_OPTIONS,button,1342242816
83Control9=IDC_EXIT,button,1342242816
84Control10=IDCANCEL,button,1208025088
85Control11=IDC_ADVANCED,button,1342242816
86
87[CLS:CDropURL]
88Type=0
89HeaderFile=DropURL.h
90ImplementationFile=DropURL.cpp
91BaseClass=CCmdTarget
92Filter=N
93LastObject=CDropURL
94VirtualFilter=C
95
96[DLG:IDD_DRAGPAD]
97Type=1
98Class=CDragPad
99ControlCount=3
100Control1=IDC_DNDTARGET,SysAnimate32,1342242816
101Control2=IDCANCEL,button,1208025088
102Control3=IDOK,button,1208025089
103
104[CLS:CDragPad]
105Type=0
106HeaderFile=DragPad.h
107ImplementationFile=DragPad.cpp
108BaseClass=CDialog
109Filter=W
110VirtualFilter=dWC
111LastObject=CDragPad
112
113[DLG:IDD_OPTIONS]
114Type=1
115Class=COptionsDlg
116ControlCount=22
117Control1=IDC_STATIC,static,1342308352
118Control2=IDC_NPINGS,edit,1350631552
119Control3=IDC_SPINPINGS,msctls_updown32,1342177463
120Control4=IDC_STATIC,static,1342308352
121Control5=IDC_MAXPINGS,edit,1350631552
122Control6=IDC_SPINMAXPINGS,msctls_updown32,1342177463
123Control7=IDC_STATIC,static,1342308352
124Control8=IDC_TIMEOUT,edit,1350631552
125Control9=IDC_SPINTIMEOUT,msctls_updown32,1342177463
126Control10=IDC_STATIC,static,1342308352
127Control11=IDC_INTERVAL,edit,1350631552
128Control12=IDC_SPINTERVAL,msctls_updown32,1342177463
129Control13=IDC_STATIC,static,1342308352
130Control14=IDC_PACKETSIZE,edit,1350631552
131Control15=IDC_SPINSIZE,msctls_updown32,1342177463
132Control16=IDC_MSWORKAROUND,button,1342259203
133Control17=IDOK,button,1342242817
134Control18=IDCANCEL,button,1342242816
135Control19=IDC_AUTOBEST,button,1342259203
136Control20=IDC_SMARTADJUST,button,1342259203
137Control21=IDC_ADJUSTINN,button,1342259203
138Control22=IDC_IGNORELA,button,1342259203
139
140[CLS:COptionsDlg]
141Type=0
142HeaderFile=OptionsDlg.h
143ImplementationFile=OptionsDlg.cpp
144BaseClass=CDialog
145Filter=W
146VirtualFilter=dWC
147LastObject=COptionsDlg
148
149[MNU:IDR_MENU]
150Type=1
151Class=CDipstickDlg
152Command1=ID_DRAGPAD_MANUALPING
153Command2=ID_DRAGPAD_PASTEURL
154Command3=ID_DRAGPAD_REPINGALL
155Command4=ID_DRAGPAD_REMOVEALL
156Command5=ID_DRAGPAD_OPTIONS
157Command6=ID_DRAGPAD_SHOWMAINWINDOW
158Command7=ID_DRAGPAD_ADVANCED_EXPORTLIST
159Command8=ID_DRAGPAD_ADVANCED_IMPORTLIST
160Command9=ID_DRAGPAD_HELP
161Command10=ID_DRAGPAD_ABOUT
162Command11=ID_DRAGPAD_EXIT
163Command12=ID_HOSTLIST_REPING
164Command13=ID_HOSTLIST_REMOVE
165Command14=ID_HOSTLIST_OPENURL
166Command15=ID_HOSTLIST_COPYURL
167Command16=ID_HOSTLIST_REPINGALL
168Command17=ID_HOSTLIST_REMOVEALL
169Command18=ID_HOSTLIST_PASTEURL
170Command19=ID_HOSTLIST_PROPERTIES
171Command20=ID_ADVANCED_EXPORTLIST
172Command21=ID_ADVANCED_IMPORTLIST
173CommandCount=21
174
175[DLG:IDD_MANUALHOST]
176Type=1
177Class=CHostNameDlg
178ControlCount=4
179Control1=IDC_STATIC,static,1342308352
180Control2=IDC_HOST,edit,1350631568
181Control3=IDOK,button,1342242817
182Control4=IDCANCEL,button,1342242816
183
184[CLS:CHostNameDlg]
185Type=0
186HeaderFile=HostNameDlg.h
187ImplementationFile=HostNameDlg.cpp
188BaseClass=CDialog
189Filter=D
190LastObject=CHostNameDlg
191VirtualFilter=dWC
192
193[DLG:IDD_PROPS]
194Type=1
195Class=CHostProperties
196ControlCount=16
197Control1=IDOK,button,1342242817
198Control2=IDC_URLCAPTION,static,1342308608
199Control3=IDC_URL,static,1342308736
200Control4=IDC_HOSTCAPTION,static,1342308608
201Control5=IDC_HOST,static,1342308736
202Control6=IDC_IPCAPTION,static,1342308608
203Control7=IDC_IP,static,1342308608
204Control8=IDC_TIMESCAPTION,static,1342308608
205Control9=IDC_TIMES,static,1342308608
206Control10=IDC_LOSSCAPTION,static,1342308608
207Control11=IDC_LOSS,static,1342308736
208Control12=IDC_STATUSCAPTION,static,1342308608
209Control13=IDC_STATUS,static,1342308736
210Control14=IDC_OPENURL,button,1342242816
211Control15=IDC_STATE,static,1342180099
212Control16=IDC_COPYURL,button,1342242816
213
214[CLS:CHostProperties]
215Type=0
216HeaderFile=HostProperties.h
217ImplementationFile=HostProperties.cpp
218BaseClass=CDialog
219Filter=D
220VirtualFilter=dWC
221LastObject=CHostProperties
222
223[DLG:IDD_AUTOBEST]
224Type=1
225Class=CAutoBestDlg
226ControlCount=11
227Control1=IDOK,button,1342242817
228Control2=IDC_NEXT,button,1342242816
229Control3=IDC_PREV,button,1342242816
230Control4=IDC_URL,static,1342308481
231Control5=IDC_STATIC,static,1342308352
232Control6=IDC_RTT,static,1342308352
233Control7=IDC_STATIC,static,1342308352
234Control8=IDC_PKTLOSS,static,1342308352
235Control9=IDCANCEL,button,1342242816
236Control10=IDC_DROPSOURCE,SysAnimate32,1342177285
237Control11=IDC_COPYURL,button,1342254848
238
239[CLS:CAutoBestDlg]
240Type=0
241HeaderFile=AutoBestDlg.h
242ImplementationFile=AutoBestDlg.cpp
243BaseClass=CDialog
244Filter=W
245LastObject=CAutoBestDlg
246VirtualFilter=dWC
247
248[DLG:IDD_URLS]
249Type=1
250Class=CSelectURLsDlg
251ControlCount=5
252Control1=IDC_URLS,listbox,1345390851
253Control2=IDOK,button,1342242817
254Control3=IDCANCEL,button,1342242816
255Control4=IDC_DOADJUST,button,1342243843
256Control5=IDC_ADJUSTINN,button,1342252035
257
258[CLS:CSelectURLsDlg]
259Type=0
260HeaderFile=SelectURLsDlg.h
261ImplementationFile=SelectURLsDlg.cpp
262BaseClass=CDialog
263Filter=W
264LastObject=CSelectURLsDlg
265VirtualFilter=dWC
266
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 @@
1// Dipstick.cpp : Defines the class behaviors for the application.
2//
3
4#include "stdafx.h"
5#include "Dipstick.h"
6#include "DipstickDlg.h"
7
8#ifdef _DEBUG
9#define new DEBUG_NEW
10#undef THIS_FILE
11static char THIS_FILE[] = __FILE__;
12#endif
13
14/////////////////////////////////////////////////////////////////////////////
15// CDipstickApp
16
17BEGIN_MESSAGE_MAP(CDipstickApp, CWinApp)
18 //{{AFX_MSG_MAP(CDipstickApp)
19 //}}AFX_MSG
20 ON_COMMAND(ID_HELP, CWinApp::OnHelp)
21END_MESSAGE_MAP()
22
23/////////////////////////////////////////////////////////////////////////////
24// CDipstickApp construction
25
26CDipstickApp::CDipstickApp()
27{
28}
29
30/////////////////////////////////////////////////////////////////////////////
31// The one and only CDipstickApp object
32
33CDipstickApp theApp;
34
35/////////////////////////////////////////////////////////////////////////////
36// CDipstickApp initialization
37
38BOOL CDipstickApp::InitInstance()
39{
40 if (!AfxSocketInit())
41 {
42 AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
43 return FALSE;
44 }
45
46 // Standard initialization
47 // If you are not using these features and wish to reduce the size
48 // of your final executable, you should remove from the following
49 // the specific initialization routines you do not need.
50
51#ifdef _AFXDLL
52 Enable3dControls(); // Call this when using MFC in a shared DLL
53#else
54 Enable3dControlsStatic();// Call this when linking to MFC statically
55#endif
56
57 OleInitialize(NULL);
58
59 SetRegistryKey(IDS_REGISTRYKEY);
60 m_HelpFile = m_pszHelpFilePath;
61 m_HelpFile+=">Standard";
62 m_pszHelpFilePath=m_HelpFile;
63
64CDipstickDlg dlg;
65 m_pMainWnd = &dlg;
66 dlg.DoModal();
67
68 OleUninitialize();
69
70 // Since the dialog has been closed, return FALSE so that we exit the
71 // application, rather than start the application's message pump.
72 return FALSE;
73}
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 @@
1// Dipstick.h : main header file for the DIPSTICK application
2//
3
4#ifndef __AFXWIN_H__
5 #error include 'stdafx.h' before including this file for PCH
6#endif
7
8 #include "resource.h" // main symbols
9
10/////////////////////////////////////////////////////////////////////////////
11// CDipstickApp:
12// See Dipstick.cpp for the implementation of this class
13//
14
15class CDipstickApp : public CWinApp
16{
17public:
18 CString m_HelpFile;
19 CDipstickApp();
20
21// Overrides
22 // ClassWizard generated virtual function overrides
23 //{{AFX_VIRTUAL(CDipstickApp)
24 public:
25 virtual BOOL InitInstance();
26 //}}AFX_VIRTUAL
27
28// Implementation
29
30 //{{AFX_MSG(CDipstickApp)
31 //}}AFX_MSG
32 DECLARE_MESSAGE_MAP()
33};
34
35
36/////////////////////////////////////////////////////////////////////////////
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 @@
1# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
2# ** DO NOT EDIT **
3
4# TARGTYPE "Win32 (x86) Application" 0x0101
5
6!IF "$(CFG)" == ""
7CFG=Install - Win32 Canned
8!MESSAGE No configuration specified. Defaulting to Install - Win32 Canned.
9!ENDIF
10
11!IF "$(CFG)" != "Dipstick - Win32 Release" && "$(CFG)" !=\
12 "Dipstick - Win32 Debug" && "$(CFG)" != "Dipstick - Win32 Release Static" &&\
13 "$(CFG)" != "Install - Win32 Debug" && "$(CFG)" != "Install - Win32 Pure" &&\
14 "$(CFG)" != "Install - Win32 Static" && "$(CFG)" != "Install - Win32 Canned"
15!MESSAGE Invalid configuration "$(CFG)" specified.
16!MESSAGE You can specify a configuration when running NMAKE on this makefile
17!MESSAGE by defining the macro CFG on the command line. For example:
18!MESSAGE
19!MESSAGE NMAKE /f "dipstick.mak" CFG="Install - Win32 Canned"
20!MESSAGE
21!MESSAGE Possible choices for configuration are:
22!MESSAGE
23!MESSAGE "Dipstick - Win32 Release" (based on "Win32 (x86) Application")
24!MESSAGE "Dipstick - Win32 Debug" (based on "Win32 (x86) Application")
25!MESSAGE "Dipstick - Win32 Release Static" (based on "Win32 (x86) Application")
26!MESSAGE "Install - Win32 Debug" (based on "Win32 (x86) Application")
27!MESSAGE "Install - Win32 Pure" (based on "Win32 (x86) Application")
28!MESSAGE "Install - Win32 Static" (based on "Win32 (x86) Application")
29!MESSAGE "Install - Win32 Canned" (based on "Win32 (x86) Application")
30!MESSAGE
31!ERROR An invalid configuration is specified.
32!ENDIF
33
34!IF "$(OS)" == "Windows_NT"
35NULL=
36!ELSE
37NULL=nul
38!ENDIF
39################################################################################
40# Begin Project
41# PROP Target_Last_Scanned "Dipstick - Win32 Release"
42RSC=rc.exe
43MTL=mktyplib.exe
44CPP=cl.exe
45
46!IF "$(CFG)" == "Dipstick - Win32 Release"
47
48# PROP BASE Use_MFC 6
49# PROP BASE Use_Debug_Libraries 0
50# PROP BASE Output_Dir "Release"
51# PROP BASE Intermediate_Dir "Release"
52# PROP BASE Target_Dir ""
53# PROP Use_MFC 6
54# PROP Use_Debug_Libraries 0
55# PROP Output_Dir "Release"
56# PROP Intermediate_Dir "Release"
57# PROP Target_Dir ""
58OUTDIR=.\Release
59INTDIR=.\Release
60# Begin Custom Macros
61OutDir=.\Release
62TargetName=dipstick
63# End Custom Macros
64
65ALL : "$(OUTDIR)\dipstick.exe" "$(OUTDIR)\dipstick.ex_"\
66 "$(OUTDIR)\dipstick.hlp" "$(OUTDIR)\dipstick.cnt" "$(OUTDIR)\dipstick.hl_"\
67 "$(OUTDIR)\dipstick.cn_"
68
69CLEAN :
70 -@erase "$(INTDIR)\AutoBestDlg.obj"
71 -@erase "$(INTDIR)\CrackURL.obj"
72 -@erase "$(INTDIR)\dipstick.cn_"
73 -@erase "$(INTDIR)\dipstick.cnt"
74 -@erase "$(INTDIR)\dipstick.hl_"
75 -@erase "$(INTDIR)\dipstick.hlp"
76 -@erase "$(INTDIR)\Dipstick.obj"
77 -@erase "$(INTDIR)\dipstick.pch"
78 -@erase "$(INTDIR)\dipstick.res"
79 -@erase "$(INTDIR)\DipstickDlg.obj"
80 -@erase "$(INTDIR)\DragPad.obj"
81 -@erase "$(INTDIR)\HostNameDlg.obj"
82 -@erase "$(INTDIR)\HostProperties.obj"
83 -@erase "$(INTDIR)\kICMP.obj"
84 -@erase "$(INTDIR)\OptionsDlg.obj"
85 -@erase "$(INTDIR)\RegEx.obj"
86 -@erase "$(INTDIR)\SelectURLsDlg.obj"
87 -@erase "$(INTDIR)\StdAfx.obj"
88 -@erase "$(INTDIR)\URLSource.obj"
89 -@erase "$(OUTDIR)\dipstick.ex_"
90 -@erase "$(OUTDIR)\dipstick.exe"
91
92"$(OUTDIR)" :
93 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
94
95# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
96# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
97CPP_PROJ=/nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
98 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/"\
99 /c
100CPP_OBJS=.\Release/
101CPP_SBRS=.\.
102# ADD BASE MTL /nologo /D "NDEBUG" /win32
103# ADD MTL /nologo /D "NDEBUG" /win32
104MTL_PROJ=/nologo /D "NDEBUG" /win32
105# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
106# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
107RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dipstick.res" /d "NDEBUG" /d "_AFXDLL"
108BSC32=bscmake.exe
109# ADD BASE BSC32 /nologo
110# ADD BSC32 /nologo
111BSC32_FLAGS=/nologo /o"$(OUTDIR)/dipstick.bsc"
112BSC32_SBRS= \
113
114LINK32=link.exe
115# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
116# ADD LINK32 uuid.lib /nologo /subsystem:windows /machine:I386
117LINK32_FLAGS=uuid.lib /nologo /subsystem:windows /incremental:no\
118 /pdb:"$(OUTDIR)/dipstick.pdb" /machine:I386 /out:"$(OUTDIR)/dipstick.exe"
119LINK32_OBJS= \
120 "$(INTDIR)\AutoBestDlg.obj" \
121 "$(INTDIR)\CrackURL.obj" \
122 "$(INTDIR)\Dipstick.obj" \
123 "$(INTDIR)\dipstick.res" \
124 "$(INTDIR)\DipstickDlg.obj" \
125 "$(INTDIR)\DragPad.obj" \
126 "$(INTDIR)\HostNameDlg.obj" \
127 "$(INTDIR)\HostProperties.obj" \
128 "$(INTDIR)\kICMP.obj" \
129 "$(INTDIR)\OptionsDlg.obj" \
130 "$(INTDIR)\RegEx.obj" \
131 "$(INTDIR)\SelectURLsDlg.obj" \
132 "$(INTDIR)\StdAfx.obj" \
133 "$(INTDIR)\URLSource.obj"
134
135"$(OUTDIR)\dipstick.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
136 $(LINK32) @<<
137 $(LINK32_FLAGS) $(LINK32_OBJS)
138<<
139
140# Begin Custom Build
141OutDir=.\Release
142TargetName=dipstick
143InputPath=.\Release\dipstick.exe
144SOURCE=$(InputPath)
145
146"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
147 compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
148
149# End Custom Build
150
151!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
152
153# PROP BASE Use_MFC 6
154# PROP BASE Use_Debug_Libraries 1
155# PROP BASE Output_Dir "Debug"
156# PROP BASE Intermediate_Dir "Debug"
157# PROP BASE Target_Dir ""
158# PROP Use_MFC 6
159# PROP Use_Debug_Libraries 1
160# PROP Output_Dir "Debug"
161# PROP Intermediate_Dir "Debug"
162# PROP Target_Dir ""
163OUTDIR=.\Debug
164INTDIR=.\Debug
165# Begin Custom Macros
166OutDir=.\Debug
167TargetName=dipstick
168# End Custom Macros
169
170ALL : "$(OUTDIR)\dipstick.exe" "$(OUTDIR)\dipstick.ex_"\
171 "$(OUTDIR)\dipstick.hlp" "$(OUTDIR)\dipstick.cnt" "$(OUTDIR)\dipstick.hl_"\
172 "$(OUTDIR)\dipstick.cn_"
173
174CLEAN :
175 -@erase "$(INTDIR)\AutoBestDlg.obj"
176 -@erase "$(INTDIR)\CrackURL.obj"
177 -@erase "$(INTDIR)\dipstick.cn_"
178 -@erase "$(INTDIR)\dipstick.cnt"
179 -@erase "$(INTDIR)\dipstick.hl_"
180 -@erase "$(INTDIR)\dipstick.hlp"
181 -@erase "$(INTDIR)\Dipstick.obj"
182 -@erase "$(INTDIR)\dipstick.pch"
183 -@erase "$(INTDIR)\dipstick.res"
184 -@erase "$(INTDIR)\DipstickDlg.obj"
185 -@erase "$(INTDIR)\DragPad.obj"
186 -@erase "$(INTDIR)\HostNameDlg.obj"
187 -@erase "$(INTDIR)\HostProperties.obj"
188 -@erase "$(INTDIR)\kICMP.obj"
189 -@erase "$(INTDIR)\OptionsDlg.obj"
190 -@erase "$(INTDIR)\RegEx.obj"
191 -@erase "$(INTDIR)\SelectURLsDlg.obj"
192 -@erase "$(INTDIR)\StdAfx.obj"
193 -@erase "$(INTDIR)\URLSource.obj"
194 -@erase "$(INTDIR)\vc40.idb"
195 -@erase "$(INTDIR)\vc40.pdb"
196 -@erase "$(OUTDIR)\dipstick.ex_"
197 -@erase "$(OUTDIR)\dipstick.exe"
198 -@erase "$(OUTDIR)\dipstick.ilk"
199 -@erase "$(OUTDIR)\dipstick.pdb"
200
201"$(OUTDIR)" :
202 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
203
204# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
205# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
206CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
207 /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"stdafx.h"\
208 /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
209CPP_OBJS=.\Debug/
210CPP_SBRS=.\.
211# ADD BASE MTL /nologo /D "_DEBUG" /win32
212# ADD MTL /nologo /D "_DEBUG" /win32
213MTL_PROJ=/nologo /D "_DEBUG" /win32
214# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
215# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
216RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dipstick.res" /d "_DEBUG" /d "_AFXDLL"
217BSC32=bscmake.exe
218# ADD BASE BSC32 /nologo
219# ADD BSC32 /nologo
220BSC32_FLAGS=/nologo /o"$(OUTDIR)/dipstick.bsc"
221BSC32_SBRS= \
222
223LINK32=link.exe
224# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
225# ADD LINK32 uuid.lib /nologo /subsystem:windows /debug /machine:I386
226LINK32_FLAGS=uuid.lib /nologo /subsystem:windows /incremental:yes\
227 /pdb:"$(OUTDIR)/dipstick.pdb" /debug /machine:I386\
228 /out:"$(OUTDIR)/dipstick.exe"
229LINK32_OBJS= \
230 "$(INTDIR)\AutoBestDlg.obj" \
231 "$(INTDIR)\CrackURL.obj" \
232 "$(INTDIR)\Dipstick.obj" \
233 "$(INTDIR)\dipstick.res" \
234 "$(INTDIR)\DipstickDlg.obj" \
235 "$(INTDIR)\DragPad.obj" \
236 "$(INTDIR)\HostNameDlg.obj" \
237 "$(INTDIR)\HostProperties.obj" \
238 "$(INTDIR)\kICMP.obj" \
239 "$(INTDIR)\OptionsDlg.obj" \
240 "$(INTDIR)\RegEx.obj" \
241 "$(INTDIR)\SelectURLsDlg.obj" \
242 "$(INTDIR)\StdAfx.obj" \
243 "$(INTDIR)\URLSource.obj"
244
245"$(OUTDIR)\dipstick.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
246 $(LINK32) @<<
247 $(LINK32_FLAGS) $(LINK32_OBJS)
248<<
249
250# Begin Custom Build
251OutDir=.\Debug
252TargetName=dipstick
253InputPath=.\Debug\dipstick.exe
254SOURCE=$(InputPath)
255
256"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
257 compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
258
259# End Custom Build
260
261!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
262
263# PROP BASE Use_MFC 6
264# PROP BASE Use_Debug_Libraries 0
265# PROP BASE Output_Dir "Dipstick_"
266# PROP BASE Intermediate_Dir "Dipstick_"
267# PROP BASE Target_Dir ""
268# PROP Use_MFC 5
269# PROP Use_Debug_Libraries 0
270# PROP Output_Dir "Releast"
271# PROP Intermediate_Dir "Releast"
272# PROP Target_Dir ""
273OUTDIR=.\Releast
274INTDIR=.\Releast
275# Begin Custom Macros
276OutDir=.\Releast
277TargetName=dipstick
278# End Custom Macros
279
280ALL : "$(OUTDIR)\dipstick.exe" "$(OUTDIR)\dipstick.ex_"\
281 "$(OUTDIR)\dipstick.hlp" "$(OUTDIR)\dipstick.cnt" "$(OUTDIR)\dipstick.hl_"\
282 "$(OUTDIR)\dipstick.cn_"
283
284CLEAN :
285 -@erase "$(INTDIR)\AutoBestDlg.obj"
286 -@erase "$(INTDIR)\CrackURL.obj"
287 -@erase "$(INTDIR)\dipstick.cn_"
288 -@erase "$(INTDIR)\dipstick.cnt"
289 -@erase "$(INTDIR)\dipstick.hl_"
290 -@erase "$(INTDIR)\dipstick.hlp"
291 -@erase "$(INTDIR)\Dipstick.obj"
292 -@erase "$(INTDIR)\dipstick.pch"
293 -@erase "$(INTDIR)\dipstick.res"
294 -@erase "$(INTDIR)\DipstickDlg.obj"
295 -@erase "$(INTDIR)\DragPad.obj"
296 -@erase "$(INTDIR)\HostNameDlg.obj"
297 -@erase "$(INTDIR)\HostProperties.obj"
298 -@erase "$(INTDIR)\kICMP.obj"
299 -@erase "$(INTDIR)\OptionsDlg.obj"
300 -@erase "$(INTDIR)\RegEx.obj"
301 -@erase "$(INTDIR)\SelectURLsDlg.obj"
302 -@erase "$(INTDIR)\StdAfx.obj"
303 -@erase "$(INTDIR)\URLSource.obj"
304 -@erase "$(OUTDIR)\dipstick.ex_"
305 -@erase "$(OUTDIR)\dipstick.exe"
306
307"$(OUTDIR)" :
308 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
309
310# ADD BASE CPP /nologo /MD /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
311# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /c
312CPP_PROJ=/nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
313 "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c
314CPP_OBJS=.\Releast/
315CPP_SBRS=.\.
316# ADD BASE MTL /nologo /D "NDEBUG" /win32
317# ADD MTL /nologo /D "NDEBUG" /win32
318MTL_PROJ=/nologo /D "NDEBUG" /win32
319# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
320# ADD RSC /l 0x409 /d "NDEBUG"
321RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dipstick.res" /d "NDEBUG"
322BSC32=bscmake.exe
323# ADD BASE BSC32 /nologo
324# ADD BSC32 /nologo
325BSC32_FLAGS=/nologo /o"$(OUTDIR)/dipstick.bsc"
326BSC32_SBRS= \
327
328LINK32=link.exe
329# ADD BASE LINK32 lib\icmp.lib /nologo /subsystem:windows /machine:I386 /out:"Release/DipStick.exe"
330# ADD LINK32 uuid.lib /nologo /subsystem:windows /machine:I386
331LINK32_FLAGS=uuid.lib /nologo /subsystem:windows /incremental:no\
332 /pdb:"$(OUTDIR)/dipstick.pdb" /machine:I386 /out:"$(OUTDIR)/dipstick.exe"
333LINK32_OBJS= \
334 "$(INTDIR)\AutoBestDlg.obj" \
335 "$(INTDIR)\CrackURL.obj" \
336 "$(INTDIR)\Dipstick.obj" \
337 "$(INTDIR)\dipstick.res" \
338 "$(INTDIR)\DipstickDlg.obj" \
339 "$(INTDIR)\DragPad.obj" \
340 "$(INTDIR)\HostNameDlg.obj" \
341 "$(INTDIR)\HostProperties.obj" \
342 "$(INTDIR)\kICMP.obj" \
343 "$(INTDIR)\OptionsDlg.obj" \
344 "$(INTDIR)\RegEx.obj" \
345 "$(INTDIR)\SelectURLsDlg.obj" \
346 "$(INTDIR)\StdAfx.obj" \
347 "$(INTDIR)\URLSource.obj"
348
349"$(OUTDIR)\dipstick.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
350 $(LINK32) @<<
351 $(LINK32_FLAGS) $(LINK32_OBJS)
352<<
353
354# Begin Custom Build
355OutDir=.\Releast
356TargetName=dipstick
357InputPath=.\Releast\dipstick.exe
358SOURCE=$(InputPath)
359
360"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
361 compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
362
363# End Custom Build
364
365!ELSEIF "$(CFG)" == "Install - Win32 Debug"
366
367# PROP BASE Use_MFC 2
368# PROP BASE Use_Debug_Libraries 1
369# PROP BASE Output_Dir "Install\Debug"
370# PROP BASE Intermediate_Dir "Install\Debug"
371# PROP BASE Target_Dir "Install"
372# PROP Use_MFC 0
373# PROP Use_Debug_Libraries 1
374# PROP Output_Dir "Install\Debug"
375# PROP Intermediate_Dir "Install\Debug"
376# PROP Target_Dir "Install"
377OUTDIR=.\Install\Debug
378INTDIR=.\Install\Debug
379
380ALL : "Dipstick - Win32 Debug" "$(OUTDIR)\Install.exe"
381
382CLEAN :
383 -@erase "$(INTDIR)\install.obj"
384 -@erase "$(INTDIR)\Install.res"
385 -@erase "$(INTDIR)\vc40.idb"
386 -@erase "$(INTDIR)\vc40.pdb"
387 -@erase "$(OUTDIR)\Install.exe"
388 -@erase "$(OUTDIR)\Install.ilk"
389 -@erase "$(OUTDIR)\Install.pdb"
390
391"$(OUTDIR)" :
392 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
393
394# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c
395# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
396CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
397 /D "_MBCS" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c
398CPP_OBJS=.\Install\Debug/
399CPP_SBRS=.\.
400# ADD BASE MTL /nologo /D "_DEBUG" /win32
401# ADD MTL /nologo /D "_DEBUG" /win32
402MTL_PROJ=/nologo /D "_DEBUG" /win32
403# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
404# ADD RSC /l 0x409 /d "_DEBUG"
405RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "_DEBUG"
406BSC32=bscmake.exe
407# ADD BASE BSC32 /nologo
408# ADD BSC32 /nologo
409BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
410BSC32_SBRS= \
411
412LINK32=link.exe
413# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
414# 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
415LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
416 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
417 odbccp32.lib version.lib /nologo /subsystem:windows /incremental:yes\
418 /pdb:"$(OUTDIR)/Install.pdb" /debug /machine:I386 /out:"$(OUTDIR)/Install.exe"
419LINK32_OBJS= \
420 "$(INTDIR)\install.obj" \
421 "$(INTDIR)\Install.res"
422
423"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
424 $(LINK32) @<<
425 $(LINK32_FLAGS) $(LINK32_OBJS)
426<<
427
428!ELSEIF "$(CFG)" == "Install - Win32 Pure"
429
430# PROP BASE Use_MFC 0
431# PROP BASE Use_Debug_Libraries 1
432# PROP BASE Output_Dir "Install\Pure"
433# PROP BASE Intermediate_Dir "Install\Pure"
434# PROP BASE Target_Dir "Install"
435# PROP Use_MFC 0
436# PROP Use_Debug_Libraries 1
437# PROP Output_Dir "Install\Pure"
438# PROP Intermediate_Dir "Install\Pure"
439# PROP Target_Dir "Install"
440OUTDIR=.\Install\Pure
441INTDIR=.\Install\Pure
442
443ALL : "$(OUTDIR)\Install.exe"
444
445CLEAN :
446 -@erase "$(INTDIR)\install.obj"
447 -@erase "$(INTDIR)\Install.res"
448 -@erase "$(OUTDIR)\Install.exe"
449
450"$(OUTDIR)" :
451 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
452
453# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
454# ADD CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
455CPP_PROJ=/nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
456 "_MBCS" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c
457CPP_OBJS=.\Install\Pure/
458CPP_SBRS=.\.
459# ADD BASE MTL /nologo /D "_DEBUG" /win32
460# ADD MTL /nologo /D "NDEBUG" /win32
461MTL_PROJ=/nologo /D "NDEBUG" /win32
462# ADD BASE RSC /l 0x409 /d "_DEBUG"
463# ADD RSC /l 0x409 /d "NDEBUG"
464RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG"
465BSC32=bscmake.exe
466# ADD BASE BSC32 /nologo
467# ADD BSC32 /nologo
468BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
469BSC32_SBRS= \
470
471LINK32=link.exe
472# 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
473# 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
474# SUBTRACT LINK32 /debug
475LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
476 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
477 odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\
478 /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe"
479LINK32_OBJS= \
480 "$(INTDIR)\install.obj" \
481 "$(INTDIR)\Install.res"
482
483"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
484 $(LINK32) @<<
485 $(LINK32_FLAGS) $(LINK32_OBJS)
486<<
487
488!ELSEIF "$(CFG)" == "Install - Win32 Static"
489
490# PROP BASE Use_MFC 0
491# PROP BASE Use_Debug_Libraries 1
492# PROP BASE Output_Dir "Install\Static"
493# PROP BASE Intermediate_Dir "Install\Static"
494# PROP BASE Target_Dir "Install"
495# PROP Use_MFC 0
496# PROP Use_Debug_Libraries 1
497# PROP Output_Dir "Install\Static"
498# PROP Intermediate_Dir "Install\Static"
499# PROP Target_Dir "Install"
500OUTDIR=.\Install\Static
501INTDIR=.\Install\Static
502
503ALL : "$(OUTDIR)\Install.exe"
504
505CLEAN :
506 -@erase "$(INTDIR)\install.obj"
507 -@erase "$(INTDIR)\Install.res"
508 -@erase "$(OUTDIR)\Install.exe"
509
510"$(OUTDIR)" :
511 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
512
513# ADD BASE CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
514# ADD CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "STATI_K" /YX /c
515CPP_PROJ=/nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
516 "_MBCS" /D "STATI_K" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c
517CPP_OBJS=.\Install\Static/
518CPP_SBRS=.\.
519# ADD BASE MTL /nologo /D "NDEBUG" /win32
520# ADD MTL /nologo /D "NDEBUG" /D "STATI_K" /win32
521MTL_PROJ=/nologo /D "NDEBUG" /D "STATI_K" /win32
522# ADD BASE RSC /l 0x409 /d "NDEBUG"
523# ADD RSC /l 0x409 /d "NDEBUG" /d "STATI_K"
524RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "STATI_K"
525BSC32=bscmake.exe
526# ADD BASE BSC32 /nologo
527# ADD BSC32 /nologo
528BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
529BSC32_SBRS= \
530
531LINK32=link.exe
532# 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"
533# SUBTRACT BASE LINK32 /debug
534# 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
535# SUBTRACT LINK32 /debug
536LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
537 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
538 odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\
539 /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe"
540LINK32_OBJS= \
541 "$(INTDIR)\install.obj" \
542 "$(INTDIR)\Install.res"
543
544"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
545 $(LINK32) @<<
546 $(LINK32_FLAGS) $(LINK32_OBJS)
547<<
548
549!ELSEIF "$(CFG)" == "Install - Win32 Canned"
550
551# PROP BASE Use_MFC 0
552# PROP BASE Use_Debug_Libraries 1
553# PROP BASE Output_Dir "Install\Canned"
554# PROP BASE Intermediate_Dir "Install\Canned"
555# PROP BASE Target_Dir "Install"
556# PROP Use_MFC 0
557# PROP Use_Debug_Libraries 1
558# PROP Output_Dir "Install\Canned"
559# PROP Intermediate_Dir "Install\Canned"
560# PROP Target_Dir "Install"
561OUTDIR=.\Install\Canned
562INTDIR=.\Install\Canned
563
564ALL : "$(OUTDIR)\Install.exe"
565
566CLEAN :
567 -@erase "$(INTDIR)\install.obj"
568 -@erase "$(INTDIR)\Install.res"
569 -@erase "$(OUTDIR)\Install.exe"
570
571"$(OUTDIR)" :
572 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
573
574# ADD BASE CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c
575# ADD CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "K_ANNED" /YX /c
576CPP_PROJ=/nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
577 "_MBCS" /D "K_ANNED" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c
578CPP_OBJS=.\Install\Canned/
579CPP_SBRS=.\.
580# ADD BASE MTL /nologo /D "NDEBUG" /win32
581# ADD MTL /nologo /D "NDEBUG" /D "K_ANNED" /win32
582MTL_PROJ=/nologo /D "NDEBUG" /D "K_ANNED" /win32
583# ADD BASE RSC /l 0x409 /d "NDEBUG"
584# ADD RSC /l 0x409 /d "NDEBUG" /d "K_ANNED"
585RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "K_ANNED"
586BSC32=bscmake.exe
587# ADD BASE BSC32 /nologo
588# ADD BSC32 /nologo
589BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
590BSC32_SBRS= \
591
592LINK32=link.exe
593# 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"
594# SUBTRACT BASE LINK32 /debug
595# 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
596# SUBTRACT LINK32 /debug
597LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
598 advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
599 odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\
600 /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe"
601LINK32_OBJS= \
602 "$(INTDIR)\install.obj" \
603 "$(INTDIR)\Install.res"
604
605"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
606 $(LINK32) @<<
607 $(LINK32_FLAGS) $(LINK32_OBJS)
608<<
609
610!ENDIF
611
612.c{$(CPP_OBJS)}.obj:
613 $(CPP) $(CPP_PROJ) $<
614
615.cpp{$(CPP_OBJS)}.obj:
616 $(CPP) $(CPP_PROJ) $<
617
618.cxx{$(CPP_OBJS)}.obj:
619 $(CPP) $(CPP_PROJ) $<
620
621.c{$(CPP_SBRS)}.sbr:
622 $(CPP) $(CPP_PROJ) $<
623
624.cpp{$(CPP_SBRS)}.sbr:
625 $(CPP) $(CPP_PROJ) $<
626
627.cxx{$(CPP_SBRS)}.sbr:
628 $(CPP) $(CPP_PROJ) $<
629
630################################################################################
631# Begin Target
632
633# Name "Dipstick - Win32 Release"
634# Name "Dipstick - Win32 Debug"
635# Name "Dipstick - Win32 Release Static"
636
637!IF "$(CFG)" == "Dipstick - Win32 Release"
638
639!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
640
641!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
642
643!ENDIF
644
645################################################################################
646# Begin Source File
647
648SOURCE=.\Dipstick.cpp
649
650!IF "$(CFG)" == "Dipstick - Win32 Release"
651
652DEP_CPP_DIPST=\
653 ".\CrackURL.h"\
654 ".\Dipstick.h"\
655 ".\DipstickDlg.h"\
656 ".\shared-code\ip_icmp.h"\
657 ".\shared-code\kICMP.h"\
658 ".\shared-code\ms_icmp.h"\
659 ".\shared-code\RegEx.h"\
660 ".\stdafx.h"\
661
662
663"$(INTDIR)\Dipstick.obj" : $(SOURCE) $(DEP_CPP_DIPST) "$(INTDIR)"\
664 "$(INTDIR)\dipstick.pch"
665
666
667!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
668
669DEP_CPP_DIPST=\
670 ".\CrackURL.h"\
671 ".\Dipstick.h"\
672 ".\DipstickDlg.h"\
673 ".\shared-code\ip_icmp.h"\
674 ".\shared-code\kICMP.h"\
675 ".\shared-code\ms_icmp.h"\
676 ".\shared-code\RegEx.h"\
677 ".\stdafx.h"\
678
679
680"$(INTDIR)\Dipstick.obj" : $(SOURCE) $(DEP_CPP_DIPST) "$(INTDIR)"\
681 "$(INTDIR)\dipstick.pch"
682
683
684!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
685
686DEP_CPP_DIPST=\
687 ".\CrackURL.h"\
688 ".\Dipstick.h"\
689 ".\DipstickDlg.h"\
690 ".\shared-code\ip_icmp.h"\
691 ".\shared-code\kICMP.h"\
692 ".\shared-code\ms_icmp.h"\
693 ".\shared-code\RegEx.h"\
694 ".\stdafx.h"\
695
696
697"$(INTDIR)\Dipstick.obj" : $(SOURCE) $(DEP_CPP_DIPST) "$(INTDIR)"\
698 "$(INTDIR)\dipstick.pch"
699
700
701!ENDIF
702
703# End Source File
704################################################################################
705# Begin Source File
706
707SOURCE=.\DipstickDlg.cpp
708
709!IF "$(CFG)" == "Dipstick - Win32 Release"
710
711DEP_CPP_DIPSTI=\
712 ".\AutoBestDlg.h"\
713 ".\CrackURL.h"\
714 ".\Dipstick.h"\
715 ".\DipstickDlg.h"\
716 ".\DragPad.h"\
717 ".\HostNameDlg.h"\
718 ".\HostProperties.h"\
719 ".\OptionsDlg.h"\
720 ".\SelectURLsDlg.h"\
721 ".\shared-code\ip_icmp.h"\
722 ".\shared-code\kICMP.h"\
723 ".\shared-code\ms_icmp.h"\
724 ".\shared-code\RegEx.h"\
725 ".\stdafx.h"\
726 ".\URLSource.h"\
727
728
729"$(INTDIR)\DipstickDlg.obj" : $(SOURCE) $(DEP_CPP_DIPSTI) "$(INTDIR)"\
730 "$(INTDIR)\dipstick.pch"
731
732
733!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
734
735DEP_CPP_DIPSTI=\
736 ".\AutoBestDlg.h"\
737 ".\CrackURL.h"\
738 ".\Dipstick.h"\
739 ".\DipstickDlg.h"\
740 ".\DragPad.h"\
741 ".\HostNameDlg.h"\
742 ".\HostProperties.h"\
743 ".\OptionsDlg.h"\
744 ".\SelectURLsDlg.h"\
745 ".\shared-code\ip_icmp.h"\
746 ".\shared-code\kICMP.h"\
747 ".\shared-code\ms_icmp.h"\
748 ".\shared-code\RegEx.h"\
749 ".\stdafx.h"\
750 ".\URLSource.h"\
751
752
753"$(INTDIR)\DipstickDlg.obj" : $(SOURCE) $(DEP_CPP_DIPSTI) "$(INTDIR)"\
754 "$(INTDIR)\dipstick.pch"
755
756
757!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
758
759DEP_CPP_DIPSTI=\
760 ".\AutoBestDlg.h"\
761 ".\CrackURL.h"\
762 ".\Dipstick.h"\
763 ".\DipstickDlg.h"\
764 ".\DragPad.h"\
765 ".\HostNameDlg.h"\
766 ".\HostProperties.h"\
767 ".\OptionsDlg.h"\
768 ".\SelectURLsDlg.h"\
769 ".\shared-code\ip_icmp.h"\
770 ".\shared-code\kICMP.h"\
771 ".\shared-code\ms_icmp.h"\
772 ".\shared-code\RegEx.h"\
773 ".\stdafx.h"\
774 ".\URLSource.h"\
775
776
777"$(INTDIR)\DipstickDlg.obj" : $(SOURCE) $(DEP_CPP_DIPSTI) "$(INTDIR)"\
778 "$(INTDIR)\dipstick.pch"
779
780
781!ENDIF
782
783# End Source File
784################################################################################
785# Begin Source File
786
787SOURCE=.\StdAfx.cpp
788
789!IF "$(CFG)" == "Dipstick - Win32 Release"
790
791DEP_CPP_STDAF=\
792 ".\CrackURL.h"\
793 ".\shared-code\ip_icmp.h"\
794 ".\shared-code\kICMP.h"\
795 ".\shared-code\ms_icmp.h"\
796 ".\shared-code\RegEx.h"\
797 ".\stdafx.h"\
798
799# ADD CPP /Yc"stdafx.h"
800
801BuildCmds= \
802 $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
803 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/"\
804 /c $(SOURCE) \
805
806
807"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
808 $(BuildCmds)
809
810"$(INTDIR)\dipstick.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
811 $(BuildCmds)
812
813!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
814
815DEP_CPP_STDAF=\
816 ".\CrackURL.h"\
817 ".\shared-code\ip_icmp.h"\
818 ".\shared-code\kICMP.h"\
819 ".\shared-code\ms_icmp.h"\
820 ".\shared-code\RegEx.h"\
821 ".\stdafx.h"\
822
823# ADD CPP /Yc"stdafx.h"
824
825BuildCmds= \
826 $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
827 /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yc"stdafx.h"\
828 /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE) \
829
830
831"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
832 $(BuildCmds)
833
834"$(INTDIR)\dipstick.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
835 $(BuildCmds)
836
837!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
838
839DEP_CPP_STDAF=\
840 ".\CrackURL.h"\
841 ".\shared-code\ip_icmp.h"\
842 ".\shared-code\kICMP.h"\
843 ".\shared-code\ms_icmp.h"\
844 ".\shared-code\RegEx.h"\
845 ".\stdafx.h"\
846
847# ADD BASE CPP /Yc"stdafx.h"
848# ADD CPP /Yc"stdafx.h"
849
850BuildCmds= \
851 $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS"\
852 /Fp"$(INTDIR)/dipstick.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \
853
854
855"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
856 $(BuildCmds)
857
858"$(INTDIR)\dipstick.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
859 $(BuildCmds)
860
861!ENDIF
862
863# End Source File
864################################################################################
865# Begin Source File
866
867SOURCE=.\dipstick.rc
868
869!IF "$(CFG)" == "Dipstick - Win32 Release"
870
871DEP_RSC_DIPSTIC=\
872 ".\res\best.wav"\
873 ".\res\complete.ico"\
874 ".\res\Dipstick.ico"\
875 ".\res\dipstick.rc2"\
876 ".\res\kdnd.avi"\
877 ".\res\Kdragurl.avi"\
878 ".\res\pending.ico"\
879 ".\res\pinging.ico"\
880 ".\res\unreach.ico"\
881 ".\shared-data\klever-background.bmp"\
882
883
884"$(INTDIR)\dipstick.res" : $(SOURCE) $(DEP_RSC_DIPSTIC) "$(INTDIR)"
885 $(RSC) $(RSC_PROJ) $(SOURCE)
886
887
888!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
889
890DEP_RSC_DIPSTIC=\
891 ".\res\background.bmp"\
892 ".\res\best.wav"\
893 ".\res\complete.ico"\
894 ".\res\Dipstick.ico"\
895 ".\res\dipstick.rc2"\
896 ".\res\kdnd.avi"\
897 ".\res\Kdragurl.avi"\
898 ".\res\pending.ico"\
899 ".\res\pinging.ico"\
900 ".\res\unreach.ico"\
901
902
903"$(INTDIR)\dipstick.res" : $(SOURCE) $(DEP_RSC_DIPSTIC) "$(INTDIR)"
904 $(RSC) $(RSC_PROJ) $(SOURCE)
905
906
907!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
908
909DEP_RSC_DIPSTIC=\
910 ".\res\background.bmp"\
911 ".\res\best.wav"\
912 ".\res\complete.ico"\
913 ".\res\Dipstick.ico"\
914 ".\res\dipstick.rc2"\
915 ".\res\kdnd.avi"\
916 ".\res\Kdragurl.avi"\
917 ".\res\pending.ico"\
918 ".\res\pinging.ico"\
919 ".\res\unreach.ico"\
920
921
922"$(INTDIR)\dipstick.res" : $(SOURCE) $(DEP_RSC_DIPSTIC) "$(INTDIR)"
923 $(RSC) $(RSC_PROJ) $(SOURCE)
924
925
926!ENDIF
927
928# End Source File
929################################################################################
930# Begin Source File
931
932SOURCE=.\DragPad.cpp
933
934!IF "$(CFG)" == "Dipstick - Win32 Release"
935
936DEP_CPP_DRAGP=\
937 ".\CrackURL.h"\
938 ".\Dipstick.h"\
939 ".\DipstickDlg.h"\
940 ".\DragPad.h"\
941 ".\shared-code\ip_icmp.h"\
942 ".\shared-code\kICMP.h"\
943 ".\shared-code\ms_icmp.h"\
944 ".\shared-code\RegEx.h"\
945 ".\stdafx.h"\
946
947
948"$(INTDIR)\DragPad.obj" : $(SOURCE) $(DEP_CPP_DRAGP) "$(INTDIR)"\
949 "$(INTDIR)\dipstick.pch"
950
951
952!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
953
954DEP_CPP_DRAGP=\
955 ".\CrackURL.h"\
956 ".\Dipstick.h"\
957 ".\DipstickDlg.h"\
958 ".\DragPad.h"\
959 ".\shared-code\ip_icmp.h"\
960 ".\shared-code\kICMP.h"\
961 ".\shared-code\ms_icmp.h"\
962 ".\shared-code\RegEx.h"\
963 ".\stdafx.h"\
964
965
966"$(INTDIR)\DragPad.obj" : $(SOURCE) $(DEP_CPP_DRAGP) "$(INTDIR)"\
967 "$(INTDIR)\dipstick.pch"
968
969
970!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
971
972DEP_CPP_DRAGP=\
973 ".\CrackURL.h"\
974 ".\Dipstick.h"\
975 ".\DipstickDlg.h"\
976 ".\DragPad.h"\
977 ".\shared-code\ip_icmp.h"\
978 ".\shared-code\kICMP.h"\
979 ".\shared-code\ms_icmp.h"\
980 ".\shared-code\RegEx.h"\
981 ".\stdafx.h"\
982
983
984"$(INTDIR)\DragPad.obj" : $(SOURCE) $(DEP_CPP_DRAGP) "$(INTDIR)"\
985 "$(INTDIR)\dipstick.pch"
986
987
988!ENDIF
989
990# End Source File
991################################################################################
992# Begin Source File
993
994SOURCE=.\OptionsDlg.cpp
995
996!IF "$(CFG)" == "Dipstick - Win32 Release"
997
998DEP_CPP_OPTIO=\
999 ".\CrackURL.h"\
1000 ".\Dipstick.h"\
1001 ".\OptionsDlg.h"\
1002 ".\shared-code\ip_icmp.h"\
1003 ".\shared-code\kICMP.h"\
1004 ".\shared-code\ms_icmp.h"\
1005 ".\shared-code\RegEx.h"\
1006 ".\stdafx.h"\
1007
1008
1009"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) $(DEP_CPP_OPTIO) "$(INTDIR)"\
1010 "$(INTDIR)\dipstick.pch"
1011
1012
1013!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1014
1015DEP_CPP_OPTIO=\
1016 ".\CrackURL.h"\
1017 ".\Dipstick.h"\
1018 ".\OptionsDlg.h"\
1019 ".\shared-code\ip_icmp.h"\
1020 ".\shared-code\kICMP.h"\
1021 ".\shared-code\ms_icmp.h"\
1022 ".\shared-code\RegEx.h"\
1023 ".\stdafx.h"\
1024
1025
1026"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) $(DEP_CPP_OPTIO) "$(INTDIR)"\
1027 "$(INTDIR)\dipstick.pch"
1028
1029
1030!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1031
1032DEP_CPP_OPTIO=\
1033 ".\CrackURL.h"\
1034 ".\Dipstick.h"\
1035 ".\OptionsDlg.h"\
1036 ".\shared-code\ip_icmp.h"\
1037 ".\shared-code\kICMP.h"\
1038 ".\shared-code\ms_icmp.h"\
1039 ".\shared-code\RegEx.h"\
1040 ".\stdafx.h"\
1041
1042
1043"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) $(DEP_CPP_OPTIO) "$(INTDIR)"\
1044 "$(INTDIR)\dipstick.pch"
1045
1046
1047!ENDIF
1048
1049# End Source File
1050################################################################################
1051# Begin Source File
1052
1053SOURCE=.\HostNameDlg.cpp
1054
1055!IF "$(CFG)" == "Dipstick - Win32 Release"
1056
1057DEP_CPP_HOSTN=\
1058 ".\CrackURL.h"\
1059 ".\Dipstick.h"\
1060 ".\HostNameDlg.h"\
1061 ".\shared-code\ip_icmp.h"\
1062 ".\shared-code\kICMP.h"\
1063 ".\shared-code\ms_icmp.h"\
1064 ".\shared-code\RegEx.h"\
1065 ".\stdafx.h"\
1066
1067
1068"$(INTDIR)\HostNameDlg.obj" : $(SOURCE) $(DEP_CPP_HOSTN) "$(INTDIR)"\
1069 "$(INTDIR)\dipstick.pch"
1070
1071
1072!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1073
1074DEP_CPP_HOSTN=\
1075 ".\CrackURL.h"\
1076 ".\Dipstick.h"\
1077 ".\HostNameDlg.h"\
1078 ".\shared-code\ip_icmp.h"\
1079 ".\shared-code\kICMP.h"\
1080 ".\shared-code\ms_icmp.h"\
1081 ".\shared-code\RegEx.h"\
1082 ".\stdafx.h"\
1083
1084
1085"$(INTDIR)\HostNameDlg.obj" : $(SOURCE) $(DEP_CPP_HOSTN) "$(INTDIR)"\
1086 "$(INTDIR)\dipstick.pch"
1087
1088
1089!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1090
1091DEP_CPP_HOSTN=\
1092 ".\CrackURL.h"\
1093 ".\Dipstick.h"\
1094 ".\HostNameDlg.h"\
1095 ".\shared-code\ip_icmp.h"\
1096 ".\shared-code\kICMP.h"\
1097 ".\shared-code\ms_icmp.h"\
1098 ".\shared-code\RegEx.h"\
1099 ".\stdafx.h"\
1100
1101
1102"$(INTDIR)\HostNameDlg.obj" : $(SOURCE) $(DEP_CPP_HOSTN) "$(INTDIR)"\
1103 "$(INTDIR)\dipstick.pch"
1104
1105
1106!ENDIF
1107
1108# End Source File
1109################################################################################
1110# Begin Source File
1111
1112SOURCE=.\HostProperties.cpp
1113
1114!IF "$(CFG)" == "Dipstick - Win32 Release"
1115
1116DEP_CPP_HOSTP=\
1117 ".\CrackURL.h"\
1118 ".\Dipstick.h"\
1119 ".\DipstickDlg.h"\
1120 ".\HostProperties.h"\
1121 ".\shared-code\ip_icmp.h"\
1122 ".\shared-code\kICMP.h"\
1123 ".\shared-code\ms_icmp.h"\
1124 ".\shared-code\RegEx.h"\
1125 ".\stdafx.h"\
1126
1127
1128"$(INTDIR)\HostProperties.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
1129 "$(INTDIR)\dipstick.pch"
1130
1131
1132!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1133
1134DEP_CPP_HOSTP=\
1135 ".\CrackURL.h"\
1136 ".\Dipstick.h"\
1137 ".\DipstickDlg.h"\
1138 ".\HostProperties.h"\
1139 ".\shared-code\ip_icmp.h"\
1140 ".\shared-code\kICMP.h"\
1141 ".\shared-code\ms_icmp.h"\
1142 ".\shared-code\RegEx.h"\
1143 ".\stdafx.h"\
1144
1145
1146"$(INTDIR)\HostProperties.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
1147 "$(INTDIR)\dipstick.pch"
1148
1149
1150!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1151
1152DEP_CPP_HOSTP=\
1153 ".\CrackURL.h"\
1154 ".\Dipstick.h"\
1155 ".\DipstickDlg.h"\
1156 ".\HostProperties.h"\
1157 ".\shared-code\ip_icmp.h"\
1158 ".\shared-code\kICMP.h"\
1159 ".\shared-code\ms_icmp.h"\
1160 ".\shared-code\RegEx.h"\
1161 ".\stdafx.h"\
1162
1163
1164"$(INTDIR)\HostProperties.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\
1165 "$(INTDIR)\dipstick.pch"
1166
1167
1168!ENDIF
1169
1170# End Source File
1171################################################################################
1172# Begin Source File
1173
1174SOURCE=.\Help\DipStick.hpj
1175
1176!IF "$(CFG)" == "Dipstick - Win32 Release"
1177
1178# Begin Custom Build - Making help file...
1179OutDir=.\Release
1180ProjDir=.
1181TargetName=dipstick
1182InputPath=.\help\dipstick.hpj
1183
1184BuildCmds= \
1185 "$(ProjDir)\makehelp.bat" \
1186 compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
1187 compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
1188
1189
1190"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1191 $(BuildCmds)
1192
1193"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1194 $(BuildCmds)
1195
1196"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1197 $(BuildCmds)
1198
1199"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1200 $(BuildCmds)
1201# End Custom Build
1202
1203!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1204
1205# Begin Custom Build - Making help file...
1206OutDir=.\Debug
1207ProjDir=.
1208TargetName=dipstick
1209InputPath=.\help\dipstick.hpj
1210
1211BuildCmds= \
1212 "$(ProjDir)\makehelp.bat" \
1213 compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
1214 compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
1215
1216
1217"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1218 $(BuildCmds)
1219
1220"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1221 $(BuildCmds)
1222
1223"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1224 $(BuildCmds)
1225
1226"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1227 $(BuildCmds)
1228# End Custom Build
1229
1230!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1231
1232# Begin Custom Build - Making help file...
1233OutDir=.\Releast
1234ProjDir=.
1235TargetName=dipstick
1236InputPath=.\help\dipstick.hpj
1237
1238BuildCmds= \
1239 "$(ProjDir)\makehelp.bat" \
1240 compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
1241 compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
1242
1243
1244"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1245 $(BuildCmds)
1246
1247"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1248 $(BuildCmds)
1249
1250"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1251 $(BuildCmds)
1252
1253"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
1254 $(BuildCmds)
1255# End Custom Build
1256
1257!ENDIF
1258
1259# End Source File
1260################################################################################
1261# Begin Source File
1262
1263SOURCE=.\AutoBestDlg.cpp
1264
1265!IF "$(CFG)" == "Dipstick - Win32 Release"
1266
1267DEP_CPP_AUTOB=\
1268 ".\AutoBestDlg.h"\
1269 ".\CrackURL.h"\
1270 ".\Dipstick.h"\
1271 ".\shared-code\ip_icmp.h"\
1272 ".\shared-code\kICMP.h"\
1273 ".\shared-code\ms_icmp.h"\
1274 ".\shared-code\RegEx.h"\
1275 ".\stdafx.h"\
1276 ".\URLSource.h"\
1277
1278
1279"$(INTDIR)\AutoBestDlg.obj" : $(SOURCE) $(DEP_CPP_AUTOB) "$(INTDIR)"\
1280 "$(INTDIR)\dipstick.pch"
1281
1282
1283!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1284
1285DEP_CPP_AUTOB=\
1286 ".\AutoBestDlg.h"\
1287 ".\CrackURL.h"\
1288 ".\Dipstick.h"\
1289 ".\shared-code\ip_icmp.h"\
1290 ".\shared-code\kICMP.h"\
1291 ".\shared-code\ms_icmp.h"\
1292 ".\shared-code\RegEx.h"\
1293 ".\stdafx.h"\
1294 ".\URLSource.h"\
1295
1296
1297"$(INTDIR)\AutoBestDlg.obj" : $(SOURCE) $(DEP_CPP_AUTOB) "$(INTDIR)"\
1298 "$(INTDIR)\dipstick.pch"
1299
1300
1301!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1302
1303DEP_CPP_AUTOB=\
1304 ".\AutoBestDlg.h"\
1305 ".\CrackURL.h"\
1306 ".\Dipstick.h"\
1307 ".\shared-code\ip_icmp.h"\
1308 ".\shared-code\kICMP.h"\
1309 ".\shared-code\ms_icmp.h"\
1310 ".\shared-code\RegEx.h"\
1311 ".\stdafx.h"\
1312 ".\URLSource.h"\
1313
1314
1315"$(INTDIR)\AutoBestDlg.obj" : $(SOURCE) $(DEP_CPP_AUTOB) "$(INTDIR)"\
1316 "$(INTDIR)\dipstick.pch"
1317
1318
1319!ENDIF
1320
1321# End Source File
1322################################################################################
1323# Begin Source File
1324
1325SOURCE=.\URLSource.cpp
1326
1327!IF "$(CFG)" == "Dipstick - Win32 Release"
1328
1329DEP_CPP_URLSO=\
1330 ".\CrackURL.h"\
1331 ".\shared-code\ip_icmp.h"\
1332 ".\shared-code\kICMP.h"\
1333 ".\shared-code\ms_icmp.h"\
1334 ".\shared-code\RegEx.h"\
1335 ".\stdafx.h"\
1336 ".\URLSource.h"\
1337
1338
1339"$(INTDIR)\URLSource.obj" : $(SOURCE) $(DEP_CPP_URLSO) "$(INTDIR)"\
1340 "$(INTDIR)\dipstick.pch"
1341
1342
1343!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1344
1345DEP_CPP_URLSO=\
1346 ".\CrackURL.h"\
1347 ".\shared-code\ip_icmp.h"\
1348 ".\shared-code\kICMP.h"\
1349 ".\shared-code\ms_icmp.h"\
1350 ".\shared-code\RegEx.h"\
1351 ".\stdafx.h"\
1352 ".\URLSource.h"\
1353
1354
1355"$(INTDIR)\URLSource.obj" : $(SOURCE) $(DEP_CPP_URLSO) "$(INTDIR)"\
1356 "$(INTDIR)\dipstick.pch"
1357
1358
1359!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1360
1361DEP_CPP_URLSO=\
1362 ".\CrackURL.h"\
1363 ".\shared-code\ip_icmp.h"\
1364 ".\shared-code\kICMP.h"\
1365 ".\shared-code\ms_icmp.h"\
1366 ".\shared-code\RegEx.h"\
1367 ".\stdafx.h"\
1368 ".\URLSource.h"\
1369
1370
1371"$(INTDIR)\URLSource.obj" : $(SOURCE) $(DEP_CPP_URLSO) "$(INTDIR)"\
1372 "$(INTDIR)\dipstick.pch"
1373
1374
1375!ENDIF
1376
1377# End Source File
1378################################################################################
1379# Begin Source File
1380
1381SOURCE=.\Help\Dipstick.cnt
1382
1383!IF "$(CFG)" == "Dipstick - Win32 Release"
1384
1385# PROP Exclude_From_Build 1
1386
1387!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1388
1389# PROP Exclude_From_Build 1
1390
1391!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1392
1393# PROP Exclude_From_Build 1
1394
1395!ENDIF
1396
1397# End Source File
1398################################################################################
1399# Begin Source File
1400
1401SOURCE=.\CrackURL.cpp
1402
1403!IF "$(CFG)" == "Dipstick - Win32 Release"
1404
1405DEP_CPP_CRACK=\
1406 ".\CrackURL.h"\
1407 ".\shared-code\ip_icmp.h"\
1408 ".\shared-code\kICMP.h"\
1409 ".\shared-code\ms_icmp.h"\
1410 ".\shared-code\RegEx.h"\
1411 ".\stdafx.h"\
1412
1413
1414"$(INTDIR)\CrackURL.obj" : $(SOURCE) $(DEP_CPP_CRACK) "$(INTDIR)"\
1415 "$(INTDIR)\dipstick.pch"
1416
1417
1418!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1419
1420DEP_CPP_CRACK=\
1421 ".\CrackURL.h"\
1422 ".\shared-code\ip_icmp.h"\
1423 ".\shared-code\kICMP.h"\
1424 ".\shared-code\ms_icmp.h"\
1425 ".\shared-code\RegEx.h"\
1426 ".\stdafx.h"\
1427
1428
1429"$(INTDIR)\CrackURL.obj" : $(SOURCE) $(DEP_CPP_CRACK) "$(INTDIR)"\
1430 "$(INTDIR)\dipstick.pch"
1431
1432
1433!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1434
1435DEP_CPP_CRACK=\
1436 ".\CrackURL.h"\
1437 ".\shared-code\ip_icmp.h"\
1438 ".\shared-code\kICMP.h"\
1439 ".\shared-code\ms_icmp.h"\
1440 ".\shared-code\RegEx.h"\
1441 ".\stdafx.h"\
1442
1443
1444"$(INTDIR)\CrackURL.obj" : $(SOURCE) $(DEP_CPP_CRACK) "$(INTDIR)"\
1445 "$(INTDIR)\dipstick.pch"
1446
1447
1448!ENDIF
1449
1450# End Source File
1451################################################################################
1452# Begin Source File
1453
1454SOURCE=.\SelectURLsDlg.cpp
1455
1456!IF "$(CFG)" == "Dipstick - Win32 Release"
1457
1458DEP_CPP_SELEC=\
1459 ".\CrackURL.h"\
1460 ".\Dipstick.h"\
1461 ".\SelectURLsDlg.h"\
1462 ".\shared-code\ip_icmp.h"\
1463 ".\shared-code\kICMP.h"\
1464 ".\shared-code\ms_icmp.h"\
1465 ".\shared-code\RegEx.h"\
1466 ".\stdafx.h"\
1467
1468
1469"$(INTDIR)\SelectURLsDlg.obj" : $(SOURCE) $(DEP_CPP_SELEC) "$(INTDIR)"\
1470 "$(INTDIR)\dipstick.pch"
1471
1472
1473!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1474
1475DEP_CPP_SELEC=\
1476 ".\CrackURL.h"\
1477 ".\Dipstick.h"\
1478 ".\SelectURLsDlg.h"\
1479 ".\shared-code\ip_icmp.h"\
1480 ".\shared-code\kICMP.h"\
1481 ".\shared-code\ms_icmp.h"\
1482 ".\shared-code\RegEx.h"\
1483 ".\stdafx.h"\
1484
1485
1486"$(INTDIR)\SelectURLsDlg.obj" : $(SOURCE) $(DEP_CPP_SELEC) "$(INTDIR)"\
1487 "$(INTDIR)\dipstick.pch"
1488
1489
1490!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1491
1492DEP_CPP_SELEC=\
1493 ".\CrackURL.h"\
1494 ".\Dipstick.h"\
1495 ".\SelectURLsDlg.h"\
1496 ".\shared-code\ip_icmp.h"\
1497 ".\shared-code\kICMP.h"\
1498 ".\shared-code\ms_icmp.h"\
1499 ".\shared-code\RegEx.h"\
1500 ".\stdafx.h"\
1501
1502
1503"$(INTDIR)\SelectURLsDlg.obj" : $(SOURCE) $(DEP_CPP_SELEC) "$(INTDIR)"\
1504 "$(INTDIR)\dipstick.pch"
1505
1506
1507!ENDIF
1508
1509# End Source File
1510################################################################################
1511# Begin Source File
1512
1513SOURCE=".\shared-code\RegEx.cpp"
1514
1515!IF "$(CFG)" == "Dipstick - Win32 Release"
1516
1517DEP_CPP_REGEX=\
1518 ".\CrackURL.h"\
1519 ".\shared-code\ip_icmp.h"\
1520 ".\shared-code\kICMP.h"\
1521 ".\shared-code\ms_icmp.h"\
1522 ".\shared-code\RegEx.h"\
1523 ".\stdafx.h"\
1524
1525# ADD CPP /Yu"../stdafx.h"
1526
1527"$(INTDIR)\RegEx.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"\
1528 "$(INTDIR)\dipstick.pch"
1529 $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
1530 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\
1531 /Fo"$(INTDIR)/" /c $(SOURCE)
1532
1533
1534!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1535
1536DEP_CPP_REGEX=\
1537 ".\CrackURL.h"\
1538 ".\shared-code\ip_icmp.h"\
1539 ".\shared-code\kICMP.h"\
1540 ".\shared-code\ms_icmp.h"\
1541 ".\shared-code\RegEx.h"\
1542 ".\stdafx.h"\
1543
1544# ADD CPP /Yu"../stdafx.h"
1545
1546"$(INTDIR)\RegEx.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"\
1547 "$(INTDIR)\dipstick.pch"
1548 $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
1549 /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\
1550 /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE)
1551
1552
1553!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1554
1555DEP_CPP_REGEX=\
1556 ".\CrackURL.h"\
1557 ".\shared-code\ip_icmp.h"\
1558 ".\shared-code\kICMP.h"\
1559 ".\shared-code\ms_icmp.h"\
1560 ".\shared-code\RegEx.h"\
1561 ".\stdafx.h"\
1562
1563# ADD CPP /Yu"../stdafx.h"
1564
1565"$(INTDIR)\RegEx.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"\
1566 "$(INTDIR)\dipstick.pch"
1567 $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
1568 "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h" /Fo"$(INTDIR)/" /c\
1569 $(SOURCE)
1570
1571
1572!ENDIF
1573
1574# End Source File
1575################################################################################
1576# Begin Source File
1577
1578SOURCE=".\shared-code\kICMP.cpp"
1579
1580!IF "$(CFG)" == "Dipstick - Win32 Release"
1581
1582DEP_CPP_KICMP=\
1583 ".\CrackURL.h"\
1584 ".\shared-code\ip_icmp.h"\
1585 ".\shared-code\kICMP.h"\
1586 ".\shared-code\ms_icmp.h"\
1587 ".\shared-code\RegEx.h"\
1588 ".\stdafx.h"\
1589
1590# ADD CPP /Yu"../stdafx.h"
1591
1592"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
1593 "$(INTDIR)\dipstick.pch"
1594 $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
1595 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\
1596 /Fo"$(INTDIR)/" /c $(SOURCE)
1597
1598
1599!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug"
1600
1601DEP_CPP_KICMP=\
1602 ".\CrackURL.h"\
1603 ".\shared-code\ip_icmp.h"\
1604 ".\shared-code\kICMP.h"\
1605 ".\shared-code\ms_icmp.h"\
1606 ".\shared-code\RegEx.h"\
1607 ".\stdafx.h"\
1608
1609# ADD CPP /Yu"../stdafx.h"
1610
1611"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
1612 "$(INTDIR)\dipstick.pch"
1613 $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
1614 /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\
1615 /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE)
1616
1617
1618!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static"
1619
1620DEP_CPP_KICMP=\
1621 ".\CrackURL.h"\
1622 ".\shared-code\ip_icmp.h"\
1623 ".\shared-code\kICMP.h"\
1624 ".\shared-code\ms_icmp.h"\
1625 ".\shared-code\RegEx.h"\
1626 ".\stdafx.h"\
1627
1628# ADD CPP /Yu"../stdafx.h"
1629
1630"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\
1631 "$(INTDIR)\dipstick.pch"
1632 $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
1633 "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h" /Fo"$(INTDIR)/" /c\
1634 $(SOURCE)
1635
1636
1637!ENDIF
1638
1639# End Source File
1640# End Target
1641################################################################################
1642# Begin Target
1643
1644# Name "Install - Win32 Debug"
1645# Name "Install - Win32 Pure"
1646# Name "Install - Win32 Static"
1647# Name "Install - Win32 Canned"
1648
1649!IF "$(CFG)" == "Install - Win32 Debug"
1650
1651!ELSEIF "$(CFG)" == "Install - Win32 Pure"
1652
1653!ELSEIF "$(CFG)" == "Install - Win32 Static"
1654
1655!ELSEIF "$(CFG)" == "Install - Win32 Canned"
1656
1657!ENDIF
1658
1659################################################################################
1660# Begin Source File
1661
1662SOURCE=.\Install\Install.rc
1663DEP_RSC_INSTA=\
1664 ".\Install\Custom.rch"\
1665 ".\shared-data\install-icon.ico"\
1666
1667
1668!IF "$(CFG)" == "Install - Win32 Debug"
1669
1670
1671"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
1672 $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "_DEBUG"\
1673 $(SOURCE)
1674
1675
1676!ELSEIF "$(CFG)" == "Install - Win32 Pure"
1677
1678
1679"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
1680 $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG"\
1681 $(SOURCE)
1682
1683
1684!ELSEIF "$(CFG)" == "Install - Win32 Static"
1685
1686
1687"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
1688 $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG" /d\
1689 "STATI_K" $(SOURCE)
1690
1691
1692!ELSEIF "$(CFG)" == "Install - Win32 Canned"
1693
1694
1695"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
1696 $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG" /d\
1697 "K_ANNED" $(SOURCE)
1698
1699
1700!ENDIF
1701
1702# End Source File
1703################################################################################
1704# Begin Source File
1705
1706SOURCE=.\Install\install.cpp
1707DEP_CPP_INSTAL=\
1708 ".\shared-code\install.h"\
1709
1710
1711!IF "$(CFG)" == "Install - Win32 Debug"
1712
1713
1714"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
1715 $(CPP) $(CPP_PROJ) $(SOURCE)
1716
1717
1718!ELSEIF "$(CFG)" == "Install - Win32 Pure"
1719
1720
1721"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
1722 $(CPP) $(CPP_PROJ) $(SOURCE)
1723
1724
1725!ELSEIF "$(CFG)" == "Install - Win32 Static"
1726
1727
1728"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
1729 $(CPP) $(CPP_PROJ) $(SOURCE)
1730
1731
1732!ELSEIF "$(CFG)" == "Install - Win32 Canned"
1733
1734
1735"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
1736 $(CPP) $(CPP_PROJ) $(SOURCE)
1737
1738
1739!ENDIF
1740
1741# End Source File
1742################################################################################
1743# Begin Project Dependency
1744
1745# Project_Dep_Name "Dipstick"
1746
1747!IF "$(CFG)" == "Install - Win32 Debug"
1748
1749"Dipstick - Win32 Debug" :
1750 $(MAKE) /$(MAKEFLAGS) /F ".\dipstick.mak" CFG="Dipstick - Win32 Debug"
1751
1752!ELSEIF "$(CFG)" == "Install - Win32 Pure"
1753
1754!ELSEIF "$(CFG)" == "Install - Win32 Static"
1755
1756!ELSEIF "$(CFG)" == "Install - Win32 Canned"
1757
1758!ENDIF
1759
1760# End Project Dependency
1761# End Target
1762# End Project
1763################################################################################
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 @@
1//Microsoft Developer Studio generated resource script.
2//
3#include "resource.h"
4
5#define APSTUDIO_READONLY_SYMBOLS
6/////////////////////////////////////////////////////////////////////////////
7//
8// Generated from the TEXTINCLUDE 2 resource.
9//
10#include "afxres.h"
11
12/////////////////////////////////////////////////////////////////////////////
13#undef APSTUDIO_READONLY_SYMBOLS
14
15/////////////////////////////////////////////////////////////////////////////
16// English (U.S.) resources
17
18#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19#ifdef _WIN32
20LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21#pragma code_page(1252)
22#endif //_WIN32
23
24#ifdef APSTUDIO_INVOKED
25/////////////////////////////////////////////////////////////////////////////
26//
27// TEXTINCLUDE
28//
29
301 TEXTINCLUDE DISCARDABLE
31BEGIN
32 "resource.h\0"
33END
34
352 TEXTINCLUDE DISCARDABLE
36BEGIN
37 "#include ""afxres.h""\r\n"
38 "\0"
39END
40
413 TEXTINCLUDE DISCARDABLE
42BEGIN
43 "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
44 "#define _AFX_NO_OLE_RESOURCES\r\n"
45 "#define _AFX_NO_TRACKER_RESOURCES\r\n"
46 "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
47 "\r\n"
48 "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
49 "#ifdef _WIN32\r\n"
50 "LANGUAGE 9, 1\r\n"
51 "#pragma code_page(1252)\r\n"
52 "#endif\r\n"
53 "#include ""res\\Dipstick.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
54 "#include ""afxres.rc"" // Standard components\r\n"
55 "#endif\0"
56END
57
58#endif // APSTUDIO_INVOKED
59
60
61/////////////////////////////////////////////////////////////////////////////
62//
63// Icon
64//
65
66// Icon with lowest ID value placed first to ensure application icon
67// remains consistent on all systems.
68IDR_MAINFRAME ICON DISCARDABLE "res\\Dipstick.ico"
69IDI_PINGING ICON DISCARDABLE "res\\pinging.ico"
70IDI_PENDING ICON DISCARDABLE "res\\pending.ico"
71IDI_COMPLETED ICON DISCARDABLE "res\\complete.ico"
72IDI_UNREACHABLE ICON DISCARDABLE "res\\unreach.ico"
73
74/////////////////////////////////////////////////////////////////////////////
75//
76// Dialog
77//
78
79IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 213, 61
80STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU
81CAPTION "About Dipstick"
82FONT 8, "MS Sans Serif"
83BEGIN
84 ICON IDR_MAINFRAME,IDC_STATIC,11,17,21,20
85 LTEXT "Dipstick, Version 3.00",IDC_STATIC,40,7,89,8,
86 SS_NOPREFIX
87 LTEXT "Copyright © 1996,1997,1998,2002 Klever Group",
88 IDC_STATIC,40,25,166,8
89 DEFPUSHBUTTON "OK",IDOK,174,7,32,14,WS_GROUP
90 PUSHBUTTON "http://www.klever.net/",IDC_KLEVERNET,40,40,91,14
91END
92
93IDD_DIPSTICK_DIALOG DIALOGEX 0, 0, 419, 152
94STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
95EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP |
96 WS_EX_APPWINDOW
97CAPTION " Dipstick 3.00"
98FONT 8, "MS Sans Serif", 0, 0, 0x1
99BEGIN
100 CONTROL "List1",IDC_HOSTLIST,"SysListView32",LVS_REPORT |
101 LVS_SORTASCENDING | LVS_AUTOARRANGE | WS_BORDER |
102 WS_TABSTOP,8,8,349,136,WS_EX_CLIENTEDGE
103 PUSHBUTTON "&Manual Ping",IDC_MANUALPING,361,8,50,14
104 PUSHBUTTON "&Reping",IDC_REPING,361,23,50,14,WS_DISABLED
105 PUSHBUTTON "Reping &All",IDC_REPINGALL,361,38,50,14,WS_DISABLED
106 PUSHBUTTON "R&emove",IDC_REMOVE,361,53,50,14,WS_DISABLED
107 PUSHBUTTON "Remove A&ll",IDC_CLEAR,361,68,50,14,WS_DISABLED
108 PUSHBUTTON "&Help",ID_HELP,361,99,50,14
109 PUSHBUTTON "&Options",IDC_OPTIONS,361,114,50,14
110 PUSHBUTTON "E&xit Dipstick",IDC_EXIT,361,129,50,14
111 PUSHBUTTON "",IDCANCEL,411,2,6,6,NOT WS_VISIBLE | WS_DISABLED
112 PUSHBUTTON "Ad&vanced",IDC_ADVANCED,361,83,50,11
113END
114
115IDD_DRAGPAD DIALOGEX 0, 0, 53, 33
116STYLE DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
117EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP
118CAPTION " Drag URL here"
119FONT 8, "MS Sans Serif", 0, 0, 0x1
120BEGIN
121 CONTROL "Animate1",IDC_DNDTARGET,"SysAnimate32",WS_TABSTOP,0,0,
122 53,33
123 PUSHBUTTON "",IDCANCEL,49,0,6,6,NOT WS_VISIBLE | WS_DISABLED
124 DEFPUSHBUTTON "",IDOK,47,27,6,6,NOT WS_VISIBLE | WS_DISABLED
125END
126
127IDD_OPTIONS DIALOGEX 0, 0, 179, 154
128STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
129EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP
130CAPTION "Dipstick Options"
131FONT 8, "MS Sans Serif", 0, 0, 0x1
132BEGIN
133 LTEXT "Number of pings per &host",IDC_STATIC,50,9,122,10
134 EDITTEXT IDC_NPINGS,7,7,35,14,ES_AUTOHSCROLL
135 CONTROL "Spin1",IDC_SPINPINGS,"msctls_updown32",UDS_WRAP |
136 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
137 UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,7,11,14
138 LTEXT "&Maximum number of threads",IDC_STATIC,50,23,122,10
139 EDITTEXT IDC_MAXPINGS,7,21,35,14,ES_AUTOHSCROLL
140 CONTROL "Spin1",IDC_SPINMAXPINGS,"msctls_updown32",UDS_WRAP |
141 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
142 UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,21,11,14
143 LTEXT "Ping &timeout",IDC_STATIC,50,37,122,10
144 EDITTEXT IDC_TIMEOUT,7,35,35,14,ES_AUTOHSCROLL
145 CONTROL "Spin1",IDC_SPINTIMEOUT,"msctls_updown32",UDS_WRAP |
146 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
147 UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,35,11,14
148 LTEXT "&Interval between pings",IDC_STATIC,50,51,122,10
149 EDITTEXT IDC_INTERVAL,7,49,35,14,ES_AUTOHSCROLL
150 CONTROL "Spin1",IDC_SPINTERVAL,"msctls_updown32",UDS_WRAP |
151 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
152 UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,49,11,14
153 LTEXT "Ping &size",IDC_STATIC,50,65,122,10
154 EDITTEXT IDC_PACKETSIZE,7,63,35,14,ES_AUTOHSCROLL
155 CONTROL "Spin1",IDC_SPINSIZE,"msctls_updown32",UDS_WRAP |
156 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
157 UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,63,11,14
158 CONTROL "Test i&nnermost URL",IDC_MSWORKAROUND,"Button",
159 BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,7,80,165,8
160 DEFPUSHBUTTON "OK",IDOK,31,133,50,14
161 PUSHBUTTON "Cancel",IDCANCEL,97,133,50,14
162 CONTROL "Come up with the &best URL",IDC_AUTOBEST,"Button",
163 BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,16,90,156,8
164 CONTROL "When selecting URLs, enable smart adjust",
165 IDC_SMARTADJUST,"Button",BS_AUTOCHECKBOX | BS_NOTIFY |
166 WS_TABSTOP,7,100,165,8
167 CONTROL "When smart-adjusting, use innermost URL",IDC_ADJUSTINN,
168 "Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,16,110,
169 156,8
170 CONTROL "Ignore relative URLs when dragging selection.",
171 IDC_IGNORELA,"Button",BS_AUTOCHECKBOX | BS_NOTIFY |
172 WS_TABSTOP,7,120,165,8
173END
174
175IDD_MANUALHOST DIALOGEX 0, 0, 187, 54
176STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
177EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
178CAPTION " Manually Test Host"
179FONT 8, "MS Sans Serif", 0, 0, 0x1
180BEGIN
181 LTEXT "Enter &URL, host name or ip address:",IDC_STATIC,7,7,
182 129,8
183 EDITTEXT IDC_HOST,7,16,173,14,ES_LOWERCASE | ES_AUTOHSCROLL
184 DEFPUSHBUTTON "OK",IDOK,35,33,50,14
185 PUSHBUTTON "Cancel",IDCANCEL,101,33,50,14
186END
187
188IDD_PROPS DIALOGEX 0, 0, 209, 99
189STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
190EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
191CAPTION " Properties"
192FONT 8, "MS Sans Serif", 0, 0, 0x1
193BEGIN
194 DEFPUSHBUTTON "OK",IDOK,152,78,50,14
195 LTEXT "URL:",IDC_URLCAPTION,7,7,18,8,SS_NOTIFY
196 LTEXT "..",IDC_URL,60,7,142,8,SS_NOPREFIX | SS_NOTIFY
197 LTEXT "Host name:",IDC_HOSTCAPTION,7,17,37,8,SS_NOTIFY
198 LTEXT "..",IDC_HOST,60,17,142,8,SS_NOPREFIX | SS_NOTIFY
199 LTEXT "IP:",IDC_IPCAPTION,7,27,10,8,SS_NOTIFY
200 LTEXT "..",IDC_IP,60,27,142,8,SS_NOTIFY
201 LTEXT "Ping times (min/avg/max):",IDC_TIMESCAPTION,7,37,53,17,
202 SS_NOTIFY
203 LTEXT "../../..",IDC_TIMES,60,45,66,8,SS_NOTIFY
204 LTEXT "Packet loss:",IDC_LOSSCAPTION,7,56,40,8,SS_NOTIFY
205 LTEXT "..",IDC_LOSS,60,56,66,8,SS_NOPREFIX | SS_NOTIFY
206 LTEXT "Status:",IDC_STATUSCAPTION,7,66,23,8,SS_NOTIFY
207 LTEXT "..",IDC_STATUS,60,66,142,8,SS_NOPREFIX | SS_NOTIFY
208 PUSHBUTTON "&Open URL",IDC_OPENURL,7,78,50,14
209 ICON IDR_MAINFRAME,IDC_STATE,166,42,18,20,SS_NOTIFY |
210 SS_CENTERIMAGE | SS_REALSIZEIMAGE
211 PUSHBUTTON "&Copy URL",IDC_COPYURL,60,78,50,14
212END
213
214IDD_AUTOBEST DIALOGEX 0, 0, 287, 82
215STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
216 WS_CAPTION
217EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
218CAPTION " Dipstick - report"
219FONT 8, "MS Sans Serif", 0, 0, 0x1
220BEGIN
221 DEFPUSHBUTTON "Open this URL",IDOK,110,47,68,14
222 PUSHBUTTON "&Next Location",IDC_NEXT,188,47,68,14
223 PUSHBUTTON "&Previous Location",IDC_PREV,32,47,68,14
224 CTEXT "..",IDC_URL,7,7,273,14,SS_NOPREFIX,WS_EX_DLGMODALFRAME |
225 WS_EX_CLIENTEDGE
226 LTEXT "Average Response Time, milliseconds:",IDC_STATIC,7,25,
227 136,8
228 LTEXT "..",IDC_RTT,143,25,68,8
229 LTEXT "Packet Loss:",IDC_STATIC,7,36,136,8
230 LTEXT "..",IDC_PKTLOSS,143,36,68,8
231 PUSHBUTTON "Cancel",IDCANCEL,118,63,50,12
232 CONTROL "Animate1",IDC_DROPSOURCE,"SysAnimate32",ACS_CENTER |
233 ACS_AUTOPLAY,257,23,23,22,WS_EX_DLGMODALFRAME |
234 WS_EX_STATICEDGE
235 PUSHBUTTON "&Copy URL",IDC_COPYURL,211,23,39,22,BS_CENTER |
236 BS_VCENTER | BS_MULTILINE
237END
238
239IDD_URLS DIALOGEX 0, 0, 176, 192
240STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_MAXIMIZEBOX | WS_POPUP |
241 WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
242EXSTYLE WS_EX_CLIENTEDGE
243CAPTION " Select URLs of interest"
244FONT 8, "MS Sans Serif", 0, 0, 0x1
245BEGIN
246 LISTBOX IDC_URLS,7,7,162,146,LBS_SORT | LBS_NOINTEGRALHEIGHT |
247 LBS_EXTENDEDSEL | NOT WS_BORDER | WS_VSCROLL |
248 WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
249 DEFPUSHBUTTON "OK",IDOK,7,155,50,14
250 PUSHBUTTON "Cancel",IDCANCEL,7,171,50,14
251 CONTROL "&Smart adjust selection",IDC_DOADJUST,"Button",
252 BS_AUTOCHECKBOX | BS_TOP | WS_TABSTOP,63,157,106,10
253 CONTROL "Adjust by &innermost URL",IDC_ADJUSTINN,"Button",
254 BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,63,
255 175,106,10
256END
257
258
259#ifndef _MAC
260/////////////////////////////////////////////////////////////////////////////
261//
262// Version
263//
264
265VS_VERSION_INFO VERSIONINFO
266 FILEVERSION 3,0,0,0
267 PRODUCTVERSION 3,0,0,0
268 FILEFLAGSMASK 0x3fL
269#ifdef _DEBUG
270 FILEFLAGS 0x9L
271#else
272 FILEFLAGS 0x8L
273#endif
274 FILEOS 0x4L
275 FILETYPE 0x1L
276 FILESUBTYPE 0x0L
277BEGIN
278 BLOCK "StringFileInfo"
279 BEGIN
280 BLOCK "040904b0"
281 BEGIN
282 VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
283 VALUE "FileDescription", "Dipstick, mirror locator\0"
284 VALUE "FileVersion", "3, 0, 0, 0\0"
285 VALUE "InternalName", "DIPSTICK\0"
286 VALUE "LegalCopyright", "Copyright © 1996, 1997, 1998, 2002 Klever Group (http://www.klever.net/)\0"
287 VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
288 VALUE "OriginalFilename", "DIPSTICK.EXE\0"
289 VALUE "ProductName", "Dipstick\0"
290 VALUE "ProductVersion", "3, 0, 0, 0\0"
291 END
292 END
293 BLOCK "VarFileInfo"
294 BEGIN
295 VALUE "Translation", 0x409, 1200
296 END
297END
298
299#endif // !_MAC
300
301
302/////////////////////////////////////////////////////////////////////////////
303//
304// DESIGNINFO
305//
306
307#ifdef APSTUDIO_INVOKED
308GUIDELINES DESIGNINFO DISCARDABLE
309BEGIN
310 IDD_ABOUTBOX, DIALOG
311 BEGIN
312 LEFTMARGIN, 7
313 RIGHTMARGIN, 206
314 VERTGUIDE, 40
315 TOPMARGIN, 7
316 BOTTOMMARGIN, 54
317 END
318
319 IDD_DIPSTICK_DIALOG, DIALOG
320 BEGIN
321 VERTGUIDE, 8
322 VERTGUIDE, 411
323 HORZGUIDE, 8
324 HORZGUIDE, 144
325 END
326
327 IDD_OPTIONS, DIALOG
328 BEGIN
329 LEFTMARGIN, 7
330 RIGHTMARGIN, 172
331 VERTGUIDE, 16
332 VERTGUIDE, 50
333 TOPMARGIN, 7
334 BOTTOMMARGIN, 147
335 END
336
337 IDD_MANUALHOST, DIALOG
338 BEGIN
339 LEFTMARGIN, 7
340 RIGHTMARGIN, 180
341 TOPMARGIN, 7
342 BOTTOMMARGIN, 47
343 END
344
345 IDD_PROPS, DIALOG
346 BEGIN
347 LEFTMARGIN, 7
348 RIGHTMARGIN, 202
349 VERTGUIDE, 60
350 TOPMARGIN, 7
351 BOTTOMMARGIN, 92
352 END
353
354 IDD_AUTOBEST, DIALOG
355 BEGIN
356 LEFTMARGIN, 7
357 RIGHTMARGIN, 280
358 VERTGUIDE, 143
359 VERTGUIDE, 211
360 TOPMARGIN, 7
361 BOTTOMMARGIN, 75
362 HORZGUIDE, 25
363 HORZGUIDE, 44
364 END
365
366 IDD_URLS, DIALOG
367 BEGIN
368 LEFTMARGIN, 7
369 RIGHTMARGIN, 169
370 TOPMARGIN, 7
371 BOTTOMMARGIN, 185
372 END
373END
374#endif // APSTUDIO_INVOKED
375
376
377/////////////////////////////////////////////////////////////////////////////
378//
379// AVI
380//
381
382IDR_DNDAVI AVI DISCARDABLE "res\\kdnd.avi"
383IDR_DRAGAVI AVI DISCARDABLE "res\\kdragurl.avi"
384
385/////////////////////////////////////////////////////////////////////////////
386//
387// Menu
388//
389
390IDR_MENU MENU DISCARDABLE
391BEGIN
392 POPUP "Drag pad"
393 BEGIN
394 MENUITEM "&Manual Ping", ID_DRAGPAD_MANUALPING
395 MENUITEM "&Paste URL(s)", ID_DRAGPAD_PASTEURL
396 MENUITEM "Reping &All", ID_DRAGPAD_REPINGALL
397 MENUITEM "Remove A&ll", ID_DRAGPAD_REMOVEALL
398 MENUITEM SEPARATOR
399 MENUITEM "&Options", ID_DRAGPAD_OPTIONS
400 MENUITEM "&Show main window", ID_DRAGPAD_SHOWMAINWINDOW
401 POPUP "Ad&vanced"
402 BEGIN
403 MENUITEM "&Export List", ID_DRAGPAD_ADVANCED_EXPORTLIST
404
405 MENUITEM "&Import List", ID_DRAGPAD_ADVANCED_IMPORTLIST
406
407 END
408 MENUITEM SEPARATOR
409 MENUITEM "&Help", ID_DRAGPAD_HELP
410 MENUITEM "A&bout Dipstick", ID_DRAGPAD_ABOUT
411 MENUITEM "E&xit Dipstick", ID_DRAGPAD_EXIT
412 END
413 POPUP "Host List"
414 BEGIN
415 MENUITEM "&Reping", ID_HOSTLIST_REPING
416 MENUITEM "R&emove", ID_HOSTLIST_REMOVE
417 MENUITEM "Open URL", ID_HOSTLIST_OPENURL
418 MENUITEM "&Copy URL", ID_HOSTLIST_COPYURL
419 MENUITEM SEPARATOR
420 MENUITEM "Reping &All", ID_HOSTLIST_REPINGALL
421 MENUITEM "Remove A&ll", ID_HOSTLIST_REMOVEALL
422 MENUITEM SEPARATOR
423 MENUITEM "&Paste URL(s)", ID_HOSTLIST_PASTEURL
424 MENUITEM "&Properties", ID_HOSTLIST_PROPERTIES
425 END
426 POPUP "Advanced"
427 BEGIN
428 MENUITEM "&Export List", ID_ADVANCED_EXPORTLIST
429 MENUITEM "&Import List", ID_ADVANCED_IMPORTLIST
430 END
431END
432
433
434/////////////////////////////////////////////////////////////////////////////
435//
436// Bitmap
437//
438
439IDB_DIABACK BITMAP DISCARDABLE "shared-data/klever-background.bmp"
440
441/////////////////////////////////////////////////////////////////////////////
442//
443// WAVE
444//
445
446IDW_BESTURL WAVE DISCARDABLE "res\\best.wav"
447
448/////////////////////////////////////////////////////////////////////////////
449//
450// String Table
451//
452
453STRINGTABLE DISCARDABLE
454BEGIN
455 IDS_ABOUTBOX "&About Dipstick.."
456 IDS_PS_FAILEDTOLOCK "Failed to gain access to internal resources. Please, report to Klever."
457 IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed."
458 IDS_CSVEXT ".csv"
459 IDS_HN_BADURL "Bad URL"
460 IDS_ABEST_CLEANUP "Remove all locations from list?"
461 IDS_ABEST_NONEFOUND "No reachable locations were found."
462 IDS_ABEST_TITLE " Dipstick - report"
463 IDS_DRAGPAD_TITLE " Dipstick 3.00"
464 IDS_DRAGPAD_URLS " %d/%d URL(s)"
465 IDS_REGEX_HTMLURL "<A[^[:alpha:]][^>]*href[[:space:]]*=[[:space:]]*""?([^[:space:]>""]+)""?[^>]*>"
466END
467
468STRINGTABLE DISCARDABLE
469BEGIN
470 IDS_KLEVERNET_URL "http://www.klever.net/"
471 IDS_PS_INTERNALERROR "Internal Error. Please report to Klever."
472 IDS_PS_NETUNREACHABLE "Destination network unreachable"
473 IDS_PS_HOSTUNREACHABLE "Destination host unreachable"
474 IDS_PS_PROTUNREACHABLE "Destination protocol unreachable"
475 IDS_PS_PORTUNREACHABLE "Destination port unreachable"
476 IDS_PS_NORESOURCES "No resources"
477 IDS_PS_HWERROR "Hardware error"
478 IDS_PS_BIGPACKET "Packet size is too big"
479END
480
481STRINGTABLE DISCARDABLE
482BEGIN
483 IDC_DNDTARGET "Dipstick 3.00, click the right mouse button to display main window, left mouse button for menu"
484 IDC_HOST "Host name as specified or resolved by Dipstick"
485END
486
487STRINGTABLE DISCARDABLE
488BEGIN
489 IDC_URLCAPTION "Universal Resource Locator (URL) associated with this location"
490 IDC_URL "Universal Resource Locator (URL) associated with this location"
491 IDC_HOSTCAPTION "Host name as specified or resolved by Dipstick"
492 IDC_IPCAPTION "Host's IP address as specified or resolved by Dipstick"
493 IDC_TIMESCAPTION "Minmum, maximum and average round trip time in milliseconds. The less the better."
494 IDC_TIMES "Minmum, maximum and average round trip time in milliseconds. The less the better."
495 IDC_LOSSCAPTION "IP packets loss"
496 IDC_LOSS "IP packets loss"
497 IDC_STATUSCAPTION "Last error occured during attempt to ping this location"
498 IDC_STATUS "Last error occured during attempt to ping this location"
499 IDC_OPENURL "Open URL in your default browser"
500END
501
502STRINGTABLE DISCARDABLE
503BEGIN
504 IDS_PS_TIMEOUT "Request timed out"
505 IDS_PS_BADROUTE "Bad route"
506 IDS_PS_TTLEXPTRANSIT "TTL expired in transit"
507 IDS_PS_TTLEXPREASM "TTL expired during reassembly"
508 IDS_PS_IPARAMP "IP parameter problem"
509 IDS_PS_SOURCEQUENCH "Source quench received"
510 IDS_PS_BIGOPTION "Option is too big"
511 IDS_PS_BADDEST "Bad destination"
512 IDS_PS_UNKNOWNERROR "Unknown error"
513 IDS_REGISTRYKEY "Klever Group, Inc."
514 IDS_FMT_TIMES "%lu/%lu/%lu"
515 IDS_FMT_LOSS "%d%%"
516 IDS_TIP_UNREACHABLE "This location seems to be unreachable"
517 IDS_PS_FAILEDTORESOLVE "Unable to resolve host IP"
518END
519
520STRINGTABLE DISCARDABLE
521BEGIN
522 IDS_PS_UNABLETOICMP "Unable to initialize ICMP services"
523 IDS_TIP_PENDING "This location is waiting for it's turn to get pinged"
524 IDS_TIP_COMPLETE "Pinging of this location has been completed"
525 IDS_TIP_PROPSOK "Click OK if you're done with looking and want to dismiss this window"
526 IDS_TIP_INTERVAL "Interval between ping requests in seconds"
527 IDS_TIP_OPTIONSOK "Click OK to make changes permanent"
528 IDS_TIP_OPTIONSCANCEL "Click CANCEL to leave dialog without making any changes"
529 IDS_TIP_PINGING "This location is being pinged at the moment.."
530END
531
532STRINGTABLE DISCARDABLE
533BEGIN
534 IDC_MSWORKAROUND "In case of REDIRed URL - test the innermost one"
535END
536
537STRINGTABLE DISCARDABLE
538BEGIN
539 IDS_CSVFILTER "Comma Separated Values (*.csv)|*.csv|All Files (*.*)|*.*||"
540END
541
542#endif // English (U.S.) resources
543/////////////////////////////////////////////////////////////////////////////
544
545
546
547#ifndef APSTUDIO_INVOKED
548/////////////////////////////////////////////////////////////////////////////
549//
550// Generated from the TEXTINCLUDE 3 resource.
551//
552#define _AFX_NO_SPLITTER_RESOURCES
553#define _AFX_NO_OLE_RESOURCES
554#define _AFX_NO_TRACKER_RESOURCES
555#define _AFX_NO_PROPERTY_RESOURCES
556
557#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
558#ifdef _WIN32
559LANGUAGE 9, 1
560#pragma code_page(1252)
561#endif
562#include "res\Dipstick.rc2" // non-Microsoft Visual C++ edited resources
563#include "afxres.rc" // Standard components
564#endif
565/////////////////////////////////////////////////////////////////////////////
566#endif // not APSTUDIO_INVOKED
567
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 @@
1:Base DipStick.hlp>Standard
2:Title Dipstick
31 Dipstick
42 About Dipstick=About
52 Using Dipstick=Using
62 Main Window=MainWindow
72 Dipstick Options=Options
82 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 @@
1; This file is maintained by HCW. Do not modify this file directly.
2
3[OPTIONS]
4COMPRESS=12 Hall Zeck
5LCID=0x409 0x0 0x0 ;English (United States)
6REPORT=Yes
7CONTENTS=About
8TITLE=Dipstick
9CNT=dipstick.cnt
10HLP=DIPSTICK.HLP
11
12[FILES]
13dipstick.rtf
14
15[ALIAS]
16HIDD_ABOUTBOX=About
17HIDD_AUTOBEST=Autobest
18HIDD_DRAGPAD=Using
19HIDD_MANUALHOST=MainWindowMP
20HIDD_OPTIONS=Options
21HIDD_PROPS=Properties
22HIDD_DIPSTICK_DIALOG=MainWindow
23HIDD_URLS=SelectURLs
24
25[MAP]
26#include dipstick.hm
27
28[WINDOWS]
29Standard="",(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 @@
1{\rtf1\ansi
2@{\footnote
3THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.
4DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD
5}
6{\fonttbl{\f0\froman Times New Roman;}{\f1\fswiss Arial;}{\f3\froman Symbol;}}{\colortbl;
7 \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
8 \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
9 \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
10 \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
11
12\pard\plain\keepn
13#{\footnote About}
14${\footnote About Dipstick}
15K{\footnote about}
16{ \f1\fs18\b\sb120 About {\b Dipstick}}
17\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.
18\par\sa120\sb120\qj\pard \f1\fs18\sb120
19\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b {\i Enjoy!}}
20{
21\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/")}
22\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:
23\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
24\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.
25}
26\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")}
27\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}
28\page
29
30\pard\plain\keepn
31#{\footnote News}
32${\footnote What's new}
33{ \f1\fs18\b\sb120 What's New}
34\par\pard\plain\f1\fs24\qc\cf2\b 3.00 - August 19st, 2002
35\par\pard\plain\fi0\li0\f1\fs18 \bullet Change of {\uldb license}{\v About} and opening the source.
36\par\pard\plain\fi0\li0\f1\fs18 \bullet Minor cosmetic changes
37\par\pard\plain\f1\fs24\qc\cf2\b 2.52 - June 3rd, 1998
38\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.
39\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.
40\par\pard\plain\f1\fs24\qc\cf2\b 2.5 - December 30th, 1997
41\par\pard\plain\fi0\li0\f1\fs18 \bullet Ability to export/import sets of URLs.
42\par\pard\plain\fi0\li0\f1\fs18 \bullet Copy URL menu command in the Main Window and button in the Best URL window.
43\par\pard\plain\fi0\li0\f1\fs18 \bullet Multiple URLs dragging or pasting. Works only for MSIE4 browser.
44\par\pard\plain\fi0\li0\f1\fs18 \bullet Annoying ToolTips removed.
45\par\pard\plain\f1\fs24\qc\cf2\b 2.00 - July 1st, 1997
46\par\pard\plain\fi0\li0\f1\fs18 \bullet Drag'n'drop source added to the Best URL window.
47\par\pard\plain\fi0\li0\f1\fs18 \bullet Completed/Total URLs counter added to {\b Dipstick} drag pad.
48\par\pard\plain\fi0\li0\f1\fs18 \bullet You may now drag'n'drop URLs from main {\b Dipstick} dialog window.
49\par\pard\plain\fi0\li0\f1\fs18 \bullet Added ability to paste URLs into {\b Dipstick} instead of dropping.
50\par\pard\plain\fi0\li0\f1\fs18 \bullet New install program now lets you install {\b Dipstick} to the location of your choice.
51\par\pard\plain\f1\fs24\qc\cf2\b 1.01 - March 13th, 1997
52\par\pard\plain\fi0\li0\f1\fs18 \bullet Resizable main {\b Dipstick} dialog window.
53\par\pard\plain\fi0\li0\f1\fs18 \bullet Come up with the best URL automatically.
54\par\pard\plain\fi0\li0\f1\fs18 \bullet Workaround for redir.dll
55\par\pard\plain\fi0\li0\f1\fs18 \bullet No more {\b\cf6 MSIE} 3.0 requirement.
56\par\pard\plain\fi0\li0\f1\fs18 \bullet Remembers window positions and size as well as columns widths.
57\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)
58\page
59
60\pard\plain\keepn
61#{\footnote Using}
62${\footnote Using Dipstick}
63{ \f1\fs18\b\sb120 Using {\b Dipstick}}
64\par\sa120\sb120\qj\pard \f1\fs18\sb120 To use {\b Dipstick}, please follow these steps:\pard
65\par \fi0\li0 \bullet Load the page that contains links into your {\b\cf6 MSIE} or {\b\cf6 Netscape} browser.
66\par \fi0\li0 \bullet Drag'n'drop desired links to {\b Dipstick} window.
67\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.
68\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).
69\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
70\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.
71\page
72
73\pard\plain\keepn
74#{\footnote MainWindow}
75${\footnote Main Window}
76{ \f1\fs18\b\sb120 Main Window}
77\par\sa120\sb120\qj\pard \f1\fs18\sb120 The main window consists of -\pard
78\par \fi0\li0 \bullet {\b Brilliant ListView with the following columns:}
79\par \fi0\li0 \bullet Host Name - host name as it was specified in the URL or resolved from IP address.
80\par \fi0\li0 \bullet Host IP address - host IP address as it was specified in the URL or resolved from host name.
81\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.
82\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.
83\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.
84\par \fi0\li0 \bullet Pktloss - Percentage of the requests lost somewhere in the net. The less the better.
85\par \fi0\li0 \bullet {\b Buttons:}
86\par \fi0\li0 \bullet {#{\footnote MainWindowMP}}Manual Ping - lets you add location manually (usually you just drag'n'drop locations into {\b Dipstick} window.
87\par \fi0\li0 \bullet Reping - Test selected location again.
88\par \fi0\li0 \bullet {#{\footnote MainWindowRA}}Reping All - Test again all locations in the list.
89\par \fi0\li0 \bullet Remove - Remove selected location from the list.
90\par \fi0\li0 \bullet Remove All - Remove all locations from the list.
91\par \fi0\li0 \bullet Help - I think you have a clue on what this button does.
92\par \fi0\li0 \bullet Options - Set {\b Dipstick} options
93\par \fi0\li0 \bullet Exit Dipstick - Close {\b Dipstick} program\pard
94\page
95
96\pard\plain\keepn
97#{\footnote Options}
98${\footnote Dipstick Options}
99{ \f1\fs18\b\sb120 {\b Dipstick} Opions}
100\par\sa120\sb120\qj\pard \f1\fs18\sb120 Options are:\pard
101\par \fi0\li0 \bullet {#{\footnote OptionsPPH}}{\b Number of pings per host} - number of echo requests to send for each location.
102\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.
103\par \fi0\li0 \bullet {\b Ping Timeout} - number of seconds to wait between sending echo requests.
104\par \fi0\li0 \bullet {\b Interval between pings} - number of seconds to wait between sending echo requests.
105\par \fi0\li0 \bullet {\b Ping size} - number of bytes to send in each echo request.
106\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}
107\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
108\page
109
110\pard\plain\keepn
111#{\footnote Properties}
112${\footnote URL properties}
113{ \f1\fs18\b\sb120 URL Properties}
114\par\sa120\sb120\qj\pard \f1\fs18\sb120 URL Properties are:\pard
115\par \fi0\li0 \bullet {\b URL} - the URL itself if present.
116\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}.
117\par \fi0\li0 \bullet {\b Ping times} - minimum, average, and mmaximum round trip times if available.
118\par \fi0\li0 \bullet {\b Packet loss} - percentage of packets lost in transmission.
119\par \fi0\li0 \bullet {\b Status} - description of last error occured (if any).\pard
120\page
121
122\pard\plain\keepn
123#{\footnote SelectURLs}
124${\footnote Select URLs Dialog}
125{ \f1\fs18\b\sb120 Select URLs dialog}
126\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.
127\par\sa120\sb120\qj\pard \f1\fs18\sb120 There are two options you may want to change when selecting URLs from list:\pard
128\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.
129\par \fi0\li0 \bullet {\b Adjusst by innermost URL} - use the innermost URL when adjusting selection.\pard
130\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.
131\page
132
133\pard\plain\keepn
134#{\footnote Autobest}
135${\footnote Dipstick Report}
136{ \f1\fs18\b\sb120 {\b Dipstick} report}
137\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.
138\page
139} \ 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 @@
1<?xml version="1.0"?>
2<winhelp>
3 <topic id="About" title="About Dipstick" keywords="about">
4 <heading scroll="no">About <kin>Dipstick</kin></heading>
5 <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>
6 <p/>
7 <p><b><i>Enjoy!</i></b></p>
8 <license years="1996, 1997, 1998, 2002"/>
9 <credits/>
10 </topic>
11 <topic id="News" title="What's new">
12 <heading scroll="no">What's New</heading>
13 <newsfor version="3.00" date="August 19st, 2002">
14 <ni>Change of <a href="#About">license</a> and opening the source.</ni>
15 <ni>Minor cosmetic changes</ni>
16 </newsfor>
17 <newsfor version="2.52" date="June 3rd, 1998">
18 <ni>Now works properly with Winsock 2 for Windows95. Also may start working with non-Microsoft TCP/IP stacks.</ni>
19 <ni>Fixed bug that caused GPF when removing all URLs after testing is over and you picked the URL of your choice.</ni>
20 </newsfor>
21 <newsfor version="2.5" date="December 30th, 1997">
22 <ni>Ability to export/import sets of URLs.</ni>
23 <ni>Copy URL menu command in the Main Window and button in the Best URL window.</ni>
24 <ni>Multiple URLs dragging or pasting. Works only for MSIE4 browser.</ni>
25 <ni>Annoying ToolTips removed.</ni>
26 </newsfor>
27 <newsfor version="2.00" date="July 1st, 1997">
28 <ni>Drag'n'drop source added to the Best URL window.</ni>
29 <ni>Completed/Total URLs counter added to <kin>Dipstick</kin> drag pad.</ni>
30 <ni>You may now drag'n'drop URLs from main <kin>Dipstick</kin> dialog window.</ni>
31 <ni>Added ability to paste URLs into <kin>Dipstick</kin> instead of dropping.</ni>
32 <ni>New install program now lets you install <kin>Dipstick</kin> to the location of your choice.</ni>
33 </newsfor>
34 <newsfor version="1.01" date="March 13th, 1997">
35 <ni>Resizable main <kin>Dipstick</kin> dialog window.</ni>
36 <ni>Come up with the best URL automatically.</ni>
37 <ni>Workaround for redir.dll</ni>
38 <ni>No more <product>MSIE</product> 3.0 requirement.</ni>
39 <ni>Remembers window positions and size as well as columns widths.</ni>
40 <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>
41 </newsfor>
42 </topic>
43 <topic id="Using" title="Using Dipstick">
44 <heading scroll="no">Using <kin>Dipstick</kin></heading>
45 <p>To use <kin>Dipstick</kin>, please follow these steps:</p>
46 <ul>
47 <li>Load the page that contains links into your <product>MSIE</product> or <product>Netscape</product> browser.</li>
48 <li>Drag'n'drop desired links to <kin>Dipstick</kin> window.</li>
49 <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>
50 <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>
51 <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>
52 </ul>
53 <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>
54 </topic>
55 <topic id="MainWindow" title="Main Window">
56 <heading scroll="no">Main Window</heading>
57 <p>The main window consists of -</p>
58 <ul>
59 <li><b>Brilliant ListView with the following columns:</b></li>
60 <li>Host Name - host name as it was specified in the URL or resolved from IP address.</li>
61 <li>Host IP address - host IP address as it was specified in the URL or resolved from host name.</li>
62 <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>
63 <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>
64 <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>
65 <li>Pktloss - Percentage of the requests lost somewhere in the net. The less the better.</li>
66 <li><b>Buttons:</b></li>
67 <li><a name="MainWindowMP"/>Manual Ping - lets you add location manually (usually you just drag'n'drop locations into <kin>Dipstick</kin> window.</li>
68 <li>Reping - Test selected location again.</li>
69 <li><a name="MainWindowRA"/>Reping All - Test again all locations in the list.</li>
70 <li>Remove - Remove selected location from the list.</li>
71 <li>Remove All - Remove all locations from the list.</li>
72 <li>Help - I think you have a clue on what this button does.</li>
73 <li>Options - Set <kin>Dipstick</kin> options</li>
74 <li>Exit Dipstick - Close <kin>Dipstick</kin> program</li>
75 </ul>
76 </topic>
77 <topic id="Options" title="Dipstick Options">
78 <heading scroll="no"><kin>Dipstick</kin> Opions</heading>
79 <p>Options are:</p>
80 <ul>
81 <li><a name="OptionsPPH"/><b>Number of pings per host</b> - number of echo requests to send for each location.</li>
82 <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>
83 <li><b>Ping Timeout</b> - number of seconds to wait between sending echo requests.</li>
84 <li><b>Interval between pings</b> - number of seconds to wait between sending echo requests.</li>
85 <li><b>Ping size</b> - number of bytes to send in each echo request.</li>
86 <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>
87 <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>
88 </ul>
89 </topic>
90 <topic id="Properties" title="URL properties">
91 <heading scroll="no">URL Properties</heading>
92 <p>URL Properties are:</p>
93 <ul>
94 <li><b>URL</b> - the URL itself if present.</li>
95 <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>
96 <li><b>Ping times</b> - minimum, average, and mmaximum round trip times if available.</li>
97 <li><b>Packet loss</b> - percentage of packets lost in transmission.</li>
98 <li><b>Status</b> - description of last error occured (if any).</li>
99 </ul>
100 </topic>
101 <topic id="SelectURLs" title="Select URLs Dialog">
102 <heading scroll="no">Select URLs dialog</heading>
103 <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>
104 <p>There are two options you may want to change when selecting URLs from list:</p>
105 <ul>
106 <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>
107 <li><b>Adjusst by innermost URL</b> - use the innermost URL when adjusting selection.</li>
108 </ul>
109 <p>The default values for these options are also available from the <a href="#Options"><b>Options</b></a> dialog box.</p>
110 </topic>
111 <topic id="Autobest" title="Dipstick Report">
112 <heading scroll="no"><kin>Dipstick</kin> report</heading>
113 <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>
114 </topic>
115</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 @@
1 #ifdefSTATI_K
2dipstick.ex_ rcdata discardable "../releast/dipstick.ex_"
3#else
4dipstick.ex_ rcdata discardable "../release/dipstick.ex_"
5#endif
6dipstick.cn_ rcdata discardable "../release/dipstick.cn_"
7dipstick.hl_ rcdata discardable "../release/dipstick.hl_"
8#ifdef K_ANNED
9mfc42.dl_ rcdata discardable "../redist/mfc42.dl_"
10#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 @@
1#include "resource.h"
2#include "../shared-code/install.h"
3
4#define KINNAME "Dipstick"
5#define KINSHORT KINNAME
6#define VERSION "3.00"
7
8BOOL Install(void)
9{
10STRING dPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",KINSHORT "Path");
11STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath");
12LPCSTR qPath = ((LPCSTR)dPath)?(LPCSTR)dPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings");
13STRING path = REQUESTPATH(" " KINNAME " " VERSION,"\nEnter destination path:",qPath);
14 if(!path)
15 return NULL;
16
17 #ifdefK_ANNED
18STRING sysDir(_MAX_PATH);
19 GetSystemDirectory(sysDir,_MAX_PATH);
20 INSTALLFILE("mfc42.dl_",sysDir,"mfc42.dll");
21#endif
22
23 MAKE_PATH(path);
24STRING shortPath = GET_SHORT_PATH(path);
25 if(!shortPath){
26 MessageBox(NULL,"Failed to install " KINNAME " " VERSION " in specified directory",NULL,MB_ICONERROR|MB_OK);
27 return FALSE;
28 }
29
30 if(!(
31 INSTALLFILE("dipstick.ex_",path,"dipstick.exe") &&
32 INSTALLFILE("dipstick.hl_",path,"dipstick.hlp") &&
33 INSTALLFILE("dipstick.cn_",path,"dipstick.cnt")
34 )){
35 MessageBox(NULL,"Failed to install " KINNAME " " VERSION " in specified directory",NULL,MB_ICONERROR|MB_OK);
36 return FALSE;
37 }
38 ADDMENU("Accessories\\Klever Co.",KINNAME,path,"dipstick.exe");
39
40 strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",KINSHORT "Path",path);
41 strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath",path);
42
43FILE* inf=CREATE_INF_FILE(path,KINSHORT ".INF");
44 if(!inf){
45 MessageBox(NULL,"Failed to install " KINNAME " " VERSION,NULL,MB_ICONERROR|MB_OK);
46 return FALSE;
47 }
48 INF_FILE_HEADER(inf);
49 INF_FILE_SECTION(inf,"Uninstall");
50 fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n");
51 INF_FILE_SECTION(inf,"kFiles");
52 INF_REMOVE_ROOT(inf,KINSHORT "Files",path);
53 INF_REMOVE_FILE(inf,KINSHORT "Files","dipstick.exe");
54 INF_REMOVE_HELP_FILE(inf,KINSHORT "Files","dipstick");
55 INF_REMOVE_FILE(inf,KINSHORT "Files",KINSHORT ".INF");
56 INF_FILE_SECTION(inf,"kReg");
57 INF_UNINSTALL_REG(inf,KINSHORT);
58 INF_FILE_SECTION(inf,"kMenu");
59 INF_MENU_GROUP(inf,1,"Accessories\\Klever Co.");
60 INF_MENU_ITEM(inf,1,KINNAME);
61 fclose(inf);
62
63 REG_UNINSTALL_COMMAND(KINSHORT,"Klever " KINNAME " " VERSION,shortPath,KINSHORT ".INF","Uninstall");
64
65 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);
66
67 return TRUE;
68}
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 @@
1//Microsoft Developer Studio generated resource script.
2//
3#include "resource.h"
4
5#define APSTUDIO_READONLY_SYMBOLS
6/////////////////////////////////////////////////////////////////////////////
7//
8// Generated from the TEXTINCLUDE 2 resource.
9//
10#include "afxres.h"
11
12/////////////////////////////////////////////////////////////////////////////
13#undef APSTUDIO_READONLY_SYMBOLS
14
15/////////////////////////////////////////////////////////////////////////////
16// English (U.S.) resources
17
18#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19#ifdef _WIN32
20LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21#pragma code_page(1252)
22#endif //_WIN32
23
24/////////////////////////////////////////////////////////////////////////////
25//
26// Dialog
27//
28
29#if defined(APSTUDIO_INVOKED) || defined(FALSE)
30#if defined(APSTUDIO_INVOKED)
31IDD_INSTALLING$(FALSE) DIALOGEX 0, 0, 200, 74
32#else
33IDD_INSTALLING DIALOGEX 0, 0, 200, 74
34#endif
35STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP
36FONT 8, "MS Sans Serif", 0, 0, 0x1
37BEGIN
38 PUSHBUTTON "Cancel",IDCANCEL,143,53,50,14,BS_CENTER | BS_VCENTER |
39 BS_NOTIFY | BS_FLAT,WS_EX_DLGMODALFRAME
40 CONTROL "Animate1",IDC_DISKS,"SysAnimate32",ACS_TRANSPARENT |
41 ACS_AUTOPLAY | WS_TABSTOP,161,7,32,32
42 LTEXT "",IDC_STATE,7,7,150,32,SS_NOPREFIX | SS_NOTIFY
43 CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,45,
44 186,7,WS_EX_DLGMODALFRAME
45END
46#endif
47
48IDD_PATH DIALOGEX 0, 0, 255, 73
49STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
50 WS_VISIBLE | WS_CAPTION
51EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
52FONT 8, "MS Sans Serif", 0, 0, 0x1
53BEGIN
54 LTEXT "",IDC_PROMPT,7,7,241,30
55 EDITTEXT IDC_PATH,7,37,195,12,ES_AUTOHSCROLL
56 PUSHBUTTON "B&rowse..",IDC_BROWSE,208,37,40,12
57 DEFPUSHBUTTON "OK",IDOK,69,52,50,14
58 PUSHBUTTON "Cancel",IDCANCEL,135,52,50,14
59END
60
61
62/////////////////////////////////////////////////////////////////////////////
63//
64// DESIGNINFO
65//
66
67#ifdef APSTUDIO_INVOKED
68GUIDELINES DESIGNINFO DISCARDABLE
69BEGIN
70 "IDD_INSTALLING$(FALSE)", DIALOG
71 BEGIN
72 LEFTMARGIN, 7
73 RIGHTMARGIN, 193
74 TOPMARGIN, 7
75 BOTTOMMARGIN, 67
76 HORZGUIDE, 39
77 END
78
79 IDD_PATH, DIALOG
80 BEGIN
81 LEFTMARGIN, 7
82 RIGHTMARGIN, 248
83 VERTGUIDE, 202
84 VERTGUIDE, 208
85 TOPMARGIN, 7
86 BOTTOMMARGIN, 66
87 HORZGUIDE, 37
88 END
89END
90#endif // APSTUDIO_INVOKED
91
92
93#ifdef APSTUDIO_INVOKED
94/////////////////////////////////////////////////////////////////////////////
95//
96// TEXTINCLUDE
97//
98
991 TEXTINCLUDE DISCARDABLE
100BEGIN
101 "resource.h\0"
102END
103
1042 TEXTINCLUDE DISCARDABLE
105BEGIN
106 "#include ""afxres.h""\r\n"
107 "\0"
108END
109
1103 TEXTINCLUDE DISCARDABLE
111BEGIN
112 "#include ""custom.rch""\0"
113END
114
115#endif // APSTUDIO_INVOKED
116
117
118/////////////////////////////////////////////////////////////////////////////
119//
120// Icon
121//
122
123// Icon with lowest ID value placed first to ensure application icon
124// remains consistent on all systems.
125IDI_ICON ICON DISCARDABLE "../shared-data/install-icon.ico"
126
127#ifndef _MAC
128/////////////////////////////////////////////////////////////////////////////
129//
130// Version
131//
132
133VS_VERSION_INFO VERSIONINFO
134 FILEVERSION 3,0,0,0
135 PRODUCTVERSION 3,0,0,0
136 FILEFLAGSMASK 0x3fL
137#ifdef _DEBUG
138 FILEFLAGS 0x1L
139#else
140 FILEFLAGS 0x0L
141#endif
142 FILEOS 0x40004L
143 FILETYPE 0x1L
144 FILESUBTYPE 0x0L
145BEGIN
146 BLOCK "StringFileInfo"
147 BEGIN
148 BLOCK "040904b0"
149 BEGIN
150 VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
151 VALUE "FileDescription", "INSTALL: Dipstick, mirror locator\0"
152 VALUE "FileVersion", "3, 0, 0, 0\0"
153 VALUE "InternalName", "INSTALL\0"
154 VALUE "LegalCopyright", "Copyright © 1996, 1997, 1998, 2002 Klever Group (http://www.klever.net/)\0"
155 VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
156 VALUE "OriginalFilename", "INSTALL.EXE\0"
157 VALUE "ProductName", "Dipstick\0"
158 VALUE "ProductVersion", "3, 0, 0, 0\0"
159 END
160 END
161 BLOCK "VarFileInfo"
162 BEGIN
163 VALUE "Translation", 0x409, 1200
164 END
165END
166
167#endif // !_MAC
168
169#endif // English (U.S.) resources
170/////////////////////////////////////////////////////////////////////////////
171
172
173
174#ifndef APSTUDIO_INVOKED
175/////////////////////////////////////////////////////////////////////////////
176//
177// Generated from the TEXTINCLUDE 3 resource.
178//
179#include "custom.rch"
180/////////////////////////////////////////////////////////////////////////////
181#endif // not APSTUDIO_INVOKED
182
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 @@
1//{{NO_DEPENDENCIES}}
2// Microsoft Developer Studio generated include file.
3// Used by Install.rc
4//
5#define IDD_INSTALLING 101
6#define IDD_PATH 102
7#define IDI_ICON 105
8#define IDC_DISKS 1000
9#define IDC_STATE 1001
10#define IDC_PROGRESS 1002
11#define IDC_PROMPT 1003
12#define IDC_PATH 1004
13#define IDC_BROWSE 1005
14
15// Next default values for new objects
16//
17#ifdef APSTUDIO_INVOKED
18#ifndef APSTUDIO_READONLY_SYMBOLS
19#define _APS_NEXT_RESOURCE_VALUE 107
20#define _APS_NEXT_COMMAND_VALUE 40001
21#define _APS_NEXT_CONTROL_VALUE 1006
22#define _APS_NEXT_SYMED_VALUE 101
23#endif
24#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 @@
1@echo off
2REM -- First make map file from Microsoft Visual C++ generated resource.h
3echo // MAKEHELP.BAT generated Help Map file. Used by DIPSTICK.HPJ. >"help\dipstick.hm"
4echo. >>"help\dipstick.hm"
5REM echo // Commands (ID_* and IDM_*) >>"help\dipstick.hm"
6REM makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h >>"help\dipstick.hm"
7REM echo. >>"help\dipstick.hm"
8REM echo // Prompts (IDP_*) >>"help\dipstick.hm"
9REM makehm IDP_,HIDP_,0x30000 resource.h >>"help\dipstick.hm"
10REM echo. >>"help\dipstick.hm"
11REM echo // Resources (IDR_*) >>"help\dipstick.hm"
12REM makehm IDR_,HIDR_,0x20000 resource.h >>"help\dipstick.hm"
13REM echo. >>"help\dipstick.hm"
14echo // Dialogs (IDD_*) >>"help\dipstick.hm"
15makehm IDD_,HIDD_,0x20000 resource.h >>"help\dipstick.hm"
16echo. >>"help\dipstick.hm"
17REM echo // Frame Controls (IDW_*) >>"help\dipstick.hm"
18REM makehm IDW_,HIDW_,0x50000 resource.h >>"help\dipstick.hm"
19makehm IDH_,IDH_,0 resource.h >>"help\dipstick.hm"
20REM -- Make help for Project DIPSTICK
21
22echo Building RTF file
23xsltproc -o help/dipstick.rtf shared-code/kinhelp.xsl help/dipstick.xml
24echo Building Win32 Help files
25start /wait hcrtf -x "help\dipstick.hpj"
26echo.
27if exist Debug\nul copy "help\dipstick.hlp" Debug
28if exist Debug\nul copy "help\dipstick.cnt" Debug
29if exist Release\nul copy "help\dipstick.hlp" Release
30if exist Release\nul copy "help\dipstick.cnt" Release
31if exist Releast\nul copy "help\dipstick.hlp" Releast
32if exist Releast\nul copy "help\dipstick.cnt" Releast
33echo.
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 @@
1//
2// DIPSTICK.RC2 - resources Microsoft Visual C++ does not edit directly
3//
4
5#ifdef APSTUDIO_INVOKED
6 #error this file is not editable by Microsoft Visual C++
7#endif //APSTUDIO_INVOKED
8
9
10/////////////////////////////////////////////////////////////////////////////
11// Add manually edited resources here...
12
13/////////////////////////////////////////////////////////////////////////////
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 @@
1//{{NO_DEPENDENCIES}}
2// Microsoft Developer Studio generated include file.
3// Used by Dipstick.rc
4//
5#define IDM_ABOUTBOX 0x0010
6#define IDD_ABOUTBOX 100
7#define IDS_ABOUTBOX 101
8#define IDD_DIPSTICK_DIALOG 102
9#define IDS_REGEX_NESTEDURL 102
10#define IDS_PS_FAILEDTOLOCK 102
11#define IDP_SOCKETS_INIT_FAILED 103
12#define IDS_REGEX_CRACKHOST 104
13#define IDS_CSVEXT 104
14#define IDS_HN_BADURL 105
15#define IDS_ABEST_CLEANUP 106
16#define IDS_ABEST_NONEFOUND 107
17#define IDS_ABEST_TITLE 108
18#define IDS_DRAGPAD_TITLE 109
19#define IDS_DRAGPAD_URLS 110
20#define IDS_REGEX_HTMLURL 111
21#define IDS_CSVFILTER 112
22#define IDR_MAINFRAME 128
23#define IDD_DRAGPAD 129
24#define IDR_DNDAVI 130
25#define IDD_OPTIONS 132
26#define IDR_MENU 133
27#define IDD_MANUALHOST 134
28#define IDD_PROPS 135
29#define IDI_PINGING 136
30#define IDI_PENDING 137
31#define IDI_COMPLETED 138
32#define IDI_UNREACHABLE 139
33#define IDB_DIABACK 140
34#define IDD_AUTOBEST 141
35#define IDW_BESTURL 142
36#define IDR_DRAGAVI 143
37#define IDD_URLS 145
38#define IDC_HOSTLIST 1002
39#define IDC_DNDTARGET 1011
40#define IDC_OPTIONS 1013
41#define IDC_NPINGS 1014
42#define IDC_PACKETSIZE 1015
43#define IDC_TIMEOUT 1016
44#define IDC_INTERVAL 1017
45#define IDC_KLEVERNET 1017
46#define IDC_MAXPINGS 1018
47#define IDC_MANUALPING 1019
48#define IDC_HOST 1020
49#define IDC_REPING 1021
50#define IDC_IP 1021
51#define IDC_REPINGALL 1022
52#define IDC_CLEAR 1023
53#define IDC_EXIT 1024
54#define IDC_REMOVE 1025
55#define IDC_URLCAPTION 1026
56#define IDC_URL 1027
57#define IDC_HOSTCAPTION 1028
58#define IDC_IPCAPTION 1029
59#define IDC_TIMESCAPTION 1030
60#define IDC_TIMES 1031
61#define IDC_LOSSCAPTION 1032
62#define IDC_LOSS 1033
63#define IDC_STATUSCAPTION 1034
64#define IDC_STATUS 1035
65#define IDC_OPENURL 1036
66#define IDC_STATE 1039
67#define IDC_MSWORKAROUND 1048
68#define IDC_SPINPINGS 1049
69#define IDC_SPINMAXPINGS 1050
70#define IDC_SPINTIMEOUT 1051
71#define IDC_RTT 1051
72#define IDC_SPINTERVAL 1052
73#define IDC_PKTLOSS 1052
74#define IDC_SPINSIZE 1053
75#define IDC_PREV 1053
76#define IDC_AUTOBEST 1054
77#define IDC_NEXT 1054
78#define IDC_SMARTADJUST 1055
79#define IDC_DROPSOURCE 1056
80#define IDC_URLS 1057
81#define IDC_DOADJUST 1058
82#define IDC_ADJUSTINN 1059
83#define IDC_IGNORELA 1060
84#define IDC_COPYURL 1060
85#define IDC_ADVANCED 1061
86#define IDS_KLEVERNET_URL 2102
87#define IDS_PS_INTERNALERROR 2104
88#define IDS_PS_NETUNREACHABLE 2105
89#define IDS_PS_HOSTUNREACHABLE 2106
90#define IDS_PS_PROTUNREACHABLE 2107
91#define IDS_PS_PORTUNREACHABLE 2108
92#define IDS_PS_NORESOURCES 2109
93#define IDS_PS_HWERROR 2110
94#define IDS_PS_BIGPACKET 2111
95#define IDS_PS_TIMEOUT 2112
96#define IDS_PS_BADROUTE 2113
97#define IDS_PS_TTLEXPTRANSIT 2114
98#define IDS_PS_TTLEXPREASM 2115
99#define IDS_PS_IPARAMP 2116
100#define IDS_PS_SOURCEQUENCH 2117
101#define IDS_PS_BIGOPTION 2118
102#define IDS_PS_BADDEST 2119
103#define IDS_PS_UNKNOWNERROR 2120
104#define IDS_REGISTRYKEY 2121
105#define IDS_FMT_TIMES 2122
106#define IDS_FMT_LOSS 2123
107#define IDS_TIP_UNREACHABLE 2124
108#define IDS_PS_FAILEDTORESOLVE 2127
109#define IDS_PS_UNABLETOICMP 2128
110#define IDS_TIP_PENDING 2130
111#define IDS_TIP_COMPLETE 2131
112#define IDS_TIP_PROPSOK 2132
113#define IDS_TIP_INTERVAL 2133
114#define IDS_TIP_OPTIONSOK 2134
115#define IDS_TIP_OPTIONSCANCEL 2135
116#define IDS_TIP_PINGING 2136
117#define ID_DRAGPAD_EXIT 32771
118#define ID_DRAGPAD_SHOWMAINWINDOW 32772
119#define ID_DRAGPAD_OPTIONS 32773
120#define ID_DRAGPAD_ABOUT 32774
121#define ID_DRAGPAD_MANUALPING 32775
122#define ID_HOSTLIST_REPING 32776
123#define ID_HOSTLIST_REMOVE 32777
124#define ID_HOSTLIST_REPINGALL 32778
125#define ID_HOSTLIST_REMOVEALL 32779
126#define ID_HOSTLIST_OPENURL 32780
127#define ID_HOSTLIST_PROPERTIES 32781
128#define ID_DRAGPAD_HELP 32782
129#define ID_DRAGPAD_REPINGALL 32783
130#define ID_DRAGPAD_REMOVEALL 32784
131#define ID_DRAGPAD_PASTEURL 32785
132#define ID_HOSTLIST_PASTEURL 32786
133#define ID_HOSTLIST_COPYURL 32787
134#define ID_ADVANCED_EXPORTLIST 32788
135#define ID_ADVANCED_IMPORTLIST 32789
136#define ID_DRAGPAD_ADVANCED_EXPORTLIST 32790
137#define ID_DRAGPAD_ADVANCED_IMPORTLIST 32791
138
139// Next default values for new objects
140//
141#ifdef APSTUDIO_INVOKED
142#ifndef APSTUDIO_READONLY_SYMBOLS
143#define _APS_3D_CONTROLS 1
144#define _APS_NEXT_RESOURCE_VALUE 147
145#define _APS_NEXT_COMMAND_VALUE 32792
146#define _APS_NEXT_CONTROL_VALUE 1062
147#define _APS_NEXT_SYMED_VALUE 107
148#endif
149#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 @@
1 #ifndef__BTREENDEX_H
2 #define__BTREENDEX_H
3
4#include "Dynamide.h"
5
6namespace Klever {
7
8template<class key,class value,int treeOrder,int cluster>
9 class CBTreendex : public CObject{
10public:
11 typedef LONG CBTPageRef;
12 struct CBTRecordRef {
13 CBTPageRef m_Page;
14 INT m_Offset;
15 CBTRecordRef(CBTPageRef page=-1,INT offset=-1) : m_Page(page), m_Offset(offset) {}
16 };
17 class CBTRecord : public CObject {
18 public:
19 CBTPageRef m_ptrLeft;
20 CBTPageRef m_ptrRight;
21 key m_Key;
22 value m_Value;
23 CBTRecord() : m_ptrLeft(-1), m_ptrRight(-1) {}
24 CBTRecord(key& _key,value& _value,CBTPageRef left=-1,CBTPageRef right=-1) : m_Key(_key), m_Value(_value), m_ptrLeft(left), m_ptrRight(right) {}
25 CBTRecord(CBTRecord& r) : m_Key(r.m_Key), m_Value(r.m_Value), m_ptrLeft(r.m_ptrLeft), m_ptrRight(r.m_ptrRight) {}
26
27 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;}
28
29 void Serialize(CArchive& ar) {
30 if(ar.IsStoring()){
31 ar << m_ptrLeft;
32 ar << m_ptrRight;
33 }else{
34 ar >> m_ptrLeft;
35 ar >> m_ptrRight;
36 }
37 SerializeElements(ar,&m_Key,1);
38 SerializeElements(ar,&m_Value,1);
39 }
40 };
41 class CBTPage : public CArray<CBTRecord,CBTRecord&> {
42 public:
43 void Serialize(CArchive& ar) {
44 int nCount = -1;
45 if(ar.IsStoring()){
46 nCount = GetSize();
47 ar << nCount;
48 }else{
49 nCount = 0;
50 ar >> nCount;
51 RemoveAll();
52 SetSize(nCount);
53 }
54 for(int tmp=0;tmp<nCount;tmp++)
55 ElementAt(tmp).Serialize(ar);
56 }
57 };
58 typedef CDynamide<256,cluster> CBTDyna;
59 typedef CBTDyna::CDynaFile CBTDynaFile;
60 typedef CArray<CBTRecordRef,CBTRecordRef&> CBTRStack;
61
62 CBTDyna m_BT;
63 struct_btCrap {
64 BOOL m_bRootSet;
65 CBTPageRef m_Root;
66 } *m_BTCrap;
67 BOOL m_bRO;
68 CBTRStack m_btStack;
69 CBTPage m_stackTop;
70
71 CBTreendex() {}
72 ~CBTreendex() { Close(); }
73 BOOL Attach(CFile* file,BOOL bAutodelete) {
74 m_bRO = FALSE;
75 if(!m_BT.Attach(file,bAutodelete))
76 return FALSE;
77 return Attach();
78 }
79 BOOL Open(LPCTSTR file,BOOL bReadOnly) {
80 if(!m_BT.Open(file,bReadOnly))
81 return FALSE;
82 m_bRO = bReadOnly;
83 return Attach();
84 }
85 BOOL Create(LPCTSTR file) {
86 try{
87 CFile* f = new CFile(file,CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead|CFile::shareDenyWrite|CFile::typeBinary);
88 ASSERT(f);
89 return Attach(f,TRUE);
90 }catch(CException* e){
91 e->Delete();
92 return FALSE;
93 }
94 }
95 BOOL Attach() {
96 ASSERT(m_BT.IsOpened());
97 m_BTCrap = (_btCrap*)m_BT.m_FB.crap;
98 if(!m_BTCrap->m_bRootSet){
99 m_BTCrap->m_Root = AllocatePage();
100 if(m_BTCrap->m_Root<0)
101 return FALSE;
102 m_BTCrap->m_bRootSet = TRUE;
103 m_BT.Write1stBlock();
104 }
105 return TRUE;
106 }
107 BOOL Close() {
108 m_BT.Close();
109 return TRUE;
110 }
111 BOOL IsOpened() {
112 return m_BT.IsOpened();
113 }
114
115 BOOL Lookup(key& _key,value& value) {
116 if(!IsOpened())
117 return FALSE;
118 ASSERT(m_BTCrap->m_bRootSet);
119 if(!SeekToPage(_key))
120 return FALSE;
121 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
122 if(rr.m_Offset<0)
123 return FALSE;
124 ASSERT(rr.m_Offset<m_stackTop.GetSize());
125 if(_key != m_stackTop[rr.m_Offset].m_Key)
126 return FALSE;
127 value = m_stackTop[rr.m_Offset].m_Value;
128 return TRUE;
129 }
130 BOOL Add(key& _key,value& _value) {
131 if(!IsOpened())
132 return FALSE;
133 ASSERT(m_BTCrap->m_bRootSet);
134 if(!SeekToPage(_key))
135 return FALSE;
136 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
137 CBTRecord nuRecord(_key,_value);
138 if(rr.m_Offset<0){
139 if(m_stackTop.GetSize())
140 nuRecord.m_ptrLeft = m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight;
141 }else if(rr.m_Offset==0){
142 nuRecord.m_ptrRight = m_stackTop[0].m_ptrLeft;
143 }else{
144 nuRecord.m_ptrLeft = m_stackTop[rr.m_Offset-1].m_ptrRight;
145 nuRecord.m_ptrRight = m_stackTop[rr.m_Offset].m_ptrLeft;
146 }
147 // ASSERT(rr.m_Offset==0 || (m_stackTop[rr.m_Offset-1].m_Key<_key && m_stackTop[rr.m_Offset-1].m_ptrRight<0));
148 // ASSERT(rr.m_Offset<0 || m_stackTop[rr.m_Offset].m_Key>=_key && m_stackTop[rr.m_Offset].m_ptrLeft<0);
149 if(rr.m_Offset>=0 && m_stackTop[rr.m_Offset].m_Key==_key){
150 // Exact match found - just replace.
151 m_stackTop[rr.m_Offset].m_Value = _value;
152 if(!SavePage(rr.m_Page,m_stackTop))
153 return FALSE;
154 return TRUE;
155 }
156 // Split the page and propagate the split if needed..
157 // Insert new element at rr.m_Offset..
158 BOOL nuisnew = TRUE;
159 for(int sp=m_btStack.GetUpperBound();sp>=0;sp--){
160 CBTPageRef opr = m_btStack[sp].m_Page;
161 int iAt = m_btStack[sp].m_Offset;
162 CBTPage op;
163 VERIFY(LoadPage(opr,op));
164 if(iAt<0)
165 iAt = op.GetSize();
166 else{
167 if(op[iAt].m_Key<nuRecord.m_Key)
168 iAt++;
169 ASSERT(iAt==op.GetSize() || op[iAt].m_Key > nuRecord.m_Key);
170 }
171 op.InsertAt(iAt,nuRecord);
172 if(iAt>0)
173 op[iAt-1].m_ptrRight=nuRecord.m_ptrLeft;
174 if(iAt<op.GetUpperBound())
175 op[iAt+1].m_ptrLeft=nuRecord.m_ptrRight;
176 if(op.GetSize()<=treeOrder*2){
177 // This isn't causing overflow
178 VERIFY(SavePage(opr,op));
179 return TRUE;
180 }
181 TRACE0("Split\n");
182 ASSERT(op.GetSize()==(treeOrder*2+1));
183 CBTPageRef npr = AllocatePage();
184 ASSERT(npr>=0);
185 CBTPage np;
186 ASSERT(LoadPage(npr,np));
187 ASSERT(!np.GetSize());
188 nuRecord = op[treeOrder];
189 if(iAt==treeOrder){
190 // We're inserting central element! - drop out the stack top if this is still new one
191 for(int tmp=0;tmp<treeOrder;tmp++)
192 np.InsertAt(tmp,op[tmp]);
193 op.RemoveAt(0,treeOrder+1);
194 nuRecord.m_ptrLeft = npr;
195 nuRecord.m_ptrRight = opr;
196 if(nuisnew)
197 m_btStack.RemoveAt(m_btStack.GetUpperBound());
198 }else{
199 if(iAt<treeOrder){
200 // We're inserting in the left subtree.
201 // Make newpage the right one and forget it.
202 for(int tmp=0;tmp<treeOrder;tmp++)
203 np.InsertAt(tmp,op[tmp+treeOrder+1]);
204 op.RemoveAt(treeOrder,treeOrder+1);
205 nuRecord.m_ptrLeft = opr;
206 nuRecord.m_ptrRight = npr;
207 }else{
208 // We're inserting in the right subtree.
209 // Make newpage the left one, forget it, but also adjust offset in the stack
210 for(int tmp=0;tmp<treeOrder;tmp++)
211 np.InsertAt(tmp,op[tmp]);
212 op.RemoveAt(0,treeOrder+1);
213 nuRecord.m_ptrLeft = npr;
214 nuRecord.m_ptrRight = opr;
215 m_btStack[sp].m_Offset-=treeOrder+1;
216 }
217 // Note that we're not inserting new element anymore.
218 nuisnew = FALSE;
219 }
220 // Do, excessive sanity checks and save pages
221 ASSERT(op.GetSize());
222 ASSERT(np.GetSize());
223 VERIFY(SavePage(opr,op));
224 VERIFY(SavePage(npr,np));
225 }
226 // Here we have root page overflow, which means that we're simply putting new
227 // record in this brand new root page and also inserting this page on the bottom of the stack
228 CBTPageRef nuroot = AllocatePage();
229 ASSERT(nuroot>=0);
230 CBTPage nurpa;
231 ASSERT(LoadPage(nuroot,nurpa));
232 ASSERT(!nurpa.GetSize());
233 nurpa.Add(nuRecord);
234 VERIFY(SavePage(nuroot,nurpa));
235 m_btStack.InsertAt(0,CBTRecordRef(nuroot,0));
236 m_BTCrap->m_Root = nuroot;
237 m_BT.Write1stBlock();
238 return TRUE;
239 }
240 BOOL Delete(key& _key) {
241 if(!IsOpened())
242 return FALSE;
243 ASSERT(m_BTCrap->m_bRootSet);
244 value _value;
245 if(!Lookup(_key,_value))
246 return FALSE;
247 // Found key, check if it's a leaf
248 {
249 CBTRecordRef* rr = &m_btStack[m_btStack.GetUpperBound()];
250 int rrIdx = m_btStack.GetUpperBound();
251 if(m_stackTop[rr->m_Offset].m_ptrLeft>=0){
252 ASSERT(m_stackTop[rr->m_Offset].m_ptrRight>=0);
253 // It isn't - scan for the _next_ key and do dirty deeds
254 m_btStack.Add(CBTRecordRef(m_stackTop[rr->m_Offset].m_ptrRight,0));
255 for(;;){
256 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
257 if(!LoadPage(rr.m_Page,m_stackTop))
258 return FALSE;
259 if(m_stackTop[0].m_ptrLeft<0)
260 break;
261 m_btStack.Add(CBTRecordRef(m_stackTop[0].m_ptrLeft,0));
262 }
263 // We have a leaf node here, replace victim with the first element and kill it.
264 CBTPage uppage;
265 rr = &m_btStack[rrIdx];
266 if(!LoadPage(rr->m_Page,uppage))
267 return FALSE;
268 uppage[rr->m_Offset].m_Key=m_stackTop[0].m_Key; uppage[rr->m_Offset].m_Value=m_stackTop[0].m_Value;
269 m_stackTop.RemoveAt(0);
270 if(!(SavePage(rr->m_Page,uppage) && SavePage(m_btStack[m_btStack.GetUpperBound()].m_Page,m_stackTop)))
271 return FALSE;
272 }else{
273 ASSERT(m_stackTop[rr->m_Offset].m_ptrRight<0);
274 m_stackTop.RemoveAt(rr->m_Offset);
275 if(!SavePage(rr->m_Page,m_stackTop))
276 return FALSE;
277 }
278 }
279 // We have a page to check for underflow at the top of the stack now.
280 for(;;){
281 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
282 if(!LoadPage(rr.m_Page,m_stackTop))
283 return FALSE;
284 if(m_stackTop.GetSize()>=treeOrder || m_btStack.GetSize()==1)
285 return TRUE;
286 CBTRecordRef& rr1 = m_btStack[m_btStack.GetUpperBound()-1];
287 CBTPage daddy;
288 if(!LoadPage(rr1.m_Page,daddy))
289 return FALSE;
290 CBTPageRef nPage = daddy[rr1.m_Offset].m_ptrRight;
291 BOOL bRight=TRUE;
292 if(nPage<0 || nPage==rr.m_Page){
293 nPage = daddy[rr1.m_Offset].m_ptrLeft;
294 bRight = FALSE;
295 }
296 ASSERT(nPage>=0 && nPage!=rr.m_Page);
297 CBTPage neighbor;
298 if(!LoadPage(nPage,neighbor))
299 return FALSE;
300 // Here we have possibly two cases:
301 // 1. Neighboring page can share some data with use, then do share and leave
302 // 2. Neighboring page is of treeorder in size, then merge and propagate
303 if(neighbor.GetSize()>treeOrder){
304 TRACE0("Redistributing..\n");
305 // Borrow some data from there.
306 int toBorrow = neighbor.GetSize()-treeOrder;
307 toBorrow=toBorrow/2+1;
308 ASSERT(toBorrow);
309 if(bRight)
310 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));
311 else
312 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));
313 for(toBorrow--;toBorrow;toBorrow--){
314 if(bRight){
315 m_stackTop.Add(neighbor[0]);
316 neighbor.RemoveAt(0);
317 }else{
318 m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]);
319 neighbor.RemoveAt(neighbor.GetUpperBound());
320 }
321 }
322 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;
323 neighbor.RemoveAt(bRight?0:neighbor.GetUpperBound());
324 if(!(SavePage(rr1.m_Page,daddy) && SavePage(nPage,neighbor) && SavePage(rr.m_Page,m_stackTop)))
325 return FALSE;
326 rr.m_Offset = -1;// *** Point to the next??
327 return TRUE;
328 }
329 TRACE0("Merging..\n");
330 // We need to merge pages here..
331 // We will merge them at stacktop, then we'll discard neighbor guy..
332 if(bRight)
333 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));
334 else
335 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));
336 if(bRight){
337 while(neighbor.GetSize()){
338 m_stackTop.Add(neighbor[0]);
339 neighbor.RemoveAt(0);
340 }
341 }else{
342 while(neighbor.GetSize()){
343 m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]);
344 neighbor.RemoveAt(neighbor.GetUpperBound());
345 }
346 }
347 if(rr1.m_Offset>0)
348 daddy[rr1.m_Offset-1].m_ptrRight=rr.m_Page;
349 if(rr1.m_Offset<daddy.GetUpperBound())
350 daddy[rr1.m_Offset+1].m_ptrLeft=rr.m_Page;
351 daddy.RemoveAt(rr1.m_Offset);
352 if(!(SavePage(rr1.m_Page,daddy) && SavePage(rr.m_Page,m_stackTop)))
353 return FALSE;
354 VERIFY(DeallocatePage(nPage));
355 m_btStack.RemoveAt(m_btStack.GetUpperBound());
356 }
357 return FALSE;
358 }
359 BOOL GoFirst() {
360 if(!IsOpened())
361 return FALSE;
362 ASSERT(m_BTCrap->m_bRootSet);
363 m_btStack.RemoveAll();
364 m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
365 for(;;){
366 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
367 if(!LoadPage(rr.m_Page,m_stackTop))
368 return FALSE;
369 if(!m_stackTop.GetSize()){
370 ASSERT(m_btStack.GetSize()==1);
371 return FALSE;
372 }
373 rr.m_Offset = 0;
374 if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
375 return TRUE;
376 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
377 }
378 }
379 BOOL GoLast() {
380 if(!IsOpened())
381 return FALSE;
382 ASSERT(m_BTCrap->m_bRootSet);
383 m_btStack.RemoveAll();
384 m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
385 for(;;){
386 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
387 if(!LoadPage(rr.m_Page,m_stackTop))
388 return FALSE;
389 if(!m_stackTop.GetSize()){
390 ASSERT(m_btStack.GetSize()==1);
391 return FALSE;
392 }
393 rr.m_Offset = m_stackTop.GetUpperBound();
394 if(m_stackTop[rr.m_Offset].m_ptrRight<0)
395 return TRUE;
396 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1));
397 }
398 }
399 BOOL GoNext() {
400 if(!IsOpened())
401 return FALSE;
402 if(!(m_btStack.GetSize() && m_btStack[m_btStack.GetUpperBound()].m_Offset>=0))
403 return FALSE;
404 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
405 if(!LoadPage(rr.m_Page,m_stackTop))
406 return FALSE;
407 ASSERT(rr.m_Offset<m_stackTop.GetSize());
408 if(m_stackTop[rr.m_Offset].m_ptrRight>=0){
409 // Advance pointer in this page and dive into subtree
410 // going left and left until we have nowhere to go.
411 // TRACE1("Dive into page %lu",m_stackTop[rr.m_Offset].m_ptrRight);
412 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,0));
413 for(;;){
414 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
415 ASSERT(rr.m_Offset==0);
416 if(!LoadPage(rr.m_Page,m_stackTop))
417 return FALSE;
418 if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
419 break;
420 // TRACE1(", %lu",m_stackTop[rr.m_Offset].m_ptrLeft);
421 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,0));
422 }
423 // TRACE0("\n");
424 return TRUE;
425 }else if(rr.m_Offset<m_stackTop.GetUpperBound()){
426 rr.m_Offset++;
427 return TRUE;
428 }
429 // We're at the end of page go up until we're done or we have data.
430 m_btStack.RemoveAt(m_btStack.GetUpperBound());
431 // TRACE0("Go up");
432 while(m_btStack.GetSize()){
433 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
434 if(!LoadPage(rr.m_Page,m_stackTop))
435 return FALSE;
436 if(rr.m_Offset<m_stackTop.GetSize()){
437 // TRACE0("\n");
438 return TRUE;
439 }
440 // TRACE0(", up");
441 m_btStack.RemoveAt(m_btStack.GetUpperBound());
442 }
443 // TRACE0("\nBtree is done\n");
444 return FALSE;
445 }
446 BOOL GoPrev() {
447 if(!IsOpened())
448 return FALSE;
449 if(!(m_btStack.GetSize() && m_btStack[m_btStack.GetUpperBound()].m_Offset>=0))
450 return FALSE;
451 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
452 if(!LoadPage(rr.m_Page,m_stackTop))
453 return FALSE;
454 ASSERT(rr.m_Offset<m_stackTop.GetSize());
455 if(m_stackTop[rr.m_Offset].m_ptrLeft>=0){
456 // Dive in and go right and right from the rightmost until
457 // we have nowhere to go.
458 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
459 for(;;){
460 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
461 if(!LoadPage(rr.m_Page,m_stackTop))
462 return FALSE;
463 rr.m_Offset = m_stackTop.GetUpperBound();
464 if(m_stackTop[rr.m_Offset].m_ptrRight<0)
465 return TRUE;
466 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1));
467 }
468 return TRUE;
469 }else if(rr.m_Offset>0){
470 rr.m_Offset--;
471 return TRUE;
472 }
473 // We're at the leftmost element in page - go up and left until we're
474 // done or we have data.
475 m_btStack.RemoveAt(m_btStack.GetUpperBound());
476 while(m_btStack.GetSize()){
477 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
478 if(!LoadPage(rr.m_Page,m_stackTop))
479 return FALSE;
480 rr.m_Offset--;
481 if(rr.m_Offset>=0)
482 return TRUE;
483 m_btStack.RemoveAt(m_btStack.GetUpperBound());
484 }
485 // No more data - we were at the first element in tree.
486 return FALSE;
487 }
488 BOOL GetThis(key& _key,value& _value) {
489 if(!IsOpened())
490 return FALSE;
491 // *** MORE CHECKING
492 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
493 if(!LoadPage(rr.m_Page,m_stackTop))
494 return FALSE;
495 _key = m_stackTop[rr.m_Offset].m_Key;
496 _value = m_stackTop[rr.m_Offset].m_Value;
497 return TRUE;
498 }
499
500 BOOL SeekToPage(const key& _key) {
501 ASSERT(IsOpened());
502 ASSERT(m_BTCrap->m_bRootSet);
503 m_btStack.RemoveAll();
504 m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
505 for(;;){
506 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
507 if(!LoadPage(rr.m_Page,m_stackTop))
508 return FALSE;
509 ASSERT(m_stackTop.GetSize() || !m_btStack.GetUpperBound());
510 if(!m_stackTop.GetSize()){
511 rr.m_Offset=-1;
512 return TRUE;
513 }
514 for(rr.m_Offset=0;rr.m_Offset<m_stackTop.GetSize();rr.m_Offset++){
515 if(_key == m_stackTop[rr.m_Offset].m_Key)
516 return TRUE;
517 if(_key < m_stackTop[rr.m_Offset].m_Key){
518 ASSERT(rr.m_Offset==0 || m_stackTop[rr.m_Offset].m_ptrLeft==m_stackTop[rr.m_Offset-1].m_ptrRight);
519 if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
520 return TRUE;
521 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
522 break;
523 }
524 if(rr.m_Offset==m_stackTop.GetUpperBound()){
525 if(m_stackTop[rr.m_Offset].m_ptrRight<0){
526 rr.m_Offset=-1;
527 return TRUE;
528 }
529 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrRight,-1));
530 break;
531 }
532 }
533 }
534 }
535
536 BOOL LoadPage(CBTPageRef ref,CBTPage& page) {
537 CFile* pageFile = m_BT.OpenFile(ref);
538 if(!pageFile)
539 return FALSE;
540 BOOL rv = TRUE;
541 try{
542 CArchive ar(pageFile,CArchive::load);
543 page.Serialize(ar);
544 if(m_bRO)
545 page.FreeExtra();// ** ???
546 ar.Close();
547 }catch(CException* e){
548 e->Delete();
549 rv = FALSE;
550 }
551 delete pageFile;
552 return rv;
553 }
554 BOOL SavePage(CBTPageRef ref,CBTPage& page) {
555 CFile* pageFile = m_BT.OpenFile(ref);
556 if(!pageFile)
557 return FALSE;
558 BOOL rv = TRUE;
559 try{
560 CArchive ar(pageFile,CArchive::store);
561 page.Serialize(ar);
562 ar.Close();
563 }catch(CException* e){
564 e->Delete();
565 rv = FALSE;
566 }
567 delete pageFile;
568 return rv;
569 }
570 CBTPageRef AllocatePage() {
571 CBTDynaFile* pageFile = m_BT.CreateFile();
572 if(!pageFile)
573 return -1;
574 CBTPage nothing;
575 CBTPageRef rv = pageFile->GetFile();
576 try{
577 CArchive ar(pageFile,CArchive::store);
578 nothing.Serialize(ar);
579 ar.Close();
580 }catch(CException* e){
581 e->Delete();
582 rv = -1;
583 }
584 delete pageFile;
585 return rv;
586 }
587 BOOL DeallocatePage(CBTPageRef ref) {
588 return m_BT.DeleteFile(ref);
589 }
590
591};
592
593};
594
595 #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 @@
1 #ifndef__BELLSNWHISTLES_H
2#define __BELLSNWHISTLES_H
3
4 class CBellsNWhistles{
5public:
6 class CBang {
7 public:
8 CString m_codeName;
9 enum_bangType {
10 bangNone, bangSpeaker, bangSystem, bangResource,
11 bangWaveform
12 }m_type;
13 BOOL m_bLoop;
14 union{
15 UINT system;
16 LPCTSTR resource;
17 LPCTSTR wave;
18
19 LPCTSTR str;
20 UINT id;
21 };
22 CString m_strWave;
23 CBang() : m_type(bangNone), m_bLoop(FALSE) {}
24 };
25 typedef CTypedPtrMap<CMapStringToPtr,CString,CBang*> CBangs;
26 structCBelling {
27 LPCSTR snd;
28 HMODULE hm;
29 DWORD flags;
30 CBelling(LPCSTR snd,HMODULE hm,DWORD flags) : snd(snd), hm(hm),
31 flags(flags) {}
32 CBelling(CBelling& s) : snd(s.snd), hm(s.hm), flags(s.flags) {}
33 CBelling& operator=(CBelling& s) {
34 snd=s.snd; hm=s.hm; flags=s.flags;
35 return *this;
36 }
37 };
38 typedef CBelling* Whistling;
39
40 CBangs m_bangs;
41
42 ~CBellsNWhistles() {
43 POSITION p = m_bangs.GetStartPosition();
44 while(p){
45 CString s; CBang* b;
46 m_bangs.GetNextAssoc(p,s,b);
47 delete b;
48 }
49 m_bangs.RemoveAll();
50 }
51
52 BOOL AssignSound(LPCTSTR codeName,LPCTSTR id,CBang::_bangType type=CBang::bangWaveform) {
53 CString cn = codeName;
54 cn.MakeLower();
55 CBang* b;
56 if(!m_bangs.Lookup(cn,b)) {
57 b = new CBang;
58 b->m_codeName=cn;
59 m_bangs[cn]=b;
60 }
61 b->m_type=type;
62 b->str = id;
63 if(type==CBang::bangWaveform){
64 b->m_strWave=id; b->str = b->m_strWave;
65 }
66 return TRUE;
67 }
68 BOOL AssignSound(LPCTSTR codeName,UINT nID,CBang::_bangType type=CBang::bangResource) {
69 CString cn = codeName;
70 cn.MakeLower();
71 CBang* b;
72 if(!m_bangs.Lookup(cn,b)) {
73 b = new CBang;
74 b->m_codeName=cn;
75 m_bangs[cn]=b;
76 }
77 b->m_type=type;
78 b->id = nID;
79 ASSERT(type!=CBang::bangWaveform);
80 return TRUE;
81 }
82 BOOL UnassignSound(LPCTSTR codeName) {
83 CString cn = codeName;
84 cn.MakeLower();
85 CBang* b;
86 if(m_bangs.Lookup(cn,b)) {
87 m_bangs.RemoveKey(cn);
88 delete b;
89 return TRUE;
90 }
91 return FALSE;
92 }
93
94 Whistling StartSound(LPCTSTR codeName) {
95 Whistling* rv = NULL;
96 CString cn = codeName;
97 CBang* b;
98 if(!m_bangs.Lookup(cn,b)){
99 ::PlaySound(cn,AfxGetInstanceHandle(),SND_ASYNC|SND_NODEFAULT|SND_NOWAIT|SND_FILENAME);
100 return NULL;
101 }
102 UINT flags = SND_ASYNC|SND_NODEFAULT|SND_NOWAIT;
103 LPCSTR snd = NULL;
104 switch(b->m_type){
105 case CBang::bangNone: return NULL;
106 case CBang::bangSpeaker: MessageBeep(0xFFFFFFFF); return NULL;
107 case CBang::bangSystem: MessageBeep(b->system); return NULL;
108 case CBang::bangResource:
109 snd = b->resource;
110 flags|=SND_RESOURCE; break;
111 case CBang::bangWaveform:
112 snd = b->wave;
113 flags|=SND_FILENAME; break;
114#ifdef _DEBUG
115 default:
116 ASSERT(FALSE); return NULL;
117#endif
118 }
119 if(b->m_bLoop)
120 flags|=SND_LOOP;
121 HMODULE hm = AfxGetInstanceHandle();
122 if(!::PlaySound(snd,hm,flags))
123 return NULL;
124 return b->m_bLoop?new CBelling(snd,hm,flags):NULL;
125 }
126 BOOL StopSound(Whistling whistle) {
127 if(!whistle)
128 return FALSE;
129 ::PlaySound(whistle->snd,whistle->hm,whistle->flags|SND_PURGE);
130 delete whistle;
131 return TRUE;
132 }
133 UINT FillInCombo(CComboBox* combo) {
134 POSITION p = m_bangs.GetStartPosition();
135 UINT rv = 0;
136 while(p) {
137 CString s;
138 CBang* b;
139 m_bangs.GetNextAssoc(p,s,b);
140 combo->AddString(s);
141 }
142 return rv;
143 }
144};
145
146 #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 @@
1 #ifndef__BITSET_H
2#define __BITSET_H
3
4namespace Klever {
5
6 class CBitSet: public CObject {
7public:
8 CWordArray m_Bits;
9 ULONG m_BitsInSet;
10 enum{
11 bitsPerWord = sizeof(WORD)*8
12 };
13
14 CBitSet(ULONG size = 0) : m_BitsInSet(0) { SetSize(size); }
15 CBitSet(CBitSet& o) : m_BitsInSet(0) { CopyFrom(o); }
16
17 void SetSize(ULONG size,BOOL bFillOnes=FALSE) {
18 UINT os = m_Bits.GetSize();
19 UINT ns = (size+bitsPerWord-1)/bitsPerWord;
20 if(os==ns){
21 if(os){
22 if(bFillOnes)
23 m_Bits[m_BitsInSet/bitsPerWord]|=(~(WORD)0)<<(m_BitsInSet%bitsPerWord);
24 else
25 m_Bits[m_BitsInSet/bitsPerWord]&=~((~(WORD)0)<<(m_BitsInSet%bitsPerWord));
26 }
27 m_BitsInSet=size;
28 }else{
29 // *?* ASSERT((!os) || (((os-1)*bitsPerWord)<=m_BitsInSet && m_BitsInSet<(os*bitsPerWord)));
30 if(os<ns){
31 m_Bits.SetSize(ns);
32 if(bFillOnes)
33 m_Bits[m_BitsInSet/bitsPerWord]|=(~(WORD)0)<<(m_BitsInSet%bitsPerWord);
34 else
35 m_Bits[m_BitsInSet/bitsPerWord]&=~((~(WORD)0)<<(m_BitsInSet%bitsPerWord));
36 WORD* ws = m_Bits.GetData();
37 ASSERT(ws);
38 memset(&ws[os],bFillOnes?0xFF:0,(ns-os)*sizeof(WORD));
39 m_BitsInSet=size;
40 }else{
41 m_Bits.SetSize(ns);
42 m_BitsInSet=size;
43 }
44 }
45 }
46 BOOL BitSet(UINT bit,BOOL bGrow=TRUE) { return SetBit(bit,TRUE,bGrow); }
47 BOOL BitClear(UINT bit,BOOL bGrow=TRUE) { return SetBit(bit,FALSE,bGrow); }
48 BOOL SetBit(UINT bit,BOOL state,BOOL bGrow=TRUE) {
49 if(m_BitsInSet<=bit){
50 if(!bGrow)
51 return FALSE;
52 SetSize(bit+1);
53 }
54 WORD mask = ((WORD)1)<<(bit%bitsPerWord);
55 if(state)
56 m_Bits[bit/bitsPerWord]|=mask;
57 else
58 m_Bits[bit/bitsPerWord]&=~mask;
59 return TRUE;
60 }
61 BOOL IsSet(UINT bit) {
62 if(m_BitsInSet<=bit)
63 return FALSE;
64 return (m_Bits[bit/bitsPerWord]&(((WORD)1)<<(bit%bitsPerWord)))!=0;
65 }
66 void Invert() {
67 for(int i=m_Bits.GetUpperBound();i>=0;i--)
68 m_Bits[i]=~m_Bits[i];
69 }
70 CBitSet& operator&=(CBitSet& o) {
71 if(o.m_BitsInSet<m_BitsInSet)
72 SetSize(o.m_BitsInSet);
73 for(int i=m_Bits.GetUpperBound();i>=0;i--)
74 m_Bits[i]&=o.m_Bits[i];
75 return *this;
76 }
77 CBitSet& operator|=(CBitSet& o) {
78 if(o.m_BitsInSet>m_BitsInSet)
79 SetSize(o.m_BitsInSet);
80 for(int i=o.m_Bits.GetUpperBound();i>=0;i--)
81 m_Bits[i]|=o.m_Bits[i];
82 return *this;
83 }
84 CBitSet& operator=(CBitSet& o) {
85 CopyFrom(o);
86 return *this;
87 }
88 void CopyFrom(CBitSet& o) {
89 m_BitsInSet=o.m_BitsInSet;
90 m_Bits.Copy(o.m_Bits);
91 }
92 void Serialize(CArchive& ar) {
93 if(ar.IsStoring()){
94 ar << m_BitsInSet;
95 m_Bits.Serialize(ar);
96 }else{
97 ar >> m_BitsInSet;
98 m_Bits.Serialize(ar);
99 }
100 }
101};
102
103};
104
105#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 @@
1#ifndef __DYNAMIDE_H
2#define __DYNAMIDE_H
3
4#include "LRUCache.h"
5
6namespace Klever {
7
8template<int fbSize,int bSize>
9class CDynamide : public CObject {
10 structfirstBlock {
11 LONGfreeFile;
12 BYTEcrap[fbSize-sizeof(LONG)];
13 };
14 structtheBlock {
15 LONGnext;
16 BYTEdata[bSize-sizeof(LONG)];
17 };
18public:
19 static firstBlock FirstBlock;
20 static theBlock TheBlock;
21private:
22 classCDynaCache : public CLRUCache<DWORD,DWORD,theBlock> {
23 public:
24 CFile* m_File;
25 BOOL m_bAutodelete;
26 CDynaCache(CFile* file,BOOL bAutodelete=TRUE) : CLRUCache<DWORD,DWORD,theBlock>(64) {
27 m_File=file;
28 m_bAutodelete=bAutodelete;
29 }
30 virtual ~CDynaCache() {
31 Flush();
32 if(m_bAutodelete){
33 m_File->Close();
34 delete m_File;
35 }
36 }
37 virtual BOOL _ReadIn(DWORD idx,theBlock* data) {
38 LONG p = sizeof(firstBlock)+idx*sizeof(theBlock);
39 LONG s = m_File->Seek(p,CFile::begin);
40 if(p==s){
41 UINT rb = m_File->Read(data,sizeof(*data));
42 if(rb==sizeof(*data))
43 return TRUE;
44 if(rb)
45 return FALSE;
46 memset(data,0,sizeof(*data));
47 data->next=-1;
48 try{
49 m_File->Write(data,sizeof(*data));
50 }catch(CException* e){
51 e->Delete();
52 return FALSE;
53 }
54 }else{
55 LONG togo = p-s;
56 ASSERT(togo>0);
57 ASSERT(!(togo%sizeof(theBlock)));
58 memset(data,0,sizeof(*data));
59 data->next=-1;
60 while(togo>=0){
61 try{
62 m_File->Write(data,sizeof(*data));
63 }catch(CException* e){
64 e->Delete();
65 return FALSE;
66 }
67 }
68 }
69 return TRUE;
70 }
71 virtual BOOL _WriteOut(DWORD idx,theBlock* data) {
72 LONG p = sizeof(firstBlock)+idx*sizeof(theBlock);
73 LONG s = m_File->Seek(p,CFile::begin);
74 if(p!=s)
75 return FALSE;
76 try{
77 m_File->Write(data,sizeof(*data));
78 }catch(CException* e){
79 e->Delete();
80 return FALSE;
81 }
82 return TRUE;
83 }
84 DWORD AllocateNode() {
85 LONG l = m_File->GetLength();
86 ASSERT(!((l-sizeof(firstBlock))%sizeof(theBlock)));
87 m_File->SetLength(l+sizeof(theBlock));
88 return (l-sizeof(firstBlock))/sizeof(theBlock);
89 }
90 BOOL Read1stBlock(firstBlock* fb) {
91 m_File->SeekToBegin();
92 UINT rb = m_File->Read(fb,sizeof(*fb));
93 if(rb==sizeof(*fb))
94 return TRUE;
95 if(rb)
96 return FALSE;
97 memset(fb,0,sizeof(*fb));
98 fb->freeFile = -1;
99 try{
100 m_File->Write(fb,sizeof(*fb));
101 }catch(CException* e){
102 e->Delete();
103 return FALSE;
104 }
105 return TRUE;
106 }
107 BOOL Write1stBlock(firstBlock* fb) {
108 m_File->SeekToBegin();
109 try{
110 m_File->Write(fb,sizeof(*fb));
111 }catch(CException* e){
112 e->Delete();
113 return FALSE;
114 }
115 return TRUE;
116 }
117 };
118public:
119 class CDynaFile : public CFile{
120 public:
121 CDynamide<fbSize,bSize>* m_Daddy;
122 CArray<LONG,LONG> m_Blocks;
123 LONG m_Position;
124
125 CDynaFile(CDynamide<fbSize,bSize>* daddy) : m_Daddy(NULL) { AttachToDaddy(daddy); }
126 virtual ~CDynaFile() { Close(); DetachFromDaddy(); }
127
128 void AttachToDaddy(CDynamide<fbSize,bSize>* daddy) {
129 ASSERT(!m_Daddy);
130 ASSERT(daddy);
131 m_Daddy=daddy;
132 m_Daddy->AttachDynaFile(this);
133 }
134 void DetachFromDaddy() {
135 ASSERT(m_Daddy);
136 ASSERT(!IsOpened());
137 m_Daddy->DetachDynaFile(this);
138 m_Daddy=NULL;
139 }
140
141 BOOL Create() {
142 if(IsOpened())
143 return FALSE;
144 m_Blocks.SetAtGrow(0,m_Daddy->Allocate());
145 ASSERT(m_Blocks[0]>=0);
146 m_Position=0;
147 return TRUE;
148 }
149 BOOL Open(LONG fb) {
150 if(IsOpened())
151 return FALSE;
152 ASSERT(fb>=0);
153 theBlock* b;
154 do{
155 m_Blocks.Add(fb);
156 b = m_Daddy->m_File->GetCached(fb);
157 ASSERT(b);
158 fb=b->next;
159 if(m_Blocks[m_Blocks.GetUpperBound()]==fb)
160 return FALSE;
161 }while(fb>=0);
162 m_Position=0;
163 return TRUE;
164 }
165
166 LONG GetFile() {
167 if(!IsOpened())
168 return -1;
169 return m_Blocks[0];
170 }
171 virtual DWORD GetPosition() const {
172 if(!IsOpened())
173 return 0;
174 if(m_Position<0)
175 return 0;
176 if(m_Position>GetLength())
177 return GetLength();
178 return m_Position;
179 }
180 virtual CString GetFileName() {
181 CString rv;
182 if(IsOpened())
183 rv.Format("0x%08lX",m_Blocks[0]);
184 else
185 rv.Format("None");
186 return rv;
187 }
188 virtual CString GetFileTitle() { return GetFileName(); }
189 virtual CString GetFilePath() { return GetFileName(); }
190 virtual void SetFilePath(LPCTSTR lpszNewName) { ASSERT(FALSE); }
191
192 virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL) { ASSERT(FALSE); return FALSE; }
193 virtual CFile* Duplicate() { ASSERT(FALSE); return NULL; }
194
195 virtual LONG Seek(LONG lOff, UINT nFrom) {
196 if(!IsOpened())
197 return -1;
198 switch(nFrom){
199 case CFile::begin:
200 m_Position=lOff;
201 break;
202 case CFile::current:
203 m_Position+=lOff;
204 break;
205 case CFile::end:
206 m_Position=GetLength()+lOff;
207 break;
208 default:
209 ASSERT(FALSE);
210 return -1;
211 }
212 if(m_Position<0)
213 m_Position=0;
214 if(m_Position>GetLength())
215 m_Position=GetLength();
216 return m_Position;
217 }
218 virtual void SetLength(DWORD dwNewLen) {
219 if(!IsOpened())
220 return;
221 if(dwNewLen<GetLength()){
222 dwNewLen=dwNewLen+sizeof(TheBlock.data);
223 dwNewLen-=dwNewLen%sizeof(TheBlock.data);
224 while(dwNewLen<GetLength() && m_Blocks.GetSize()>1){
225 LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
226 LONG mb1 = m_Blocks[m_Blocks.GetUpperBound()-1];
227 theBlock* b = m_Daddy->m_File->GetCached(mb1);
228 ASSERT(b);
229 ASSERT(b->next==mb);
230 b->next=-1;
231 m_Daddy->m_File->MakeDirty(mb1);
232 m_Daddy->Deallocate(mb);
233 m_Blocks.SetSize(m_Blocks.GetSize()-1);
234 }
235 }else{
236 while(dwNewLen>GetLength()){
237 LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
238 LONG newBlock = m_Daddy->Allocate();
239 ASSERT(newBlock>=0);
240 theBlock* b = m_Daddy->m_File->GetCached(mb);
241 ASSERT(b);
242 ASSERT(b->next<0);
243 b->next=newBlock;
244 m_Daddy->m_File->MakeDirty(mb);
245 m_Blocks.Add(newBlock);
246 }
247 }
248 }
249 virtual DWORD GetLength() const {
250 return ((long)m_Blocks.GetSize())*((long)sizeof(TheBlock.data));
251 }
252
253 virtual UINT Read(void* lpBuf, UINT nCount) {
254 UINT rv = 0;
255 ASSERT(m_Position>=0 && m_Position<=GetLength());
256 LPBYTE data = (LPBYTE)lpBuf;
257 while(nCount && m_Position<GetLength()){
258 UINT bn = m_Position/sizeof(TheBlock.data);
259 UINT bo = m_Position%sizeof(TheBlock.data);
260 theBlock* b = m_Daddy->m_File->GetCached(m_Blocks[bn]);
261 ASSERT(b);
262 UINT bc = min(nCount,sizeof(TheBlock.data)-bo);
263 memmove(data,&b->data[bo],bc);
264 nCount-=bc;
265 data=&data[bc];
266 rv+=bc;
267 m_Position+=bc;
268 }
269 return rv;
270 }
271 virtual void Write(const void* lpBuf, UINT nCount) {
272 ASSERT(m_Position>=0 && m_Position<=GetLength());
273 LPBYTE data = (LPBYTE)lpBuf;
274 while(nCount){
275 UINT bn = m_Position/sizeof(TheBlock.data);
276 UINT bo = m_Position%sizeof(TheBlock.data);
277 while(bn>=m_Blocks.GetSize()){
278 LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
279 LONG newBlock = m_Daddy->Allocate();
280 ASSERT(newBlock>=0);
281 theBlock* b = m_Daddy->m_File->GetCached(mb);
282 ASSERT(b);
283 ASSERT(b->next<0);
284 b->next=newBlock;
285 m_Daddy->m_File->MakeDirty(mb);
286 m_Blocks.Add(newBlock);
287 }
288 theBlock* b = m_Daddy->m_File->GetCached(m_Blocks[bn]);
289 ASSERT(b);
290 UINT bc = min(nCount,sizeof(TheBlock.data)-bo);
291 memmove(&b->data[bo],data,bc);
292 m_Daddy->m_File->MakeDirty(m_Blocks[bn]);
293 nCount-=bc;
294 data=&data[bc];
295 m_Position+=bc;
296 }
297 }
298
299 virtual void LockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); }
300 virtual void UnlockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); }
301
302 virtual void Abort() { ASSERT(FALSE); }
303 virtual void Flush() {
304 m_Daddy->m_File->Flush();
305 }
306 virtual void Close() {
307 m_Blocks.RemoveAll();
308 }
309
310 BOOL IsOpened() const { return m_Blocks.GetSize()!=0; }
311 };
312
313 CDynaCache* m_File;
314 firstBlock m_FB;
315
316 CDynamide() : m_File(NULL) {}
317 ~CDynamide() { Close(); }
318
319 BOOL AttachDynaFile(CDynaFile* f) {
320 //ASSERT(!m_Files.Find(f));
321 //m_Files.AddHead(f);
322 return TRUE;
323 }
324 BOOL DetachDynaFile(CDynaFile* f) {
325 //POSITION p = m_Files.Find(f);
326 //ASSERT(p);
327 //m_Files.RemoveAt(p);
328 return TRUE;
329 }
330
331 BOOL Open(LPCTSTR file,BOOL bRO=FALSE) {
332 Close();
333 try{
334 CFile* f = new CFile(file,CFile::typeBinary|(bRO?CFile::modeRead|CFile::shareDenyWrite:CFile::modeReadWrite|CFile::shareDenyRead));
335 return Attach(f,TRUE);
336 }catch(CException* e){
337 e->Delete();
338 return FALSE;
339 }
340 }
341 BOOL Create(LPCTSTR file) {
342 Close();
343 try{
344 CFile* f = new CFile(file,CFile::typeBinary|CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead);
345 return Attach(f,TRUE);
346 }catch(CException* e){
347 e->Delete();
348 return FALSE;
349 }
350 }
351 BOOL Attach(CFile* file,BOOL bAutodelete=TRUE) {
352 if(IsOpened())
353 return FALSE;
354 m_File = new CDynaCache(file,bAutodelete);
355 if(!m_File->Read1stBlock(&m_FB)){
356 memset(&m_FB,0,sizeof(m_FB));
357 m_FB.freeFile=-1;
358 VERIFY(m_File->Write1stBlock(&m_FB));
359 }
360 return IsOpened();
361 }
362 // CFile* Detach();
363 BOOL Close() {
364 if(!IsOpened())
365 return FALSE;
366 m_File->Write1stBlock(&m_FB);
367 delete m_File;
368 m_File=NULL;
369 return TRUE;
370 }
371 BOOL IsOpened() {
372 return m_File != NULL;
373 }
374 BOOL Write1stBlock(void) {
375 if(!IsOpened())
376 return FALSE;
377 VERIFY(m_File->Write1stBlock(&m_FB));
378 return TRUE;
379 }
380
381 CDynaFile* CreateFile() {
382 CDynaFile* rv = new CDynaFile(this);
383 if(rv->Create())
384 return rv;
385 delete rv;
386 return NULL;
387 }
388 CDynaFile* OpenFile(LONG fb) {
389 CDynaFile* rv = new CDynaFile(this);
390 if(rv->Open(fb))
391 return rv;
392 delete rv;
393 return NULL;
394 }
395 BOOL DeleteFile(LONG fb) {
396 while(fb>=0){
397 theBlock* b = m_File->GetCached(fb);
398 LONG nb = b->next;
399 Deallocate(fb);
400 fb=nb;
401 }
402 return TRUE;
403 }
404
405 LONG Allocate() {
406 if(!IsOpened())
407 return -1;
408 if(m_FB.freeFile<0){
409 LONG rv = m_File->AllocateNode();
410 theBlock *b = m_File->GetCached(rv);
411 b->next=-1;
412 m_File->MakeDirty(rv);
413 return rv;
414 }
415 LONG rv = m_FB.freeFile;
416 theBlock *b = m_File->GetCached(rv);
417 m_FB.freeFile=b->next;
418 b->next=-1;
419 m_File->MakeDirty(rv);
420 m_File->Write1stBlock(&m_FB);
421 return rv;
422 }
423 BOOL Deallocate(LONG bk) {
424 if(!IsOpened())
425 return FALSE;
426 theBlock* b = m_File->GetCached(bk);
427 ASSERT(b);
428 if(m_FB.freeFile<0){
429 b->next=-1;
430 m_FB.freeFile=bk;
431 }else{
432 b->next=m_FB.freeFile;
433 m_FB.freeFile=bk;
434 }
435 m_File->MakeDirty(bk);
436 m_File->Write1stBlock(&m_FB);
437 return TRUE;
438 }
439};
440
441};
442
443#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 @@
1 #ifndef__FINDIFACE_H
2 #define__FINDIFACE_H
3
4#include "SNMPeer.h"
5#include "SNMPExtDLL.h"
6#include "SNMPOIDs.h"
7
8namespace Klever {
9
10inline BOOL FindIFace(in_addr& target,in_addr& source)
11{
12 DEFINE_OID(ipRouteDest, OIDipRouteDest);
13 DEFINE_OID(ipRouteMask, OIDipRouteMask);
14 DEFINE_OID(ipRouteIfIndex,OIDipRouteIfIndex);
15 DEFINE_OID(ipRouteMetric1,OIDipRouteMetric1);
16 DEFINE_OID(ipAdEntIfIndex,OIDipAdEntIfIndex);
17 DEFINE_OID(ipAdEntAddr, OIDipAdEntAddr);
18 struct _route{
19 int iface;
20 int metric;
21 DWORD nm;
22 }routes[16];
23int nRoutes = 0;
24CSNMPVarBindList vbl;
25 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteDest,sizeof(ipRouteDest))));
26 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMask,sizeof(ipRouteMask))));
27 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteIfIndex,sizeof(ipRouteIfIndex))));
28 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMetric1,sizeof(ipRouteMetric1))));
29CSNMPExtDLL snmp("INETMIB1");
30 while(nRoutes<(sizeof(routes)/sizeof(routes[0]))){
31 if(
32 snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl)
33 && vbl.GetCount() == 4
34 ){
35 POSITION p = vbl.GetHeadPosition();
36 _route r = {-1,-1};
37 in_addr d, m;
38 BOOL bD = FALSE, bM = FALSE;
39 while(p){
40 CSNMPVarBind& vb = vbl.GetNext(p);
41 if(
42 vb.IsName(ipRouteDest,sizeof(ipRouteDest))
43 && vb.value.type==CASNAny::typeASNIP
44 ){
45 d.s_addr=vb.value.value.ip.s_addr; bD = TRUE;
46 }else if(
47 vb.IsName(ipRouteMask,sizeof(ipRouteMask))
48 && vb.value.type==CASNAny::typeASNIP
49 ){
50 m.s_addr=vb.value.value.ip.s_addr; bM = TRUE;
51 }else if(
52 vb.IsName(ipRouteIfIndex,sizeof(ipRouteIfIndex))
53 && vb.value.type==CASNAny::typeASNInteger
54 ){
55 r.iface=vb.value.value.number;
56 }else if(
57 vb.IsName(ipRouteMetric1,sizeof(ipRouteMetric1))
58 && vb.value.type==CASNAny::typeASNInteger
59 ){
60 r.metric=vb.value.value.number;
61 }else
62 break;
63 }
64 if(r.iface<0 || r.metric<0 || (!bD) || (!bM))
65 break;
66 if((target.s_addr&m.s_addr)==(d.s_addr&m.s_addr)){
67 r.nm=htonl(m.s_addr);
68 memmove(&routes[nRoutes++],&r,sizeof(routes[0]));
69 }
70 }else
71 break;
72 }
73 if(!nRoutes)
74 return FALSE;
75int rn = 0;
76 if(nRoutes>1){
77 for(int tmp=1;tmp<nRoutes;tmp++)
78 if(
79 routes[tmp].metric<routes[rn].metric
80 || routes[tmp].nm>routes[rn].nm
81 )
82 rn = tmp;
83 }
84int iface = routes[rn].iface;
85 vbl.RemoveAll();
86 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntAddr,sizeof(ipAdEntAddr))));
87 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntIfIndex,sizeof(ipAdEntIfIndex))));
88 for(;;){
89 if(
90 snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl)
91 && vbl.GetCount()==2
92 ){
93 in_addr a; a.s_addr = INADDR_NONE;
94 int ifn = -1;
95 POSITION p = vbl.GetHeadPosition();
96 while(p){
97 CSNMPVarBind& vb = vbl.GetNext(p);
98 if(
99 vb.IsName(ipAdEntAddr,sizeof(ipAdEntAddr))
100 && vb.value.type==CASNAny::typeASNIP
101 ){
102 a.s_addr=vb.value.value.ip.s_addr;
103 }else if(
104 vb.IsName(ipAdEntIfIndex,sizeof(ipAdEntIfIndex))
105 && vb.value.type==CASNAny::typeASNInteger
106 ){
107 ifn = vb.value.value.number;
108 }else
109 break;
110 }
111 if(ifn<0)
112 break;
113 if(ifn==iface){
114 source.s_addr=a.s_addr;
115 return TRUE;
116 }
117 }else
118 break;
119 }
120 return FALSE;
121}
122
123};
124
125 #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 @@
1 #ifndef__LRUCACHE_H
2 #define__LRUCACHE_H
3
4namespace Klever {
5
6template<class IDX,class ARGIDX,class DATA>
7class CLRUCache : public CObject {
8public:
9 struct CacheEntry{
10 enum cacheState{
11 cacheClean, cacheDirty, cacheEmpty
12 };
13 cacheStatem_State;
14 UINT m_hits;
15
16 IDX m_idx;
17 DATA* m_pData;
18
19 CacheEntry() { m_State=cacheEmpty; VERIFY(m_pData=new DATA); m_hits=0; }
20 virtual ~CacheEntry() { delete m_pData; }
21 };
22 typedef CMap<IDX,ARGIDX,CacheEntry*,CacheEntry*> CCacheMap;
23 typedef CList<CacheEntry*,CacheEntry*> CCacheList;
24
25 CCacheList m_Cache;
26 CCacheMap m_Map;
27
28 CLRUCache(UINT cacheSize){
29 for(int tmp=0;tmp<cacheSize;tmp++){
30 CacheEntry* p = new CacheEntry;
31 m_Cache.AddTail(p);
32 }
33 }
34 virtual ~CLRUCache(){
35 Flush();
36 POSITION p = m_Cache.GetHeadPosition();
37 while(p){
38 CacheEntry* c = m_Cache.GetNext(p);
39 delete c;
40 }
41 }
42
43 DATA* GetCached(ARGIDX idx,BOOL bLoad=TRUE) {
44 CacheEntry* rv;
45 if(m_Map.Lookup(idx,rv)){
46 rv->m_hits++;
47 PopUp(rv);
48 return rv->m_pData;
49 }
50 if(!bLoad)
51 return NULL;
52 rv = m_Cache.GetTail();
53 ASSERT(rv);
54 switch(rv->m_State){
55 case CacheEntry::cacheDirty:
56 FlushEntry(rv);
57 case CacheEntry::cacheClean:
58 m_Map.RemoveKey(rv->m_idx);
59 rv->m_State=CacheEntry::cacheEmpty;
60 case CacheEntry::cacheEmpty:
61 break;
62 default:
63 ASSERT(FALSE);
64 }
65 if(!_ReadIn(idx,rv->m_pData))
66 return NULL;
67 rv->m_hits=1;
68 rv->m_State=CacheEntry::cacheClean;
69 rv->m_idx=idx;
70 m_Map[idx]=rv;
71 PopUp(rv);
72 return rv->m_pData;
73 }
74 BOOL MakeDirty(ARGIDX idx) {
75 CacheEntry* pEntry;
76 if(m_Map.Lookup(idx,pEntry)){
77 ASSERT(pEntry->m_State==CacheEntry::cacheClean || pEntry->m_State==CacheEntry::cacheDirty);
78 pEntry->m_State=CacheEntry::cacheDirty;
79 return TRUE;
80 }
81 return FALSE;
82 }
83 BOOL Flush() {
84 POSITION p = m_Cache.GetHeadPosition();
85 while(p){
86 CacheEntry* pEntry = m_Cache.GetNext(p);
87 ASSERT(pEntry);
88 FlushEntry(pEntry);
89 }
90 return TRUE;
91 }
92 BOOL FlushEntry(CacheEntry* pEntry) {
93 if(pEntry->m_State==CacheEntry::cacheDirty){
94 BOOL rv = _WriteOut(pEntry->m_idx,pEntry->m_pData);
95 if(rv)
96 pEntry->m_State=CacheEntry::cacheClean;
97 }
98 return FALSE;
99 }
100 void PopUp(CacheEntry* pEntry) {
101 POSITION p = m_Cache.Find(pEntry);
102 ASSERT(p);
103 m_Cache.RemoveAt(p);
104 VERIFY(m_Cache.AddHead(pEntry));
105 }
106
107 virtualBOOL _ReadIn(ARGIDX idx,DATA* data) = 0;
108 virtual BOOL _WriteOut(ARGIDX idx,DATA* data) = 0;
109};
110
111};
112
113 #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 @@
1#include "../stdafx.h"
2#include "RegEx.h"
3
4 #defineisWordableChar(c) (isalnum(c) || (c)=='_')
5
6BOOL CRegEx::Compile(LPCTSTR regex,int flags)
7{
8 ASSERT(!((flags&regExtended) && (flags&regLiteral)));
9 m_Matches.RemoveAll();
10 m_Strip.RemoveAll();
11 m_Strip.SetSize(0,15);
12 m_Pattern=regex;
13 m_ParsePointer=0;
14 m_Error=0;
15 m_Sets.RemoveAll();
16 m_Flags=flags;
17 m_iFlags=0;
18 m_BOLs=m_EOLs=0;
19 m_Subexps = 0;
20 m_Categories=1;// 0 is 'everything else'
21 m_bBackRefs=FALSE;
22 memset(m_Category,0,sizeof(m_Category));
23
24 // Go ahead.
25 m_Error || m_Strip.Add(CSop(CSop::opEnd));
26 if(flags&regExtended){
27 ParseERE();
28 }else if(flags&regLiteral){
29 ParseLiteral();
30 }else{
31 ParseBRE();
32 }
33 m_Error || m_Strip.Add(CSop(CSop::opEnd));
34 Categorize();
35 m_Strip.FreeExtra();
36 FigureMust();
37 m_Pluses=CountPluses();
38 if(m_iFlags&iflagsBad){
39 m_Error || (m_Error=regeAssert);
40 // ??? point to nuls? ;-)
41 }
42 // We may wish to free some memory here if we're erroneous (ie. m_Error..)
43 m_ParseParens.RemoveAll();
44#ifdef _DEBUG
45 if(m_Error){
46 CString tmp;
47 tmp.Format("RE: ParseError: %d\n",m_Error);
48 TRACE0(tmp);
49 }
50 //DumpStrip(afxDump);
51#endif
52 return (m_bCompiled=(!m_Error));
53}
54
55BOOL CRegEx::Match(LPCTSTR src,int flags)
56{
57 if(!m_bCompiled)
58 return FALSE;
59 if(m_iFlags&iflagsBad)
60 return FALSE;
61 m_Input=src;
62 m_mFlags=flags;
63 m_mPointer=m_Input;
64 m_mBegin=m_Input;
65 m_mEnd=&m_mBegin[m_Input.GetLength()];
66 ASSERT(m_mPointer<=m_mEnd);
67 m_Matches.RemoveAll();
68 if(!m_Must.IsEmpty()){
69 if(m_Input.Find(m_Must)<0)
70 return FALSE;
71 }
72 // Go ahead..
73int stripLen = m_Strip.GetSize();
74 m_mLastPos.SetSize(0);
75 for(int tmp=0;tmp<stripLen;tmp++)
76 m_Strip[tmp].m_MatchData=0;
77LPCTSTR beginp = m_mBegin;
78LPCTSTR endp;
79 for(;;){
80 endp = MatchFast(beginp);
81 if(!endp)
82 return FALSE;
83 if((m_mFlags&regNoSubExpressions) && !m_bBackRefs)
84 break;
85 ASSERT(m_cOldP);
86 for(;;){
87 endp = MatchSlow(m_cOldP,m_mEnd,1,stripLen-1);
88 if(endp)
89 break;
90 ASSERT(m_cOldP<m_mEnd);
91 m_cOldP++;
92 }
93 if((m_mFlags&regOneMatch) && !m_bBackRefs)
94 break;
95 // Oh, his, we want the subexpression..
96 m_Matches.SetSize(m_Subexps+1);
97 LPCTSTR dp;
98 if(!m_bBackRefs && !(m_mFlags&regBackRefs)){
99 dp = MatchDissect(m_cOldP,endp,1,stripLen-1);
100 }else{
101 if(m_Pluses>0 && !m_mLastPos.GetSize())
102 m_mLastPos.SetSize(m_Pluses);
103 dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0);
104 }
105 if(dp)
106 break;
107 // Uh.. oh.. we couldn't find a subexpression-level match
108 ASSERT(m_bBackRefs);
109 ASSERT(m_Pluses==0 || m_mLastPos.GetSize());
110 for(;;){
111 if(dp || endp <= m_cOldP)
112 break;// defeat.. ?
113 endp = MatchSlow(m_cOldP,endp-1,1,stripLen-1);
114 if(!endp)
115 break;// defeat.. ?
116 // Try it on a shorter possibility..
117#ifdef _DEBUG
118 for(tmp=1;tmp<=m_Subexps;tmp++)
119 ASSERT(m_Matches[tmp].m_Begin<0 && m_Matches[tmp].m_End<0);
120#endif
121 dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0);
122 }
123 ASSERT((!dp) || dp==endp);
124 if(dp)// Found a shorter one..
125 break;
126 // Despite initial appearances, there is no match here
127 beginp = m_cOldP+1;
128 ASSERT(beginp<=m_mEnd);
129 }
130 // Fill in the detail if so requested..
131 if(!(m_mFlags&regNoSubExpressions)){
132 if(!m_Matches.GetSize())
133 m_Matches.SetSize(1);
134 m_Matches[0].m_Begin=m_cOldP-m_mBegin;
135 m_Matches[0].m_End=endp-m_mBegin;
136 }
137 m_mLastPos.RemoveAll();
138 return TRUE;
139}
140
141CString CRegEx::Replace(LPCTSTR src,LPCTSTR rep,int flags)
142{
143 // ***
144 return CString();
145}
146
147void CRegEx::ParseERE(int stop)
148{
149UCHAR c;
150BOOL first=TRUE;
151int prevF, prevB;
152 for(;;){
153 int co = m_Strip.GetSize();
154 while(m_ParsePointer < m_Pattern.GetLength() && ((c=m_Pattern[m_ParsePointer])!='|') && c!=stop)
155 ParseEREexp();
156 if(m_Strip.GetSize()==co){
157 m_Error || (m_Error=regeEmpty);
158 // ??? point to nuls?
159 }
160 if(m_ParsePointer>=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='|')
161 break;
162 else
163 m_ParsePointer++;
164 if(first){
165 StripInsert(co,CSop(CSop::opChoice0,m_Strip.GetSize()-co+1));
166 prevF = prevB = co;
167 first=FALSE;
168 }
169 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-prevB));
170 prevB = m_Strip.GetSize()-1;
171 m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF);
172 prevF = m_Strip.GetSize();
173 m_Error || m_Strip.Add(CSop(CSop::opOr1,0));// offset isn't really right.. very so..
174 }
175 if(!first){
176 m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF);
177 m_Error || m_Strip.Add(CSop(CSop::opChoice1,m_Strip.GetSize()-prevB));
178 }
179 ASSERT(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]==stop);
180}
181
182void CRegEx::ParseEREexp()
183{
184 ASSERT(m_ParsePointer < m_Pattern.GetLength());
185UCHAR c = m_Pattern[m_ParsePointer++];
186int pos = m_Strip.GetSize();
187int subno;
188int count, count2;
189BOOL wascaret=FALSE;
190 switch(c){
191 case '(':
192 if(!(m_ParsePointer<m_Pattern.GetLength())){
193 TRACE0("RE: '(' at the end of the pattern\n");
194 if(!m_Error)
195 m_Error = regeParen;
196 // ??? point to nuls?
197 }
198 m_Subexps++;
199 subno=m_Subexps;
200 m_ParseParens.SetAtGrow(m_Subexps,CParenthesis(m_Strip.GetSize()));
201 m_Error || m_Strip.Add(CSop(CSop::opLeftParen,subno));
202 if(m_ParsePointer>=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!=')')
203 ParseERE(')');
204 VERIFY(m_ParseParens[m_Subexps].m_End = m_Strip.GetSize());
205 m_Error || m_Strip.Add(CSop(CSop::opRightParen,subno));
206 if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer++]!=')'){
207 TRACE0("RE: No matching ')'\n");
208 if(!m_Error)
209 m_Error = regeParen;
210 // ??? point to nuls?
211 }
212 break;
213 case '^':
214 m_Error || m_Strip.Add(CSop(CSop::opBOL));
215 m_iFlags|=iflagsUseBOL;
216 m_BOLs++;
217 wascaret=TRUE;
218 break;
219 case '$':
220 m_Error || m_Strip.Add(CSop(CSop::opEOL));
221 m_iFlags|=iflagsUseEOL;
222 m_EOLs++;
223 break;
224 case '|':
225 TRACE0("RE: '|' outside of expression\n");
226 if(!m_Error)
227 m_Error = regeEmpty;
228 // ??? point to nuls?
229 break;
230 case '*':
231 case '+':
232 case '?':
233 TRACE0("RE: '*'/'+'/'?' with no previous expression\n");
234 if(!m_Error)
235 m_Error = regeBadRepeat;
236 // ??? point to nuls?
237 break;
238 case '.':
239 if(m_Flags&regNewLine)
240 EmitNonNewLineAny();
241 else
242 m_Error || m_Strip.Add(CSop(CSop::opAny));
243 break;
244 case '[':
245 ParseBracket();
246 break;
247 case '\\':
248 if(m_ParsePointer >= m_Pattern.GetLength()){
249 TRACE0("RE: '\\' at the end of the pattern\n");
250 if(!m_Error)
251 m_Error = regeEscape;
252 // ??? point to nuls?
253 }else{
254 c = m_Pattern[m_ParsePointer++];
255 EmitOrdinary(c);
256 }
257 break;
258 case '{':
259 if(m_ParsePointer >= m_Pattern.GetLength() || !isdigit(m_Pattern[m_ParsePointer])){
260 TRACE0("RE: '{' with no repeat count\n");
261 if(!m_Error)
262 m_Error = regeBadRepeat;
263 // ??? point to nuls?
264 }
265 // Fallthrough..
266 default:
267 EmitOrdinary(c);
268 break;
269 }
270 if(m_ParsePointer >= m_Pattern.GetLength())
271 return;
272 c = m_Pattern[m_ParsePointer];
273 // Call a '{' repetition if followed by a digit
274 if (!(c=='*' || c=='+' || c=='?' || ( c=='{' && (m_ParsePointer+1) < m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer+1])) ))
275 return; // No repetitor - done.
276 m_ParsePointer++;
277 if(wascaret){
278 TRACE0("RE: repetitive '^' detected\n");
279 if(!m_Error)
280 m_Error = regeBadRepeat;
281 // ??? point to nuls?
282 }
283 switch(c){
284 case '*':// Implemeted as +?
285 // + expression
286 StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
287 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
288 // ? expression
289 StripInsert(pos,CSop(CSop::opQuest0,m_Strip.GetSize()-pos+1));
290 m_Error || m_Strip.Add(CSop(CSop::opQuest1,m_Strip.GetSize()-pos));
291 break;
292 case '+':
293 // + expression
294 StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
295 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
296 break;
297 case '?':
298 // Kludge - emit y? as (y|) until subtle bug gets fixed :-)
299 StripInsert(pos,CSop(CSop::opChoice0,m_Strip.GetSize()-pos+1));
300 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
301 m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
302 m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
303 m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
304 break;
305 case '{':
306 count = ParseCount();
307 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==','){
308 m_ParsePointer++;
309 if(isdigit(m_Pattern[m_ParsePointer])){ // HHH Personally, I doubt it is always available
310 count2=ParseCount();
311 if(!(count<=count2)){
312 TRACE0("RE: Disbalanced counts in '{}' repeater\n");
313 m_Error || (m_Error=regeBadBrace);
314 // ??? point to nuls?
315 }
316 }else // Single number with comma
317 count2=256; // Infinity
318 }else // Single number
319 count2=count;
320 EmitRepeat(pos,count,count2);
321 if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='}'){
322 // No '}'..
323 TRACE0("RE: No immediately following '}' of '{' expression\n");
324 while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!='}')
325 m_ParsePointer++;
326 if(m_ParsePointer >= m_Pattern.GetLength()){
327 TRACE0("RE: No closing '}' found\n");
328 m_Error || (m_Error=regeBrace);
329 }else
330 m_Error || (m_Error=regeBadBrace);
331 // ??? point to nuls?
332 }else
333 m_ParsePointer++;
334 break;
335 }
336 if(m_ParsePointer >= m_Pattern.GetLength())
337 return;
338 c = m_Pattern[m_ParsePointer];
339 if(!(c=='*' || c=='+' || c=='?' || (c=='{' && (m_ParsePointer+1)<m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer+1]))))
340 return;
341 TRACE0("RE: Double repeater\n");
342 m_Error || (m_Error=regeBadRepeat);
343 // ??? point to nuls?
344}
345
346void CRegEx::StripInsert(int pos,CSop& sop)
347{
348 if(m_Error)
349 return;
350int sn = m_Strip.GetSize();
351 m_Strip.InsertAt(pos,sop);
352 for(int tmp=1;tmp<m_ParseParens.GetSize();tmp++){
353 if(m_ParseParens[tmp].m_Begin>=pos)
354 m_ParseParens[tmp].m_Begin++;
355 if(m_ParseParens[tmp].m_End>=pos)
356 m_ParseParens[tmp].m_End++;
357 }
358}
359
360void CRegEx::EmitOrdinary(UCHAR c)
361{
362 if(m_Flags&regIgnoreCase && isalpha(c) && (tolower(c) !=toupper(c))){
363 // Emit both cases
364 CString savePattern = m_Pattern;
365 int savePointer = m_ParsePointer;
366 m_Pattern=c;
367 m_Pattern+=']';
368 m_ParsePointer=0;
369 ParseBracket();
370 m_Pattern=savePattern;
371 m_ParsePointer=savePointer;
372 }else{
373 m_Error || m_Strip.Add(CSop(CSop::opChar,c));
374 if(!m_Category[(BYTE)c])
375 m_Category[(BYTE)c]=m_Categories++;
376 }
377}
378
379void CRegEx::EmitNonNewLineAny()
380{
381 // Kludges're going on and on..
382CString savePattern = m_Pattern;
383int savePointer = m_ParsePointer;
384 m_Pattern="^\n]";
385 m_ParsePointer=0;
386 ParseBracket();
387 m_Pattern=savePattern;
388 m_ParsePointer=savePointer;
389}
390
391int CRegEx::ParseCount()
392{
393BOOL nonEmpty=FALSE;
394int rv = 0;
395UCHAR c;
396 while(m_ParsePointer < m_Pattern.GetLength() && isdigit(c=m_Pattern[m_ParsePointer]) && rv <=255){
397 rv = rv*10 + c-'0';
398 nonEmpty=TRUE;
399 m_ParsePointer++;
400 }
401 if(rv>255 || !nonEmpty){
402 m_Error || (m_Error=regeBadBrace);
403 // ??? point to nuls?
404 }
405 return rv;
406}
407
408void CRegEx::ParseBracket()
409{
410 // Dept. of truly sickening special case kludges
411 if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:<]]")){
412 m_Error || m_Strip.Add(CSop(CSop::opBOW));
413 m_ParsePointer+=6;
414 return;
415 }
416 if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:>]]")){
417 m_Error || m_Strip.Add(CSop(CSop::opEOW));
418 m_ParsePointer+=6;
419 return;
420 }
421BOOL invert=TRUE;
422 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='^')
423 m_ParsePointer++;
424 else
425 invert=FALSE;
426CSet cset;
427 if(m_ParsePointer < m_Pattern.GetLength()){
428 switch(m_Pattern[m_ParsePointer]){
429 case ']':
430 case '-':
431 cset.Add(m_Pattern[m_ParsePointer]);
432 m_ParsePointer++;
433 break;
434 }
435 }
436 while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!=']' && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("-]")))
437 ParseBracketTerm(cset);
438 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-'){
439 m_ParsePointer++;
440 cset.Add('-');
441 }
442 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==']')
443 m_ParsePointer++;
444 else{
445 m_Error || (m_Error=regeBracket);
446 // ??? point to nuls?
447 return;
448 }
449 if(m_Flags&regIgnoreCase){
450 for(int tmp=CSet::size-1;tmp>=0;tmp--){
451 if(cset.IsIn(tmp) && isalpha(tmp) && (toupper(tmp)!=tolower(tmp)))
452 cset.Add(isupper(tmp)?tolower(tmp):toupper(tmp));
453 }
454 /*
455 if(!cset->m_Multis.IsEmpty())
456 cset.CollatingCase();
457 */
458 }
459 if(invert){
460 for(int tmp=CSet::size-1;tmp>=0;tmp--)
461 if(cset.IsIn(tmp))
462 cset.Sub(tmp);
463 else
464 cset.Add(tmp);
465 if(m_Flags&regNewLine)
466 cset.Sub('\n');
467 /*
468 if(!cset.m_Multis.IsEmpty())
469 cset.CollatingInvert();
470 */
471 }
472UCHAR c = cset.GetOnly();
473 if(c){
474 EmitOrdinary(c);
475 }else
476 m_Error || m_Strip.Add(CSop(CSop::opAnyOf,StoreSet(cset)));
477}
478
479void CRegEx::CSet::Add(UCHAR c)
480{
481 m_Set[(BYTE)c]=TRUE;
482 m_Hash+=c;
483}
484
485BOOL CRegEx::CSet::IsIn(UCHAR c)
486{
487 return m_Set[(BYTE)c];
488}
489
490void CRegEx::CSet::Sub(UCHAR c)
491{
492 m_Set[(BYTE)c]=FALSE;
493 m_Hash-=c;
494}
495
496UCHAR CRegEx::CSet::GetOnly()
497{
498int rv = 0;
499UCHAR only = 0;
500 for(int tmp=0;tmp<size;tmp++){
501 rv+=m_Set[tmp]?(only=tmp,1):0;
502 }
503 return (rv==1)?only:0;
504}
505
506int CRegEx::StoreSet(CSet& cset)
507{
508 for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
509 if(m_Sets[tmp]==cset)
510 return tmp;
511 return m_Sets.Add(cset);
512}
513
514void CRegEx::ParseBracketTerm(CSet& cset)
515{
516UCHAR c;
517 switch((m_ParsePointer<m_Pattern.GetLength())?m_Pattern[m_ParsePointer]:0){
518 case '[':
519 c = ((m_ParsePointer+1)<m_Pattern.GetLength())?m_Pattern[m_ParsePointer+1]:0;
520 break;
521 case '-':
522 m_Error || (m_Error=regeRange);
523 // ??? point to nuls?
524 return;
525 default:
526 c = 0;
527 break;
528 }
529 switch(c){
530 case ':':// Character class
531 m_ParsePointer+=2;
532 if(m_ParsePointer>=m_Pattern.GetLength()){
533 m_Error || (m_Error=regeBracket);
534 // ??? point to nuls?
535 }
536 c = m_Pattern[m_ParsePointer];
537 if(c== '-' || c==']'){
538 m_Error || (m_Error=regeCType);
539 // ??? point to nuls?
540 }
541 ParseBracketCClass(cset);
542 if(m_ParsePointer>=m_Pattern.GetLength()){
543 m_Error || (m_Error=regeBracket);
544 // ??? point to nuls?
545 }
546 if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare(":]"))){
547 m_Error || (m_Error=regeCType);
548 // ??? point to nuls?
549 }else
550 m_ParsePointer+=2;
551 break;
552 case '=':// Equivalence class
553 m_ParsePointer+=2;
554 if(m_ParsePointer >= m_Pattern.GetLength()){
555 m_Error || (m_Error=regeBracket);
556 // ??? point to nuls?
557 }
558 c = m_Pattern[m_ParsePointer];
559 if(c== '-' || c==']'){
560 m_Error || (m_Error=regeCollate);
561 // ??? point to nuls?
562 }
563 ParseBracketEClass(cset);
564 if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare("=]"))){
565 m_Error || (m_Error=regeCollate);
566 // ??? point to nuls?
567 }else
568 m_ParsePointer+=2;
569 break;
570 default:// Symbol, character or range
571 {
572 UCHAR start, finish;
573 start = ParseBracketSymbol();
574 if((m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-') /*&& (m_ParsePointer+1)<m_Pattern.GetLength() && m_Pattern[m_ParsePointer+1]==']'*/){
575 // I believe the expression above is seetwo..
576 // range.
577 m_ParsePointer++;
578 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-'){
579 m_ParsePointer++;
580 finish='-';
581 }else
582 finish=ParseBracketSymbol();
583 }else
584 finish=start;
585 if(((BYTE)start)>((BYTE)finish)){
586 m_Error || (m_Error=regeRange);
587 // ??? point to nuls?
588 }
589 for(int tmp=start;tmp<=(BYTE)finish;tmp++)
590 cset.Add(tmp);
591 }
592 break;
593 }
594}
595
596void CRegEx::ParseBracketCClass(CSet& cset)
597{
598 static struct{
599 char *className;
600 char *classChars;
601 }cc[] = {
602 {"alnum","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},
603 {"alpha","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},
604 {"blank"," \t"},
605 {"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"},
606 {"digit","0123456789"},
607 {"graph","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"},
608 {"lower","abcdefghijklmnopqrstuvwxyz"},
609 {"print","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ "},
610 {"punct","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"},
611 {"space","\t\n\v\f\r "},
612 {"upper","ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
613 {"xdigit","0123456789ABCDEFabcdef"}
614};
615CString cclass;
616UCHAR c;
617 while(m_ParsePointer < m_Pattern.GetLength() && isalpha(c=m_Pattern[m_ParsePointer])){
618 cclass+=c;
619 m_ParsePointer++;
620 }
621char *classChars = NULL;
622 for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++){
623 if(!cclass.CompareNoCase(cc[tmp].className)){
624 classChars=cc[tmp].classChars;
625 break;
626 }
627 }
628 if(!classChars){
629 m_Error || (m_Error=regeCType);
630 // ??? point to nuls?
631 return;
632 }
633 while(*classChars)
634 cset.Add(*(classChars++));
635 // --- multis
636}
637
638void CRegEx::ParseBracketEClass(CSet& cset)
639{
640 cset.Add(ParseBracketCollatingElement('='));;
641}
642
643UCHAR CRegEx::ParseBracketCollatingElement(UCHAR term)
644{
645 static struct{
646 char *entityName;
647 char entity;
648 }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'} };
649CString seeTwo;
650 seeTwo=term;
651 seeTwo+=']';
652CString entityName;
653 while(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare(seeTwo)))
654 entityName+=m_Pattern[m_ParsePointer++];
655 if(m_ParsePointer>=m_Pattern.GetLength()){
656 m_Error || (m_Error=regeBracket);
657 // ??? point to nuls?
658 return 0;
659 }
660 for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++)
661 if(!entityName.CompareNoCase(cc[tmp].entityName))
662 return cc[tmp].entity;
663 if(entityName.GetLength()==1)
664 return entityName[0];
665 m_Error || (m_Error=regeCollate);
666 // ??? point to nuls?
667 return 0;
668}
669
670UCHAR CRegEx::ParseBracketSymbol()
671{
672 if(m_ParsePointer>=m_Pattern.GetLength()){
673 m_Error || (m_Error=regeBracket);
674 // ??? point to nuls?
675 }
676 if((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("[."))
677 m_ParsePointer+=2;
678 else
679 return m_Pattern[m_ParsePointer++];
680 // Collating symbol
681UCHAR rv = ParseBracketCollatingElement('.');
682 if((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("[."))
683 m_ParsePointer+=2;
684 else{
685 m_Error || (m_Error=regeCollate);
686 // ??? point to nuls?
687 }
688 return rv;
689}
690
691void CRegEx::EmitRepeat(int pos,int from,int to)
692{
693 if(m_Error)
694 return;
695 ASSERT(from<=to);
696int finish = m_Strip.GetSize();
697int copy;
698 #defineN 2
699#define INF 3
700#define REP(f,t) ((f)*8+(t))
701#define MAP(n) (((n)<=1)?(n):((n)==256)?INF:N)
702 switch(REP(MAP(from),MAP(to))){
703 case REP(0,0):// must be user doing ths??
704 m_Strip.SetSize(pos);
705 break;
706 case REP(0,1):// as in '?'
707 case REP(0,N):// as in '{1,n}?'
708 case REP(0,INF):// as in '{1,}?'
709 // Kludge - emit y? as (y|) until something gets fixed..
710 StripInsert(pos,CSop(CSop::opChoice0,pos));
711 EmitRepeat(pos+1,1,to);
712 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
713 m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
714 m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
715 m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
716 break;
717 case REP(1,1):
718 break;
719 case REP(1,N):// as in 'x?x{1,n-1}'
720 // Kludge again..
721 StripInsert(pos,CSop(CSop::opChoice0,pos));
722 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
723 m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
724 m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
725 m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
726 copy = StripDuplicate(pos+1,finish+1);
727 ASSERT(copy==(finish+4));
728 EmitRepeat(copy,1,to-1);
729 break;
730 case REP(1,INF): // as in '+'
731 StripInsert(pos,CSop(CSop::opPlus0,pos));
732 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
733 break;
734 case REP(N,N):// as in 'xx{from-1,to-1}'
735 copy = StripDuplicate(pos,finish);
736 EmitRepeat(copy,from-1,to-1);
737 break;
738 case REP(N,INF): // as in 'xx{n-1,}'
739 copy = StripDuplicate(pos,finish);
740 EmitRepeat(copy,from-1,to);
741 break;
742#ifndef NDEBUG
743 default:
744 ASSERT(FALSE);
745 break;
746#endif
747 }
748#undef MAP
749#undef REP
750#undef INF
751#undef N
752}
753
754int CRegEx::StripDuplicate(int from,int to)
755{
756int rv = m_Strip.GetSize();
757 ASSERT(from<=to);
758 if(from==to)
759 return rv;
760 // Maybe should be optimized for copying the whole thing.
761 for(int tmp=from;tmp<to;tmp++)
762 m_Strip.Add(m_Strip[tmp]);
763 return rv;
764}
765
766void CRegEx::Categorize()
767{
768 if(m_Error)
769 return;
770 for(int tmp=0;tmp<(sizeof(m_Category)/sizeof(m_Category[0]));tmp++)
771 if((!m_Category[tmp]) && IsInSets(tmp)){
772 int cat = m_Categories++;
773 m_Category[tmp]=cat;
774 for(int c=tmp+1;c<(sizeof(m_Category)/sizeof(m_Category[0]));c++)
775 if((!m_Category[c]) && IsInSameSets(tmp,c))
776 m_Category[c]=cat;
777 }
778}
779
780BOOL CRegEx::IsInSets(UCHAR c)
781{
782 for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
783 if(m_Sets[tmp].IsIn(c))
784 return TRUE;
785 return FALSE;
786}
787
788BOOL CRegEx::IsInSameSets(UCHAR c1,UCHAR c2)
789{
790 for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
791 if(m_Sets[tmp].IsIn(c1)!=m_Sets[tmp].IsIn(c2))
792 return FALSE;
793 return TRUE;
794}
795
796void CRegEx::FigureMust()
797{
798 if(m_Error)
799 return;
800 m_Must.Empty();
801int stripLen = m_Strip.GetSize();
802int seqStart, seqLength = 0;
803int mustStart, mustLength = 0;
804 for(int tmp=1;tmp<stripLen;tmp++){
805 switch(m_Strip[tmp].m_Operator){
806 case CSop::opChar:
807 if(!seqLength)
808 seqStart=tmp;
809 seqLength++;
810 break;
811 case CSop::opPlus0:
812 case CSop::opLeftParen:
813 case CSop::opRightParen:
814 break;// Break, since they don't break the sequence
815 case CSop::opQuest0:
816 case CSop::opChoice0:
817 // These ones we skip.
818 do{
819 tmp+=m_Strip[tmp].m_Operand;
820 // I still think it could be ASSERTed..
821 if(m_Strip[tmp].m_Operator!=CSop::opQuest1 && m_Strip[tmp].m_Operator!=CSop::opChoice1 && m_Strip[tmp].m_Operator!=CSop::opOr1){
822 m_iFlags|=iflagsBad;
823 return;
824 }
825 }while(m_Strip[tmp].m_Operator!=CSop::opQuest1 && m_Strip[tmp].m_Operator!=CSop::opChoice1);
826 // Fallthrough..
827 default:
828 // End of sequence
829 if(seqLength>mustLength){
830 mustStart=seqStart;
831 mustLength=seqLength;
832 }
833 seqLength=0;
834 break;
835 }
836 }// Hmm.. originally it's meant to be do while not opEnd..
837 if(!mustLength)
838 return;
839 // Turn into string, but, wait, personally I'm sure it could be put in the main loop.. or maybe not..
840 for(tmp=0;tmp<seqLength;tmp++){
841 while(m_Strip[seqStart+tmp].m_Operator!=CSop::opChar)
842 ASSERT(tmp<seqLength);
843 m_Must+=m_Strip[tmp].m_Operand;
844 }
845}
846
847int CRegEx::CountPluses()
848{
849 if(m_Error)
850 return 0;
851int stripLen = m_Strip.GetSize();
852int rv = 0;
853int nest = 0;
854 for(int tmp=0;tmp<stripLen;tmp++){
855 switch(m_Strip[tmp].m_Operator){
856 case CSop::opPlus0:
857 nest++;
858 break;
859 case CSop::opPlus1:
860 if(nest>rv)
861 rv = nest;
862 nest--;
863 break;
864 }
865 }// Again, originally we were supposed to scan till opEnd..
866 if(nest)
867 m_iFlags|=iflagsBad;// Could this be an ASSERTion?
868 return rv;
869}
870
871void CRegEx::ParseLiteral()
872{
873 if(!m_Pattern.GetLength()){
874 m_Error || (m_Error=regeEmpty);
875 // ??? point to nuls?
876 }
877 while(m_ParsePointer < m_Pattern.GetLength())
878 EmitOrdinary(m_Pattern[m_ParsePointer++]);
879}
880
881void CRegEx::ParseBRE(int stopa,int stopb)
882{
883int start = m_Strip.GetSize();
884BOOL first=TRUE;
885BOOL wasDollar=FALSE;
886 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='^'){
887 m_ParsePointer++;
888 m_Error || m_Strip.Add(CSop(CSop::opBOL,0));
889 m_iFlags|=iflagsUseBOL;
890 m_BOLs++;
891 }
892CString stopstr;
893 if(stopa){
894 stopstr+=stopa;
895 if(stopb)
896 stopstr+=stopb;
897 }
898 while(m_ParsePointer < m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare(stopstr))){
899 wasDollar = ParseBREexp(first);
900 first=FALSE;
901 }
902 if(wasDollar){// Trailing anchor that was..
903 m_Strip.SetSize(m_Strip.GetSize()-1);
904 m_Error || m_Strip.Add(CSop(CSop::opEOL,0));
905 m_iFlags|=iflagsUseEOL;
906 m_EOLs++;
907 }
908 if(m_Strip.GetSize()==start){
909 m_Error || (m_Error=regeEmpty);
910 // ??? point to nuls?
911 }
912}
913
914BOOL CRegEx::ParseBREexp(BOOL ordinaryStar)
915{
916int subno;
917int pos = m_Strip.GetSize();
918 ASSERT(m_ParsePointer<m_Pattern.GetLength());
919int c = m_Pattern[m_ParsePointer++];
920 if(c=='\\'){
921 if(m_ParsePointer>=m_Pattern.GetLength()){
922 m_Error || (m_Error=regeEscape);
923 // ??? point to nuls
924 }else
925 c = 0x100|m_Pattern[m_ParsePointer++];
926 }
927 switch(c){
928 case '.':
929 if(m_Flags&regNewLine)
930 EmitNonNewLineAny();
931 else
932 m_Error || m_Strip.Add(CSop(CSop::opAny,0));
933 break;
934 case '[':
935 ParseBracket();
936 break;
937 case 0x100|'{':
938 m_Error || (m_Error=regeBadRepeat);
939 // ??? point to nuls?
940 break;
941 case 0x100|'(':
942 m_Subexps++;
943 subno=m_Subexps;
944 m_ParseParens.SetAtGrow(m_Subexps,CParenthesis(m_Strip.GetSize()));
945 m_Error || m_Strip.Add(CSop(CSop::opLeftParen,subno));
946 if(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\)")))
947 ParseBRE('\\',')');
948 VERIFY(m_ParseParens[m_Subexps].m_End = m_Strip.GetSize());
949 m_Error || m_Strip.Add(CSop(CSop::opRightParen,subno));
950 if((m_ParsePointer+1) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\)"))
951 m_ParsePointer+=2;
952 else{
953 m_Error || (m_Error=regeParen);
954 // ??? point to nuls?
955 }
956 break;
957 case 0x100|')':
958 case 0x100|'}':
959 // Can this possibly happen?!
960 m_Error || (m_Error=regeParen);
961 // ??? point to nuls?
962 break;
963 case 0x100|'1':
964 case 0x100|'2':
965 case 0x100|'3':
966 case 0x100|'4':
967 case 0x100|'5':
968 case 0x100|'6':
969 case 0x100|'7':
970 case 0x100|'8':
971 case 0x100|'9':
972 {
973 int i = (c&0xFF)-'0';
974 if(i < m_ParseParens.GetSize() && m_ParseParens[i].m_End){
975 m_Error || m_Strip.Add(CSop(CSop::opBackRef0,i));
976 ASSERT(m_ParseParens[i].m_Begin);
977 ASSERT(m_Strip[m_ParseParens[i].m_Begin].m_Operator==CSop::opLeftParen);
978 ASSERT(m_Strip[m_ParseParens[i].m_End].m_Operator==CSop::opRightParen);
979 StripDuplicate(m_ParseParens[i].m_Begin+1,m_ParseParens[i].m_End);
980 m_Error || m_Strip.Add(CSop(CSop::opBackRef1,i));
981 }else{
982 m_Error || (m_Error=regeSubReg);
983 // ??? point to nuls?
984 }
985 m_bBackRefs=TRUE;
986 }
987 break;
988 case '*':
989 if(!ordinaryStar){
990 m_Error || (m_Error=regeBadRepeat);
991 // ??? point to nuls?
992 }
993 // Fallthrough..
994 default:
995 EmitOrdinary(c&0xFF);
996 break;
997 }
998 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='*'){
999 m_ParsePointer++;
1000 // as in '+?'
1001 StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
1002 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
1003 StripInsert(pos,CSop(CSop::opQuest0,m_Strip.GetSize()-pos+1));
1004 m_Error || m_Strip.Add(CSop(CSop::opQuest1,m_Strip.GetSize()-pos));
1005 }else if ((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\{")){
1006 m_ParsePointer+=2;
1007 int count = ParseCount();
1008 int count2;
1009 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==','){
1010 m_ParsePointer++;
1011 if(m_ParsePointer<m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer])){
1012 count2=ParseCount();
1013 if(count>count2){
1014 m_Error || (m_Error=regeBadBrace);
1015 // ??? poin to nuls?
1016 }
1017 }else // Single number with comma
1018 count2=256;
1019 }else // Single number
1020 count2=count;
1021 EmitRepeat(pos,count,count2);
1022 if((m_ParsePointer+1)>=m_Pattern.GetLength() || m_Pattern.Mid(m_ParsePointer,2).Compare("\\}")){
1023 while(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\}")))
1024 m_ParsePointer++;
1025 if(m_ParsePointer>=m_Pattern.GetLength()){
1026 m_Error || (m_Error=regeBrace);
1027 // ??? point to nuls?
1028 }
1029 m_Error || (m_Error=regeBadBrace);
1030 }else
1031 m_ParsePointer+=2;
1032 }else if(c=='$')
1033 return TRUE;
1034 return FALSE;
1035}
1036
1037CRegEx::CRegEx()
1038{
1039 m_bCompiled=FALSE;
1040}
1041
1042LPCTSTR CRegEx::MatchFast(LPCTSTR begin)
1043{
1044 MatchStatesClear(CSop::stCurrent);
1045 m_Strip[1].m_MatchData|=CSop::stCurrent;
1046int stripLen = m_Strip.GetSize();
1047 MatchStep(1,stripLen-1,CSop::stCurrent,charNothing,CSop::stCurrent);
1048 MatchStatesCopy(CSop::stFresh,CSop::stCurrent);
1049LPCTSTR coldp = NULL;
1050LPCTSTR p = begin;
1051int c = (begin==m_mBegin)?charOut:((int)(BYTE)m_mPointer[-1]);
1052 for(;;){
1053 // next character..
1054 int lastc = c;
1055 c = (p==m_mEnd)?charOut:(int)*(BYTE*)p;
1056 if(MatchStatesEqual(CSop::stCurrent,CSop::stFresh))
1057 coldp=p;
1058 // Is there an EOL and/or BOL between lastc and c? - they ask..
1059 intflagc=0;
1060 inti = 0;
1061 if((lastc=='\n' && m_Flags&regNewLine) || (lastc==charOut && !(m_mFlags&regNotBOL))){
1062 flagc=charBOL;
1063 i=m_BOLs;
1064 }
1065 if((c=='\n' && m_Flags&regNewLine) || (c==charOut && !(m_mFlags&regNotEOL))){
1066 flagc=(flagc==charBOL)?charBOLEOL:charEOL;
1067 i+=m_EOLs;
1068 }
1069 if(i){
1070 for(;i>0;i--)
1071 MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent);
1072 }
1073 // What about a word boundary? - they wonder..
1074 if((flagc==charBOL || (lastc!=charOut && !isWordableChar(c))) && (c!=charOut && isWordableChar(c)))
1075 flagc = charBOW;
1076 if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c))))
1077 flagc = charEOW;
1078 if(flagc==charBOW || flagc==charEOW){
1079 MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent);
1080 }
1081 // Are we done? Now WE wonder..
1082 if((m_Strip[stripLen-1].m_MatchData&CSop::stCurrent) || p==m_mEnd)
1083 break;// They insist I need to note break out.. Okay, I do..
1084 // Nope, we're not done. We have to face this character..
1085 MatchStatesCopy(CSop::stTemp,CSop::stCurrent);
1086 MatchStatesCopy(CSop::stCurrent,CSop::stFresh);
1087 ASSERT(c!=charOut);
1088 MatchStep(1,stripLen-1,CSop::stTemp,c,CSop::stCurrent);
1089 p++;
1090 }
1091 ASSERT(coldp);
1092 m_cOldP=coldp;// *** I believe this variable can be changed 'in-place'
1093 if(m_Strip[stripLen-1].m_MatchData&CSop::stCurrent)
1094 return &p[1];
1095 else
1096 return NULL;
1097}
1098
1099void CRegEx::MatchStatesClear(BYTE mask)
1100{
1101int stripLen = m_Strip.GetSize();
1102 for(int tmp=0;tmp<stripLen;tmp++)
1103 m_Strip[tmp].m_MatchData&=~mask;
1104}
1105
1106void CRegEx::MatchStep(int from,int to,BYTE maskBefore,int charCode,BYTE maskAfter)
1107{
1108BOOL i;
1109int look;
1110int here = from;
1111 for(int pc=from;pc!=to;pc++,here++){
1112 CSop s=m_Strip[pc];
1113 switch(s.m_Operator){
1114 case CSop::opEnd:
1115 ASSERT(pc==(to-1));
1116 break;
1117 case CSop::opChar:
1118 // Only characters can match..
1119 ASSERT((charCode<charOut) || charCode!=s.m_Operand);
1120 if(charCode==s.m_Operand)
1121 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1122 break;
1123 case CSop::opBOL:
1124 if(charCode==charBOL || charCode==charBOLEOL)
1125 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1126 break;
1127 case CSop::opEOL:
1128 if(charCode==charEOL || charCode==charBOLEOL)
1129 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1130 break;
1131 case CSop::opBOW:
1132 if(charCode==charBOW)
1133 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1134 break;
1135 case CSop::opEOW:
1136 if(charCode==charEOW)
1137 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1138 break;
1139 case CSop::opAny:
1140 if(charCode<charOut)
1141 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1142 break;
1143 case CSop::opAnyOf:
1144 if(charCode<charOut && m_Sets[s.m_Operand].m_Set[charCode])
1145 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1146 break;
1147 case CSop::opBackRef0:// Ignored here..
1148 case CSop::opBackRef1:
1149 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1150 break;
1151 case CSop::opPlus0:
1152 // Forward, this is just an empty, comment says..
1153 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1154 break;
1155 case CSop::opPlus1:
1156 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1157 i =(m_Strip[here-s.m_Operand].m_MatchData&maskAfter)!=0;
1158 m_Strip[here-s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1159 if(!i && (m_Strip[here-s.m_Operand].m_MatchData&maskAfter)){
1160 // oho, must reconsider loop body, comment says.. what's so 'oho' about it?
1161 pc-=s.m_Operand+1;
1162 here=pc;
1163 }
1164 break;
1165 case CSop::opQuest0:
1166 // two branches, both forward..
1167 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1168 m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1169 break;
1170 case CSop::opQuest1:
1171 // just an empty.. aren't we tired of justanempties?
1172 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1173 break;
1174 case CSop::opLeftParen: // they say it's not significan there..
1175 case CSop::opRightParen:
1176 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1177 break;
1178 case CSop::opChoice0:// mark the first two branches..
1179 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1180 ASSERT(m_Strip[pc+s.m_Operand].m_Operator==CSop::opOr1);
1181 m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1182 break;
1183 case CSop::opOr0:// done a branch, find the end of choice..
1184 if(m_Strip[here].m_MatchData&maskAfter){
1185 for(look=1;(s=m_Strip[pc+look]).m_Operator!=CSop::opChoice1;look+=s.m_Operand)
1186 ASSERT(s.m_Operator==CSop::opOr1);
1187 m_Strip[here+look].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1188 }
1189 break;
1190 case CSop::opOr1: // Propagate Choice's marking..
1191 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1192 if(m_Strip[pc+s.m_Operand].m_Operator!=CSop::opChoice1){
1193 ASSERT(m_Strip[pc+s.m_Operand].m_Operator==CSop::opOr1);
1194 m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1195 }
1196 break;
1197 case CSop::opChoice1: // Just empty.. :-)..
1198 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1199 break;
1200#ifdef _DEBUG
1201 default:
1202 ASSERT(FALSE);
1203 break;
1204#endif
1205 }
1206 }
1207}
1208
1209void CRegEx::MatchStatesCopy(BYTE dst,BYTE src)
1210{
1211int stripLen = m_Strip.GetSize();
1212 for(int tmp=0;tmp<stripLen;tmp++){
1213 // I believe this can be optimized, easily..
1214 m_Strip[tmp].m_MatchData&=~dst;
1215 m_Strip[tmp].m_MatchData|=(m_Strip[tmp].m_MatchData&src)?dst:0;
1216 }
1217}
1218
1219BOOL CRegEx::MatchStatesEqual(BYTE m1,BYTE m2)
1220{
1221int stripLen = m_Strip.GetSize();
1222 for(int tmp=0;tmp<stripLen;tmp++){
1223 BYTE mm = m_Strip[tmp].m_MatchData;
1224 if(((mm&m1) && (mm&m2)) || !(mm&(m1|m2)))
1225 continue;
1226 return FALSE;
1227 }
1228 return TRUE;
1229}
1230
1231LPCTSTR CRegEx::MatchSlow(LPCTSTR begin,LPCTSTR end,int from,int to)
1232{
1233 MatchStatesClear(CSop::stCurrent);
1234 m_Strip[from].m_MatchData|=CSop::stCurrent;
1235 MatchStep(from,to,CSop::stCurrent,charNothing,CSop::stCurrent);
1236LPCTSTR mp = NULL;
1237int c = (m_mBegin==m_mPointer)?charOut:(int)(BYTE)begin[-1];
1238LPCTSTR p = begin;
1239 for(;;){
1240 // next character..
1241 int lastc = c;
1242 c = (p==m_mEnd)?charOut:(int)*(BYTE*)p;
1243 // Now we start to wonder if there is an EOL and/or BOL between lastc and c
1244 int flagc = 0;
1245 int i = 0;
1246 if((lastc=='\n' && m_Flags&regNewLine) || (lastc==charOut && !(m_mFlags&regNotBOL))){
1247 flagc = charBOL;
1248 i = m_BOLs;
1249 }
1250 if((c=='\n' && m_Flags&regNewLine) || (c==charOut && !(m_mFlags&regNotEOL))){
1251 flagc = (flagc==charBOL)?charBOLEOL:charEOL;
1252 i+=m_EOLs;
1253 }
1254 if(i){
1255 for(;i>0;i--)
1256 MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent);
1257 }
1258 // Now we wonder about word boundaries..
1259 if((flagc==charBOL || (lastc!=charOut && !isWordableChar(lastc))) && (c!=charOut && isWordableChar(c)))
1260 flagc=charBOW;
1261 if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c))))
1262 flagc=charEOW;
1263 if(flagc==charBOW || flagc==charEOW){
1264 MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent);
1265 }
1266 // Are we done we all wonder??
1267 if(m_Strip[to].m_MatchData&CSop::stCurrent)
1268 mp=p;
1269 if(MatchStatesEqual(CSop::stCurrent,CSop::stEmpty) || p==end)
1270 break;// Again, we're obliged to note break out. We do.
1271 // Sucks.. we have to face this character..
1272 MatchStatesCopy(CSop::stTemp,CSop::stCurrent);
1273 MatchStatesCopy(CSop::stCurrent,CSop::stEmpty);
1274 ASSERT(c!=charOut);
1275 MatchStep(from,to,CSop::stTemp,c,CSop::stCurrent);
1276 MatchStep(from,to,CSop::stCurrent,charNothing,CSop::stCurrent);
1277 p++;
1278 }
1279 return mp;
1280}
1281
1282LPCTSTR CRegEx::MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to)
1283{
1284LPCTSTR sp = begin, dp;
1285LPCTSTR stp, rest, tail, ssp, oldssp, sep;
1286int ssub, esub;
1287int es;
1288int i;
1289 for(int ss=from;ss<to;ss = es){
1290 // Identify end of SubRE
1291 es = ss;
1292 switch(m_Strip[es].m_Operator){
1293 case CSop::opPlus0:
1294 case CSop::opQuest0:
1295 es+=m_Strip[es].m_Operand;
1296 break;
1297 case CSop::opChoice0:
1298 while(m_Strip[es].m_Operator!=CSop::opChoice1)
1299 es+=m_Strip[es].m_Operand;
1300 break;
1301 }
1302 es++;
1303 // Figure out what it matched
1304 switch(m_Strip[ss].m_Operator){
1305 case CSop::opEnd:
1306 ASSERT(FALSE);
1307 break;
1308 case CSop::opChar:
1309 sp++;
1310 break;
1311 case CSop::opBOL:
1312 case CSop::opEOL:
1313 case CSop::opBOW:
1314 case CSop::opEOW:
1315 break;
1316 case CSop::opAny:
1317 case CSop::opAnyOf:
1318 sp++;
1319 break;
1320 case CSop::opBackRef0:
1321 case CSop::opBackRef1:
1322 ASSERT(FALSE);
1323 break;
1324 // Cases where lenght of match is hard to find..
1325 case CSop::opQuest0:
1326 stp=end;
1327 for(;;){
1328 // How long could this one be??
1329 rest = MatchSlow(sp,stp,ss,es);
1330 ASSERT(rest);// It did match.. It should've..
1331 // Could the rest match the rest? (good question)
1332 tail = MatchSlow(rest,end,es,to);
1333 if(tail==end)
1334 break;// yup.
1335 // nope, try a shorter match for this one..
1336 stp=rest-1;
1337 ASSERT(stp>=sp);// It did work.. It should've..
1338 }
1339 ssub=ss+1;
1340 esub=es-1;
1341 // Did innards match?
1342 if(MatchSlow(sp,rest,ssub,esub)){
1343 dp = MatchDissect(sp,rest,ssub,esub);
1344 ASSERT(dp==rest);
1345 }else// nope..
1346 ASSERT(sp==rest);
1347 sp = rest;
1348 break;
1349 case CSop::opPlus0:
1350 stp=end;
1351 for(;;){
1352 // How long could this one be??
1353 rest = MatchSlow(sp,stp,ss,es);
1354 ASSERT(rest);// It did.. It should've..
1355 // Could the rest match the rest?
1356 tail = MatchSlow(rest,end,es,to);
1357 if(tail==end)
1358 break;// yup.
1359 // nope..
1360 stp=rest-1;
1361 ASSERT(stp>=sp);// It should've worked, we believe..
1362 }
1363 ssub=ss+1;
1364 esub=es-1;
1365 ssp=sp;
1366 oldssp=ssp;
1367 for(;;){// Find last match of innards..
1368 sep = MatchSlow(ssp,rest,ssub,esub);
1369 if((!sep) || sep==ssp)
1370 break; // Failed or matched nothin'
1371 oldssp=ssp;
1372 ssp=sep;
1373 }
1374 if(!sep){
1375 // Last successfull..
1376 sep=ssp;
1377 ssp=oldssp;
1378 }
1379 ASSERT(sep=rest);// Must exhaust substring they say..
1380 VERIFY(MatchSlow(ssp,sep,ssub,esub)==rest);// Assert or verify - that is the question..
1381 dp = MatchDissect(ssp,sep,ssub,esub);
1382 ASSERT(dp==sep);
1383 sp=rest;
1384 break;
1385 case CSop::opChoice0:
1386 stp = end;
1387 for(;;){
1388 // how long..
1389 rest = MatchSlow(sp,stp,ss,es);
1390 ASSERT(rest);
1391 // Could it..
1392 tail = MatchSlow(rest,end,es,to);
1393 if(tail==end)
1394 break;// y
1395 // n
1396 stp = rest-1;
1397 ASSERT(stp>=sp);
1398 }
1399 ssub=ss+1;
1400 esub=ss+m_Strip[ss].m_Operand-1;
1401 ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
1402 for(;;){// Find first matching branch..
1403 if(MatchSlow(sp,rest,ssub,esub)==rest)
1404 break;
1405 // this one missed, try next..
1406 ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
1407 esub++;
1408 ASSERT(m_Strip[esub].m_Operator==CSop::opOr1);
1409 ssub=esub+1;
1410 esub+=m_Strip[esub].m_Operand;
1411 if(m_Strip[esub].m_Operator==CSop::opOr1)
1412 esub--;
1413 else
1414 ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1);
1415 }
1416 dp = MatchDissect(sp,rest,ssub,esub);
1417 ASSERT(dp==rest);
1418 sp=rest;
1419 break;
1420 case CSop::opPlus1:
1421 case CSop::opQuest1:
1422 case CSop::opOr0:
1423 case CSop::opOr1:
1424 case CSop::opChoice1:
1425 ASSERT(FALSE);
1426 break;
1427 case CSop::opLeftParen:
1428 i = m_Strip[ss].m_Operand;
1429 ASSERT(0<i && i<=m_Subexps);
1430 m_Matches[i].m_Begin=sp-m_mBegin;
1431 break;
1432 case CSop::opRightParen:
1433 i = m_Strip[ss].m_Operand;
1434 ASSERT(0<i && i<=m_Subexps);
1435 m_Matches[i].m_End=sp-m_mBegin;
1436 break;
1437#ifdef _DEBUG
1438 default:// Uh.. oh..
1439 ASSERT(FALSE);
1440 break;
1441#endif
1442 }
1443 }
1444 ASSERT(sp==end);
1445 return sp;
1446}
1447
1448LPCTSTR CRegEx::MatchBackRef(LPCTSTR begin,LPCTSTR end,int from,int to,int level)
1449{
1450LPCTSTR sp = begin;
1451BOOL hard = FALSE;
1452 // Get as far as we can as long as it's easy
1453 for(int ss=from;!hard && ss<to;ss++){
1454 CSop s = m_Strip[ss];
1455 switch(s.m_Operator){
1456 case CSop::opChar:
1457 if(sp==end || *sp++ != s.m_Operand)
1458 return NULL;
1459 break;
1460 case CSop::opAny:
1461 if(sp==end)
1462 return NULL;
1463 sp++;// I'm sure this ++ could be embedded in previous expression..
1464 break;
1465 case CSop::opAnyOf:
1466 if(sp==end || !m_Sets[s.m_Operand].IsIn(*sp++))
1467 return NULL;
1468 break;
1469 case CSop::opBOL:
1470 if(!((sp==m_mBegin && !(m_mFlags&regNotBOL)) || (sp<m_mEnd && *(sp-1)=='\n' && (m_Flags&regNewLine))))
1471 return NULL;
1472 break;
1473 case CSop::opEOL:
1474 if(!((sp==m_mEnd && !(m_mFlags&regNotEOL)) || (sp<m_mEnd && *sp=='\n' && (m_Flags&regNewLine))))
1475 return NULL;
1476 break;
1477 case CSop::opBOW:
1478 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))))
1479 return NULL;
1480 break;
1481 case CSop::opEOW:
1482 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)))))
1483 return NULL;
1484 break;
1485 case CSop::opQuest1:
1486 break;
1487 case CSop::opOr0:// Matches null, but needs to skip
1488 ss++;
1489 s = m_Strip[ss];
1490 do{
1491 ASSERT(s.m_Operator==CSop::opOr1);
1492 ss+=s.m_Operand;
1493 }while((s=m_Strip[ss]).m_Operator!=CSop::opChoice1);
1494 // Now we should note that ss++ gets us past the Choice1..
1495 break;
1496 default:
1497 // Have to make a choice..
1498 hard=TRUE;
1499 break;
1500 }
1501 }
1502 if(!hard){// That was it..
1503 if(sp!=end)
1504 return NULL;
1505 return sp;
1506 }
1507 ss--;// Adjust for ther for's final increment..
1508 // Hard stuff.. is going on and on..
1509CSop s = m_Strip[ss];
1510int i, len, offsave;
1511int ssub,esub;
1512LPCTSTR ssp, dp;
1513 switch(s.m_Operator){
1514 case CSop::opBackRef0:// The vilest depths they say.. If I only knew what the 'viles' stands for..
1515 i = s.m_Operand;
1516 ASSERT(0<i && i<=m_Subexps);
1517 if(m_Matches[i].m_End<0)
1518 return NULL;
1519 ASSERT(m_Matches[i].m_Begin>=0);
1520 len = m_Matches[i].GetLength();
1521 ASSERT((end-m_mBegin)>=len);
1522 if(sp>end-len)
1523 return NULL;// Not enough left to match..
1524 ssp = m_mBegin+m_Matches[i].m_Begin;
1525 if(memcmp(sp,ssp,len))
1526 return NULL;
1527 while(m_Strip[ss]!=CSop(CSop::opBackRef1,i))
1528 ss++;
1529 return MatchBackRef(sp+len,end,ss+1,to,level-1);
1530 break;
1531 case CSop::opQuest0:// to null or not they wonder..
1532 dp = MatchBackRef(sp,end,ss+1,to,level);
1533 if(dp)
1534 return dp;// not..
1535 return MatchBackRef(sp,end,ss+s.m_Operand+1,to,level-1);
1536 break;
1537 case CSop::opPlus0:
1538 ASSERT(m_mLastPos.GetSize());
1539 ASSERT(level+1 <= m_Pluses);
1540 m_mLastPos[level+1]=sp;
1541 return MatchBackRef(sp,end,ss+1,to,level+1);
1542 break;
1543 case CSop::opPlus1:
1544 if(sp == m_mLastPos[level])// Last pass matched null
1545 return MatchBackRef(sp,end,ss+1,to,level-1);
1546 // Try another pass..
1547 m_mLastPos[level]=sp;
1548 dp = MatchBackRef(sp,end,ss-s.m_Operand+1,to,level);
1549 if(dp)
1550 return dp;
1551 return MatchBackRef(sp,end,ss+1,to,level-1);
1552 break;
1553 case CSop::opChoice0:// find the right one, ifany
1554 ssub = ss+1;
1555 esub = ss+s.m_Operand-1;
1556 ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
1557 for(;;){// Find first matching branch.
1558 dp = MatchBackRef(sp,end,ssub,esub,level);
1559 if(dp)
1560 return dp;
1561 // This one missed, try next one..
1562 if(m_Strip[esub].m_Operator==CSop::opChoice1)
1563 return NULL;// There is none..
1564 esub++;
1565 ASSERT(m_Strip[esub].m_Operator==CSop::opOr1);
1566 ssub=esub+1;
1567 esub+=m_Strip[esub].m_Operand;
1568 if(m_Strip[esub].m_Operator==CSop::opOr1)
1569 esub--;
1570 else
1571 ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1);
1572 }
1573 break;
1574 case CSop::opLeftParen:// Must undo assignment if rest fails..
1575 i = s.m_Operand;
1576 ASSERT(0<i && i<=m_Subexps);
1577 offsave = m_Matches[i].m_Begin;
1578 m_Matches[i].m_Begin = sp-m_mBegin;
1579 dp = MatchBackRef(sp,end,ss+1,to,level);
1580 if(dp)
1581 return dp;
1582 m_Matches[i].m_Begin=offsave;
1583 return NULL;
1584 break;
1585 case CSop::opRightParen: // Must undo assignment if rest fails..
1586 i = s.m_Operand;
1587 ASSERT(0<i && i<=m_Subexps);
1588 offsave = m_Matches[i].m_End;
1589 m_Matches[i].m_End = sp-m_mBegin;
1590 dp = MatchBackRef(sp,end,ss+1,to,level);
1591 if(dp)
1592 return dp;
1593 m_Matches[i].m_End = offsave;
1594 return NULL;
1595 break;
1596 #ifdef_DEBUG
1597 default:
1598 ASSERT(FALSE);
1599 break;
1600#endif
1601 }
1602 ASSERT(FALSE);
1603 return NULL;// Anyway - we can never get here..
1604}
1605
1606 #ifdef_DEBUG
1607void CRegEx::CSop::Dump(CDumpContext& dc)
1608{
1609 switch(m_Operator){
1610 case opEnd:
1611 dc << "end";
1612 break;
1613 case opChar:
1614 dc << "char('" << (char)m_Operand << "')";
1615 break;
1616 case opBOL:
1617 dc << "BOL";
1618 break;
1619 case opEOL:
1620 dc << "EOL";
1621 break;
1622 case opAny:
1623 dc << "any";
1624 break;
1625 case opAnyOf:
1626 dc << "anyOf(" << m_Operand << ")";
1627 break;
1628 case opBackRef0:
1629 dc << "[ backref(" << m_Operand << ")";
1630 break;
1631 case opBackRef1:
1632 dc << "] backref(" << m_Operand << ")";
1633 break;
1634 case opPlus0:
1635 dc << "[ + (" << m_Operand << ")";
1636 break;
1637 case opPlus1:
1638 dc << "] + (" << m_Operand << ")";
1639 break;
1640 case opQuest0:
1641 dc << "[ ? (" << m_Operand << ")";
1642 break;
1643 case opQuest1:
1644 dc << "] ? (" << m_Operand << ")";
1645 break;
1646 case opLeftParen:
1647 dc << "[ ( (" << m_Operand << ")";
1648 break;
1649 case opRightParen:
1650 dc << "] ) (" << m_Operand << ")";
1651 break;
1652 case opChoice0:
1653 dc << "[ choice (" << m_Operand << ")";
1654 break;
1655 case opOr0:
1656 dc << "[ | (" << m_Operand << ")";
1657 break;
1658 case opOr1:
1659 dc << "] | (" << m_Operand << ")";
1660 break;
1661 case opChoice1:
1662 dc << "] choice (" << m_Operand << ")";
1663 break;
1664 case opBOW:
1665 dc << "BOW";
1666 break;
1667 case opEOW:
1668 dc << "EOW";
1669 break;
1670 }
1671}
1672void CRegEx::DumpStrip(CDumpContext& dc)
1673{
1674 for(int tmp=0;tmp<m_Strip.GetSize();tmp++)
1675 dc << tmp << ": " << m_Strip[tmp] << ";\n";
1676}
1677#endif
1678
1679
1680CString CRegEx::GetMatch(int match)
1681{
1682CString rv;
1683 if(!m_Matches.GetSize())
1684 return rv;
1685 ASSERT(m_Matches[0].m_Begin<m_Input.GetLength() && m_Matches[0].m_End<=m_Input.GetLength());
1686 if(match==matchPreMatch)
1687 return m_Input.Left(m_Matches[0].m_Begin);
1688 if(match==matchPostMatch)
1689 return m_Input.Mid(m_Matches[0].m_End);
1690 if(match<0 || match >= m_Matches.GetSize())
1691 return rv;
1692 if(m_Matches[match].m_Begin<0 || m_Matches[match].m_End<0)
1693 return rv;
1694 ASSERT(m_Matches[match].m_Begin<m_Input.GetLength() && m_Matches[match].m_End<=m_Input.GetLength());
1695 rv = m_Input.Mid(m_Matches[match].m_Begin,m_Matches[match].m_End-m_Matches[match].m_Begin);
1696 return rv;
1697}
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 @@
1#ifndef __REGEX_H
2#define __REGEX_H
3
4 class CRegEx{
5public:
6 CString GetMatch(int match=0);
7 CString m_Input;
8 struct CMatch{
9 CMatch() : m_Begin(-1), m_End(-1) {}
10 int GetLength() { return m_End-m_Begin; }
11 int m_Begin;
12 int m_End;
13 };
14 typedefCArray<CMatch,CMatch&> CMatchBox;
15 enum{
16 matchMatch = 0,
17 matchPreMatch = -1,
18 matchPostMatch = -2
19 };
20 CMatchBox m_Matches;
21 enum{
22 charOut = 256,
23 charBOL, charEOL, charBOLEOL, charNothing, charBOW, charEOW,
24 charMaxCode = charEOW,
25 charNNChars = (charMaxCode-255)
26 };
27 int m_mFlags;
28 enum{
29 regeSuccess = 0,
30 regeNoMatch = 1, regeBadPattern, regeCollate, regeCType, regeEscape, regeSubReg, regeBracket,
31 regeParen, regeBrace, regeBadBrace, regeRange, regeSpace, regeBadRepeat, regeEmpty, regeAssert,
32 regeInvArg
33 };
34 int m_Error;
35 CRegEx();
36 BOOL m_bCompiled;
37 CString m_Pattern;
38 BOOL m_bBackRefs;
39 int m_Pluses;
40 CString m_Must;
41 BYTE m_Category[CHAR_MAX-CHAR_MIN+1];
42 int m_Categories;
43 int m_EOLs;
44 int m_BOLs;
45 int m_iFlags;
46 int m_Subexps;
47 struct CSop {
48 void Dump(CDumpContext& dc);
49 CSop(){}
50 CSop(BYTE op,DWORD opnd=0) : m_Operator(op), m_Operand(opnd) {}
51 BOOL operator==(CSop& other) {return m_Operator==other.m_Operator && m_Operand==other.m_Operand;}
52 BOOL operator!=(CSop& other) { return !((*this)==other);}
53 enum{
54 opEnd = 1, opChar, opBOL, opEOL, opAny, opAnyOf, opBackRef0, opBackRef1,
55 opPlus0, opPlus1, opQuest0, opQuest1, opLeftParen, opRightParen, opChoice0,
56 opOr0, opOr1, opChoice1, opBOW, opEOW
57 };
58 BYTE m_Operator;
59 DWORD m_Operand;
60 enum{
61 stCurrent = 1, stFresh = 2, stTemp = 4, stEmpty = 8
62 };
63 BYTE m_MatchData;
64 };
65 typedef CArray<CSop,CSop&> CStrip;
66 CStrip m_Strip;
67 int m_Flags;
68 struct CSet{
69 CSet() : m_Hash(0) { memset(m_Set,0,sizeof(m_Set)); }
70 CSet(CSet& src) { (*this)=src; }
71 CSet& operator=(CSet& src) { memmove(this,&src,sizeof(*this)); return *this; }
72 BOOL operator==(CSet& other) { if(m_Hash!=other.m_Hash)return FALSE;return !memcmp(m_Set,other.m_Set,sizeof(m_Set)); }
73 enum{
74 size = (CHAR_MAX-CHAR_MIN+1)
75 };
76 BOOL m_Set[size];
77 BYTE m_Hash;
78 public:
79 UCHAR GetOnly();
80 void Sub(UCHAR c);
81 BOOL IsIn(UCHAR c);
82 void Add(UCHAR c);
83 };
84 typedef CArray<CSet,CSet&> CSets;
85 CSets m_Sets;
86 enum{
87 // Compile flags
88 regBasic = 0, regExtended = 1,
89 regIgnoreCase = 2,
90 regNoSubExpressions = 4,// Also works for matching.
91 regNewLine = 16,
92 regLiteral = 32,
93 // Match Flags
94 regNotBOL = 1,
95 regNotEOL = 2,
96 regOneMatch=64,
97 regBackRefs=128,
98 // iFlags
99 iflagsUseBOL=1, iflagsUseEOL=2, iflagsBad=4
100 };
101 CString Replace(LPCTSTR src,LPCTSTR rep,int flags=0);
102 BOOL Match(LPCTSTR src,int flags=0);
103 BOOL Compile(LPCTSTR regex,int flags=0);
104private:
105 #ifdef_DEBUG
106 void DumpStrip(CDumpContext& dc);
107#endif
108 LPCTSTR MatchBackRef(LPCTSTR begin,LPCTSTR end,int from,int to,int level);
109 typedef CArray<LPCTSTR,LPCTSTR> CStrPtrArray;
110 CStrPtrArray m_mLastPos;
111 LPCTSTR MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to);
112 LPCTSTR MatchSlow(LPCTSTR begin,LPCTSTR end,int from,int to);
113 LPCTSTR m_cOldP;
114 BOOL MatchStatesEqual(BYTE m1,BYTE m2);
115 LPCTSTR m_mBegin;
116 void MatchStatesCopy(BYTE dst,BYTE src);
117 void MatchStep(int from,int to,BYTE maskBefore,int charCode,BYTE maskAfter);
118 void MatchStatesClear(BYTE mask);
119 LPCTSTR MatchFast(LPCTSTR begin);
120 LPCTSTR m_mEnd;
121 LPCTSTR m_mPointer;
122 BOOL ParseBREexp(BOOL ordinaryStar);
123 void ParseBRE(int stopa=0,int stopb=0);
124 void ParseLiteral();
125 int CountPluses();
126 void FigureMust();
127 BOOL IsInSameSets(UCHAR c1,UCHAR c2);
128 BOOL IsInSets(UCHAR c);
129 void Categorize();
130 int StripDuplicate(int from,int to);
131 void EmitRepeat(int pos,int from,int to);
132 UCHAR ParseBracketSymbol();
133 UCHAR ParseBracketCollatingElement(UCHAR term);
134 void ParseBracketEClass(CSet& cset);
135 void ParseBracketCClass(CSet& cset);
136 void ParseBracketTerm(CSet& cset);
137 int StoreSet(CSet& cset);
138 void ParseBracket();
139 int ParseCount();
140 void EmitNonNewLineAny();
141 void EmitOrdinary(UCHAR c);
142 void StripInsert(int pos,CSop& sop);
143 void ParseEREexp();
144 void ParseERE(int stop=0);
145 struct CParenthesis{
146 long m_Begin;
147 long m_End;
148 CParenthesis(long b=0,long e=0) : m_Begin(b), m_End(e) {}
149 };
150 typedef CArray<CParenthesis,CParenthesis&> CParens;
151 CParens m_ParseParens;
152 int m_ParsePointer;
153};
154 #ifdef_DEBUG
155inline CDumpContext& operator<<(CDumpContext& dc, CRegEx::CSop& sop) { sop.Dump(dc); return dc; }
156#endif
157
158#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 @@
1 #ifndef__SNMPEXTDLL_H
2#define __SNMPEXTDLL_H
3
4#include "snmpeer.h"
5
6#include <snmp.h>
7
8namespace Klever {
9
10 class CSNMPExtDLL : public CSNMPeer{
11public:
12 HINSTANCE m_hInstance;
13 HANDLE m_hEvent;
14 AsnObjectIdentifier m_OID;
15 BOOL (SNMP_FUNC_TYPE *m_extInit)(DWORD dw,HANDLE h,AsnObjectIdentifier* aoid);
16 BOOL (SNMP_FUNC_TYPE *m_extQuery)(BYTE b,RFC1157VarBindList* rvbl,AsnInteger* ai1,AsnInteger* ai2);
17 BOOL (SNMP_FUNC_TYPE *m_extTrap)(AsnObjectIdentifier*,AsnNetworkAddress*,AsnInteger*,AsnInteger*,AsnTimeticks*,RFC1157VarBindList*);
18
19 HINSTANCE m_hSNMPAPI;
20 void (SNMP_FUNC_TYPE *m_snmpOIDFree)(AsnObjectIdentifier*);
21 LPVOID (SNMP_FUNC_TYPE *m_snmpAlloc)(UINT);
22 void (SNMP_FUNC_TYPE *m_snmpFree)(LPVOID);
23 void (SNMP_FUNC_TYPE *m_snmpVBLFree)(RFC1157VarBindList* vbl);
24 void InitSNMP() {
25 m_hSNMPAPI = ::LoadLibraryEx("SNMPAPI",NULL,0);
26 if(!m_hSNMPAPI)
27 return;
28 *(FARPROC*)&m_snmpOIDFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilOidFree");
29 *(FARPROC*)&m_snmpAlloc = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemAlloc");
30 *(FARPROC*)&m_snmpFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemFree");
31 *(FARPROC*)&m_snmpVBLFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilVarBindListFree");
32 if(
33 (m_snmpFree && !m_snmpAlloc) ||
34 (m_snmpAlloc && !m_snmpFree)
35 )
36 DeinitSNMP();
37 }
38 void DeinitSNMP() {
39 if(!m_hSNMPAPI)
40 return;
41 ::FreeLibrary(m_hSNMPAPI);
42 m_hSNMPAPI=NULL;
43 }
44 void SNMPFreeOID(AsnObjectIdentifier* oid) {
45 if(m_hSNMPAPI && m_snmpOIDFree)
46 (*m_snmpOIDFree)(oid);
47 else
48 ::GlobalFree((HGLOBAL)oid->ids);
49 }
50 LPVOID SNMPAlloc(UINT size) {
51 if(m_hSNMPAPI && m_snmpAlloc)
52 return (*m_snmpAlloc)(size);
53 else
54 return ::GlobalAlloc(GMEM_FIXED,size);
55 }
56 void SNMPFree(LPVOID addr) {
57 if(m_hSNMPAPI && m_snmpFree)
58 (*m_snmpFree)(addr);
59 else
60 :: GlobalFree((HGLOBAL)addr);
61 }
62 void SNMPFreeVBL(RFC1157VarBindList& vbl) {
63 if(m_hSNMPAPI && m_snmpVBLFree)
64 (*m_snmpVBLFree)(&vbl);
65 else{
66 for(UINT tmp=0;tmp<vbl.len;tmp++) {
67 SNMPFree(vbl.list[tmp].name.ids);
68 switch(vbl.list[tmp].value.asnType){
69 case ASN_OCTETSTRING:
70 case ASN_SEQUENCE:
71 case ASN_RFC1155_IPADDRESS:
72 case ASN_RFC1155_OPAQUE:
73 // case ASN_RFC1213_DISPSTRING:
74 if(vbl.list[tmp].value.asnValue.arbitrary.dynamic)
75 SNMPFree(vbl.list[tmp].value.asnValue.arbitrary.stream);
76 break;
77 case ASN_OBJECTIDENTIFIER:
78 SNMPFree(vbl.list[tmp].value.asnValue.object.ids);
79 break;
80 default:
81 break;
82 }
83 }
84 SNMPFree(vbl.list);
85 }
86 }
87
88 BOOL SNMPBuildVBL(RFC1157VarBindList& vbl,CSNMPVarBindList& in) {
89 vbl.len = in.GetCount();
90 vbl.list = (RFC1157VarBind*)SNMPAlloc(sizeof(RFC1157VarBind)*vbl.len);
91 POSITION p = in.GetHeadPosition();
92 UINT ptr = 0;
93 while(p){
94 CSNMPVarBind& vb = in.GetNext(p);
95 ASSERT(ptr<vbl.len);
96 SNMPBuildVB(vbl.list[ptr++],vb);
97 }
98 return TRUE;
99 }
100 BOOL SNMPBuildVB(RFC1157VarBind& vb,CSNMPVarBind& in) {
101 ASSERT(in.name.type==CASNAny::typeASNOID);
102 return SNMPBuildOID(vb.name,in.name.value.oid) && SNMPBuildAA(vb.value,in.value);
103 }
104 BOOL SNMPBuildAA(AsnAny& aa,CASNAny& in) {
105 aa.asnType=in.type;
106 switch(in.type) {
107 case CASNAny::typeASNInteger:
108 aa.asnValue.number=in.value.number; break;
109 case CASNAny::typeASNOctetString:
110 // case CASNAny::typeASNDispString:
111 SNMPBuildOS(aa.asnValue.string,in.value.string); break;
112 case CASNAny::typeASNNull:
113 break;
114 case CASNAny::typeASNOID:
115 SNMPBuildOID(aa.asnValue.object,in.value.oid); break;
116 case CASNAny::typeASNSequence:
117 // case CASNAny::typeASNSequenceOf:
118 SNMPBuildOS(aa.asnValue.sequence,in.value.sequence); break;
119 case CASNAny::typeASNIP:
120 SNMPBuildFLOS(aa.asnValue.address,(LPBYTE)&in.value.ip,sizeof(in.value.ip)); break;
121 case CASNAny::typeASNCounter:
122 aa.asnValue.counter = in.value.counter; break;
123 case CASNAny::typeASNGauge:
124 aa.asnValue.gauge = in.value.gauge; break;
125 case CASNAny::typeASNTicks:
126 aa.asnValue.ticks = in.value.ticks; break;
127 case CASNAny::typeASNOpaque:
128 ASSERT(in.storeType==CASNAny::storeDynamic);
129 SNMPBuildOS(aa.asnValue.arbitrary,in.value.data); break;
130 break;
131 default:
132 ASSERT(FALSE);
133 return FALSE;
134 }
135 return TRUE;
136 }
137 BOOL SNMPBuildOS(AsnOctetString& os,CASNAny::asnOctetString& in) {
138 return SNMPBuildFLOS(os,in.data,in.size);
139 }
140 BOOL SNMPBuildOID(AsnObjectIdentifier& oid,CASNAny::asnOID& in) {
141 oid.idLength = in.size/sizeof(UINT);
142 ASSERT(!(in.size%sizeof(UINT)));
143 VERIFY(oid.ids = (UINT*)SNMPAlloc(in.size));
144 memmove(oid.ids,in.data,in.size);
145 return TRUE;
146 }
147 BOOL SNMPBuildFLOS(AsnOctetString& os,LPBYTE data,UINT size) {
148 os.length = size;
149 VERIFY(os.stream = (BYTE*)SNMPAlloc(os.length));
150 os.dynamic=TRUE;
151 memmove(os.stream,data,size);
152 return TRUE;
153 }
154 BOOL SNMPParseVBL(RFC1157VarBindList& vbl,CSNMPVarBindList& ou) {
155 for(UINT tmp=0;tmp<vbl.len;tmp++){
156 CSNMPVarBind vb;
157 SNMPParseVB(vbl.list[tmp],vb);
158 ou.AddTail(vb);
159 }
160 return TRUE;
161 }
162 BOOL SNMPParseVB(RFC1157VarBind& vb,CSNMPVarBind& ou) {
163 ou.name.Set(CASNAny::typeASNOID,(LPBYTE)vb.name.ids,vb.name.idLength*sizeof(UINT));
164 return SNMPParseAA(vb.value,ou.value);
165 }
166 BOOL SNMPParseAA(AsnAny& aa,CASNAny& ou) {
167 switch(aa.asnType){
168 case ASN_INTEGER:
169 ou.Set(CASNAny::typeASNInteger,aa.asnValue.number); break;
170 case ASN_OCTETSTRING:
171 // case ASN_RFC1213_DISPSTRING:
172 ou.Set(CASNAny::typeASNOctetString,aa.asnValue.string.stream,aa.asnValue.string.length); break;
173 case ASN_OBJECTIDENTIFIER:
174 ou.Set(CASNAny::typeASNOID,(LPBYTE)aa.asnValue.object.ids,aa.asnValue.object.idLength);
175 SNMPParseOID(aa.asnValue.object,ou.value.oid); break;
176 case ASN_SEQUENCE:
177 ou.Set(CASNAny::typeASNSequence,aa.asnValue.sequence.stream,aa.asnValue.sequence.length); break;
178 case ASN_RFC1155_IPADDRESS:
179 SNMPParseIP(aa.asnValue.address,ou); break;
180 case ASN_RFC1155_COUNTER:
181 ou.Set(CASNAny::typeASNCounter,(LONG)aa.asnValue.counter); break;
182 case ASN_RFC1155_GAUGE:
183 ou.Set(CASNAny::typeASNGauge,(LONG)aa.asnValue.gauge); break;
184 case ASN_RFC1155_TIMETICKS:
185 ou.Set(CASNAny::typeASNTicks,(LONG)aa.asnValue.ticks); break;
186 case ASN_RFC1155_OPAQUE:
187 ou.Set(CASNAny::typeASNOpaque,aa.asnValue.arbitrary.stream,aa.asnValue.arbitrary.length); break;
188 case ASN_NULL:
189 ou.Free(); break;
190 default:
191 ASSERT(FALSE);
192 return FALSE;
193 }
194 return TRUE;
195 }
196 BOOL SNMPParseOID(AsnObjectIdentifier& oid,CASNAny::asnOID& ou) {
197 ASSERT(ou.size==(oid.idLength*sizeof(UINT)));
198 memmove(ou.data,oid.ids,ou.size);
199 return TRUE;
200 }
201 BOOL SNMPParseIP(AsnIPAddress& ip,CASNAny& ou) {
202 in_addr i;
203 if(ip.length>sizeof(i))
204 return FALSE;
205 i.s_addr=0;
206 memmove(&i,ip.stream,ip.length);
207 ou.Set(i);
208 return TRUE;
209 }
210
211
212 CSNMPExtDLL(LPCTSTR dllName) : m_hInstance(NULL) { InitSNMP(); Init(dllName); }
213 ~CSNMPExtDLL() { Deinit(); DeinitSNMP(); }
214
215 BOOL Init(LPCTSTR dllName) {
216 Deinit();
217 m_hInstance = ::LoadLibraryEx(dllName,NULL,0);
218 if(!m_hInstance)
219 return FALSE;
220 *(FARPROC*)&m_extInit = ::GetProcAddress(m_hInstance,"SnmpExtensionInit");
221 *(FARPROC*)&m_extQuery = ::GetProcAddress(m_hInstance,"SnmpExtensionQuery");
222 *(FARPROC*)&m_extTrap = ::GetProcAddress(m_hInstance,"SnmpExtensionTrap");
223 if(!(m_extInit && m_extQuery && m_extTrap)){
224 Deinit();
225 return FALSE;
226 }
227 if(!((*m_extInit)(GetCurrentTime(),&m_hEvent,&m_OID))){
228 Deinit();
229 return FALSE;
230 }
231 return TRUE;
232 }
233 void Deinit() {
234 if(!m_hInstance)
235 return;
236 ::FreeLibrary(m_hInstance);
237 }
238 virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) {
239 RFC1157VarBindList vbl;
240 SNMPBuildVBL(vbl,in);
241 AsnInteger errorStatus, errorIndex;
242 (*m_extQuery)(type,&vbl,&errorStatus,&errorIndex);
243 ou.RemoveAll();
244 SNMPParseVBL(vbl,ou);
245 SNMPFreeVBL(vbl);
246 return TRUE;
247 }
248};
249
250};
251
252 #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 @@
1 #ifndef__SNMPOIDS_H
2 #define__SNMPOIDS_H
3
4 #define DEFINE_OID(name,oid)static UINT name[] = oid
5
6 // MIB-II OIDs
7
8#define OIDccitt {0}
9#define OIDnull {0,0}
10#define OIDiso {1}
11#define OIDorg {1,3}
12#define OIDdod {1,3,6}
13#define OIDinternet {1,3,6,1}
14#define OIDdirectory {1,3,6,1,1}
15#define OIDmgmt {1,3,6,1,2}
16#define OIDmib_2 {1,3,6,1,2,1}
17#define OIDsystem {1,3,6,1,2,1,1}
18#define OIDsysDescr {1,3,6,1,2,1,1,1}
19#define OIDsysObjectID {1,3,6,1,2,1,1,2}
20#define OIDsysUpTime {1,3,6,1,2,1,1,3}
21#define OIDsysContact {1,3,6,1,2,1,1,4}
22#define OIDsysName {1,3,6,1,2,1,1,5}
23#define OIDsysLocation {1,3,6,1,2,1,1,6}
24#define OIDsysServices {1,3,6,1,2,1,1,7}
25#define OIDtransmission {1,3,6,1,2,1,10}
26#define OIDsnmp {1,3,6,1,2,1,11}
27#define OIDsnmpInPkts {1,3,6,1,2,1,11,1}
28#define OIDsnmpInBadValues {1,3,6,1,2,1,11,10}
29#define OIDsnmpInReadOnlys {1,3,6,1,2,1,11,11}
30#define OIDsnmpInGenErrs {1,3,6,1,2,1,11,12}
31#define OIDsnmpInTotalReqVars {1,3,6,1,2,1,11,13}
32#define OIDsnmpInTotalSetVars {1,3,6,1,2,1,11,14}
33#define OIDsnmpInGetRequests {1,3,6,1,2,1,11,15}
34#define OIDsnmpInGetNexts {1,3,6,1,2,1,11,16}
35#define OIDsnmpInSetRequests {1,3,6,1,2,1,11,17}
36#define OIDsnmpInGetResponses {1,3,6,1,2,1,11,18}
37#define OIDsnmpInTraps {1,3,6,1,2,1,11,19}
38#define OIDsnmpOutPkts {1,3,6,1,2,1,11,2}
39#define OIDsnmpOutTooBigs {1,3,6,1,2,1,11,20}
40#define OIDsnmpOutNoSuchNames {1,3,6,1,2,1,11,21}
41#define OIDsnmpOutBadValues {1,3,6,1,2,1,11,22}
42#define OIDsnmpOutGenErrs {1,3,6,1,2,1,11,24}
43#define OIDsnmpOutGetRequests {1,3,6,1,2,1,11,25}
44#define OIDsnmpOutGetNexts {1,3,6,1,2,1,11,26}
45#define OIDsnmpOutSetRequests {1,3,6,1,2,1,11,27}
46#define OIDsnmpOutGetResponses {1,3,6,1,2,1,11,28}
47#define OIDsnmpOutTraps {1,3,6,1,2,1,11,29}
48#define OIDsnmpInBadVersions {1,3,6,1,2,1,11,3}
49#define OIDsnmpEnableAuthenTraps {1,3,6,1,2,1,11,30}
50#define OIDsnmpInBadCommunityNames {1,3,6,1,2,1,11,4}
51#define OIDsnmpInBadCommunityUses {1,3,6,1,2,1,11,5}
52#define OIDsnmpInASNParseErrs {1,3,6,1,2,1,11,6}
53#define OIDsnmpInTooBigs {1,3,6,1,2,1,11,8}
54#define OIDsnmpInNoSuchNames {1,3,6,1,2,1,11,9}
55#define OIDinterfaces {1,3,6,1,2,1,2}
56#define OIDifNumber {1,3,6,1,2,1,2,1}
57#define OIDifTable {1,3,6,1,2,1,2,2}
58#define OIDifEntry {1,3,6,1,2,1,2,2,1}
59#define OIDifIndex {1,3,6,1,2,1,2,2,1,1}
60#define OIDifInOctets {1,3,6,1,2,1,2,2,1,10}
61#define OIDifInUcastPkts {1,3,6,1,2,1,2,2,1,11}
62#define OIDifInNUcastPkts {1,3,6,1,2,1,2,2,1,12}
63#define OIDifInDiscards {1,3,6,1,2,1,2,2,1,13}
64#define OIDifInErrors {1,3,6,1,2,1,2,2,1,14}
65#define OIDifInUnknownProtos {1,3,6,1,2,1,2,2,1,15}
66#define OIDifOutOctets {1,3,6,1,2,1,2,2,1,16}
67#define OIDifOutUcastPkts {1,3,6,1,2,1,2,2,1,17}
68#define OIDifOutNUcastPkts {1,3,6,1,2,1,2,2,1,18}
69#define OIDifOutDiscards {1,3,6,1,2,1,2,2,1,19}
70#define OIDifDescr {1,3,6,1,2,1,2,2,1,2}
71#define OIDifOutErrors {1,3,6,1,2,1,2,2,1,20}
72#define OIDifOutQLen {1,3,6,1,2,1,2,2,1,21}
73#define OIDifSpecific {1,3,6,1,2,1,2,2,1,22}
74#define OIDifType {1,3,6,1,2,1,2,2,1,3}
75#define OIDifMtu {1,3,6,1,2,1,2,2,1,4}
76#define OIDifSpeed {1,3,6,1,2,1,2,2,1,5}
77#define OIDifPhysAddress {1,3,6,1,2,1,2,2,1,6}
78#define OIDifAdminStatus {1,3,6,1,2,1,2,2,1,7}
79#define OIDifOperStatus {1,3,6,1,2,1,2,2,1,8}
80#define OIDifLastChange {1,3,6,1,2,1,2,2,1,9}
81#define OIDat {1,3,6,1,2,1,3}
82#define OIDatTable {1,3,6,1,2,1,3,1}
83#define OIDatEntry {1,3,6,1,2,1,3,1,1}
84#define OIDatIfIndex {1,3,6,1,2,1,3,1,1,1}
85#define OIDatPhysAddress {1,3,6,1,2,1,3,1,1,2}
86#define OIDatNetAddress {1,3,6,1,2,1,3,1,1,3}
87#define OIDip {1,3,6,1,2,1,4}
88#define OIDipForwarding {1,3,6,1,2,1,4,1}
89#define OIDipOutRequests {1,3,6,1,2,1,4,10}
90#define OIDipOutDiscards {1,3,6,1,2,1,4,11}
91#define OIDipOutNoRoutes {1,3,6,1,2,1,4,12}
92#define OIDipReasmTimeout {1,3,6,1,2,1,4,13}
93#define OIDipReasmReqds {1,3,6,1,2,1,4,14}
94#define OIDipReasmOKs {1,3,6,1,2,1,4,15}
95#define OIDipReasmFails {1,3,6,1,2,1,4,16}
96#define OIDipFragOKs {1,3,6,1,2,1,4,17}
97#define OIDipFragFails {1,3,6,1,2,1,4,18}
98#define OIDipFragCreates {1,3,6,1,2,1,4,19}
99#define OIDipDefaultTTL {1,3,6,1,2,1,4,2}
100#define OIDipAddrTable {1,3,6,1,2,1,4,20}
101#define OIDipAddrEntry {1,3,6,1,2,1,4,20,1}
102#define OIDipAdEntAddr {1,3,6,1,2,1,4,20,1,1}
103#define OIDipAdEntIfIndex {1,3,6,1,2,1,4,20,1,2}
104#define OIDipAdEntNetMask {1,3,6,1,2,1,4,20,1,3}
105#define OIDipAdEntBcastAddr {1,3,6,1,2,1,4,20,1,4}
106#define OIDipAdEntReasmMaxSize {1,3,6,1,2,1,4,20,1,5}
107#define OIDipRouteTable {1,3,6,1,2,1,4,21}
108#define OIDipRouteEntry {1,3,6,1,2,1,4,21,1}
109#define OIDipRouteDest {1,3,6,1,2,1,4,21,1,1}
110#define OIDipRouteAge {1,3,6,1,2,1,4,21,1,10}
111#define OIDipRouteMask {1,3,6,1,2,1,4,21,1,11}
112#define OIDipRouteMetric5 {1,3,6,1,2,1,4,21,1,12}
113#define OIDipRouteInfo {1,3,6,1,2,1,4,21,1,13}
114#define OIDipRouteIfIndex {1,3,6,1,2,1,4,21,1,2}
115#define OIDipRouteMetric1 {1,3,6,1,2,1,4,21,1,3}
116#define OIDipRouteMetric2 {1,3,6,1,2,1,4,21,1,4}
117#define OIDipRouteMetric3 {1,3,6,1,2,1,4,21,1,5}
118#define OIDipRouteMetric4 {1,3,6,1,2,1,4,21,1,6}
119#define OIDipRouteNextHop {1,3,6,1,2,1,4,21,1,7}
120#define OIDipRouteType {1,3,6,1,2,1,4,21,1,8}
121#define OIDipRouteProto {1,3,6,1,2,1,4,21,1,9}
122#define OIDipNetToMediaTable {1,3,6,1,2,1,4,22}
123#define OIDipNetToMediaEntry {1,3,6,1,2,1,4,22,1}
124#define OIDipNetToMediaIfIndex {1,3,6,1,2,1,4,22,1,1}
125#define OIDipNetToMediaPhysAddress {1,3,6,1,2,1,4,22,1,2}
126#define OIDipNetToMediaNetAddress {1,3,6,1,2,1,4,22,1,3}
127#define OIDipNetToMediaType {1,3,6,1,2,1,4,22,1,4}
128#define OIDipRoutingDiscards {1,3,6,1,2,1,4,23}
129#define OIDipInReceives {1,3,6,1,2,1,4,3}
130#define OIDipInHdrErrors {1,3,6,1,2,1,4,4}
131#define OIDipInAddrErrors {1,3,6,1,2,1,4,5}
132#define OIDipForwDatagrams {1,3,6,1,2,1,4,6}
133#define OIDipInUnknownProtos {1,3,6,1,2,1,4,7}
134#define OIDipInDiscards {1,3,6,1,2,1,4,8}
135#define OIDipInDelivers {1,3,6,1,2,1,4,9}
136#define OIDicmp {1,3,6,1,2,1,5}
137#define OIDicmpInMsgs {1,3,6,1,2,1,5,1}
138#define OIDicmpInTimestamps {1,3,6,1,2,1,5,10}
139#define OIDicmpInTimestampReps {1,3,6,1,2,1,5,11}
140#define OIDicmpInAddrMasks {1,3,6,1,2,1,5,12}
141#define OIDicmpInAddrMaskReps {1,3,6,1,2,1,5,13}
142#define OIDicmpOutMsgs {1,3,6,1,2,1,5,14}
143#define OIDicmpOutErrors {1,3,6,1,2,1,5,15}
144#define OIDicmpOutDestUnreachs {1,3,6,1,2,1,5,16}
145#define OIDicmpOutTimeExcds {1,3,6,1,2,1,5,17}
146#define OIDicmpOutParmProbs {1,3,6,1,2,1,5,18}
147#define OIDicmpOutSrcQuenchs {1,3,6,1,2,1,5,19}
148#define OIDicmpInErrors {1,3,6,1,2,1,5,2}
149#define OIDicmpOutRedirects {1,3,6,1,2,1,5,20}
150#define OIDicmpOutEchos {1,3,6,1,2,1,5,21}
151#define OIDicmpOutEchoReps {1,3,6,1,2,1,5,22}
152#define OIDicmpOutTimestamps {1,3,6,1,2,1,5,23}
153#define OIDicmpOutTimestampReps {1,3,6,1,2,1,5,24}
154#define OIDicmpOutAddrMasks {1,3,6,1,2,1,5,25}
155#define OIDicmpOutAddrMaskReps {1,3,6,1,2,1,5,26}
156#define OIDicmpInDestUnreachs {1,3,6,1,2,1,5,3}
157#define OIDicmpInTimeExcds {1,3,6,1,2,1,5,4}
158#define OIDicmpInParmProbs {1,3,6,1,2,1,5,5}
159#define OIDicmpInSrcQuenchs {1,3,6,1,2,1,5,6}
160#define OIDicmpInRedirects {1,3,6,1,2,1,5,7}
161#define OIDicmpInEchos {1,3,6,1,2,1,5,8}
162#define OIDicmpInEchoReps {1,3,6,1,2,1,5,9}
163#define OIDtcp {1,3,6,1,2,1,6}
164#define OIDtcpRtoAlgorithm {1,3,6,1,2,1,6,1}
165#define OIDtcpInSegs {1,3,6,1,2,1,6,10}
166#define OIDtcpOutSegs {1,3,6,1,2,1,6,11}
167#define OIDtcpRetransSegs {1,3,6,1,2,1,6,12}
168#define OIDtcpConnTable {1,3,6,1,2,1,6,13}
169#define OIDtcpConnEntry {1,3,6,1,2,1,6,13,1}
170#define OIDtcpConnState {1,3,6,1,2,1,6,13,1,1}
171#define OIDtcpConnLocalAddress {1,3,6,1,2,1,6,13,1,2}
172#define OIDtcpConnLocalPort {1,3,6,1,2,1,6,13,1,3}
173#define OIDtcpConnRemAddress {1,3,6,1,2,1,6,13,1,4}
174#define OIDtcpConnRemPort {1,3,6,1,2,1,6,13,1,5}
175#define OIDtcpInErrs {1,3,6,1,2,1,6,14}
176#define OIDtcpOutRsts {1,3,6,1,2,1,6,15}
177#define OIDtcpRtoMin {1,3,6,1,2,1,6,2}
178#define OIDtcpRtoMax {1,3,6,1,2,1,6,3}
179#define OIDtcpMaxConn {1,3,6,1,2,1,6,4}
180#define OIDtcpActiveOpens {1,3,6,1,2,1,6,5}
181#define OIDtcpPassiveOpens {1,3,6,1,2,1,6,6}
182#define OIDtcpAttemptFails {1,3,6,1,2,1,6,7}
183#define OIDtcpEstabResets {1,3,6,1,2,1,6,8}
184#define OIDtcpCurrEstab {1,3,6,1,2,1,6,9}
185#define OIDudp {1,3,6,1,2,1,7}
186#define OIDudpInDatagrams {1,3,6,1,2,1,7,1}
187#define OIDudpNoPorts {1,3,6,1,2,1,7,2}
188#define OIDudpInErrors {1,3,6,1,2,1,7,3}
189#define OIDudpOutDatagrams {1,3,6,1,2,1,7,4}
190#define OIDudpTable {1,3,6,1,2,1,7,5}
191#define OIDudpEntry {1,3,6,1,2,1,7,5,1}
192#define OIDudpLocalAddress {1,3,6,1,2,1,7,5,1,1}
193#define OIDudpLocalPort {1,3,6,1,2,1,7,5,1,2}
194#define OIDegp {1,3,6,1,2,1,8}
195#define OIDegpInMsgs {1,3,6,1,2,1,8,1}
196#define OIDegpInErrors {1,3,6,1,2,1,8,2}
197#define OIDegpOutMsgs {1,3,6,1,2,1,8,3}
198#define OIDegpOutErrors {1,3,6,1,2,1,8,4}
199#define OIDegpNeighTable {1,3,6,1,2,1,8,5}
200#define OIDegpNeighEntry {1,3,6,1,2,1,8,5,1}
201#define OIDegpNeighState {1,3,6,1,2,1,8,5,1,1}
202#define OIDegpNeighStateUps {1,3,6,1,2,1,8,5,1,10}
203#define OIDegpNeighStateDowns {1,3,6,1,2,1,8,5,1,11}
204#define OIDegpNeighIntervalHello {1,3,6,1,2,1,8,5,1,12}
205#define OIDegpNeighIntervalPoll {1,3,6,1,2,1,8,5,1,13}
206#define OIDegpNeighMode {1,3,6,1,2,1,8,5,1,14}
207#define OIDegpNeighEventTrigger {1,3,6,1,2,1,8,5,1,15}
208#define OIDegpNeighAddr {1,3,6,1,2,1,8,5,1,2}
209#define OIDegpNeighAs {1,3,6,1,2,1,8,5,1,3}
210#define OIDegpNeighInMsgs {1,3,6,1,2,1,8,5,1,4}
211#define OIDegpNeighInErrs {1,3,6,1,2,1,8,5,1,5}
212#define OIDegpNeighOutMsgs {1,3,6,1,2,1,8,5,1,6}
213#define OIDegpNeighOutErrs {1,3,6,1,2,1,8,5,1,7}
214#define OIDegpNeighInErrMsgs {1,3,6,1,2,1,8,5,1,8}
215#define OIDegpNeighOutErrMsgs {1,3,6,1,2,1,8,5,1,9}
216#define OIDegpAs {1,3,6,1,2,1,8,6}
217#define OIDexperimental {1,3,6,1,3}
218#define OIDprivate {1,3,6,1,4}
219#define OIDenterprises {1,3,6,1,4,1}
220
221 #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 @@
1 #ifndef__SNMPEER_H
2#define __SNMPEER_H
3
4namespace Klever {
5
6 class CASNAny{
7public:
8 enum{
9 asnCls = 0xC0,
10 asnClsUniversal = 0x00,
11 asnClsApplication = 0x40,
12 asnClsContextSpecific = 0x80,
13 asnClsPrivate = 0xC0,
14 asnConstructed = 0x20,
15 asnPrimitive = 0x00,
16 asnTag = 0x1F,
17 // ASN.1 Primitive Tags
18 asnTagInteger = 0x02,
19 asnTagOctetString = 0x04,
20 asnTagNull = 0x05,
21 asnTagOID = 0x06,
22 // ASN.1 Constructed Tags
23 asnTagSequence = 0x10,
24 // RFC1155 Primitive Tags
25 asnTagIP = 0x00,
26 asnTagCounter = 0x01,
27 asnTagGauge = 0x02,
28 asnTagTicks = 0x03,
29 asnTagOpaque = 0x04,
30 // RFC1213 alias
31 asnTagDispString = 0x04,// (ASN.1 Octet string)
32 // RFC1157 Constructed Tags
33 asnTagGetRequest = 0x00,
34 asnTagGetNextRequest = 0x01,
35 asnTagGetResponse = 0x02,
36 asnTagSetRequest = 0x03,
37 asnTagTrap = 0x04
38 };
39 enum{
40 typeASNInteger = (asnClsUniversal|asnPrimitive|asnTagInteger),
41 typeASNOctetString = (asnClsUniversal|asnPrimitive|asnTagOctetString),
42 typeASNNull = (asnClsUniversal|asnPrimitive|asnTagNull),
43 typeASNOID = (asnClsUniversal|asnPrimitive|asnTagOID),
44
45 typeASNSequence = (asnClsUniversal|asnConstructed|asnTagSequence),
46 typeASNSequenceOf = (asnClsUniversal|asnConstructed|asnTagSequence),
47
48 typeASNIP = (asnClsApplication|asnPrimitive|asnTagIP),
49 typeASNCounter = (asnClsApplication|asnPrimitive|asnTagCounter),
50 typeASNGauge = (asnClsApplication|asnPrimitive|asnTagGauge),
51 typeASNTicks = (asnClsApplication|asnPrimitive|asnTagTicks),
52 typeASNOpaque = (asnClsApplication|asnPrimitive|asnTagOpaque),
53 typeASNDispString = (asnClsUniversal|asnPrimitive|asnTagOctetString),
54
55 typeASNGetRequest = (asnClsContextSpecific|asnConstructed|asnTagGetRequest),
56 typeASNGetNextRequest = (asnClsContextSpecific|asnConstructed|asnTagGetNextRequest),
57 typeASNGetResponse = (asnClsContextSpecific|asnConstructed|asnTagGetResponse),
58 typeASNSetRequest = (asnClsContextSpecific|asnConstructed|asnTagSetRequest),
59 typeASNTrap = (asnClsContextSpecific|asnConstructed|asnTagTrap)
60 };
61
62 typedefLONG asnInteger;
63 typedef LARGE_INTEGER asnInteger64;
64 typedefDWORD asnCounter;
65 typedef ULARGE_INTEGER asnCounter64;
66 typedef DWORD asnGauge;
67 typedef ULARGE_INTEGER asnGauge64;
68 typedefDWORD asnTicks;
69 typedef ULARGE_INTEGER asnTicks64;
70 struct asnDynamic{
71 UINT size;
72 LPBYTE data;
73 BOOL Allocate(UINT size) {
74 BOOL rv = Free();
75 if(size)
76 rv=rv&&(data=new BYTE[size]);
77 if(rv)
78 asnDynamic::size=size;
79 return rv;
80 }
81 BOOL Set(LPBYTE data,UINT size) {
82 BOOL rv = Allocate(size);
83 if(rv && size)
84 memmove(asnDynamic::data,data,size);
85 return rv;
86 }
87 BOOL Free() {
88 if(!size)
89 return TRUE;
90 delete data;
91 size=0;
92 data=0;
93 return TRUE;
94 }
95 void Clean() {
96 size=0;
97 data=0;
98 }
99 BOOL Copy(asnDynamic& src) {
100 BOOL rv = Free();
101 if(rv){
102 if(src.size)
103 rv=rv&&(data = new BYTE[src.size]);
104 if(rv){
105 if(size=src.size)
106 memmove(data,src.data,size);
107 }
108 }
109 return rv;
110 }
111 };
112 typedefasnDynamic asnOctetString;
113 typedef asnDynamic asnOID;
114 typedef in_addr asnIP;
115 typedef asnDynamic asnSequence;
116
117 BYTE type;
118 enum _storeType{
119 storeDynamic,
120 storeStatic
121 }storeType;
122 union{
123 asnInteger number;
124 asnInteger64 number64;
125 asnOctetString string;
126 asnOID oid;
127 asnSequence sequence;
128 asnIP ip;
129 asnCounter counter;
130 asnCounter64 counter64;
131 asnGauge gauge;
132 asnGauge64 gauge64;
133 asnTicks ticks;
134 asnTicks64 ticks64;
135 asnDynamic data;
136 } value;
137
138 CASNAny() : type(typeASNNull), storeType(storeStatic) { value.data.Clean(); }
139 CASNAny(CASNAny& src) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Copy(src); }
140 CASNAny(BYTE type) : type(type), storeType(storeStatic) { value.data.Clean(); }
141 CASNAny(BYTE type,LONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); }
142 CASNAny(BYTE type,LONGLONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); }
143 CASNAny(BYTE type,LPCTSTR string) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,string); }
144 CASNAny(BYTE type,LPBYTE data,UINT length) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,data,length); }
145 CASNAny(BYTE type,UINT* data,UINT size) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,(LPBYTE)data,size); }
146 CASNAny(in_addr& ip) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(ip); }
147 ~CASNAny() { Free(); }
148
149 BOOL Set(BYTE type) {
150 BOOL rv = Free();
151 CASNAny::type=type;
152 return rv;
153 }
154 BOOL Set(BYTE type,LONG number) {
155 BOOL rv = Free();
156 CASNAny::type=type;
157 value.number=number;
158 storeType=storeStatic;
159 return rv;
160 }
161 BOOL Set(BYTE type,LONGLONG number) {
162 BOOL rv = Free();
163 CASNAny::type=type;
164 value.number64.QuadPart = number;
165 storeType=storeStatic;
166 return rv;
167 }
168 BOOL Set(BYTE type,LPCTSTR string) {
169 BOOL rv = Free();
170 CASNAny::type=type;
171 rv=rv&&value.string.Set((LPBYTE)string,strlen(string)+1);
172 if(rv){
173 value.string.size--;
174 storeType=storeDynamic;
175 }
176 return rv;
177 }
178 BOOL Set(BYTE type,LPBYTE data,UINT length) {
179 BOOL rv = Free();
180 CASNAny::type=type;
181 rv=rv&&value.data.Set(data,length);
182 if(rv)
183 storeType=storeDynamic;
184 return rv;
185 }
186 BOOL Set(in_addr& ip) {
187 BOOL rv = Free();
188 memmove(&value.ip,&ip,sizeof(value.ip));
189 type=typeASNIP;
190 storeType=storeStatic;
191 return rv;
192 }
193 BOOL Free() {
194 if(storeType==storeDynamic)
195 value.data.Free();
196 else{
197 memset(&value,0,sizeof(value));
198 value.data.Clean();
199 }
200 storeType=storeStatic;
201 type=typeASNNull;
202 return TRUE;
203 }
204 BOOL Copy(CASNAny& src) {
205 BOOL rv = Free();
206 if(src.storeType==storeDynamic){
207 rv=rv&&value.data.Copy(src.value.data);
208 if(rv){
209 type=src.type;
210 storeType=src.storeType;
211 }
212 }else{
213 memmove(this,&src,sizeof(*this));
214 }
215 return rv;
216 }
217 CASNAny& operator=(CASNAny& src) {
218 VERIFY(Copy(src));
219 return *this;
220 }
221
222 // High Level
223 CString GetString() {
224 ASSERT(storeType==storeDynamic);
225 CString rv;
226 LPTSTR b = rv.GetBuffer(value.data.size+1);
227 ASSERT(b);
228 b[value.data.size]=0;
229 memmove(b,value.data.data,value.data.size);
230 rv.ReleaseBuffer();
231 return rv;
232 }
233};
234
235
236 class CSNMPVarBind{
237public:
238 CASNAny name;
239 CASNAny value;
240
241 CSNMPVarBind() {}
242 CSNMPVarBind(CASNAny& name,CASNAny& value) : name(name), value(value) {}
243 CSNMPVarBind(CASNAny& name) : name(name) {}
244 CSNMPVarBind(CSNMPVarBind& src) { Copy(src); }
245 BOOL Copy(CSNMPVarBind& src) {
246 name.Copy(src.name);
247 value.Copy(src.value);
248 return TRUE;
249 }
250 CSNMPVarBind& operator=(CSNMPVarBind& src) {
251 Copy(src);
252 return *this;
253 }
254 // High level
255 BOOL IsName(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) {
256 if(name.type!=CASNAny::typeASNOID)
257 return FALSE;
258 if(name.value.oid.size<prefixSize)
259 return FALSE;
260 if(bExact && (name.value.oid.size!=prefixSize))
261 return FALSE;
262 return !memcmp(prefix,name.value.oid.data,prefixSize);
263 }
264};
265
266 class CSNMPVarBindList: public CList<CSNMPVarBind,CSNMPVarBind&> {
267public:
268 CSNMPVarBind* GetVarBind(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) {
269 POSITION p = GetHeadPosition();
270 while(p){
271 CSNMPVarBind& vb = GetNext(p);
272 if(vb.IsName(prefix,prefixSize,bExact))
273 return &vb;
274 }
275 return NULL;
276 }
277};
278
279 class CSNMPeer{
280public:
281 virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) = 0;
282};
283
284};
285
286 #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 @@
1 #defineWIN32_LEAN_AND_MEAN
2#define VC_EXTRALEAN
3#define WIN32_EXTRALEAN
4#include <windows.h>
5#include <shlobj.h>
6#include <winver.h>
7#include <crtdbg.h>
8#include <string.h>
9#include <stdio.h>
10
11extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID);
12
13 template<class T> class Smart{
14public:
15 T *pT;
16
17 Smart() : pT(NULL) {}
18 Smart(int cb) : pT(new T[cb]) {}
19 Smart(T* p) : pT(p) {}
20 ~Smart() { if(pT)delete pT; }
21
22 Smart& operator=(T* p) { if(pT)delete pT; pT=p; return *this; }
23 operator T* () { return pT; }
24
25 //T& operator[](int ndx) { return pT[ndx]; }
26
27 T* Detach() { T* rv = pT; pT=NULL; return rv; }
28};
29 typedefSmart<char> STRING;
30
31 #define APPEND_SLASH(str) if((str)[strlen(str)-1]!='\\')strcat(str,"\\")
32
33HINSTANCE theInstance;
34
35LPSTR strFETCH_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR val)
36{
37HKEY hkey;
38 if(RegOpenKeyEx(hRoot,subKey,0,KEY_QUERY_VALUE,&hkey)!=ERROR_SUCCESS)
39 return NULL;
40DWORD kType,cb=0;
41STRING rv;
42 if(RegQueryValueEx(hkey,val,NULL,&kType,NULL,&cb)==ERROR_SUCCESS && kType==REG_SZ){
43 rv= new char[cb];
44 _ASSERT(rv!=NULL);
45 if(RegQueryValueEx(hkey,val,NULL,&kType,(LPBYTE)(LPSTR)rv,&cb)!=ERROR_SUCCESS)
46 rv=NULL;
47 }
48 RegCloseKey(hkey);
49 return rv.Detach();
50}
51
52BOOL strSET_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR valName,LPCSTR val)
53{
54HKEY hkey;
55DWORD dw;
56 if(RegCreateKeyEx(hRoot,subKey,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&hkey,&dw)!=ERROR_SUCCESS)
57 return FALSE;
58BOOL rv = (RegSetValueEx(hkey,valName,0,REG_SZ,(LPBYTE)val,strlen(val)+1)==ERROR_SUCCESS);
59 RegCloseKey(hkey);
60 return rv;
61}
62
63void MAKE_PATH(LPCSTR path)
64{
65STRING tmp(strlen(path)+1);
66LPCSTR t0=path;
67LPSTR t1=tmp;
68 while(*t0){
69 if((*t0)=='\\'){
70 *t1=0;
71 CreateDirectory(tmp,NULL);
72 }
73 *(t1++)=*(t0++);
74 }
75 *t1=0;
76 CreateDirectory(tmp,NULL);
77}
78
79BOOL ADDMENU(LPCSTR menu,LPCSTR item,LPCSTR path,LPCSTR program)
80{
81STRING stm = strFETCH_REG_KEY(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders","Programs");
82 if(!stm)
83 return FALSE;
84int pil = 1+strlen(path)+1+strlen(program)+1+1;
85STRING pi(pil);
86 strcpy(pi,path);
87 APPEND_SLASH(pi);
88 strcat(pi,program);
89int ipl = strlen(stm)+1+strlen(menu)+1+strlen(item)+4+1;
90STRING ip(ipl);
91 memmove(ip,stm,strlen(stm)+1);
92 APPEND_SLASH(ip);
93 strcat(ip,menu);
94 MAKE_PATH(ip);
95 APPEND_SLASH(ip);
96 strcat(ip,item);
97 strcat(ip,".lnk");
98IShellLink* sl = NULL;
99IPersistFile* pf = NULL;
100BOOL rv = FALSE;
101 do{
102 HRESULT hrv = CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(LPVOID*)&sl);
103 if(!SUCCEEDED(hrv))
104 break;
105 sl->SetDescription(item);
106 sl->SetPath(pi);
107 hrv = sl->QueryInterface(IID_IPersistFile,(LPVOID*)&pf);
108 if(!SUCCEEDED(hrv))
109 break;
110 WORD wsz[MAX_PATH];
111 MultiByteToWideChar(CP_ACP,0,ip,-1,wsz,MAX_PATH);
112 hrv = pf->Save(wsz,TRUE);
113 if(SUCCEEDED(hrv))
114 rv=TRUE;
115 }while(FALSE);
116 if(pf)
117 pf->Release();
118 if(sl)
119 sl->Release();
120 return rv;
121}
122
123FILE* CREATE_INF_FILE(LPCSTR path,LPCSTR file)
124{
125STRING fn(strlen(path)+1+strlen(file)+1);
126 strcpy(fn,path);
127 APPEND_SLASH(fn);
128 strcat(fn,file);
129 return fopen(fn,"wt");
130}
131
132BOOL INSTALLFILE(LPCSTR res,LPCSTR path,LPCSTR file)
133{
134STRING temp(MAX_PATH);
135 if(!GetTempPath(MAX_PATH,temp)) return FALSE;
136STRING tf(MAX_PATH);
137 if(!GetTempFileName(temp,"KGI",0,tf)) return FALSE;
138HRSRC hrsrc = FindResource(NULL,res,MAKEINTRESOURCE(RT_RCDATA));
139 if(!hrsrc) return FALSE;
140DWORD sor = SizeofResource(NULL,hrsrc);
141 if(!sor) return FALSE;
142HGLOBAL hglobal = LoadResource(NULL,hrsrc);
143 if(!hglobal) return FALSE;
144LPVOID lpv = LockResource(hglobal);
145 if(!lpv) return FALSE;
146HANDLE hf = CreateFile(tf,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
147 if(!hf) return FALSE;
148DWORD written = 0;
149 if(!WriteFile(hf,lpv,sor,&written,NULL) || written!=sor){
150 CloseHandle(hf);
151 return FALSE;
152 }
153 CloseHandle(hf);
154STRING toKill(strlen(tf)+1);
155 strcpy(toKill,tf);
156 for(int tmp=strlen(tf)-1;tmp>0 && ((tf[tmp])!='\\');tmp--);
157 if(tf[tmp]=='\\')
158 tf[tmp++]=0;
159STRING nothing(_MAX_PATH);
160UINT nothingLength=_MAX_PATH;
161 if(VerInstallFile(0,&tf[tmp],(LPSTR)file,tf,(LPSTR)path,NULL,nothing,&nothingLength)){
162 DeleteFile(toKill);
163 return FALSE;
164 }
165 DeleteFile(toKill);
166 return TRUE;
167}
168
169LPCSTR pdTitle, pdPrompt;
170char pdPath[_MAX_PATH];
171BOOL CALLBACK pathDlgProc(HWND hwnd,UINT uMsg,WPARAM wP,LPARAM lP)
172{
173 switch(uMsg){
174 case WM_INITDIALOG:
175 SetWindowText(hwnd,pdTitle);
176 SetDlgItemText(hwnd,IDC_PROMPT,pdPrompt);
177 SetDlgItemText(hwnd,IDC_PATH,pdPath);
178 SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
179 return 1;
180 case WM_COMMAND:
181 switch(LOWORD(wP)){ // ID
182 case IDC_BROWSE:
183 switch(HIWORD(wP)){
184 case BN_CLICKED:
185 {
186 BROWSEINFO bi;
187 memset(&bi,0,sizeof(bi));
188 bi.hwndOwner=hwnd;
189 bi.pszDisplayName=pdPath;
190 bi.lpszTitle="Select Folder..";
191 bi.ulFlags=BIF_RETURNONLYFSDIRS;
192 LPITEMIDLIST lpidl=SHBrowseForFolder(&bi);
193 if(lpidl){
194 SHGetPathFromIDList(lpidl,pdPath);
195 SHFree(lpidl);
196 SetDlgItemText(hwnd,IDC_PATH,pdPath);
197 }
198 }
199 return 1;
200 }
201 break;
202 case IDOK:
203 switch(HIWORD(wP)){
204 case BN_CLICKED:
205 if(GetDlgItemText(hwnd,IDC_PATH,pdPath,sizeof(pdPath)))
206 EndDialog(hwnd,IDOK);
207 else
208 // *** Error message
209 EndDialog(hwnd,IDCANCEL);
210 return 1;
211 }
212 break;
213 case IDCANCEL:
214 switch(HIWORD(wP)){
215 case BN_CLICKED:
216 EndDialog(hwnd,IDCANCEL);
217 return 1;
218 }
219 break;
220 };
221 break;
222 }
223 return 0;
224}
225
226LPSTR REQUESTPATH(LPCSTR title,LPCSTR prompt,LPCSTR defPath)
227{
228 pdTitle=title;pdPrompt=prompt;
229 strcpy(pdPath,defPath);
230 if(DialogBox(NULL,MAKEINTRESOURCE(IDD_PATH),NULL/*Parent*/,(DLGPROC)&pathDlgProc)!=IDOK)
231 return NULL;
232STRING rv(strlen(pdPath)+1);
233 strcpy(rv,pdPath);
234 return rv.Detach();
235}
236
237HKEY uninstallKey(LPCSTR regKey) {
238 STRING rk(100+strlen(regKey)+1);
239 sprintf(rk,"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s",regKey);
240 HKEY rv = NULL;
241 DWORD dw;
242 if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,rk,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&rv,&dw)!=ERROR_SUCCESS)
243 return NULL;
244 return rv;
245}
246
247BOOL REG_UNINSTALL_COMMAND(LPCSTR regKey,LPCSTR dName,LPCSTR iPath,LPCSTR iFile,LPCSTR iSection)
248{
249 HKEY hKey = uninstallKey(regKey);
250 if(!hKey)
251 return FALSE;
252 BOOL rv=FALSE;
253 do{
254 if(RegSetValueEx(hKey,"DisplayName",0,REG_SZ,(LPBYTE)dName,strlen(dName)+1)!=ERROR_SUCCESS)
255 break;
256 STRING us(50+strlen(iPath)+1+strlen(iFile)+strlen(iSection)+1);
257 strcpy(us,"RunDll32 setupapi.dll,InstallHinfSection ");
258 strcat(us,iSection);
259 strcat(us," 132 ");
260 strcat(us,iPath);
261 APPEND_SLASH(us);
262 strcat(us,iFile);
263 if(RegSetValueEx(hKey,"UninstallString",0,REG_SZ,(LPBYTE)(LPCSTR)us,strlen(us)+1)!=ERROR_SUCCESS)
264 break;
265 rv=TRUE;
266 }while(FALSE);
267 RegCloseKey(hKey);
268 return rv;
269}
270BOOL REG_UNINSTALL_ICON(LPCSTR regKey,LPCSTR path,LPCSTR file,int n) {
271 HKEY hKey = uninstallKey(regKey);
272 if(!hKey)
273 return FALSE;
274 STRING uis(strlen(path)+1+strlen(file)+7);
275 strcpy(uis,path);
276 APPEND_SLASH(uis);
277 strcat(uis,file);
278 char tmp[8];
279 sprintf(tmp,";%d",n);
280 strcat(uis,tmp);
281 BOOL rv = TRUE;
282 if(RegSetValueEx(hKey,"DisplayIcon",0,REG_SZ,(LPBYTE)(LPCSTR)uis,strlen(uis)+1)!=ERROR_SUCCESS)
283 rv = FALSE;
284 RegCloseKey(hKey);
285 return rv;
286}
287BOOL REG_UNINSTALL_COMMENT(LPCSTR regKey,LPCSTR comment) {
288 HKEY hKey = uninstallKey(regKey);
289 if(!hKey)
290 return FALSE;
291 BOOL rv = TRUE;
292 if(RegSetValueEx(hKey,"lComment",0,REG_SZ,(LPBYTE)comment,strlen(comment)+1)!=ERROR_SUCCESS)
293 rv = FALSE;
294 RegCloseKey(hKey);
295 return rv;
296}
297BOOL REG_UNINSTALL_VERSION(LPCSTR regKey,LPCSTR version) {
298 HKEY hKey = uninstallKey(regKey);
299 if(!hKey)
300 return FALSE;
301 BOOL rv = TRUE;
302 if(RegSetValueEx(hKey,"DisplayVersion",0,REG_SZ,(LPBYTE)version,strlen(version)+1)!=ERROR_SUCCESS)
303 rv = FALSE;
304 RegCloseKey(hKey);
305 return rv;
306}
307BOOL REG_UNINSTALL_LOCATION(LPCSTR regKey,LPCSTR location) {
308 HKEY hKey = uninstallKey(regKey);
309 if(!hKey)
310 return FALSE;
311 BOOL rv = TRUE;
312 if(RegSetValueEx(hKey,"InstallLocation",0,REG_SZ,(LPBYTE)location,strlen(location)+1)!=ERROR_SUCCESS)
313 rv = FALSE;
314 RegCloseKey(hKey);
315 return rv;
316}
317BOOL REG_UNINSTALL_PUBLISHER(LPCSTR regKey,LPCSTR publisher) {
318 HKEY hKey = uninstallKey(regKey);
319 if(!hKey)
320 return FALSE;
321 BOOL rv = TRUE;
322 if(RegSetValueEx(hKey,"Publisher",0,REG_SZ,(LPBYTE)publisher,strlen(publisher)+1)!=ERROR_SUCCESS)
323 rv = FALSE;
324 RegCloseKey(hKey);
325 return rv;
326}
327BOOL REG_UNINSTALL_URLS(LPCSTR regKey,LPCSTR about,LPCSTR update) {
328 HKEY hKey = uninstallKey(regKey);
329 if(!hKey)
330 return FALSE;
331 BOOL rv = TRUE;
332 if(RegSetValueEx(hKey,"URLInfoAbout",0,REG_SZ,(LPBYTE)about,strlen(about)+1)!=ERROR_SUCCESS)
333 rv = FALSE;
334 if(RegSetValueEx(hKey,"URLUpdateInfo",0,REG_SZ,(LPBYTE)update,strlen(update)+1)!=ERROR_SUCCESS)
335 rv = FALSE;
336 RegCloseKey(hKey);
337 return rv;
338}
339
340 #defineINF_FILE_HEADER(i) fprintf(i,"[Version]\nSignature=\"$CHICAGO$\"\n\n")
341#define INF_FILE_SECTION(i,s) fprintf(i,"\n[%s]\n",s)
342 #defineINF_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)
343#define INF_MENU_GROUP(i,n,m) fprintf(i,"setup.ini, progman.groups,,\"group%d=%s\"\n",n,m)
344#define INF_MENU_ITEM(i,n,m) fprintf(i,"setup.ini, group%d,, \"\"\"%s\"\"\"\n",n,m);
345#define INF_REMOVE_ROOT(i,g,r) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,,,\"%s\"\n",g,r)
346#define INF_REMOVE_FILE(i,g,f) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,%s,,\"%s\"\n",g,f,f)
347#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");}
348
349LPSTR GET_SHORT_PATH(LPCSTR path)
350{
351char tmp;
352DWORD len = GetShortPathName(path,&tmp,1);
353 if(!len)
354 return NULL;
355STRING rv(len+1);
356 if(!GetShortPathName(path,rv,len+1))
357 return NULL;
358 return rv.Detach();
359}
360
361BOOL Install(void);
362
363int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE,LPSTR,int)
364{
365 theInstance=hInstance;
366 CoInitialize(NULL);
367 Install();
368 CoUninitialize();
369 return 0;
370}
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 @@
1#ifndef IP_ICMPHEADER
2
3#define IP_ICMPHEADER
4
5struct icmp {
6 BYTE icmp_type;
7 BYTE icmp_code;
8 WORD icmp_cksum;
9 WORD icmp_id;
10 WORD icmp_seq;
11 char icmp_data[1];
12};
13
14#define SIZE_ICMP_HDR 8
15#define SIZE_TIME_DATA 8
16
17struct ip {
18 BYTE ip_hl:4, /* header length */
19 ip_v:4; /* version */
20 BYTE ip_tos; /* type of service */
21 short ip_len; /* total length */
22 u_short ip_id; /* identification */
23 short ip_off; /* fragment offset field */
24 BYTE ip_ttl; /* time to live */
25 BYTE ip_p; /* protocol */
26 u_short ip_sum; /* checksum */
27 struct in_addr ip_src,ip_dst; /* source and dest address */
28};
29
30#define ICMP_ECHOREPLY 0 /* echo reply */
31#define ICMP_UNREACH 3 /* dest unreachable, codes: */
32#define ICMP_UNREACH_NET 0 /* bad net */
33#define ICMP_UNREACH_HOST 1 /* bad host */
34#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
35#define ICMP_UNREACH_PORT 3 /* bad port */
36#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
37#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
38#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
39#define ICMP_REDIRECT 5 /* shorter route, codes: */
40#define ICMP_REDIRECT_NET 0 /* for network */
41#define ICMP_REDIRECT_HOST 1 /* for host */
42#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
43#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
44#define ICMP_ECHO 8 /* echo service */
45#define ICMP_TIMXCEED 11 /* time exceeded, code: */
46#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
47#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
48#define ICMP_PARAMPROB 12 /* ip header bad */
49#define ICMP_TSTAMP 13 /* timestamp request */
50#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
51#define ICMP_IREQ 15 /* information request */
52#define ICMP_IREQREPLY 16 /* information reply */
53#define ICMP_MASKREQ 17 /* address mask request */
54#define ICMP_MASKREPLY 18 /* address mask reply */
55
56#define ICMP_MAXTYPE 18
57
58#define ICMP_MINLEN 8 /* abs minimum */
59#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
60#define ICMP_MASKLEN 12 /* address mask */
61#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
62#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
63
64#define STNORM 0
65
66/* Definition of the lowest telnet byte following an IAC byte */
67#define LOW_TEL_OPT 236
68
69#define TEL_EOF 236
70#define SUSP 237
71#define ABORT 238
72
73#define SE 240
74#define NOP 241
75#define DM 242
76#define BREAK 243
77#define IP 244
78#define AO 245
79#define AYT 246
80#define EC 247
81#define EL 248
82#define GOAHEAD 249
83#define SB 250
84#define WILL 251
85#define WONT 252
86#define DO 253
87#define DONT 254
88#define IAC 255
89
90#endif
91
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 @@
1 #ifndef__KHELPERS_H
2#define __KHELPERS_H
3
4#include <shlobj.h>
5
6extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID);
7
8namespace Klever {
9
10 inline BOOL BrowseForFolder(CString& folder,LPCTSTR title=NULL,CWnd* pParent=NULL) {
11 BROWSEINFO bi;
12 memset(&bi,0,sizeof(bi));
13 if(pParent)
14 bi.hwndOwner=pParent->GetSafeHwnd();
15 CString rv;
16 bi.pszDisplayName=rv.GetBuffer(MAX_PATH);
17 bi.lpszTitle=title;
18 bi.ulFlags=BIF_RETURNONLYFSDIRS;
19 LPITEMIDLIST lpidl = SHBrowseForFolder(&bi);
20 if(lpidl){
21 SHGetPathFromIDList(lpidl,bi.pszDisplayName);
22 SHFree(lpidl);
23 rv.ReleaseBuffer();
24 folder=rv;
25 return TRUE;
26 }
27 rv.ReleaseBuffer();
28 return FALSE;
29 }
30 inline BOOL BrowseForFolder(CString& folder,UINT idTitle,CWnd* pParent=NULL) {
31 CString title;
32 VERIFY(title.LoadString(idTitle));
33 return BrowseForFolder(folder,title,pParent);
34 }
35 inline CString GluePathAndFile(LPCTSTR path,LPCTSTR file) {
36 CString rv = path;
37 while((!rv.IsEmpty()) && rv[rv.GetLength()-1]=='\\')
38 rv=rv.Left(rv.GetLength()-1);
39 rv+='\\';
40 while(*file && *file=='\\')
41 file++;
42 rv+=file;
43 return rv;
44 }
45 inline UINT TokenizeString(CStringList& rv,LPCTSTR string,LPCTSTR delimiter) {
46 CString s = string;
47 int found;
48 int delength = strlen(delimiter);
49 int rvc = 0;
50 while((found=s.Find(delimiter))>=0){
51 rv.AddTail(s.Left(found));
52 rvc++;
53 s=s.Mid(found+delength);
54 }
55 if(!s.IsEmpty()){
56 rv.AddTail(s);
57 rvc++;
58 }
59 return rvc;
60 }
61 inline BOOL LogRecord(LPCTSTR logFile,LPCTSTR logRecord) {
62 try{
63 CFile f(logFile,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite|CFile::shareDenyWrite);
64 f.SeekToEnd();
65 CString s = CTime::GetCurrentTime().Format("[%c] ")+logRecord+"\r\n";
66 f.Write((LPCTSTR)s,s.GetLength());
67 }catch(CException* e){
68 e->Delete();
69 return FALSE;
70 }
71 return TRUE;
72 }
73 inline BOOL ReadString(CFile* file,CString& rv) {
74 rv.Empty();
75 int nBuffer = 256;
76 TCHAR* ch = rv.GetBuffer(nBuffer);
77 int nPos = 0;
78 BOOL bRV = FALSE;
79 for(;;){
80 TCHAR c;
81 try{
82 if(file->Read(&c,sizeof(c))!=sizeof(c))
83 break;
84 bRV=TRUE;
85 }catch(CException* e){
86 e->Delete();
87 TRACE0("Exception in ReadString\n");
88 return FALSE;
89 }
90 if(nPos>=(nBuffer-1)){
91 rv.ReleaseBuffer();
92 ch = rv.GetBuffer(nBuffer=nBuffer+256);
93 ASSERT(ch);
94 }
95 if(c=='\n')
96 break;
97 ch[nPos++]=c;
98 }
99 ch[nPos]=0;
100 for(;;){
101 nPos--;
102 if(nPos<0)
103 break;
104 if(ch[nPos]!='\r')
105 break;
106 ch[nPos]=0;
107 }
108 rv.ReleaseBuffer();
109 rv.FreeExtra();
110 return bRV;
111 }
112
113 inline int LoadStringList(CStringList& list,LPCTSTR section) {
114 CString n;
115 list.RemoveAll();
116 CWinApp* app = AfxGetApp();
117 ASSERT(app);
118 for(int tmp=0;;tmp++){
119 n.Format("%d",tmp);
120 CString str = app->GetProfileString(section,n,NULL);
121 if(str.IsEmpty())
122 break;
123 list.AddTail(str);
124 }
125 return tmp;
126 }
127 inline int SaveStringList(CStringList& list,LPCTSTR section) {
128 CString n;
129 CWinApp* app = AfxGetApp();
130 ASSERT(app);
131 POSITION p = list.GetHeadPosition();
132 for(int tmp=0;p;tmp++){
133 n.Format("%d",tmp);
134 app->WriteProfileString(section,n,list.GetNext(p));
135 }
136 n.Format("%d",tmp);
137 app->WriteProfileString(section,n,NULL);
138 return tmp;
139 }
140
141 inline BOOL WriteProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR str) {
142 CWinApp* app = AfxGetApp();
143 return app->WriteProfileBinary(section,entry,(LPBYTE)str,strlen(str)+1);
144 }
145 inline CString GetProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR defval) {
146 CWinApp* app = AfxGetApp();
147 LPBYTE pData;
148 UINT nCount;
149 CString rv = defval;
150 if(app->GetProfileBinary(section,entry,&pData,&nCount)){
151 rv = (LPCTSTR)pData;
152 delete pData;
153 }
154 return rv;
155 }
156
157};
158
159#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 @@
1#include "../stdafx.h"
2#include "kICMP.h"
3
4CICMP::_mechanismus CICMP::m_mechanismus = CICMP::_icmpUndetermined;
5
6BOOL CICMPDll::Initialize()
7{
8 if(m_hICMP!=INVALID_HANDLE_VALUE || m_hICMPDLL)
9 Deinitialize();
10 m_hICMPDLL = ::LoadLibraryEx("ICMP",NULL,0);
11 if(!m_hICMPDLL)
12 return FALSE;
13 *(FARPROC*)&m_icmpCF = ::GetProcAddress(m_hICMPDLL,"IcmpCreateFile");
14 *(FARPROC*)&m_icmpSE = ::GetProcAddress(m_hICMPDLL,"IcmpSendEcho");
15 *(FARPROC*)&m_icmpCH = ::GetProcAddress(m_hICMPDLL,"IcmpCloseHandle");
16 if(!(m_icmpCF && m_icmpSE && m_icmpCH)){
17 Deinitialize(); return FALSE;
18 }
19 m_hICMP = (*m_icmpCF)();
20 if(m_hICMP==INVALID_HANDLE_VALUE){
21 Deinitialize(); return FALSE;
22 }
23 TRACE0("ICMP-DLL Initialized\n");
24 return TRUE;
25}
26void CICMPDll::Deinitialize()
27{
28 if(m_hICMPDLL){
29 if(m_hICMP!=INVALID_HANDLE_VALUE && m_icmpCH)
30 (*m_icmpCH)(m_hICMP);
31 ::FreeLibrary(m_hICMPDLL); m_hICMPDLL = NULL;
32 m_icmpCF = NULL;
33 m_icmpSE = NULL;
34 m_icmpCH = NULL;
35 }
36 m_hICMP=INVALID_HANDLE_VALUE;
37 if(m_sizeOut && m_bsOut){
38 delete m_bsOut;
39 m_bsOut = NULL; m_sizeOut = 0;
40 }
41 if(m_sizeIn && m_bsIn){
42 delete m_bsIn;
43 m_bsIn = NULL; m_sizeIn = 0;
44 }
45}
46
47LONG CICMPDll::Ping(const in_addr host,const UINT packetSize,
48 const UINT timeOut,LPINT pStatus)
49{
50 if(!(m_hICMP && m_hICMPDLL && m_icmpSE)){
51 if(pStatus)
52 (*pStatus) = icmpNotInitialized;
53 return -1;
54 }
55 VERIFY(AdjustBuffers(packetSize));
56IPINFO ipi;
57 memset(&ipi,0,sizeof(ipi));
58 ipi.Ttl = 30;
59 for(UINT tmp=0;tmp<packetSize;tmp++)
60 m_bsOut[tmp]=tmp&0xFF;
61LPICMPECHO pRep = (LPICMPECHO)m_bsIn;
62 pRep->Status = 0xFFFFFFFFl;
63 if((*m_icmpSE)(m_hICMP,host.s_addr,m_bsOut,packetSize,
64 &ipi,pRep,m_sizeIn,timeOut))
65 TRACE0("ICMP-SendEcho succeeded\n");
66 else
67 TRACE0("ICMP-SendEcho failed\n");
68LONG lrv = -1;
69INT rv = ipUnknown;
70 switch(pRep->Status){
71 case IP_SUCCESS:
72 lrv = pRep->RTTime; rv = ipSuccess;
73 break;
74 case IP_BUF_TOO_SMALL: rv = ipBuffTooSmall; break;
75 case IP_DEST_NET_UNREACHABLE: rv = ipDestNetUnreachable; break;
76 case IP_DEST_HOST_UNREACHABLE: rv = ipDestHostUnreachable; break;
77 case IP_DEST_PROT_UNREACHABLE: rv = ipDestProtUnreachable; break;
78 case IP_DEST_PORT_UNREACHABLE: rv = ipDestPortUnreachable; break;
79 case IP_NO_RESOURCES: rv = ipNoResources; break;
80 case IP_BAD_OPTION: rv = ipBadOption; break;
81 case IP_HW_ERROR: rv = ipHWError; break;
82 case IP_PACKET_TOO_BIG: rv = ipPacketTooBig; break;
83 case IP_REQ_TIMED_OUT: rv = ipTimeOut; break;
84 case IP_BAD_REQ: rv = ipBadRequest; break;
85 case IP_BAD_ROUTE: rv = ipBadRoute; break;
86 case IP_TTL_EXPIRED_TRANSIT: rv = ipTTLExpiredInTransit; break;
87 case IP_TTL_EXPIRED_REASSEM: rv = ipTTLExpiredInReasm; break;
88 case IP_PARAM_PROBLEM: rv = ipParamProblem; break;
89 case IP_SOURCE_QUENCH: rv = ipSourceQuench; break;
90 case IP_OPTION_TOO_BIG: rv = ipOptionTooBig; break;
91 case IP_BAD_DESTINATION: rv = ipBadDest; break;
92 }
93 if(pStatus)
94 (*pStatus)=rv;
95 return lrv;
96}
97
98BOOL CICMPDll::AdjustBuffers(UINT packetSize)
99{
100 if(!packetSize)
101 packetSize=1;
102 if(packetSize>m_sizeOut){
103 if(m_sizeOut && m_bsOut)
104 delete m_bsOut;
105 m_bsOut = new BYTE[m_sizeOut=packetSize];
106 if(!m_bsOut)
107 return FALSE;
108 }
109UINT sin = sizeof(ICMPECHO)+SIZE_ICMP_HDR+packetSize;
110 if(sin>m_sizeIn){
111 if(m_sizeIn && m_bsIn)
112 delete m_bsIn;
113 m_bsIn = new BYTE[m_sizeIn=sin];
114 if(!m_bsIn)
115 return FALSE;
116 }
117 return TRUE;
118}
119
120
121WORD CICMPWS::m_icmpSeq = 0;
122
123BOOL CICMPWS::Initialize()
124{
125 if(m_socket!=INVALID_SOCKET)
126 Deinitialize();
127 m_socket = socket(AF_INET,SOCK_RAW,1/*ICMP*/);
128 if(m_socket==INVALID_SOCKET)
129 return FALSE;
130 TRACE0("ICMP-WS Initialized\n");
131 return TRUE;
132}
133void CICMPWS::Deinitialize()
134{
135 if(m_socket!=INVALID_SOCKET){
136 closesocket(m_socket);
137 m_socket=INVALID_SOCKET;
138 }
139 if(m_sizeOut && m_bsOut){
140 delete m_bsOut;
141 m_bsOut = NULL; m_sizeOut = 0;
142 }
143 if(m_sizeIn && m_bsIn){
144 delete m_bsIn;
145 m_bsIn = NULL; m_sizeIn = 0;
146 }
147}
148LONG CICMPWS::Ping(const in_addr host,const UINT packetSize,
149 const UINT timeOut,LPINT pStatus)
150{
151 if(m_socket==INVALID_SOCKET){
152 if(pStatus)
153 (*pStatus)=icmpNotInitialized;
154 }
155 VERIFY(AdjustBuffers(packetSize));
156icmp* pPacket = (icmp*)m_bsOut;
157 memset(pPacket,0,m_sizeOut);
158 pPacket->icmp_type = ICMP_ECHO;
159 pPacket->icmp_seq = m_icmpSeq++;
160 pPacket->icmp_id = (WORD)(::GetCurrentThreadId()&0xFFFF);
161 for(UINT tmp=0;tmp<packetSize;tmp++)
162 pPacket->icmp_data[tmp]=tmp&0xFF;
163 pPacket->icmp_cksum = cksum(pPacket,SIZE_ICMP_HDR+packetSize);
164sockaddr_in to;
165 memset(&to,0,sizeof(to));
166 to.sin_addr.s_addr = host.s_addr;
167 to.sin_family = AF_INET;
168 if(sendto(m_socket,(char*)pPacket,SIZE_ICMP_HDR+packetSize,0,
169 (SOCKADDR*)&to,sizeof(to)) != (int)(SIZE_ICMP_HDR+packetSize)){
170 TRACE1("sendto: %lu\n",WSAGetLastError());
171 if(pStatus)
172 (*pStatus)=icmpSocketError;
173 return -1;
174 }
175DWORD sentTime = ::GetTickCount();
176sockaddr_in from;
177 memset(&from,0,sizeof(from));
178 from.sin_family=AF_INET;
179 from.sin_addr.s_addr=INADDR_ANY;
180fd_set fds;
181 FD_ZERO(&fds);
182 FD_SET(m_socket,&fds);
183long lrv = -1;
184INT rv = ipTimeOut;
185 for(;;){
186 DWORD ct = ::GetTickCount();
187 if((ct-sentTime)>=timeOut){
188 TRACE0("Timeout\n");
189 break;
190 }
191 timeval tv = {
192 (timeOut-ct+sentTime)/1000,
193 (timeOut-ct+sentTime)%1000
194 };// tv_sec, tv_usec (secs,microsecs)
195 if(!select(m_socket,&fds,NULL,NULL,&tv)){
196 TRACE1("select: %d\n",WSAGetLastError());
197 break;
198 }
199 DWORD rtime = ::GetTickCount();
200 ASSERT(FD_ISSET(m_socket,&fds));
201 int fl = sizeof(from);
202 int rb = recvfrom(m_socket,(char*)m_bsIn,m_sizeIn,0,(SOCKADDR*)&from,&fl);
203 ip* pIP = (ip*)m_bsIn;
204 icmp* pICMP = (icmp*)&m_bsIn[sizeof(ip)];
205 if(pICMP->icmp_id!=pPacket->icmp_id)
206 continue;
207 if(pICMP->icmp_seq!=pPacket->icmp_seq)
208 continue;
209 if(from.sin_addr.s_addr!=host.s_addr)
210 continue;
211 if(pICMP->icmp_type==ICMP_ECHOREPLY){
212 lrv=rtime-sentTime;
213 rv=ipSuccess;
214 break;
215 }
216 rv = ipUnknown;// ***
217 break;
218 }
219 if(pStatus)
220 (*pStatus)=rv;
221 return lrv;
222}
223
224BOOL CICMPWS::AdjustBuffers(UINT packetSize)
225{
226 if(!packetSize)
227 packetSize=0;
228UINT osize = packetSize+SIZE_ICMP_HDR;
229 if(m_sizeOut<osize){
230 if(m_sizeOut && m_bsOut)
231 delete m_bsOut;
232 m_bsOut = new BYTE[m_sizeOut=osize];
233 if(!m_bsOut)
234 return FALSE;
235 }
236UINT isize = osize+sizeof(ip);
237 if(m_sizeIn<isize){
238 if(m_sizeIn && m_bsIn)
239 delete m_bsIn;
240 m_bsIn = new BYTE[m_sizeIn=isize];
241 if(!m_bsIn)
242 return FALSE;
243 }
244 return TRUE;
245}
246
247WORD CICMPWS::cksum(LPVOID data,int count)
248{
249long lSum = 0;
250WORD *pData = (WORD*)data;
251 while(count>0){
252 if(count>1){
253 lSum+=*(pData++);
254 count-=2;
255 }else{
256 lSum+=((WORD)*(BYTE*)pData)&0xFF;
257 count--;
258 }
259 }
260 lSum = (lSum&0xFFFF)+(lSum>>16);
261 lSum += (lSum>>16);
262 return (~lSum)&0xFFFF;
263}
264
265CICMP* CICMP::CreateICMP()
266{
267 if(m_mechanismus==_icmpUndetermined)
268 GuessMechanismus();
269 switch(m_mechanismus){
270 case _icmpWinsock:
271 return new CICMPWS;
272 break;
273 case _icmpDLL:
274 return new CICMPDll;
275 break;
276 }
277 return NULL;
278}
279
280void CICMP::GuessMechanismus()
281{
282 m_mechanismus=_icmpUndetermined;
283SOCKET testSocket = socket(AF_INET,SOCK_RAW,1);
284 if(testSocket!=INVALID_SOCKET){
285 closesocket(testSocket);
286 m_mechanismus=_icmpWinsock;
287 }else{
288 HINSTANCE hICMP = ::LoadLibraryEx("ICMP",NULL,0);
289 if(!hICMP)
290 return;
291 BOOL isThere = (
292 ::GetProcAddress(hICMP,"IcmpCreateFile")
293 && ::GetProcAddress(hICMP,"IcmpSendEcho")
294 && ::GetProcAddress(hICMP,"IcmpCloseHandle")
295 );
296 ::FreeLibrary(hICMP);
297 if(isThere)
298 m_mechanismus=_icmpDLL;
299 }
300} \ 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 @@
1 #ifndef__KICMP_H
2#define __KICMP_H
3
4class CICMP {
5 enum _mechanismus {
6 _icmpUndetermined = -1,
7 _icmpWinsock = 0, _icmpDLL
8 };
9static _mechanismus m_mechanismus;
10static void GuessMechanismus();
11public:
12static
13 CICMP* CreateICMP();
14
15 enum {
16 ipSuccess = 0,
17 ipBuffTooSmall, ipDestNetUnreachable, ipDestHostUnreachable,
18 ipDestProtUnreachable, ipDestPortUnreachable, ipNoResources,
19 ipBadOption, ipHWError, ipPacketTooBig, ipTimeOut, ipBadRequest,
20 ipBadRoute, ipTTLExpiredInTransit, ipTTLExpiredInReasm,
21 ipParamProblem, ipSourceQuench, ipOptionTooBig, ipBadDest,
22 ipUnknown = -1,
23 icmpNotInitialized = -2,
24 icmpSocketError = -3
25 };
26
27 virtual BOOL Initialize() = 0;
28 virtual void Deinitialize() = 0;
29
30 virtual LONG Ping(const in_addr host,const UINT packetSize=0,
31 const UINT timeOut=10000,LPINT pStatus=NULL) = 0;
32};
33
34class CICMPDll : public CICMP {
35 HANDLE(WINAPI *m_icmpCF)(VOID);
36 BOOL(WINAPI *m_icmpSE)(HANDLE,ULONG,LPVOID,WORD,
37 PIPINFO,LPVOID,DWORD,DWORD);
38 BOOL(WINAPI *m_icmpCH)(HANDLE);
39public:
40 HINSTANCE m_hICMPDLL;
41 HANDLE m_hICMP;
42 LPBYTE m_bsIn, m_bsOut;
43 UINT m_sizeIn, m_sizeOut;
44
45 CICMPDll() : m_hICMP(INVALID_HANDLE_VALUE), m_hICMPDLL(NULL),
46 m_bsIn(NULL), m_bsOut(NULL), m_sizeIn(0), m_sizeOut(0) {}
47 virtual ~CICMPDll() { Deinitialize(); }
48
49 virtual BOOL Initialize();
50 virtual void Deinitialize();
51
52 virtual LONG Ping(const in_addr host,const UINT packetSize=0,
53 const UINT timeOut=10000,LPINT pStatus=NULL);
54
55 BOOL AdjustBuffers(UINT packetSize=0);
56};
57
58class CICMPWS : public CICMP {
59static
60 WORD m_icmpSeq;
61public:
62 SOCKET m_socket;
63 LPBYTE m_bsIn, m_bsOut;
64 UINT m_sizeIn, m_sizeOut;
65
66 CICMPWS() : m_socket(INVALID_SOCKET), m_bsIn(NULL), m_bsOut(NULL),
67 m_sizeIn(0), m_sizeOut(0) {}
68 virtual ~CICMPWS() { Deinitialize(); }
69
70 virtual BOOL Initialize();
71 virtual void Deinitialize();
72
73 virtual LONG Ping(const in_addr host,const UINT packetSize=0,
74 const UINT timeOut=10000,LPINT pStatus=NULL);
75
76 BOOL AdjustBuffers(UINT packetSize=0);
77 WORD cksum(LPVOID data,int count);
78};
79
80#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 @@
1<?xml version="1.0"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 >
5 <xsl:output
6 method="text"
7 encoding="us-ascii"/>
8 <xsl:strip-space elements="*"/>
9
10 <xsl:template match="winhelp">
11 <xsl:text>{\rtf1\ansi</xsl:text>
12 <xsl:text>&#xA;@{\footnote</xsl:text>
13 <xsl:text>&#xA;THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.</xsl:text>
14 <xsl:text>&#xA;DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD</xsl:text>
15 <xsl:text>&#xA;}&#xA;</xsl:text>
16 <xsl:call-template name="fonttbl"/>
17 <xsl:call-template name="colortbl"/>
18 <xsl:apply-templates/>
19 <xsl:text>}</xsl:text>
20 </xsl:template>
21
22 <xsl:template match="topic">
23 <xsl:text>&#xA;\pard\plain</xsl:text>
24 <xsl:if test="descendant::*[ (@scroll='no') and
25 count(preceding-sibling::*[not(@scroll='no') and (name()!='a' and @name)])=0] ">
26 <xsl:text>\keepn</xsl:text>
27 </xsl:if>
28 <xsl:if test="@id">
29 <xsl:text>&#xA;#{\footnote </xsl:text>
30 <xsl:value-of select="@id"/>
31 <xsl:text>}</xsl:text>
32 </xsl:if>
33 <xsl:if test="@title">
34 <xsl:text>&#xA;${\footnote </xsl:text>
35 <xsl:value-of select="@title"/>
36 <xsl:text>}</xsl:text>
37 </xsl:if>
38 <xsl:if test="@keywords">
39 <xsl:text>&#xA;K{\footnote </xsl:text>
40 <xsl:value-of select="@keywords"/>
41 <xsl:text>}</xsl:text>
42 </xsl:if>
43 <xsl:apply-templates/>
44 <xsl:text>&#xA;\page&#xA;</xsl:text>
45 </xsl:template>
46
47 <xsl:template match="a[@name]">
48 <xsl:text>{#{\footnote </xsl:text>
49 <xsl:value-of select="@name"/>
50 <xsl:text>}}</xsl:text>
51 </xsl:template>
52 <xsl:template match="a[@href]">
53 <xsl:call-template name="hyperref">
54 <xsl:with-param name="href" select="@href"/>
55 <xsl:with-param name="inset"><xsl:apply-templates/></xsl:with-param>
56 </xsl:call-template>
57 </xsl:template>
58 <xsl:template name="hyperref">
59 <xsl:param name="href"/>
60 <xsl:param name="inset"/>
61 <xsl:choose>
62 <xsl:when test="starts-with($href,'http:') or starts-with($href,'mailto:') or
63 starts-with($href,'ftp:')">
64 <xsl:text>{\uldb </xsl:text>
65 <xsl:value-of select="$inset"/>
66 <xsl:text>}{\v %!ExecFile("</xsl:text>
67 <xsl:value-of select="$href"/>
68 <xsl:text>")}</xsl:text>
69 </xsl:when>
70 <xsl:when test="starts-with($href,'#')">
71 <xsl:text>{\uldb </xsl:text>
72 <xsl:value-of select="$inset"/>
73 <xsl:text>}{\v </xsl:text>
74 <xsl:value-of select="substring($href,2)"/>
75 <xsl:text>}</xsl:text>
76 </xsl:when>
77 <xsl:otherwise>
78 <xsl:message>Warining: Unqualified hyper-reference. Using as help-internal</xsl:message>
79 <xsl:text>{\uldb </xsl:text>
80 <xsl:value-of select="$inset"/>
81 <xsl:text>}{\v </xsl:text>
82 <xsl:value-of select="$href"/>
83 <xsl:text>}</xsl:text>
84 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:template>
87
88 <xsl:template match="heading">
89 <xsl:text>&#xA;</xsl:text>
90 <xsl:if test="@scroll!='no'">
91 <xsl:text>\pard </xsl:text>
92 </xsl:if>
93 <xsl:text>{ \f1\fs18\b\sb120 </xsl:text>
94 <xsl:apply-templates/>
95 <xsl:text>}</xsl:text>
96 </xsl:template>
97
98 <xsl:template match="p">
99 <xsl:text>&#xA;\par\sa120\sb120\qj</xsl:text>
100 <xsl:if test="@scroll!='no'">
101 <xsl:text>\pard</xsl:text>
102 </xsl:if>
103 <xsl:text> \f1\fs18\sb120 </xsl:text>
104 <xsl:apply-templates/>
105 </xsl:template>
106
107 <xsl:template match="note">
108 <xsl:text>&#xA;\par\sa120\sb120\qj\f1\fs16 </xsl:text>
109 <xsl:apply-templates/>
110 </xsl:template>
111
112 <xsl:template match="dedication">
113 <xsl:text>&#xA;\par\sa120\sb120\qr\f1\fs16 </xsl:text>
114 <xsl:apply-templates/>
115 </xsl:template>
116
117 <xsl:template match="image">
118 <xsl:text>\{bmct </xsl:text>
119 <xsl:value-of select="@source"/>
120 <xsl:text>\}</xsl:text>
121 </xsl:template>
122
123 <xsl:template match="newsfor">
124 <xsl:text>&#xA;\par\pard\plain\f1\fs24\qc\cf2\b </xsl:text>
125 <xsl:value-of select="@version"/>
126 <xsl:text> - </xsl:text>
127 <xsl:value-of select="@date"/>
128 <xsl:apply-templates/>
129 </xsl:template>
130 <xsl:template match="ni">
131 <xsl:text>&#xA;\par\pard\plain\fi0\li0\f1\fs18 \bullet </xsl:text>
132 <xsl:apply-templates/>
133 </xsl:template>
134
135 <xsl:template match="b">
136 <xsl:text>{\b </xsl:text>
137 <xsl:apply-templates/>
138 <xsl:text>}</xsl:text>
139 </xsl:template>
140 <xsl:template match="i">
141 <xsl:text>{\i </xsl:text>
142 <xsl:apply-templates/>
143 <xsl:text>}</xsl:text>
144 </xsl:template>
145 <xsl:template match="u">
146 <xsl:text>{\ul </xsl:text>
147 <xsl:apply-templates/>
148 <xsl:text>}</xsl:text>
149 </xsl:template>
150 <xsl:template match="strike">
151 <xsl:text>{\strike </xsl:text>
152 <xsl:apply-templates/>
153 <xsl:text>}</xsl:text>
154 </xsl:template>
155
156 <xsl:template match="kin">
157 <xsl:choose>
158 <xsl:when test="@href">
159 <xsl:call-template name="hyperref">
160 <xsl:with-param name="href" select="@href"/>
161 <xsl:with-param name="inset"><xsl:text>{\b </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param>
162 </xsl:call-template>
163 </xsl:when>
164 <xsl:otherwise>
165 <xsl:text>{\b </xsl:text>
166 <xsl:apply-templates/>
167 <xsl:text>}</xsl:text>
168 </xsl:otherwise>
169 </xsl:choose>
170 </xsl:template>
171 <xsl:template match="product">
172 <xsl:choose>
173 <xsl:when test="@href">
174 <xsl:call-template name="hyperref">
175 <xsl:with-param name="href" select="@href"/>
176 <xsl:with-param name="inset"><xsl:text>{\b\cf6 </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param>
177 </xsl:call-template>
178 </xsl:when>
179 <xsl:otherwise>
180 <xsl:text>{\b\cf6 </xsl:text>
181 <xsl:apply-templates/>
182 <xsl:text>}</xsl:text>
183 </xsl:otherwise>
184 </xsl:choose>
185 </xsl:template>
186 <xsl:template match="term">
187 <xsl:text>{\i </xsl:text>
188 <xsl:apply-templates/>
189 <xsl:text>}</xsl:text>
190 </xsl:template>
191
192 <xsl:template match="rfc">
193 <xsl:call-template name="hyperref">
194 <xsl:with-param name="href" select="concat('http://www.rfc-editor.org/rfc/rfc',@num,'.txt')"/>
195 <xsl:with-param name="inset" select="concat('{\b RFC',@num,'}')"/>
196 </xsl:call-template>
197 </xsl:template>
198
199 <xsl:template match="license">
200 <xsl:text>&#xA;{</xsl:text>
201 <xsl:text>&#xA;\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) </xsl:text>
202 <xsl:value-of select="@years"/>
203 <xsl:text> {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")}</xsl:text>
204 <xsl:text>&#xA;\par\qj\sb120\sa120</xsl:text>
205 <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>
206 <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>
207 <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>
208 <xsl:text>&#xA;}</xsl:text>
209 </xsl:template>
210 <xsl:template match="credits">
211 <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>
212 <xsl:text>&#xA;\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}</xsl:text>
213 </xsl:template>
214
215 <xsl:template match="ul">
216 <xsl:text>\pard</xsl:text>
217 <xsl:apply-templates/>
218 <xsl:text>\pard</xsl:text>
219 </xsl:template>
220 <xsl:template match="li">
221 <!-- TODO: could be done better, but you never know with winhelp.. -->
222 <xsl:variable name="li" select=" count(ancestor::ul) "/>
223 <xsl:text>&#xA;\par \fi0\li</xsl:text><xsl:value-of
224 select="0"/><xsl:text> \bullet </xsl:text>
225 <xsl:apply-templates/>
226 </xsl:template>
227
228 <xsl:template match="topic/text()">
229 <!-- maybe only omit spaces? -->
230 </xsl:template>
231 <xsl:template match="ul/text()">
232 </xsl:template>
233
234 <xsl:template name="colortbl">
235 <xsl:text>{\colortbl;
236 \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
237 \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
238 \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
239 \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
240 </xsl:text>
241 </xsl:template>
242 <xsl:template name="fonttbl">
243 <xsl:text>{\fonttbl</xsl:text>
244 <xsl:text>{\f0\froman Times New Roman;}</xsl:text>
245 <xsl:text>{\f1\fswiss Arial;}</xsl:text>
246 <xsl:text>{\f3\froman Symbol;}</xsl:text>
247 <xsl:text>}</xsl:text>
248 </xsl:template>
249
250</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 @@
1/*------------------------------------------------------------------
2* Filename: MS_ICMP.H
3*
4* Description: Prototypes of Microsoft's ICMP.DLL functions for
5* access to Internet Control Message Protocol (their stacks do
6* not support the standard Berkeley Sockets raw socket API).
7* Use this to do "ping" or "traceroute," although beware that
8* Microsoft discourages its use.
9*/
10
11
12/* Note 2: For the most part, you can refer to RFC 791 for detials on
13* how to fill in values for the IP option information structure. */
14typedef struct ip_option_information {
15 u_char Ttl; /* Time To Live (used for traceroute) */
16 u_char Tos; /* Type Of Service (usually 0) */
17 u_char Flags; /* IP header flags (usually 0) */
18 u_char OptionsSize; /* Size of options data (usually 0, max 40) */
19 u_char FAR *OptionsData;/* Options data buffer */
20 }IPINFO, *PIPINFO, FAR *LPIPINFO;
21
22/* Note 1: The Reply Buffer will have an array of ICMP_ECHO_REPLY
23* structures, followed by options and the data in ICMP echo reply
24* datagram received. You must have room for at least one ICMP
25* echo reply structure, plus 8 bytes for an ICMP header. */
26typedef struct icmp_echo_reply {
27 u_long Address; /* source address */
28 u_long Status; /* IP status value (see below) */
29 u_long RTTime; /* Round Trip Time in milliseconds */
30 u_short DataSize; /* reply data size */
31 u_short Reserved; /* */
32 void FAR *Data; /* reply data buffer */
33 typedef struct ip_option_information Options; /* reply options */
34 }ICMPECHO, *PICMPECHO, FAR *LPICMPECHO;
35
36#define IP_STATUS_BASE 11000
37#define IP_SUCCESS 0
38#define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1)
39#define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2)
40#define IP_DEST_HOST_UNREACHABLE (IP_STATUS_BASE + 3)
41#define IP_DEST_PROT_UNREACHABLE (IP_STATUS_BASE + 4)
42#define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
43#define IP_NO_RESOURCES (IP_STATUS_BASE + 6)
44#define IP_BAD_OPTION (IP_STATUS_BASE + 7)
45#define IP_HW_ERROR (IP_STATUS_BASE + 8)
46#define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9)
47#define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10)
48#define IP_BAD_REQ (IP_STATUS_BASE + 11)
49#define IP_BAD_ROUTE (IP_STATUS_BASE + 12)
50#define IP_TTL_EXPIRED_TRANSIT (IP_STATUS_BASE + 13)
51#define IP_TTL_EXPIRED_REASSEM (IP_STATUS_BASE + 14)
52#define IP_PARAM_PROBLEM (IP_STATUS_BASE + 15)
53#define IP_SOURCE_QUENCH (IP_STATUS_BASE + 16)
54#define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17)
55#define IP_BAD_DESTINATION (IP_STATUS_BASE + 18)
56#define IP_ADDR_DELETED (IP_STATUS_BASE + 19)
57#define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 20)
58#define IP_MTU_CHANGE (IP_STATUS_BASE + 21)
59#define IP_UNLOAD (IP_STATUS_BASE + 22)
60#define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50)
61#define MAX_IP_STATUS IP_GENERAL_FAILURE
62#define IP_PENDING (IP_STATUS_BASE + 255)
63
64
65HANDLE WINAPI PASCAL IcmpCreateFile(VOID); /* INVALID_HANDLE_VALUE on error */
66BOOL WINAPI PASCAL IcmpCloseHandle(HANDLE IcmpHandle); /* FALSE on error */
67DWORD WINAPI PASCAL IcmpSendEcho(
68 HANDLE IcmpHandle, /* handle returned from IcmpCreateFile() */
69 u_long DestAddress, /* destination IP address (in network order) */
70 LPVOID RequestData, /* pointer to buffer to send */
71 WORD RequestSize, /* length of data in buffer */
72 LPIPINFO RequestOptns, /* see Note 2 below */
73 LPVOID ReplyBuffer, /* see Note 1 below */
74 DWORD ReplySize, /* length of reply (must allow at least 1 reply) */
75 DWORD Timeout /* time in milliseconds to wait for reply */
76);
77
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 @@
1// stdafx.cpp : source file that includes just the standard includes
2 //Dipstick.pch will be the pre-compiled header
3 //stdafx.obj will contain the pre-compiled type information
4
5#include "stdafx.h"
6
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 @@
1// stdafx.h : include file for standard system include files,
2// or project specific include files that are used frequently, but
3// are changed infrequently
4//
5
6 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
7
8#include <afxwin.h> // MFC core and standard components
9#include <afxext.h> // MFC extensions
10#ifndef _AFX_NO_AFXCMN_SUPPORT
11 #include <afxcmn.h> // MFC support for Windows 95 Common Controls
12#endif // _AFX_NO_AFXCMN_SUPPORT
13
14 #include <afxsock.h> // MFC socket extensions
15
16#include <afxole.h>
17#include <afxtempl.h>
18#include <afxmt.h>
19
20#include <winsock.h>
21#include "shared-code/ms_icmp.h"
22#include "shared-code/ip_icmp.h"
23
24#include "shared-code/kICMP.h"
25#include "shared-code/RegEx.h"
26#include "CrackURL.h"
27
28 enum{
29 WM_DNP_ACTIVITYCOUNT = WM_USER+16,
30 WM_DNP_URLPING,
31 WM_DNP_UPDATEHOSTDATA,
32 WM_DNP_HTML
33};
34#include <MMSystem.h>
35// CG: The following line was added by the Windows Multimedia component.
36#pragma comment(lib, "winmm.lib")