From 5305ddd8332ebd905ebef3b8365fc0d736858a7a Mon Sep 17 00:00:00 2001 From: Michael Krelin Date: Mon, 05 Jul 2004 01:53:09 +0000 Subject: initial commit into svn repository git-svn-id: http://svn.klever.net/kin/dipstick/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..31b8754 --- a/dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ + +# / +/Debug +/Release +/Releast +/debug +/release +/releast +/DEBUG +/RELEASE +/RELEAST +/*.mdp +/*.ncb +/*.aps +/redist + +# /help/ +/help/DIPSTICK.HLP +/help/dipstick.LOG +/help/dipstick.hm +/help/dipstick.GID + +# /install/ +/install/debug +/install/pure +/install/canned +/install/static +/install/Debug +/install/Pure +/install/Canned +/install/Static +/install/DEBUG +/install/PURE +/install/CANNED +/install/STATIC +/install/*.aps diff --git a/AutoBestDlg.cpp b/AutoBestDlg.cpp new file mode 100644 index 0000000..cf18c9c --- a/dev/null +++ b/AutoBestDlg.cpp @@ -0,0 +1,109 @@ +// AutoBestDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "Dipstick.h" +#include "AutoBestDlg.h" + +#include "URLSource.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CAutoBestDlg dialog + + +CAutoBestDlg::CAutoBestDlg(CWnd* pParent /*=NULL*/) + : CDialog(CAutoBestDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CAutoBestDlg) + m_PktLoss = _T(""); + m_RTT = _T(""); + m_URL = _T(""); + //}}AFX_DATA_INIT +} + + +void CAutoBestDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAutoBestDlg) + DDX_Control(pDX, IDC_DROPSOURCE, m_DropSourceCtl); + DDX_Control(pDX, IDC_PREV, m_PrevCtl); + DDX_Control(pDX, IDC_NEXT, m_NextCtl); + DDX_Text(pDX, IDC_PKTLOSS, m_PktLoss); + DDX_Text(pDX, IDC_RTT, m_RTT); + DDX_Text(pDX, IDC_URL, m_URL); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CAutoBestDlg, CDialog) + //{{AFX_MSG_MAP(CAutoBestDlg) + ON_BN_CLICKED(IDC_NEXT, OnNext) + ON_BN_CLICKED(IDC_PREV, OnPrev) + ON_WM_LBUTTONDOWN() + ON_BN_CLICKED(IDC_COPYURL, OnCopyurl) + ON_WM_HELPINFO() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CAutoBestDlg message handlers + +void CAutoBestDlg::OnNext() +{ + EndDialog(IDC_NEXT); +} + +void CAutoBestDlg::OnPrev() +{ + EndDialog(IDC_PREV); +} + +BOOL CAutoBestDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_NextCtl.EnableWindow(m_bNext); + m_PrevCtl.EnableWindow(m_bPrev); + + VERIFY(m_DropSourceCtl.Open(IDR_DRAGAVI)); + SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +CAutoBestDlg::~CAutoBestDlg() +{ +} + +void CAutoBestDlg::OnLButtonDown(UINT nFlags, CPoint point) +{ + if(ChildWindowFromPoint(point,CWP_ALL)==&m_DropSourceCtl){ + TRACE0("Dragging!\n"); + CURLSource us(m_URL); + m_DropSourceCtl.Stop(); + us.DoDragDrop(DROPEFFECT_COPY|DROPEFFECT_LINK); + m_DropSourceCtl.Play(0,-1,-1); + }else + CDialog::OnLButtonDown(nFlags, point); +} + +void CAutoBestDlg::OnCopyurl() +{ +CURLSource *us = new CURLSource(m_URL); + us->SetClipboard(); + us->FlushClipboard(); +} + +BOOL CAutoBestDlg::OnHelpInfo(HELPINFO* pHelpInfo) +{ + WinHelp(IDD|0x20000l); + return TRUE; +} diff --git a/AutoBestDlg.h b/AutoBestDlg.h new file mode 100644 index 0000000..fb7ca4c --- a/dev/null +++ b/AutoBestDlg.h @@ -0,0 +1,48 @@ +// AutoBestDlg.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CAutoBestDlg dialog + +class CAutoBestDlg : public CDialog +{ +// Construction +public: + ~CAutoBestDlg(); + BOOL m_bPrev; + BOOL m_bNext; + CAutoBestDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CAutoBestDlg) + enum { IDD = IDD_AUTOBEST }; + CAnimateCtrl m_DropSourceCtl; + CButton m_PrevCtl; + CButton m_NextCtl; + CString m_PktLoss; + CString m_RTT; + CString m_URL; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAutoBestDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CAutoBestDlg) + afx_msg void OnNext(); + afx_msg void OnPrev(); + virtual BOOL OnInitDialog(); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg void OnCopyurl(); + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..ad23259 --- a/dev/null +++ b/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 1996, 1997, 1998, 2002 Klever Group (http://www.klever.net/) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/CrackURL.cpp b/CrackURL.cpp new file mode 100644 index 0000000..6537b42 --- a/dev/null +++ b/CrackURL.cpp @@ -0,0 +1,139 @@ +#include "stdafx.h" +#include "CrackURL.h" + +CCrackURL::CCrackURL() +{ + VERIFY(m_reSchema.Compile("([[:alpha:]]+):",CRegEx::regExtended|CRegEx::regIgnoreCase)); + VERIFY(m_reUPHP.Compile("(([^:]+)?(:([^@]*))?@)?([^:/]+)(:([[:digit:]]+))?",CRegEx::regExtended|CRegEx::regIgnoreCase)); + VERIFY(m_reHTTPReq.Compile("(.*/)?([^#\\?]*)(#[^\\?]*)?(\\?.*)?",CRegEx::regExtended|CRegEx::regIgnoreCase)); +} + +BOOL CCrackURL::Crack(LPCTSTR url) +{ + m_URL = url; +CString rest; + if(m_reSchema.Match(url)){ + m_Schema = m_reSchema.GetMatch(1); + rest = m_reSchema.GetMatch(CRegEx::matchPostMatch); + }else{ + m_Schema.Empty(); + rest = url; + } + if(rest.Left(2)=="//"){ + // URL conforms to common syntax + rest=rest.Mid(2); + ParseUPHP(rest); + }else if(!m_Schema.CompareNoCase("mailto")){ + ParseUPHP(rest); + }else{ + m_User.Empty(); m_Password.Empty(); m_Host.Empty(); m_Port.Empty(); + } + if((!rest.IsEmpty()) && m_reHTTPReq.Match(rest)){ + m_pathPath = m_reHTTPReq.GetMatch(1); + m_pathFile = m_reHTTPReq.GetMatch(2); + m_pathAnchor = m_reHTTPReq.GetMatch(3); + m_pathQuery = m_reHTTPReq.GetMatch(4); + m_URLPath = m_reHTTPReq.GetMatch(CRegEx::matchMatch); + rest = m_reHTTPReq.GetMatch(CRegEx::matchPostMatch); + }else{ + m_URLPath.Empty(); + m_pathPath.Empty(); + m_pathFile.Empty(); + m_pathAnchor.Empty(); + m_pathQuery.Empty(); + } + m_urlRest = rest; + return TRUE; +} + +void CCrackURL::ParseUPHP(CString& rest) +{ + if(m_reUPHP.Match(rest)){ + m_User = m_reUPHP.GetMatch(2); + m_Password = m_reUPHP.GetMatch(4); + m_Host = m_reUPHP.GetMatch(5); + m_Port = m_reUPHP.GetMatch(7); + if(!m_Port.IsEmpty()) + m_nPort = atoi(m_Port); + rest = m_reUPHP.GetMatch(CRegEx::matchPostMatch); + }else{ + m_User.Empty(); + m_Password.Empty(); + m_Host.Empty(); + m_Port.Empty(); + } +} + +BOOL CCrackURL::Adjust(LPCTSTR srcURL) +{ +CCrackURL cracked; + VERIFY(cracked.Crack(srcURL)); + return Adjust(cracked); +} + +BOOL CCrackURL::Adjust(CCrackURL& srcURL) +{ + if(m_Schema.IsEmpty()) m_Schema = srcURL.m_Schema; + if(m_Host.IsEmpty()){ + m_Host = srcURL.m_Host; + if(m_User.IsEmpty()) m_User = srcURL.m_User; + if(m_Password.IsEmpty()) m_Password = srcURL.m_Password; + if(m_Port.IsEmpty()) m_Port = srcURL.m_Port, m_nPort = srcURL.m_nPort; + } + if(m_pathPath.Find('/')==0) + return TRUE; + m_pathPath = srcURL.m_pathPath+m_pathPath; + m_URLPath.Empty(); + return TRUE; +} + +CString CCrackURL::Build() +{ +CString rv; + if(!m_Schema.IsEmpty()) + rv+=m_Schema+':'; + if(!m_Schema.CompareNoCase("mailto")){ + rv+=m_User+'@'+m_Host; + }else{ + rv+="//"; + if(!m_User.IsEmpty()){ + rv+=m_User; + if(!m_Password.IsEmpty()) + rv+=':'+m_Password; + rv+='@'; + } + rv+=m_Host; + if(!m_Port.IsEmpty()) + rv+=':'+m_Port; + if(!m_URLPath.IsEmpty()){ + rv+=m_URLPath; + }else{ + rv+=m_pathPath+m_pathFile+m_pathAnchor+m_pathQuery; + } + } + return rv; +} + +CString CCrackURL::InnermostURL(LPCTSTR url) +{ +static CRegEx reInnerURL; + if(!reInnerURL.m_bCompiled) + VERIFY(reInnerURL.Compile(".+[^[:alpha:]]([[:alpha:]]+://[^&]+)",CRegEx::regExtended|CRegEx::regIgnoreCase)); +CString rv = url; + while(reInnerURL.Match(rv)) + rv=reInnerURL.GetMatch(1); + return rv; +} + +CString CCrackURL::GetHostName(LPCTSTR url) +{ +static CRegEx reHost; + if(!reHost.m_bCompiled) + VERIFY(reHost.Compile("^[[:alpha:]]+://([^/:]+)",CRegEx::regExtended|CRegEx::regIgnoreCase)); +CString rv; + if(reHost.Match(url)) + rv = reHost.GetMatch(1); + else + rv = url; + return rv; +} diff --git a/CrackURL.h b/CrackURL.h new file mode 100644 index 0000000..2223740 --- a/dev/null +++ b/CrackURL.h @@ -0,0 +1,34 @@ +#ifndef __CRACKURL_H +#define __CRACKURL_H + +#include "shared-code/RegEx.h" + +class CCrackURL { +public: + static CString GetHostName(LPCTSTR url); + static CString InnermostURL(LPCTSTR url); + CString Build(); + BOOL Adjust(CCrackURL& srcURL); + CString m_pathPath; + CString m_pathFile; + CString m_pathAnchor; + CString m_pathQuery; + CString m_urlRest; + BOOL Adjust(LPCTSTR srcURL); + CRegEx m_reHTTPReq; + CRegEx m_reUPHP; + CString m_URLPath; + UINT m_nPort; + CString m_Port; + CString m_Host; + CString m_Password; + CString m_User; + void ParseUPHP(CString& rest); + CString m_Schema; + CString m_URL; + BOOL Crack(LPCTSTR url); + CCrackURL(); + CRegEx m_reSchema; +}; + +#endif // __CRACKURL_H diff --git a/DipstickDlg.cpp b/DipstickDlg.cpp new file mode 100644 index 0000000..ace2aff --- a/dev/null +++ b/DipstickDlg.cpp @@ -0,0 +1,1586 @@ +// DipstickDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "Dipstick.h" +#include "DipstickDlg.h" +#include "DragPad.h" +#include "OptionsDlg.h" +#include "HostNameDlg.h" +#include "HostProperties.h" +#include "AutoBestDlg.h" +#include "ddeml.h" + +#include "URLSource.h" +#include "SelectURLsDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + +// Dialog Data + //{{AFX_DATA(CAboutDlg) + enum { IDD = IDD_ABOUTBOX }; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAboutDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + virtual BOOL OnInitDialog(); + //{{AFX_MSG(CAboutDlg) + afx_msg void OnKlevernet(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) + //{{AFX_MSG_MAP(CAboutDlg) + ON_BN_CLICKED(IDC_KLEVERNET, OnKlevernet) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDipstickDlg dialog + +CDipstickDlg::CDipstickDlg(CWnd* pParent /*=NULL*/) + : CDialog(CDipstickDlg::IDD, pParent), + m_DragPad(NULL), m_PingsPerHost(10), m_PingSize(32), m_TimeOut(5000), m_Interval(500), + m_SortCriteria(sortAvg), m_bShown(FALSE), m_MaxThreads(10), m_bExiting(FALSE), + m_bMSWorkAround(TRUE), m_MinSize(-1,-1), m_bAutoBest(TRUE), m_bSmartAdjust(TRUE), + m_bAdjustInnermost(TRUE), m_ActiveThreads(0), m_bIgnorelative(TRUE) +{ +CWinApp *app = AfxGetApp(); + ASSERT(app); +WORD hi,lo; + hi=app->GetProfileInt("Options","IntervalHi",HIWORD(m_Interval)); + lo=app->GetProfileInt("Options","IntervalLo",LOWORD(m_Interval)); + m_Interval=MAKELONG(lo,hi); + m_MaxThreads=app->GetProfileInt("Options","MaxThreads",m_MaxThreads); + m_PingSize=app->GetProfileInt("Options","PingSize",m_PingSize); + m_PingsPerHost=app->GetProfileInt("Options","PingsPerHost",m_PingsPerHost); + m_SortCriteria=app->GetProfileInt("Options","SortBy",m_SortCriteria); + hi=app->GetProfileInt("Options","TimeOutHi",HIWORD(m_TimeOut)); + lo=app->GetProfileInt("Options","TimeOutLo",LOWORD(m_TimeOut)); + m_TimeOut=MAKELONG(lo,hi); + m_bMSWorkAround = app->GetProfileInt("Options","InnermostURL",m_bMSWorkAround); + m_bAutoBest = app->GetProfileInt("Options","AutoBest",m_bAutoBest); + m_bSmartAdjust = app->GetProfileInt("Options","SmartAdjust",m_bSmartAdjust); + m_bAdjustInnermost = app->GetProfileInt("Options","AdjustInnermost",m_bAdjustInnermost); + m_bIgnorelative = app->GetProfileInt("Options","IgnoreRelative",m_bIgnorelative); + m_impexPath = app->GetProfileString("Options","ImportExportPath",m_impexPath); + //{{AFX_DATA_INIT(CDipstickDlg) + //}}AFX_DATA_INIT + // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + m_bmpBack.LoadBitmap(IDB_DIABACK); + m_bmpBack.GetBitmap(&m_bitmapBack); +CString tmp; + VERIFY(tmp.LoadString(IDS_REGEX_HTMLURL)); + VERIFY(m_reHTMLURL.Compile(tmp,CRegEx::regExtended|CRegEx::regIgnoreCase)); +} + +CDipstickDlg::~CDipstickDlg() +{ +} + +void CDipstickDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDipstickDlg) + DDX_Control(pDX, IDC_ADVANCED, m_AdvancedCtl); + DDX_Control(pDX, ID_HELP, m_HelpCtl); + DDX_Control(pDX, IDC_EXIT, m_ExitCtl); + DDX_Control(pDX, IDC_OPTIONS, m_OptionsCtl); + DDX_Control(pDX, IDC_MANUALPING, m_ManualPingCtl); + DDX_Control(pDX, IDC_REMOVE, m_RemoveCtl); + DDX_Control(pDX, IDC_REPINGALL, m_RepingAllCtl); + DDX_Control(pDX, IDC_REPING, m_RepingCtl); + DDX_Control(pDX, IDC_CLEAR, m_ClearListCtl); + DDX_Control(pDX, IDC_HOSTLIST, m_HostList); + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CDipstickDlg, CDialog) + //{{AFX_MSG_MAP(CDipstickDlg) + ON_WM_SYSCOMMAND() + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_WM_DESTROY() + ON_BN_CLICKED(IDC_OPTIONS, OnOptions) + ON_MESSAGE(WM_DNP_URLPING, OnUrlPing) + ON_MESSAGE(WM_DNP_ACTIVITYCOUNT, OnActivityCount) + ON_MESSAGE(WM_DNP_UPDATEHOSTDATA, OnUpdateHostData) + ON_MESSAGE(WM_DNP_HTML, OnHTMLTransfer) + ON_NOTIFY(LVN_COLUMNCLICK, IDC_HOSTLIST, OnColumnclickHostlist) + ON_WM_WINDOWPOSCHANGING() + ON_COMMAND(ID_DRAGPAD_OPTIONS, OnDragpadOptions) + ON_COMMAND(ID_DRAGPAD_SHOWMAINWINDOW, OnDragpadShowmainwindow) + ON_COMMAND(ID_DRAGPAD_HELP, OnDragpadHelp) + ON_COMMAND(ID_DRAGPAD_ABOUT, OnDragpadAbout) + ON_COMMAND(ID_DRAGPAD_EXIT, OnDragpadExit) + ON_BN_CLICKED(IDC_MANUALPING, OnManualping) + ON_COMMAND(ID_DRAGPAD_MANUALPING, OnDragpadManualping) + ON_COMMAND(ID_DRAGPAD_REPINGALL, OnDragpadRepingAll) + ON_COMMAND(ID_DRAGPAD_REMOVEALL, OnDragpadRemoveAll) + ON_BN_CLICKED(IDC_REPING, OnReping) + ON_BN_CLICKED(IDC_REPINGALL, OnRepingall) + ON_BN_CLICKED(IDC_CLEAR, OnClear) + ON_NOTIFY(LVN_INSERTITEM, IDC_HOSTLIST, OnInsertitemHostlist) + ON_NOTIFY(LVN_DELETEITEM, IDC_HOSTLIST, OnDeleteitemHostlist) + ON_NOTIFY(LVN_DELETEALLITEMS, IDC_HOSTLIST, OnDeleteallitemsHostlist) + ON_BN_CLICKED(IDC_EXIT, OnExit) + ON_NOTIFY(LVN_ITEMCHANGED, IDC_HOSTLIST, OnItemchangedHostlist) + ON_BN_CLICKED(IDC_REMOVE, OnRemove) + ON_NOTIFY(NM_RCLICK, IDC_HOSTLIST, OnRclickHostlist) + ON_COMMAND(ID_HOSTLIST_REPING, OnHostListReping) + ON_COMMAND(ID_HOSTLIST_REMOVE, OnHostListRemove) + ON_COMMAND(ID_HOSTLIST_REPINGALL, OnHostListRepingAll) + ON_COMMAND(ID_HOSTLIST_REMOVEALL, OnHostListRemoveAll) + ON_COMMAND(ID_HOSTLIST_OPENURL, OnHostListOpenURL) + ON_COMMAND(ID_HOSTLIST_PROPERTIES, OnHostListProperties) + ON_NOTIFY(NM_DBLCLK, IDC_HOSTLIST, OnDblclkHostlist) + ON_WM_CLOSE() + ON_WM_GETMINMAXINFO() + ON_WM_SIZE() + ON_BN_CLICKED(ID_HELP, OnHelp) + ON_NOTIFY(LVN_BEGINDRAG, IDC_HOSTLIST, OnBegindragHostlist) + ON_COMMAND(ID_HOSTLIST_PASTEURL, OnPasteurl) + ON_COMMAND(ID_HOSTLIST_COPYURL, OnHostlistCopyurl) + ON_WM_HELPINFO() + ON_WM_DROPFILES() + ON_BN_CLICKED(IDC_ADVANCED, OnAdvanced) + ON_COMMAND(ID_ADVANCED_EXPORTLIST, OnAdvancedExportlist) + ON_COMMAND(ID_ADVANCED_IMPORTLIST, OnAdvancedImportlist) + ON_COMMAND(ID_DRAGPAD_PASTEURL, OnPasteurl) + ON_COMMAND(ID_DRAGPAD_ADVANCED_EXPORTLIST, OnDragpadAdvancedExportlist) + ON_COMMAND(ID_DRAGPAD_ADVANCED_IMPORTLIST, OnDragpadAdvancedImportlist) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDipstickDlg message handlers + +BOOL CDipstickDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // Add "About..." menu item to system menu. + + // IDM_ABOUTBOX must be in the system command range. + ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); + ASSERT(IDM_ABOUTBOX < 0xF000); + + CMenu* pSysMenu = GetSystemMenu(FALSE); + CString strAboutMenu; + strAboutMenu.LoadString(IDS_ABOUTBOX); + if (!strAboutMenu.IsEmpty()) + { + pSysMenu->AppendMenu(MF_SEPARATOR); + pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); + } + + // Set the icon for this dialog. The framework does this automatically + // when the application's main window is not a dialog + SetIcon(m_hIcon, TRUE); // Set big icon + SetIcon(m_hIcon, FALSE); // Set small icon + +CRect wrci, wrco; + GetWindowRect(&wrco); + GetClientRect(&wrci); +CRect brc1, brc2, lrc; + m_HostList.GetWindowRect(&lrc); + ScreenToClient(&lrc); + m_ManualPingCtl.GetWindowRect(&brc1); + ScreenToClient(brc1); + m_RepingCtl.GetWindowRect(&brc2); + ScreenToClient(&brc2); + m_OverX = lrc.left; + m_OverY = lrc.top; + m_GapY = brc2.top - brc1.bottom; + m_MinSize.cx = m_OverX+m_OverX+m_OverX+brc1.Width()+m_OverX; + m_MinSize.cy = m_OverY+(brc1.Height()+m_GapY)*6+(brc1.Height()+m_GapY)*3+m_OverY; + m_MinSize.cx+=wrco.Width()-wrci.Width(); + m_MinSize.cy+=wrco.Height()-wrci.Height(); + +CWinApp *app = AfxGetApp(); + ASSERT(app); +CRect wrc; + wrc.top=app->GetProfileInt("Windows","DlgTop",-1); + wrc.bottom=app->GetProfileInt("Windows","DlgBottom",-1); + wrc.left=app->GetProfileInt("Windows","DlgLeft",-1); + wrc.right=app->GetProfileInt("Windows","DlgRight",-1); + if((wrc.top!=-1|| wrc.bottom!=-1) && wrc.left!=-1&& wrc.right!=-1) + MoveWindow(&wrc); + + RecalcLayout(-1,-1); + + m_DragPad = new CDragPad(); + m_DragPad->m_Daddy=this; + m_DragPad->Create(CDragPad::IDD); + m_Images.Create(16,16,TRUE,4,1); + m_iPending=m_Images.Add(app->LoadIcon(IDI_PENDING)); + m_iPinging=m_Images.Add(app->LoadIcon(IDI_PINGING)); + m_iCompleted=m_Images.Add(app->LoadIcon(IDI_COMPLETED)); + m_iUnreachable=m_Images.Add(app->LoadIcon(IDI_UNREACHABLE)); + ASSERT(!(m_iPending<0 || m_iPinging<0 || m_iCompleted<0 || m_iUnreachable<0)); + m_HostList.SetImageList(&m_Images,LVSIL_NORMAL); + m_HostList.SetImageList(&m_Images,LVSIL_SMALL); + m_HostList.SetImageList(&m_Images,LVSIL_STATE); + m_HostList.SetTextColor(RGB(255,255,0)); // Yellow + m_HostList.SetTextBkColor(RGB(12,167,0)); // Green + m_HostList.SetBkColor(RGB(12,167,0)); // Green +CRect listrc; + m_HostList.GetClientRect(&listrc); + m_HostList.InsertColumn(0,"Host Name",LVCFMT_LEFT,app->GetProfileInt("Columns","HostName",listrc.Width()-(listrc.Width()*2/16)*4-(listrc.Width()*3/16)),subitemHost); + m_HostList.InsertColumn(1,"Host IP",LVCFMT_LEFT,app->GetProfileInt("Columns","HostIP",listrc.Width()*3/16),subitemIP); + m_HostList.InsertColumn(2,"Min RTT",LVCFMT_RIGHT,app->GetProfileInt("Columns","MinRTT",listrc.Width()*2/16),subitemMin); + m_HostList.InsertColumn(3,"Avg RTT",LVCFMT_RIGHT,app->GetProfileInt("Columns","AvgRTT",listrc.Width()*2/16),subitemAvg); + m_HostList.InsertColumn(4,"Max RTT",LVCFMT_RIGHT,app->GetProfileInt("Columns","MaxRTT",listrc.Width()*2/16),subitemMax); + m_HostList.InsertColumn(5,"Pktloss", LVCFMT_RIGHT,app->GetProfileInt("Columns","PktLoss",listrc.Width()*2/16),subitemPacketloss); + + DragAcceptFiles(TRUE); + + return TRUE; // return TRUE unless you set the focus to a control +} + +void CDipstickDlg::OnSysCommand(UINT nID, LPARAM lParam) +{ + if ((nID & 0xFFF0) == IDM_ABOUTBOX) + { + CAboutDlg dlgAbout; + dlgAbout.DoModal(); + } + else + { + CDialog::OnSysCommand(nID, lParam); + } +} + +// If you add a minimize button to your dialog, you will need the code below +// to draw the icon. For MFC applications using the document/view model, +// this is automatically done for you by the framework. + +void CDipstickDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); + + // Center icon in client rectangle + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // Draw the icon + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CPaintDC pDC(this); + CDC bmpDC; + bmpDC.CreateCompatibleDC(&pDC); + bmpDC.SelectObject(&m_bmpBack); + CRect rc; + GetClientRect(&rc); + for(int x=-m_bitmapBack.bmWidth*2/4;xDestroyWindow(); + delete m_DragPad; + m_DragPad=NULL; + // *** Eventually move the following code to separate function +POSITION p = m_Hosts.GetHeadPosition(); + while(p){ + POSITION pp = p; + CPingyHost *host = m_Hosts.GetNext(p); + ASSERT(host); + m_Hosts.RemoveAt(pp); + host->Suicide(); + } + ASSERT(m_Hosts.IsEmpty()); +} + +void CDipstickDlg::OnOptions() +{ +COptionsDlg o(this); + o.m_Pings = m_PingsPerHost; + o.m_PingSize = m_PingSize; + o.m_TimeOut = max(1,m_TimeOut/1000); + o.m_Interval = max(1,m_Interval/1000); + o.m_MaxThreads = m_MaxThreads; + o.m_bMSWorkAround = m_bMSWorkAround; + o.m_bAutoBest = m_bAutoBest; + o.m_bAdjust = m_bSmartAdjust; + o.m_bAdjustInn = m_bAdjustInnermost; + o.m_bIgnorelative = m_bIgnorelative; + if(o.DoModal()==IDOK){ + m_PingsPerHost = o.m_Pings; + m_PingSize = o.m_PingSize; + m_TimeOut = o.m_TimeOut*1000; + m_Interval = o.m_Interval*1000; + m_MaxThreads = o.m_MaxThreads; + m_bMSWorkAround = o.m_bMSWorkAround; + m_bAutoBest = o.m_bAutoBest; + m_bSmartAdjust = o.m_bAdjust; + m_bAdjustInnermost = o.m_bAdjustInn; + m_bIgnorelative = o.m_bIgnorelative; + } +} + +BOOL CDipstickDlg::AddPingyHost(CPingyHost *host) +{ + m_Hosts.AddTail(host); +int i = m_HostList.InsertItem(0,host->m_HostName); + m_HostList.SetItemData(i,(DWORD)host); + UpdateDragpadTitle(); + return UpdatePingyHost(host,i); // *** Do someting if failed. +} + +BOOL CDipstickDlg::UpdatePingyHost(CPingyHost *host,int index) +{ + UpdateDragpadTitle(); +int i = index; + if(i<0){ + int is = m_HostList.GetItemCount(); + for(i=0;im_HostName.IsEmpty()?"...":host->m_HostName); + m_HostList.SetItemText(i,subitemIP,host->m_IP?inet_ntoa(*(in_addr*)&host->m_IP):"..."); + if(host->m_Pinged && host->m_Packetloss>=0){ + CString tmp; + if(host->m_Packetloss==100){ + m_HostList.SetItemText(i,subitemMin,"-"); + m_HostList.SetItemText(i,subitemAvg,"-"); + m_HostList.SetItemText(i,subitemMax,"-"); + }else{ + tmp.Format("%lu",host->m_MinRTT); + m_HostList.SetItemText(i,subitemMin,tmp); + tmp.Format("%lu",host->m_AvgRTT); + m_HostList.SetItemText(i,subitemAvg,tmp); + tmp.Format("%lu",host->m_MaxRTT); + m_HostList.SetItemText(i,subitemMax,tmp); + } + tmp.Format("%d%%",host->m_Packetloss); + m_HostList.SetItemText(i,subitemPacketloss,tmp); + }else{ + m_HostList.SetItemText(i,subitemMin,"..."); + m_HostList.SetItemText(i,subitemAvg,"..."); + m_HostList.SetItemText(i,subitemMax,"..."); + m_HostList.SetItemText(i,subitemPacketloss,"..."); + } + if(host->m_Pinging) + m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iPinging,0,0,0); + else{ + if(host->m_bToPing) + m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iPending,0,0,0); + else{ + if(host->m_Pinged){ + if(host->m_Packetloss==100) + m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iUnreachable,0,0,0); + else + m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iCompleted,0,0,0); + }else + m_HostList.SetItem(i,subitemHost,LVIF_IMAGE,NULL,m_iPending,0,0,0); + } + } + m_HostList.SortItems(CompareItems,(DWORD)this); + UpdateControlButtons(); + return TRUE; +} + +BOOL CDipstickDlg::RemovePingyHost(CPingyHost *host,int index) +{ + if(host->m_Pinging) + return FALSE; +int i = index; + if(i<0){ + int is = m_HostList.GetItemCount(); + for(i=0;iSuicide(); + UpdateControlButtons(); + UpdateDragpadTitle(); + return TRUE; +} + +LRESULT CDipstickDlg::OnUrlPing(WPARAM wP, LPARAM lP) +{ + ASSERT(lP); +CString *u = (CString*)lP; +CString hn; +CPingyHost *host; + if(m_bMSWorkAround) + hn = CCrackURL::InnermostURL(*u); + else + hn = *u; + hn = CCrackURL::GetHostName(hn); +DWORD ip = inet_addr(hn); + if(ip==INADDR_NONE) + host = new CPingyHost(this,(char*)(LPCTSTR)hn); + else + host = new CPingyHost(this,ip); + host->m_URL=*u; + delete u; + AddPingyHost(host); + CheckForPendingRequests(); + return 0; +} + +LRESULT CDipstickDlg::OnActivityCount(WPARAM wP,LPARAM) +{ + if(!wP) + return 0; +int crement = (int)wP; + m_ActiveThreads+=crement; + if(m_ActiveThreads<0){ + TRACE0("C'est n'est pas possible!\n"); + m_ActiveThreads=0; + } + TRACE1("AC: %d\n",m_ActiveThreads); + if(m_ActiveThreads){ + m_DragPad->m_DragNDropTarget.Play(0,(UINT)-1,(UINT)-1); + m_ClearListCtl.EnableWindow(FALSE); + }else{ + m_DragPad->m_DragNDropTarget.Stop(); + m_DragPad->m_DragNDropTarget.Seek(0); + if(m_HostList.GetItemCount()) + m_ClearListCtl.EnableWindow(TRUE); + } + if(crement>0) + return 0; + UpdateDragpadTitle(); +int items = m_HostList.GetItemCount(); + if((!CheckForPendingRequests()) && m_bAutoBest && items && !m_ActiveThreads){ + // Come up with the best URL.. + m_SortCriteria=sortAvg; + m_HostList.SortItems(CompareItems,(DWORD)this); + CPtrArray hs; + for(int tmp=0;tmpm_Pinging); + ASSERT(host->m_Pinged); + if(host->m_Packetloss==100 || host->m_URL.IsEmpty()) + continue; + hs.Add(host); + } + if(hs.GetSize()){ + int item = 0; + if(!::PlaySound((LPCTSTR)IDW_BESTURL,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE)) + MessageBeep(0xFFFFFFFF); + for(;;){ + CPingyHost *host = (CPingyHost*)hs[item]; + CAutoBestDlg abd; + abd.m_bPrev = (item>0); + abd.m_bNext = (itemm_Packetloss); + abd.m_RTT.Format("%lu",host->m_AvgRTT); + abd.m_URL=host->m_URL; + int rv = abd.DoModal(); + if(rv==IDOK){ + ShellExecute(::GetDesktopWindow(),"open",host->m_URL,NULL,NULL,SW_SHOWMAXIMIZED); + CString title, text; + VERIFY(title.LoadString(IDS_ABEST_TITLE)); + VERIFY(text.LoadString(IDS_ABEST_CLEANUP)); + if(MessageBox(text,title,MB_YESNO|MB_ICONQUESTION|MB_APPLMODAL)==IDYES) + OnClear(); + break; + }else if(rv==IDCANCEL){ + break; + }else if(rv==IDC_PREV){ + item--; + ASSERT(item>=0); + }else if(rv==IDC_NEXT){ + item++; + ASSERT(itemm_SortCriteria; + switch(criteria){ + case sortHost: + return h1->m_HostName.CompareNoCase(h2->m_HostName); + case sortIP: + return htonl(h1->m_IP)-htonl(h2->m_IP); + default: + if(h1->m_Pinged){ + if(!h2->m_Pinged) + return -1; + if(h1->m_Packetloss==100){ + if(h2->m_Packetloss!=100) + return 1; + return 0; + }else{ + if(h2->m_Packetloss==100) + return -1; + } + }else{ + if(h2->m_Pinged) + return 1; + break; + } + switch(criteria){ + case sortMin: + return h1->m_MinRTT-h2->m_MinRTT; + case sortAvg: + return h1->m_AvgRTT-h2->m_AvgRTT; + case sortMax: + return h1->m_MaxRTT-h2->m_MaxRTT; + case sortLoss: + return h1->m_Packetloss-h2->m_Packetloss; + } + } + return 0; +} + +void CDipstickDlg::OnColumnclickHostlist(NMHDR* pNMHDR, LRESULT* pResult) +{ + NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; + switch(pNMListView->iSubItem){ + case subitemHost: m_SortCriteria=sortHost; break; + case subitemIP: m_SortCriteria=sortIP; break; + case subitemMin: m_SortCriteria=sortMin; break; + case subitemAvg: m_SortCriteria=sortAvg; break; + case subitemMax: m_SortCriteria=sortMax; break; + case subitemPacketloss: m_SortCriteria=sortLoss; break; + } + m_HostList.SortItems(CompareItems,(DWORD)this); + *pResult = 0; +} + +BOOL CDipstickDlg::PreCreateWindow(CREATESTRUCT& cs) +{ + cs.style&=~WS_VISIBLE; + return CDialog::PreCreateWindow(cs); +} + +void CDipstickDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) +{ + CDialog::OnWindowPosChanging(lpwndpos); + if(!m_bExiting){ + if(m_bShown){ + lpwndpos->flags&=~SWP_HIDEWINDOW; + lpwndpos->flags|=SWP_SHOWWINDOW; + }else{ + lpwndpos->flags&=~SWP_SHOWWINDOW; + lpwndpos->flags|=SWP_HIDEWINDOW; + } + } +} + +void CDipstickDlg::OnDragpadOptions() +{ + OnOptions(); +} +void CDipstickDlg::OnDragpadShowmainwindow() +{ + m_DragPad->ToggleMainWindowDisplay(); +} +void CDipstickDlg::OnDragpadHelp() +{ + OnHelp(); +} +void CDipstickDlg::OnDragpadAbout() +{ +CAboutDlg dlgAbout; + dlgAbout.DoModal(); +} +void CDipstickDlg::OnDragpadExit() +{ + // *** More threading-aware + OnOK(); +} + +int CDipstickDlg::CheckForPendingRequests() +{ +static BOOL bChecking = FALSE; + if(bChecking) + return -1; + bChecking = TRUE; + TRACE1("CFPR: AC: %d\n",m_ActiveThreads); +int newRequests = m_MaxThreads-m_ActiveThreads; +POSITION p = m_Hosts.GetHeadPosition(); +int rv = 0; + while(newRequests>0 && p){ + CPingyHost *host = m_Hosts.GetNext(p); + ASSERT(host); + if(host->m_Pinging) + continue; + if(!host->m_bToPing) + continue; + TRACE0("!"); + host->Ping(); + newRequests--; + rv++; + } + TRACE0("/CFPR\n"); + bChecking = FALSE; + return rv; +} + +void CAboutDlg::OnKlevernet() +{ +CString url; + url.LoadString(IDS_KLEVERNET_URL); + ShellExecute(::GetDesktopWindow(),"open",url,NULL,NULL,SW_SHOWMAXIMIZED); +} + +void CDipstickDlg::OnOK() +{ +CWinApp *app = AfxGetApp(); + ASSERT(app); + app->WriteProfileInt("Options","IntervalHi",HIWORD(m_Interval)); + app->WriteProfileInt("Options","IntervalLo",LOWORD(m_Interval)); + app->WriteProfileInt("Options","MaxThreads",m_MaxThreads); + app->WriteProfileInt("Options","PingSize",m_PingSize); + app->WriteProfileInt("Options","PingsPerHost",m_PingsPerHost); + app->WriteProfileInt("Options","SortBy",m_SortCriteria); + app->WriteProfileInt("Options","TimeOutHi",HIWORD(m_TimeOut)); + app->WriteProfileInt("Options","TimeOutLo",LOWORD(m_TimeOut)); + app->WriteProfileInt("Options","InnermostURL",m_bMSWorkAround); + app->WriteProfileInt("Options","AutoBest",m_bAutoBest); + app->WriteProfileInt("Options","SmartAdjust",m_bSmartAdjust); + app->WriteProfileInt("Options","AdjustInnermost",m_bAdjustInnermost); + app->WriteProfileInt("Options","IgnoreRelative",m_bIgnorelative); + app->WriteProfileString("Options","ImportExportPath",m_impexPath); +CRect rc; + GetWindowRect(&rc); + app->WriteProfileInt("Windows","DlgTop",rc.top); + app->WriteProfileInt("Windows","DlgBottom",rc.bottom); + app->WriteProfileInt("Windows","DlgLeft",rc.left); + app->WriteProfileInt("Windows","DlgRight",rc.right); + m_DragPad->GetWindowRect(&rc); + app->WriteProfileInt("Windows","DragPadTop",rc.top); + app->WriteProfileInt("Windows","DragPadLeft",rc.left); + // Columns + app->WriteProfileInt("Columns","HostName",m_HostList.GetColumnWidth(0)); + app->WriteProfileInt("Columns","HostIP",m_HostList.GetColumnWidth(1)); + app->WriteProfileInt("Columns","MinRTT",m_HostList.GetColumnWidth(2)); + app->WriteProfileInt("Columns","AvgRTT",m_HostList.GetColumnWidth(3)); + app->WriteProfileInt("Columns","MaxRTT",m_HostList.GetColumnWidth(4)); + app->WriteProfileInt("Columns","PktLoss",m_HostList.GetColumnWidth(5)); + m_bExiting=TRUE; + CDialog::OnOK(); +} + +void CDipstickDlg::OnCancel() +{ +} + +void CDipstickDlg::OnManualping() +{ +CHostNameDlg hnd(this); + if(hnd.DoModal()==IDOK && !hnd.m_Host.IsEmpty()){ + CString *host = new CString(hnd.m_Host); + ASSERT(host); + PostMessage(WM_DNP_URLPING,0,(LPARAM)host); + } +} + +void CDipstickDlg::OnDragpadManualping() +{ + OnManualping(); +} + +void CDipstickDlg::OnDragpadRepingAll() +{ + OnRepingall(); +} +void CDipstickDlg::OnDragpadRemoveAll() +{ + OnClear(); +} + +void CDipstickDlg::OnReping() +{ + if(!m_HostList.GetSelectedCount()) + return; +int items = m_HostList.GetItemCount(); + for(int tmp=0;tmpm_Pinged && !host->m_Pinging) + host->m_bToPing=TRUE; + } + UpdateDragpadTitle(); + CheckForPendingRequests(); +} + +void CDipstickDlg::OnRepingall() +{ +POSITION p = m_Hosts.GetHeadPosition(); + while(p){ + CPingyHost *host = m_Hosts.GetNext(p); + ASSERT(host); + if(host->m_Pinged && !host->m_Pinging) + host->m_bToPing=TRUE; + } + UpdateDragpadTitle(); + CheckForPendingRequests(); +} + +void CDipstickDlg::OnClear() +{ + if(m_ActiveThreads) + return; + m_HostList.DeleteAllItems(); + // *** Eventually move the following code to separate function +POSITION p = m_Hosts.GetHeadPosition(); + while(p){ + POSITION pp = p; + CPingyHost *host = (CPingyHost*)m_Hosts.GetNext(p); + ASSERT(host); + m_Hosts.RemoveAt(pp); + host->Suicide(); + } + ASSERT(m_Hosts.IsEmpty()); + UpdateDragpadTitle(); +} + +void CDipstickDlg::OnInsertitemHostlist(NMHDR* pNMHDR, LRESULT* pResult) +{ +NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; + m_RepingCtl.EnableWindow(TRUE); + m_RepingAllCtl.EnableWindow(TRUE); + UpdateDragpadTitle(); + *pResult = 0; +} + +void CDipstickDlg::OnDeleteitemHostlist(NMHDR* pNMHDR, LRESULT* pResult) +{ +NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; + if(!m_HostList.GetItemCount()){ + m_RepingCtl.EnableWindow(FALSE); + m_RepingAllCtl.EnableWindow(FALSE); + m_ClearListCtl.EnableWindow(FALSE); + } + UpdateDragpadTitle(); + *pResult = 0; +} + +void CDipstickDlg::OnDeleteallitemsHostlist(NMHDR* pNMHDR, LRESULT* pResult) +{ +NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; + m_RepingCtl.EnableWindow(FALSE); + m_RepingAllCtl.EnableWindow(FALSE); + m_ClearListCtl.EnableWindow(FALSE); + UpdateDragpadTitle(); + *pResult = 0; +} + +void CDipstickDlg::OnExit() +{ + OnOK(); +} + +void CDipstickDlg::OnItemchangedHostlist(NMHDR* pNMHDR, LRESULT* pResult) +{ +NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; + if(pNMListView->uChanged&LVIF_STATE && (pNMListView->uOldState&LVIS_SELECTED)!=(pNMListView->uNewState&LVIS_SELECTED)) + UpdateControlButtons(); + UpdateDragpadTitle(); + *pResult = 0; +} + +void CDipstickDlg::UpdateControlButtons() +{ +int items = m_HostList.GetItemCount(); + if(!items){ + m_ClearListCtl.EnableWindow(FALSE); + m_RemoveCtl.EnableWindow(FALSE); + m_RepingAllCtl.EnableWindow(FALSE); + m_RepingCtl.EnableWindow(FALSE); + return; + } +BOOL cl = m_ActiveThreads?FALSE:TRUE, rm = FALSE, ra = FALSE, rp = FALSE; + for(int tmp=0;tmpm_Pinging){ + ra=TRUE; + if(m_HostList.GetItemState(tmp,LVIS_SELECTED)&LVIS_SELECTED){ + rp = TRUE; + rm = TRUE; + break; + } + } + } + m_ClearListCtl.EnableWindow(cl); + m_RemoveCtl.EnableWindow(rm); + m_RepingAllCtl.EnableWindow(ra); + m_RepingCtl.EnableWindow(rp); +} + +void CDipstickDlg::OnRemove() +{ + if(!m_HostList.GetSelectedCount()) + return; +int items = m_HostList.GetItemCount(); + for(int tmp=0;tmpm_Pinging) + RemovePingyHost(host,tmp); + } +} + +void CDipstickDlg::OnRclickHostlist(NMHDR* pNMHDR, LRESULT* pResult) +{ + if(!m_HostList.GetSelectedCount()) + return; +int items = m_HostList.GetItemCount(); +int item = -1; + for(int tmp=0;tmp=0); +CPoint p; + VERIFY(m_HostList.GetItemPosition(item,&p)); +CPingyHost *host = (CPingyHost*)m_HostList.GetItemData(item); + ASSERT(host); + m_HostList.ClientToScreen(&p); +CMenu menus; + VERIFY(menus.LoadMenu(IDR_MENU)); +CMenu *popUp = menus.GetSubMenu(1); + ASSERT(popUp); + UpdateControlButtons(); + popUp->EnableMenuItem(ID_HOSTLIST_REPING,MF_BYCOMMAND|(m_RepingCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED)); + popUp->EnableMenuItem(ID_HOSTLIST_REMOVE,MF_BYCOMMAND|(m_RemoveCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED)); + popUp->EnableMenuItem(ID_HOSTLIST_REMOVEALL,MF_BYCOMMAND|(m_ClearListCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED)); + popUp->EnableMenuItem(ID_HOSTLIST_REPINGALL,MF_BYCOMMAND|(m_RepingAllCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED)); + popUp->EnableMenuItem(ID_HOSTLIST_OPENURL,MF_BYCOMMAND|((m_HostList.GetSelectedCount()==1 && !host->m_URL.IsEmpty())?MF_ENABLED:MF_GRAYED)); + popUp->EnableMenuItem(ID_HOSTLIST_COPYURL,MF_BYCOMMAND|((m_HostList.GetSelectedCount()==1 && !host->m_URL.IsEmpty())?MF_ENABLED:MF_GRAYED)); + popUp->EnableMenuItem(ID_HOSTLIST_PROPERTIES,MF_BYCOMMAND|((m_HostList.GetSelectedCount()==1)?MF_ENABLED:MF_GRAYED)); + popUp->EnableMenuItem(ID_HOSTLIST_PASTEURL,MF_BYCOMMAND|(IsPasteableClipboard()?MF_ENABLED:MF_GRAYED)); + popUp->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_LEFTBUTTON,p.x,p.y,this); + *pResult = 0; +} + +void CDipstickDlg::OnHostListReping() +{ + OnReping(); +} +void CDipstickDlg::OnHostListRemove() +{ + OnRemove(); +} +void CDipstickDlg::OnHostListRepingAll() +{ + OnRepingall(); +} +void CDipstickDlg::OnHostListRemoveAll() +{ + OnClear(); +} +void CDipstickDlg::OnHostListOpenURL() +{ + if(m_HostList.GetSelectedCount()!=1) + return; +int items = m_HostList.GetItemCount(); + for(int tmp=0;tmpm_URL.IsEmpty()) + ShellExecute(::GetDesktopWindow(),NULL,host->m_URL,NULL,NULL,SW_SHOWMAXIMIZED); +} + +void CDipstickDlg::OnHostListProperties() +{ + if(m_HostList.GetSelectedCount()!=1) + return; +int items = m_HostList.GetItemCount(); + for(int tmp=0;tmp0 && m_MinSize.cy>0){ + lpMMI->ptMinTrackSize.x = m_MinSize.cx; + lpMMI->ptMinTrackSize.y = m_MinSize.cy; + } +} + +void CDipstickDlg::OnSize(UINT nType, int cx, int cy) +{ + CDialog::OnSize(nType, cx, cy); + if(nType==SIZE_RESTORED) + RecalcLayout(cx,cy); +} + +void CDipstickDlg::RecalcLayout(int,int) +{ +CRect wrc; + GetClientRect(&wrc); +CRect brc; + m_ManualPingCtl.GetWindowRect(&brc); + m_HostList.SetWindowPos(NULL,m_OverX,m_OverY,wrc.Width()-m_OverX*3-brc.Width(),wrc.Height()-m_OverY*2,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOZORDER); +int xb = wrc.Width()-m_OverX-brc.Width(); +int cyb = brc.Height()+m_GapY; + m_ManualPingCtl.SetWindowPos(NULL,xb,m_OverY,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_RepingCtl.SetWindowPos(NULL,xb,m_OverY+cyb,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_RepingAllCtl.SetWindowPos(NULL,xb,m_OverY+cyb*2,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_RemoveCtl.SetWindowPos(NULL,xb,m_OverY+cyb*3,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_ClearListCtl.SetWindowPos(NULL,xb,m_OverY+cyb*4,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_AdvancedCtl.SetWindowPos(NULL,xb,m_OverY+cyb*5,0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_ExitCtl.SetWindowPos(NULL,xb,wrc.Height()-m_OverY-brc.Height(),0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_OptionsCtl.SetWindowPos(NULL,xb,wrc.Height()-m_OverY-cyb-brc.Height(),0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_HelpCtl.SetWindowPos(NULL,xb,wrc.Height()-m_OverY-cyb*2-brc.Height(),0,0,SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); +} + +void CDipstickDlg::OnHelp() +{ + WinHelp(0,HELP_FINDER); +} + +void CDipstickDlg::UpdateDragpadTitle() +{ +int ic = m_HostList.GetItemCount(); +CString title; + if(!ic){ + VERIFY(title.LoadString(IDS_DRAGPAD_TITLE)); + }else{ + int ip = 0; + POSITION p = m_Hosts.GetHeadPosition(); + while(p){ + CPingyHost *host = m_Hosts.GetNext(p); + ASSERT(host); + if(!(host->m_Pinging || host->m_bToPing)) + ip++; + } + title.Format(IDS_DRAGPAD_URLS,ip,ic); + } + if(m_DragPad) + m_DragPad->SetWindowText(title); +} + +void CDipstickDlg::OnBegindragHostlist(NMHDR* pNMHDR, LRESULT* pResult) +{ + NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; + + if(pNMListView->iItem>=0){ + CPingyHost *host = (CPingyHost*) m_HostList.GetItemData(pNMListView->iItem); + ASSERT(host); + if(!host->m_URL.IsEmpty()){ + CURLSource us(host->m_URL); + us.DoDragDrop(DROPEFFECT_COPY|DROPEFFECT_LINK); + } + } + + *pResult = 0; +} + +void CDipstickDlg::OnPasteurl() +{ +COleDataObject odo; + if(!odo.AttachClipboard()) + return; + CollectURLs(&odo,FALSE); +} + +BOOL CDipstickDlg::IsPasteableClipboard() +{ +COleDataObject odo; + if(!odo.AttachClipboard()) + return FALSE; + if(CollectURLs(&odo,TRUE)) + return TRUE; + return FALSE; +} + +BOOL CDipstickDlg::CollectURLs(COleDataObject* pDO,BOOL bTestOnly) +{ +UINT cfURL = RegisterClipboardFormat("UniformResourceLocator"); +UINT cfHTML = RegisterClipboardFormat("HTML Format"); +UINT cfNIF = RegisterClipboardFormat("Netscape Image Format"); + if(pDO->IsDataAvailable(cfURL)){ + if(!bTestOnly){ + HGLOBAL hg = pDO->GetGlobalData(cfURL); + ASSERT(hg); + LPVOID lpv = GlobalLock(hg); + ASSERT(lpv); + PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString((LPCTSTR)lpv)); + GlobalUnlock(hg); + GlobalFree(hg); + } + return TRUE; + } + if(pDO->IsDataAvailable(cfHTML)){ + HGLOBAL hg = pDO->GetGlobalData(cfHTML); + ASSERT(hg); + LPCTSTR lps = (LPCTSTR)GlobalLock(hg); + ASSERT(lps); + BOOL rv = FALSE; + do{ + static LPCTSTR v10 = "Version:1.0\r\n"; + if(memcmp(v10,lps,strlen(v10))) + break; + static LPCTSTR strStartSelection = "StartSelection:"; + static LPCTSTR strEndSelection = "EndSelection:"; + static LPCTSTR strSourceURL = "SourceURL:"; + LPTSTR subs = strstr(lps,strStartSelection); + if(!subs) + break; + LONG startSelection = atol(&subs[strlen(strStartSelection)]); + if(!startSelection) + break; + if(!(subs=strstr(lps,strEndSelection))) + break; + LONG endSelection = atol(&subs[strlen(strEndSelection)]); + if(!endSelection) + break; + if(!(subs=strstr(lps,strSourceURL))) + break; + subs = &subs[strlen(strSourceURL)]; + LPTSTR eol = strchr(subs,'\r'); + if(!eol) + break; + (*eol)=0; + CString sourceURL = subs; + if(!sourceURL.GetLength()) + break; + TRACE0("SourceURL = "+sourceURL+"\n"); + _xferHTML* xf = new _xferHTML; + VERIFY(xf->src.Crack(sourceURL)); + LPTSTR htmlBuff = xf->html.GetBuffer(endSelection-startSelection+2); + ASSERT(htmlBuff); + memmove(htmlBuff,&lps[startSelection],endSelection-startSelection+1); + htmlBuff[endSelection-startSelection+1]=0; + xf->html.ReleaseBuffer(); + if(bTestOnly){ + rv = m_reHTMLURL.Match(xf->html); + delete xf; + }else{ + PostMessage(WM_DNP_HTML,0,(LPARAM)xf); + } + }while(FALSE); + GlobalUnlock(hg); + GlobalFree(hg); + return rv; + } + if(pDO->IsDataAvailable(cfNIF)){ + if(!bTestOnly){ + HGLOBAL hg = pDO->GetGlobalData(cfNIF); + ASSERT(hg); + LPVOID lpv = GlobalLock(hg); + ASSERT(lpv); + struct _nif { + BYTE data[0x20]; + DWORD m_offDescr; + DWORD m_offURL; + DWORD m_offToImage; + } *nif = (_nif*)lpv; + PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString((LPCTSTR)&nif->data[nif->m_offURL])); + GlobalUnlock(hg); + GlobalFree(hg); + } + return TRUE; + } + if(pDO->IsDataAvailable(CF_TEXT)){ + if(!bTestOnly){ + HGLOBAL hg = pDO->GetGlobalData(CF_TEXT); + ASSERT(hg); + LPVOID lpv = GlobalLock(hg); + ASSERT(lpv); + PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString((LPCTSTR)lpv)); + GlobalUnlock(hg); + GlobalFree(hg); + } + return TRUE; + } + return FALSE; +} + +LRESULT CDipstickDlg::OnHTMLTransfer(WPARAM wP, LPARAM lP) +{ +_xferHTML* xf = (_xferHTML*)lP; +CSelectURLsDlg su; + su.m_bAdjust = m_bSmartAdjust; + su.m_bAdjustInnermost = m_bAdjustInnermost; + BeginWaitCursor(); + while(m_reHTMLURL.Match(xf->html)){ + CString url = m_reHTMLURL.GetMatch(1); + xf->html = m_reHTMLURL.GetMatch(CRegEx::matchPostMatch); + if(CCrackURL::GetHostName(url)==url){ + if(m_bIgnorelative) + continue; + CCrackURL cracked; + VERIFY(cracked.Crack(url)); + cracked.Adjust(xf->src); + url = cracked.Build(); + } + if(!su.m_URLs.Find(url)) + VERIFY(su.m_URLs.AddTail(url)); + } + EndWaitCursor(); + delete xf; + if(su.DoModal()==IDOK){ + POSITION p = su.m_URLs.GetHeadPosition(); + while(p){ + CString url = su.m_URLs.GetNext(p); + PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString(url)); + } + } + return 0; +} + +UINT CPingyHost::PingProc(LPVOID pParam) +{ +CPingyHost* pThis = (CPingyHost*)pParam; + ASSERT(pThis->m_Daddy); + return pThis->DoPing(); +} + +UINT CPingyHost::DoPing() +{ +CSingleLock slock(&m_mutex); + if(!slock.Lock(2000)){ + m_Status.LoadString(IDS_PS_FAILEDTOLOCK); + return 1; + } + m_Pinging = TRUE; + m_bToPing = FALSE; + VERIFY(m_Daddy->m_eveStartup.SetEvent()); + m_Daddy->PostMessage(WM_DNP_UPDATEHOSTDATA,0,(LPARAM)this); +in_addr ip; +UINT packets, lost; + packets=lost=0; +CICMP* pICMP = NULL; +UINT dataSize = m_Daddy->m_PingSize; +int ploss = 100; + do{ + if(m_HostName.IsEmpty()){ + ip.s_addr = m_IP; + hostent *he = gethostbyaddr((char*)&ip,4,PF_INET); + if(!he) + m_HostName.Empty(); + else + m_HostName = he->h_name; + }else{ + hostent *he = gethostbyname(m_HostName); + if(!he){ + m_Status.LoadString(IDS_PS_FAILEDTORESOLVE); + m_IP = 0; + break; + } + memmove(&ip.s_addr,he->h_addr,sizeof(ip.s_addr)); + m_IP = ip.s_addr; + } + pICMP = CICMP::CreateICMP(); + if(!(pICMP && pICMP->Initialize())){ + m_Status.LoadString(IDS_PS_UNABLETOICMP); + break; + } + m_Daddy->PostMessage(WM_DNP_UPDATEHOSTDATA,0,(LPARAM)this); + ULONG sum, num, pmin, pmax; + sum = num = 0; + pmin = 0xFFFFFFFF; + pmax = 0; + UINT seq; + for(seq = 0;seqm_PingsPerHost;seq++){ + INT status; + LONG rtt = pICMP->Ping(ip,dataSize,m_Daddy->m_TimeOut,&status); + UINT stString = 0; + switch(status){ + case CICMP::ipSuccess: + sum+=rtt; num++; + if(rttpmax) + pmax=rtt; + break; + case CICMP::ipBuffTooSmall: stString = IDS_PS_INTERNALERROR; + break; + case CICMP::ipDestNetUnreachable: stString = IDS_PS_NETUNREACHABLE; + break; + case CICMP::ipDestHostUnreachable: stString = IDS_PS_HOSTUNREACHABLE; + break; + case CICMP::ipDestProtUnreachable: stString = IDS_PS_PROTUNREACHABLE; + break; + case CICMP::ipDestPortUnreachable: stString = IDS_PS_PORTUNREACHABLE; + break; + case CICMP::ipNoResources: stString = IDS_PS_NORESOURCES; + break; + case CICMP::ipBadOption: stString = IDS_PS_INTERNALERROR; + break; + case CICMP::ipHWError: stString = IDS_PS_HWERROR; + break; + case CICMP::ipPacketTooBig: stString = IDS_PS_BIGPACKET; + break; + case CICMP::ipTimeOut: stString = IDS_PS_TIMEOUT; + break; + case CICMP::ipBadRequest: stString = IDS_PS_INTERNALERROR; + break; + case CICMP::ipBadRoute: stString = IDS_PS_BADROUTE; + break; + case CICMP::ipTTLExpiredInTransit: stString = IDS_PS_TTLEXPTRANSIT; + break; + case CICMP::ipTTLExpiredInReasm: stString = IDS_PS_TTLEXPREASM; + break; + case CICMP::ipParamProblem: stString = IDS_PS_IPARAMP; + break; + case CICMP::ipSourceQuench: stString = IDS_PS_SOURCEQUENCH; + break; + case CICMP::ipOptionTooBig: stString = IDS_PS_BIGOPTION; + break; + case CICMP::ipBadDest: stString = IDS_PS_BADDEST; + break; + default: + stString = IDS_PS_UNKNOWNERROR; + break; + } + if(stString) + m_Status.LoadString(stString); + packets++; + if(rtt<0) + lost++; + Sleep(m_Daddy->m_Interval); + } + if(packets==lost || !packets){ + ploss=100; + }else{ + ploss = lost*100/packets; + m_MinRTT = pmin; + m_MaxRTT = pmax; + if(sum){ + ASSERT(num); + m_AvgRTT = sum/num; + }else{ + m_AvgRTT = 0; + } + } + }while(FALSE); + m_Packetloss=ploss; + m_Pinged=TRUE; + m_Pinging=FALSE; + if(pICMP){ + pICMP->Deinitialize(); + delete pICMP; + } + m_Daddy->PostMessage(WM_DNP_UPDATEHOSTDATA,0,(LPARAM)this); + m_Daddy->PostMessage(WM_DNP_ACTIVITYCOUNT,(WPARAM)-1); + return 0; +} + +void CPingyHost::Ping() +{ + ASSERT(m_Daddy); + m_Daddy->m_eveStartup.ResetEvent(); + if(!AfxBeginThread(CPingyHost::PingProc,this)){ + ASSERT(FALSE); + }else{ + CSingleLock sl(&m_Daddy->m_eveStartup); + sl.Lock(); + m_Daddy->SendMessage(WM_DNP_ACTIVITYCOUNT,(WPARAM)1); // *** AWFUL! Shouldn't be here! + } +} + +void CDipstickDlg::OnHostlistCopyurl() +{ + if(m_HostList.GetSelectedCount()!=1) + return; +int items = m_HostList.GetItemCount(); + for(int tmp=0;tmpm_URL.IsEmpty()){ + CURLSource *us = new CURLSource(host->m_URL); + us->SetClipboard(); + us->FlushClipboard(); + } +} + +BOOL CDipstickDlg::OnHelpInfo(HELPINFO* pHelpInfo) +{ + WinHelp(IDD|0x20000l); + return TRUE; +} + +void CDipstickDlg::OnDropFiles(HDROP hDropInfo) +{ + // *** Import only 1st file, but maybe we should fall into prompt mode if multiple files are dropped. +CString fileName; +int bufferSize = DragQueryFile(hDropInfo,0,NULL,0); + DragQueryFile(hDropInfo,0,fileName.GetBuffer(bufferSize+2),bufferSize+1); + fileName.ReleaseBuffer(); + if(fileName.IsEmpty()) + CDialog::OnDropFiles(hDropInfo); + else + ImportLocations(fileName); +} + +BOOL CDipstickDlg::ImportLocations(LPCTSTR file) +{ +CString fileLine; +CString q; + try{ + CStdioFile f(file,CFile::modeRead|CFile::typeText|CFile::shareDenyWrite); + // *** Cleanup locations.. + while(f.ReadString(fileLine)){ + if(fileLine.IsEmpty()) + continue; + if(fileLine[0]=='\"' || fileLine[0]=='\''){ + TCHAR q = fileLine[0]; + fileLine=fileLine.Mid(1); + for(int tmp=0;tmp=0) + fileLine=fileLine.Left(co); + } + if(fileLine.IsEmpty()) + continue; + if(!fileLine.CompareNoCase("url")) + continue; + PostMessage(WM_DNP_URLPING,0,(LPARAM)new CString(fileLine)); + } + }catch(CException* e){ + e->Delete(); + TRACE0("Failed to import URLList file\n"); + return FALSE; + } + return TRUE; +} + +void CDipstickDlg::OnAdvanced() +{ +CRect rc; + m_AdvancedCtl.GetClientRect(rc); + m_AdvancedCtl.ClientToScreen(rc); +CMenu menus; + VERIFY(menus.LoadMenu(IDR_MENU)); +CMenu *popUp = menus.GetSubMenu(2); + ASSERT(popUp); + popUp->EnableMenuItem(ID_ADVANCED_EXPORTLIST,MF_BYCOMMAND|(m_HostList.GetItemCount()?MF_ENABLED:MF_GRAYED)); + popUp->TrackPopupMenu(TPM_CENTERALIGN|TPM_RIGHTBUTTON|TPM_LEFTBUTTON,(rc.left+rc.right)/2,rc.top,this); +} + +void CDipstickDlg::OnAdvancedExportlist() +{ +CString filter; + filter.LoadString(IDS_CSVFILTER); +CFileDialog cfd(FALSE,".csv",NULL,OFN_EXPLORER|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST,filter,this); + if(!m_impexPath.IsEmpty()) + SetCurrentDirectory(m_impexPath); + if(cfd.DoModal()==IDOK){ + GetCurrentDirectory(2048,m_impexPath.GetBuffer(2048)); + m_impexPath.ReleaseBuffer(); + ExportLocations(cfd.GetPathName()); + } +} + +void CDipstickDlg::OnAdvancedImportlist() +{ +CString filter; + filter.LoadString(IDS_CSVFILTER); +CFileDialog cfd(TRUE,".csv",NULL,OFN_EXPLORER|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST|OFN_FILEMUSTEXIST,filter,this); + if(!m_impexPath.IsEmpty()) + SetCurrentDirectory(m_impexPath); + if(cfd.DoModal()==IDOK){ + GetCurrentDirectory(2048,m_impexPath.GetBuffer(2048)); + m_impexPath.ReleaseBuffer(); + ImportLocations(cfd.GetPathName()); + } +} + +BOOL CDipstickDlg::ExportLocations(LPCTSTR file) +{ + try{ + CStdioFile f(file,CFile::modeCreate|CFile::modeWrite|CFile::typeText); + f.WriteString("URL,Host Name,IP Address, Min RTT,Avg RTT,Max RTT,Pktloss\n"); + POSITION p = m_Hosts.GetHeadPosition(); + while(p){ + CPingyHost *host = m_Hosts.GetNext(p); + ASSERT(host); + CString ph; + ph.Format("\"%s\",%s,%s,%lu,%lu,%lu,%d%%\n",host->m_URL,host->m_HostName,inet_ntoa(*(in_addr*)&host->m_IP), + host->m_MinRTT,host->m_AvgRTT,host->m_MaxRTT,host->m_Packetloss + ); + f.WriteString(ph); + } + f.Close(); + }catch(CException* e){ + TRACE0("Failed to export URLList\n"); + e->Delete(); + return FALSE; + } + return TRUE; +} + +void CDipstickDlg::OnDragpadAdvancedExportlist() +{ + OnAdvancedExportlist(); +} + +void CDipstickDlg::OnDragpadAdvancedImportlist() +{ + OnAdvancedImportlist(); +} + +void CPingyHost::Suicide() +{ +CSingleLock sl(&m_mutex); + if(sl.Lock(10)){ + sl.Unlock(); + delete this; + }else{ + if(!AfxBeginThread(CPingyHost::SuicideProc,this)) + ASSERT(FALSE); + } +} + +UINT CPingyHost::SuicideProc(LPVOID pParam) +{ +CPingyHost* pThis = (CPingyHost*)pParam; +CSingleLock sl(&pThis->m_mutex); + sl.Lock(); + VERIFY(sl.Unlock()); + delete pThis; + return 0; +} diff --git a/DipstickDlg.h b/DipstickDlg.h new file mode 100644 index 0000000..ce9ed22 --- a/dev/null +++ b/DipstickDlg.h @@ -0,0 +1,184 @@ +// DipstickDlg.h : header file +// + +class CDipstickDlg; +struct CPingyHost { + CPingyHost(CDipstickDlg* daddy) : m_IP(0), m_MinRTT(0), m_AvgRTT(0), m_MaxRTT(0), m_Pinged(FALSE), m_Pinging(FALSE), m_Packetloss(-1), m_bToPing(TRUE), m_Daddy(daddy) {} + CPingyHost(CDipstickDlg* daddy,LPTSTR hostname) : m_HostName(hostname), m_IP(0), m_MinRTT(0), m_AvgRTT(0), m_MaxRTT(0), m_Pinged(FALSE), m_Pinging(FALSE), m_Packetloss(-1), m_bToPing(TRUE), m_Daddy(daddy) {} + CPingyHost(CDipstickDlg* daddy,LPTSTR hostname,DWORD ip) : m_HostName(hostname), m_IP(ip), m_MinRTT(0), m_AvgRTT(0), m_MaxRTT(0), m_Pinged(FALSE), m_Pinging(FALSE), m_Packetloss(-1), m_bToPing(TRUE), m_Daddy(daddy) {} + CPingyHost(CDipstickDlg* daddy,DWORD ip) : m_IP(ip), m_MinRTT(0), m_AvgRTT(0), m_MaxRTT(0), m_Pinged(FALSE), m_Pinging(FALSE), m_Packetloss(-1), m_bToPing(TRUE), m_Daddy(daddy) {} +public: + static UINT SuicideProc(LPVOID pParam); + void Suicide(); + void Ping(); + UINT DoPing(); + static UINT PingProc(LPVOID); + CDipstickDlg* m_Daddy; + CMutex m_mutex; + CString m_Descr; + CString m_URL; + BOOL m_bToPing; + BOOL m_Pinging; + CString m_HostName; + CString m_Status; + DWORD m_IP; + ULONG m_MinRTT; + ULONG m_AvgRTT; + ULONG m_MaxRTT; + BOOL m_Pinged; + int m_Packetloss; +}; + +typedef CList CHostList; + +///////////////////////////////////////////////////////////////////////////// +// CDipstickDlg dialog + +class CDragPad; +class CDipstickDlg : public CDialog +{ +// Construction + struct _xferHTML { + CString html; + CCrackURL src; + }; +public: + BOOL ExportLocations(LPCTSTR file); + CString m_impexPath; + BOOL ImportLocations(LPCTSTR file); + BOOL m_bIgnorelative; + CEvent m_eveStartup; + UINT volatile m_ActiveThreads; + BOOL m_bAdjustInnermost; + BOOL m_bSmartAdjust; + BOOL CollectURLs(COleDataObject* pDO,BOOL bTestOnly=FALSE); + BOOL IsPasteableClipboard(); + void UpdateDragpadTitle(); + BOOL m_bAutoBest; + void RecalcLayout(int cx,int cy); + CSize m_MinSize; + UINT m_GapY; + UINT m_OverY; + UINT m_OverX; + BOOL m_bMSWorkAround; + CRegEx m_reCrackHost; + CRegEx m_reNestedURL; + CRegEx m_reHTMLURL; // 1 - URL + CRegEx m_reCrackURL; // 3 - schema, 4 - host, 5 - path, 7 - query string + BITMAP m_bitmapBack; + CBitmap m_bmpBack; + int m_iUnreachable; + int m_iCompleted; + int m_iPinging; + int m_iPending; + CImageList m_Images; + void UpdateControlButtons(); + BOOL m_bExiting; + int CheckForPendingRequests(); + UINT m_MaxThreads; + BOOL m_bShown; + enum { + sortHost, sortIP, sortMin, sortAvg, sortMax, sortLoss + }; + int m_SortCriteria; + static int CALLBACK CompareItems(LPARAM lp1, LPARAM lp2, LPARAM lp); + DWORD m_Interval; + BOOL RemovePingyHost(CPingyHost *host,int index=-1); + BOOL UpdatePingyHost(CPingyHost *host,int index=-1); + BOOL AddPingyHost(CPingyHost *host); + CHostList m_Hosts; + enum { + subitemHost = 0, subitemIP, subitemMin,subitemAvg,subitemMax, subitemPacketloss + }; + DWORD m_TimeOut; + UINT m_PingSize; + UINT m_PingsPerHost; + CDragPad * m_DragPad; + ~CDipstickDlg(); + CDipstickDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CDipstickDlg) + enum { IDD = IDD_DIPSTICK_DIALOG }; + CButton m_AdvancedCtl; + CButton m_HelpCtl; + CButton m_ExitCtl; + CButton m_OptionsCtl; + CButton m_ManualPingCtl; + CButton m_RemoveCtl; + CButton m_RepingAllCtl; + CButton m_RepingCtl; + CButton m_ClearListCtl; + CListCtrl m_HostList; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDipstickDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +protected: + HICON m_hIcon; + + // Generated message map functions + //{{AFX_MSG(CDipstickDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnDestroy(); + afx_msg void OnOptions(); + afx_msg LRESULT OnUrlPing(WPARAM,LPARAM); + afx_msg LRESULT OnActivityCount(WPARAM,LPARAM); + afx_msg LRESULT OnUpdateHostData(WPARAM,LPARAM); + afx_msg LRESULT OnHTMLTransfer(WPARAM,LPARAM); + afx_msg void OnColumnclickHostlist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos); + afx_msg void OnDragpadOptions(); + afx_msg void OnDragpadShowmainwindow(); + afx_msg void OnDragpadHelp(); + afx_msg void OnDragpadAbout(); + afx_msg void OnDragpadExit(); + virtual void OnOK(); + virtual void OnCancel(); + afx_msg void OnManualping(); + afx_msg void OnDragpadManualping(); + afx_msg void OnDragpadRepingAll(); + afx_msg void OnDragpadRemoveAll(); + afx_msg void OnReping(); + afx_msg void OnRepingall(); + afx_msg void OnClear(); + afx_msg void OnInsertitemHostlist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnDeleteitemHostlist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnDeleteallitemsHostlist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnExit(); + afx_msg void OnItemchangedHostlist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnRemove(); + afx_msg void OnRclickHostlist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnHostListReping(); + afx_msg void OnHostListRemove(); + afx_msg void OnHostListRepingAll(); + afx_msg void OnHostListRemoveAll(); + afx_msg void OnHostListOpenURL(); + afx_msg void OnHostListProperties(); + afx_msg void OnDblclkHostlist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnClose(); + afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); + afx_msg void OnSize(UINT nType, int cx, int cy); + afx_msg void OnHelp(); + afx_msg void OnBegindragHostlist(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnPasteurl(); + afx_msg void OnHostlistCopyurl(); + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + afx_msg void OnDropFiles(HDROP hDropInfo); + afx_msg void OnAdvanced(); + afx_msg void OnAdvancedExportlist(); + afx_msg void OnAdvancedImportlist(); + afx_msg void OnDragpadAdvancedExportlist(); + afx_msg void OnDragpadAdvancedImportlist(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/DragPad.cpp b/DragPad.cpp new file mode 100644 index 0000000..9b0aa31 --- a/dev/null +++ b/DragPad.cpp @@ -0,0 +1,213 @@ +// DragPad.cpp : implementation file +// + +#include "stdafx.h" +#include "Dipstick.h" +#include "DragPad.h" +#include "DipstickDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CDragPad dialog + + +CDragPad::CDragPad(CWnd* pParent /*=NULL*/) + : CDialog(CDragPad::IDD, pParent) +{ + //{{AFX_DATA_INIT(CDragPad) + //}}AFX_DATA_INIT + m_DropTarget.m_Pad = this; +} + +CDragPad::~CDragPad() +{ +} + +void CDragPad::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDragPad) + DDX_Control(pDX, IDC_DNDTARGET, m_DragNDropTarget); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CDragPad, CDialog) + //{{AFX_MSG_MAP(CDragPad) + ON_WM_WINDOWPOSCHANGED() + ON_WM_NCACTIVATE() + ON_WM_DESTROY() + ON_WM_CREATE() + ON_WM_LBUTTONDBLCLK() + ON_WM_RBUTTONDOWN() + ON_WM_LBUTTONDOWN() + ON_WM_HELPINFO() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDragPad message handlers + +BOOL CDragPad::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_DropTarget.Register(&m_DragNDropTarget); + m_DragNDropTarget.Open(IDR_DNDAVI); +CRect rc; + m_DragNDropTarget.GetClientRect(rc); + m_DragNDropTarget.MoveWindow(rc,FALSE); +CRect wrc,crc,drc, nrc; + GetWindowRect(wrc); + GetClientRect(crc); + GetDesktopWindow()->GetClientRect(drc); + nrc.left = drc.right-(rc.Width()+(wrc.Width()-crc.Width())) - 5; + nrc.top = drc.bottom-(rc.Height()+(wrc.Height()-crc.Height())) - 5; +CWinApp *app = AfxGetApp(); + ASSERT(app); + ScreenToClient(nrc); + nrc.top=app->GetProfileInt("Windows","DragPadTop",nrc.top); + nrc.left=app->GetProfileInt("Windows","DragPadLeft",nrc.left); + nrc.right = nrc.left+(rc.Width()+(wrc.Width()-crc.Width())); + nrc.bottom = nrc.top+(rc.Height()+(wrc.Height()-crc.Height())); + MoveWindow(nrc,FALSE); + + // CG: The following block was added by the ToolTips component. + { + // Create the ToolTip control. + m_tooltip.Create(this); + m_tooltip.Activate(TRUE); + } + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CDragPad::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) +{ + CDialog::OnWindowPosChanged(lpwndpos); + if(lpwndpos->hwnd!=m_hWnd) + SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE); +} + +BOOL CDragPad::PreCreateWindow(CREATESTRUCT& cs) +{ + cs.dwExStyle|=WS_EX_TOPMOST; + return CDialog::PreCreateWindow(cs); +} + +BOOL CDragPad::OnNcActivate(BOOL bActive) +{ + if(!bActive) + SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOSIZE); + return CDialog::OnNcActivate(bActive); +} + +void CDragPad::OnDestroy() +{ + CDialog::OnDestroy(); + TRACE0("DestroyPad\n"); + RevokeDragDrop(m_DragNDropTarget.m_hWnd); +} + +int CDragPad::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CDialog::OnCreate(lpCreateStruct) == -1) + return -1; +CRect rc,drc, nrc; +CWinApp *app = AfxGetApp(); + ASSERT(app); + GetWindowRect(rc); + GetDesktopWindow()->GetClientRect(drc); + nrc.left = drc.right-rc.Width() - 5; + nrc.top = drc.bottom-rc.Height() - 5; + ScreenToClient(nrc); + nrc.top=app->GetProfileInt("Windows","DragPadTop",nrc.top); + nrc.left=app->GetProfileInt("Windows","DragPadLeft",nrc.left); + nrc.right = nrc.left+rc.Width(); + nrc.bottom = nrc.top+rc.Height(); + MoveWindow(nrc); + return 0; +} + +void CDragPad::OnLButtonDblClk(UINT nFlags, CPoint point) +{ + ToggleMainWindowDisplay(); + CDialog::OnLButtonDblClk(nFlags, point); +} + +void CDragPad::OnRButtonDown(UINT nFlags, CPoint point) +{ +CMenu menus; + VERIFY(menus.LoadMenu(IDR_MENU)); +CMenu *dpm = menus.GetSubMenu(0); // *** Position? + ASSERT(dpm); +CPoint pt = point; + ClientToScreen(&pt); + m_Daddy->UpdateControlButtons(); + dpm->CheckMenuItem(ID_DRAGPAD_SHOWMAINWINDOW,MF_BYCOMMAND|(m_Daddy->m_bShown?MF_CHECKED:MF_UNCHECKED)); + dpm->EnableMenuItem(ID_DRAGPAD_REPINGALL,MF_BYCOMMAND|(m_Daddy->m_RepingAllCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED)); + dpm->EnableMenuItem(ID_DRAGPAD_REMOVEALL,MF_BYCOMMAND|(m_Daddy->m_ClearListCtl.IsWindowEnabled()?MF_ENABLED:MF_GRAYED)); + dpm->EnableMenuItem(ID_DRAGPAD_PASTEURL,MF_BYCOMMAND|(m_Daddy->IsPasteableClipboard()?MF_ENABLED:MF_GRAYED)); + dpm->EnableMenuItem(ID_DRAGPAD_ADVANCED_EXPORTLIST,MF_BYCOMMAND|(m_Daddy->m_HostList.GetItemCount()?MF_ENABLED:MF_GRAYED)); + dpm->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,m_Daddy,NULL); + CDialog::OnRButtonDown(nFlags, point); +} + +void CDragPad::OnLButtonDown(UINT nFlags, CPoint point) +{ + ToggleMainWindowDisplay(); + CDialog::OnLButtonDown(nFlags, point); +} + +void CDragPad::ToggleMainWindowDisplay() +{ + if(m_Daddy->IsWindowVisible()){ + m_Daddy->m_bShown=FALSE; + m_Daddy->ShowWindow(SW_HIDE); + }else{ + m_Daddy->m_bShown=TRUE; + m_Daddy->ShowWindow(SW_SHOW); + } +} + +BOOL CDragPad::PreTranslateMessage(MSG* pMsg) +{ + // CG: The following block was added by the ToolTips component. + { + // Let the ToolTip process this message. + m_tooltip.RelayEvent(pMsg); + + return CDialog::PreTranslateMessage(pMsg); + } +} + +DROPEFFECT CDUTarget::OnDragEnter(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt) +{ + if(m_Pad->m_Daddy->CollectURLs(pDO,TRUE)) + return m_dropAsEntered=DROPEFFECT_LINK|DROPEFFECT_COPY|DROPEFFECT_MOVE; + else + return m_dropAsEntered=DROPEFFECT_NONE; +} +DROPEFFECT CDUTarget::OnDragOver(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt) +{ + return m_dropAsEntered; +} +DROPEFFECT CDUTarget::OnDropEx(CWnd* pWnd,COleDataObject* pDO,DROPEFFECT dropDefault,DROPEFFECT dropList,CPoint pt) +{ + if(m_Pad->m_Daddy->CollectURLs(pDO,FALSE)) + return DROPEFFECT_LINK|DROPEFFECT_COPY|DROPEFFECT_MOVE; + else + return DROPEFFECT_NONE; +} + +BOOL CDragPad::OnHelpInfo(HELPINFO* pHelpInfo) +{ + WinHelp(IDD|0x20000l); + return TRUE; +} diff --git a/DragPad.h b/DragPad.h new file mode 100644 index 0000000..b5f67f2 --- a/dev/null +++ b/DragPad.h @@ -0,0 +1,62 @@ +// DragPad.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CDragPad dialog + +class CDragPad; +class CDUTarget : public COleDropTarget { +public: + CDragPad* m_Pad; + DROPEFFECT m_dropAsEntered; + + virtual DROPEFFECT OnDragEnter(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt); + virtual DROPEFFECT OnDragOver(CWnd* pWnd,COleDataObject* pDO,DWORD dwKeyState,CPoint pt); + virtual DROPEFFECT OnDropEx(CWnd* pWnd,COleDataObject* pDO,DROPEFFECT dropDefault,DROPEFFECT dropList,CPoint pt); +}; + +class CDipstickDlg; +class CDragPad : public CDialog +{ +// Construction +public: + CDUTarget m_DropTarget; + virtual BOOL PreTranslateMessage(MSG* pMsg); + void ToggleMainWindowDisplay(); + CDipstickDlg *m_Daddy; + ~CDragPad(); + CDragPad(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CDragPad) + enum { IDD = IDD_DRAGPAD }; + CAnimateCtrl m_DragNDropTarget; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDragPad) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +protected: + CToolTipCtrl m_tooltip; + + // Generated message map functions + //{{AFX_MSG(CDragPad) + virtual BOOL OnInitDialog(); + afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos); + afx_msg BOOL OnNcActivate(BOOL bActive); + afx_msg void OnDestroy(); + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); + afx_msg void OnRButtonDown(UINT nFlags, CPoint point); + afx_msg void OnLButtonDown(UINT nFlags, CPoint point); + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/DropURL.cpp b/DropURL.cpp new file mode 100644 index 0000000..9394889 --- a/dev/null +++ b/DropURL.cpp @@ -0,0 +1,149 @@ +// DropURL.cpp : implementation file +// + +#include "stdafx.h" +#include "Dipstick.h" +#include "DropURL.h" +#include "DragPad.h" +#include "Dipstick.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CDropURL + +IMPLEMENT_DYNCREATE(CDropURL, CCmdTarget) + +CDropURL::CDropURL() + : m_Pad(NULL) +{ +} + +CDropURL::~CDropURL() +{ +} + + +BEGIN_MESSAGE_MAP(CDropURL, CCmdTarget) + //{{AFX_MSG_MAP(CDropURL) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +BEGIN_INTERFACE_MAP(CDropURL, CCmdTarget) + INTERFACE_PART(CDropURL, IID_IDropTarget, DDropTarget) +END_INTERFACE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDropURL message handlers + +STDMETHODIMP_(ULONG) CDropURL::XDDropTarget::AddRef() +{ + METHOD_PROLOGUE(CDropURL, DDropTarget) + return pThis->ExternalAddRef(); +} +STDMETHODIMP_(ULONG) CDropURL::XDDropTarget::Release() +{ + METHOD_PROLOGUE(CDropURL, DDropTarget) + return pThis->ExternalRelease(); +} +STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::QueryInterface(REFIID iid,void FAR* FAR * ppvObj) +{ + METHOD_PROLOGUE(CDropURL, DDropTarget) + return pThis->ExternalQueryInterface(&iid,ppvObj); +} + +STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::DragEnter(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect) +{ + METHOD_PROLOGUE(CDropURL, DDropTarget) + TRACE0("DragEnter\n"); + return pThis->DragEnter(pDataObject,grfKeyState,pt,pdwEffect); +} +STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::DragOver(DWORD grfKeyState,POINTL pt,DWORD *pdwEffect) +{ + METHOD_PROLOGUE(CDropURL, DDropTarget) + return S_OK; +} +STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::DragLeave(void) +{ + METHOD_PROLOGUE(CDropURL, DDropTarget) + TRACE0("DragLeave\n"); + return S_OK; +} +STDMETHODIMP_(HRESULT) CDropURL::XDDropTarget::Drop(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect) +{ + METHOD_PROLOGUE(CDropURL, DDropTarget) + TRACE0("Drop\n"); + return pThis->Drop(pDataObject,grfKeyState,pt,pdwEffect); +} + + +HRESULT CDropURL::DragEnter(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect) +{ +CString host = GetHostName(pDataObject); + if(host.IsEmpty()){ + (*pdwEffect)=DROPEFFECT_NONE; + return S_FALSE; + }else{ + (*pdwEffect)=DROPEFFECT_LINK; + return S_OK; + } +} + +CString CDropURL::GetHostName(IDataObject *pDataObject,CString *_url) +{ +FORMATETC fetc; + fetc.cfFormat=CF_TEXT; + fetc.ptd=NULL; + fetc.dwAspect=DVASPECT_CONTENT; + fetc.lindex=-1; + fetc.tymed=TYMED_HGLOBAL; +STGMEDIUM stgm; +LPVOID globe = NULL; +CString url; +CString rv; + stgm.pUnkForRelease=NULL; + do{ + if(pDataObject->GetData(&fetc,&stgm)!=S_OK) + break; + ASSERT(stgm.tymed==TYMED_HGLOBAL); + if(GlobalSize(stgm.hGlobal)>=1024) + break; + VERIFY(globe=GlobalLock(stgm.hGlobal)); + url=(LPTSTR)globe; + TRACE0("["+url+"]\n"); + if(_url) + (*_url) = url; + rv = m_Pad->m_Daddy->GetHostName(url); + }while(FALSE); + if(globe) + GlobalUnlock(stgm.hGlobal); + if(stgm.pUnkForRelease) + stgm.pUnkForRelease->Release(); + return rv; +} + +HRESULT CDropURL::Drop(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pwdEffect) +{ +CString url; +CString host = GetHostName(pDataObject,&url); + if(host.IsEmpty()) + return S_FALSE; +#ifdef TRUE + // URL Mode +CString *u = new CString(url); + m_Pad->m_Daddy->PostMessage(WM_DNP_URLPING,0,(LPARAM)u); +#else +CString *hn = new CString(host); + m_Pad->m_Daddy->PostMessage(WM_DNP_HOSTPING,0,(LPARAM)hn); +#endif + return S_OK; +} +void CDropURL::OnFinalRelease() +{ + TRACE0("Final Release\n"); + CCmdTarget::OnFinalRelease(); +} diff --git a/DropURL.h b/DropURL.h new file mode 100644 index 0000000..2f72cd2 --- a/dev/null +++ b/DropURL.h @@ -0,0 +1,54 @@ +// DropURL.h : header file +// + + + +///////////////////////////////////////////////////////////////////////////// +// CDropURL command target + +class CDragPad; +class CDropURL : public CCmdTarget +{ + DECLARE_DYNCREATE(CDropURL) + + CDropURL(); // protected constructor used by dynamic creation + +// Attributes +public: + CDragPad* m_Pad; + HRESULT Drop(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pwdEffect); + CString GetHostName(IDataObject *pDataObject,CString *url = NULL); + HRESULT DragEnter(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect); + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDropURL) + public: + virtual void OnFinalRelease(); + //}}AFX_VIRTUAL + +// Implementation +protected: + virtual ~CDropURL(); + + // Generated message map functions + //{{AFX_MSG(CDropURL) + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + + DECLARE_INTERFACE_MAP() + + BEGIN_INTERFACE_PART(DDropTarget, IDropTarget) + STDMETHOD_(HRESULT, DragEnter)(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect); + STDMETHOD_(HRESULT, DragOver)(DWORD grfKeyState,POINTL pt,DWORD *pdwEffect); + STDMETHOD_(HRESULT, DragLeave)(void); + STDMETHOD_(HRESULT, Drop)(IDataObject *pDataObject,DWORD grfKeyState,POINTL pt,DWORD *pdwEffect); + END_INTERFACE_PART(DDropTarget); + +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/HostNameDlg.cpp b/HostNameDlg.cpp new file mode 100644 index 0000000..19e3a07 --- a/dev/null +++ b/HostNameDlg.cpp @@ -0,0 +1,49 @@ +// HostNameDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "Dipstick.h" +#include "HostNameDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CHostNameDlg dialog + + +CHostNameDlg::CHostNameDlg(CWnd* pParent /*=NULL*/) + : CDialog(CHostNameDlg::IDD, pParent) +{ + //{{AFX_DATA_INIT(CHostNameDlg) + m_Host = _T(""); + //}}AFX_DATA_INIT +} + + +void CHostNameDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CHostNameDlg) + DDX_Text(pDX, IDC_HOST, m_Host); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CHostNameDlg, CDialog) + //{{AFX_MSG_MAP(CHostNameDlg) + ON_WM_HELPINFO() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CHostNameDlg message handlers + +BOOL CHostNameDlg::OnHelpInfo(HELPINFO* pHelpInfo) +{ + WinHelp(IDD|0x20000l); + return TRUE; +} diff --git a/HostNameDlg.h b/HostNameDlg.h new file mode 100644 index 0000000..40fd966 --- a/dev/null +++ b/HostNameDlg.h @@ -0,0 +1,35 @@ +// HostNameDlg.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CHostNameDlg dialog + +class CHostNameDlg : public CDialog +{ +// Construction +public: + CHostNameDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CHostNameDlg) + enum { IDD = IDD_MANUALHOST }; + CString m_Host; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CHostNameDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CHostNameDlg) + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/HostProperties.cpp b/HostProperties.cpp new file mode 100644 index 0000000..6c2a47b --- a/dev/null +++ b/HostProperties.cpp @@ -0,0 +1,185 @@ +// HostProperties.cpp : implementation file +// + +#include "stdafx.h" +#include "Dipstick.h" +#include "HostProperties.h" +#include "DipstickDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CHostProperties dialog + + +CHostProperties::CHostProperties(CWnd* pParent /*=NULL*/) + : CDialog(CHostProperties::IDD, pParent) +{ + //{{AFX_DATA_INIT(CHostProperties) + m_Host = _T(""); + m_IP = _T(""); + m_Loss = _T(""); + m_Status = _T(""); + m_Times = _T(""); + m_URL = _T(""); + //}}AFX_DATA_INIT +} + + +void CHostProperties::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CHostProperties) + DDX_Control(pDX, IDC_STATE, m_StateCtl); + DDX_Control(pDX, IDC_URLCAPTION, m_URLCaptionCtl); + DDX_Control(pDX, IDC_URL, m_URLCtl); + DDX_Control(pDX, IDC_TIMESCAPTION, m_TimesCaptionCtl); + DDX_Control(pDX, IDC_TIMES, m_TimesCtl); + DDX_Control(pDX, IDC_STATUSCAPTION, m_StatusCaptionCtl); + DDX_Control(pDX, IDC_STATUS, m_StatusCtl); + DDX_Control(pDX, IDC_OPENURL, m_OpenURLCtl); + DDX_Control(pDX, IDC_LOSSCAPTION, m_LossCaptionCtl); + DDX_Control(pDX, IDC_LOSS, m_LossCtl); + DDX_Control(pDX, IDC_IPCAPTION, m_IPCaptionCtl); + DDX_Control(pDX, IDC_IP, m_IPCtl); + DDX_Control(pDX, IDC_HOSTCAPTION, m_HostCaptionCtl); + DDX_Control(pDX, IDC_HOST, m_HostCtl); + DDX_Text(pDX, IDC_HOST, m_Host); + DDX_Text(pDX, IDC_IP, m_IP); + DDX_Text(pDX, IDC_LOSS, m_Loss); + DDX_Text(pDX, IDC_STATUS, m_Status); + DDX_Text(pDX, IDC_TIMES, m_Times); + DDX_Text(pDX, IDC_URL, m_URL); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CHostProperties, CDialog) + //{{AFX_MSG_MAP(CHostProperties) + ON_BN_CLICKED(IDC_OPENURL, OnOpenurl) + ON_WM_HELPINFO() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CHostProperties message handlers + +BOOL CHostProperties::OnInitDialog() +{ + CDialog::OnInitDialog(); + + ASSERT(host); + if(host->m_HostName.IsEmpty()){ + m_HostCtl.ShowWindow(SW_HIDE); + m_HostCaptionCtl.ShowWindow(SW_HIDE); + }else + m_Host = host->m_HostName; + if(host->m_IP) + m_IP = inet_ntoa(*(in_addr*)&host->m_IP); + else{ + m_IPCtl.ShowWindow(SW_HIDE); + m_IPCaptionCtl.ShowWindow(SW_HIDE); + } + if(host->m_Pinged){ + m_Loss.Format(IDS_FMT_LOSS,host->m_Packetloss); + m_Times.Format(IDS_FMT_TIMES,host->m_MinRTT,host->m_AvgRTT,host->m_MaxRTT); + }else{ + m_LossCtl.ShowWindow(SW_HIDE); + m_LossCaptionCtl.ShowWindow(SW_HIDE); + m_TimesCtl.ShowWindow(SW_HIDE); + m_TimesCaptionCtl.ShowWindow(SW_HIDE); + } + if(host->m_URL.IsEmpty()){ + m_URLCtl.ShowWindow(SW_HIDE); + m_URLCaptionCtl.ShowWindow(SW_HIDE); + m_OpenURLCtl.ShowWindow(SW_HIDE); + }else + m_URL = host->m_URL; + if(host->m_Status.IsEmpty()){ + m_StatusCtl.ShowWindow(SW_HIDE); + m_StatusCaptionCtl.ShowWindow(SW_HIDE); + }else + m_Status = host->m_Status; + + // CG: The following block was added by the ToolTips component. + { + // Create the ToolTip control. + m_tooltip.Create(this); + m_tooltip.Activate(TRUE); + + m_tooltip.AddTool(&m_HostCaptionCtl,IDC_HOSTCAPTION); + m_tooltip.AddTool(&m_HostCtl,IDC_HOST); + m_tooltip.AddTool(&m_IPCaptionCtl,IDC_IPCAPTION); + m_tooltip.AddTool(&m_IPCtl,IDC_IPCAPTION); + m_tooltip.AddTool(&m_LossCaptionCtl,IDC_LOSSCAPTION); + m_tooltip.AddTool(&m_LossCtl,IDC_LOSS); + m_tooltip.AddTool(&m_OpenURLCtl,IDC_OPENURL); + m_tooltip.AddTool(&m_StatusCaptionCtl,IDC_STATUSCAPTION); + m_tooltip.AddTool(&m_StatusCtl,IDC_STATUS); + m_tooltip.AddTool(&m_TimesCaptionCtl,IDC_TIMESCAPTION); + m_tooltip.AddTool(&m_TimesCtl,IDC_TIMES); + m_tooltip.AddTool(&m_URLCaptionCtl,IDC_URLCAPTION); + m_tooltip.AddTool(&m_URLCtl,IDC_URL); + m_tooltip.AddTool(GetDlgItem(IDOK),IDS_TIP_PROPSOK); + + if(host->m_Pinging){ + m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PINGING)); + m_tooltip.AddTool(&m_StateCtl,IDS_TIP_PINGING); + }else{ + if(host->m_bToPing){ + m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PENDING)); + m_tooltip.AddTool(&m_StateCtl,IDS_TIP_PENDING); + }else{ + if(host->m_Pinged){ + if(host->m_Packetloss==100){ + m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_UNREACHABLE)); + m_tooltip.AddTool(&m_StateCtl,IDS_TIP_UNREACHABLE); + }else{ + m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_COMPLETED)); + m_tooltip.AddTool(&m_StateCtl,IDS_TIP_COMPLETE); + } + }else{ + m_StateCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PENDING)); + m_tooltip.AddTool(&m_StateCtl,IDS_TIP_PENDING); + } + } + } + + UpdateData(FALSE); + + } + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CHostProperties::SetHost(CPingyHost *host) +{ + CHostProperties::host = host; +} + +void CHostProperties::OnOpenurl() +{ + ASSERT(!m_URL.IsEmpty()); + ShellExecute(::GetDesktopWindow(),"open",m_URL,NULL,NULL,SW_SHOWMAXIMIZED); +} + +BOOL CHostProperties::PreTranslateMessage(MSG* pMsg) +{ + // CG: The following block was added by the ToolTips component. + { + // Let the ToolTip process this message. + m_tooltip.RelayEvent(pMsg); + + return CDialog::PreTranslateMessage(pMsg); + } +} + +BOOL CHostProperties::OnHelpInfo(HELPINFO* pHelpInfo) +{ + WinHelp(IDD|0x20000l); + return TRUE; +} diff --git a/HostProperties.h b/HostProperties.h new file mode 100644 index 0000000..c59336b --- a/dev/null +++ b/HostProperties.h @@ -0,0 +1,61 @@ +// HostProperties.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CHostProperties dialog + +struct CPingyHost; +class CHostProperties : public CDialog +{ +// Construction +public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + void SetHost(CPingyHost *host); + CPingyHost * host; + CHostProperties(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CHostProperties) + enum { IDD = IDD_PROPS }; + CStatic m_StateCtl; + CStatic m_URLCaptionCtl; + CStatic m_URLCtl; + CStatic m_TimesCaptionCtl; + CStatic m_TimesCtl; + CStatic m_StatusCaptionCtl; + CStatic m_StatusCtl; + CButton m_OpenURLCtl; + CStatic m_LossCaptionCtl; + CStatic m_LossCtl; + CStatic m_IPCaptionCtl; + CStatic m_IPCtl; + CStatic m_HostCaptionCtl; + CStatic m_HostCtl; + CString m_Host; + CString m_IP; + CString m_Loss; + CString m_Status; + CString m_Times; + CString m_URL; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CHostProperties) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + CToolTipCtrl m_tooltip; + + // Generated message map functions + //{{AFX_MSG(CHostProperties) + virtual BOOL OnInitDialog(); + afx_msg void OnOpenurl(); + afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/KTAGS b/KTAGS new file mode 100644 index 0000000..e3cc88a --- a/dev/null +++ b/KTAGS @@ -0,0 +1,15 @@ +about-date dipstick.rc /LTEXT\s\+"Copyright /;" kind:d +about-version dipstick.rc /LTEXT\s\+"Dipstick, Version/;" kind:v +dialog-version dipstick.rc /^CAPTION\s\+" Dipstick/;" kind:v +dndtarget-version dipstick.rc /IDC_DNDTARGET\s\+"Dipstick /;" kind:v +dragpad-version dipstick.rc /IDS_DRAGPAD_TITLE\s\+" Dipstick /;" kind:v +help-license-date ./help/dipstick.xml /ptMinTrackSize.x = m_minSize.cx; + lpMMI->ptMinTrackSize.y = m_minSize.cy; + } +} + +void CSelectURLsDlg::RecalcLayout(int cx,int cy) +{ + if(!(m_minSize.cx&&m_minSize.cy)) + return; +CRect rcok, rccan, rcadj, rcadjin, rclist; + m_OkCtl.GetWindowRect(rcok); ScreenToClient(rcok); + m_CancelCtl.GetWindowRect(rccan); ScreenToClient(rccan); + m_AdjustCtl.GetWindowRect(rcadj); ScreenToClient(rcadj); + m_AdjustInnCtl.GetWindowRect(rcadjin); ScreenToClient(rcadjin); + m_URLsCtl.GetWindowRect(rclist); ScreenToClient(rclist); + m_CancelCtl.SetWindowPos(NULL,rccan.left,cy-m_Gap.cy-rccan.Height(),0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_OkCtl.SetWindowPos(NULL,rcok.left,cy-m_Gap.cy-rcok.Height()-rccan.bottom+rcok.bottom,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_AdjustCtl.SetWindowPos(NULL,rcadj.left,cy-m_Gap.cy-rccan.bottom+rcadj.bottom-rcadj.Height(),0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_AdjustInnCtl.SetWindowPos(NULL,rcadjin.left,cy-m_Gap.cy-rccan.bottom+rcadjin.bottom-rcadjin.Height(),0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOCOPYBITS); + m_URLsCtl.SetWindowPos(NULL,rclist.left,rclist.top,cx-m_Gap.cx*2,cy-m_Gap.cy*2-rccan.bottom+rclist.bottom,SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOCOPYBITS); +} + +void CSelectURLsDlg::OnSelchangeUrls() +{ + UpdateData(TRUE); + if(!m_bAdjust) + return; + if(m_URLsCtl.GetSelCount()!=1) + return; +INT selection; + VERIFY(m_URLsCtl.GetSelItems(1,&selection)==1); +CCrackURL base; +CString selectedItem; + m_URLsCtl.GetText(selection,selectedItem); + VERIFY(base.Crack(selectedItem)); +CCrackURL item; +int is = m_URLsCtl.GetCount(); + BeginWaitCursor(); + for(int i = 0;i +#include +#include + +CURLSource::CURLSource(LPCTSTR strURL) +{ +IUniformResourceLocator *lpURL; + if(CoCreateInstance(CLSID_InternetShortcut,NULL,CLSCTX_INPROC_SERVER,IID_IUniformResourceLocator,(LPVOID*)&lpURL)==S_OK){ + ASSERT(lpURL); + lpURL->SetURL(strURL,IURL_SETURL_FL_GUESS_PROTOCOL); + LPDATAOBJECT lpDO = NULL; + VERIFY(lpURL->QueryInterface(IID_IDataObject,(LPVOID*)&lpDO)==S_OK); + COleDataObject odo; + odo.Attach(lpDO,TRUE); + odo.BeginEnumFormats(); + FORMATETC fe; + while(odo.GetNextFormat(&fe)){ + HGLOBAL hg = odo.GetGlobalData(fe.cfFormat,NULL); + if(hg) + CacheGlobalData(fe.cfFormat,hg,NULL); + } + lpURL->Release(); + } +HGLOBAL hg = GlobalAlloc(GHND,strlen(strURL)+1); +LPVOID lpv = GlobalLock(hg); + memmove(lpv,strURL,strlen(strURL)+1); + GlobalUnlock(hg); + CacheGlobalData(CF_TEXT,hg,NULL); +} diff --git a/URLSource.h b/URLSource.h new file mode 100644 index 0000000..d7c9b87 --- a/dev/null +++ b/URLSource.h @@ -0,0 +1,5 @@ + +class CURLSource : public COleDataSource { +public: + CURLSource(LPCTSTR strURL); +}; \ No newline at end of file diff --git a/dipstick.clw b/dipstick.clw new file mode 100644 index 0000000..708ee48 --- a/dev/null +++ b/dipstick.clw @@ -0,0 +1,266 @@ +; CLW file contains information for the MFC ClassWizard + +[General Info] +Version=1 +LastClass=CDipstickDlg +LastTemplate=CDialog +NewFileInclude1=#include "stdafx.h" +NewFileInclude2=#include "Dipstick.h" + +ClassCount=10 +Class1=CDipstickApp +Class2=CDipstickDlg +Class3=CAboutDlg + +ResourceCount=10 +Resource1=IDD_PROPS +Resource2=IDR_MAINFRAME +Class4=CDropURL +Resource3=IDD_MANUALHOST +Class5=CDragPad +Resource4=IDD_ABOUTBOX +Class6=COptionsDlg +Resource5=IDD_OPTIONS +Resource6=IDD_AUTOBEST +Class7=CHostNameDlg +Resource7=IDD_DRAGPAD +Class8=CHostProperties +Resource8=IDR_MENU +Class9=CAutoBestDlg +Resource9=IDD_DIPSTICK_DIALOG +Class10=CSelectURLsDlg +Resource10=IDD_URLS + +[CLS:CDipstickApp] +Type=0 +HeaderFile=Dipstick.h +ImplementationFile=Dipstick.cpp +Filter=N +LastObject=CDipstickApp +BaseClass=CWinApp +VirtualFilter=AC + +[CLS:CDipstickDlg] +Type=0 +HeaderFile=DipstickDlg.h +ImplementationFile=DipstickDlg.cpp +Filter=W +BaseClass=CDialog +VirtualFilter=dWC +LastObject=CDipstickDlg + +[CLS:CAboutDlg] +Type=0 +HeaderFile=DipstickDlg.h +ImplementationFile=DipstickDlg.cpp +Filter=D +BaseClass=CDialog +VirtualFilter=dWC +LastObject=IDC_KLEVERNET + +[DLG:IDD_ABOUTBOX] +Type=1 +Class=CAboutDlg +ControlCount=5 +Control1=IDC_STATIC,static,1342177283 +Control2=IDC_STATIC,static,1342308480 +Control3=IDC_STATIC,static,1342308352 +Control4=IDOK,button,1342373889 +Control5=IDC_KLEVERNET,button,1342242816 + +[DLG:IDD_DIPSTICK_DIALOG] +Type=1 +Class=CDipstickDlg +ControlCount=11 +Control1=IDC_HOSTLIST,SysListView32,1350631697 +Control2=IDC_MANUALPING,button,1342242816 +Control3=IDC_REPING,button,1476460544 +Control4=IDC_REPINGALL,button,1476460544 +Control5=IDC_REMOVE,button,1476460544 +Control6=IDC_CLEAR,button,1476460544 +Control7=ID_HELP,button,1342242816 +Control8=IDC_OPTIONS,button,1342242816 +Control9=IDC_EXIT,button,1342242816 +Control10=IDCANCEL,button,1208025088 +Control11=IDC_ADVANCED,button,1342242816 + +[CLS:CDropURL] +Type=0 +HeaderFile=DropURL.h +ImplementationFile=DropURL.cpp +BaseClass=CCmdTarget +Filter=N +LastObject=CDropURL +VirtualFilter=C + +[DLG:IDD_DRAGPAD] +Type=1 +Class=CDragPad +ControlCount=3 +Control1=IDC_DNDTARGET,SysAnimate32,1342242816 +Control2=IDCANCEL,button,1208025088 +Control3=IDOK,button,1208025089 + +[CLS:CDragPad] +Type=0 +HeaderFile=DragPad.h +ImplementationFile=DragPad.cpp +BaseClass=CDialog +Filter=W +VirtualFilter=dWC +LastObject=CDragPad + +[DLG:IDD_OPTIONS] +Type=1 +Class=COptionsDlg +ControlCount=22 +Control1=IDC_STATIC,static,1342308352 +Control2=IDC_NPINGS,edit,1350631552 +Control3=IDC_SPINPINGS,msctls_updown32,1342177463 +Control4=IDC_STATIC,static,1342308352 +Control5=IDC_MAXPINGS,edit,1350631552 +Control6=IDC_SPINMAXPINGS,msctls_updown32,1342177463 +Control7=IDC_STATIC,static,1342308352 +Control8=IDC_TIMEOUT,edit,1350631552 +Control9=IDC_SPINTIMEOUT,msctls_updown32,1342177463 +Control10=IDC_STATIC,static,1342308352 +Control11=IDC_INTERVAL,edit,1350631552 +Control12=IDC_SPINTERVAL,msctls_updown32,1342177463 +Control13=IDC_STATIC,static,1342308352 +Control14=IDC_PACKETSIZE,edit,1350631552 +Control15=IDC_SPINSIZE,msctls_updown32,1342177463 +Control16=IDC_MSWORKAROUND,button,1342259203 +Control17=IDOK,button,1342242817 +Control18=IDCANCEL,button,1342242816 +Control19=IDC_AUTOBEST,button,1342259203 +Control20=IDC_SMARTADJUST,button,1342259203 +Control21=IDC_ADJUSTINN,button,1342259203 +Control22=IDC_IGNORELA,button,1342259203 + +[CLS:COptionsDlg] +Type=0 +HeaderFile=OptionsDlg.h +ImplementationFile=OptionsDlg.cpp +BaseClass=CDialog +Filter=W +VirtualFilter=dWC +LastObject=COptionsDlg + +[MNU:IDR_MENU] +Type=1 +Class=CDipstickDlg +Command1=ID_DRAGPAD_MANUALPING +Command2=ID_DRAGPAD_PASTEURL +Command3=ID_DRAGPAD_REPINGALL +Command4=ID_DRAGPAD_REMOVEALL +Command5=ID_DRAGPAD_OPTIONS +Command6=ID_DRAGPAD_SHOWMAINWINDOW +Command7=ID_DRAGPAD_ADVANCED_EXPORTLIST +Command8=ID_DRAGPAD_ADVANCED_IMPORTLIST +Command9=ID_DRAGPAD_HELP +Command10=ID_DRAGPAD_ABOUT +Command11=ID_DRAGPAD_EXIT +Command12=ID_HOSTLIST_REPING +Command13=ID_HOSTLIST_REMOVE +Command14=ID_HOSTLIST_OPENURL +Command15=ID_HOSTLIST_COPYURL +Command16=ID_HOSTLIST_REPINGALL +Command17=ID_HOSTLIST_REMOVEALL +Command18=ID_HOSTLIST_PASTEURL +Command19=ID_HOSTLIST_PROPERTIES +Command20=ID_ADVANCED_EXPORTLIST +Command21=ID_ADVANCED_IMPORTLIST +CommandCount=21 + +[DLG:IDD_MANUALHOST] +Type=1 +Class=CHostNameDlg +ControlCount=4 +Control1=IDC_STATIC,static,1342308352 +Control2=IDC_HOST,edit,1350631568 +Control3=IDOK,button,1342242817 +Control4=IDCANCEL,button,1342242816 + +[CLS:CHostNameDlg] +Type=0 +HeaderFile=HostNameDlg.h +ImplementationFile=HostNameDlg.cpp +BaseClass=CDialog +Filter=D +LastObject=CHostNameDlg +VirtualFilter=dWC + +[DLG:IDD_PROPS] +Type=1 +Class=CHostProperties +ControlCount=16 +Control1=IDOK,button,1342242817 +Control2=IDC_URLCAPTION,static,1342308608 +Control3=IDC_URL,static,1342308736 +Control4=IDC_HOSTCAPTION,static,1342308608 +Control5=IDC_HOST,static,1342308736 +Control6=IDC_IPCAPTION,static,1342308608 +Control7=IDC_IP,static,1342308608 +Control8=IDC_TIMESCAPTION,static,1342308608 +Control9=IDC_TIMES,static,1342308608 +Control10=IDC_LOSSCAPTION,static,1342308608 +Control11=IDC_LOSS,static,1342308736 +Control12=IDC_STATUSCAPTION,static,1342308608 +Control13=IDC_STATUS,static,1342308736 +Control14=IDC_OPENURL,button,1342242816 +Control15=IDC_STATE,static,1342180099 +Control16=IDC_COPYURL,button,1342242816 + +[CLS:CHostProperties] +Type=0 +HeaderFile=HostProperties.h +ImplementationFile=HostProperties.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=CHostProperties + +[DLG:IDD_AUTOBEST] +Type=1 +Class=CAutoBestDlg +ControlCount=11 +Control1=IDOK,button,1342242817 +Control2=IDC_NEXT,button,1342242816 +Control3=IDC_PREV,button,1342242816 +Control4=IDC_URL,static,1342308481 +Control5=IDC_STATIC,static,1342308352 +Control6=IDC_RTT,static,1342308352 +Control7=IDC_STATIC,static,1342308352 +Control8=IDC_PKTLOSS,static,1342308352 +Control9=IDCANCEL,button,1342242816 +Control10=IDC_DROPSOURCE,SysAnimate32,1342177285 +Control11=IDC_COPYURL,button,1342254848 + +[CLS:CAutoBestDlg] +Type=0 +HeaderFile=AutoBestDlg.h +ImplementationFile=AutoBestDlg.cpp +BaseClass=CDialog +Filter=W +LastObject=CAutoBestDlg +VirtualFilter=dWC + +[DLG:IDD_URLS] +Type=1 +Class=CSelectURLsDlg +ControlCount=5 +Control1=IDC_URLS,listbox,1345390851 +Control2=IDOK,button,1342242817 +Control3=IDCANCEL,button,1342242816 +Control4=IDC_DOADJUST,button,1342243843 +Control5=IDC_ADJUSTINN,button,1342252035 + +[CLS:CSelectURLsDlg] +Type=0 +HeaderFile=SelectURLsDlg.h +ImplementationFile=SelectURLsDlg.cpp +BaseClass=CDialog +Filter=W +LastObject=CSelectURLsDlg +VirtualFilter=dWC + diff --git a/dipstick.cpp b/dipstick.cpp new file mode 100644 index 0000000..7ac3f42 --- a/dev/null +++ b/dipstick.cpp @@ -0,0 +1,73 @@ +// Dipstick.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "Dipstick.h" +#include "DipstickDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CDipstickApp + +BEGIN_MESSAGE_MAP(CDipstickApp, CWinApp) + //{{AFX_MSG_MAP(CDipstickApp) + //}}AFX_MSG + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDipstickApp construction + +CDipstickApp::CDipstickApp() +{ +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CDipstickApp object + +CDipstickApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CDipstickApp initialization + +BOOL CDipstickApp::InitInstance() +{ + if (!AfxSocketInit()) + { + AfxMessageBox(IDP_SOCKETS_INIT_FAILED); + return FALSE; + } + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need. + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + + OleInitialize(NULL); + + SetRegistryKey(IDS_REGISTRYKEY); + m_HelpFile = m_pszHelpFilePath; + m_HelpFile+=">Standard"; + m_pszHelpFilePath=m_HelpFile; + +CDipstickDlg dlg; + m_pMainWnd = &dlg; + dlg.DoModal(); + + OleUninitialize(); + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} diff --git a/dipstick.h b/dipstick.h new file mode 100644 index 0000000..dff8edd --- a/dev/null +++ b/dipstick.h @@ -0,0 +1,36 @@ +// Dipstick.h : main header file for the DIPSTICK application +// + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CDipstickApp: +// See Dipstick.cpp for the implementation of this class +// + +class CDipstickApp : public CWinApp +{ +public: + CString m_HelpFile; + CDipstickApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDipstickApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CDipstickApp) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// diff --git a/dipstick.mak b/dipstick.mak new file mode 100644 index 0000000..eb1e8bc --- a/dev/null +++ b/dipstick.mak @@ -0,0 +1,1763 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=Install - Win32 Canned +!MESSAGE No configuration specified. Defaulting to Install - Win32 Canned. +!ENDIF + +!IF "$(CFG)" != "Dipstick - Win32 Release" && "$(CFG)" !=\ + "Dipstick - Win32 Debug" && "$(CFG)" != "Dipstick - Win32 Release Static" &&\ + "$(CFG)" != "Install - Win32 Debug" && "$(CFG)" != "Install - Win32 Pure" &&\ + "$(CFG)" != "Install - Win32 Static" && "$(CFG)" != "Install - Win32 Canned" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE on this makefile +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "dipstick.mak" CFG="Install - Win32 Canned" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "Dipstick - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "Dipstick - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "Dipstick - Win32 Release Static" (based on "Win32 (x86) Application") +!MESSAGE "Install - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "Install - Win32 Pure" (based on "Win32 (x86) Application") +!MESSAGE "Install - Win32 Static" (based on "Win32 (x86) Application") +!MESSAGE "Install - Win32 Canned" (based on "Win32 (x86) Application") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF +################################################################################ +# Begin Project +# PROP Target_Last_Scanned "Dipstick - Win32 Release" +RSC=rc.exe +MTL=mktyplib.exe +CPP=cl.exe + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +OUTDIR=.\Release +INTDIR=.\Release +# Begin Custom Macros +OutDir=.\Release +TargetName=dipstick +# End Custom Macros + +ALL : "$(OUTDIR)\dipstick.exe" "$(OUTDIR)\dipstick.ex_"\ + "$(OUTDIR)\dipstick.hlp" "$(OUTDIR)\dipstick.cnt" "$(OUTDIR)\dipstick.hl_"\ + "$(OUTDIR)\dipstick.cn_" + +CLEAN : + -@erase "$(INTDIR)\AutoBestDlg.obj" + -@erase "$(INTDIR)\CrackURL.obj" + -@erase "$(INTDIR)\dipstick.cn_" + -@erase "$(INTDIR)\dipstick.cnt" + -@erase "$(INTDIR)\dipstick.hl_" + -@erase "$(INTDIR)\dipstick.hlp" + -@erase "$(INTDIR)\Dipstick.obj" + -@erase "$(INTDIR)\dipstick.pch" + -@erase "$(INTDIR)\dipstick.res" + -@erase "$(INTDIR)\DipstickDlg.obj" + -@erase "$(INTDIR)\DragPad.obj" + -@erase "$(INTDIR)\HostNameDlg.obj" + -@erase "$(INTDIR)\HostProperties.obj" + -@erase "$(INTDIR)\kICMP.obj" + -@erase "$(INTDIR)\OptionsDlg.obj" + -@erase "$(INTDIR)\RegEx.obj" + -@erase "$(INTDIR)\SelectURLsDlg.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\URLSource.obj" + -@erase "$(OUTDIR)\dipstick.ex_" + -@erase "$(OUTDIR)\dipstick.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c +# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c +CPP_PROJ=/nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/"\ + /c +CPP_OBJS=.\Release/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dipstick.res" /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/dipstick.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 uuid.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=uuid.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/dipstick.pdb" /machine:I386 /out:"$(OUTDIR)/dipstick.exe" +LINK32_OBJS= \ + "$(INTDIR)\AutoBestDlg.obj" \ + "$(INTDIR)\CrackURL.obj" \ + "$(INTDIR)\Dipstick.obj" \ + "$(INTDIR)\dipstick.res" \ + "$(INTDIR)\DipstickDlg.obj" \ + "$(INTDIR)\DragPad.obj" \ + "$(INTDIR)\HostNameDlg.obj" \ + "$(INTDIR)\HostProperties.obj" \ + "$(INTDIR)\kICMP.obj" \ + "$(INTDIR)\OptionsDlg.obj" \ + "$(INTDIR)\RegEx.obj" \ + "$(INTDIR)\SelectURLsDlg.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\URLSource.obj" + +"$(OUTDIR)\dipstick.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +# Begin Custom Build +OutDir=.\Release +TargetName=dipstick +InputPath=.\Release\dipstick.exe +SOURCE=$(InputPath) + +"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_ + +# End Custom Build + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 6 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +TargetName=dipstick +# End Custom Macros + +ALL : "$(OUTDIR)\dipstick.exe" "$(OUTDIR)\dipstick.ex_"\ + "$(OUTDIR)\dipstick.hlp" "$(OUTDIR)\dipstick.cnt" "$(OUTDIR)\dipstick.hl_"\ + "$(OUTDIR)\dipstick.cn_" + +CLEAN : + -@erase "$(INTDIR)\AutoBestDlg.obj" + -@erase "$(INTDIR)\CrackURL.obj" + -@erase "$(INTDIR)\dipstick.cn_" + -@erase "$(INTDIR)\dipstick.cnt" + -@erase "$(INTDIR)\dipstick.hl_" + -@erase "$(INTDIR)\dipstick.hlp" + -@erase "$(INTDIR)\Dipstick.obj" + -@erase "$(INTDIR)\dipstick.pch" + -@erase "$(INTDIR)\dipstick.res" + -@erase "$(INTDIR)\DipstickDlg.obj" + -@erase "$(INTDIR)\DragPad.obj" + -@erase "$(INTDIR)\HostNameDlg.obj" + -@erase "$(INTDIR)\HostProperties.obj" + -@erase "$(INTDIR)\kICMP.obj" + -@erase "$(INTDIR)\OptionsDlg.obj" + -@erase "$(INTDIR)\RegEx.obj" + -@erase "$(INTDIR)\SelectURLsDlg.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\URLSource.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\dipstick.ex_" + -@erase "$(OUTDIR)\dipstick.exe" + -@erase "$(OUTDIR)\dipstick.ilk" + -@erase "$(OUTDIR)\dipstick.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"stdafx.h"\ + /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dipstick.res" /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/dipstick.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 uuid.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=uuid.lib /nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/dipstick.pdb" /debug /machine:I386\ + /out:"$(OUTDIR)/dipstick.exe" +LINK32_OBJS= \ + "$(INTDIR)\AutoBestDlg.obj" \ + "$(INTDIR)\CrackURL.obj" \ + "$(INTDIR)\Dipstick.obj" \ + "$(INTDIR)\dipstick.res" \ + "$(INTDIR)\DipstickDlg.obj" \ + "$(INTDIR)\DragPad.obj" \ + "$(INTDIR)\HostNameDlg.obj" \ + "$(INTDIR)\HostProperties.obj" \ + "$(INTDIR)\kICMP.obj" \ + "$(INTDIR)\OptionsDlg.obj" \ + "$(INTDIR)\RegEx.obj" \ + "$(INTDIR)\SelectURLsDlg.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\URLSource.obj" + +"$(OUTDIR)\dipstick.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +# Begin Custom Build +OutDir=.\Debug +TargetName=dipstick +InputPath=.\Debug\dipstick.exe +SOURCE=$(InputPath) + +"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_ + +# End Custom Build + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Dipstick_" +# PROP BASE Intermediate_Dir "Dipstick_" +# PROP BASE Target_Dir "" +# PROP Use_MFC 5 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Releast" +# PROP Intermediate_Dir "Releast" +# PROP Target_Dir "" +OUTDIR=.\Releast +INTDIR=.\Releast +# Begin Custom Macros +OutDir=.\Releast +TargetName=dipstick +# End Custom Macros + +ALL : "$(OUTDIR)\dipstick.exe" "$(OUTDIR)\dipstick.ex_"\ + "$(OUTDIR)\dipstick.hlp" "$(OUTDIR)\dipstick.cnt" "$(OUTDIR)\dipstick.hl_"\ + "$(OUTDIR)\dipstick.cn_" + +CLEAN : + -@erase "$(INTDIR)\AutoBestDlg.obj" + -@erase "$(INTDIR)\CrackURL.obj" + -@erase "$(INTDIR)\dipstick.cn_" + -@erase "$(INTDIR)\dipstick.cnt" + -@erase "$(INTDIR)\dipstick.hl_" + -@erase "$(INTDIR)\dipstick.hlp" + -@erase "$(INTDIR)\Dipstick.obj" + -@erase "$(INTDIR)\dipstick.pch" + -@erase "$(INTDIR)\dipstick.res" + -@erase "$(INTDIR)\DipstickDlg.obj" + -@erase "$(INTDIR)\DragPad.obj" + -@erase "$(INTDIR)\HostNameDlg.obj" + -@erase "$(INTDIR)\HostProperties.obj" + -@erase "$(INTDIR)\kICMP.obj" + -@erase "$(INTDIR)\OptionsDlg.obj" + -@erase "$(INTDIR)\RegEx.obj" + -@erase "$(INTDIR)\SelectURLsDlg.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\URLSource.obj" + -@erase "$(OUTDIR)\dipstick.ex_" + -@erase "$(OUTDIR)\dipstick.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MD /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c +# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /c +CPP_PROJ=/nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Releast/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/dipstick.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/dipstick.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 lib\icmp.lib /nologo /subsystem:windows /machine:I386 /out:"Release/DipStick.exe" +# ADD LINK32 uuid.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=uuid.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/dipstick.pdb" /machine:I386 /out:"$(OUTDIR)/dipstick.exe" +LINK32_OBJS= \ + "$(INTDIR)\AutoBestDlg.obj" \ + "$(INTDIR)\CrackURL.obj" \ + "$(INTDIR)\Dipstick.obj" \ + "$(INTDIR)\dipstick.res" \ + "$(INTDIR)\DipstickDlg.obj" \ + "$(INTDIR)\DragPad.obj" \ + "$(INTDIR)\HostNameDlg.obj" \ + "$(INTDIR)\HostProperties.obj" \ + "$(INTDIR)\kICMP.obj" \ + "$(INTDIR)\OptionsDlg.obj" \ + "$(INTDIR)\RegEx.obj" \ + "$(INTDIR)\SelectURLsDlg.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\URLSource.obj" + +"$(OUTDIR)\dipstick.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +# Begin Custom Build +OutDir=.\Releast +TargetName=dipstick +InputPath=.\Releast\dipstick.exe +SOURCE=$(InputPath) + +"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_ + +# End Custom Build + +!ELSEIF "$(CFG)" == "Install - Win32 Debug" + +# PROP BASE Use_MFC 2 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Install\Debug" +# PROP BASE Intermediate_Dir "Install\Debug" +# PROP BASE Target_Dir "Install" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Install\Debug" +# PROP Intermediate_Dir "Install\Debug" +# PROP Target_Dir "Install" +OUTDIR=.\Install\Debug +INTDIR=.\Install\Debug + +ALL : "Dipstick - Win32 Debug" "$(OUTDIR)\Install.exe" + +CLEAN : + -@erase "$(INTDIR)\install.obj" + -@erase "$(INTDIR)\Install.res" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(OUTDIR)\Install.exe" + -@erase "$(OUTDIR)\Install.ilk" + -@erase "$(OUTDIR)\Install.pdb" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c +CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /D "_MBCS" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c +CPP_OBJS=.\Install\Debug/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "_DEBUG" /win32 +MTL_PROJ=/nologo /D "_DEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib version.lib /nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/Install.pdb" /debug /machine:I386 /out:"$(OUTDIR)/Install.exe" +LINK32_OBJS= \ + "$(INTDIR)\install.obj" \ + "$(INTDIR)\Install.res" + +"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Install - Win32 Pure" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Install\Pure" +# PROP BASE Intermediate_Dir "Install\Pure" +# PROP BASE Target_Dir "Install" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Install\Pure" +# PROP Intermediate_Dir "Install\Pure" +# PROP Target_Dir "Install" +OUTDIR=.\Install\Pure +INTDIR=.\Install\Pure + +ALL : "$(OUTDIR)\Install.exe" + +CLEAN : + -@erase "$(INTDIR)\install.obj" + -@erase "$(INTDIR)\Install.res" + -@erase "$(OUTDIR)\Install.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c +# ADD CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_MBCS" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Install\Pure/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "_DEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386 +# SUBTRACT LINK32 /debug +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe" +LINK32_OBJS= \ + "$(INTDIR)\install.obj" \ + "$(INTDIR)\Install.res" + +"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Install - Win32 Static" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Install\Static" +# PROP BASE Intermediate_Dir "Install\Static" +# PROP BASE Target_Dir "Install" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Install\Static" +# PROP Intermediate_Dir "Install\Static" +# PROP Target_Dir "Install" +OUTDIR=.\Install\Static +INTDIR=.\Install\Static + +ALL : "$(OUTDIR)\Install.exe" + +CLEAN : + -@erase "$(INTDIR)\install.obj" + -@erase "$(INTDIR)\Install.res" + -@erase "$(OUTDIR)\Install.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c +# ADD CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "STATI_K" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_MBCS" /D "STATI_K" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Install\Static/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /D "STATI_K" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /D "STATI_K" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" /d "STATI_K" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "STATI_K" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386 /out:"Install\Pure/Dipstick.exe" +# SUBTRACT BASE LINK32 /debug +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386 +# SUBTRACT LINK32 /debug +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe" +LINK32_OBJS= \ + "$(INTDIR)\install.obj" \ + "$(INTDIR)\Install.res" + +"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "Install - Win32 Canned" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Install\Canned" +# PROP BASE Intermediate_Dir "Install\Canned" +# PROP BASE Target_Dir "Install" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Install\Canned" +# PROP Intermediate_Dir "Install\Canned" +# PROP Target_Dir "Install" +OUTDIR=.\Install\Canned +INTDIR=.\Install\Canned + +ALL : "$(OUTDIR)\Install.exe" + +CLEAN : + -@erase "$(INTDIR)\install.obj" + -@erase "$(INTDIR)\Install.res" + -@erase "$(OUTDIR)\Install.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c +# ADD CPP /nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "K_ANNED" /YX /c +CPP_PROJ=/nologo /ML /W3 /GX /O1 /Ob2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_MBCS" /D "K_ANNED" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Install\Canned/ +CPP_SBRS=.\. +# ADD BASE MTL /nologo /D "NDEBUG" /win32 +# ADD MTL /nologo /D "NDEBUG" /D "K_ANNED" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /D "K_ANNED" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" /d "K_ANNED" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "K_ANNED" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386 /out:"Install\Pure/Dipstick.exe" +# SUBTRACT BASE LINK32 /debug +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no /machine:I386 +# SUBTRACT LINK32 /debug +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ + advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\ + odbccp32.lib version.lib /nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe" +LINK32_OBJS= \ + "$(INTDIR)\install.obj" \ + "$(INTDIR)\Install.res" + +"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_OBJS)}.obj: + $(CPP) $(CPP_PROJ) $< + +.c{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cpp{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +.cxx{$(CPP_SBRS)}.sbr: + $(CPP) $(CPP_PROJ) $< + +################################################################################ +# Begin Target + +# Name "Dipstick - Win32 Release" +# Name "Dipstick - Win32 Debug" +# Name "Dipstick - Win32 Release Static" + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\Dipstick.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_DIPST=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\Dipstick.obj" : $(SOURCE) $(DEP_CPP_DIPST) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_DIPST=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\Dipstick.obj" : $(SOURCE) $(DEP_CPP_DIPST) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_DIPST=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\Dipstick.obj" : $(SOURCE) $(DEP_CPP_DIPST) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\DipstickDlg.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_DIPSTI=\ + ".\AutoBestDlg.h"\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\DragPad.h"\ + ".\HostNameDlg.h"\ + ".\HostProperties.h"\ + ".\OptionsDlg.h"\ + ".\SelectURLsDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + ".\URLSource.h"\ + + +"$(INTDIR)\DipstickDlg.obj" : $(SOURCE) $(DEP_CPP_DIPSTI) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_DIPSTI=\ + ".\AutoBestDlg.h"\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\DragPad.h"\ + ".\HostNameDlg.h"\ + ".\HostProperties.h"\ + ".\OptionsDlg.h"\ + ".\SelectURLsDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + ".\URLSource.h"\ + + +"$(INTDIR)\DipstickDlg.obj" : $(SOURCE) $(DEP_CPP_DIPSTI) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_DIPSTI=\ + ".\AutoBestDlg.h"\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\DragPad.h"\ + ".\HostNameDlg.h"\ + ".\HostProperties.h"\ + ".\OptionsDlg.h"\ + ".\SelectURLsDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + ".\URLSource.h"\ + + +"$(INTDIR)\DipstickDlg.obj" : $(SOURCE) $(DEP_CPP_DIPSTI) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\StdAfx.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_STDAF=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + +# ADD CPP /Yc"stdafx.h" + +BuildCmds= \ + $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/"\ + /c $(SOURCE) \ + + +"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +"$(INTDIR)\dipstick.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_STDAF=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + +# ADD CPP /Yc"stdafx.h" + +BuildCmds= \ + $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yc"stdafx.h"\ + /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE) \ + + +"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +"$(INTDIR)\dipstick.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_STDAF=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + +# ADD BASE CPP /Yc"stdafx.h" +# ADD CPP /Yc"stdafx.h" + +BuildCmds= \ + $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS"\ + /Fp"$(INTDIR)/dipstick.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \ + + +"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +"$(INTDIR)\dipstick.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\dipstick.rc + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_RSC_DIPSTIC=\ + ".\res\best.wav"\ + ".\res\complete.ico"\ + ".\res\Dipstick.ico"\ + ".\res\dipstick.rc2"\ + ".\res\kdnd.avi"\ + ".\res\Kdragurl.avi"\ + ".\res\pending.ico"\ + ".\res\pinging.ico"\ + ".\res\unreach.ico"\ + ".\shared-data\klever-background.bmp"\ + + +"$(INTDIR)\dipstick.res" : $(SOURCE) $(DEP_RSC_DIPSTIC) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_RSC_DIPSTIC=\ + ".\res\background.bmp"\ + ".\res\best.wav"\ + ".\res\complete.ico"\ + ".\res\Dipstick.ico"\ + ".\res\dipstick.rc2"\ + ".\res\kdnd.avi"\ + ".\res\Kdragurl.avi"\ + ".\res\pending.ico"\ + ".\res\pinging.ico"\ + ".\res\unreach.ico"\ + + +"$(INTDIR)\dipstick.res" : $(SOURCE) $(DEP_RSC_DIPSTIC) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_RSC_DIPSTIC=\ + ".\res\background.bmp"\ + ".\res\best.wav"\ + ".\res\complete.ico"\ + ".\res\Dipstick.ico"\ + ".\res\dipstick.rc2"\ + ".\res\kdnd.avi"\ + ".\res\Kdragurl.avi"\ + ".\res\pending.ico"\ + ".\res\pinging.ico"\ + ".\res\unreach.ico"\ + + +"$(INTDIR)\dipstick.res" : $(SOURCE) $(DEP_RSC_DIPSTIC) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\DragPad.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_DRAGP=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\DragPad.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\DragPad.obj" : $(SOURCE) $(DEP_CPP_DRAGP) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_DRAGP=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\DragPad.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\DragPad.obj" : $(SOURCE) $(DEP_CPP_DRAGP) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_DRAGP=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\DragPad.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\DragPad.obj" : $(SOURCE) $(DEP_CPP_DRAGP) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\OptionsDlg.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_OPTIO=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\OptionsDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) $(DEP_CPP_OPTIO) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_OPTIO=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\OptionsDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) $(DEP_CPP_OPTIO) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_OPTIO=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\OptionsDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\OptionsDlg.obj" : $(SOURCE) $(DEP_CPP_OPTIO) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\HostNameDlg.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_HOSTN=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\HostNameDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\HostNameDlg.obj" : $(SOURCE) $(DEP_CPP_HOSTN) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_HOSTN=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\HostNameDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\HostNameDlg.obj" : $(SOURCE) $(DEP_CPP_HOSTN) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_HOSTN=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\HostNameDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\HostNameDlg.obj" : $(SOURCE) $(DEP_CPP_HOSTN) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\HostProperties.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_HOSTP=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\HostProperties.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\HostProperties.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_HOSTP=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\HostProperties.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\HostProperties.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_HOSTP=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\DipstickDlg.h"\ + ".\HostProperties.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\HostProperties.obj" : $(SOURCE) $(DEP_CPP_HOSTP) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\Help\DipStick.hpj + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +# Begin Custom Build - Making help file... +OutDir=.\Release +ProjDir=. +TargetName=dipstick +InputPath=.\help\dipstick.hpj + +BuildCmds= \ + "$(ProjDir)\makehelp.bat" \ + compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \ + compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \ + + +"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +# Begin Custom Build - Making help file... +OutDir=.\Debug +ProjDir=. +TargetName=dipstick +InputPath=.\help\dipstick.hpj + +BuildCmds= \ + "$(ProjDir)\makehelp.bat" \ + compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \ + compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \ + + +"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +# Begin Custom Build - Making help file... +OutDir=.\Releast +ProjDir=. +TargetName=dipstick +InputPath=.\help\dipstick.hpj + +BuildCmds= \ + "$(ProjDir)\makehelp.bat" \ + compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \ + compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \ + + +"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\AutoBestDlg.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_AUTOB=\ + ".\AutoBestDlg.h"\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + ".\URLSource.h"\ + + +"$(INTDIR)\AutoBestDlg.obj" : $(SOURCE) $(DEP_CPP_AUTOB) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_AUTOB=\ + ".\AutoBestDlg.h"\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + ".\URLSource.h"\ + + +"$(INTDIR)\AutoBestDlg.obj" : $(SOURCE) $(DEP_CPP_AUTOB) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_AUTOB=\ + ".\AutoBestDlg.h"\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + ".\URLSource.h"\ + + +"$(INTDIR)\AutoBestDlg.obj" : $(SOURCE) $(DEP_CPP_AUTOB) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\URLSource.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_URLSO=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + ".\URLSource.h"\ + + +"$(INTDIR)\URLSource.obj" : $(SOURCE) $(DEP_CPP_URLSO) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_URLSO=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + ".\URLSource.h"\ + + +"$(INTDIR)\URLSource.obj" : $(SOURCE) $(DEP_CPP_URLSO) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_URLSO=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + ".\URLSource.h"\ + + +"$(INTDIR)\URLSource.obj" : $(SOURCE) $(DEP_CPP_URLSO) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\Help\Dipstick.cnt + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +# PROP Exclude_From_Build 1 + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\CrackURL.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_CRACK=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\CrackURL.obj" : $(SOURCE) $(DEP_CPP_CRACK) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_CRACK=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\CrackURL.obj" : $(SOURCE) $(DEP_CPP_CRACK) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_CRACK=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\CrackURL.obj" : $(SOURCE) $(DEP_CPP_CRACK) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\SelectURLsDlg.cpp + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_SELEC=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\SelectURLsDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\SelectURLsDlg.obj" : $(SOURCE) $(DEP_CPP_SELEC) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_SELEC=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\SelectURLsDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\SelectURLsDlg.obj" : $(SOURCE) $(DEP_CPP_SELEC) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_SELEC=\ + ".\CrackURL.h"\ + ".\Dipstick.h"\ + ".\SelectURLsDlg.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + + +"$(INTDIR)\SelectURLsDlg.obj" : $(SOURCE) $(DEP_CPP_SELEC) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=".\shared-code\RegEx.cpp" + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_REGEX=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + +# ADD CPP /Yu"../stdafx.h" + +"$(INTDIR)\RegEx.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\ + /Fo"$(INTDIR)/" /c $(SOURCE) + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_REGEX=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + +# ADD CPP /Yu"../stdafx.h" + +"$(INTDIR)\RegEx.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\ + /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE) + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_REGEX=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + +# ADD CPP /Yu"../stdafx.h" + +"$(INTDIR)\RegEx.obj" : $(SOURCE) $(DEP_CPP_REGEX) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h" /Fo"$(INTDIR)/" /c\ + $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=".\shared-code\kICMP.cpp" + +!IF "$(CFG)" == "Dipstick - Win32 Release" + +DEP_CPP_KICMP=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + +# ADD CPP /Yu"../stdafx.h" + +"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\ + /Fo"$(INTDIR)/" /c $(SOURCE) + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Debug" + +DEP_CPP_KICMP=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + +# ADD CPP /Yu"../stdafx.h" + +"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h"\ + /Fo"$(INTDIR)/" /Fd"$(INTDIR)/" /c $(SOURCE) + + +!ELSEIF "$(CFG)" == "Dipstick - Win32 Release Static" + +DEP_CPP_KICMP=\ + ".\CrackURL.h"\ + ".\shared-code\ip_icmp.h"\ + ".\shared-code\kICMP.h"\ + ".\shared-code\ms_icmp.h"\ + ".\shared-code\RegEx.h"\ + ".\stdafx.h"\ + +# ADD CPP /Yu"../stdafx.h" + +"$(INTDIR)\kICMP.obj" : $(SOURCE) $(DEP_CPP_KICMP) "$(INTDIR)"\ + "$(INTDIR)\dipstick.pch" + $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_MBCS" /Fp"$(INTDIR)/dipstick.pch" /Yu"../stdafx.h" /Fo"$(INTDIR)/" /c\ + $(SOURCE) + + +!ENDIF + +# End Source File +# End Target +################################################################################ +# Begin Target + +# Name "Install - Win32 Debug" +# Name "Install - Win32 Pure" +# Name "Install - Win32 Static" +# Name "Install - Win32 Canned" + +!IF "$(CFG)" == "Install - Win32 Debug" + +!ELSEIF "$(CFG)" == "Install - Win32 Pure" + +!ELSEIF "$(CFG)" == "Install - Win32 Static" + +!ELSEIF "$(CFG)" == "Install - Win32 Canned" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\Install\Install.rc +DEP_RSC_INSTA=\ + ".\Install\Custom.rch"\ + ".\shared-data\install-icon.ico"\ + + +!IF "$(CFG)" == "Install - Win32 Debug" + + +"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "_DEBUG"\ + $(SOURCE) + + +!ELSEIF "$(CFG)" == "Install - Win32 Pure" + + +"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG"\ + $(SOURCE) + + +!ELSEIF "$(CFG)" == "Install - Win32 Static" + + +"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG" /d\ + "STATI_K" $(SOURCE) + + +!ELSEIF "$(CFG)" == "Install - Win32 Canned" + + +"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG" /d\ + "K_ANNED" $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\Install\install.cpp +DEP_CPP_INSTAL=\ + ".\shared-code\install.h"\ + + +!IF "$(CFG)" == "Install - Win32 Debug" + + +"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "Install - Win32 Pure" + + +"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "Install - Win32 Static" + + +"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "Install - Win32 Canned" + + +"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Project Dependency + +# Project_Dep_Name "Dipstick" + +!IF "$(CFG)" == "Install - Win32 Debug" + +"Dipstick - Win32 Debug" : + $(MAKE) /$(MAKEFLAGS) /F ".\dipstick.mak" CFG="Dipstick - Win32 Debug" + +!ELSEIF "$(CFG)" == "Install - Win32 Pure" + +!ELSEIF "$(CFG)" == "Install - Win32 Static" + +!ELSEIF "$(CFG)" == "Install - Win32 Canned" + +!ENDIF + +# End Project Dependency +# End Target +# End Project +################################################################################ diff --git a/dipstick.rc b/dipstick.rc new file mode 100644 index 0000000..55b8d98 --- a/dev/null +++ b/dipstick.rc @@ -0,0 +1,567 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""res\\Dipstick.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\Dipstick.ico" +IDI_PINGING ICON DISCARDABLE "res\\pinging.ico" +IDI_PENDING ICON DISCARDABLE "res\\pending.ico" +IDI_COMPLETED ICON DISCARDABLE "res\\complete.ico" +IDI_UNREACHABLE ICON DISCARDABLE "res\\unreach.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 213, 61 +STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About Dipstick" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,21,20 + LTEXT "Dipstick, Version 3.00",IDC_STATIC,40,7,89,8, + SS_NOPREFIX + LTEXT "Copyright © 1996,1997,1998,2002 Klever Group", + IDC_STATIC,40,25,166,8 + DEFPUSHBUTTON "OK",IDOK,174,7,32,14,WS_GROUP + PUSHBUTTON "http://www.klever.net/",IDC_KLEVERNET,40,40,91,14 +END + +IDD_DIPSTICK_DIALOG DIALOGEX 0, 0, 419, 152 +STYLE DS_3DLOOK | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP | + WS_EX_APPWINDOW +CAPTION " Dipstick 3.00" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "List1",IDC_HOSTLIST,"SysListView32",LVS_REPORT | + LVS_SORTASCENDING | LVS_AUTOARRANGE | WS_BORDER | + WS_TABSTOP,8,8,349,136,WS_EX_CLIENTEDGE + PUSHBUTTON "&Manual Ping",IDC_MANUALPING,361,8,50,14 + PUSHBUTTON "&Reping",IDC_REPING,361,23,50,14,WS_DISABLED + PUSHBUTTON "Reping &All",IDC_REPINGALL,361,38,50,14,WS_DISABLED + PUSHBUTTON "R&emove",IDC_REMOVE,361,53,50,14,WS_DISABLED + PUSHBUTTON "Remove A&ll",IDC_CLEAR,361,68,50,14,WS_DISABLED + PUSHBUTTON "&Help",ID_HELP,361,99,50,14 + PUSHBUTTON "&Options",IDC_OPTIONS,361,114,50,14 + PUSHBUTTON "E&xit Dipstick",IDC_EXIT,361,129,50,14 + PUSHBUTTON "",IDCANCEL,411,2,6,6,NOT WS_VISIBLE | WS_DISABLED + PUSHBUTTON "Ad&vanced",IDC_ADVANCED,361,83,50,11 +END + +IDD_DRAGPAD DIALOGEX 0, 0, 53, 33 +STYLE DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION +EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP +CAPTION " Drag URL here" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CONTROL "Animate1",IDC_DNDTARGET,"SysAnimate32",WS_TABSTOP,0,0, + 53,33 + PUSHBUTTON "",IDCANCEL,49,0,6,6,NOT WS_VISIBLE | WS_DISABLED + DEFPUSHBUTTON "",IDOK,47,27,6,6,NOT WS_VISIBLE | WS_DISABLED +END + +IDD_OPTIONS DIALOGEX 0, 0, 179, 154 +STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP +CAPTION "Dipstick Options" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + LTEXT "Number of pings per &host",IDC_STATIC,50,9,122,10 + EDITTEXT IDC_NPINGS,7,7,35,14,ES_AUTOHSCROLL + CONTROL "Spin1",IDC_SPINPINGS,"msctls_updown32",UDS_WRAP | + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,7,11,14 + LTEXT "&Maximum number of threads",IDC_STATIC,50,23,122,10 + EDITTEXT IDC_MAXPINGS,7,21,35,14,ES_AUTOHSCROLL + CONTROL "Spin1",IDC_SPINMAXPINGS,"msctls_updown32",UDS_WRAP | + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,21,11,14 + LTEXT "Ping &timeout",IDC_STATIC,50,37,122,10 + EDITTEXT IDC_TIMEOUT,7,35,35,14,ES_AUTOHSCROLL + CONTROL "Spin1",IDC_SPINTIMEOUT,"msctls_updown32",UDS_WRAP | + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,35,11,14 + LTEXT "&Interval between pings",IDC_STATIC,50,51,122,10 + EDITTEXT IDC_INTERVAL,7,49,35,14,ES_AUTOHSCROLL + CONTROL "Spin1",IDC_SPINTERVAL,"msctls_updown32",UDS_WRAP | + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,49,11,14 + LTEXT "Ping &size",IDC_STATIC,50,65,122,10 + EDITTEXT IDC_PACKETSIZE,7,63,35,14,ES_AUTOHSCROLL + CONTROL "Spin1",IDC_SPINSIZE,"msctls_updown32",UDS_WRAP | + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS,31,63,11,14 + CONTROL "Test i&nnermost URL",IDC_MSWORKAROUND,"Button", + BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,7,80,165,8 + DEFPUSHBUTTON "OK",IDOK,31,133,50,14 + PUSHBUTTON "Cancel",IDCANCEL,97,133,50,14 + CONTROL "Come up with the &best URL",IDC_AUTOBEST,"Button", + BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,16,90,156,8 + CONTROL "When selecting URLs, enable smart adjust", + IDC_SMARTADJUST,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | + WS_TABSTOP,7,100,165,8 + CONTROL "When smart-adjusting, use innermost URL",IDC_ADJUSTINN, + "Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,16,110, + 156,8 + CONTROL "Ignore relative URLs when dragging selection.", + IDC_IGNORELA,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | + WS_TABSTOP,7,120,165,8 +END + +IDD_MANUALHOST DIALOGEX 0, 0, 187, 54 +STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE +CAPTION " Manually Test Host" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + LTEXT "Enter &URL, host name or ip address:",IDC_STATIC,7,7, + 129,8 + EDITTEXT IDC_HOST,7,16,173,14,ES_LOWERCASE | ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,35,33,50,14 + PUSHBUTTON "Cancel",IDCANCEL,101,33,50,14 +END + +IDD_PROPS DIALOGEX 0, 0, 209, 99 +STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE +CAPTION " Properties" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,152,78,50,14 + LTEXT "URL:",IDC_URLCAPTION,7,7,18,8,SS_NOTIFY + LTEXT "..",IDC_URL,60,7,142,8,SS_NOPREFIX | SS_NOTIFY + LTEXT "Host name:",IDC_HOSTCAPTION,7,17,37,8,SS_NOTIFY + LTEXT "..",IDC_HOST,60,17,142,8,SS_NOPREFIX | SS_NOTIFY + LTEXT "IP:",IDC_IPCAPTION,7,27,10,8,SS_NOTIFY + LTEXT "..",IDC_IP,60,27,142,8,SS_NOTIFY + LTEXT "Ping times (min/avg/max):",IDC_TIMESCAPTION,7,37,53,17, + SS_NOTIFY + LTEXT "../../..",IDC_TIMES,60,45,66,8,SS_NOTIFY + LTEXT "Packet loss:",IDC_LOSSCAPTION,7,56,40,8,SS_NOTIFY + LTEXT "..",IDC_LOSS,60,56,66,8,SS_NOPREFIX | SS_NOTIFY + LTEXT "Status:",IDC_STATUSCAPTION,7,66,23,8,SS_NOTIFY + LTEXT "..",IDC_STATUS,60,66,142,8,SS_NOPREFIX | SS_NOTIFY + PUSHBUTTON "&Open URL",IDC_OPENURL,7,78,50,14 + ICON IDR_MAINFRAME,IDC_STATE,166,42,18,20,SS_NOTIFY | + SS_CENTERIMAGE | SS_REALSIZEIMAGE + PUSHBUTTON "&Copy URL",IDC_COPYURL,60,78,50,14 +END + +IDD_AUTOBEST DIALOGEX 0, 0, 287, 82 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP | + WS_CAPTION +EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE +CAPTION " Dipstick - report" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "Open this URL",IDOK,110,47,68,14 + PUSHBUTTON "&Next Location",IDC_NEXT,188,47,68,14 + PUSHBUTTON "&Previous Location",IDC_PREV,32,47,68,14 + CTEXT "..",IDC_URL,7,7,273,14,SS_NOPREFIX,WS_EX_DLGMODALFRAME | + WS_EX_CLIENTEDGE + LTEXT "Average Response Time, milliseconds:",IDC_STATIC,7,25, + 136,8 + LTEXT "..",IDC_RTT,143,25,68,8 + LTEXT "Packet Loss:",IDC_STATIC,7,36,136,8 + LTEXT "..",IDC_PKTLOSS,143,36,68,8 + PUSHBUTTON "Cancel",IDCANCEL,118,63,50,12 + CONTROL "Animate1",IDC_DROPSOURCE,"SysAnimate32",ACS_CENTER | + ACS_AUTOPLAY,257,23,23,22,WS_EX_DLGMODALFRAME | + WS_EX_STATICEDGE + PUSHBUTTON "&Copy URL",IDC_COPYURL,211,23,39,22,BS_CENTER | + BS_VCENTER | BS_MULTILINE +END + +IDD_URLS DIALOGEX 0, 0, 176, 192 +STYLE DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_MAXIMIZEBOX | WS_POPUP | + WS_CAPTION | WS_SYSMENU | WS_THICKFRAME +EXSTYLE WS_EX_CLIENTEDGE +CAPTION " Select URLs of interest" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + LISTBOX IDC_URLS,7,7,162,146,LBS_SORT | LBS_NOINTEGRALHEIGHT | + LBS_EXTENDEDSEL | NOT WS_BORDER | WS_VSCROLL | + WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE + DEFPUSHBUTTON "OK",IDOK,7,155,50,14 + PUSHBUTTON "Cancel",IDCANCEL,7,171,50,14 + CONTROL "&Smart adjust selection",IDC_DOADJUST,"Button", + BS_AUTOCHECKBOX | BS_TOP | WS_TABSTOP,63,157,106,10 + CONTROL "Adjust by &innermost URL",IDC_ADJUSTINN,"Button", + BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,63, + 175,106,10 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 3,0,0,0 + PRODUCTVERSION 3,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x9L +#else + FILEFLAGS 0x8L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0" + VALUE "FileDescription", "Dipstick, mirror locator\0" + VALUE "FileVersion", "3, 0, 0, 0\0" + VALUE "InternalName", "DIPSTICK\0" + VALUE "LegalCopyright", "Copyright © 1996, 1997, 1998, 2002 Klever Group (http://www.klever.net/)\0" + VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0" + VALUE "OriginalFilename", "DIPSTICK.EXE\0" + VALUE "ProductName", "Dipstick\0" + VALUE "ProductVersion", "3, 0, 0, 0\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 206 + VERTGUIDE, 40 + TOPMARGIN, 7 + BOTTOMMARGIN, 54 + END + + IDD_DIPSTICK_DIALOG, DIALOG + BEGIN + VERTGUIDE, 8 + VERTGUIDE, 411 + HORZGUIDE, 8 + HORZGUIDE, 144 + END + + IDD_OPTIONS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 172 + VERTGUIDE, 16 + VERTGUIDE, 50 + TOPMARGIN, 7 + BOTTOMMARGIN, 147 + END + + IDD_MANUALHOST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 180 + TOPMARGIN, 7 + BOTTOMMARGIN, 47 + END + + IDD_PROPS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 202 + VERTGUIDE, 60 + TOPMARGIN, 7 + BOTTOMMARGIN, 92 + END + + IDD_AUTOBEST, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 280 + VERTGUIDE, 143 + VERTGUIDE, 211 + TOPMARGIN, 7 + BOTTOMMARGIN, 75 + HORZGUIDE, 25 + HORZGUIDE, 44 + END + + IDD_URLS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 169 + TOPMARGIN, 7 + BOTTOMMARGIN, 185 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// AVI +// + +IDR_DNDAVI AVI DISCARDABLE "res\\kdnd.avi" +IDR_DRAGAVI AVI DISCARDABLE "res\\kdragurl.avi" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_MENU MENU DISCARDABLE +BEGIN + POPUP "Drag pad" + BEGIN + MENUITEM "&Manual Ping", ID_DRAGPAD_MANUALPING + MENUITEM "&Paste URL(s)", ID_DRAGPAD_PASTEURL + MENUITEM "Reping &All", ID_DRAGPAD_REPINGALL + MENUITEM "Remove A&ll", ID_DRAGPAD_REMOVEALL + MENUITEM SEPARATOR + MENUITEM "&Options", ID_DRAGPAD_OPTIONS + MENUITEM "&Show main window", ID_DRAGPAD_SHOWMAINWINDOW + POPUP "Ad&vanced" + BEGIN + MENUITEM "&Export List", ID_DRAGPAD_ADVANCED_EXPORTLIST + + MENUITEM "&Import List", ID_DRAGPAD_ADVANCED_IMPORTLIST + + END + MENUITEM SEPARATOR + MENUITEM "&Help", ID_DRAGPAD_HELP + MENUITEM "A&bout Dipstick", ID_DRAGPAD_ABOUT + MENUITEM "E&xit Dipstick", ID_DRAGPAD_EXIT + END + POPUP "Host List" + BEGIN + MENUITEM "&Reping", ID_HOSTLIST_REPING + MENUITEM "R&emove", ID_HOSTLIST_REMOVE + MENUITEM "Open URL", ID_HOSTLIST_OPENURL + MENUITEM "&Copy URL", ID_HOSTLIST_COPYURL + MENUITEM SEPARATOR + MENUITEM "Reping &All", ID_HOSTLIST_REPINGALL + MENUITEM "Remove A&ll", ID_HOSTLIST_REMOVEALL + MENUITEM SEPARATOR + MENUITEM "&Paste URL(s)", ID_HOSTLIST_PASTEURL + MENUITEM "&Properties", ID_HOSTLIST_PROPERTIES + END + POPUP "Advanced" + BEGIN + MENUITEM "&Export List", ID_ADVANCED_EXPORTLIST + MENUITEM "&Import List", ID_ADVANCED_IMPORTLIST + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_DIABACK BITMAP DISCARDABLE "shared-data/klever-background.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// WAVE +// + +IDW_BESTURL WAVE DISCARDABLE "res\\best.wav" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ABOUTBOX "&About Dipstick.." + IDS_PS_FAILEDTOLOCK "Failed to gain access to internal resources. Please, report to Klever." + IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed." + IDS_CSVEXT ".csv" + IDS_HN_BADURL "Bad URL" + IDS_ABEST_CLEANUP "Remove all locations from list?" + IDS_ABEST_NONEFOUND "No reachable locations were found." + IDS_ABEST_TITLE " Dipstick - report" + IDS_DRAGPAD_TITLE " Dipstick 3.00" + IDS_DRAGPAD_URLS " %d/%d URL(s)" + IDS_REGEX_HTMLURL "]*href[[:space:]]*=[[:space:]]*""?([^[:space:]>""]+)""?[^>]*>" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_KLEVERNET_URL "http://www.klever.net/" + IDS_PS_INTERNALERROR "Internal Error. Please report to Klever." + IDS_PS_NETUNREACHABLE "Destination network unreachable" + IDS_PS_HOSTUNREACHABLE "Destination host unreachable" + IDS_PS_PROTUNREACHABLE "Destination protocol unreachable" + IDS_PS_PORTUNREACHABLE "Destination port unreachable" + IDS_PS_NORESOURCES "No resources" + IDS_PS_HWERROR "Hardware error" + IDS_PS_BIGPACKET "Packet size is too big" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDC_DNDTARGET "Dipstick 3.00, click the right mouse button to display main window, left mouse button for menu" + IDC_HOST "Host name as specified or resolved by Dipstick" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDC_URLCAPTION "Universal Resource Locator (URL) associated with this location" + IDC_URL "Universal Resource Locator (URL) associated with this location" + IDC_HOSTCAPTION "Host name as specified or resolved by Dipstick" + IDC_IPCAPTION "Host's IP address as specified or resolved by Dipstick" + IDC_TIMESCAPTION "Minmum, maximum and average round trip time in milliseconds. The less the better." + IDC_TIMES "Minmum, maximum and average round trip time in milliseconds. The less the better." + IDC_LOSSCAPTION "IP packets loss" + IDC_LOSS "IP packets loss" + IDC_STATUSCAPTION "Last error occured during attempt to ping this location" + IDC_STATUS "Last error occured during attempt to ping this location" + IDC_OPENURL "Open URL in your default browser" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PS_TIMEOUT "Request timed out" + IDS_PS_BADROUTE "Bad route" + IDS_PS_TTLEXPTRANSIT "TTL expired in transit" + IDS_PS_TTLEXPREASM "TTL expired during reassembly" + IDS_PS_IPARAMP "IP parameter problem" + IDS_PS_SOURCEQUENCH "Source quench received" + IDS_PS_BIGOPTION "Option is too big" + IDS_PS_BADDEST "Bad destination" + IDS_PS_UNKNOWNERROR "Unknown error" + IDS_REGISTRYKEY "Klever Group, Inc." + IDS_FMT_TIMES "%lu/%lu/%lu" + IDS_FMT_LOSS "%d%%" + IDS_TIP_UNREACHABLE "This location seems to be unreachable" + IDS_PS_FAILEDTORESOLVE "Unable to resolve host IP" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PS_UNABLETOICMP "Unable to initialize ICMP services" + IDS_TIP_PENDING "This location is waiting for it's turn to get pinged" + IDS_TIP_COMPLETE "Pinging of this location has been completed" + IDS_TIP_PROPSOK "Click OK if you're done with looking and want to dismiss this window" + IDS_TIP_INTERVAL "Interval between ping requests in seconds" + IDS_TIP_OPTIONSOK "Click OK to make changes permanent" + IDS_TIP_OPTIONSCANCEL "Click CANCEL to leave dialog without making any changes" + IDS_TIP_PINGING "This location is being pinged at the moment.." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDC_MSWORKAROUND "In case of REDIRed URL - test the innermost one" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CSVFILTER "Comma Separated Values (*.csv)|*.csv|All Files (*.*)|*.*||" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "res\Dipstick.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/help/dipstick.cnt b/help/dipstick.cnt new file mode 100644 index 0000000..150117c --- a/dev/null +++ b/help/dipstick.cnt @@ -0,0 +1,8 @@ +:Base DipStick.hlp>Standard +:Title Dipstick +1 Dipstick +2 About Dipstick=About +2 Using Dipstick=Using +2 Main Window=MainWindow +2 Dipstick Options=Options +2 What's New=News diff --git a/help/dipstick.hpj b/help/dipstick.hpj new file mode 100644 index 0000000..6d63b4c --- a/dev/null +++ b/help/dipstick.hpj @@ -0,0 +1,29 @@ +; This file is maintained by HCW. Do not modify this file directly. + +[OPTIONS] +COMPRESS=12 Hall Zeck +LCID=0x409 0x0 0x0 ;English (United States) +REPORT=Yes +CONTENTS=About +TITLE=Dipstick +CNT=dipstick.cnt +HLP=DIPSTICK.HLP + +[FILES] +dipstick.rtf + +[ALIAS] +HIDD_ABOUTBOX=About +HIDD_AUTOBEST=Autobest +HIDD_DRAGPAD=Using +HIDD_MANUALHOST=MainWindowMP +HIDD_OPTIONS=Options +HIDD_PROPS=Properties +HIDD_DIPSTICK_DIALOG=MainWindow +HIDD_URLS=SelectURLs + +[MAP] +#include dipstick.hm + +[WINDOWS] +Standard="",(471,3,551,849),29444,(r14876671),(r12632256),f2 diff --git a/help/dipstick.rtf b/help/dipstick.rtf new file mode 100644 index 0000000..a37a39f --- a/dev/null +++ b/help/dipstick.rtf @@ -0,0 +1,139 @@ +{\rtf1\ansi +@{\footnote +THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT. +DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD +} +{\fonttbl{\f0\froman Times New Roman;}{\f1\fswiss Arial;}{\f3\froman Symbol;}}{\colortbl; + \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0; + \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; + \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128; + \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} + +\pard\plain\keepn +#{\footnote About} +${\footnote About Dipstick} +K{\footnote about} +{ \f1\fs18\b\sb120 About {\b Dipstick}} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b Dipstick} is our award-winning freeware that allows you to evaluate {\i mirror sites} to figure out which one has currently the least traffic. +\par\sa120\sb120\qj\pard \f1\fs18\sb120 +\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b {\i Enjoy!}} +{ +\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) 1996, 1997, 1998, 2002 {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")} +\par\qj\sb120\sa120Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +\par \sa360 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +} +\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")} +\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")} +\page + +\pard\plain\keepn +#{\footnote News} +${\footnote What's new} +{ \f1\fs18\b\sb120 What's New} +\par\pard\plain\f1\fs24\qc\cf2\b 3.00 - August 19st, 2002 +\par\pard\plain\fi0\li0\f1\fs18 \bullet Change of {\uldb license}{\v About} and opening the source. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Minor cosmetic changes +\par\pard\plain\f1\fs24\qc\cf2\b 2.52 - June 3rd, 1998 +\par\pard\plain\fi0\li0\f1\fs18 \bullet Now works properly with Winsock 2 for Windows95. Also may start working with non-Microsoft TCP/IP stacks. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Fixed bug that caused GPF when removing all URLs after testing is over and you picked the URL of your choice. +\par\pard\plain\f1\fs24\qc\cf2\b 2.5 - December 30th, 1997 +\par\pard\plain\fi0\li0\f1\fs18 \bullet Ability to export/import sets of URLs. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Copy URL menu command in the Main Window and button in the Best URL window. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Multiple URLs dragging or pasting. Works only for MSIE4 browser. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Annoying ToolTips removed. +\par\pard\plain\f1\fs24\qc\cf2\b 2.00 - July 1st, 1997 +\par\pard\plain\fi0\li0\f1\fs18 \bullet Drag'n'drop source added to the Best URL window. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Completed/Total URLs counter added to {\b Dipstick} drag pad. +\par\pard\plain\fi0\li0\f1\fs18 \bullet You may now drag'n'drop URLs from main {\b Dipstick} dialog window. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Added ability to paste URLs into {\b Dipstick} instead of dropping. +\par\pard\plain\fi0\li0\f1\fs18 \bullet New install program now lets you install {\b Dipstick} to the location of your choice. +\par\pard\plain\f1\fs24\qc\cf2\b 1.01 - March 13th, 1997 +\par\pard\plain\fi0\li0\f1\fs18 \bullet Resizable main {\b Dipstick} dialog window. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Come up with the best URL automatically. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Workaround for redir.dll +\par\pard\plain\fi0\li0\f1\fs18 \bullet No more {\b\cf6 MSIE} 3.0 requirement. +\par\pard\plain\fi0\li0\f1\fs18 \bullet Remembers window positions and size as well as columns widths. +\par\pard\plain\fi0\li0\f1\fs18 \bullet When manually adding locations - you may specify the URL, not host name as it was before (I still wonder how it came to my mind) +\page + +\pard\plain\keepn +#{\footnote Using} +${\footnote Using Dipstick} +{ \f1\fs18\b\sb120 Using {\b Dipstick}} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 To use {\b Dipstick}, please follow these steps:\pard +\par \fi0\li0 \bullet Load the page that contains links into your {\b\cf6 MSIE} or {\b\cf6 Netscape} browser. +\par \fi0\li0 \bullet Drag'n'drop desired links to {\b Dipstick} window. +\par \fi0\li0 \bullet {#{\footnote UsingManual}}(Optional) you can also manually add as many links as you want by selecting {\b Manual Ping} option. You can enter {\i url}, {\i hostname} or {\i IP address} there. +\par \fi0\li0 \bullet You will see rain going thought {\b Dipstick} window. After the rain stops, {\b Dipstick} will show you results either by suggesting the best URL or by sorting results in a table (which can be viewed by clicking on {\b Dipstick} window). +\par \fi0\li0 \bullet After you are done, you can reping all selected URLs by clicking {\uldb {\b Reping All}}{\v MainWindowRA} button in {\b Dipstick} window.\pard +\par\sa120\sb120\qj\f1\fs16 Small note for newbies (all others, please do not get mad): To drag'n'drop the URL, you need to move your mouse to the link on the web page, press and hold the select (usually - left) mouse button, and drag the mouse (with the selected URL to {\b Dipstick} window and then release mouse button. +\page + +\pard\plain\keepn +#{\footnote MainWindow} +${\footnote Main Window} +{ \f1\fs18\b\sb120 Main Window} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 The main window consists of -\pard +\par \fi0\li0 \bullet {\b Brilliant ListView with the following columns:} +\par \fi0\li0 \bullet Host Name - host name as it was specified in the URL or resolved from IP address. +\par \fi0\li0 \bullet Host IP address - host IP address as it was specified in the URL or resolved from host name. +\par \fi0\li0 \bullet Min RTT - Minimum Round Trip Time. {\b Dipstick} sends a few echo requests to remote host and calculates minimum, maximum, and average Round Trip Times. The less the better. +\par \fi0\li0 \bullet Avg RTT - Average Round Trip Time. About the same meaning as in Min RTT, but this is the average one. The less the better. By default locations are sorted by Avg RTT. +\par \fi0\li0 \bullet Max RTT - Maximum Round Trip Time. About the same meaning as in Min RTT and Avg RTT, but this is maximum one. The less the better. +\par \fi0\li0 \bullet Pktloss - Percentage of the requests lost somewhere in the net. The less the better. +\par \fi0\li0 \bullet {\b Buttons:} +\par \fi0\li0 \bullet {#{\footnote MainWindowMP}}Manual Ping - lets you add location manually (usually you just drag'n'drop locations into {\b Dipstick} window. +\par \fi0\li0 \bullet Reping - Test selected location again. +\par \fi0\li0 \bullet {#{\footnote MainWindowRA}}Reping All - Test again all locations in the list. +\par \fi0\li0 \bullet Remove - Remove selected location from the list. +\par \fi0\li0 \bullet Remove All - Remove all locations from the list. +\par \fi0\li0 \bullet Help - I think you have a clue on what this button does. +\par \fi0\li0 \bullet Options - Set {\b Dipstick} options +\par \fi0\li0 \bullet Exit Dipstick - Close {\b Dipstick} program\pard +\page + +\pard\plain\keepn +#{\footnote Options} +${\footnote Dipstick Options} +{ \f1\fs18\b\sb120 {\b Dipstick} Opions} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 Options are:\pard +\par \fi0\li0 \bullet {#{\footnote OptionsPPH}}{\b Number of pings per host} - number of echo requests to send for each location. +\par \fi0\li0 \bullet {\b Maximum number of threads} - number of locations to process at the same time. adjust this if you have unusually fast or slow connection and/or computer. +\par \fi0\li0 \bullet {\b Ping Timeout} - number of seconds to wait between sending echo requests. +\par \fi0\li0 \bullet {\b Interval between pings} - number of seconds to wait between sending echo requests. +\par \fi0\li0 \bullet {\b Ping size} - number of bytes to send in each echo request. +\par \fi0\li0 \bullet {#{\footnote OptionsIM}}{\b Test innermost URL} - in case of nesting {\b redir}ed URLs test the innermost one. Some strange companies refer to their mirrors using {\b redir.dll} so that the URLs for files located on different machines look like they're all here. Like {\b http://www.punchcards.com/redir.dll?target=http://www.punchcards.mirrordudes.com/file.exe&puchcards=advanced} +\par \fi0\li0 \bullet {#{\footnote OptionsBU}}{\b Come up with the best URL} - pop up with a suggestion about the best URL (after all locations have been pinged and have nothing left to do other than to start dowloading).\pard +\page + +\pard\plain\keepn +#{\footnote Properties} +${\footnote URL properties} +{ \f1\fs18\b\sb120 URL Properties} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 URL Properties are:\pard +\par \fi0\li0 \bullet {\b URL} - the URL itself if present. +\par \fi0\li0 \bullet {\b Host name} - host name as specified in URL (or the innermost URL in case of {\b redir}ed URLs in the {\uldb appropriate option}{\v OptionsIM} is turned on or resolved by {\b Dipstick}. +\par \fi0\li0 \bullet {\b Ping times} - minimum, average, and mmaximum round trip times if available. +\par \fi0\li0 \bullet {\b Packet loss} - percentage of packets lost in transmission. +\par \fi0\li0 \bullet {\b Status} - description of last error occured (if any).\pard +\page + +\pard\plain\keepn +#{\footnote SelectURLs} +${\footnote Select URLs Dialog} +{ \f1\fs18\b\sb120 Select URLs dialog} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 If you're dragging or cut'n'pasting selection from {\b\cf6 MSIE4} browser, you're supposed to chose which URLs to test. +\par\sa120\sb120\qj\pard \f1\fs18\sb120 There are two options you may want to change when selecting URLs from list:\pard +\par \fi0\li0 \bullet {\b Smart adjust selection} - let {\b Dipstick} adjust current selection when you're clicking URL based on the URL you click. +\par \fi0\li0 \bullet {\b Adjusst by innermost URL} - use the innermost URL when adjusting selection.\pard +\par\sa120\sb120\qj\pard \f1\fs18\sb120 The default values for these options are also available from the {\uldb {\b Options}}{\v Options} dialog box. +\page + +\pard\plain\keepn +#{\footnote Autobest} +${\footnote Dipstick Report} +{ \f1\fs18\b\sb120 {\b Dipstick} report} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 When {\b Dipstick} has finished testing and there's nothing left but to start your download, you're presented with a suggestion about the best URL. From this dialog you may chose to browse to the location you like using {\b Previous Location} and {\b Next Location} buttons, {\b Open this URL}, {\b Copy URL} to clipboard or drag it to wherever you want. +\page +} \ No newline at end of file diff --git a/help/dipstick.xml b/help/dipstick.xml new file mode 100644 index 0000000..b6e0748 --- a/dev/null +++ b/help/dipstick.xml @@ -0,0 +1,115 @@ + + + + About Dipstick +

Dipstick is our award-winning freeware that allows you to evaluate mirror sites to figure out which one has currently the least traffic.

+

+

Enjoy!

+ + +
+ + What's New + + Change of license and opening the source. + Minor cosmetic changes + + + Now works properly with Winsock 2 for Windows95. Also may start working with non-Microsoft TCP/IP stacks. + Fixed bug that caused GPF when removing all URLs after testing is over and you picked the URL of your choice. + + + Ability to export/import sets of URLs. + Copy URL menu command in the Main Window and button in the Best URL window. + Multiple URLs dragging or pasting. Works only for MSIE4 browser. + Annoying ToolTips removed. + + + Drag'n'drop source added to the Best URL window. + Completed/Total URLs counter added to Dipstick drag pad. + You may now drag'n'drop URLs from main Dipstick dialog window. + Added ability to paste URLs into Dipstick instead of dropping. + New install program now lets you install Dipstick to the location of your choice. + + + Resizable main Dipstick dialog window. + Come up with the best URL automatically. + Workaround for redir.dll + No more MSIE 3.0 requirement. + Remembers window positions and size as well as columns widths. + 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) + + + + Using Dipstick +

To use Dipstick, please follow these steps:

+ + 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 Dipstick window and then release mouse button. +
+ + Main Window +

The main window consists of -

+ +
+ + Dipstick Opions +

Options are:

+
+ + + URL Properties +

URL Properties are:

+
+ + + Select URLs dialog +

If you're dragging or cut'n'pasting selection from MSIE4 browser, you're supposed to chose which URLs to test.

+

There are two options you may want to change when selecting URLs from list:

+
    +
  • Smart adjust selection - let Dipstick adjust current selection when you're clicking URL based on the URL you click.
  • +
  • Adjusst by innermost URL - use the innermost URL when adjusting selection.
  • +
+

The default values for these options are also available from the Options dialog box.

+
+ + Dipstick report +

When 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 Previous Location and Next Location buttons, Open this URL, Copy URL to clipboard or drag it to wherever you want.

+
+
diff --git a/install/custom.rch b/install/custom.rch new file mode 100644 index 0000000..6b8ce9c --- a/dev/null +++ b/install/custom.rch @@ -0,0 +1,10 @@ +#ifdef STATI_K +dipstick.ex_ rcdata discardable "../releast/dipstick.ex_" +#else +dipstick.ex_ rcdata discardable "../release/dipstick.ex_" +#endif +dipstick.cn_ rcdata discardable "../release/dipstick.cn_" +dipstick.hl_ rcdata discardable "../release/dipstick.hl_" +#ifdef K_ANNED +mfc42.dl_ rcdata discardable "../redist/mfc42.dl_" +#endif diff --git a/install/install.cpp b/install/install.cpp new file mode 100644 index 0000000..995b78f --- a/dev/null +++ b/install/install.cpp @@ -0,0 +1,68 @@ +#include "resource.h" +#include "../shared-code/install.h" + +#define KINNAME "Dipstick" +#define KINSHORT KINNAME +#define VERSION "3.00" + +BOOL Install(void) +{ +STRING dPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",KINSHORT "Path"); +STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath"); +LPCSTR qPath = ((LPCSTR)dPath)?(LPCSTR)dPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings"); +STRING path = REQUESTPATH(" " KINNAME " " VERSION,"\nEnter destination path:",qPath); + if(!path) + return NULL; + +#ifdef K_ANNED +STRING sysDir(_MAX_PATH); + GetSystemDirectory(sysDir,_MAX_PATH); + INSTALLFILE("mfc42.dl_",sysDir,"mfc42.dll"); +#endif + + MAKE_PATH(path); +STRING shortPath = GET_SHORT_PATH(path); + if(!shortPath){ + MessageBox(NULL,"Failed to install " KINNAME " " VERSION " in specified directory",NULL,MB_ICONERROR|MB_OK); + return FALSE; + } + + if(!( + INSTALLFILE("dipstick.ex_",path,"dipstick.exe") && + INSTALLFILE("dipstick.hl_",path,"dipstick.hlp") && + INSTALLFILE("dipstick.cn_",path,"dipstick.cnt") + )){ + MessageBox(NULL,"Failed to install " KINNAME " " VERSION " in specified directory",NULL,MB_ICONERROR|MB_OK); + return FALSE; + } + ADDMENU("Accessories\\Klever Co.",KINNAME,path,"dipstick.exe"); + + strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",KINSHORT "Path",path); + strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath",path); + +FILE* inf=CREATE_INF_FILE(path,KINSHORT ".INF"); + if(!inf){ + MessageBox(NULL,"Failed to install " KINNAME " " VERSION,NULL,MB_ICONERROR|MB_OK); + return FALSE; + } + INF_FILE_HEADER(inf); + INF_FILE_SECTION(inf,"Uninstall"); + fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n"); + INF_FILE_SECTION(inf,"kFiles"); + INF_REMOVE_ROOT(inf,KINSHORT "Files",path); + INF_REMOVE_FILE(inf,KINSHORT "Files","dipstick.exe"); + INF_REMOVE_HELP_FILE(inf,KINSHORT "Files","dipstick"); + INF_REMOVE_FILE(inf,KINSHORT "Files",KINSHORT ".INF"); + INF_FILE_SECTION(inf,"kReg"); + INF_UNINSTALL_REG(inf,KINSHORT); + INF_FILE_SECTION(inf,"kMenu"); + INF_MENU_GROUP(inf,1,"Accessories\\Klever Co."); + INF_MENU_ITEM(inf,1,KINNAME); + fclose(inf); + + REG_UNINSTALL_COMMAND(KINSHORT,"Klever " KINNAME " " VERSION,shortPath,KINSHORT ".INF","Uninstall"); + + MessageBox(NULL,KINNAME " " VERSION " installed successfully, you may now run it from Programs/Accessories/Klever Co. menu or remove it using Control Panel Add/Remove Programs applet."," Rejoice!",MB_ICONINFORMATION|MB_OK); + + return TRUE; +} diff --git a/install/install.rc b/install/install.rc new file mode 100644 index 0000000..8c86414 --- a/dev/null +++ b/install/install.rc @@ -0,0 +1,182 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +#if defined(APSTUDIO_INVOKED) || defined(FALSE) +#if defined(APSTUDIO_INVOKED) +IDD_INSTALLING$(FALSE) DIALOGEX 0, 0, 200, 74 +#else +IDD_INSTALLING DIALOGEX 0, 0, 200, 74 +#endif +STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + PUSHBUTTON "Cancel",IDCANCEL,143,53,50,14,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_FLAT,WS_EX_DLGMODALFRAME + CONTROL "Animate1",IDC_DISKS,"SysAnimate32",ACS_TRANSPARENT | + ACS_AUTOPLAY | WS_TABSTOP,161,7,32,32 + LTEXT "",IDC_STATE,7,7,150,32,SS_NOPREFIX | SS_NOTIFY + CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,45, + 186,7,WS_EX_DLGMODALFRAME +END +#endif + +IDD_PATH DIALOGEX 0, 0, 255, 73 +STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP | + WS_VISIBLE | WS_CAPTION +EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + LTEXT "",IDC_PROMPT,7,7,241,30 + EDITTEXT IDC_PATH,7,37,195,12,ES_AUTOHSCROLL + PUSHBUTTON "B&rowse..",IDC_BROWSE,208,37,40,12 + DEFPUSHBUTTON "OK",IDOK,69,52,50,14 + PUSHBUTTON "Cancel",IDCANCEL,135,52,50,14 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + "IDD_INSTALLING$(FALSE)", DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 193 + TOPMARGIN, 7 + BOTTOMMARGIN, 67 + HORZGUIDE, 39 + END + + IDD_PATH, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 248 + VERTGUIDE, 202 + VERTGUIDE, 208 + TOPMARGIN, 7 + BOTTOMMARGIN, 66 + HORZGUIDE, 37 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""custom.rch""\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON ICON DISCARDABLE "../shared-data/install-icon.ico" + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 3,0,0,0 + PRODUCTVERSION 3,0,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0" + VALUE "FileDescription", "INSTALL: Dipstick, mirror locator\0" + VALUE "FileVersion", "3, 0, 0, 0\0" + VALUE "InternalName", "INSTALL\0" + VALUE "LegalCopyright", "Copyright © 1996, 1997, 1998, 2002 Klever Group (http://www.klever.net/)\0" + VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0" + VALUE "OriginalFilename", "INSTALL.EXE\0" + VALUE "ProductName", "Dipstick\0" + VALUE "ProductVersion", "3, 0, 0, 0\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "custom.rch" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/install/resource.h b/install/resource.h new file mode 100644 index 0000000..ebf7991 --- a/dev/null +++ b/install/resource.h @@ -0,0 +1,24 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Install.rc +// +#define IDD_INSTALLING 101 +#define IDD_PATH 102 +#define IDI_ICON 105 +#define IDC_DISKS 1000 +#define IDC_STATE 1001 +#define IDC_PROGRESS 1002 +#define IDC_PROMPT 1003 +#define IDC_PATH 1004 +#define IDC_BROWSE 1005 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 107 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1006 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/makehelp.bat b/makehelp.bat new file mode 100644 index 0000000..df0ff97 --- a/dev/null +++ b/makehelp.bat @@ -0,0 +1,33 @@ +@echo off +REM -- First make map file from Microsoft Visual C++ generated resource.h +echo // MAKEHELP.BAT generated Help Map file. Used by DIPSTICK.HPJ. >"help\dipstick.hm" +echo. >>"help\dipstick.hm" +REM echo // Commands (ID_* and IDM_*) >>"help\dipstick.hm" +REM makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h >>"help\dipstick.hm" +REM echo. >>"help\dipstick.hm" +REM echo // Prompts (IDP_*) >>"help\dipstick.hm" +REM makehm IDP_,HIDP_,0x30000 resource.h >>"help\dipstick.hm" +REM echo. >>"help\dipstick.hm" +REM echo // Resources (IDR_*) >>"help\dipstick.hm" +REM makehm IDR_,HIDR_,0x20000 resource.h >>"help\dipstick.hm" +REM echo. >>"help\dipstick.hm" +echo // Dialogs (IDD_*) >>"help\dipstick.hm" +makehm IDD_,HIDD_,0x20000 resource.h >>"help\dipstick.hm" +echo. >>"help\dipstick.hm" +REM echo // Frame Controls (IDW_*) >>"help\dipstick.hm" +REM makehm IDW_,HIDW_,0x50000 resource.h >>"help\dipstick.hm" +makehm IDH_,IDH_,0 resource.h >>"help\dipstick.hm" +REM -- Make help for Project DIPSTICK + +echo Building RTF file +xsltproc -o help/dipstick.rtf shared-code/kinhelp.xsl help/dipstick.xml +echo Building Win32 Help files +start /wait hcrtf -x "help\dipstick.hpj" +echo. +if exist Debug\nul copy "help\dipstick.hlp" Debug +if exist Debug\nul copy "help\dipstick.cnt" Debug +if exist Release\nul copy "help\dipstick.hlp" Release +if exist Release\nul copy "help\dipstick.cnt" Release +if exist Releast\nul copy "help\dipstick.hlp" Releast +if exist Releast\nul copy "help\dipstick.cnt" Releast +echo. diff --git a/res/best.wav b/res/best.wav new file mode 100644 index 0000000..cadaa04 --- a/dev/null +++ b/res/best.wav Binary files differ diff --git a/res/complete.ico b/res/complete.ico new file mode 100644 index 0000000..01b7014 --- a/dev/null +++ b/res/complete.ico Binary files differ diff --git a/res/dipstick.ico b/res/dipstick.ico new file mode 100644 index 0000000..6cc0ee5 --- a/dev/null +++ b/res/dipstick.ico Binary files differ diff --git a/res/dipstick.rc2 b/res/dipstick.rc2 new file mode 100644 index 0000000..c5f3389 --- a/dev/null +++ b/res/dipstick.rc2 @@ -0,0 +1,13 @@ +// +// DIPSTICK.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff --git a/res/kdnd.avi b/res/kdnd.avi new file mode 100644 index 0000000..e2221db --- a/dev/null +++ b/res/kdnd.avi Binary files differ diff --git a/res/kdragurl.avi b/res/kdragurl.avi new file mode 100644 index 0000000..03baf1f --- a/dev/null +++ b/res/kdragurl.avi Binary files differ diff --git a/res/pending.ico b/res/pending.ico new file mode 100644 index 0000000..5b978cb --- a/dev/null +++ b/res/pending.ico Binary files differ diff --git a/res/pinging.ico b/res/pinging.ico new file mode 100644 index 0000000..38aa6bf --- a/dev/null +++ b/res/pinging.ico Binary files differ diff --git a/res/unreach.ico b/res/unreach.ico new file mode 100644 index 0000000..a9ff75a --- a/dev/null +++ b/res/unreach.ico Binary files differ diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..2af32cb --- a/dev/null +++ b/resource.h @@ -0,0 +1,149 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by Dipstick.rc +// +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDD_DIPSTICK_DIALOG 102 +#define IDS_REGEX_NESTEDURL 102 +#define IDS_PS_FAILEDTOLOCK 102 +#define IDP_SOCKETS_INIT_FAILED 103 +#define IDS_REGEX_CRACKHOST 104 +#define IDS_CSVEXT 104 +#define IDS_HN_BADURL 105 +#define IDS_ABEST_CLEANUP 106 +#define IDS_ABEST_NONEFOUND 107 +#define IDS_ABEST_TITLE 108 +#define IDS_DRAGPAD_TITLE 109 +#define IDS_DRAGPAD_URLS 110 +#define IDS_REGEX_HTMLURL 111 +#define IDS_CSVFILTER 112 +#define IDR_MAINFRAME 128 +#define IDD_DRAGPAD 129 +#define IDR_DNDAVI 130 +#define IDD_OPTIONS 132 +#define IDR_MENU 133 +#define IDD_MANUALHOST 134 +#define IDD_PROPS 135 +#define IDI_PINGING 136 +#define IDI_PENDING 137 +#define IDI_COMPLETED 138 +#define IDI_UNREACHABLE 139 +#define IDB_DIABACK 140 +#define IDD_AUTOBEST 141 +#define IDW_BESTURL 142 +#define IDR_DRAGAVI 143 +#define IDD_URLS 145 +#define IDC_HOSTLIST 1002 +#define IDC_DNDTARGET 1011 +#define IDC_OPTIONS 1013 +#define IDC_NPINGS 1014 +#define IDC_PACKETSIZE 1015 +#define IDC_TIMEOUT 1016 +#define IDC_INTERVAL 1017 +#define IDC_KLEVERNET 1017 +#define IDC_MAXPINGS 1018 +#define IDC_MANUALPING 1019 +#define IDC_HOST 1020 +#define IDC_REPING 1021 +#define IDC_IP 1021 +#define IDC_REPINGALL 1022 +#define IDC_CLEAR 1023 +#define IDC_EXIT 1024 +#define IDC_REMOVE 1025 +#define IDC_URLCAPTION 1026 +#define IDC_URL 1027 +#define IDC_HOSTCAPTION 1028 +#define IDC_IPCAPTION 1029 +#define IDC_TIMESCAPTION 1030 +#define IDC_TIMES 1031 +#define IDC_LOSSCAPTION 1032 +#define IDC_LOSS 1033 +#define IDC_STATUSCAPTION 1034 +#define IDC_STATUS 1035 +#define IDC_OPENURL 1036 +#define IDC_STATE 1039 +#define IDC_MSWORKAROUND 1048 +#define IDC_SPINPINGS 1049 +#define IDC_SPINMAXPINGS 1050 +#define IDC_SPINTIMEOUT 1051 +#define IDC_RTT 1051 +#define IDC_SPINTERVAL 1052 +#define IDC_PKTLOSS 1052 +#define IDC_SPINSIZE 1053 +#define IDC_PREV 1053 +#define IDC_AUTOBEST 1054 +#define IDC_NEXT 1054 +#define IDC_SMARTADJUST 1055 +#define IDC_DROPSOURCE 1056 +#define IDC_URLS 1057 +#define IDC_DOADJUST 1058 +#define IDC_ADJUSTINN 1059 +#define IDC_IGNORELA 1060 +#define IDC_COPYURL 1060 +#define IDC_ADVANCED 1061 +#define IDS_KLEVERNET_URL 2102 +#define IDS_PS_INTERNALERROR 2104 +#define IDS_PS_NETUNREACHABLE 2105 +#define IDS_PS_HOSTUNREACHABLE 2106 +#define IDS_PS_PROTUNREACHABLE 2107 +#define IDS_PS_PORTUNREACHABLE 2108 +#define IDS_PS_NORESOURCES 2109 +#define IDS_PS_HWERROR 2110 +#define IDS_PS_BIGPACKET 2111 +#define IDS_PS_TIMEOUT 2112 +#define IDS_PS_BADROUTE 2113 +#define IDS_PS_TTLEXPTRANSIT 2114 +#define IDS_PS_TTLEXPREASM 2115 +#define IDS_PS_IPARAMP 2116 +#define IDS_PS_SOURCEQUENCH 2117 +#define IDS_PS_BIGOPTION 2118 +#define IDS_PS_BADDEST 2119 +#define IDS_PS_UNKNOWNERROR 2120 +#define IDS_REGISTRYKEY 2121 +#define IDS_FMT_TIMES 2122 +#define IDS_FMT_LOSS 2123 +#define IDS_TIP_UNREACHABLE 2124 +#define IDS_PS_FAILEDTORESOLVE 2127 +#define IDS_PS_UNABLETOICMP 2128 +#define IDS_TIP_PENDING 2130 +#define IDS_TIP_COMPLETE 2131 +#define IDS_TIP_PROPSOK 2132 +#define IDS_TIP_INTERVAL 2133 +#define IDS_TIP_OPTIONSOK 2134 +#define IDS_TIP_OPTIONSCANCEL 2135 +#define IDS_TIP_PINGING 2136 +#define ID_DRAGPAD_EXIT 32771 +#define ID_DRAGPAD_SHOWMAINWINDOW 32772 +#define ID_DRAGPAD_OPTIONS 32773 +#define ID_DRAGPAD_ABOUT 32774 +#define ID_DRAGPAD_MANUALPING 32775 +#define ID_HOSTLIST_REPING 32776 +#define ID_HOSTLIST_REMOVE 32777 +#define ID_HOSTLIST_REPINGALL 32778 +#define ID_HOSTLIST_REMOVEALL 32779 +#define ID_HOSTLIST_OPENURL 32780 +#define ID_HOSTLIST_PROPERTIES 32781 +#define ID_DRAGPAD_HELP 32782 +#define ID_DRAGPAD_REPINGALL 32783 +#define ID_DRAGPAD_REMOVEALL 32784 +#define ID_DRAGPAD_PASTEURL 32785 +#define ID_HOSTLIST_PASTEURL 32786 +#define ID_HOSTLIST_COPYURL 32787 +#define ID_ADVANCED_EXPORTLIST 32788 +#define ID_ADVANCED_IMPORTLIST 32789 +#define ID_DRAGPAD_ADVANCED_EXPORTLIST 32790 +#define ID_DRAGPAD_ADVANCED_IMPORTLIST 32791 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_3D_CONTROLS 1 +#define _APS_NEXT_RESOURCE_VALUE 147 +#define _APS_NEXT_COMMAND_VALUE 32792 +#define _APS_NEXT_CONTROL_VALUE 1062 +#define _APS_NEXT_SYMED_VALUE 107 +#endif +#endif diff --git a/shared-code/BTreendex.h b/shared-code/BTreendex.h new file mode 100644 index 0000000..88109ab --- a/dev/null +++ b/shared-code/BTreendex.h @@ -0,0 +1,595 @@ +#ifndef __BTREENDEX_H +#define __BTREENDEX_H + +#include "Dynamide.h" + +namespace Klever { + +template +class CBTreendex : public CObject { +public: + typedef LONG CBTPageRef; + struct CBTRecordRef { + CBTPageRef m_Page; + INT m_Offset; + CBTRecordRef(CBTPageRef page=-1,INT offset=-1) : m_Page(page), m_Offset(offset) {} + }; + class CBTRecord : public CObject { + public: + CBTPageRef m_ptrLeft; + CBTPageRef m_ptrRight; + key m_Key; + value m_Value; + CBTRecord() : m_ptrLeft(-1), m_ptrRight(-1) {} + CBTRecord(key& _key,value& _value,CBTPageRef left=-1,CBTPageRef right=-1) : m_Key(_key), m_Value(_value), m_ptrLeft(left), m_ptrRight(right) {} + CBTRecord(CBTRecord& r) : m_Key(r.m_Key), m_Value(r.m_Value), m_ptrLeft(r.m_ptrLeft), m_ptrRight(r.m_ptrRight) {} + + CBTRecord& operator=(CBTRecord& r) {m_Key=r.m_Key, m_Value=r.m_Value, m_ptrLeft=r.m_ptrLeft, m_ptrRight=r.m_ptrRight;return *this;} + + void Serialize(CArchive& ar) { + if(ar.IsStoring()){ + ar << m_ptrLeft; + ar << m_ptrRight; + }else{ + ar >> m_ptrLeft; + ar >> m_ptrRight; + } + SerializeElements(ar,&m_Key,1); + SerializeElements(ar,&m_Value,1); + } + }; + class CBTPage : public CArray { + public: + void Serialize(CArchive& ar) { + int nCount = -1; + if(ar.IsStoring()){ + nCount = GetSize(); + ar << nCount; + }else{ + nCount = 0; + ar >> nCount; + RemoveAll(); + SetSize(nCount); + } + for(int tmp=0;tmp CBTDyna; + typedef CBTDyna::CDynaFile CBTDynaFile; + typedef CArray CBTRStack; + + CBTDyna m_BT; + struct _btCrap { + BOOL m_bRootSet; + CBTPageRef m_Root; + } *m_BTCrap; + BOOL m_bRO; + CBTRStack m_btStack; + CBTPage m_stackTop; + + CBTreendex() {} + ~CBTreendex() { Close(); } + BOOL Attach(CFile* file,BOOL bAutodelete) { + m_bRO = FALSE; + if(!m_BT.Attach(file,bAutodelete)) + return FALSE; + return Attach(); + } + BOOL Open(LPCTSTR file,BOOL bReadOnly) { + if(!m_BT.Open(file,bReadOnly)) + return FALSE; + m_bRO = bReadOnly; + return Attach(); + } + BOOL Create(LPCTSTR file) { + try{ + CFile* f = new CFile(file,CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead|CFile::shareDenyWrite|CFile::typeBinary); + ASSERT(f); + return Attach(f,TRUE); + }catch(CException* e){ + e->Delete(); + return FALSE; + } + } + BOOL Attach() { + ASSERT(m_BT.IsOpened()); + m_BTCrap = (_btCrap*)m_BT.m_FB.crap; + if(!m_BTCrap->m_bRootSet){ + m_BTCrap->m_Root = AllocatePage(); + if(m_BTCrap->m_Root<0) + return FALSE; + m_BTCrap->m_bRootSet = TRUE; + m_BT.Write1stBlock(); + } + return TRUE; + } + BOOL Close() { + m_BT.Close(); + return TRUE; + } + BOOL IsOpened() { + return m_BT.IsOpened(); + } + + BOOL Lookup(key& _key,value& value) { + if(!IsOpened()) + return FALSE; + ASSERT(m_BTCrap->m_bRootSet); + if(!SeekToPage(_key)) + return FALSE; + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(rr.m_Offset<0) + return FALSE; + ASSERT(rr.m_Offsetm_bRootSet); + if(!SeekToPage(_key)) + return FALSE; + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + CBTRecord nuRecord(_key,_value); + if(rr.m_Offset<0){ + if(m_stackTop.GetSize()) + nuRecord.m_ptrLeft = m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight; + }else if(rr.m_Offset==0){ + nuRecord.m_ptrRight = m_stackTop[0].m_ptrLeft; + }else{ + nuRecord.m_ptrLeft = m_stackTop[rr.m_Offset-1].m_ptrRight; + nuRecord.m_ptrRight = m_stackTop[rr.m_Offset].m_ptrLeft; + } +// ASSERT(rr.m_Offset==0 || (m_stackTop[rr.m_Offset-1].m_Key<_key && m_stackTop[rr.m_Offset-1].m_ptrRight<0)); +// ASSERT(rr.m_Offset<0 || m_stackTop[rr.m_Offset].m_Key>=_key && m_stackTop[rr.m_Offset].m_ptrLeft<0); + if(rr.m_Offset>=0 && m_stackTop[rr.m_Offset].m_Key==_key){ + // Exact match found - just replace. + m_stackTop[rr.m_Offset].m_Value = _value; + if(!SavePage(rr.m_Page,m_stackTop)) + return FALSE; + return TRUE; + } + // Split the page and propagate the split if needed.. + // Insert new element at rr.m_Offset.. + BOOL nuisnew = TRUE; + for(int sp=m_btStack.GetUpperBound();sp>=0;sp--){ + CBTPageRef opr = m_btStack[sp].m_Page; + int iAt = m_btStack[sp].m_Offset; + CBTPage op; + VERIFY(LoadPage(opr,op)); + if(iAt<0) + iAt = op.GetSize(); + else{ + if(op[iAt].m_Key nuRecord.m_Key); + } + op.InsertAt(iAt,nuRecord); + if(iAt>0) + op[iAt-1].m_ptrRight=nuRecord.m_ptrLeft; + if(iAt=0); + CBTPage np; + ASSERT(LoadPage(npr,np)); + ASSERT(!np.GetSize()); + nuRecord = op[treeOrder]; + if(iAt==treeOrder){ + // We're inserting central element! - drop out the stack top if this is still new one + for(int tmp=0;tmp=0); + CBTPage nurpa; + ASSERT(LoadPage(nuroot,nurpa)); + ASSERT(!nurpa.GetSize()); + nurpa.Add(nuRecord); + VERIFY(SavePage(nuroot,nurpa)); + m_btStack.InsertAt(0,CBTRecordRef(nuroot,0)); + m_BTCrap->m_Root = nuroot; + m_BT.Write1stBlock(); + return TRUE; + } + BOOL Delete(key& _key) { + if(!IsOpened()) + return FALSE; + ASSERT(m_BTCrap->m_bRootSet); + value _value; + if(!Lookup(_key,_value)) + return FALSE; + // Found key, check if it's a leaf + { + CBTRecordRef* rr = &m_btStack[m_btStack.GetUpperBound()]; + int rrIdx = m_btStack.GetUpperBound(); + if(m_stackTop[rr->m_Offset].m_ptrLeft>=0){ + ASSERT(m_stackTop[rr->m_Offset].m_ptrRight>=0); + // It isn't - scan for the _next_ key and do dirty deeds + m_btStack.Add(CBTRecordRef(m_stackTop[rr->m_Offset].m_ptrRight,0)); + for(;;){ + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + if(m_stackTop[0].m_ptrLeft<0) + break; + m_btStack.Add(CBTRecordRef(m_stackTop[0].m_ptrLeft,0)); + } + // We have a leaf node here, replace victim with the first element and kill it. + CBTPage uppage; + rr = &m_btStack[rrIdx]; + if(!LoadPage(rr->m_Page,uppage)) + return FALSE; + uppage[rr->m_Offset].m_Key=m_stackTop[0].m_Key; uppage[rr->m_Offset].m_Value=m_stackTop[0].m_Value; + m_stackTop.RemoveAt(0); + if(!(SavePage(rr->m_Page,uppage) && SavePage(m_btStack[m_btStack.GetUpperBound()].m_Page,m_stackTop))) + return FALSE; + }else{ + ASSERT(m_stackTop[rr->m_Offset].m_ptrRight<0); + m_stackTop.RemoveAt(rr->m_Offset); + if(!SavePage(rr->m_Page,m_stackTop)) + return FALSE; + } + } + // We have a page to check for underflow at the top of the stack now. + for(;;){ + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + if(m_stackTop.GetSize()>=treeOrder || m_btStack.GetSize()==1) + return TRUE; + CBTRecordRef& rr1 = m_btStack[m_btStack.GetUpperBound()-1]; + CBTPage daddy; + if(!LoadPage(rr1.m_Page,daddy)) + return FALSE; + CBTPageRef nPage = daddy[rr1.m_Offset].m_ptrRight; + BOOL bRight=TRUE; + if(nPage<0 || nPage==rr.m_Page){ + nPage = daddy[rr1.m_Offset].m_ptrLeft; + bRight = FALSE; + } + ASSERT(nPage>=0 && nPage!=rr.m_Page); + CBTPage neighbor; + if(!LoadPage(nPage,neighbor)) + return FALSE; + // Here we have possibly two cases: + // 1. Neighboring page can share some data with use, then do share and leave + // 2. Neighboring page is of treeorder in size, then merge and propagate + if(neighbor.GetSize()>treeOrder){ + TRACE0("Redistributing..\n"); + // Borrow some data from there. + int toBorrow = neighbor.GetSize()-treeOrder; + toBorrow=toBorrow/2+1; + ASSERT(toBorrow); + if(bRight) + m_stackTop.Add(CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight,neighbor[0].m_ptrLeft)); + else + m_stackTop.InsertAt(0,CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,neighbor[neighbor.GetUpperBound()].m_ptrRight,m_stackTop[0].m_ptrLeft)); + for(toBorrow--;toBorrow;toBorrow--){ + if(bRight){ + m_stackTop.Add(neighbor[0]); + neighbor.RemoveAt(0); + }else{ + m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]); + neighbor.RemoveAt(neighbor.GetUpperBound()); + } + } + daddy[rr1.m_Offset].m_Key = neighbor[bRight?0:neighbor.GetUpperBound()].m_Key; daddy[rr1.m_Offset].m_Value = neighbor[bRight?0:neighbor.GetUpperBound()].m_Value; + neighbor.RemoveAt(bRight?0:neighbor.GetUpperBound()); + if(!(SavePage(rr1.m_Page,daddy) && SavePage(nPage,neighbor) && SavePage(rr.m_Page,m_stackTop))) + return FALSE; + rr.m_Offset = -1; // *** Point to the next?? + return TRUE; + } + TRACE0("Merging..\n"); + // We need to merge pages here.. + // We will merge them at stacktop, then we'll discard neighbor guy.. + if(bRight) + m_stackTop.Add(CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight,neighbor[0].m_ptrLeft)); + else + m_stackTop.InsertAt(0,CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,neighbor[neighbor.GetUpperBound()].m_ptrRight,m_stackTop[0].m_ptrLeft)); + if(bRight){ + while(neighbor.GetSize()){ + m_stackTop.Add(neighbor[0]); + neighbor.RemoveAt(0); + } + }else{ + while(neighbor.GetSize()){ + m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]); + neighbor.RemoveAt(neighbor.GetUpperBound()); + } + } + if(rr1.m_Offset>0) + daddy[rr1.m_Offset-1].m_ptrRight=rr.m_Page; + if(rr1.m_Offsetm_bRootSet); + m_btStack.RemoveAll(); + m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1)); + for(;;){ + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + if(!m_stackTop.GetSize()){ + ASSERT(m_btStack.GetSize()==1); + return FALSE; + } + rr.m_Offset = 0; + if(m_stackTop[rr.m_Offset].m_ptrLeft<0) + return TRUE; + m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1)); + } + } + BOOL GoLast() { + if(!IsOpened()) + return FALSE; + ASSERT(m_BTCrap->m_bRootSet); + m_btStack.RemoveAll(); + m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1)); + for(;;){ + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + if(!m_stackTop.GetSize()){ + ASSERT(m_btStack.GetSize()==1); + return FALSE; + } + rr.m_Offset = m_stackTop.GetUpperBound(); + if(m_stackTop[rr.m_Offset].m_ptrRight<0) + return TRUE; + m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1)); + } + } + BOOL GoNext() { + if(!IsOpened()) + return FALSE; + if(!(m_btStack.GetSize() && m_btStack[m_btStack.GetUpperBound()].m_Offset>=0)) + return FALSE; + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + ASSERT(rr.m_Offset=0){ + // Advance pointer in this page and dive into subtree + // going left and left until we have nowhere to go. +// TRACE1("Dive into page %lu",m_stackTop[rr.m_Offset].m_ptrRight); + m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,0)); + for(;;){ + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + ASSERT(rr.m_Offset==0); + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + if(m_stackTop[rr.m_Offset].m_ptrLeft<0) + break; +// TRACE1(", %lu",m_stackTop[rr.m_Offset].m_ptrLeft); + m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,0)); + } +// TRACE0("\n"); + return TRUE; + }else if(rr.m_Offset=0)) + return FALSE; + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + ASSERT(rr.m_Offset=0){ + // Dive in and go right and right from the rightmost until + // we have nowhere to go. + m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1)); + for(;;){ + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + rr.m_Offset = m_stackTop.GetUpperBound(); + if(m_stackTop[rr.m_Offset].m_ptrRight<0) + return TRUE; + m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1)); + } + return TRUE; + }else if(rr.m_Offset>0){ + rr.m_Offset--; + return TRUE; + } + // We're at the leftmost element in page - go up and left until we're + // done or we have data. + m_btStack.RemoveAt(m_btStack.GetUpperBound()); + while(m_btStack.GetSize()){ + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + rr.m_Offset--; + if(rr.m_Offset>=0) + return TRUE; + m_btStack.RemoveAt(m_btStack.GetUpperBound()); + } + // No more data - we were at the first element in tree. + return FALSE; + } + BOOL GetThis(key& _key,value& _value) { + if(!IsOpened()) + return FALSE; + // *** MORE CHECKING + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + _key = m_stackTop[rr.m_Offset].m_Key; + _value = m_stackTop[rr.m_Offset].m_Value; + return TRUE; + } + + BOOL SeekToPage(const key& _key) { + ASSERT(IsOpened()); + ASSERT(m_BTCrap->m_bRootSet); + m_btStack.RemoveAll(); + m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1)); + for(;;){ + CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()]; + if(!LoadPage(rr.m_Page,m_stackTop)) + return FALSE; + ASSERT(m_stackTop.GetSize() || !m_btStack.GetUpperBound()); + if(!m_stackTop.GetSize()){ + rr.m_Offset=-1; + return TRUE; + } + for(rr.m_Offset=0;rr.m_OffsetDelete(); + rv = FALSE; + } + delete pageFile; + return rv; + } + BOOL SavePage(CBTPageRef ref,CBTPage& page) { + CFile* pageFile = m_BT.OpenFile(ref); + if(!pageFile) + return FALSE; + BOOL rv = TRUE; + try{ + CArchive ar(pageFile,CArchive::store); + page.Serialize(ar); + ar.Close(); + }catch(CException* e){ + e->Delete(); + rv = FALSE; + } + delete pageFile; + return rv; + } + CBTPageRef AllocatePage() { + CBTDynaFile* pageFile = m_BT.CreateFile(); + if(!pageFile) + return -1; + CBTPage nothing; + CBTPageRef rv = pageFile->GetFile(); + try{ + CArchive ar(pageFile,CArchive::store); + nothing.Serialize(ar); + ar.Close(); + }catch(CException* e){ + e->Delete(); + rv = -1; + } + delete pageFile; + return rv; + } + BOOL DeallocatePage(CBTPageRef ref) { + return m_BT.DeleteFile(ref); + } + +}; + +}; + +#endif // __BTREENDEX_H diff --git a/shared-code/BellsNWhistles.h b/shared-code/BellsNWhistles.h new file mode 100644 index 0000000..1de77ae --- a/dev/null +++ b/shared-code/BellsNWhistles.h @@ -0,0 +1,146 @@ +#ifndef __BELLSNWHISTLES_H +#define __BELLSNWHISTLES_H + +class CBellsNWhistles { +public: + class CBang { + public: + CString m_codeName; + enum _bangType { + bangNone, bangSpeaker, bangSystem, bangResource, + bangWaveform + } m_type; + BOOL m_bLoop; + union { + UINT system; + LPCTSTR resource; + LPCTSTR wave; + + LPCTSTR str; + UINT id; + }; + CString m_strWave; + CBang() : m_type(bangNone), m_bLoop(FALSE) {} + }; + typedef CTypedPtrMap CBangs; + struct CBelling { + LPCSTR snd; + HMODULE hm; + DWORD flags; + CBelling(LPCSTR snd,HMODULE hm,DWORD flags) : snd(snd), hm(hm), + flags(flags) {} + CBelling(CBelling& s) : snd(s.snd), hm(s.hm), flags(s.flags) {} + CBelling& operator=(CBelling& s) { + snd=s.snd; hm=s.hm; flags=s.flags; + return *this; + } + }; + typedef CBelling* Whistling; + + CBangs m_bangs; + + ~CBellsNWhistles() { + POSITION p = m_bangs.GetStartPosition(); + while(p){ + CString s; CBang* b; + m_bangs.GetNextAssoc(p,s,b); + delete b; + } + m_bangs.RemoveAll(); + } + + BOOL AssignSound(LPCTSTR codeName,LPCTSTR id,CBang::_bangType type=CBang::bangWaveform) { + CString cn = codeName; + cn.MakeLower(); + CBang* b; + if(!m_bangs.Lookup(cn,b)) { + b = new CBang; + b->m_codeName=cn; + m_bangs[cn]=b; + } + b->m_type=type; + b->str = id; + if(type==CBang::bangWaveform){ + b->m_strWave=id; b->str = b->m_strWave; + } + return TRUE; + } + BOOL AssignSound(LPCTSTR codeName,UINT nID,CBang::_bangType type=CBang::bangResource) { + CString cn = codeName; + cn.MakeLower(); + CBang* b; + if(!m_bangs.Lookup(cn,b)) { + b = new CBang; + b->m_codeName=cn; + m_bangs[cn]=b; + } + b->m_type=type; + b->id = nID; + ASSERT(type!=CBang::bangWaveform); + return TRUE; + } + BOOL UnassignSound(LPCTSTR codeName) { + CString cn = codeName; + cn.MakeLower(); + CBang* b; + if(m_bangs.Lookup(cn,b)) { + m_bangs.RemoveKey(cn); + delete b; + return TRUE; + } + return FALSE; + } + + Whistling StartSound(LPCTSTR codeName) { + Whistling* rv = NULL; + CString cn = codeName; + CBang* b; + if(!m_bangs.Lookup(cn,b)){ + ::PlaySound(cn,AfxGetInstanceHandle(),SND_ASYNC|SND_NODEFAULT|SND_NOWAIT|SND_FILENAME); + return NULL; + } + UINT flags = SND_ASYNC|SND_NODEFAULT|SND_NOWAIT; + LPCSTR snd = NULL; + switch(b->m_type){ + case CBang::bangNone: return NULL; + case CBang::bangSpeaker: MessageBeep(0xFFFFFFFF); return NULL; + case CBang::bangSystem: MessageBeep(b->system); return NULL; + case CBang::bangResource: + snd = b->resource; + flags|=SND_RESOURCE; break; + case CBang::bangWaveform: + snd = b->wave; + flags|=SND_FILENAME; break; +#ifdef _DEBUG + default: + ASSERT(FALSE); return NULL; +#endif + } + if(b->m_bLoop) + flags|=SND_LOOP; + HMODULE hm = AfxGetInstanceHandle(); + if(!::PlaySound(snd,hm,flags)) + return NULL; + return b->m_bLoop?new CBelling(snd,hm,flags):NULL; + } + BOOL StopSound(Whistling whistle) { + if(!whistle) + return FALSE; + ::PlaySound(whistle->snd,whistle->hm,whistle->flags|SND_PURGE); + delete whistle; + return TRUE; + } + UINT FillInCombo(CComboBox* combo) { + POSITION p = m_bangs.GetStartPosition(); + UINT rv = 0; + while(p) { + CString s; + CBang* b; + m_bangs.GetNextAssoc(p,s,b); + combo->AddString(s); + } + return rv; + } +}; + +#endif // _BELLSNWHISTLES_H \ No newline at end of file diff --git a/shared-code/BitSet.h b/shared-code/BitSet.h new file mode 100644 index 0000000..cf36e3b --- a/dev/null +++ b/shared-code/BitSet.h @@ -0,0 +1,105 @@ +#ifndef __BITSET_H +#define __BITSET_H + +namespace Klever { + +class CBitSet : public CObject { +public: + CWordArray m_Bits; + ULONG m_BitsInSet; + enum { + bitsPerWord = sizeof(WORD)*8 + }; + + CBitSet(ULONG size = 0) : m_BitsInSet(0) { SetSize(size); } + CBitSet(CBitSet& o) : m_BitsInSet(0) { CopyFrom(o); } + + void SetSize(ULONG size,BOOL bFillOnes=FALSE) { + UINT os = m_Bits.GetSize(); + UINT ns = (size+bitsPerWord-1)/bitsPerWord; + if(os==ns){ + if(os){ + if(bFillOnes) + m_Bits[m_BitsInSet/bitsPerWord]|=(~(WORD)0)<<(m_BitsInSet%bitsPerWord); + else + m_Bits[m_BitsInSet/bitsPerWord]&=~((~(WORD)0)<<(m_BitsInSet%bitsPerWord)); + } + m_BitsInSet=size; + }else{ + // *?* ASSERT((!os) || (((os-1)*bitsPerWord)<=m_BitsInSet && m_BitsInSet<(os*bitsPerWord))); + if(os=0;i--) + m_Bits[i]=~m_Bits[i]; + } + CBitSet& operator&=(CBitSet& o) { + if(o.m_BitsInSet=0;i--) + m_Bits[i]&=o.m_Bits[i]; + return *this; + } + CBitSet& operator|=(CBitSet& o) { + if(o.m_BitsInSet>m_BitsInSet) + SetSize(o.m_BitsInSet); + for(int i=o.m_Bits.GetUpperBound();i>=0;i--) + m_Bits[i]|=o.m_Bits[i]; + return *this; + } + CBitSet& operator=(CBitSet& o) { + CopyFrom(o); + return *this; + } + void CopyFrom(CBitSet& o) { + m_BitsInSet=o.m_BitsInSet; + m_Bits.Copy(o.m_Bits); + } + void Serialize(CArchive& ar) { + if(ar.IsStoring()){ + ar << m_BitsInSet; + m_Bits.Serialize(ar); + }else{ + ar >> m_BitsInSet; + m_Bits.Serialize(ar); + } + } +}; + +}; + +#endif // __BITSET_H diff --git a/shared-code/Dynamide.h b/shared-code/Dynamide.h new file mode 100644 index 0000000..32c93f7 --- a/dev/null +++ b/shared-code/Dynamide.h @@ -0,0 +1,443 @@ +#ifndef __DYNAMIDE_H +#define __DYNAMIDE_H + +#include "LRUCache.h" + +namespace Klever { + +template +class CDynamide : public CObject { + struct firstBlock { + LONG freeFile; + BYTE crap[fbSize-sizeof(LONG)]; + }; + struct theBlock { + LONG next; + BYTE data[bSize-sizeof(LONG)]; + }; +public: + static firstBlock FirstBlock; + static theBlock TheBlock; +private: + class CDynaCache : public CLRUCache { + public: + CFile* m_File; + BOOL m_bAutodelete; + CDynaCache(CFile* file,BOOL bAutodelete=TRUE) : CLRUCache(64) { + m_File=file; + m_bAutodelete=bAutodelete; + } + virtual ~CDynaCache() { + Flush(); + if(m_bAutodelete){ + m_File->Close(); + delete m_File; + } + } + virtual BOOL _ReadIn(DWORD idx,theBlock* data) { + LONG p = sizeof(firstBlock)+idx*sizeof(theBlock); + LONG s = m_File->Seek(p,CFile::begin); + if(p==s){ + UINT rb = m_File->Read(data,sizeof(*data)); + if(rb==sizeof(*data)) + return TRUE; + if(rb) + return FALSE; + memset(data,0,sizeof(*data)); + data->next=-1; + try{ + m_File->Write(data,sizeof(*data)); + }catch(CException* e){ + e->Delete(); + return FALSE; + } + }else{ + LONG togo = p-s; + ASSERT(togo>0); + ASSERT(!(togo%sizeof(theBlock))); + memset(data,0,sizeof(*data)); + data->next=-1; + while(togo>=0){ + try{ + m_File->Write(data,sizeof(*data)); + }catch(CException* e){ + e->Delete(); + return FALSE; + } + } + } + return TRUE; + } + virtual BOOL _WriteOut(DWORD idx,theBlock* data) { + LONG p = sizeof(firstBlock)+idx*sizeof(theBlock); + LONG s = m_File->Seek(p,CFile::begin); + if(p!=s) + return FALSE; + try{ + m_File->Write(data,sizeof(*data)); + }catch(CException* e){ + e->Delete(); + return FALSE; + } + return TRUE; + } + DWORD AllocateNode() { + LONG l = m_File->GetLength(); + ASSERT(!((l-sizeof(firstBlock))%sizeof(theBlock))); + m_File->SetLength(l+sizeof(theBlock)); + return (l-sizeof(firstBlock))/sizeof(theBlock); + } + BOOL Read1stBlock(firstBlock* fb) { + m_File->SeekToBegin(); + UINT rb = m_File->Read(fb,sizeof(*fb)); + if(rb==sizeof(*fb)) + return TRUE; + if(rb) + return FALSE; + memset(fb,0,sizeof(*fb)); + fb->freeFile = -1; + try{ + m_File->Write(fb,sizeof(*fb)); + }catch(CException* e){ + e->Delete(); + return FALSE; + } + return TRUE; + } + BOOL Write1stBlock(firstBlock* fb) { + m_File->SeekToBegin(); + try{ + m_File->Write(fb,sizeof(*fb)); + }catch(CException* e){ + e->Delete(); + return FALSE; + } + return TRUE; + } + }; +public: + class CDynaFile : public CFile { + public: + CDynamide* m_Daddy; + CArray m_Blocks; + LONG m_Position; + + CDynaFile(CDynamide* daddy) : m_Daddy(NULL) { AttachToDaddy(daddy); } + virtual ~CDynaFile() { Close(); DetachFromDaddy(); } + + void AttachToDaddy(CDynamide* daddy) { + ASSERT(!m_Daddy); + ASSERT(daddy); + m_Daddy=daddy; + m_Daddy->AttachDynaFile(this); + } + void DetachFromDaddy() { + ASSERT(m_Daddy); + ASSERT(!IsOpened()); + m_Daddy->DetachDynaFile(this); + m_Daddy=NULL; + } + + BOOL Create() { + if(IsOpened()) + return FALSE; + m_Blocks.SetAtGrow(0,m_Daddy->Allocate()); + ASSERT(m_Blocks[0]>=0); + m_Position=0; + return TRUE; + } + BOOL Open(LONG fb) { + if(IsOpened()) + return FALSE; + ASSERT(fb>=0); + theBlock* b; + do{ + m_Blocks.Add(fb); + b = m_Daddy->m_File->GetCached(fb); + ASSERT(b); + fb=b->next; + if(m_Blocks[m_Blocks.GetUpperBound()]==fb) + return FALSE; + }while(fb>=0); + m_Position=0; + return TRUE; + } + + LONG GetFile() { + if(!IsOpened()) + return -1; + return m_Blocks[0]; + } + virtual DWORD GetPosition() const { + if(!IsOpened()) + return 0; + if(m_Position<0) + return 0; + if(m_Position>GetLength()) + return GetLength(); + return m_Position; + } + virtual CString GetFileName() { + CString rv; + if(IsOpened()) + rv.Format("0x%08lX",m_Blocks[0]); + else + rv.Format("None"); + return rv; + } + virtual CString GetFileTitle() { return GetFileName(); } + virtual CString GetFilePath() { return GetFileName(); } + virtual void SetFilePath(LPCTSTR lpszNewName) { ASSERT(FALSE); } + + virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL) { ASSERT(FALSE); return FALSE; } + virtual CFile* Duplicate() { ASSERT(FALSE); return NULL; } + + virtual LONG Seek(LONG lOff, UINT nFrom) { + if(!IsOpened()) + return -1; + switch(nFrom){ + case CFile::begin: + m_Position=lOff; + break; + case CFile::current: + m_Position+=lOff; + break; + case CFile::end: + m_Position=GetLength()+lOff; + break; + default: + ASSERT(FALSE); + return -1; + } + if(m_Position<0) + m_Position=0; + if(m_Position>GetLength()) + m_Position=GetLength(); + return m_Position; + } + virtual void SetLength(DWORD dwNewLen) { + if(!IsOpened()) + return; + if(dwNewLen1){ + LONG mb = m_Blocks[m_Blocks.GetUpperBound()]; + LONG mb1 = m_Blocks[m_Blocks.GetUpperBound()-1]; + theBlock* b = m_Daddy->m_File->GetCached(mb1); + ASSERT(b); + ASSERT(b->next==mb); + b->next=-1; + m_Daddy->m_File->MakeDirty(mb1); + m_Daddy->Deallocate(mb); + m_Blocks.SetSize(m_Blocks.GetSize()-1); + } + }else{ + while(dwNewLen>GetLength()){ + LONG mb = m_Blocks[m_Blocks.GetUpperBound()]; + LONG newBlock = m_Daddy->Allocate(); + ASSERT(newBlock>=0); + theBlock* b = m_Daddy->m_File->GetCached(mb); + ASSERT(b); + ASSERT(b->next<0); + b->next=newBlock; + m_Daddy->m_File->MakeDirty(mb); + m_Blocks.Add(newBlock); + } + } + } + virtual DWORD GetLength() const { + return ((long)m_Blocks.GetSize())*((long)sizeof(TheBlock.data)); + } + + virtual UINT Read(void* lpBuf, UINT nCount) { + UINT rv = 0; + ASSERT(m_Position>=0 && m_Position<=GetLength()); + LPBYTE data = (LPBYTE)lpBuf; + while(nCount && m_Positionm_File->GetCached(m_Blocks[bn]); + ASSERT(b); + UINT bc = min(nCount,sizeof(TheBlock.data)-bo); + memmove(data,&b->data[bo],bc); + nCount-=bc; + data=&data[bc]; + rv+=bc; + m_Position+=bc; + } + return rv; + } + virtual void Write(const void* lpBuf, UINT nCount) { + ASSERT(m_Position>=0 && m_Position<=GetLength()); + LPBYTE data = (LPBYTE)lpBuf; + while(nCount){ + UINT bn = m_Position/sizeof(TheBlock.data); + UINT bo = m_Position%sizeof(TheBlock.data); + while(bn>=m_Blocks.GetSize()){ + LONG mb = m_Blocks[m_Blocks.GetUpperBound()]; + LONG newBlock = m_Daddy->Allocate(); + ASSERT(newBlock>=0); + theBlock* b = m_Daddy->m_File->GetCached(mb); + ASSERT(b); + ASSERT(b->next<0); + b->next=newBlock; + m_Daddy->m_File->MakeDirty(mb); + m_Blocks.Add(newBlock); + } + theBlock* b = m_Daddy->m_File->GetCached(m_Blocks[bn]); + ASSERT(b); + UINT bc = min(nCount,sizeof(TheBlock.data)-bo); + memmove(&b->data[bo],data,bc); + m_Daddy->m_File->MakeDirty(m_Blocks[bn]); + nCount-=bc; + data=&data[bc]; + m_Position+=bc; + } + } + + virtual void LockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); } + virtual void UnlockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); } + + virtual void Abort() { ASSERT(FALSE); } + virtual void Flush() { + m_Daddy->m_File->Flush(); + } + virtual void Close() { + m_Blocks.RemoveAll(); + } + + BOOL IsOpened() const { return m_Blocks.GetSize()!=0; } + }; + + CDynaCache* m_File; + firstBlock m_FB; + + CDynamide() : m_File(NULL) {} + ~CDynamide() { Close(); } + + BOOL AttachDynaFile(CDynaFile* f) { + // ASSERT(!m_Files.Find(f)); + // m_Files.AddHead(f); + return TRUE; + } + BOOL DetachDynaFile(CDynaFile* f) { + //POSITION p = m_Files.Find(f); + // ASSERT(p); + // m_Files.RemoveAt(p); + return TRUE; + } + + BOOL Open(LPCTSTR file,BOOL bRO=FALSE) { + Close(); + try{ + CFile* f = new CFile(file,CFile::typeBinary|(bRO?CFile::modeRead|CFile::shareDenyWrite:CFile::modeReadWrite|CFile::shareDenyRead)); + return Attach(f,TRUE); + }catch(CException* e){ + e->Delete(); + return FALSE; + } + } + BOOL Create(LPCTSTR file) { + Close(); + try{ + CFile* f = new CFile(file,CFile::typeBinary|CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead); + return Attach(f,TRUE); + }catch(CException* e){ + e->Delete(); + return FALSE; + } + } + BOOL Attach(CFile* file,BOOL bAutodelete=TRUE) { + if(IsOpened()) + return FALSE; + m_File = new CDynaCache(file,bAutodelete); + if(!m_File->Read1stBlock(&m_FB)){ + memset(&m_FB,0,sizeof(m_FB)); + m_FB.freeFile=-1; + VERIFY(m_File->Write1stBlock(&m_FB)); + } + return IsOpened(); + } + // CFile* Detach(); + BOOL Close() { + if(!IsOpened()) + return FALSE; + m_File->Write1stBlock(&m_FB); + delete m_File; + m_File=NULL; + return TRUE; + } + BOOL IsOpened() { + return m_File != NULL; + } + BOOL Write1stBlock(void) { + if(!IsOpened()) + return FALSE; + VERIFY(m_File->Write1stBlock(&m_FB)); + return TRUE; + } + + CDynaFile* CreateFile() { + CDynaFile* rv = new CDynaFile(this); + if(rv->Create()) + return rv; + delete rv; + return NULL; + } + CDynaFile* OpenFile(LONG fb) { + CDynaFile* rv = new CDynaFile(this); + if(rv->Open(fb)) + return rv; + delete rv; + return NULL; + } + BOOL DeleteFile(LONG fb) { + while(fb>=0){ + theBlock* b = m_File->GetCached(fb); + LONG nb = b->next; + Deallocate(fb); + fb=nb; + } + return TRUE; + } + + LONG Allocate() { + if(!IsOpened()) + return -1; + if(m_FB.freeFile<0){ + LONG rv = m_File->AllocateNode(); + theBlock *b = m_File->GetCached(rv); + b->next=-1; + m_File->MakeDirty(rv); + return rv; + } + LONG rv = m_FB.freeFile; + theBlock *b = m_File->GetCached(rv); + m_FB.freeFile=b->next; + b->next=-1; + m_File->MakeDirty(rv); + m_File->Write1stBlock(&m_FB); + return rv; + } + BOOL Deallocate(LONG bk) { + if(!IsOpened()) + return FALSE; + theBlock* b = m_File->GetCached(bk); + ASSERT(b); + if(m_FB.freeFile<0){ + b->next=-1; + m_FB.freeFile=bk; + }else{ + b->next=m_FB.freeFile; + m_FB.freeFile=bk; + } + m_File->MakeDirty(bk); + m_File->Write1stBlock(&m_FB); + return TRUE; + } +}; + +}; + +#endif // __DYNAMIDE_H diff --git a/shared-code/FindIFace.h b/shared-code/FindIFace.h new file mode 100644 index 0000000..8dec8c4 --- a/dev/null +++ b/shared-code/FindIFace.h @@ -0,0 +1,125 @@ +#ifndef __FINDIFACE_H +#define __FINDIFACE_H + +#include "SNMPeer.h" +#include "SNMPExtDLL.h" +#include "SNMPOIDs.h" + +namespace Klever { + +inline BOOL FindIFace(in_addr& target,in_addr& source) +{ +DEFINE_OID(ipRouteDest, OIDipRouteDest); +DEFINE_OID(ipRouteMask, OIDipRouteMask); +DEFINE_OID(ipRouteIfIndex, OIDipRouteIfIndex); +DEFINE_OID(ipRouteMetric1, OIDipRouteMetric1); +DEFINE_OID(ipAdEntIfIndex, OIDipAdEntIfIndex); +DEFINE_OID(ipAdEntAddr, OIDipAdEntAddr); +struct _route { + int iface; + int metric; + DWORD nm; +} routes[16]; +int nRoutes = 0; +CSNMPVarBindList vbl; + vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteDest,sizeof(ipRouteDest)))); + vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMask,sizeof(ipRouteMask)))); + vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteIfIndex,sizeof(ipRouteIfIndex)))); + vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMetric1,sizeof(ipRouteMetric1)))); +CSNMPExtDLL snmp("INETMIB1"); + while(nRoutes<(sizeof(routes)/sizeof(routes[0]))){ + if( + snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl) + && vbl.GetCount() == 4 + ){ + POSITION p = vbl.GetHeadPosition(); + _route r = {-1,-1}; + in_addr d, m; + BOOL bD = FALSE, bM = FALSE; + while(p){ + CSNMPVarBind& vb = vbl.GetNext(p); + if( + vb.IsName(ipRouteDest,sizeof(ipRouteDest)) + && vb.value.type==CASNAny::typeASNIP + ){ + d.s_addr=vb.value.value.ip.s_addr; bD = TRUE; + }else if( + vb.IsName(ipRouteMask,sizeof(ipRouteMask)) + && vb.value.type==CASNAny::typeASNIP + ){ + m.s_addr=vb.value.value.ip.s_addr; bM = TRUE; + }else if( + vb.IsName(ipRouteIfIndex,sizeof(ipRouteIfIndex)) + && vb.value.type==CASNAny::typeASNInteger + ){ + r.iface=vb.value.value.number; + }else if( + vb.IsName(ipRouteMetric1,sizeof(ipRouteMetric1)) + && vb.value.type==CASNAny::typeASNInteger + ){ + r.metric=vb.value.value.number; + }else + break; + } + if(r.iface<0 || r.metric<0 || (!bD) || (!bM)) + break; + if((target.s_addr&m.s_addr)==(d.s_addr&m.s_addr)){ + r.nm=htonl(m.s_addr); + memmove(&routes[nRoutes++],&r,sizeof(routes[0])); + } + }else + break; + } + if(!nRoutes) + return FALSE; +int rn = 0; + if(nRoutes>1){ + for(int tmp=1;tmproutes[rn].nm + ) + rn = tmp; + } +int iface = routes[rn].iface; + vbl.RemoveAll(); + vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntAddr,sizeof(ipAdEntAddr)))); + vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntIfIndex,sizeof(ipAdEntIfIndex)))); + for(;;){ + if( + snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl) + && vbl.GetCount()==2 + ){ + in_addr a; a.s_addr = INADDR_NONE; + int ifn = -1; + POSITION p = vbl.GetHeadPosition(); + while(p){ + CSNMPVarBind& vb = vbl.GetNext(p); + if( + vb.IsName(ipAdEntAddr,sizeof(ipAdEntAddr)) + && vb.value.type==CASNAny::typeASNIP + ){ + a.s_addr=vb.value.value.ip.s_addr; + }else if( + vb.IsName(ipAdEntIfIndex,sizeof(ipAdEntIfIndex)) + && vb.value.type==CASNAny::typeASNInteger + ){ + ifn = vb.value.value.number; + }else + break; + } + if(ifn<0) + break; + if(ifn==iface){ + source.s_addr=a.s_addr; + return TRUE; + } + }else + break; + } + return FALSE; +} + +}; + +#endif // __FINDIFACE_H diff --git a/shared-code/LRUCache.h b/shared-code/LRUCache.h new file mode 100644 index 0000000..569e829 --- a/dev/null +++ b/shared-code/LRUCache.h @@ -0,0 +1,113 @@ +#ifndef __LRUCACHE_H +#define __LRUCACHE_H + +namespace Klever { + +template +class CLRUCache : public CObject { +public: + struct CacheEntry { + enum cacheState { + cacheClean, cacheDirty, cacheEmpty + }; + cacheState m_State; + UINT m_hits; + + IDX m_idx; + DATA* m_pData; + + CacheEntry() { m_State=cacheEmpty; VERIFY(m_pData=new DATA); m_hits=0; } + virtual ~CacheEntry() { delete m_pData; } + }; + typedef CMap CCacheMap; + typedef CList CCacheList; + + CCacheList m_Cache; + CCacheMap m_Map; + + CLRUCache(UINT cacheSize) { + for(int tmp=0;tmpm_hits++; + PopUp(rv); + return rv->m_pData; + } + if(!bLoad) + return NULL; + rv = m_Cache.GetTail(); + ASSERT(rv); + switch(rv->m_State){ + case CacheEntry::cacheDirty: + FlushEntry(rv); + case CacheEntry::cacheClean: + m_Map.RemoveKey(rv->m_idx); + rv->m_State=CacheEntry::cacheEmpty; + case CacheEntry::cacheEmpty: + break; + default: + ASSERT(FALSE); + } + if(!_ReadIn(idx,rv->m_pData)) + return NULL; + rv->m_hits=1; + rv->m_State=CacheEntry::cacheClean; + rv->m_idx=idx; + m_Map[idx]=rv; + PopUp(rv); + return rv->m_pData; + } + BOOL MakeDirty(ARGIDX idx) { + CacheEntry* pEntry; + if(m_Map.Lookup(idx,pEntry)){ + ASSERT(pEntry->m_State==CacheEntry::cacheClean || pEntry->m_State==CacheEntry::cacheDirty); + pEntry->m_State=CacheEntry::cacheDirty; + return TRUE; + } + return FALSE; + } + BOOL Flush() { + POSITION p = m_Cache.GetHeadPosition(); + while(p){ + CacheEntry* pEntry = m_Cache.GetNext(p); + ASSERT(pEntry); + FlushEntry(pEntry); + } + return TRUE; + } + BOOL FlushEntry(CacheEntry* pEntry) { + if(pEntry->m_State==CacheEntry::cacheDirty){ + BOOL rv = _WriteOut(pEntry->m_idx,pEntry->m_pData); + if(rv) + pEntry->m_State=CacheEntry::cacheClean; + } + return FALSE; + } + void PopUp(CacheEntry* pEntry) { + POSITION p = m_Cache.Find(pEntry); + ASSERT(p); + m_Cache.RemoveAt(p); + VERIFY(m_Cache.AddHead(pEntry)); + } + + virtual BOOL _ReadIn(ARGIDX idx,DATA* data) = 0; + virtual BOOL _WriteOut(ARGIDX idx,DATA* data) = 0; +}; + +}; + +#endif // __LRUCACHE_H diff --git a/shared-code/RegEx.cpp b/shared-code/RegEx.cpp new file mode 100644 index 0000000..b7bab62 --- a/dev/null +++ b/shared-code/RegEx.cpp @@ -0,0 +1,1697 @@ +#include "../stdafx.h" +#include "RegEx.h" + +#define isWordableChar(c) (isalnum(c) || (c)=='_') + +BOOL CRegEx::Compile(LPCTSTR regex,int flags) +{ + ASSERT(!((flags®Extended) && (flags®Literal))); + m_Matches.RemoveAll(); + m_Strip.RemoveAll(); + m_Strip.SetSize(0,15); + m_Pattern=regex; + m_ParsePointer=0; + m_Error=0; + m_Sets.RemoveAll(); + m_Flags=flags; + m_iFlags=0; + m_BOLs=m_EOLs=0; + m_Subexps = 0; + m_Categories=1; // 0 is 'everything else' + m_bBackRefs=FALSE; + memset(m_Category,0,sizeof(m_Category)); + + // Go ahead. + m_Error || m_Strip.Add(CSop(CSop::opEnd)); + if(flags®Extended){ + ParseERE(); + }else if(flags®Literal){ + ParseLiteral(); + }else{ + ParseBRE(); + } + m_Error || m_Strip.Add(CSop(CSop::opEnd)); + Categorize(); + m_Strip.FreeExtra(); + FigureMust(); + m_Pluses=CountPluses(); + if(m_iFlags&iflagsBad){ + m_Error || (m_Error=regeAssert); + // ??? point to nuls? ;-) + } + // We may wish to free some memory here if we're erroneous (ie. m_Error..) + m_ParseParens.RemoveAll(); +#ifdef _DEBUG + if(m_Error){ + CString tmp; + tmp.Format("RE: ParseError: %d\n",m_Error); + TRACE0(tmp); + } +// DumpStrip(afxDump); +#endif + return (m_bCompiled=(!m_Error)); +} + +BOOL CRegEx::Match(LPCTSTR src,int flags) +{ + if(!m_bCompiled) + return FALSE; + if(m_iFlags&iflagsBad) + return FALSE; + m_Input=src; + m_mFlags=flags; + m_mPointer=m_Input; + m_mBegin=m_Input; + m_mEnd=&m_mBegin[m_Input.GetLength()]; + ASSERT(m_mPointer<=m_mEnd); + m_Matches.RemoveAll(); + if(!m_Must.IsEmpty()){ + if(m_Input.Find(m_Must)<0) + return FALSE; + } + // Go ahead.. +int stripLen = m_Strip.GetSize(); + m_mLastPos.SetSize(0); + for(int tmp=0;tmp0 && !m_mLastPos.GetSize()) + m_mLastPos.SetSize(m_Pluses); + dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0); + } + if(dp) + break; + // Uh.. oh.. we couldn't find a subexpression-level match + ASSERT(m_bBackRefs); + ASSERT(m_Pluses==0 || m_mLastPos.GetSize()); + for(;;){ + if(dp || endp <= m_cOldP) + break; // defeat.. ? + endp = MatchSlow(m_cOldP,endp-1,1,stripLen-1); + if(!endp) + break; // defeat.. ? + // Try it on a shorter possibility.. +#ifdef _DEBUG + for(tmp=1;tmp<=m_Subexps;tmp++) + ASSERT(m_Matches[tmp].m_Begin<0 && m_Matches[tmp].m_End<0); +#endif + dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0); + } + ASSERT((!dp) || dp==endp); + if(dp) // Found a shorter one.. + break; + // Despite initial appearances, there is no match here + beginp = m_cOldP+1; + ASSERT(beginp<=m_mEnd); + } + // Fill in the detail if so requested.. + if(!(m_mFlags®NoSubExpressions)){ + if(!m_Matches.GetSize()) + m_Matches.SetSize(1); + m_Matches[0].m_Begin=m_cOldP-m_mBegin; + m_Matches[0].m_End=endp-m_mBegin; + } + m_mLastPos.RemoveAll(); + return TRUE; +} + +CString CRegEx::Replace(LPCTSTR src,LPCTSTR rep,int flags) +{ + // *** + return CString(); +} + +void CRegEx::ParseERE(int stop) +{ +UCHAR c; +BOOL first=TRUE; +int prevF, prevB; + for(;;){ + int co = m_Strip.GetSize(); + while(m_ParsePointer < m_Pattern.GetLength() && ((c=m_Pattern[m_ParsePointer])!='|') && c!=stop) + ParseEREexp(); + if(m_Strip.GetSize()==co){ + m_Error || (m_Error=regeEmpty); + // ??? point to nuls? + } + if(m_ParsePointer>=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='|') + break; + else + m_ParsePointer++; + if(first){ + StripInsert(co,CSop(CSop::opChoice0,m_Strip.GetSize()-co+1)); + prevF = prevB = co; + first=FALSE; + } + m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-prevB)); + prevB = m_Strip.GetSize()-1; + m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF); + prevF = m_Strip.GetSize(); + m_Error || m_Strip.Add(CSop(CSop::opOr1,0)); // offset isn't really right.. very so.. + } + if(!first){ + m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF); + m_Error || m_Strip.Add(CSop(CSop::opChoice1,m_Strip.GetSize()-prevB)); + } + ASSERT(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]==stop); +} + +void CRegEx::ParseEREexp() +{ + ASSERT(m_ParsePointer < m_Pattern.GetLength()); +UCHAR c = m_Pattern[m_ParsePointer++]; +int pos = m_Strip.GetSize(); +int subno; +int count, count2; +BOOL wascaret=FALSE; + switch(c){ + case '(': + if(!(m_ParsePointer=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!=')') + ParseERE(')'); + VERIFY(m_ParseParens[m_Subexps].m_End = m_Strip.GetSize()); + m_Error || m_Strip.Add(CSop(CSop::opRightParen,subno)); + if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer++]!=')'){ + TRACE0("RE: No matching ')'\n"); + if(!m_Error) + m_Error = regeParen; + // ??? point to nuls? + } + break; + case '^': + m_Error || m_Strip.Add(CSop(CSop::opBOL)); + m_iFlags|=iflagsUseBOL; + m_BOLs++; + wascaret=TRUE; + break; + case '$': + m_Error || m_Strip.Add(CSop(CSop::opEOL)); + m_iFlags|=iflagsUseEOL; + m_EOLs++; + break; + case '|': + TRACE0("RE: '|' outside of expression\n"); + if(!m_Error) + m_Error = regeEmpty; + // ??? point to nuls? + break; + case '*': + case '+': + case '?': + TRACE0("RE: '*'/'+'/'?' with no previous expression\n"); + if(!m_Error) + m_Error = regeBadRepeat; + // ??? point to nuls? + break; + case '.': + if(m_Flags®NewLine) + EmitNonNewLineAny(); + else + m_Error || m_Strip.Add(CSop(CSop::opAny)); + break; + case '[': + ParseBracket(); + break; + case '\\': + if(m_ParsePointer >= m_Pattern.GetLength()){ + TRACE0("RE: '\\' at the end of the pattern\n"); + if(!m_Error) + m_Error = regeEscape; + // ??? point to nuls? + }else{ + c = m_Pattern[m_ParsePointer++]; + EmitOrdinary(c); + } + break; + case '{': + if(m_ParsePointer >= m_Pattern.GetLength() || !isdigit(m_Pattern[m_ParsePointer])){ + TRACE0("RE: '{' with no repeat count\n"); + if(!m_Error) + m_Error = regeBadRepeat; + // ??? point to nuls? + } + // Fallthrough.. + default: + EmitOrdinary(c); + break; + } + if(m_ParsePointer >= m_Pattern.GetLength()) + return; + c = m_Pattern[m_ParsePointer]; + // Call a '{' repetition if followed by a digit + if (!(c=='*' || c=='+' || c=='?' || ( c=='{' && (m_ParsePointer+1) < m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer+1])) )) + return; // No repetitor - done. + m_ParsePointer++; + if(wascaret){ + TRACE0("RE: repetitive '^' detected\n"); + if(!m_Error) + m_Error = regeBadRepeat; + // ??? point to nuls? + } + switch(c){ + case '*': // Implemeted as +? + // + expression + StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1)); + m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos)); + // ? expression + StripInsert(pos,CSop(CSop::opQuest0,m_Strip.GetSize()-pos+1)); + m_Error || m_Strip.Add(CSop(CSop::opQuest1,m_Strip.GetSize()-pos)); + break; + case '+': + // + expression + StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1)); + m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos)); + break; + case '?': + // Kludge - emit y? as (y|) until subtle bug gets fixed :-) + StripInsert(pos,CSop(CSop::opChoice0,m_Strip.GetSize()-pos+1)); + m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos)); + m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos); + m_Error || m_Strip.Add(CSop(CSop::opOr1,1)); + m_Error || m_Strip.Add(CSop(CSop::opChoice1,2)); + break; + case '{': + count = ParseCount(); + if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==','){ + m_ParsePointer++; + if(isdigit(m_Pattern[m_ParsePointer])){ // HHH Personally, I doubt it is always available + count2=ParseCount(); + if(!(count<=count2)){ + TRACE0("RE: Disbalanced counts in '{}' repeater\n"); + m_Error || (m_Error=regeBadBrace); + // ??? point to nuls? + } + }else // Single number with comma + count2=256; // Infinity + }else // Single number + count2=count; + EmitRepeat(pos,count,count2); + if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='}'){ + // No '}'.. + TRACE0("RE: No immediately following '}' of '{' expression\n"); + while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!='}') + m_ParsePointer++; + if(m_ParsePointer >= m_Pattern.GetLength()){ + TRACE0("RE: No closing '}' found\n"); + m_Error || (m_Error=regeBrace); + }else + m_Error || (m_Error=regeBadBrace); + // ??? point to nuls? + }else + m_ParsePointer++; + break; + } + if(m_ParsePointer >= m_Pattern.GetLength()) + return; + c = m_Pattern[m_ParsePointer]; + if(!(c=='*' || c=='+' || c=='?' || (c=='{' && (m_ParsePointer+1)=pos) + m_ParseParens[tmp].m_Begin++; + if(m_ParseParens[tmp].m_End>=pos) + m_ParseParens[tmp].m_End++; + } +} + +void CRegEx::EmitOrdinary(UCHAR c) +{ + if(m_Flags®IgnoreCase && isalpha(c) && (tolower(c) !=toupper(c))){ + // Emit both cases + CString savePattern = m_Pattern; + int savePointer = m_ParsePointer; + m_Pattern=c; + m_Pattern+=']'; + m_ParsePointer=0; + ParseBracket(); + m_Pattern=savePattern; + m_ParsePointer=savePointer; + }else{ + m_Error || m_Strip.Add(CSop(CSop::opChar,c)); + if(!m_Category[(BYTE)c]) + m_Category[(BYTE)c]=m_Categories++; + } +} + +void CRegEx::EmitNonNewLineAny() +{ + // Kludges're going on and on.. +CString savePattern = m_Pattern; +int savePointer = m_ParsePointer; + m_Pattern="^\n]"; + m_ParsePointer=0; + ParseBracket(); + m_Pattern=savePattern; + m_ParsePointer=savePointer; +} + +int CRegEx::ParseCount() +{ +BOOL nonEmpty=FALSE; +int rv = 0; +UCHAR c; + while(m_ParsePointer < m_Pattern.GetLength() && isdigit(c=m_Pattern[m_ParsePointer]) && rv <=255){ + rv = rv*10 + c-'0'; + nonEmpty=TRUE; + m_ParsePointer++; + } + if(rv>255 || !nonEmpty){ + m_Error || (m_Error=regeBadBrace); + // ??? point to nuls? + } + return rv; +} + +void CRegEx::ParseBracket() +{ + // Dept. of truly sickening special case kludges + if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:<]]")){ + m_Error || m_Strip.Add(CSop(CSop::opBOW)); + m_ParsePointer+=6; + return; + } + if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:>]]")){ + m_Error || m_Strip.Add(CSop(CSop::opEOW)); + m_ParsePointer+=6; + return; + } +BOOL invert=TRUE; + if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='^') + m_ParsePointer++; + else + invert=FALSE; +CSet cset; + if(m_ParsePointer < m_Pattern.GetLength()){ + switch(m_Pattern[m_ParsePointer]){ + case ']': + case '-': + cset.Add(m_Pattern[m_ParsePointer]); + m_ParsePointer++; + break; + } + } + while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!=']' && !((m_ParsePointer+1)=0;tmp--){ + if(cset.IsIn(tmp) && isalpha(tmp) && (toupper(tmp)!=tolower(tmp))) + cset.Add(isupper(tmp)?tolower(tmp):toupper(tmp)); + } + /* + if(!cset->m_Multis.IsEmpty()) + cset.CollatingCase(); + */ + } + if(invert){ + for(int tmp=CSet::size-1;tmp>=0;tmp--) + if(cset.IsIn(tmp)) + cset.Sub(tmp); + else + cset.Add(tmp); + if(m_Flags®NewLine) + cset.Sub('\n'); + /* + if(!cset.m_Multis.IsEmpty()) + cset.CollatingInvert(); + */ + } +UCHAR c = cset.GetOnly(); + if(c){ + EmitOrdinary(c); + }else + m_Error || m_Strip.Add(CSop(CSop::opAnyOf,StoreSet(cset))); +} + +void CRegEx::CSet::Add(UCHAR c) +{ + m_Set[(BYTE)c]=TRUE; + m_Hash+=c; +} + +BOOL CRegEx::CSet::IsIn(UCHAR c) +{ + return m_Set[(BYTE)c]; +} + +void CRegEx::CSet::Sub(UCHAR c) +{ + m_Set[(BYTE)c]=FALSE; + m_Hash-=c; +} + +UCHAR CRegEx::CSet::GetOnly() +{ +int rv = 0; +UCHAR only = 0; + for(int tmp=0;tmp=m_Pattern.GetLength()){ + m_Error || (m_Error=regeBracket); + // ??? point to nuls? + } + c = m_Pattern[m_ParsePointer]; + if(c== '-' || c==']'){ + m_Error || (m_Error=regeCType); + // ??? point to nuls? + } + ParseBracketCClass(cset); + if(m_ParsePointer>=m_Pattern.GetLength()){ + m_Error || (m_Error=regeBracket); + // ??? point to nuls? + } + if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare(":]"))){ + m_Error || (m_Error=regeCType); + // ??? point to nuls? + }else + m_ParsePointer+=2; + break; + case '=': // Equivalence class + m_ParsePointer+=2; + if(m_ParsePointer >= m_Pattern.GetLength()){ + m_Error || (m_Error=regeBracket); + // ??? point to nuls? + } + c = m_Pattern[m_ParsePointer]; + if(c== '-' || c==']'){ + m_Error || (m_Error=regeCollate); + // ??? point to nuls? + } + ParseBracketEClass(cset); + if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare("=]"))){ + m_Error || (m_Error=regeCollate); + // ??? point to nuls? + }else + m_ParsePointer+=2; + break; + default: // Symbol, character or range + { + UCHAR start, finish; + start = ParseBracketSymbol(); + if((m_ParsePointer((BYTE)finish)){ + m_Error || (m_Error=regeRange); + // ??? point to nuls? + } + for(int tmp=start;tmp<=(BYTE)finish;tmp++) + cset.Add(tmp); + } + break; + } +} + +void CRegEx::ParseBracketCClass(CSet& cset) +{ +static struct { + char *className; + char *classChars; +} cc[] = { + {"alnum","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}, + {"alpha","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"}, + {"blank"," \t"}, + {"cntrl","\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177"}, + {"digit","0123456789"}, + {"graph","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"}, + {"lower","abcdefghijklmnopqrstuvwxyz"}, + {"print","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ "}, + {"punct","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"}, + {"space","\t\n\v\f\r "}, + {"upper","ABCDEFGHIJKLMNOPQRSTUVWXYZ"}, + {"xdigit","0123456789ABCDEFabcdef"} +}; +CString cclass; +UCHAR c; + while(m_ParsePointer < m_Pattern.GetLength() && isalpha(c=m_Pattern[m_ParsePointer])){ + cclass+=c; + m_ParsePointer++; + } +char *classChars = NULL; + for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++){ + if(!cclass.CompareNoCase(cc[tmp].className)){ + classChars=cc[tmp].classChars; + break; + } + } + if(!classChars){ + m_Error || (m_Error=regeCType); + // ??? point to nuls? + return; + } + while(*classChars) + cset.Add(*(classChars++)); + // --- multis +} + +void CRegEx::ParseBracketEClass(CSet& cset) +{ + cset.Add(ParseBracketCollatingElement('='));; +} + +UCHAR CRegEx::ParseBracketCollatingElement(UCHAR term) +{ +static struct { + char *entityName; + char entity; +} cc[] = { {"NUL",'\0'},{"SOH",'\001'},{"STX",'\002'},{"ETX",'\003'},{"EOT",'\004'},{"ENQ",'\005'},{"ACK",'\006'},{"BEL",'\007'},{"alert",'\007'},{"BS",'\010'},{"backspace",'\b'},{"HT",'\011'},{"tab",'\t'},{"LF",'\012'},{"newline",'\n'},{"VT",'\013'},{"vertical-tab",'\v'},{"FF",'\014'},{"form-feed",'\f'},{"CR",'\015'},{"carriage-return",'\r'},{"SO",'\016'},{"SI",'\017'},{"DLE",'\020'},{"DC1",'\021'},{"DC2",'\022'},{"DC3",'\023'},{"DC4",'\024'},{"NAK",'\025'},{"SYN",'\026'},{"ETB",'\027'},{"CAN",'\030'},{"EM",'\031'},{"SUB",'\032'},{"ESC",'\033'},{"IS4",'\034'},{"FS",'\034'},{"IS3",'\035'},{"GS",'\035'},{"IS2",'\036'},{"RS",'\036'},{"IS1",'\037'},{"US",'\037'},{"space",' '},{"exclamation-mark",'!'},{"quotation-mark",'"'},{"number-sign",'#'},{"dollar-sign",'$'},{"percent-sign",'%'},{"ampersand",'&'},{"apostrophe",'\''},{"left-parenthesis",'('},{"right-parenthesis",')'},{"asterisk",'*'},{"plus-sign",'+'},{"comma",','},{"hyphen",'-'},{"hyphen-minus",'-'},{"period",'.'},{"full-stop",'.'},{"slash",'/'},{"solidus",'/'},{"zero",'0'},{"one",'1'},{"two",'2'},{"three",'3'},{"four",'4'},{"five",'5'},{"six",'6'},{"seven",'7'},{"eight",'8'},{"nine",'9'},{"colon",':'},{"semicolon",';'},{"less-than-sign",'<'},{"equals-sign",'='},{"greater-than-sign",'>'},{"question-mark",'?'},{"commercial-at",'@'},{"left-square-bracket",'['},{"backslash",'\\'},{"reverse-solidus",'\\'},{"right-square-bracket",']'},{"circumflex",'^'},{"circumflex-accent",'^'},{"underscore",'_'},{"low-line",'_'},{"grave-accent",'`'},{"left-brace",'{'},{"left-curly-bracket",'{'},{"vertical-line",'|'},{"right-brace",'}'},{"right-curly-bracket",'}'},{"tilde",'~'},{"DEL",'\177'} }; +CString seeTwo; + seeTwo=term; + seeTwo+=']'; +CString entityName; + while(m_ParsePointer=m_Pattern.GetLength()){ + m_Error || (m_Error=regeBracket); + // ??? point to nuls? + return 0; + } + for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++) + if(!entityName.CompareNoCase(cc[tmp].entityName)) + return cc[tmp].entity; + if(entityName.GetLength()==1) + return entityName[0]; + m_Error || (m_Error=regeCollate); + // ??? point to nuls? + return 0; +} + +UCHAR CRegEx::ParseBracketSymbol() +{ + if(m_ParsePointer>=m_Pattern.GetLength()){ + m_Error || (m_Error=regeBracket); + // ??? point to nuls? + } + if((m_ParsePointer+1)mustLength){ + mustStart=seqStart; + mustLength=seqLength; + } + seqLength=0; + break; + } + } // Hmm.. originally it's meant to be do while not opEnd.. + if(!mustLength) + return; + // Turn into string, but, wait, personally I'm sure it could be put in the main loop.. or maybe not.. + for(tmp=0;tmprv) + rv = nest; + nest--; + break; + } + } // Again, originally we were supposed to scan till opEnd.. + if(nest) + m_iFlags|=iflagsBad; // Could this be an ASSERTion? + return rv; +} + +void CRegEx::ParseLiteral() +{ + if(!m_Pattern.GetLength()){ + m_Error || (m_Error=regeEmpty); + // ??? point to nuls? + } + while(m_ParsePointer < m_Pattern.GetLength()) + EmitOrdinary(m_Pattern[m_ParsePointer++]); +} + +void CRegEx::ParseBRE(int stopa,int stopb) +{ +int start = m_Strip.GetSize(); +BOOL first=TRUE; +BOOL wasDollar=FALSE; + if(m_ParsePointer=m_Pattern.GetLength()){ + m_Error || (m_Error=regeEscape); + // ??? point to nuls + }else + c = 0x100|m_Pattern[m_ParsePointer++]; + } + switch(c){ + case '.': + if(m_Flags®NewLine) + EmitNonNewLineAny(); + else + m_Error || m_Strip.Add(CSop(CSop::opAny,0)); + break; + case '[': + ParseBracket(); + break; + case 0x100|'{': + m_Error || (m_Error=regeBadRepeat); + // ??? point to nuls? + break; + case 0x100|'(': + m_Subexps++; + subno=m_Subexps; + m_ParseParens.SetAtGrow(m_Subexps,CParenthesis(m_Strip.GetSize())); + m_Error || m_Strip.Add(CSop(CSop::opLeftParen,subno)); + if(m_ParsePointercount2){ + m_Error || (m_Error=regeBadBrace); + // ??? poin to nuls? + } + }else // Single number with comma + count2=256; + }else // Single number + count2=count; + EmitRepeat(pos,count,count2); + if((m_ParsePointer+1)>=m_Pattern.GetLength() || m_Pattern.Mid(m_ParsePointer,2).Compare("\\}")){ + while(m_ParsePointer=m_Pattern.GetLength()){ + m_Error || (m_Error=regeBrace); + // ??? point to nuls? + } + m_Error || (m_Error=regeBadBrace); + }else + m_ParsePointer+=2; + }else if(c=='$') + return TRUE; + return FALSE; +} + +CRegEx::CRegEx() +{ + m_bCompiled=FALSE; +} + +LPCTSTR CRegEx::MatchFast(LPCTSTR begin) +{ + MatchStatesClear(CSop::stCurrent); + m_Strip[1].m_MatchData|=CSop::stCurrent; +int stripLen = m_Strip.GetSize(); + MatchStep(1,stripLen-1,CSop::stCurrent,charNothing,CSop::stCurrent); + MatchStatesCopy(CSop::stFresh,CSop::stCurrent); +LPCTSTR coldp = NULL; +LPCTSTR p = begin; +int c = (begin==m_mBegin)?charOut:((int)(BYTE)m_mPointer[-1]); + for(;;){ + // next character.. + int lastc = c; + c = (p==m_mEnd)?charOut:(int)*(BYTE*)p; + if(MatchStatesEqual(CSop::stCurrent,CSop::stFresh)) + coldp=p; + // Is there an EOL and/or BOL between lastc and c? - they ask.. + int flagc=0; + int i = 0; + if((lastc=='\n' && m_Flags®NewLine) || (lastc==charOut && !(m_mFlags®NotBOL))){ + flagc=charBOL; + i=m_BOLs; + } + if((c=='\n' && m_Flags®NewLine) || (c==charOut && !(m_mFlags®NotEOL))){ + flagc=(flagc==charBOL)?charBOLEOL:charEOL; + i+=m_EOLs; + } + if(i){ + for(;i>0;i--) + MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent); + } + // What about a word boundary? - they wonder.. + if((flagc==charBOL || (lastc!=charOut && !isWordableChar(c))) && (c!=charOut && isWordableChar(c))) + flagc = charBOW; + if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c)))) + flagc = charEOW; + if(flagc==charBOW || flagc==charEOW){ + MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent); + } + // Are we done? Now WE wonder.. + if((m_Strip[stripLen-1].m_MatchData&CSop::stCurrent) || p==m_mEnd) + break; // They insist I need to note break out.. Okay, I do.. + // Nope, we're not done. We have to face this character.. + MatchStatesCopy(CSop::stTemp,CSop::stCurrent); + MatchStatesCopy(CSop::stCurrent,CSop::stFresh); + ASSERT(c!=charOut); + MatchStep(1,stripLen-1,CSop::stTemp,c,CSop::stCurrent); + p++; + } + ASSERT(coldp); + m_cOldP=coldp; // *** I believe this variable can be changed 'in-place' + if(m_Strip[stripLen-1].m_MatchData&CSop::stCurrent) + return &p[1]; + else + return NULL; +} + +void CRegEx::MatchStatesClear(BYTE mask) +{ +int stripLen = m_Strip.GetSize(); + for(int tmp=0;tmp0;i--) + MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent); + } + // Now we wonder about word boundaries.. + if((flagc==charBOL || (lastc!=charOut && !isWordableChar(lastc))) && (c!=charOut && isWordableChar(c))) + flagc=charBOW; + if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c)))) + flagc=charEOW; + if(flagc==charBOW || flagc==charEOW){ + MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent); + } + // Are we done we all wonder?? + if(m_Strip[to].m_MatchData&CSop::stCurrent) + mp=p; + if(MatchStatesEqual(CSop::stCurrent,CSop::stEmpty) || p==end) + break; // Again, we're obliged to note break out. We do. + // Sucks.. we have to face this character.. + MatchStatesCopy(CSop::stTemp,CSop::stCurrent); + MatchStatesCopy(CSop::stCurrent,CSop::stEmpty); + ASSERT(c!=charOut); + MatchStep(from,to,CSop::stTemp,c,CSop::stCurrent); + MatchStep(from,to,CSop::stCurrent,charNothing,CSop::stCurrent); + p++; + } + return mp; +} + +LPCTSTR CRegEx::MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to) +{ +LPCTSTR sp = begin, dp; +LPCTSTR stp, rest, tail, ssp, oldssp, sep; +int ssub, esub; +int es; +int i; + for(int ss=from;ss=sp); // It did work.. It should've.. + } + ssub=ss+1; + esub=es-1; + // Did innards match? + if(MatchSlow(sp,rest,ssub,esub)){ + dp = MatchDissect(sp,rest,ssub,esub); + ASSERT(dp==rest); + }else // nope.. + ASSERT(sp==rest); + sp = rest; + break; + case CSop::opPlus0: + stp=end; + for(;;){ + // How long could this one be?? + rest = MatchSlow(sp,stp,ss,es); + ASSERT(rest); // It did.. It should've.. + // Could the rest match the rest? + tail = MatchSlow(rest,end,es,to); + if(tail==end) + break; // yup. + // nope.. + stp=rest-1; + ASSERT(stp>=sp); // It should've worked, we believe.. + } + ssub=ss+1; + esub=es-1; + ssp=sp; + oldssp=ssp; + for(;;){ // Find last match of innards.. + sep = MatchSlow(ssp,rest,ssub,esub); + if((!sep) || sep==ssp) + break; // Failed or matched nothin' + oldssp=ssp; + ssp=sep; + } + if(!sep){ + // Last successfull.. + sep=ssp; + ssp=oldssp; + } + ASSERT(sep=rest); // Must exhaust substring they say.. + VERIFY(MatchSlow(ssp,sep,ssub,esub)==rest); // Assert or verify - that is the question.. + dp = MatchDissect(ssp,sep,ssub,esub); + ASSERT(dp==sep); + sp=rest; + break; + case CSop::opChoice0: + stp = end; + for(;;){ + // how long.. + rest = MatchSlow(sp,stp,ss,es); + ASSERT(rest); + // Could it.. + tail = MatchSlow(rest,end,es,to); + if(tail==end) + break; // y + // n + stp = rest-1; + ASSERT(stp>=sp); + } + ssub=ss+1; + esub=ss+m_Strip[ss].m_Operand-1; + ASSERT(m_Strip[esub].m_Operator==CSop::opOr0); + for(;;){ // Find first matching branch.. + if(MatchSlow(sp,rest,ssub,esub)==rest) + break; + // this one missed, try next.. + ASSERT(m_Strip[esub].m_Operator==CSop::opOr0); + esub++; + ASSERT(m_Strip[esub].m_Operator==CSop::opOr1); + ssub=esub+1; + esub+=m_Strip[esub].m_Operand; + if(m_Strip[esub].m_Operator==CSop::opOr1) + esub--; + else + ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1); + } + dp = MatchDissect(sp,rest,ssub,esub); + ASSERT(dp==rest); + sp=rest; + break; + case CSop::opPlus1: + case CSop::opQuest1: + case CSop::opOr0: + case CSop::opOr1: + case CSop::opChoice1: + ASSERT(FALSE); + break; + case CSop::opLeftParen: + i = m_Strip[ss].m_Operand; + ASSERT(0m_mBegin && !isWordableChar(*(sp-1)))) && (spm_mBegin && isWordableChar(*(sp-1))))) + return NULL; + break; + case CSop::opQuest1: + break; + case CSop::opOr0: // Matches null, but needs to skip + ss++; + s = m_Strip[ss]; + do{ + ASSERT(s.m_Operator==CSop::opOr1); + ss+=s.m_Operand; + }while((s=m_Strip[ss]).m_Operator!=CSop::opChoice1); + // Now we should note that ss++ gets us past the Choice1.. + break; + default: + // Have to make a choice.. + hard=TRUE; + break; + } + } + if(!hard){ // That was it.. + if(sp!=end) + return NULL; + return sp; + } + ss--; // Adjust for ther for's final increment.. + // Hard stuff.. is going on and on.. +CSop s = m_Strip[ss]; +int i, len, offsave; +int ssub,esub; +LPCTSTR ssp, dp; + switch(s.m_Operator){ + case CSop::opBackRef0: // The vilest depths they say.. If I only knew what the 'viles' stands for.. + i = s.m_Operand; + ASSERT(0=0); + len = m_Matches[i].GetLength(); + ASSERT((end-m_mBegin)>=len); + if(sp>end-len) + return NULL; // Not enough left to match.. + ssp = m_mBegin+m_Matches[i].m_Begin; + if(memcmp(sp,ssp,len)) + return NULL; + while(m_Strip[ss]!=CSop(CSop::opBackRef1,i)) + ss++; + return MatchBackRef(sp+len,end,ss+1,to,level-1); + break; + case CSop::opQuest0: // to null or not they wonder.. + dp = MatchBackRef(sp,end,ss+1,to,level); + if(dp) + return dp; // not.. + return MatchBackRef(sp,end,ss+s.m_Operand+1,to,level-1); + break; + case CSop::opPlus0: + ASSERT(m_mLastPos.GetSize()); + ASSERT(level+1 <= m_Pluses); + m_mLastPos[level+1]=sp; + return MatchBackRef(sp,end,ss+1,to,level+1); + break; + case CSop::opPlus1: + if(sp == m_mLastPos[level]) // Last pass matched null + return MatchBackRef(sp,end,ss+1,to,level-1); + // Try another pass.. + m_mLastPos[level]=sp; + dp = MatchBackRef(sp,end,ss-s.m_Operand+1,to,level); + if(dp) + return dp; + return MatchBackRef(sp,end,ss+1,to,level-1); + break; + case CSop::opChoice0: // find the right one, ifany + ssub = ss+1; + esub = ss+s.m_Operand-1; + ASSERT(m_Strip[esub].m_Operator==CSop::opOr0); + for(;;){ // Find first matching branch. + dp = MatchBackRef(sp,end,ssub,esub,level); + if(dp) + return dp; + // This one missed, try next one.. + if(m_Strip[esub].m_Operator==CSop::opChoice1) + return NULL; // There is none.. + esub++; + ASSERT(m_Strip[esub].m_Operator==CSop::opOr1); + ssub=esub+1; + esub+=m_Strip[esub].m_Operand; + if(m_Strip[esub].m_Operator==CSop::opOr1) + esub--; + else + ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1); + } + break; + case CSop::opLeftParen: // Must undo assignment if rest fails.. + i = s.m_Operand; + ASSERT(0= m_Matches.GetSize()) + return rv; + if(m_Matches[match].m_Begin<0 || m_Matches[match].m_End<0) + return rv; + ASSERT(m_Matches[match].m_Begin CMatchBox; + enum { + matchMatch = 0, + matchPreMatch = -1, + matchPostMatch = -2 + }; + CMatchBox m_Matches; + enum { + charOut = 256, + charBOL, charEOL, charBOLEOL, charNothing, charBOW, charEOW, + charMaxCode = charEOW, + charNNChars = (charMaxCode-255) + }; + int m_mFlags; + enum { + regeSuccess = 0, + regeNoMatch = 1, regeBadPattern, regeCollate, regeCType, regeEscape, regeSubReg, regeBracket, + regeParen, regeBrace, regeBadBrace, regeRange, regeSpace, regeBadRepeat, regeEmpty, regeAssert, + regeInvArg + }; + int m_Error; + CRegEx(); + BOOL m_bCompiled; + CString m_Pattern; + BOOL m_bBackRefs; + int m_Pluses; + CString m_Must; + BYTE m_Category[CHAR_MAX-CHAR_MIN+1]; + int m_Categories; + int m_EOLs; + int m_BOLs; + int m_iFlags; + int m_Subexps; + struct CSop { + void Dump(CDumpContext& dc); + CSop() {} + CSop(BYTE op,DWORD opnd=0) : m_Operator(op), m_Operand(opnd) {} + BOOL operator==(CSop& other) {return m_Operator==other.m_Operator && m_Operand==other.m_Operand;} + BOOL operator!=(CSop& other) { return !((*this)==other);} + enum { + opEnd = 1, opChar, opBOL, opEOL, opAny, opAnyOf, opBackRef0, opBackRef1, + opPlus0, opPlus1, opQuest0, opQuest1, opLeftParen, opRightParen, opChoice0, + opOr0, opOr1, opChoice1, opBOW, opEOW + }; + BYTE m_Operator; + DWORD m_Operand; + enum { + stCurrent = 1, stFresh = 2, stTemp = 4, stEmpty = 8 + }; + BYTE m_MatchData; + }; + typedef CArray CStrip; + CStrip m_Strip; + int m_Flags; + struct CSet { + CSet() : m_Hash(0) { memset(m_Set,0,sizeof(m_Set)); } + CSet(CSet& src) { (*this)=src; } + CSet& operator=(CSet& src) { memmove(this,&src,sizeof(*this)); return *this; } + BOOL operator==(CSet& other) { if(m_Hash!=other.m_Hash)return FALSE;return !memcmp(m_Set,other.m_Set,sizeof(m_Set)); } + enum { + size = (CHAR_MAX-CHAR_MIN+1) + }; + BOOL m_Set[size]; + BYTE m_Hash; + public: + UCHAR GetOnly(); + void Sub(UCHAR c); + BOOL IsIn(UCHAR c); + void Add(UCHAR c); + }; + typedef CArray CSets; + CSets m_Sets; + enum { + // Compile flags + regBasic = 0, regExtended = 1, + regIgnoreCase = 2, + regNoSubExpressions = 4, // Also works for matching. + regNewLine = 16, + regLiteral = 32, + // Match Flags + regNotBOL = 1, + regNotEOL = 2, + regOneMatch=64, + regBackRefs=128, + // iFlags + iflagsUseBOL=1, iflagsUseEOL=2, iflagsBad=4 + }; + CString Replace(LPCTSTR src,LPCTSTR rep,int flags=0); + BOOL Match(LPCTSTR src,int flags=0); + BOOL Compile(LPCTSTR regex,int flags=0); +private: +#ifdef _DEBUG + void DumpStrip(CDumpContext& dc); +#endif + LPCTSTR MatchBackRef(LPCTSTR begin,LPCTSTR end,int from,int to,int level); + typedef CArray CStrPtrArray; + CStrPtrArray m_mLastPos; + LPCTSTR MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to); + LPCTSTR MatchSlow(LPCTSTR begin,LPCTSTR end,int from,int to); + LPCTSTR m_cOldP; + BOOL MatchStatesEqual(BYTE m1,BYTE m2); + LPCTSTR m_mBegin; + void MatchStatesCopy(BYTE dst,BYTE src); + void MatchStep(int from,int to,BYTE maskBefore,int charCode,BYTE maskAfter); + void MatchStatesClear(BYTE mask); + LPCTSTR MatchFast(LPCTSTR begin); + LPCTSTR m_mEnd; + LPCTSTR m_mPointer; + BOOL ParseBREexp(BOOL ordinaryStar); + void ParseBRE(int stopa=0,int stopb=0); + void ParseLiteral(); + int CountPluses(); + void FigureMust(); + BOOL IsInSameSets(UCHAR c1,UCHAR c2); + BOOL IsInSets(UCHAR c); + void Categorize(); + int StripDuplicate(int from,int to); + void EmitRepeat(int pos,int from,int to); + UCHAR ParseBracketSymbol(); + UCHAR ParseBracketCollatingElement(UCHAR term); + void ParseBracketEClass(CSet& cset); + void ParseBracketCClass(CSet& cset); + void ParseBracketTerm(CSet& cset); + int StoreSet(CSet& cset); + void ParseBracket(); + int ParseCount(); + void EmitNonNewLineAny(); + void EmitOrdinary(UCHAR c); + void StripInsert(int pos,CSop& sop); + void ParseEREexp(); + void ParseERE(int stop=0); + struct CParenthesis { + long m_Begin; + long m_End; + CParenthesis(long b=0,long e=0) : m_Begin(b), m_End(e) {} + }; + typedef CArray CParens; + CParens m_ParseParens; + int m_ParsePointer; +}; +#ifdef _DEBUG +inline CDumpContext& operator<<(CDumpContext& dc, CRegEx::CSop& sop) { sop.Dump(dc); return dc; } +#endif + +#endif // __REGEX_H \ No newline at end of file diff --git a/shared-code/SNMPExtDll.h b/shared-code/SNMPExtDll.h new file mode 100644 index 0000000..14c920d --- a/dev/null +++ b/shared-code/SNMPExtDll.h @@ -0,0 +1,252 @@ +#ifndef __SNMPEXTDLL_H +#define __SNMPEXTDLL_H + +#include "snmpeer.h" + +#include + +namespace Klever { + +class CSNMPExtDLL : public CSNMPeer { +public: + HINSTANCE m_hInstance; + HANDLE m_hEvent; + AsnObjectIdentifier m_OID; + BOOL (SNMP_FUNC_TYPE *m_extInit)(DWORD dw,HANDLE h,AsnObjectIdentifier* aoid); + BOOL (SNMP_FUNC_TYPE *m_extQuery)(BYTE b,RFC1157VarBindList* rvbl,AsnInteger* ai1,AsnInteger* ai2); + BOOL (SNMP_FUNC_TYPE *m_extTrap)(AsnObjectIdentifier*,AsnNetworkAddress*,AsnInteger*,AsnInteger*,AsnTimeticks*,RFC1157VarBindList*); + + HINSTANCE m_hSNMPAPI; + void (SNMP_FUNC_TYPE *m_snmpOIDFree)(AsnObjectIdentifier*); + LPVOID (SNMP_FUNC_TYPE *m_snmpAlloc)(UINT); + void (SNMP_FUNC_TYPE *m_snmpFree)(LPVOID); + void (SNMP_FUNC_TYPE *m_snmpVBLFree)(RFC1157VarBindList* vbl); + void InitSNMP() { + m_hSNMPAPI = ::LoadLibraryEx("SNMPAPI",NULL,0); + if(!m_hSNMPAPI) + return; + *(FARPROC*)&m_snmpOIDFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilOidFree"); + *(FARPROC*)&m_snmpAlloc = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemAlloc"); + *(FARPROC*)&m_snmpFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemFree"); + *(FARPROC*)&m_snmpVBLFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilVarBindListFree"); + if( + (m_snmpFree && !m_snmpAlloc) || + (m_snmpAlloc && !m_snmpFree) + ) + DeinitSNMP(); + } + void DeinitSNMP() { + if(!m_hSNMPAPI) + return; + ::FreeLibrary(m_hSNMPAPI); + m_hSNMPAPI=NULL; + } + void SNMPFreeOID(AsnObjectIdentifier* oid) { + if(m_hSNMPAPI && m_snmpOIDFree) + (*m_snmpOIDFree)(oid); + else + ::GlobalFree((HGLOBAL)oid->ids); + } + LPVOID SNMPAlloc(UINT size) { + if(m_hSNMPAPI && m_snmpAlloc) + return (*m_snmpAlloc)(size); + else + return ::GlobalAlloc(GMEM_FIXED,size); + } + void SNMPFree(LPVOID addr) { + if(m_hSNMPAPI && m_snmpFree) + (*m_snmpFree)(addr); + else + :: GlobalFree((HGLOBAL)addr); + } + void SNMPFreeVBL(RFC1157VarBindList& vbl) { + if(m_hSNMPAPI && m_snmpVBLFree) + (*m_snmpVBLFree)(&vbl); + else{ + for(UINT tmp=0;tmpsizeof(i)) + return FALSE; + i.s_addr=0; + memmove(&i,ip.stream,ip.length); + ou.Set(i); + return TRUE; + } + + + CSNMPExtDLL(LPCTSTR dllName) : m_hInstance(NULL) { InitSNMP(); Init(dllName); } + ~CSNMPExtDLL() { Deinit(); DeinitSNMP(); } + + BOOL Init(LPCTSTR dllName) { + Deinit(); + m_hInstance = ::LoadLibraryEx(dllName,NULL,0); + if(!m_hInstance) + return FALSE; + *(FARPROC*)&m_extInit = ::GetProcAddress(m_hInstance,"SnmpExtensionInit"); + *(FARPROC*)&m_extQuery = ::GetProcAddress(m_hInstance,"SnmpExtensionQuery"); + *(FARPROC*)&m_extTrap = ::GetProcAddress(m_hInstance,"SnmpExtensionTrap"); + if(!(m_extInit && m_extQuery && m_extTrap)){ + Deinit(); + return FALSE; + } + if(!((*m_extInit)(GetCurrentTime(),&m_hEvent,&m_OID))){ + Deinit(); + return FALSE; + } + return TRUE; + } + void Deinit() { + if(!m_hInstance) + return; + ::FreeLibrary(m_hInstance); + } + virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) { + RFC1157VarBindList vbl; + SNMPBuildVBL(vbl,in); + AsnInteger errorStatus, errorIndex; + (*m_extQuery)(type,&vbl,&errorStatus,&errorIndex); + ou.RemoveAll(); + SNMPParseVBL(vbl,ou); + SNMPFreeVBL(vbl); + return TRUE; + } +}; + +}; + +#endif // __SNMPEXTDLL_H diff --git a/shared-code/SNMPOIDs.h b/shared-code/SNMPOIDs.h new file mode 100644 index 0000000..68ee659 --- a/dev/null +++ b/shared-code/SNMPOIDs.h @@ -0,0 +1,221 @@ +#ifndef __SNMPOIDS_H +#define __SNMPOIDS_H + +#define DEFINE_OID(name,oid) static UINT name[] = oid + +// MIB-II OIDs + +#define OIDccitt {0} +#define OIDnull {0,0} +#define OIDiso {1} +#define OIDorg {1,3} +#define OIDdod {1,3,6} +#define OIDinternet {1,3,6,1} +#define OIDdirectory {1,3,6,1,1} +#define OIDmgmt {1,3,6,1,2} +#define OIDmib_2 {1,3,6,1,2,1} +#define OIDsystem {1,3,6,1,2,1,1} +#define OIDsysDescr {1,3,6,1,2,1,1,1} +#define OIDsysObjectID {1,3,6,1,2,1,1,2} +#define OIDsysUpTime {1,3,6,1,2,1,1,3} +#define OIDsysContact {1,3,6,1,2,1,1,4} +#define OIDsysName {1,3,6,1,2,1,1,5} +#define OIDsysLocation {1,3,6,1,2,1,1,6} +#define OIDsysServices {1,3,6,1,2,1,1,7} +#define OIDtransmission {1,3,6,1,2,1,10} +#define OIDsnmp {1,3,6,1,2,1,11} +#define OIDsnmpInPkts {1,3,6,1,2,1,11,1} +#define OIDsnmpInBadValues {1,3,6,1,2,1,11,10} +#define OIDsnmpInReadOnlys {1,3,6,1,2,1,11,11} +#define OIDsnmpInGenErrs {1,3,6,1,2,1,11,12} +#define OIDsnmpInTotalReqVars {1,3,6,1,2,1,11,13} +#define OIDsnmpInTotalSetVars {1,3,6,1,2,1,11,14} +#define OIDsnmpInGetRequests {1,3,6,1,2,1,11,15} +#define OIDsnmpInGetNexts {1,3,6,1,2,1,11,16} +#define OIDsnmpInSetRequests {1,3,6,1,2,1,11,17} +#define OIDsnmpInGetResponses {1,3,6,1,2,1,11,18} +#define OIDsnmpInTraps {1,3,6,1,2,1,11,19} +#define OIDsnmpOutPkts {1,3,6,1,2,1,11,2} +#define OIDsnmpOutTooBigs {1,3,6,1,2,1,11,20} +#define OIDsnmpOutNoSuchNames {1,3,6,1,2,1,11,21} +#define OIDsnmpOutBadValues {1,3,6,1,2,1,11,22} +#define OIDsnmpOutGenErrs {1,3,6,1,2,1,11,24} +#define OIDsnmpOutGetRequests {1,3,6,1,2,1,11,25} +#define OIDsnmpOutGetNexts {1,3,6,1,2,1,11,26} +#define OIDsnmpOutSetRequests {1,3,6,1,2,1,11,27} +#define OIDsnmpOutGetResponses {1,3,6,1,2,1,11,28} +#define OIDsnmpOutTraps {1,3,6,1,2,1,11,29} +#define OIDsnmpInBadVersions {1,3,6,1,2,1,11,3} +#define OIDsnmpEnableAuthenTraps {1,3,6,1,2,1,11,30} +#define OIDsnmpInBadCommunityNames {1,3,6,1,2,1,11,4} +#define OIDsnmpInBadCommunityUses {1,3,6,1,2,1,11,5} +#define OIDsnmpInASNParseErrs {1,3,6,1,2,1,11,6} +#define OIDsnmpInTooBigs {1,3,6,1,2,1,11,8} +#define OIDsnmpInNoSuchNames {1,3,6,1,2,1,11,9} +#define OIDinterfaces {1,3,6,1,2,1,2} +#define OIDifNumber {1,3,6,1,2,1,2,1} +#define OIDifTable {1,3,6,1,2,1,2,2} +#define OIDifEntry {1,3,6,1,2,1,2,2,1} +#define OIDifIndex {1,3,6,1,2,1,2,2,1,1} +#define OIDifInOctets {1,3,6,1,2,1,2,2,1,10} +#define OIDifInUcastPkts {1,3,6,1,2,1,2,2,1,11} +#define OIDifInNUcastPkts {1,3,6,1,2,1,2,2,1,12} +#define OIDifInDiscards {1,3,6,1,2,1,2,2,1,13} +#define OIDifInErrors {1,3,6,1,2,1,2,2,1,14} +#define OIDifInUnknownProtos {1,3,6,1,2,1,2,2,1,15} +#define OIDifOutOctets {1,3,6,1,2,1,2,2,1,16} +#define OIDifOutUcastPkts {1,3,6,1,2,1,2,2,1,17} +#define OIDifOutNUcastPkts {1,3,6,1,2,1,2,2,1,18} +#define OIDifOutDiscards {1,3,6,1,2,1,2,2,1,19} +#define OIDifDescr {1,3,6,1,2,1,2,2,1,2} +#define OIDifOutErrors {1,3,6,1,2,1,2,2,1,20} +#define OIDifOutQLen {1,3,6,1,2,1,2,2,1,21} +#define OIDifSpecific {1,3,6,1,2,1,2,2,1,22} +#define OIDifType {1,3,6,1,2,1,2,2,1,3} +#define OIDifMtu {1,3,6,1,2,1,2,2,1,4} +#define OIDifSpeed {1,3,6,1,2,1,2,2,1,5} +#define OIDifPhysAddress {1,3,6,1,2,1,2,2,1,6} +#define OIDifAdminStatus {1,3,6,1,2,1,2,2,1,7} +#define OIDifOperStatus {1,3,6,1,2,1,2,2,1,8} +#define OIDifLastChange {1,3,6,1,2,1,2,2,1,9} +#define OIDat {1,3,6,1,2,1,3} +#define OIDatTable {1,3,6,1,2,1,3,1} +#define OIDatEntry {1,3,6,1,2,1,3,1,1} +#define OIDatIfIndex {1,3,6,1,2,1,3,1,1,1} +#define OIDatPhysAddress {1,3,6,1,2,1,3,1,1,2} +#define OIDatNetAddress {1,3,6,1,2,1,3,1,1,3} +#define OIDip {1,3,6,1,2,1,4} +#define OIDipForwarding {1,3,6,1,2,1,4,1} +#define OIDipOutRequests {1,3,6,1,2,1,4,10} +#define OIDipOutDiscards {1,3,6,1,2,1,4,11} +#define OIDipOutNoRoutes {1,3,6,1,2,1,4,12} +#define OIDipReasmTimeout {1,3,6,1,2,1,4,13} +#define OIDipReasmReqds {1,3,6,1,2,1,4,14} +#define OIDipReasmOKs {1,3,6,1,2,1,4,15} +#define OIDipReasmFails {1,3,6,1,2,1,4,16} +#define OIDipFragOKs {1,3,6,1,2,1,4,17} +#define OIDipFragFails {1,3,6,1,2,1,4,18} +#define OIDipFragCreates {1,3,6,1,2,1,4,19} +#define OIDipDefaultTTL {1,3,6,1,2,1,4,2} +#define OIDipAddrTable {1,3,6,1,2,1,4,20} +#define OIDipAddrEntry {1,3,6,1,2,1,4,20,1} +#define OIDipAdEntAddr {1,3,6,1,2,1,4,20,1,1} +#define OIDipAdEntIfIndex {1,3,6,1,2,1,4,20,1,2} +#define OIDipAdEntNetMask {1,3,6,1,2,1,4,20,1,3} +#define OIDipAdEntBcastAddr {1,3,6,1,2,1,4,20,1,4} +#define OIDipAdEntReasmMaxSize {1,3,6,1,2,1,4,20,1,5} +#define OIDipRouteTable {1,3,6,1,2,1,4,21} +#define OIDipRouteEntry {1,3,6,1,2,1,4,21,1} +#define OIDipRouteDest {1,3,6,1,2,1,4,21,1,1} +#define OIDipRouteAge {1,3,6,1,2,1,4,21,1,10} +#define OIDipRouteMask {1,3,6,1,2,1,4,21,1,11} +#define OIDipRouteMetric5 {1,3,6,1,2,1,4,21,1,12} +#define OIDipRouteInfo {1,3,6,1,2,1,4,21,1,13} +#define OIDipRouteIfIndex {1,3,6,1,2,1,4,21,1,2} +#define OIDipRouteMetric1 {1,3,6,1,2,1,4,21,1,3} +#define OIDipRouteMetric2 {1,3,6,1,2,1,4,21,1,4} +#define OIDipRouteMetric3 {1,3,6,1,2,1,4,21,1,5} +#define OIDipRouteMetric4 {1,3,6,1,2,1,4,21,1,6} +#define OIDipRouteNextHop {1,3,6,1,2,1,4,21,1,7} +#define OIDipRouteType {1,3,6,1,2,1,4,21,1,8} +#define OIDipRouteProto {1,3,6,1,2,1,4,21,1,9} +#define OIDipNetToMediaTable {1,3,6,1,2,1,4,22} +#define OIDipNetToMediaEntry {1,3,6,1,2,1,4,22,1} +#define OIDipNetToMediaIfIndex {1,3,6,1,2,1,4,22,1,1} +#define OIDipNetToMediaPhysAddress {1,3,6,1,2,1,4,22,1,2} +#define OIDipNetToMediaNetAddress {1,3,6,1,2,1,4,22,1,3} +#define OIDipNetToMediaType {1,3,6,1,2,1,4,22,1,4} +#define OIDipRoutingDiscards {1,3,6,1,2,1,4,23} +#define OIDipInReceives {1,3,6,1,2,1,4,3} +#define OIDipInHdrErrors {1,3,6,1,2,1,4,4} +#define OIDipInAddrErrors {1,3,6,1,2,1,4,5} +#define OIDipForwDatagrams {1,3,6,1,2,1,4,6} +#define OIDipInUnknownProtos {1,3,6,1,2,1,4,7} +#define OIDipInDiscards {1,3,6,1,2,1,4,8} +#define OIDipInDelivers {1,3,6,1,2,1,4,9} +#define OIDicmp {1,3,6,1,2,1,5} +#define OIDicmpInMsgs {1,3,6,1,2,1,5,1} +#define OIDicmpInTimestamps {1,3,6,1,2,1,5,10} +#define OIDicmpInTimestampReps {1,3,6,1,2,1,5,11} +#define OIDicmpInAddrMasks {1,3,6,1,2,1,5,12} +#define OIDicmpInAddrMaskReps {1,3,6,1,2,1,5,13} +#define OIDicmpOutMsgs {1,3,6,1,2,1,5,14} +#define OIDicmpOutErrors {1,3,6,1,2,1,5,15} +#define OIDicmpOutDestUnreachs {1,3,6,1,2,1,5,16} +#define OIDicmpOutTimeExcds {1,3,6,1,2,1,5,17} +#define OIDicmpOutParmProbs {1,3,6,1,2,1,5,18} +#define OIDicmpOutSrcQuenchs {1,3,6,1,2,1,5,19} +#define OIDicmpInErrors {1,3,6,1,2,1,5,2} +#define OIDicmpOutRedirects {1,3,6,1,2,1,5,20} +#define OIDicmpOutEchos {1,3,6,1,2,1,5,21} +#define OIDicmpOutEchoReps {1,3,6,1,2,1,5,22} +#define OIDicmpOutTimestamps {1,3,6,1,2,1,5,23} +#define OIDicmpOutTimestampReps {1,3,6,1,2,1,5,24} +#define OIDicmpOutAddrMasks {1,3,6,1,2,1,5,25} +#define OIDicmpOutAddrMaskReps {1,3,6,1,2,1,5,26} +#define OIDicmpInDestUnreachs {1,3,6,1,2,1,5,3} +#define OIDicmpInTimeExcds {1,3,6,1,2,1,5,4} +#define OIDicmpInParmProbs {1,3,6,1,2,1,5,5} +#define OIDicmpInSrcQuenchs {1,3,6,1,2,1,5,6} +#define OIDicmpInRedirects {1,3,6,1,2,1,5,7} +#define OIDicmpInEchos {1,3,6,1,2,1,5,8} +#define OIDicmpInEchoReps {1,3,6,1,2,1,5,9} +#define OIDtcp {1,3,6,1,2,1,6} +#define OIDtcpRtoAlgorithm {1,3,6,1,2,1,6,1} +#define OIDtcpInSegs {1,3,6,1,2,1,6,10} +#define OIDtcpOutSegs {1,3,6,1,2,1,6,11} +#define OIDtcpRetransSegs {1,3,6,1,2,1,6,12} +#define OIDtcpConnTable {1,3,6,1,2,1,6,13} +#define OIDtcpConnEntry {1,3,6,1,2,1,6,13,1} +#define OIDtcpConnState {1,3,6,1,2,1,6,13,1,1} +#define OIDtcpConnLocalAddress {1,3,6,1,2,1,6,13,1,2} +#define OIDtcpConnLocalPort {1,3,6,1,2,1,6,13,1,3} +#define OIDtcpConnRemAddress {1,3,6,1,2,1,6,13,1,4} +#define OIDtcpConnRemPort {1,3,6,1,2,1,6,13,1,5} +#define OIDtcpInErrs {1,3,6,1,2,1,6,14} +#define OIDtcpOutRsts {1,3,6,1,2,1,6,15} +#define OIDtcpRtoMin {1,3,6,1,2,1,6,2} +#define OIDtcpRtoMax {1,3,6,1,2,1,6,3} +#define OIDtcpMaxConn {1,3,6,1,2,1,6,4} +#define OIDtcpActiveOpens {1,3,6,1,2,1,6,5} +#define OIDtcpPassiveOpens {1,3,6,1,2,1,6,6} +#define OIDtcpAttemptFails {1,3,6,1,2,1,6,7} +#define OIDtcpEstabResets {1,3,6,1,2,1,6,8} +#define OIDtcpCurrEstab {1,3,6,1,2,1,6,9} +#define OIDudp {1,3,6,1,2,1,7} +#define OIDudpInDatagrams {1,3,6,1,2,1,7,1} +#define OIDudpNoPorts {1,3,6,1,2,1,7,2} +#define OIDudpInErrors {1,3,6,1,2,1,7,3} +#define OIDudpOutDatagrams {1,3,6,1,2,1,7,4} +#define OIDudpTable {1,3,6,1,2,1,7,5} +#define OIDudpEntry {1,3,6,1,2,1,7,5,1} +#define OIDudpLocalAddress {1,3,6,1,2,1,7,5,1,1} +#define OIDudpLocalPort {1,3,6,1,2,1,7,5,1,2} +#define OIDegp {1,3,6,1,2,1,8} +#define OIDegpInMsgs {1,3,6,1,2,1,8,1} +#define OIDegpInErrors {1,3,6,1,2,1,8,2} +#define OIDegpOutMsgs {1,3,6,1,2,1,8,3} +#define OIDegpOutErrors {1,3,6,1,2,1,8,4} +#define OIDegpNeighTable {1,3,6,1,2,1,8,5} +#define OIDegpNeighEntry {1,3,6,1,2,1,8,5,1} +#define OIDegpNeighState {1,3,6,1,2,1,8,5,1,1} +#define OIDegpNeighStateUps {1,3,6,1,2,1,8,5,1,10} +#define OIDegpNeighStateDowns {1,3,6,1,2,1,8,5,1,11} +#define OIDegpNeighIntervalHello {1,3,6,1,2,1,8,5,1,12} +#define OIDegpNeighIntervalPoll {1,3,6,1,2,1,8,5,1,13} +#define OIDegpNeighMode {1,3,6,1,2,1,8,5,1,14} +#define OIDegpNeighEventTrigger {1,3,6,1,2,1,8,5,1,15} +#define OIDegpNeighAddr {1,3,6,1,2,1,8,5,1,2} +#define OIDegpNeighAs {1,3,6,1,2,1,8,5,1,3} +#define OIDegpNeighInMsgs {1,3,6,1,2,1,8,5,1,4} +#define OIDegpNeighInErrs {1,3,6,1,2,1,8,5,1,5} +#define OIDegpNeighOutMsgs {1,3,6,1,2,1,8,5,1,6} +#define OIDegpNeighOutErrs {1,3,6,1,2,1,8,5,1,7} +#define OIDegpNeighInErrMsgs {1,3,6,1,2,1,8,5,1,8} +#define OIDegpNeighOutErrMsgs {1,3,6,1,2,1,8,5,1,9} +#define OIDegpAs {1,3,6,1,2,1,8,6} +#define OIDexperimental {1,3,6,1,3} +#define OIDprivate {1,3,6,1,4} +#define OIDenterprises {1,3,6,1,4,1} + +#endif // __SNMPOIDS_H \ No newline at end of file diff --git a/shared-code/SNMPeer.h b/shared-code/SNMPeer.h new file mode 100644 index 0000000..68f2efe --- a/dev/null +++ b/shared-code/SNMPeer.h @@ -0,0 +1,286 @@ +#ifndef __SNMPEER_H +#define __SNMPEER_H + +namespace Klever { + +class CASNAny { +public: + enum { + asnCls = 0xC0, + asnClsUniversal = 0x00, + asnClsApplication = 0x40, + asnClsContextSpecific = 0x80, + asnClsPrivate = 0xC0, + asnConstructed = 0x20, + asnPrimitive = 0x00, + asnTag = 0x1F, + // ASN.1 Primitive Tags + asnTagInteger = 0x02, + asnTagOctetString = 0x04, + asnTagNull = 0x05, + asnTagOID = 0x06, + // ASN.1 Constructed Tags + asnTagSequence = 0x10, + // RFC1155 Primitive Tags + asnTagIP = 0x00, + asnTagCounter = 0x01, + asnTagGauge = 0x02, + asnTagTicks = 0x03, + asnTagOpaque = 0x04, + // RFC1213 alias + asnTagDispString = 0x04, // (ASN.1 Octet string) + // RFC1157 Constructed Tags + asnTagGetRequest = 0x00, + asnTagGetNextRequest = 0x01, + asnTagGetResponse = 0x02, + asnTagSetRequest = 0x03, + asnTagTrap = 0x04 + }; + enum { + typeASNInteger = (asnClsUniversal|asnPrimitive|asnTagInteger), + typeASNOctetString = (asnClsUniversal|asnPrimitive|asnTagOctetString), + typeASNNull = (asnClsUniversal|asnPrimitive|asnTagNull), + typeASNOID = (asnClsUniversal|asnPrimitive|asnTagOID), + + typeASNSequence = (asnClsUniversal|asnConstructed|asnTagSequence), + typeASNSequenceOf = (asnClsUniversal|asnConstructed|asnTagSequence), + + typeASNIP = (asnClsApplication|asnPrimitive|asnTagIP), + typeASNCounter = (asnClsApplication|asnPrimitive|asnTagCounter), + typeASNGauge = (asnClsApplication|asnPrimitive|asnTagGauge), + typeASNTicks = (asnClsApplication|asnPrimitive|asnTagTicks), + typeASNOpaque = (asnClsApplication|asnPrimitive|asnTagOpaque), + typeASNDispString = (asnClsUniversal|asnPrimitive|asnTagOctetString), + + typeASNGetRequest = (asnClsContextSpecific|asnConstructed|asnTagGetRequest), + typeASNGetNextRequest = (asnClsContextSpecific|asnConstructed|asnTagGetNextRequest), + typeASNGetResponse = (asnClsContextSpecific|asnConstructed|asnTagGetResponse), + typeASNSetRequest = (asnClsContextSpecific|asnConstructed|asnTagSetRequest), + typeASNTrap = (asnClsContextSpecific|asnConstructed|asnTagTrap) + }; + + typedef LONG asnInteger; + typedef LARGE_INTEGER asnInteger64; + typedef DWORD asnCounter; + typedef ULARGE_INTEGER asnCounter64; + typedef DWORD asnGauge; + typedef ULARGE_INTEGER asnGauge64; + typedef DWORD asnTicks; + typedef ULARGE_INTEGER asnTicks64; + struct asnDynamic { + UINT size; + LPBYTE data; + BOOL Allocate(UINT size) { + BOOL rv = Free(); + if(size) + rv=rv&&(data=new BYTE[size]); + if(rv) + asnDynamic::size=size; + return rv; + } + BOOL Set(LPBYTE data,UINT size) { + BOOL rv = Allocate(size); + if(rv && size) + memmove(asnDynamic::data,data,size); + return rv; + } + BOOL Free() { + if(!size) + return TRUE; + delete data; + size=0; + data=0; + return TRUE; + } + void Clean() { + size=0; + data=0; + } + BOOL Copy(asnDynamic& src) { + BOOL rv = Free(); + if(rv){ + if(src.size) + rv=rv&&(data = new BYTE[src.size]); + if(rv){ + if(size=src.size) + memmove(data,src.data,size); + } + } + return rv; + } + }; + typedef asnDynamic asnOctetString; + typedef asnDynamic asnOID; + typedef in_addr asnIP; + typedef asnDynamic asnSequence; + + BYTE type; + enum _storeType { + storeDynamic, + storeStatic + } storeType; + union { + asnInteger number; + asnInteger64 number64; + asnOctetString string; + asnOID oid; + asnSequence sequence; + asnIP ip; + asnCounter counter; + asnCounter64 counter64; + asnGauge gauge; + asnGauge64 gauge64; + asnTicks ticks; + asnTicks64 ticks64; + asnDynamic data; + } value; + + CASNAny() : type(typeASNNull), storeType(storeStatic) { value.data.Clean(); } + CASNAny(CASNAny& src) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Copy(src); } + CASNAny(BYTE type) : type(type), storeType(storeStatic) { value.data.Clean(); } + CASNAny(BYTE type,LONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); } + CASNAny(BYTE type,LONGLONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); } + CASNAny(BYTE type,LPCTSTR string) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,string); } + CASNAny(BYTE type,LPBYTE data,UINT length) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,data,length); } + CASNAny(BYTE type,UINT* data,UINT size) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,(LPBYTE)data,size); } + CASNAny(in_addr& ip) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(ip); } + ~CASNAny() { Free(); } + + BOOL Set(BYTE type) { + BOOL rv = Free(); + CASNAny::type=type; + return rv; + } + BOOL Set(BYTE type,LONG number) { + BOOL rv = Free(); + CASNAny::type=type; + value.number=number; + storeType=storeStatic; + return rv; + } + BOOL Set(BYTE type,LONGLONG number) { + BOOL rv = Free(); + CASNAny::type=type; + value.number64.QuadPart = number; + storeType=storeStatic; + return rv; + } + BOOL Set(BYTE type,LPCTSTR string) { + BOOL rv = Free(); + CASNAny::type=type; + rv=rv&&value.string.Set((LPBYTE)string,strlen(string)+1); + if(rv){ + value.string.size--; + storeType=storeDynamic; + } + return rv; + } + BOOL Set(BYTE type,LPBYTE data,UINT length) { + BOOL rv = Free(); + CASNAny::type=type; + rv=rv&&value.data.Set(data,length); + if(rv) + storeType=storeDynamic; + return rv; + } + BOOL Set(in_addr& ip) { + BOOL rv = Free(); + memmove(&value.ip,&ip,sizeof(value.ip)); + type=typeASNIP; + storeType=storeStatic; + return rv; + } + BOOL Free() { + if(storeType==storeDynamic) + value.data.Free(); + else{ + memset(&value,0,sizeof(value)); + value.data.Clean(); + } + storeType=storeStatic; + type=typeASNNull; + return TRUE; + } + BOOL Copy(CASNAny& src) { + BOOL rv = Free(); + if(src.storeType==storeDynamic){ + rv=rv&&value.data.Copy(src.value.data); + if(rv){ + type=src.type; + storeType=src.storeType; + } + }else{ + memmove(this,&src,sizeof(*this)); + } + return rv; + } + CASNAny& operator=(CASNAny& src) { + VERIFY(Copy(src)); + return *this; + } + + // High Level + CString GetString() { + ASSERT(storeType==storeDynamic); + CString rv; + LPTSTR b = rv.GetBuffer(value.data.size+1); + ASSERT(b); + b[value.data.size]=0; + memmove(b,value.data.data,value.data.size); + rv.ReleaseBuffer(); + return rv; + } +}; + + +class CSNMPVarBind { +public: + CASNAny name; + CASNAny value; + + CSNMPVarBind() {} + CSNMPVarBind(CASNAny& name,CASNAny& value) : name(name), value(value) {} + CSNMPVarBind(CASNAny& name) : name(name) {} + CSNMPVarBind(CSNMPVarBind& src) { Copy(src); } + BOOL Copy(CSNMPVarBind& src) { + name.Copy(src.name); + value.Copy(src.value); + return TRUE; + } + CSNMPVarBind& operator=(CSNMPVarBind& src) { + Copy(src); + return *this; + } + // High level + BOOL IsName(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) { + if(name.type!=CASNAny::typeASNOID) + return FALSE; + if(name.value.oid.size { +public: + CSNMPVarBind* GetVarBind(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) { + POSITION p = GetHeadPosition(); + while(p){ + CSNMPVarBind& vb = GetNext(p); + if(vb.IsName(prefix,prefixSize,bExact)) + return &vb; + } + return NULL; + } +}; + +class CSNMPeer { +public: + virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) = 0; +}; + +}; + +#endif // __SNMPEER_H diff --git a/shared-code/install.h b/shared-code/install.h new file mode 100644 index 0000000..8c55ca9 --- a/dev/null +++ b/shared-code/install.h @@ -0,0 +1,370 @@ +#define WIN32_LEAN_AND_MEAN +#define VC_EXTRALEAN +#define WIN32_EXTRALEAN +#include +#include +#include +#include +#include +#include + +extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID); + +template class Smart { +public: + T *pT; + + Smart() : pT(NULL) {} + Smart(int cb) : pT(new T[cb]) {} + Smart(T* p) : pT(p) {} + ~Smart() { if(pT)delete pT; } + + Smart& operator=(T* p) { if(pT)delete pT; pT=p; return *this; } + operator T* () { return pT; } + +// T& operator[](int ndx) { return pT[ndx]; } + + T* Detach() { T* rv = pT; pT=NULL; return rv; } +}; +typedef Smart STRING; + +#define APPEND_SLASH(str) if((str)[strlen(str)-1]!='\\')strcat(str,"\\") + +HINSTANCE theInstance; + +LPSTR strFETCH_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR val) +{ +HKEY hkey; + if(RegOpenKeyEx(hRoot,subKey,0,KEY_QUERY_VALUE,&hkey)!=ERROR_SUCCESS) + return NULL; +DWORD kType,cb=0; +STRING rv; + if(RegQueryValueEx(hkey,val,NULL,&kType,NULL,&cb)==ERROR_SUCCESS && kType==REG_SZ){ + rv= new char[cb]; + _ASSERT(rv!=NULL); + if(RegQueryValueEx(hkey,val,NULL,&kType,(LPBYTE)(LPSTR)rv,&cb)!=ERROR_SUCCESS) + rv=NULL; + } + RegCloseKey(hkey); + return rv.Detach(); +} + +BOOL strSET_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR valName,LPCSTR val) +{ +HKEY hkey; +DWORD dw; + if(RegCreateKeyEx(hRoot,subKey,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&hkey,&dw)!=ERROR_SUCCESS) + return FALSE; +BOOL rv = (RegSetValueEx(hkey,valName,0,REG_SZ,(LPBYTE)val,strlen(val)+1)==ERROR_SUCCESS); + RegCloseKey(hkey); + return rv; +} + +void MAKE_PATH(LPCSTR path) +{ +STRING tmp(strlen(path)+1); +LPCSTR t0=path; +LPSTR t1=tmp; + while(*t0){ + if((*t0)=='\\'){ + *t1=0; + CreateDirectory(tmp,NULL); + } + *(t1++)=*(t0++); + } + *t1=0; + CreateDirectory(tmp,NULL); +} + +BOOL ADDMENU(LPCSTR menu,LPCSTR item,LPCSTR path,LPCSTR program) +{ +STRING stm = strFETCH_REG_KEY(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders","Programs"); + if(!stm) + return FALSE; +int pil = 1+strlen(path)+1+strlen(program)+1+1; +STRING pi(pil); + strcpy(pi,path); + APPEND_SLASH(pi); + strcat(pi,program); +int ipl = strlen(stm)+1+strlen(menu)+1+strlen(item)+4+1; +STRING ip(ipl); + memmove(ip,stm,strlen(stm)+1); + APPEND_SLASH(ip); + strcat(ip,menu); + MAKE_PATH(ip); + APPEND_SLASH(ip); + strcat(ip,item); + strcat(ip,".lnk"); +IShellLink* sl = NULL; +IPersistFile* pf = NULL; +BOOL rv = FALSE; + do{ + HRESULT hrv = CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(LPVOID*)&sl); + if(!SUCCEEDED(hrv)) + break; + sl->SetDescription(item); + sl->SetPath(pi); + hrv = sl->QueryInterface(IID_IPersistFile,(LPVOID*)&pf); + if(!SUCCEEDED(hrv)) + break; + WORD wsz[MAX_PATH]; + MultiByteToWideChar(CP_ACP,0,ip,-1,wsz,MAX_PATH); + hrv = pf->Save(wsz,TRUE); + if(SUCCEEDED(hrv)) + rv=TRUE; + }while(FALSE); + if(pf) + pf->Release(); + if(sl) + sl->Release(); + return rv; +} + +FILE* CREATE_INF_FILE(LPCSTR path,LPCSTR file) +{ +STRING fn(strlen(path)+1+strlen(file)+1); + strcpy(fn,path); + APPEND_SLASH(fn); + strcat(fn,file); + return fopen(fn,"wt"); +} + +BOOL INSTALLFILE(LPCSTR res,LPCSTR path,LPCSTR file) +{ +STRING temp(MAX_PATH); + if(!GetTempPath(MAX_PATH,temp)) return FALSE; +STRING tf(MAX_PATH); + if(!GetTempFileName(temp,"KGI",0,tf)) return FALSE; +HRSRC hrsrc = FindResource(NULL,res,MAKEINTRESOURCE(RT_RCDATA)); + if(!hrsrc) return FALSE; +DWORD sor = SizeofResource(NULL,hrsrc); + if(!sor) return FALSE; +HGLOBAL hglobal = LoadResource(NULL,hrsrc); + if(!hglobal) return FALSE; +LPVOID lpv = LockResource(hglobal); + if(!lpv) return FALSE; +HANDLE hf = CreateFile(tf,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL); + if(!hf) return FALSE; +DWORD written = 0; + if(!WriteFile(hf,lpv,sor,&written,NULL) || written!=sor){ + CloseHandle(hf); + return FALSE; + } + CloseHandle(hf); +STRING toKill(strlen(tf)+1); + strcpy(toKill,tf); + for(int tmp=strlen(tf)-1;tmp>0 && ((tf[tmp])!='\\');tmp--); + if(tf[tmp]=='\\') + tf[tmp++]=0; +STRING nothing(_MAX_PATH); +UINT nothingLength=_MAX_PATH; + if(VerInstallFile(0,&tf[tmp],(LPSTR)file,tf,(LPSTR)path,NULL,nothing,¬hingLength)){ + DeleteFile(toKill); + return FALSE; + } + DeleteFile(toKill); + return TRUE; +} + +LPCSTR pdTitle, pdPrompt; +char pdPath[_MAX_PATH]; +BOOL CALLBACK pathDlgProc(HWND hwnd,UINT uMsg,WPARAM wP,LPARAM lP) +{ + switch(uMsg){ + case WM_INITDIALOG: + SetWindowText(hwnd,pdTitle); + SetDlgItemText(hwnd,IDC_PROMPT,pdPrompt); + SetDlgItemText(hwnd,IDC_PATH,pdPath); + SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); + return 1; + case WM_COMMAND: + switch(LOWORD(wP)){ // ID + case IDC_BROWSE: + switch(HIWORD(wP)){ + case BN_CLICKED: + { + BROWSEINFO bi; + memset(&bi,0,sizeof(bi)); + bi.hwndOwner=hwnd; + bi.pszDisplayName=pdPath; + bi.lpszTitle="Select Folder.."; + bi.ulFlags=BIF_RETURNONLYFSDIRS; + LPITEMIDLIST lpidl=SHBrowseForFolder(&bi); + if(lpidl){ + SHGetPathFromIDList(lpidl,pdPath); + SHFree(lpidl); + SetDlgItemText(hwnd,IDC_PATH,pdPath); + } + } + return 1; + } + break; + case IDOK: + switch(HIWORD(wP)){ + case BN_CLICKED: + if(GetDlgItemText(hwnd,IDC_PATH,pdPath,sizeof(pdPath))) + EndDialog(hwnd,IDOK); + else + // *** Error message + EndDialog(hwnd,IDCANCEL); + return 1; + } + break; + case IDCANCEL: + switch(HIWORD(wP)){ + case BN_CLICKED: + EndDialog(hwnd,IDCANCEL); + return 1; + } + break; + }; + break; + } + return 0; +} + +LPSTR REQUESTPATH(LPCSTR title,LPCSTR prompt,LPCSTR defPath) +{ + pdTitle=title;pdPrompt=prompt; + strcpy(pdPath,defPath); + if(DialogBox(NULL,MAKEINTRESOURCE(IDD_PATH),NULL/*Parent*/,(DLGPROC)&pathDlgProc)!=IDOK) + return NULL; +STRING rv(strlen(pdPath)+1); + strcpy(rv,pdPath); + return rv.Detach(); +} + +HKEY uninstallKey(LPCSTR regKey) { + STRING rk(100+strlen(regKey)+1); + sprintf(rk,"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s",regKey); + HKEY rv = NULL; + DWORD dw; + if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,rk,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&rv,&dw)!=ERROR_SUCCESS) + return NULL; + return rv; +} + +BOOL REG_UNINSTALL_COMMAND(LPCSTR regKey,LPCSTR dName,LPCSTR iPath,LPCSTR iFile,LPCSTR iSection) +{ + HKEY hKey = uninstallKey(regKey); + if(!hKey) + return FALSE; + BOOL rv=FALSE; + do{ + if(RegSetValueEx(hKey,"DisplayName",0,REG_SZ,(LPBYTE)dName,strlen(dName)+1)!=ERROR_SUCCESS) + break; + STRING us(50+strlen(iPath)+1+strlen(iFile)+strlen(iSection)+1); + strcpy(us,"RunDll32 setupapi.dll,InstallHinfSection "); + strcat(us,iSection); + strcat(us," 132 "); + strcat(us,iPath); + APPEND_SLASH(us); + strcat(us,iFile); + if(RegSetValueEx(hKey,"UninstallString",0,REG_SZ,(LPBYTE)(LPCSTR)us,strlen(us)+1)!=ERROR_SUCCESS) + break; + rv=TRUE; + }while(FALSE); + RegCloseKey(hKey); + return rv; +} +BOOL REG_UNINSTALL_ICON(LPCSTR regKey,LPCSTR path,LPCSTR file,int n) { + HKEY hKey = uninstallKey(regKey); + if(!hKey) + return FALSE; + STRING uis(strlen(path)+1+strlen(file)+7); + strcpy(uis,path); + APPEND_SLASH(uis); + strcat(uis,file); + char tmp[8]; + sprintf(tmp,";%d",n); + strcat(uis,tmp); + BOOL rv = TRUE; + if(RegSetValueEx(hKey,"DisplayIcon",0,REG_SZ,(LPBYTE)(LPCSTR)uis,strlen(uis)+1)!=ERROR_SUCCESS) + rv = FALSE; + RegCloseKey(hKey); + return rv; +} +BOOL REG_UNINSTALL_COMMENT(LPCSTR regKey,LPCSTR comment) { + HKEY hKey = uninstallKey(regKey); + if(!hKey) + return FALSE; + BOOL rv = TRUE; + if(RegSetValueEx(hKey,"lComment",0,REG_SZ,(LPBYTE)comment,strlen(comment)+1)!=ERROR_SUCCESS) + rv = FALSE; + RegCloseKey(hKey); + return rv; +} +BOOL REG_UNINSTALL_VERSION(LPCSTR regKey,LPCSTR version) { + HKEY hKey = uninstallKey(regKey); + if(!hKey) + return FALSE; + BOOL rv = TRUE; + if(RegSetValueEx(hKey,"DisplayVersion",0,REG_SZ,(LPBYTE)version,strlen(version)+1)!=ERROR_SUCCESS) + rv = FALSE; + RegCloseKey(hKey); + return rv; +} +BOOL REG_UNINSTALL_LOCATION(LPCSTR regKey,LPCSTR location) { + HKEY hKey = uninstallKey(regKey); + if(!hKey) + return FALSE; + BOOL rv = TRUE; + if(RegSetValueEx(hKey,"InstallLocation",0,REG_SZ,(LPBYTE)location,strlen(location)+1)!=ERROR_SUCCESS) + rv = FALSE; + RegCloseKey(hKey); + return rv; +} +BOOL REG_UNINSTALL_PUBLISHER(LPCSTR regKey,LPCSTR publisher) { + HKEY hKey = uninstallKey(regKey); + if(!hKey) + return FALSE; + BOOL rv = TRUE; + if(RegSetValueEx(hKey,"Publisher",0,REG_SZ,(LPBYTE)publisher,strlen(publisher)+1)!=ERROR_SUCCESS) + rv = FALSE; + RegCloseKey(hKey); + return rv; +} +BOOL REG_UNINSTALL_URLS(LPCSTR regKey,LPCSTR about,LPCSTR update) { + HKEY hKey = uninstallKey(regKey); + if(!hKey) + return FALSE; + BOOL rv = TRUE; + if(RegSetValueEx(hKey,"URLInfoAbout",0,REG_SZ,(LPBYTE)about,strlen(about)+1)!=ERROR_SUCCESS) + rv = FALSE; + if(RegSetValueEx(hKey,"URLUpdateInfo",0,REG_SZ,(LPBYTE)update,strlen(update)+1)!=ERROR_SUCCESS) + rv = FALSE; + RegCloseKey(hKey); + return rv; +} + +#define INF_FILE_HEADER(i) fprintf(i,"[Version]\nSignature=\"$CHICAGO$\"\n\n") +#define INF_FILE_SECTION(i,s) fprintf(i,"\n[%s]\n",s) +#define INF_UNINSTALL_REG(i,p) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s\nHKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s,DisplayName\nHKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s,UninstallString\n",p,p,p) +#define INF_MENU_GROUP(i,n,m) fprintf(i,"setup.ini, progman.groups,,\"group%d=%s\"\n",n,m) +#define INF_MENU_ITEM(i,n,m) fprintf(i,"setup.ini, group%d,, \"\"\"%s\"\"\"\n",n,m); +#define INF_REMOVE_ROOT(i,g,r) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,,,\"%s\"\n",g,r) +#define INF_REMOVE_FILE(i,g,f) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,%s,,\"%s\"\n",g,f,f) +#define INF_REMOVE_HELP_FILE(i,g,f) {INF_REMOVE_FILE(i,g,f".hlp");INF_REMOVE_FILE(i,g,f".cnt");INF_REMOVE_FILE(i,g,f".GID");INF_REMOVE_FILE(i,g,f".FTS");} + +LPSTR GET_SHORT_PATH(LPCSTR path) +{ +char tmp; +DWORD len = GetShortPathName(path,&tmp,1); + if(!len) + return NULL; +STRING rv(len+1); + if(!GetShortPathName(path,rv,len+1)) + return NULL; + return rv.Detach(); +} + +BOOL Install(void); + +int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE,LPSTR,int) +{ + theInstance=hInstance; + CoInitialize(NULL); + Install(); + CoUninitialize(); + return 0; +} diff --git a/shared-code/ip_icmp.h b/shared-code/ip_icmp.h new file mode 100644 index 0000000..acaf7e9 --- a/dev/null +++ b/shared-code/ip_icmp.h @@ -0,0 +1,91 @@ +#ifndef IP_ICMPHEADER + +#define IP_ICMPHEADER + +struct icmp { + BYTE icmp_type; + BYTE icmp_code; + WORD icmp_cksum; + WORD icmp_id; + WORD icmp_seq; + char icmp_data[1]; +}; + +#define SIZE_ICMP_HDR 8 +#define SIZE_TIME_DATA 8 + +struct ip { + BYTE ip_hl:4, /* header length */ + ip_v:4; /* version */ + BYTE ip_tos; /* type of service */ + short ip_len; /* total length */ + u_short ip_id; /* identification */ + short ip_off; /* fragment offset field */ + BYTE ip_ttl; /* time to live */ + BYTE ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define ICMP_ECHOREPLY 0 /* echo reply */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_REDIRECT 5 /* shorter route, codes: */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ +#define ICMP_ECHO 8 /* echo service */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +#define ICMP_MAXTYPE 18 + +#define ICMP_MINLEN 8 /* abs minimum */ +#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ +#define ICMP_MASKLEN 12 /* address mask */ +#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ +#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) + +#define STNORM 0 + +/* Definition of the lowest telnet byte following an IAC byte */ +#define LOW_TEL_OPT 236 + +#define TEL_EOF 236 +#define SUSP 237 +#define ABORT 238 + +#define SE 240 +#define NOP 241 +#define DM 242 +#define BREAK 243 +#define IP 244 +#define AO 245 +#define AYT 246 +#define EC 247 +#define EL 248 +#define GOAHEAD 249 +#define SB 250 +#define WILL 251 +#define WONT 252 +#define DO 253 +#define DONT 254 +#define IAC 255 + +#endif + diff --git a/shared-code/kHelpers.h b/shared-code/kHelpers.h new file mode 100644 index 0000000..209c6b0 --- a/dev/null +++ b/shared-code/kHelpers.h @@ -0,0 +1,159 @@ +#ifndef __KHELPERS_H +#define __KHELPERS_H + +#include + +extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID); + +namespace Klever { + + inline BOOL BrowseForFolder(CString& folder,LPCTSTR title=NULL,CWnd* pParent=NULL) { + BROWSEINFO bi; + memset(&bi,0,sizeof(bi)); + if(pParent) + bi.hwndOwner=pParent->GetSafeHwnd(); + CString rv; + bi.pszDisplayName=rv.GetBuffer(MAX_PATH); + bi.lpszTitle=title; + bi.ulFlags=BIF_RETURNONLYFSDIRS; + LPITEMIDLIST lpidl = SHBrowseForFolder(&bi); + if(lpidl){ + SHGetPathFromIDList(lpidl,bi.pszDisplayName); + SHFree(lpidl); + rv.ReleaseBuffer(); + folder=rv; + return TRUE; + } + rv.ReleaseBuffer(); + return FALSE; + } + inline BOOL BrowseForFolder(CString& folder,UINT idTitle,CWnd* pParent=NULL) { + CString title; + VERIFY(title.LoadString(idTitle)); + return BrowseForFolder(folder,title,pParent); + } + inline CString GluePathAndFile(LPCTSTR path,LPCTSTR file) { + CString rv = path; + while((!rv.IsEmpty()) && rv[rv.GetLength()-1]=='\\') + rv=rv.Left(rv.GetLength()-1); + rv+='\\'; + while(*file && *file=='\\') + file++; + rv+=file; + return rv; + } + inline UINT TokenizeString(CStringList& rv,LPCTSTR string,LPCTSTR delimiter) { + CString s = string; + int found; + int delength = strlen(delimiter); + int rvc = 0; + while((found=s.Find(delimiter))>=0){ + rv.AddTail(s.Left(found)); + rvc++; + s=s.Mid(found+delength); + } + if(!s.IsEmpty()){ + rv.AddTail(s); + rvc++; + } + return rvc; + } + inline BOOL LogRecord(LPCTSTR logFile,LPCTSTR logRecord) { + try{ + CFile f(logFile,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite|CFile::shareDenyWrite); + f.SeekToEnd(); + CString s = CTime::GetCurrentTime().Format("[%c] ")+logRecord+"\r\n"; + f.Write((LPCTSTR)s,s.GetLength()); + }catch(CException* e){ + e->Delete(); + return FALSE; + } + return TRUE; + } + inline BOOL ReadString(CFile* file,CString& rv) { + rv.Empty(); + int nBuffer = 256; + TCHAR* ch = rv.GetBuffer(nBuffer); + int nPos = 0; + BOOL bRV = FALSE; + for(;;){ + TCHAR c; + try{ + if(file->Read(&c,sizeof(c))!=sizeof(c)) + break; + bRV=TRUE; + }catch(CException* e){ + e->Delete(); + TRACE0("Exception in ReadString\n"); + return FALSE; + } + if(nPos>=(nBuffer-1)){ + rv.ReleaseBuffer(); + ch = rv.GetBuffer(nBuffer=nBuffer+256); + ASSERT(ch); + } + if(c=='\n') + break; + ch[nPos++]=c; + } + ch[nPos]=0; + for(;;){ + nPos--; + if(nPos<0) + break; + if(ch[nPos]!='\r') + break; + ch[nPos]=0; + } + rv.ReleaseBuffer(); + rv.FreeExtra(); + return bRV; + } + + inline int LoadStringList(CStringList& list,LPCTSTR section) { + CString n; + list.RemoveAll(); + CWinApp* app = AfxGetApp(); + ASSERT(app); + for(int tmp=0;;tmp++){ + n.Format("%d",tmp); + CString str = app->GetProfileString(section,n,NULL); + if(str.IsEmpty()) + break; + list.AddTail(str); + } + return tmp; + } + inline int SaveStringList(CStringList& list,LPCTSTR section) { + CString n; + CWinApp* app = AfxGetApp(); + ASSERT(app); + POSITION p = list.GetHeadPosition(); + for(int tmp=0;p;tmp++){ + n.Format("%d",tmp); + app->WriteProfileString(section,n,list.GetNext(p)); + } + n.Format("%d",tmp); + app->WriteProfileString(section,n,NULL); + return tmp; + } + + inline BOOL WriteProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR str) { + CWinApp* app = AfxGetApp(); + return app->WriteProfileBinary(section,entry,(LPBYTE)str,strlen(str)+1); + } + inline CString GetProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR defval) { + CWinApp* app = AfxGetApp(); + LPBYTE pData; + UINT nCount; + CString rv = defval; + if(app->GetProfileBinary(section,entry,&pData,&nCount)){ + rv = (LPCTSTR)pData; + delete pData; + } + return rv; + } + +}; + +#endif // __KHELPERS_H diff --git a/shared-code/kICMP.cpp b/shared-code/kICMP.cpp new file mode 100644 index 0000000..09a8f94 --- a/dev/null +++ b/shared-code/kICMP.cpp @@ -0,0 +1,300 @@ +#include "../stdafx.h" +#include "kICMP.h" + +CICMP::_mechanismus CICMP::m_mechanismus = CICMP::_icmpUndetermined; + +BOOL CICMPDll::Initialize() +{ + if(m_hICMP!=INVALID_HANDLE_VALUE || m_hICMPDLL) + Deinitialize(); + m_hICMPDLL = ::LoadLibraryEx("ICMP",NULL,0); + if(!m_hICMPDLL) + return FALSE; + *(FARPROC*)&m_icmpCF = ::GetProcAddress(m_hICMPDLL,"IcmpCreateFile"); + *(FARPROC*)&m_icmpSE = ::GetProcAddress(m_hICMPDLL,"IcmpSendEcho"); + *(FARPROC*)&m_icmpCH = ::GetProcAddress(m_hICMPDLL,"IcmpCloseHandle"); + if(!(m_icmpCF && m_icmpSE && m_icmpCH)){ + Deinitialize(); return FALSE; + } + m_hICMP = (*m_icmpCF)(); + if(m_hICMP==INVALID_HANDLE_VALUE){ + Deinitialize(); return FALSE; + } + TRACE0("ICMP-DLL Initialized\n"); + return TRUE; +} +void CICMPDll::Deinitialize() +{ + if(m_hICMPDLL){ + if(m_hICMP!=INVALID_HANDLE_VALUE && m_icmpCH) + (*m_icmpCH)(m_hICMP); + ::FreeLibrary(m_hICMPDLL); m_hICMPDLL = NULL; + m_icmpCF = NULL; + m_icmpSE = NULL; + m_icmpCH = NULL; + } + m_hICMP=INVALID_HANDLE_VALUE; + if(m_sizeOut && m_bsOut){ + delete m_bsOut; + m_bsOut = NULL; m_sizeOut = 0; + } + if(m_sizeIn && m_bsIn){ + delete m_bsIn; + m_bsIn = NULL; m_sizeIn = 0; + } +} + +LONG CICMPDll::Ping(const in_addr host,const UINT packetSize, + const UINT timeOut,LPINT pStatus) +{ + if(!(m_hICMP && m_hICMPDLL && m_icmpSE)){ + if(pStatus) + (*pStatus) = icmpNotInitialized; + return -1; + } + VERIFY(AdjustBuffers(packetSize)); +IPINFO ipi; + memset(&ipi,0,sizeof(ipi)); + ipi.Ttl = 30; + for(UINT tmp=0;tmpStatus = 0xFFFFFFFFl; + if((*m_icmpSE)(m_hICMP,host.s_addr,m_bsOut,packetSize, + &ipi,pRep,m_sizeIn,timeOut)) + TRACE0("ICMP-SendEcho succeeded\n"); + else + TRACE0("ICMP-SendEcho failed\n"); +LONG lrv = -1; +INT rv = ipUnknown; + switch(pRep->Status){ + case IP_SUCCESS: + lrv = pRep->RTTime; rv = ipSuccess; + break; + case IP_BUF_TOO_SMALL: rv = ipBuffTooSmall; break; + case IP_DEST_NET_UNREACHABLE: rv = ipDestNetUnreachable; break; + case IP_DEST_HOST_UNREACHABLE: rv = ipDestHostUnreachable; break; + case IP_DEST_PROT_UNREACHABLE: rv = ipDestProtUnreachable; break; + case IP_DEST_PORT_UNREACHABLE: rv = ipDestPortUnreachable; break; + case IP_NO_RESOURCES: rv = ipNoResources; break; + case IP_BAD_OPTION: rv = ipBadOption; break; + case IP_HW_ERROR: rv = ipHWError; break; + case IP_PACKET_TOO_BIG: rv = ipPacketTooBig; break; + case IP_REQ_TIMED_OUT: rv = ipTimeOut; break; + case IP_BAD_REQ: rv = ipBadRequest; break; + case IP_BAD_ROUTE: rv = ipBadRoute; break; + case IP_TTL_EXPIRED_TRANSIT: rv = ipTTLExpiredInTransit; break; + case IP_TTL_EXPIRED_REASSEM: rv = ipTTLExpiredInReasm; break; + case IP_PARAM_PROBLEM: rv = ipParamProblem; break; + case IP_SOURCE_QUENCH: rv = ipSourceQuench; break; + case IP_OPTION_TOO_BIG: rv = ipOptionTooBig; break; + case IP_BAD_DESTINATION: rv = ipBadDest; break; + } + if(pStatus) + (*pStatus)=rv; + return lrv; +} + +BOOL CICMPDll::AdjustBuffers(UINT packetSize) +{ + if(!packetSize) + packetSize=1; + if(packetSize>m_sizeOut){ + if(m_sizeOut && m_bsOut) + delete m_bsOut; + m_bsOut = new BYTE[m_sizeOut=packetSize]; + if(!m_bsOut) + return FALSE; + } +UINT sin = sizeof(ICMPECHO)+SIZE_ICMP_HDR+packetSize; + if(sin>m_sizeIn){ + if(m_sizeIn && m_bsIn) + delete m_bsIn; + m_bsIn = new BYTE[m_sizeIn=sin]; + if(!m_bsIn) + return FALSE; + } + return TRUE; +} + + +WORD CICMPWS::m_icmpSeq = 0; + +BOOL CICMPWS::Initialize() +{ + if(m_socket!=INVALID_SOCKET) + Deinitialize(); + m_socket = socket(AF_INET,SOCK_RAW,1/*ICMP*/); + if(m_socket==INVALID_SOCKET) + return FALSE; + TRACE0("ICMP-WS Initialized\n"); + return TRUE; +} +void CICMPWS::Deinitialize() +{ + if(m_socket!=INVALID_SOCKET){ + closesocket(m_socket); + m_socket=INVALID_SOCKET; + } + if(m_sizeOut && m_bsOut){ + delete m_bsOut; + m_bsOut = NULL; m_sizeOut = 0; + } + if(m_sizeIn && m_bsIn){ + delete m_bsIn; + m_bsIn = NULL; m_sizeIn = 0; + } +} +LONG CICMPWS::Ping(const in_addr host,const UINT packetSize, + const UINT timeOut,LPINT pStatus) +{ + if(m_socket==INVALID_SOCKET){ + if(pStatus) + (*pStatus)=icmpNotInitialized; + } + VERIFY(AdjustBuffers(packetSize)); +icmp* pPacket = (icmp*)m_bsOut; + memset(pPacket,0,m_sizeOut); + pPacket->icmp_type = ICMP_ECHO; + pPacket->icmp_seq = m_icmpSeq++; + pPacket->icmp_id = (WORD)(::GetCurrentThreadId()&0xFFFF); + for(UINT tmp=0;tmpicmp_data[tmp]=tmp&0xFF; + pPacket->icmp_cksum = cksum(pPacket,SIZE_ICMP_HDR+packetSize); +sockaddr_in to; + memset(&to,0,sizeof(to)); + to.sin_addr.s_addr = host.s_addr; + to.sin_family = AF_INET; + if(sendto(m_socket,(char*)pPacket,SIZE_ICMP_HDR+packetSize,0, + (SOCKADDR*)&to,sizeof(to)) != (int)(SIZE_ICMP_HDR+packetSize)){ + TRACE1("sendto: %lu\n",WSAGetLastError()); + if(pStatus) + (*pStatus)=icmpSocketError; + return -1; + } +DWORD sentTime = ::GetTickCount(); +sockaddr_in from; + memset(&from,0,sizeof(from)); + from.sin_family=AF_INET; + from.sin_addr.s_addr=INADDR_ANY; +fd_set fds; + FD_ZERO(&fds); + FD_SET(m_socket,&fds); +long lrv = -1; +INT rv = ipTimeOut; + for(;;){ + DWORD ct = ::GetTickCount(); + if((ct-sentTime)>=timeOut){ + TRACE0("Timeout\n"); + break; + } + timeval tv = { + (timeOut-ct+sentTime)/1000, + (timeOut-ct+sentTime)%1000 + }; // tv_sec, tv_usec (secs,microsecs) + if(!select(m_socket,&fds,NULL,NULL,&tv)){ + TRACE1("select: %d\n",WSAGetLastError()); + break; + } + DWORD rtime = ::GetTickCount(); + ASSERT(FD_ISSET(m_socket,&fds)); + int fl = sizeof(from); + int rb = recvfrom(m_socket,(char*)m_bsIn,m_sizeIn,0,(SOCKADDR*)&from,&fl); + ip* pIP = (ip*)m_bsIn; + icmp* pICMP = (icmp*)&m_bsIn[sizeof(ip)]; + if(pICMP->icmp_id!=pPacket->icmp_id) + continue; + if(pICMP->icmp_seq!=pPacket->icmp_seq) + continue; + if(from.sin_addr.s_addr!=host.s_addr) + continue; + if(pICMP->icmp_type==ICMP_ECHOREPLY){ + lrv=rtime-sentTime; + rv=ipSuccess; + break; + } + rv = ipUnknown; // *** + break; + } + if(pStatus) + (*pStatus)=rv; + return lrv; +} + +BOOL CICMPWS::AdjustBuffers(UINT packetSize) +{ + if(!packetSize) + packetSize=0; +UINT osize = packetSize+SIZE_ICMP_HDR; + if(m_sizeOut0){ + if(count>1){ + lSum+=*(pData++); + count-=2; + }else{ + lSum+=((WORD)*(BYTE*)pData)&0xFF; + count--; + } + } + lSum = (lSum&0xFFFF)+(lSum>>16); + lSum += (lSum>>16); + return (~lSum)&0xFFFF; +} + +CICMP* CICMP::CreateICMP() +{ + if(m_mechanismus==_icmpUndetermined) + GuessMechanismus(); + switch(m_mechanismus){ + case _icmpWinsock: + return new CICMPWS; + break; + case _icmpDLL: + return new CICMPDll; + break; + } + return NULL; +} + +void CICMP::GuessMechanismus() +{ + m_mechanismus=_icmpUndetermined; +SOCKET testSocket = socket(AF_INET,SOCK_RAW,1); + if(testSocket!=INVALID_SOCKET){ + closesocket(testSocket); + m_mechanismus=_icmpWinsock; + }else{ + HINSTANCE hICMP = ::LoadLibraryEx("ICMP",NULL,0); + if(!hICMP) + return; + BOOL isThere = ( + ::GetProcAddress(hICMP,"IcmpCreateFile") + && ::GetProcAddress(hICMP,"IcmpSendEcho") + && ::GetProcAddress(hICMP,"IcmpCloseHandle") + ); + ::FreeLibrary(hICMP); + if(isThere) + m_mechanismus=_icmpDLL; + } +} \ No newline at end of file diff --git a/shared-code/kICMP.h b/shared-code/kICMP.h new file mode 100644 index 0000000..7a5ceaa --- a/dev/null +++ b/shared-code/kICMP.h @@ -0,0 +1,80 @@ +#ifndef __KICMP_H +#define __KICMP_H + +class CICMP { + enum _mechanismus { + _icmpUndetermined = -1, + _icmpWinsock = 0, _icmpDLL + }; +static _mechanismus m_mechanismus; +static void GuessMechanismus(); +public: +static + CICMP* CreateICMP(); + + enum { + ipSuccess = 0, + ipBuffTooSmall, ipDestNetUnreachable, ipDestHostUnreachable, + ipDestProtUnreachable, ipDestPortUnreachable, ipNoResources, + ipBadOption, ipHWError, ipPacketTooBig, ipTimeOut, ipBadRequest, + ipBadRoute, ipTTLExpiredInTransit, ipTTLExpiredInReasm, + ipParamProblem, ipSourceQuench, ipOptionTooBig, ipBadDest, + ipUnknown = -1, + icmpNotInitialized = -2, + icmpSocketError = -3 + }; + + virtual BOOL Initialize() = 0; + virtual void Deinitialize() = 0; + + virtual LONG Ping(const in_addr host,const UINT packetSize=0, + const UINT timeOut=10000,LPINT pStatus=NULL) = 0; +}; + +class CICMPDll : public CICMP { + HANDLE (WINAPI *m_icmpCF)(VOID); + BOOL (WINAPI *m_icmpSE)(HANDLE,ULONG,LPVOID,WORD, + PIPINFO,LPVOID,DWORD,DWORD); + BOOL (WINAPI *m_icmpCH)(HANDLE); +public: + HINSTANCE m_hICMPDLL; + HANDLE m_hICMP; + LPBYTE m_bsIn, m_bsOut; + UINT m_sizeIn, m_sizeOut; + + CICMPDll() : m_hICMP(INVALID_HANDLE_VALUE), m_hICMPDLL(NULL), + m_bsIn(NULL), m_bsOut(NULL), m_sizeIn(0), m_sizeOut(0) {} + virtual ~CICMPDll() { Deinitialize(); } + + virtual BOOL Initialize(); + virtual void Deinitialize(); + + virtual LONG Ping(const in_addr host,const UINT packetSize=0, + const UINT timeOut=10000,LPINT pStatus=NULL); + + BOOL AdjustBuffers(UINT packetSize=0); +}; + +class CICMPWS : public CICMP { +static + WORD m_icmpSeq; +public: + SOCKET m_socket; + LPBYTE m_bsIn, m_bsOut; + UINT m_sizeIn, m_sizeOut; + + CICMPWS() : m_socket(INVALID_SOCKET), m_bsIn(NULL), m_bsOut(NULL), + m_sizeIn(0), m_sizeOut(0) {} + virtual ~CICMPWS() { Deinitialize(); } + + virtual BOOL Initialize(); + virtual void Deinitialize(); + + virtual LONG Ping(const in_addr host,const UINT packetSize=0, + const UINT timeOut=10000,LPINT pStatus=NULL); + + BOOL AdjustBuffers(UINT packetSize=0); + WORD cksum(LPVOID data,int count); +}; + +#endif // __KICMP_H \ No newline at end of file diff --git a/shared-code/kinhelp.xsl b/shared-code/kinhelp.xsl new file mode 100644 index 0000000..0bb384a --- a/dev/null +++ b/shared-code/kinhelp.xsl @@ -0,0 +1,250 @@ + + + + + + + {\rtf1\ansi + @{\footnote + THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT. + DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD + } + + + + } + + + + \pard\plain + + \keepn + + + #{\footnote + + } + + + ${\footnote + + } + + + K{\footnote + + } + + + \page + + + + {#{\footnote + + }} + + + + + + + + + + + + + {\uldb + + }{\v %!ExecFile(" + + ")} + + + {\uldb + + }{\v + + } + + + Warining: Unqualified hyper-reference. Using as help-internal + {\uldb + + }{\v + + } + + + + + + + + \pard + + { \f1\fs18\b\sb120 + + } + + + + \par\sa120\sb120\qj + + \pard + + \f1\fs18\sb120 + + + + + \par\sa120\sb120\qj\f1\fs16 + + + + + \par\sa120\sb120\qr\f1\fs16 + + + + + \{bmct + + \} + + + + \par\pard\plain\f1\fs24\qc\cf2\b + + - + + + + + \par\pard\plain\fi0\li0\f1\fs18 \bullet + + + + + {\b + + } + + + {\i + + } + + + {\ul + + } + + + {\strike + + } + + + + + + + + {\b } + + + + {\b + + } + + + + + + + + + {\b\cf6 } + + + + {\b\cf6 + + } + + + + + {\i + + } + + + + + + + + + + + { + \par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) + + {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")} + \par\qj\sb120\sa120 + 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: + \par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + \par \sa360 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + } + + + \par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")} + \par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")} + + + + \pard + + \pard + + + + + \par \fi0\li \bullet + + + + + + + + + + + {\colortbl; + \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0; + \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; + \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128; + \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;} + + + + {\fonttbl + {\f0\froman Times New Roman;} + {\f1\fswiss Arial;} + {\f3\froman Symbol;} + } + + + diff --git a/shared-code/ms_icmp.h b/shared-code/ms_icmp.h new file mode 100644 index 0000000..32d97f5 --- a/dev/null +++ b/shared-code/ms_icmp.h @@ -0,0 +1,77 @@ +/*------------------------------------------------------------------ +* Filename: MS_ICMP.H +* +* Description: Prototypes of Microsoft's ICMP.DLL functions for +* access to Internet Control Message Protocol (their stacks do +* not support the standard Berkeley Sockets raw socket API). +* Use this to do "ping" or "traceroute," although beware that +* Microsoft discourages its use. +*/ + + +/* Note 2: For the most part, you can refer to RFC 791 for detials on +* how to fill in values for the IP option information structure. */ +typedef struct ip_option_information { + u_char Ttl; /* Time To Live (used for traceroute) */ + u_char Tos; /* Type Of Service (usually 0) */ + u_char Flags; /* IP header flags (usually 0) */ + u_char OptionsSize; /* Size of options data (usually 0, max 40) */ + u_char FAR *OptionsData;/* Options data buffer */ +} IPINFO, *PIPINFO, FAR *LPIPINFO; + +/* Note 1: The Reply Buffer will have an array of ICMP_ECHO_REPLY +* structures, followed by options and the data in ICMP echo reply +* datagram received. You must have room for at least one ICMP +* echo reply structure, plus 8 bytes for an ICMP header. */ +typedef struct icmp_echo_reply { + u_long Address; /* source address */ + u_long Status; /* IP status value (see below) */ + u_long RTTime; /* Round Trip Time in milliseconds */ + u_short DataSize; /* reply data size */ + u_short Reserved; /* */ + void FAR *Data; /* reply data buffer */ + typedef struct ip_option_information Options; /* reply options */ +} ICMPECHO, *PICMPECHO, FAR *LPICMPECHO; + +#define IP_STATUS_BASE 11000 +#define IP_SUCCESS 0 +#define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1) +#define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2) +#define IP_DEST_HOST_UNREACHABLE (IP_STATUS_BASE + 3) +#define IP_DEST_PROT_UNREACHABLE (IP_STATUS_BASE + 4) +#define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5) +#define IP_NO_RESOURCES (IP_STATUS_BASE + 6) +#define IP_BAD_OPTION (IP_STATUS_BASE + 7) +#define IP_HW_ERROR (IP_STATUS_BASE + 8) +#define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9) +#define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10) +#define IP_BAD_REQ (IP_STATUS_BASE + 11) +#define IP_BAD_ROUTE (IP_STATUS_BASE + 12) +#define IP_TTL_EXPIRED_TRANSIT (IP_STATUS_BASE + 13) +#define IP_TTL_EXPIRED_REASSEM (IP_STATUS_BASE + 14) +#define IP_PARAM_PROBLEM (IP_STATUS_BASE + 15) +#define IP_SOURCE_QUENCH (IP_STATUS_BASE + 16) +#define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17) +#define IP_BAD_DESTINATION (IP_STATUS_BASE + 18) +#define IP_ADDR_DELETED (IP_STATUS_BASE + 19) +#define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 20) +#define IP_MTU_CHANGE (IP_STATUS_BASE + 21) +#define IP_UNLOAD (IP_STATUS_BASE + 22) +#define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50) +#define MAX_IP_STATUS IP_GENERAL_FAILURE +#define IP_PENDING (IP_STATUS_BASE + 255) + + +HANDLE WINAPI PASCAL IcmpCreateFile(VOID); /* INVALID_HANDLE_VALUE on error */ +BOOL WINAPI PASCAL IcmpCloseHandle(HANDLE IcmpHandle); /* FALSE on error */ +DWORD WINAPI PASCAL IcmpSendEcho( + HANDLE IcmpHandle, /* handle returned from IcmpCreateFile() */ + u_long DestAddress, /* destination IP address (in network order) */ + LPVOID RequestData, /* pointer to buffer to send */ + WORD RequestSize, /* length of data in buffer */ + LPIPINFO RequestOptns, /* see Note 2 below */ + LPVOID ReplyBuffer, /* see Note 1 below */ + DWORD ReplySize, /* length of reply (must allow at least 1 reply) */ + DWORD Timeout /* time in milliseconds to wait for reply */ +); + diff --git a/shared-data/browse-icon.ico b/shared-data/browse-icon.ico new file mode 100644 index 0000000..d2d1b3c --- a/dev/null +++ b/shared-data/browse-icon.ico Binary files differ diff --git a/shared-data/install-icon.ico b/shared-data/install-icon.ico new file mode 100644 index 0000000..23e86a6 --- a/dev/null +++ b/shared-data/install-icon.ico Binary files differ diff --git a/shared-data/klever-background.bmp b/shared-data/klever-background.bmp new file mode 100644 index 0000000..e4d87ec --- a/dev/null +++ b/shared-data/klever-background.bmp Binary files differ diff --git a/shared-data/play-icon.ico b/shared-data/play-icon.ico new file mode 100644 index 0000000..3d2a11e --- a/dev/null +++ b/shared-data/play-icon.ico Binary files differ diff --git a/stdafx.cpp b/stdafx.cpp new file mode 100644 index 0000000..056a28f --- a/dev/null +++ b/stdafx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// Dipstick.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/stdafx.h b/stdafx.h new file mode 100644 index 0000000..06ef43f --- a/dev/null +++ b/stdafx.h @@ -0,0 +1,36 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers + +#include // MFC core and standard components +#include // MFC extensions +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows 95 Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include // MFC socket extensions + +#include +#include +#include + +#include +#include "shared-code/ms_icmp.h" +#include "shared-code/ip_icmp.h" + +#include "shared-code/kICMP.h" +#include "shared-code/RegEx.h" +#include "CrackURL.h" + +enum { + WM_DNP_ACTIVITYCOUNT = WM_USER+16, + WM_DNP_URLPING, + WM_DNP_UPDATEHOSTDATA, + WM_DNP_HTML +}; +#include +// CG: The following line was added by the Windows Multimedia component. +#pragma comment(lib, "winmm.lib") -- cgit v0.9.0.2