From a1487b3fc0313408525cd5b2f3bc4a462df351f7 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/klog/trunk@1 fe716a7a-6dde-0310-88d9-d003556173a8 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f47982c --- a/dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ + +# / +/Debug +/Release +/Releast +/debug +/release +/releast +/DEBUG +/RELEASE +/RELEAST +/*.mdp +/*.ncb +/*.aps +/redist + +# /help/ +/help/KLOG.HLP +/help/klog.LOG +/help/klog.hm +/help/klog.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/COPYING b/COPYING new file mode 100644 index 0000000..997e508 --- a/dev/null +++ b/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 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/KLogDlg.cpp b/KLogDlg.cpp new file mode 100644 index 0000000..5f1c6c0 --- a/dev/null +++ b/KLogDlg.cpp @@ -0,0 +1,1367 @@ +// KLogDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "KLog.h" +#include "SyslogSocket.h" +#include "KLogDlg.h" + +#include "Trayer.h" +#include "LogPattern.h" +#include "WarnBlocking.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +IMPLEMENT_SERIAL( CKLogDlg, CDialog, VERSIONABLE_SCHEMA|1 ); +IMPLEMENT_SERIAL( CLogger, CObject, VERSIONABLE_SCHEMA|1 ); +IMPLEMENT_SERIAL( CLogEntry, CObject, VERSIONABLE_SCHEMA|1 ); +IMPLEMENT_SERIAL( CHostMask, CObject, VERSIONABLE_SCHEMA|1 ); + +///////////////////////////////////////////////////////////////////////////// +// 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: + //{{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() + +///////////////////////////////////////////////////////////////////////////// +// CKLogDlg dialog + +CKLogDlg::CKLogDlg(CWnd* pParent /*=NULL*/) + : CDialog(CKLogDlg::IDD, pParent) +{ + m_Logger=NULL; + m_LogItems=15; + m_bShown=TRUE; + m_bExiting=FALSE; + m_bWarnBlocking=TRUE; + m_bDontWarn=TRUE; + //{{AFX_DATA_INIT(CKLogDlg) + m_Logto = -1; + m_Desc = _T(""); + m_Facility = _T(""); + m_HFName = _T(""); + m_HFNameCaption = _T(""); + m_hlIP = _T(""); + m_hlMask = _T(""); + m_Sound = _T(""); + //}}AFX_DATA_INIT + // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + m_bmpBack.LoadBitmap(IDB_BACKGROUND); + m_bmpBack.GetBitmap(&m_bitmapBack); + m_Trayer = new CTrayer(this); + ASSERT(m_Trayer); + LoadSettings(); +} + +void CKLogDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CKLogDlg) + DDX_Control(pDX, IDC_LOGPATTERN, m_LogPatternCtl); + DDX_Control(pDX, IDC_FILES, m_FilesCtl); + DDX_Control(pDX, IDC_LOGLENSPIN, m_LogLenSpinCtl); + DDX_Control(pDX, IDC_LOGLENGTH, m_LogLengthCtl); + DDX_Control(pDX, IDC_INVERT, m_PriInvertCtl); + DDX_Control(pDX, IDC_TYPE_FILE, m_LogtoFileCtl); + DDX_Control(pDX, IDC_TYPE_HOST, m_LogtoHostCtl); + DDX_Control(pDX, IDC_TYPE_NONE, m_LogtoNoneCtl); + DDX_Control(pDX, IDC_HOSTORFILE, m_HFNameCaptionCtl); + DDX_Control(pDX, IDC_HOSTS, m_hlCtl); + DDX_Control(pDX, IDC_BROWSESOUND, m_BrowseSoundCtl); + DDX_Control(pDX, IDC_NONE, m_PriNoneCtl); + DDX_Control(pDX, IDC_HL_REMOVE, m_hlRemoveCtl); + DDX_Control(pDX, IDC_HL_MASK, m_hlMaskCtl); + DDX_Control(pDX, IDC_HL_IP, m_hlIPCtl); + DDX_Control(pDX, IDC_HL_ADD, m_hlAddCtl); + DDX_Control(pDX, IDC_ALL, m_PriAllCtl); + DDX_Control(pDX, IDC_SOUND, m_SoundCtl); + DDX_Control(pDX, IDC_REMOVE, m_RemoveCtl); + DDX_Control(pDX, IDC_PLAYSOUND, m_PlaySoundCtl); + DDX_Control(pDX, IDC_LOG, m_Log); + DDX_Control(pDX, IDC_HOSTFILE, m_HFNameCtl); + DDX_Control(pDX, IDC_FACILITY, m_FacilityCtl); + DDX_Control(pDX, IDC_BROWSE, m_BrowseCtl); + DDX_Control(pDX, IDC_DESC, m_DescCtl); + DDX_Control(pDX, IDC_TABS, m_Tabs); + DDX_Radio(pDX, IDC_TYPE_FILE, m_Logto); + DDX_Text(pDX, IDC_DESC, m_Desc); + DDV_MaxChars(pDX, m_Desc, 50); + DDX_CBString(pDX, IDC_FACILITY, m_Facility); + DDX_Text(pDX, IDC_HOSTFILE, m_HFName); + DDX_Text(pDX, IDC_HOSTORFILE, m_HFNameCaption); + DDX_Text(pDX, IDC_HL_IP, m_hlIP); + DDV_MaxChars(pDX, m_hlIP, 15); + DDX_Text(pDX, IDC_HL_MASK, m_hlMask); + DDV_MaxChars(pDX, m_hlMask, 15); + DDX_CBString(pDX, IDC_SOUND, m_Sound); + //}}AFX_DATA_MAP +} + +BEGIN_MESSAGE_MAP(CKLogDlg, CDialog) + //{{AFX_MSG_MAP(CKLogDlg) + ON_WM_SYSCOMMAND() + ON_WM_DESTROY() + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_BN_CLICKED(IDC_ADD, OnAdd) + ON_NOTIFY(TCN_SELCHANGE, IDC_TABS, OnSelchangeTabs) + ON_CBN_SELCHANGE(IDC_FACILITY, OnSelchangeFacility) + ON_BN_CLICKED(IDC_ALERT, OnPriority) + ON_BN_CLICKED(IDC_TYPE_FILE, OnLogto) + ON_BN_CLICKED(IDC_ALL, OnPriAll) + ON_BN_CLICKED(IDC_NONE, OnPriNone) + ON_EN_CHANGE(IDC_DESC, OnChangeDesc) + ON_BN_CLICKED(IDC_INVERT, OnPriInvert) + ON_BN_CLICKED(IDC_HL_ADD, OnHlAdd) + ON_LBN_SELCHANGE(IDC_HOSTS, OnSelchangeHosts) + ON_BN_CLICKED(IDC_HL_REMOVE, OnHlRemove) + ON_BN_CLICKED(IDC_REMOVE, OnRemove) + ON_BN_CLICKED(IDC_PLAYSOUND, OnPlaysound) + ON_CBN_EDITCHANGE(IDC_SOUND, OnEditchangeSound) + ON_CBN_KILLFOCUS(IDC_SOUND, OnKillfocusSound) + ON_NOTIFY(UDN_DELTAPOS, IDC_LOGLENSPIN, OnDeltaposLoglenspin) + ON_BN_CLICKED(IDC_EXIT, OnExit) + ON_BN_CLICKED(IDC_FILES, OnFiles) + ON_COMMAND(ID_FILES_EXPORT, OnFilesExport) + ON_COMMAND(ID_FILES_IMPORT, OnFilesImport) + ON_BN_CLICKED(IDC_BROWSESOUND, OnBrowsesound) + ON_EN_KILLFOCUS(IDC_HOSTFILE, OnKillfocusHostfile) + ON_BN_CLICKED(IDC_BROWSE, OnBrowse) + ON_COMMAND(ID_FILES_RESET, OnFilesReset) + ON_LBN_SELCHANGE(IDC_LOG, OnSelchangeLog) + ON_WM_CREATE() + ON_WM_CLOSE() + ON_COMMAND(ID_TRAY_ABOUTKLOG, OnTrayAboutklog) + ON_COMMAND(ID_TRAY_EXIT, OnTrayExit) + ON_COMMAND(ID_TRAY_SHOWKLOGWINDOW, OnTrayShowklogwindow) + ON_WM_WINDOWPOSCHANGING() + ON_BN_CLICKED(IDC_LOGPATTERN, OnLogpattern) + ON_BN_CLICKED(IDC_CRIT, OnPriority) + ON_BN_CLICKED(IDC_DEBUG, OnPriority) + ON_BN_CLICKED(IDC_EMERG, OnPriority) + ON_BN_CLICKED(IDC_ERR, OnPriority) + ON_BN_CLICKED(IDC_INFO, OnPriority) + ON_BN_CLICKED(IDC_NOTICE, OnPriority) + ON_BN_CLICKED(IDC_WARNING, OnPriority) + ON_BN_CLICKED(IDC_TYPE_HOST, OnLogto) + ON_BN_CLICKED(IDC_TYPE_NONE, OnLogto) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CKLogDlg message handlers + +BOOL CKLogDlg::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 + + m_KLS.m_Daddy=this; + VERIFY(m_KLS.CreateListen()); + m_SLS.Create(0,SOCK_DGRAM); + + m_LogLenSpinCtl.SetRange(5,50); + UpdateLogLength(FALSE,FALSE); + + // Adjust Tab control rectangle size and padding +CRect rbrc,tcrc; + m_DescCtl.GetWindowRect(&rbrc); + m_Tabs.GetClientRect(&tcrc); + m_Tabs.ClientToScreen(&tcrc); + m_Tabs.SetItemSize(CSize(0,rbrc.top-tcrc.top-4)); + m_Tabs.SetPadding(CSize(5,5)); + + // Load Image List + m_Images.Create(16,16,TRUE,2,1); + m_iNormal=m_Images.Add(AfxGetApp()->LoadIcon(IDI_KLOG)); + m_iTriggered=m_Images.Add(AfxGetApp()->LoadIcon(IDI_KLOG_TRIGGERED)); + m_Tabs.SetImageList(&m_Images); + + // Set Icons + m_BrowseSoundCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_BROWSE)); + m_PlaySoundCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PREPLAY)); + m_LogPatternCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_LOGPATTERN)); + + // Create ToolTip Control + m_tooltip.Create(this); + m_tooltip.Activate(TRUE); + + // Restore Layout + OnFilesReset(); + + SetWindowPos(NULL,6,6,0,0,SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE); + + if(m_bShown) + ShowWindow(SW_SHOW); + else + ShowWindow(SW_HIDE); + + // Add Tips captions + m_tooltip.AddTool(GetDlgItem(IDC_ADD),IDC_ADD); + m_tooltip.AddTool(&m_RemoveCtl,IDC_REMOVE); + m_tooltip.AddTool(&m_LogLengthCtl,IDC_LOGLENGTH); + m_tooltip.AddTool(&m_LogLenSpinCtl,IDC_LOGLENGTH); + m_tooltip.AddTool(GetDlgItem(IDC_STATIC_LOGLENGTH),IDC_LOGLENGTH); + m_tooltip.AddTool(GetDlgItem(IDC_FILES),IDC_FILES); + m_tooltip.AddTool(GetDlgItem(IDC_EXIT),IDC_EXIT); + m_tooltip.AddTool(&m_LogtoFileCtl,IDC_TYPE_FILE); + m_tooltip.AddTool(&m_LogtoHostCtl,IDC_TYPE_HOST); + m_tooltip.AddTool(&m_LogtoNoneCtl,IDC_TYPE_NONE); + m_tooltip.AddTool(&m_hlCtl,IDC_HOSTS); + m_tooltip.AddTool(&m_Log,IDC_LOG); + m_tooltip.AddTool(&m_LogPatternCtl,IDC_LOGPATTERN); + + return TRUE; // return TRUE unless you set the focus to a control +} + +void CKLogDlg::OnSysCommand(UINT nID, LPARAM lParam) +{ + switch(nID&0xFFF0){ + case IDM_ABOUTBOX: + { + OnTrayAboutklog(); + } + break; + case SC_CONTEXTHELP: + AfxGetApp()->WinHelp(0,HELP_FINDER); + break; + default: + CDialog::OnSysCommand(nID, lParam); + break; + } +} + +void CKLogDlg::OnDestroy() +{ +NOTIFYICONDATA nid; + memset(&nid,0,sizeof(nid)); + nid.cbSize=sizeof(nid); + nid.hWnd=m_Trayer->m_hWnd; + nid.uID=IDC_TRAYICON; + nid.uFlags=0; + VERIFY(Shell_NotifyIcon(NIM_DELETE,&nid)); + + WinHelp(0L, HELP_QUIT); + CDialog::OnDestroy(); +} + +// 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 CKLogDlg::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;xm_Desc; + ptc.iImage=m_iNormal; + ptc.lParam=(LPARAM)l; +int tmp=m_Tabs.InsertItem(m_Tabs.GetItemCount(),&ptc); + m_Tabs.SetCurSel(tmp); + SetTab(l); + m_RemoveCtl.EnableWindow(m_Tabs.GetItemCount()>1); +} + +void CKLogDlg::OnSelchangeTabs(NMHDR* pNMHDR, LRESULT* pResult) +{ +int cs = m_Tabs.GetCurSel(); + ASSERT(cs>=0); +TC_ITEM ptci; + memset(&ptci,0,sizeof(ptci)); + ptci.mask=TCIF_PARAM; + VERIFY(m_Tabs.GetItem(cs,&ptci)); +CLogger *l = (CLogger*)ptci.lParam; + memset(&ptci,0,sizeof(ptci)); + ptci.mask=TCIF_IMAGE; + ptci.iImage=m_iNormal; + VERIFY(m_Tabs.SetItem(cs,&ptci)); + ASSERT(l); + SetTab(l); + if(pResult) + *pResult = 0; +} + +UINT CKLogDlg::m_PriorityCtls[CSyslogSocket::totalPriorities] = { + IDC_EMERG,IDC_ALERT,IDC_CRIT,IDC_ERR,IDC_WARNING,IDC_NOTICE,IDC_INFO,IDC_DEBUG +}; +void CKLogDlg::SetTab(CLogger* l) +{ + ASSERT(l); + m_Logger=l; + m_Desc=m_Logger->m_Desc; + UpdateLogto(FALSE,FALSE); + UpdatePriface(FALSE,FALSE); + // HOST LIST + m_hlCtl.ResetContent(); + m_hlRemoveCtl.EnableWindow(FALSE); +POSITION p = m_Logger->m_Hosts.GetHeadPosition(); + while(p){ + CHostMask *hm = m_Logger->m_Hosts.GetNext(p); + ASSERT(hm); + CString hms = hm->String(); + int i = m_hlCtl.AddString(hms); + ASSERT(i>=0); + m_hlCtl.SetItemData(i,(DWORD)hm); + } + // SOUND + m_Sound=m_Logger->m_Sound; + // EVENTS + m_Log.ResetContent(); + p = m_Logger->m_Log.GetHeadPosition(); + while(p){ + CLogEntry *le = m_Logger->m_Log.GetNext(p); + ASSERT(le); + AddLogLine(le); + } + + UpdateData(FALSE); +} + +CLogger::CLogger(BOOL bAll) +{ + m_Desc=bAll?"All events":"New"; + memset(m_LogPattern,bAll,sizeof(m_LogPattern)); + m_LogTo=logToNone; + m_LogToHost.sin_addr.s_addr = INADDR_NONE; +} + +void CKLogDlg::UpdatePriface(BOOL bSave,BOOL update) +{ + ASSERT(m_Logger); +int f = CSyslogSocket::Facility(m_Facility); + if(bSave){ + if(f==CSyslogSocket::facNone) + return; + for(int tmp=0;tmpm_LogPattern[f][tmp]=(IsDlgButtonChecked(m_PriorityCtls[tmp])!=0); + }else{ + if(f==CSyslogSocket::facNone){ + for(int tmp=0;tmpEnableWindow(FALSE); + } + m_PriAllCtl.EnableWindow(FALSE); + m_PriNoneCtl.EnableWindow(FALSE); + m_PriInvertCtl.EnableWindow(FALSE); + }else{ + for(int tmp=0;tmpm_LogPattern[f][tmp]?1:0); + GetDlgItem(m_PriorityCtls[tmp])->EnableWindow(TRUE); + } + m_PriAllCtl.EnableWindow(TRUE); + m_PriNoneCtl.EnableWindow(TRUE); + m_PriInvertCtl.EnableWindow(TRUE); + if(update) + UpdateData(FALSE); + } + } +} + +void CKLogDlg::OnSelchangeFacility() +{ + ASSERT(m_Logger); + UpdatePriface(TRUE,FALSE); + UpdateData(TRUE); + UpdatePriface(FALSE,TRUE); +} + +void CKLogDlg::OnPriority() +{ + UpdatePriface(TRUE,FALSE); +} + +void CKLogDlg::UpdateLogto(BOOL bSave,BOOL update) +{ + if(bSave){ + m_Logger->m_LogTo=m_Logto; + if(m_Logto!=CLogger::logToNone){ + m_Logger->m_LogToName=m_HFName; + switch(m_Logto){ + case CLogger::logToFile: + // ??? Do nothing + break; + case CLogger::logToHost: + m_Logger->LookupHost(this); + break; +#ifndef NDEBUG + default: + ASSERT(FALSE); + break; +#endif + } + } + }else{ + m_Logto=m_Logger->m_LogTo; + m_HFNameCaption.Empty(); + m_HFName=m_Logger->m_LogToName; + BOOL doLog = TRUE; + BOOL doBrowse = FALSE; + switch(m_Logger->m_LogTo){ + case CLogger::logToNone: + doLog=FALSE; + m_HFName.Empty(); + break; + case CLogger::logToFile: + m_HFNameCaption.LoadString(IDS_LOGTO_FILE); + doBrowse=TRUE; + break; + case CLogger::logToHost: + m_HFNameCaption.LoadString(IDS_LOGTO_HOST); + break; + default: + ASSERT(FALSE); + break; + } + m_HFNameCtl.EnableWindow(doLog); + m_HFNameCaptionCtl.EnableWindow(doLog); + m_BrowseCtl.EnableWindow(doBrowse); + if(update) + UpdateData(FALSE); + } +} + +void CKLogDlg::OnLogto() +{ + ASSERT(m_Logger); + UpdateData(TRUE); + m_HFName=m_Logger->m_LogToName; + UpdateLogto(TRUE,FALSE); + UpdateLogto(FALSE,TRUE); +} + +void CKLogDlg::OnPriAll() +{ + ASSERT(m_Logger); + UpdateData(TRUE); + UpdatePriface(TRUE,FALSE); +int f = CSyslogSocket::Facility(m_Facility); + for(int tmp=0;tmpm_LogPattern[f][tmp]=TRUE; + UpdatePriface(FALSE,TRUE); +} + +void CKLogDlg::OnPriNone() +{ + ASSERT(m_Logger); + UpdateData(TRUE); + UpdatePriface(TRUE,FALSE); +int f = CSyslogSocket::Facility(m_Facility); + for(int tmp=0;tmpm_LogPattern[f][tmp]=FALSE; + UpdatePriface(FALSE,TRUE); +} + +void CKLogDlg::OnPriInvert() +{ + ASSERT(m_Logger); + UpdateData(TRUE); + UpdatePriface(TRUE,FALSE); +int f = CSyslogSocket::Facility(m_Facility); + for(int tmp=0;tmpm_LogPattern[f][tmp]=!m_Logger->m_LogPattern[f][tmp]; + UpdatePriface(FALSE,TRUE); +} + +void CKLogDlg::OnChangeDesc() +{ + ASSERT(m_Logger); + UpdateData(TRUE); + m_Logger->m_Desc=m_Desc; +int cs = m_Tabs.GetCurSel(); + ASSERT(cs>=0); +TC_ITEM ptci; + memset(&ptci,0,sizeof(ptci)); + ptci.mask=TCIF_TEXT; + ptci.pszText=(LPTSTR)(LPCTSTR)m_Logger->m_Desc; + VERIFY(m_Tabs.SetItem(cs,&ptci)); +} + +CString CHostMask::String() +{ +CString rv; + rv = inet_ntoa(*(in_addr*)&m_Host); + rv+=" / "; + rv+= inet_ntoa(*(in_addr*)&m_Mask); + return rv; +} + +void CKLogDlg::OnHlAdd() +{ + ASSERT(m_Logger); + UpdateData(TRUE); +DWORD h = (DWORD)inet_addr(m_hlIP); +DWORD m = (DWORD)inet_addr(m_hlMask); + if(h==INADDR_NONE){ + TRACE0("Bad host address\n"); + m_hlIPCtl.SetFocus(); + return; + } + if(m==INADDR_NONE && m_hlMask!="255.255.255.255"){ // 255.255.255.255 stands for INADDR_NONE + TRACE0("Bad host mask\n"); + m_hlMaskCtl.SetFocus(); + return; + } + if(!(m && h)){ + TRACE0("Both zeros\n"); + m_hlIPCtl.SetFocus(); + return; + } +CHostMask *hm = new CHostMask(h,m); + ASSERT(hm); + m_Logger->m_Hosts.AddTail(hm); +CString hms = hm->String(); +int i = m_hlCtl.AddString(hms); + ASSERT(i>=0); + m_hlCtl.SetItemData(i,(DWORD)hm); +} + +void CKLogDlg::OnSelchangeHosts() +{ +int i = m_hlCtl.GetCurSel(); + if(i<0){ + m_hlRemoveCtl.EnableWindow(FALSE); + return; + } +CHostMask *hm = (CHostMask*)m_hlCtl.GetItemData(i); + ASSERT(hm); + m_hlIP=inet_ntoa(*(in_addr*)&hm->m_Host); + m_hlMask=inet_ntoa(*(in_addr*)&hm->m_Mask); + UpdateData(FALSE); + m_hlRemoveCtl.EnableWindow(TRUE); +} + +void CKLogDlg::OnHlRemove() +{ +int i = m_hlCtl.GetCurSel(); + if(i<0){ + m_hlRemoveCtl.EnableWindow(FALSE); + return; + } +CHostMask *hm = (CHostMask*)m_hlCtl.GetItemData(i); + m_hlCtl.DeleteString(i); + ASSERT(hm); + ASSERT(m_Logger); +POSITION p = m_Logger->m_Hosts.Find(hm); + ASSERT(p); + m_Logger->m_Hosts.RemoveAt(p); + delete hm; + m_hlRemoveCtl.EnableWindow(m_hlCtl.GetCurSel()>=0); +} + +void CKLogDlg::OnRemove() +{ + ASSERT(m_Tabs.GetItemCount()>1); +int t = m_Tabs.GetCurSel(); + ASSERT(t>=0); + ASSERT(m_Logger); +TC_ITEM tci; + memset(&tci,0,sizeof(tci)); + tci.mask=TCIF_PARAM; + VERIFY(m_Tabs.GetItem(t,&tci)); + ASSERT(tci.lParam==(LPARAM)m_Logger); + VERIFY(m_Tabs.DeleteItem(t)); + VERIFY(m_Logs.RemoveKey(m_Logger)); + delete m_Logger; + m_Logger=NULL; + m_Tabs.SetCurSel(t); + t=m_Tabs.GetCurSel(); + if(t<0) + VERIFY(m_Tabs.SetCurSel(t=0)); + memset(&tci,0,sizeof(tci)); + tci.mask=TCIF_PARAM; + VERIFY(m_Tabs.GetItem(t,&tci)); +CLogger *l = (CLogger*)tci.lParam; + ASSERT(l); + SetTab(l); + m_RemoveCtl.EnableWindow(m_Tabs.GetItemCount()>1); +} + +void CLogger::PlayWave() +{ + if(m_Sound.IsEmpty()) + return; +CString tmp; + tmp.LoadString(IDS_SOUND_MEOW); + if(!tmp.CompareNoCase(m_Sound)){ + ::PlaySound((LPCTSTR)IDW_SOUND_MEOW,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE); + return; + } + tmp.LoadString(IDS_SOUND_GLASS); + if(!tmp.CompareNoCase(m_Sound)){ + ::PlaySound((LPCTSTR)IDW_SOUND_GLASS,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE); + return; + } + tmp.LoadString(IDS_SOUND_FEAR); + if(!tmp.CompareNoCase(m_Sound)){ + ::PlaySound((LPCTSTR)IDW_SOUND_FEAR,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE); + return; + } + tmp.LoadString(IDS_SOUND_KICK); + if(!tmp.CompareNoCase(m_Sound)){ + ::PlaySound((LPCTSTR)IDW_SOUND_KICK,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE); + return; + } + ::PlaySound(m_Sound,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_FILENAME); +} + +void CKLogDlg::OnPlaysound() +{ + ASSERT(m_Logger); + m_Logger->PlayWave(); +} + +void CKLogDlg::OnEditchangeSound() +{ + ASSERT(m_Logger); + UpdateData(TRUE); + m_Logger->m_Sound=m_Sound; +} + +void CKLogDlg::OnKillfocusSound() +{ + ASSERT(m_Logger); + UpdateData(TRUE); + m_Logger->m_Sound=m_Sound; +} + +void CKLogDlg::UpdateLogLength(BOOL bSave,BOOL update) +{ + if(bSave){ + int sbp = m_LogLenSpinCtl.GetPos(); + if(sbp&(0xFFFFl<<16)){ + sbp = 15; + m_LogLenSpinCtl.SetPos(sbp); + } + m_LogItems=sbp; + }else{ + m_LogLenSpinCtl.SetPos(m_LogItems); + } +} + +void CKLogDlg::OnDeltaposLoglenspin(NMHDR* pNMHDR, LRESULT* pResult) +{ + NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; + UpdateLogLength(TRUE,FALSE); + *pResult = 0; +} + +void CKLogDlg::OnExit() +{ + SaveSettings(); + TotalCleanUp(); + m_bExiting=TRUE; + EndDialog(IDOK); +} + +void CKLogDlg::TotalCleanUp() +{ +POSITION p = m_Logs.GetStartPosition(); + while(p){ + CLogger *l, *ll; + m_Logs.GetNextAssoc(p,l,ll); + ASSERT(l); + ASSERT(l==ll); + delete l; + } + m_Logs.RemoveAll(); + m_Tabs.DeleteAllItems(); + RedrawWindow(); +} + +CLogger::~CLogger() +{ +POSITION p = m_Hosts.GetHeadPosition(); + while(p){ + CHostMask *hm = m_Hosts.GetNext(p); + ASSERT(hm); + delete hm; + } + m_Hosts.RemoveAll(); + p = m_Log.GetHeadPosition(); + while(p){ + CLogEntry *le = m_Log.GetNext(p); + ASSERT(le); + delete le; + } + m_Log.RemoveAll(); +} + +void CKLogDlg::OnFiles() +{ +CRect rc; + m_FilesCtl.GetWindowRect(&rc); +CPoint pt = rc.TopLeft(); +CMenu menu; + VERIFY(menu.LoadMenu(IDD)); +CMenu *filesMenu = menu.GetSubMenu(0); + ASSERT(filesMenu); + filesMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON,pt.x,pt.y,this); +} + +void CKLogDlg::OnFilesExport() +{ + TRACE0("Export\n"); +CString filter; + filter.LoadString(IDS_KLOGFILTER); +CString title, ext; + title.LoadString(IDS_KLOG_EXPORT); + ext.LoadString(IDS_KLOG_EXT); +CFileDialog cfd(FALSE,ext,NULL,OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,filter,this); + cfd.m_ofn.lpstrTitle=title; + if(cfd.DoModal()==IDOK){ + CFile klo; + if(klo.Open(cfd.GetPathName(),CFile::modeCreate|CFile::modeWrite)){ + TRY{ + CArchive ar(&klo,CArchive::store); + Serialize(ar); + ar.Close(); + }CATCH(CException, e){ + CString tmp; + tmp.LoadString(IDS_MSG_FAILEDTOEXPORT); + MessageBox(tmp,NULL,MB_ICONHAND|MB_OK); + }END_CATCH + }else{ + CString tmp; + tmp.LoadString(IDS_MSG_FAILEDTOEXPORT); + MessageBox(tmp,NULL,MB_ICONHAND|MB_OK); + } + } +} + +void CKLogDlg::OnFilesImport() +{ + TRACE0("Import\n"); +CString filter; + filter.LoadString(IDS_KLOGFILTER); +CString title; + title.LoadString(IDS_KLOG_IMPORT); +CFileDialog cfd(TRUE,NULL,NULL,OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,filter,this); + cfd.m_ofn.lpstrTitle=title; + if(cfd.DoModal()==IDOK){ + CFile klo; + if(klo.Open(cfd.GetPathName(),CFile::modeRead)){ + TRY{ + CArchive ar(&klo,CArchive::load); + Serialize(ar); + ar.Close(); + }CATCH(CException, e){ + CString tmp; + tmp.LoadString(IDS_MSG_FAILEDTOIMPORT); + MessageBox(tmp,NULL,MB_ICONHAND|MB_OK); + }END_CATCH + }else{ + CString tmp; + tmp.LoadString(IDS_MSG_FAILEDTOIMPORT); + MessageBox(tmp,NULL,MB_ICONHAND|MB_OK); + } + } +} + +void CKLogDlg::OnBrowsesound() +{ +CString filter; + filter.LoadString(IDS_WAVFILTER); +CString title; + title.LoadString(IDS_SOUND_SELECT); +CFileDialog cfd(TRUE,NULL,NULL,OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,filter,this); + cfd.m_ofn.lpstrTitle=title; + if(cfd.DoModal()==IDOK){ + m_Sound=cfd.GetPathName(); + ASSERT(m_Logger); + UpdateData(FALSE); + m_Logger->m_Sound=m_Sound; + } +} + +void CKLogDlg::OnKillfocusHostfile() +{ + UpdateData(TRUE); + if(m_HFName.Compare(m_Logger->m_LogToName)) + UpdateLogto(TRUE,FALSE); +} + +void CKLogDlg::OnOK() +{ + UpdateData(TRUE); + UpdateLogto(TRUE,FALSE); +} + +void CKLogDlg::OnBrowse() +{ +CString filter; + filter.LoadString(IDS_LOGFILTER); +CString title, ext; + title.LoadString(IDS_LOG_SELECT); + ext.LoadString(IDS_LOG_EXT); +CFileDialog cfd(FALSE,ext,NULL,OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,filter,this); + cfd.m_ofn.lpstrTitle=title; + if(cfd.DoModal()==IDOK){ + m_HFName=cfd.GetPathName(); + ASSERT(m_Logger); + UpdateData(FALSE); + m_Logger->m_LogToName=m_HFName; + } +} + +void CKLogDlg::Serialize(CArchive& ar) +{ + ASSERT_VALID(this); + + ar.MapObject(this); + ar.SerializeClass(RUNTIME_CLASS(CKLogDlg)); + + if(ar.IsStoring()){ + // Store + TRACE0("Store Klog\n"); + int nCount = m_Tabs.GetItemCount(); + ar << nCount; + for(int tmp=0;tmpSerialize(ar); + } + }else{ + // Retrieve + UINT schema = ar.GetObjectSchema(); +#ifndef NDEBUG + { + CString tmp; + tmp.Format("Doc-OSchema: %u\n",schema); + TRACE0(tmp); + } +#endif + // Do the cleanup + TotalCleanUp(); + int nCount; + ar >> nCount; + ASSERT(nCount); + for(int tmp=0;tmpSerialize(ar); + m_Logs[l]=l; + TC_ITEM ptc; + memset(&ptc,0,sizeof(ptc)); + ptc.mask=TCIF_TEXT|TCIF_IMAGE|TCIF_PARAM; + ptc.pszText=(LPTSTR)(LPCTSTR)l->m_Desc; + ptc.iImage=m_iNormal; + ptc.lParam=(LPARAM)l; + int tmp=m_Tabs.InsertItem(m_Tabs.GetItemCount(),&ptc); + if(l->m_LogTo==CLogger::logToHost) + l->LookupHost(this); + } + m_Tabs.SetCurSel(0); + OnSelchangeTabs(NULL,NULL); + m_RemoveCtl.EnableWindow(nCount>1); + } +} + +void CLogger::Serialize(CArchive& ar) +{ + ASSERT_VALID(this); + + ar.MapObject(this); + ar.SerializeClass(RUNTIME_CLASS(CLogger)); + + if(ar.IsStoring()){ + // Store + TRACE0("Store Klogger\n"); + ar << m_Desc; + ar.Write(&m_LogPattern,sizeof(m_LogPattern)); + ar << m_LogTo; + ar << m_LogToName; + ar << m_Sound; + m_Hosts.Serialize(ar); + }else{ + // Retrieve +UINT schema = ar.GetObjectSchema(); +#ifndef NDEBUG + { + CString tmp; + tmp.Format("Doc-OSchema: %u\n",schema); + TRACE0(tmp); + } +#endif + ar >> m_Desc; + ar.Read(&m_LogPattern,sizeof(m_LogPattern)); + ar >> m_LogTo; + ar >> m_LogToName; + ar >> m_Sound; + m_Hosts.Serialize(ar); + } +} + +void CHostMask::Serialize(CArchive& ar) +{ + ASSERT_VALID(this); + + if(ar.IsStoring()){ + // Store + ar << m_Host; + ar << m_Mask; + }else{ + // Retrieve + ar >> m_Host; + ar >> m_Mask; + } +} + +void CKLogDlg::OnFilesReset() +{ + TotalCleanUp(); +BYTE *pData = NULL; +UINT dataLength = 0; + if(AfxGetApp()->GetProfileBinary("Layout","Destinations",&pData,&dataLength)){ + CMemFile mf(pData,dataLength); + CArchive ar(&mf,CArchive::load); + Serialize(ar); + ar.Close(); + delete mf.Detach(); + }else + OnAdd(); +} + +void CAboutDlg::OnKlevernet() +{ +CString url; + url.LoadString(IDS_KLEVERNET_URL); + ShellExecute(::GetDesktopWindow(),"open",url,NULL,NULL,SW_SHOWMAXIMIZED); +} + +void CKLogSocket::Log(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin) +{ +CString str = Escape(line); + m_Daddy->LogMessage(pri,fac,str,sin); +} + +void CKLogDlg::LogMessage(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin) +{ + // Setting up defaults: +UINT ap = pri, af = fac; + if(ap>=CSyslogSocket::totalPriorities) + ap=CSyslogSocket::priInfo; + if(af>=CSyslogSocket::totalFacilities) + af=CSyslogSocket::facUser; +POSITION p = m_Logs.GetStartPosition(); + while(p){ + CLogger *l,*ll; + m_Logs.GetNextAssoc(p,l,ll); + ASSERT(l); + ASSERT(l==ll); + if(l->m_LogPattern[af][ap] && l->IsHostFine(sin->sin_addr.s_addr)) + l->LogLine(this,ap,af,line,sin); + } +} + +CLogEntry::CLogEntry() +{ + m_Time==CTime::GetCurrentTime(); + m_Priority=CSyslogSocket::priNone; + m_Facility=CSyslogSocket::facNone; +} + +BOOL CLogger::IsHostFine(DWORD saddr) +{ + if(m_Hosts.IsEmpty()) + return TRUE; +POSITION p = m_Hosts.GetHeadPosition(); + while(p){ + CHostMask *hm = m_Hosts.GetNext(p); + ASSERT(hm); + if(hm->IsThis(saddr)) + return TRUE; + } + return FALSE; +} + +void CLogger::LogLine(CKLogDlg *dad,UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin) +{ +CLogEntry *le = NULL; + while(m_Log.GetCount()>=dad->m_LogItems){ + le = m_Log.GetHead(); + ASSERT(le); + if(dad->m_Logger==this){ + ASSERT((CLogEntry*)dad->m_Log.GetItemData(0)==le); + dad->m_Log.DeleteString(0); + } + m_Log.RemoveHead(); + if(m_Log.GetCount()>dad->m_LogItems){ + delete le; + le=NULL; + } + } + if(!le) + le = new CLogEntry(); + ASSERT(le); + le->m_Time=CTime::GetCurrentTime(); + le->m_Priority=pri; + le->m_Facility=fac; + le->m_Data=line; + le->m_Source=inet_ntoa(sin->sin_addr); + m_Log.AddTail(le); + if(dad->m_Logger==this){ + dad->AddLogLine(le); + }else{ + int c = dad->m_Tabs.GetItemCount(); + ASSERT(c>0); + for(int i=0;im_Tabs.GetItem(i,&ptci)); + CLogger *l = (CLogger*)ptci.lParam; + if(l==this){ + memset(&ptci,0,sizeof(ptci)); + ptci.mask=TCIF_IMAGE; + ptci.iImage=dad->m_iTriggered; + VERIFY(dad->m_Tabs.SetItem(i,&ptci)); + } + } + } + PlayWave(); + switch(m_LogTo){ + case logToFile: + if(!m_LogToName.IsEmpty()){ + TRY{ + CFile file(m_LogToName,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite|CFile::typeBinary); + file.SeekToEnd(); + CString tmp = le->m_Time.Format(IDS_LOGFILETIMEFORMAT); + file.Write((LPCTSTR)tmp,tmp.GetLength()); + tmp.Format(IDS_LOGFILESOURCEFORMAT,le->m_Source); + file.Write((LPCTSTR)tmp,tmp.GetLength()); + tmp.Format(IDS_LOGFILEPRIFACEFORMAT,CSyslogSocket::m_Facilities[fac],CSyslogSocket::m_Priorities[pri]); + file.Write((LPCTSTR)tmp,tmp.GetLength()); + file.Write(line,strlen(line)); + file.Write("\r\n",2); + file.Close(); + }CATCH(CFileException, e){ +#ifndef NDEBUG + afxDump << "Logging error: " << e->m_cause << "\n"; +#endif + }END_CATCH + } + break; + case logToHost: + if(m_LogToHost.sin_addr.s_addr!=INADDR_NONE){ + CString tmp; + tmp.Format(IDS_LOGHOSTSOURCEFORMAT,le->m_Source); + tmp+=line; + dad->m_SLS.LogTo(m_LogToHost.sin_addr.s_addr,pri,fac,tmp); + } + break; + } +} + +CLogEntry& CLogEntry::operator=(CLogEntry& src) +{ + m_Data=src.m_Data; + m_Facility=src.m_Facility; + m_Priority=src.m_Priority; + m_Source=src.m_Source; + m_Time=src.m_Time; + return *this; +} + +CLogEntry::CLogEntry(CLogEntry& src) +{ + (*this)=src; +} + +void CKLogDlg::AddLogLine(CLogEntry *le) +{ + ASSERT(le); +int i = m_Log.AddString(le->m_Data); + m_Log.SetItemData(i,(DWORD)le); + m_Log.SetCurSel(i); +} + +BOOL CKLogDlg::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); + } +} + +void CKLogDlg::OnSelchangeLog() +{ +int i = m_Log.GetCurSel(); + if(i==LB_ERR) + return; +CLogEntry *le = (CLogEntry*)m_Log.GetItemData(i); + ASSERT(le); +CString tmp; + tmp.Format(IDS_TIP_LOG, + (LPCTSTR)le->m_Time.Format(IDS_LOGTIMEFORMAT), + (LPCTSTR)le->m_Source, + CSyslogSocket::m_Facilities[le->m_Facility], + CSyslogSocket::m_Priorities[le->m_Priority] + ); + m_tooltip.UpdateTipText(tmp,&m_Log); +} + +int CKLogDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CDialog::OnCreate(lpCreateStruct) == -1) + return -1; + + if(!m_Trayer->Create(NULL,"PumpKIN TrayIcon",WS_CHILD,CRect(0,0,0,0),this,0)){ + TRACE0("Failed to create trayer\n"); + return -1; + } + +NOTIFYICONDATA nid; + memset(&nid,0,sizeof(nid)); + nid.cbSize=sizeof(nid); + nid.hWnd=m_Trayer->m_hWnd; + nid.uID=IDC_TRAYICON; + nid.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP; + nid.uCallbackMessage=WM_TRAYICON; + nid.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME); + // *** Load from resource + strcpy(nid.szTip,"KLog"); + VERIFY(Shell_NotifyIcon(NIM_ADD,&nid)); + + return 0; +} + +void CKLogDlg::OnClose() +{ + OnTrayShowklogwindow(); +} + +void CKLogDlg::OnTrayAboutklog() +{ +CAboutDlg dlgAbout; + dlgAbout.DoModal(); +} + +void CKLogDlg::OnTrayExit() +{ + OnExit(); +} + +void CKLogDlg::OnTrayShowklogwindow() +{ + if(IsWindowVisible()){ + m_bShown=FALSE; + ShowWindow(SW_HIDE); + }else{ + m_bShown=TRUE; + ShowWindow(SW_SHOW); + SetForegroundWindow(); + SetFocus(); + } +} + +void CKLogDlg::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; + if(::GetForegroundWindow()==m_hWnd && (m_Trayer && !m_Trayer->m_inMenu)) + GetDesktopWindow()->SetForegroundWindow(); + } + } +} + +void CKLogDlg::LoadSettings() +{ +CWinApp *app = AfxGetApp(); + ASSERT(app); + m_LogItems=app->GetProfileInt("UISettings","LogLength",m_LogItems); + m_bShown=app->GetProfileInt("UISettings","Visible",m_bShown); + m_bWarnBlocking=app->GetProfileInt("Resolve","WarnBlocking",m_bWarnBlocking); + m_bDontWarn=app->GetProfileInt("Resolve","DontWarn",m_bDontWarn); +} + +void CKLogDlg::SaveSettings() +{ +CWinApp *app = AfxGetApp(); + ASSERT(app); + app->WriteProfileInt("UISettings","LogLength",m_LogItems); + app->WriteProfileInt("UISettings","Visible",m_bShown); + app->WriteProfileInt("Resolve","WarnBlocking",m_bWarnBlocking); + app->WriteProfileInt("Resolve","DontWarn",m_bDontWarn); +CMemFile mf(4096); +CArchive ar(&mf,CArchive::store); + Serialize(ar); + ar.Close(); +DWORD dataLength = mf.GetLength(); + if(dataLength&0xFFFF0000l){ + CString tmp; + tmp.LoadString(IDS_MSG_FAILEDTOSTORE); + MessageBox(tmp,NULL,MB_ICONHAND|MB_OK); + }else{ + UINT dl = (UINT)dataLength; + BYTE *data = mf.Detach(); + app->WriteProfileBinary("Layout","Destinations",data,dl); + delete data; + } +} + +CKLogDlg::~CKLogDlg() +{ + delete m_Trayer; +} + +void CKLogDlg::OnLogpattern() +{ +CLogPattern lp(IDS_LOGPATTERN_TITLE,this); + memmove(lp.m_Pattern,m_Logger->m_LogPattern,sizeof(lp.m_Pattern)); + if(lp.DoModal()==IDOK){ + memmove(m_Logger->m_LogPattern,lp.m_Pattern,sizeof(m_Logger->m_LogPattern)); + UpdatePriface(FALSE,TRUE); + } +} + +void CLogger::LookupHost(CKLogDlg *daddy) +{ + m_LogToHost.sin_addr.s_addr=inet_addr((LPCTSTR)m_LogToName); + if(m_LogToHost.sin_addr.s_addr==INADDR_NONE){ + if(daddy->m_bWarnBlocking){ + CWarnBlocking wb(::IsWindow(daddy->m_hWnd)?daddy:NULL); + wb.m_bDontWarn = daddy->m_bDontWarn; + if(wb.DoModal()!=IDOK) + return; + daddy->m_bDontWarn=wb.m_bDontWarn; + daddy->m_bWarnBlocking=!wb.m_bDontWarn; + } + daddy->BeginWaitCursor(); + hostent *he = gethostbyname(m_LogToName); + daddy->EndWaitCursor(); + if(he){ + m_LogToHost.sin_addr.s_addr = *(DWORD*)he->h_addr; + }else{ + m_LogToHost.sin_addr.s_addr = INADDR_NONE; + if(daddy->m_bWarnBlocking){ + CString sux; + sux.Format(IDS_MSG_LOOKUPFAILED,(LPCTSTR)m_LogToName); + daddy->MessageBox(sux,NULL,MB_ICONSTOP|MB_OK); + }else + MessageBeep(MB_ICONHAND); + } + } +} diff --git a/KLogDlg.h b/KLogDlg.h new file mode 100644 index 0000000..f6fed53 --- a/dev/null +++ b/KLogDlg.h @@ -0,0 +1,198 @@ +// KLogDlg.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CKLogDlg dialog + +class CKLogDlg; +class CKLogSocket : public CSyslogSocket { +public: + CKLogDlg* m_Daddy; + virtual void Log(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin); +}; + +class CHostMask : public CObject{ +public: + virtual void Serialize(CArchive& ar); + DWORD m_Host; + DWORD m_Mask; + BOOL IsThis(DWORD host) { return (host&m_Mask)==(m_Host&m_Mask); } + CHostMask() : m_Host(0), m_Mask(0) {} + CHostMask(DWORD host,DWORD mask) : m_Host(host), m_Mask(mask) {} + CString String(); + + DECLARE_SERIAL( CHostMask ) +}; +class CLogEntry : public CObject { +public: + CLogEntry(CLogEntry& src); + CLogEntry& operator=(CLogEntry& src); + CTime m_Time; + CString m_Source; + CString m_Data; + UINT m_Priority; + UINT m_Facility; + DECLARE_SERIAL( CLogEntry ) +public: + CLogEntry(); +}; + +typedef CTypedPtrList CAccessList; +typedef CList CLog; + +class CLogger : public CObject { +public: + void LookupHost(CKLogDlg *daddy); + void LogLine(CKLogDlg *dad,UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin); + BOOL IsHostFine(DWORD saddr); + virtual void Serialize(CArchive& ar); + virtual ~CLogger(); + void PlayWave(); + CLogger(BOOL bAll=FALSE); + CString m_Desc; + enum { + logToFile=0, logToHost=1, logToNone=2, + }; + int m_LogTo; + CString m_LogToName; + SOCKADDR_IN m_LogToHost; + BOOL m_LogPattern[CSyslogSocket::totalFacilities][CSyslogSocket::totalPriorities]; + CAccessList m_Hosts; + CString m_Sound; + CLog m_Log; + DECLARE_SERIAL( CLogger ) +}; + +typedef CMap CLoggers; + +class CTrayer; +class CKLogDlg : public CDialog +{ +// Construction +public: + BOOL m_bDontWarn; + BOOL m_bWarnBlocking; + CSyslogSocket m_SLS; + virtual ~CKLogDlg(); + void SaveSettings(); + void LoadSettings(); + BOOL m_bExiting; + BOOL m_bShown; + CTrayer* m_Trayer; + virtual BOOL PreTranslateMessage(MSG* pMsg); + void AddLogLine(CLogEntry *le); + void LogMessage(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin); + CKLogSocket m_KLS; + virtual void Serialize(CArchive& ar); + void TotalCleanUp(); + BITMAP m_bitmapBack; + CBitmap m_bmpBack; + void UpdateLogLength(BOOL bSave=TRUE,BOOL update=FALSE); + int m_LogItems; + void UpdateLogto(BOOL bSave=TRUE,BOOL update=TRUE); + void UpdatePriface(BOOL bSave=TRUE,BOOL update=TRUE); + static UINT m_PriorityCtls[CSyslogSocket::totalPriorities]; + CLogger* m_Logger; + void SetTab(CLogger* l); + int m_iTriggered; + int m_iNormal; + CImageList m_Images; + CLoggers m_Logs; + CKLogDlg(CWnd* pParent = NULL); // standard constructor + + DECLARE_SERIAL( CKLogDlg ) + +// Dialog Data + //{{AFX_DATA(CKLogDlg) + enum { IDD = IDD_KLOG_DIALOG }; + CButton m_LogPatternCtl; + CButton m_FilesCtl; + CSpinButtonCtrl m_LogLenSpinCtl; + CStatic m_LogLengthCtl; + CButton m_PriInvertCtl; + CButton m_LogtoFileCtl; + CButton m_LogtoHostCtl; + CButton m_LogtoNoneCtl; + CStatic m_HFNameCaptionCtl; + CListBox m_hlCtl; + CButton m_BrowseSoundCtl; + CButton m_PriNoneCtl; + CButton m_hlRemoveCtl; + CEdit m_hlMaskCtl; + CEdit m_hlIPCtl; + CButton m_hlAddCtl; + CButton m_PriAllCtl; + CComboBox m_SoundCtl; + CButton m_RemoveCtl; + CButton m_PlaySoundCtl; + CListBox m_Log; + CEdit m_HFNameCtl; + CComboBox m_FacilityCtl; + CButton m_BrowseCtl; + CEdit m_DescCtl; + CTabCtrl m_Tabs; + int m_Logto; + CString m_Desc; + CString m_Facility; + CString m_HFName; + CString m_HFNameCaption; + CString m_hlIP; + CString m_hlMask; + CString m_Sound; + //}}AFX_DATA + + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CKLogDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + CToolTipCtrl m_tooltip; + HICON m_hIcon; + + // Generated message map functions + //{{AFX_MSG(CKLogDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + afx_msg void OnDestroy(); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnAdd(); + afx_msg void OnSelchangeTabs(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnSelchangeFacility(); + afx_msg void OnPriority(); + afx_msg void OnLogto(); + afx_msg void OnPriAll(); + afx_msg void OnPriNone(); + afx_msg void OnChangeDesc(); + afx_msg void OnPriInvert(); + afx_msg void OnHlAdd(); + afx_msg void OnSelchangeHosts(); + afx_msg void OnHlRemove(); + afx_msg void OnRemove(); + afx_msg void OnPlaysound(); + afx_msg void OnEditchangeSound(); + afx_msg void OnKillfocusSound(); + afx_msg void OnDeltaposLoglenspin(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnExit(); + afx_msg void OnFiles(); + afx_msg void OnFilesExport(); + afx_msg void OnFilesImport(); + afx_msg void OnBrowsesound(); + afx_msg void OnKillfocusHostfile(); + virtual void OnOK(); + afx_msg void OnBrowse(); + afx_msg void OnFilesReset(); + afx_msg void OnSelchangeLog(); + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnClose(); + afx_msg void OnTrayAboutklog(); + afx_msg void OnTrayExit(); + afx_msg void OnTrayShowklogwindow(); + afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos); + afx_msg void OnLogpattern(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/KTAGS b/KTAGS new file mode 100644 index 0000000..81b6fc2 --- a/dev/null +++ b/KTAGS @@ -0,0 +1,12 @@ +about-date klog.rc /LTEXT\s\+"Copyright /;" kind:d +about-version klog.rc /LTEXT\s\+"KLog, Version /;" kind:v +help-license-date ./help/klog.xml /m_bSaveAndValidate){ + for(UINT f=from;f<=to;f++){ + for(UINT p=0;pm_pDlgWnd->IsDlgButtonChecked(m_ID[f][p])){ + case 0: + m_Pattern[f][p]=FALSE; + break; + case 1: + m_Pattern[f][p]=TRUE; + break; +#ifndef NDEBUG + default: + ASSERT(FALSE); + break; +#endif + } + } + } + }else{ + for(UINT f=from;f<=to;f++){ + for(UINT p=0;pm_pDlgWnd->CheckDlgButton(m_ID[f][p],m_Pattern[f][p]?1:0); + } + } + } +} + +void CLogPattern::PriorityOn(CWnd *pWnd,UINT pri,UINT from,UINT to) +{ + for(UINT f=from;f<=to;f++) + pWnd->CheckDlgButton(m_ID[f][pri],1); +} + +void CLogPattern::PriorityXor(CWnd *pWnd,UINT pri,UINT from,UINT to) +{ + for(UINT f=from;f<=to;f++) + pWnd->CheckDlgButton(m_ID[f][pri],pWnd->IsDlgButtonChecked(m_ID[f][pri])?0:1); +} + +void CLogPattern::FacilityOn(CWnd *pWnd,UINT fac) +{ + for(int p=0;pCheckDlgButton(m_ID[fac][p],1); +} + +void CLogPattern::FacilityXor(CWnd *pWnd,UINT fac) +{ + for(int p=0;pCheckDlgButton(m_ID[fac][p],pWnd->IsDlgButtonChecked(m_ID[fac][p])?0:1); +} + +void CLogPattern::AddTips(CToolTipCtrl& tt,CWnd *pWnd,UINT from,UINT to) +{ +CString ttt; + for(UINT f=from;fGetDlgItem(m_ID[f][p]),ttt); + } + } +} diff --git a/LogPattern.h b/LogPattern.h new file mode 100644 index 0000000..2f2ffd3 --- a/dev/null +++ b/LogPattern.h @@ -0,0 +1,53 @@ +// LogPattern.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CLogPattern + +class CLogPatternUnix; +class CLogPatternReserved; +class CLogPatternLocal; +class CLogPattern : public CPropertySheet +{ + DECLARE_DYNAMIC(CLogPattern) + +// Construction +public: + void AddTips(CToolTipCtrl& tt,CWnd *pWnd,UINT from,UINT to); + void FacilityXor(CWnd *pWnd,UINT fac); + void FacilityOn(CWnd *pWnd,UINT fac); + void PriorityXor(CWnd *pWnd,UINT pri,UINT from,UINT to); + void PriorityOn(CWnd *pWnd,UINT pri,UINT from,UINT to); + void ExchangeData(CDataExchange *pDX,UINT from,UINT to); + static UINT m_ID[CSyslogSocket::totalFacilities][CSyslogSocket::totalPriorities]; + CLogPatternLocal *m_Local; + CLogPatternReserved *m_Reserved; + CLogPatternUnix *m_Unix; + void AddPages(); + BOOL m_Pattern[CSyslogSocket::totalFacilities][CSyslogSocket::totalPriorities]; + CLogPattern(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); + CLogPattern(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CLogPattern) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CLogPattern(); + + // Generated message map functions +protected: + //{{AFX_MSG(CLogPattern) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/LogPatternLocal.cpp b/LogPatternLocal.cpp new file mode 100644 index 0000000..739eeed --- a/dev/null +++ b/LogPatternLocal.cpp @@ -0,0 +1,282 @@ +// LogPatternLocal.cpp : implementation file +// + +#include "stdafx.h" +#include "KLog.h" +#include "LogPatternLocal.h" + +#include "SyslogSocket.h" +#include "LogPattern.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CLogPatternLocal property page + +#define PFROM CSyslogSocket::facLocal0 +#define PTO CSyslogSocket::facLocal7 + +IMPLEMENT_DYNCREATE(CLogPatternLocal, CPropertyPage) + +CLogPatternLocal::CLogPatternLocal(CLogPattern* daddy) : CPropertyPage(CLogPatternLocal::IDD), m_Daddy(daddy) +{ + //{{AFX_DATA_INIT(CLogPatternLocal) + //}}AFX_DATA_INIT +} + +CLogPatternLocal::~CLogPatternLocal() +{ +} + +void CLogPatternLocal::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CLogPatternLocal) + //}}AFX_DATA_MAP + m_Daddy->ExchangeData(pDX,PFROM,PTO); +} + + +BEGIN_MESSAGE_MAP(CLogPatternLocal, CPropertyPage) + //{{AFX_MSG_MAP(CLogPatternLocal) + ON_BN_CLICKED(IDC_ALERT_ON, OnAlertOn) + ON_BN_CLICKED(IDC_ALERT_XOR, OnAlertXor) + ON_BN_CLICKED(IDC_CRIT_ON, OnCritOn) + ON_BN_CLICKED(IDC_CRIT_XOR, OnCritXor) + ON_BN_CLICKED(IDC_DEBUG_ON, OnDebugOn) + ON_BN_CLICKED(IDC_DEBUG_XOR, OnDebugXor) + ON_BN_CLICKED(IDC_EMERG_ON, OnEmergOn) + ON_BN_CLICKED(IDC_EMERG_XOR, OnEmergXor) + ON_BN_CLICKED(IDC_ERR_ON, OnErrOn) + ON_BN_CLICKED(IDC_ERR_XOR, OnErrXor) + ON_BN_CLICKED(IDC_INFO_ON, OnInfoOn) + ON_BN_CLICKED(IDC_INFO_XOR, OnInfoXor) + ON_BN_CLICKED(IDC_L0_ON, OnL0On) + ON_BN_CLICKED(IDC_L0_XOR, OnL0Xor) + ON_BN_CLICKED(IDC_L1_ON, OnL1On) + ON_BN_CLICKED(IDC_L1_XOR, OnL1Xor) + ON_BN_CLICKED(IDC_L2_ON, OnL2On) + ON_BN_CLICKED(IDC_L2_XOR, OnL2Xor) + ON_BN_CLICKED(IDC_L3_ON, OnL3On) + ON_BN_CLICKED(IDC_L3_XOR, OnL3Xor) + ON_BN_CLICKED(IDC_L4_ON, OnL4On) + ON_BN_CLICKED(IDC_L4_XOR, OnL4Xor) + ON_BN_CLICKED(IDC_L5_ON, OnL5On) + ON_BN_CLICKED(IDC_L5_XOR, OnL5Xor) + ON_BN_CLICKED(IDC_L6_ON, OnL6On) + ON_BN_CLICKED(IDC_L6_XOR, OnL6Xor) + ON_BN_CLICKED(IDC_L7_ON, OnL7On) + ON_BN_CLICKED(IDC_L7_XOR, OnL7Xor) + ON_BN_CLICKED(IDC_NOTICE_ON, OnNoticeOn) + ON_BN_CLICKED(IDC_NOTICE_XOR, OnNoticeXor) + ON_BN_CLICKED(IDC_WARN_ON, OnWarnOn) + ON_BN_CLICKED(IDC_WARN_XOR, OnWarnXor) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CLogPatternLocal message handlers + +void CLogPatternLocal::OnAlertOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priAlert,PFROM,PTO); +} +void CLogPatternLocal::OnAlertXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priAlert,PFROM,PTO); +} + +void CLogPatternLocal::OnCritOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priCritical,PFROM,PTO); +} +void CLogPatternLocal::OnCritXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priCritical,PFROM,PTO); +} + +void CLogPatternLocal::OnDebugOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priDebug,PFROM,PTO); +} +void CLogPatternLocal::OnDebugXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priDebug,PFROM,PTO); +} + +void CLogPatternLocal::OnEmergOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priEmergency,PFROM,PTO); +} +void CLogPatternLocal::OnEmergXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priEmergency,PFROM,PTO); +} + +void CLogPatternLocal::OnErrOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priError,PFROM,PTO); +} +void CLogPatternLocal::OnErrXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priError,PFROM,PTO); +} + +void CLogPatternLocal::OnInfoOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priInfo,PFROM,PTO); +} +void CLogPatternLocal::OnInfoXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priInfo,PFROM,PTO); +} + +void CLogPatternLocal::OnL0On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facLocal0); +} +void CLogPatternLocal::OnL0Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facLocal0); +} + +void CLogPatternLocal::OnL1On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facLocal1); +} +void CLogPatternLocal::OnL1Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facLocal1); +} + +void CLogPatternLocal::OnL2On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facLocal2); +} +void CLogPatternLocal::OnL2Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facLocal2); +} + +void CLogPatternLocal::OnL3On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facLocal3); +} +void CLogPatternLocal::OnL3Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facLocal3); +} + +void CLogPatternLocal::OnL4On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facLocal4); +} +void CLogPatternLocal::OnL4Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facLocal4); +} + +void CLogPatternLocal::OnL5On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facLocal5); +} +void CLogPatternLocal::OnL5Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facLocal5); +} + +void CLogPatternLocal::OnL6On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facLocal6); + +} +void CLogPatternLocal::OnL6Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facLocal6); +} + +void CLogPatternLocal::OnL7On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facLocal7); +} +void CLogPatternLocal::OnL7Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facLocal7); +} + +void CLogPatternLocal::OnNoticeOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priNotice,PFROM,PTO); +} +void CLogPatternLocal::OnNoticeXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priNotice,PFROM,PTO); +} + +void CLogPatternLocal::OnWarnOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priWarning,PFROM,PTO); +} +void CLogPatternLocal::OnWarnXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priWarning,PFROM,PTO); +} + +BOOL CLogPatternLocal::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + m_tooltip.Create(this); + m_tooltip.Activate(TRUE); + m_tooltip.AddTool(GetDlgItem(IDC_L0_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_L1_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_L2_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_L3_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_L4_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_L5_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_L6_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_L7_ON),IDS_TIP_FACILITY_ON); + + m_tooltip.AddTool(GetDlgItem(IDC_L0_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_L1_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_L2_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_L3_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_L4_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_L5_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_L6_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_L7_XOR),IDS_TIP_FACILITY_XOR); + + m_tooltip.AddTool(GetDlgItem(IDC_EMERG_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_ALERT_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_CRIT_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_ERR_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_WARN_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_INFO_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_ON),IDS_TIP_PRIORITY_ON); + + m_tooltip.AddTool(GetDlgItem(IDC_EMERG_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_ALERT_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_CRIT_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_ERR_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_WARN_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_INFO_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_XOR),IDS_TIP_PRIORITY_XOR); + + m_Daddy->AddTips(m_tooltip,this,PFROM,PTO); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +BOOL CLogPatternLocal::PreTranslateMessage(MSG* pMsg) +{ + m_tooltip.RelayEvent(pMsg); + + return CPropertyPage::PreTranslateMessage(pMsg); +} diff --git a/LogPatternLocal.h b/LogPatternLocal.h new file mode 100644 index 0000000..8a09bba --- a/dev/null +++ b/LogPatternLocal.h @@ -0,0 +1,74 @@ +// LogPatternLocal.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CLogPatternLocal dialog + +class CLogPattern; +class CLogPatternLocal : public CPropertyPage +{ + DECLARE_DYNCREATE(CLogPatternLocal) + +// Construction +public: + CToolTipCtrl m_tooltip; + CLogPattern* m_Daddy; + CLogPatternLocal(CLogPattern *daddy=NULL); + ~CLogPatternLocal(); + +// Dialog Data + //{{AFX_DATA(CLogPatternLocal) + enum { IDD = IDD_LOG_LOCAL }; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CLogPatternLocal) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CLogPatternLocal) + afx_msg void OnAlertOn(); + afx_msg void OnAlertXor(); + afx_msg void OnCritOn(); + afx_msg void OnCritXor(); + afx_msg void OnDebugOn(); + afx_msg void OnDebugXor(); + afx_msg void OnEmergOn(); + afx_msg void OnEmergXor(); + afx_msg void OnErrOn(); + afx_msg void OnErrXor(); + afx_msg void OnInfoOn(); + afx_msg void OnInfoXor(); + afx_msg void OnL0On(); + afx_msg void OnL0Xor(); + afx_msg void OnL1On(); + afx_msg void OnL1Xor(); + afx_msg void OnL2On(); + afx_msg void OnL2Xor(); + afx_msg void OnL3On(); + afx_msg void OnL3Xor(); + afx_msg void OnL4On(); + afx_msg void OnL4Xor(); + afx_msg void OnL5On(); + afx_msg void OnL5Xor(); + afx_msg void OnL6On(); + afx_msg void OnL6Xor(); + afx_msg void OnL7On(); + afx_msg void OnL7Xor(); + afx_msg void OnNoticeOn(); + afx_msg void OnNoticeXor(); + afx_msg void OnWarnOn(); + afx_msg void OnWarnXor(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/LogPatternReserved.cpp b/LogPatternReserved.cpp new file mode 100644 index 0000000..3921694 --- a/dev/null +++ b/LogPatternReserved.cpp @@ -0,0 +1,241 @@ +// LogPatternReserved.cpp : implementation file +// + +#include "stdafx.h" +#include "KLog.h" +#include "LogPatternReserved.h" + +#include "SyslogSocket.h" +#include "LogPattern.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CLogPatternReserved property page + +#define PFROM CSyslogSocket::facReserved0 +#define PTO CSyslogSocket::facReserved4 + +IMPLEMENT_DYNCREATE(CLogPatternReserved, CPropertyPage) + +CLogPatternReserved::CLogPatternReserved(CLogPattern *daddy) : CPropertyPage(CLogPatternReserved::IDD), m_Daddy(daddy) +{ + //{{AFX_DATA_INIT(CLogPatternReserved) + //}}AFX_DATA_INIT +} + +CLogPatternReserved::~CLogPatternReserved() +{ +} + +void CLogPatternReserved::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CLogPatternReserved) + //}}AFX_DATA_MAP + m_Daddy->ExchangeData(pDX,PFROM,PTO); +} + + +BEGIN_MESSAGE_MAP(CLogPatternReserved, CPropertyPage) + //{{AFX_MSG_MAP(CLogPatternReserved) + ON_BN_CLICKED(IDC_ALERT_ON, OnAlertOn) + ON_BN_CLICKED(IDC_ALERT_XOR, OnAlertXor) + ON_BN_CLICKED(IDC_CRIT_ON, OnCritOn) + ON_BN_CLICKED(IDC_CRIT_XOR, OnCritXor) + ON_BN_CLICKED(IDC_DEBUG_ON, OnDebugOn) + ON_BN_CLICKED(IDC_DEBUG_XOR, OnDebugXor) + ON_BN_CLICKED(IDC_EMERG_ON, OnEmergOn) + ON_BN_CLICKED(IDC_EMERG_XOR, OnEmergXor) + ON_BN_CLICKED(IDC_ERR_ON, OnErrOn) + ON_BN_CLICKED(IDC_ERR_XOR, OnErrXor) + ON_BN_CLICKED(IDC_INFO_ON, OnInfoOn) + ON_BN_CLICKED(IDC_INFO_XOR, OnInfoXor) + ON_BN_CLICKED(IDC_NOTICE_ON, OnNoticeOn) + ON_BN_CLICKED(IDC_NOTICE_XOR, OnNoticeXor) + ON_BN_CLICKED(IDC_R0_ON, OnR0On) + ON_BN_CLICKED(IDC_R0_XOR, OnR0Xor) + ON_BN_CLICKED(IDC_R1_ON, OnR1On) + ON_BN_CLICKED(IDC_R1_XOR, OnR1Xor) + ON_BN_CLICKED(IDC_R2_ON, OnR2On) + ON_BN_CLICKED(IDC_R2_XOR, OnR2Xor) + ON_BN_CLICKED(IDC_R3_ON, OnR3On) + ON_BN_CLICKED(IDC_R3_XOR, OnR3Xor) + ON_BN_CLICKED(IDC_R4_ON, OnR4On) + ON_BN_CLICKED(IDC_R4_XOR, OnR4Xor) + ON_BN_CLICKED(IDC_WARN_ON, OnWarnOn) + ON_BN_CLICKED(IDC_WARN_XOR, OnWarnXor) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CLogPatternReserved message handlers + +void CLogPatternReserved::OnAlertOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priAlert,PFROM,PTO); +} +void CLogPatternReserved::OnAlertXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priAlert,PFROM,PTO); +} + +void CLogPatternReserved::OnCritOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priCritical,PFROM,PTO); +} +void CLogPatternReserved::OnCritXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priCritical,PFROM,PTO); +} + +void CLogPatternReserved::OnDebugOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priDebug,PFROM,PTO); +} +void CLogPatternReserved::OnDebugXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priDebug,PFROM,PTO); +} + +void CLogPatternReserved::OnEmergOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priEmergency,PFROM,PTO); +} +void CLogPatternReserved::OnEmergXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priEmergency,PFROM,PTO); +} + +void CLogPatternReserved::OnErrOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priError,PFROM,PTO); +} +void CLogPatternReserved::OnErrXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priError,PFROM,PTO); +} + +void CLogPatternReserved::OnInfoOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priInfo,PFROM,PTO); +} +void CLogPatternReserved::OnInfoXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priInfo,PFROM,PTO); +} + +void CLogPatternReserved::OnNoticeOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priNotice,PFROM,PTO); +} +void CLogPatternReserved::OnNoticeXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priNotice,PFROM,PTO); +} + +void CLogPatternReserved::OnR0On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facReserved0); +} +void CLogPatternReserved::OnR0Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facReserved0); +} + +void CLogPatternReserved::OnR1On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facReserved1); +} +void CLogPatternReserved::OnR1Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facReserved1); +} + +void CLogPatternReserved::OnR2On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facReserved2); +} +void CLogPatternReserved::OnR2Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facReserved2); +} + +void CLogPatternReserved::OnR3On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facReserved3); +} +void CLogPatternReserved::OnR3Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facReserved3); +} + +void CLogPatternReserved::OnR4On() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facReserved4); +} +void CLogPatternReserved::OnR4Xor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facReserved4); +} + +void CLogPatternReserved::OnWarnOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priWarning,PFROM,PTO); +} +void CLogPatternReserved::OnWarnXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priWarning,PFROM,PTO); +} + +BOOL CLogPatternReserved::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + m_tooltip.Create(this); + m_tooltip.Activate(TRUE); + m_tooltip.AddTool(GetDlgItem(IDC_R0_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_R1_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_R2_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_R3_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_R4_ON),IDS_TIP_FACILITY_ON); + + m_tooltip.AddTool(GetDlgItem(IDC_R0_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_R1_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_R2_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_R3_XOR),IDS_TIP_FACILITY_XOR); + + m_tooltip.AddTool(GetDlgItem(IDC_EMERG_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_ALERT_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_CRIT_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_ERR_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_WARN_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_INFO_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_ON),IDS_TIP_PRIORITY_ON); + + m_tooltip.AddTool(GetDlgItem(IDC_EMERG_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_ALERT_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_CRIT_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_ERR_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_WARN_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_INFO_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_XOR),IDS_TIP_PRIORITY_XOR); + + m_Daddy->AddTips(m_tooltip,this,PFROM,PTO); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +BOOL CLogPatternReserved::PreTranslateMessage(MSG* pMsg) +{ + m_tooltip.RelayEvent(pMsg); + + return CPropertyPage::PreTranslateMessage(pMsg); +} diff --git a/LogPatternReserved.h b/LogPatternReserved.h new file mode 100644 index 0000000..a407154 --- a/dev/null +++ b/LogPatternReserved.h @@ -0,0 +1,68 @@ +// LogPatternReserved.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CLogPatternReserved dialog + +class CLogPattern; +class CLogPatternReserved : public CPropertyPage +{ + DECLARE_DYNCREATE(CLogPatternReserved) + +// Construction +public: + CToolTipCtrl m_tooltip; + CLogPattern* m_Daddy; + CLogPatternReserved(CLogPattern *daddy=NULL); + ~CLogPatternReserved(); + +// Dialog Data + //{{AFX_DATA(CLogPatternReserved) + enum { IDD = IDD_LOG_RESERVED }; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CLogPatternReserved) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CLogPatternReserved) + afx_msg void OnAlertOn(); + afx_msg void OnAlertXor(); + afx_msg void OnCritOn(); + afx_msg void OnCritXor(); + afx_msg void OnDebugOn(); + afx_msg void OnDebugXor(); + afx_msg void OnEmergOn(); + afx_msg void OnEmergXor(); + afx_msg void OnErrOn(); + afx_msg void OnErrXor(); + afx_msg void OnInfoOn(); + afx_msg void OnInfoXor(); + afx_msg void OnNoticeOn(); + afx_msg void OnNoticeXor(); + afx_msg void OnR0On(); + afx_msg void OnR0Xor(); + afx_msg void OnR1On(); + afx_msg void OnR1Xor(); + afx_msg void OnR2On(); + afx_msg void OnR2Xor(); + afx_msg void OnR3On(); + afx_msg void OnR3Xor(); + afx_msg void OnR4On(); + afx_msg void OnR4Xor(); + afx_msg void OnWarnOn(); + afx_msg void OnWarnXor(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/LogPatternUnix.cpp b/LogPatternUnix.cpp new file mode 100644 index 0000000..2a76e1f --- a/dev/null +++ b/LogPatternUnix.cpp @@ -0,0 +1,320 @@ +// LogPatternUnix.cpp : implementation file +// + +#include "stdafx.h" +#include "KLog.h" +#include "LogPatternUnix.h" + +#include "SyslogSocket.h" +#include "LogPattern.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CLogPatternUnix property page + +#define PFROM CSyslogSocket::facKernel +#define PTO CSyslogSocket::facAuthPriv + +IMPLEMENT_DYNCREATE(CLogPatternUnix, CPropertyPage) + +CLogPatternUnix::CLogPatternUnix(CLogPattern* daddy) : CPropertyPage(CLogPatternUnix::IDD), m_Daddy(daddy) +{ + //{{AFX_DATA_INIT(CLogPatternUnix) + //}}AFX_DATA_INIT +} + +CLogPatternUnix::~CLogPatternUnix() +{ +} + +void CLogPatternUnix::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CLogPatternUnix) + //}}AFX_DATA_MAP + m_Daddy->ExchangeData(pDX,PFROM,PTO); +} + + +BEGIN_MESSAGE_MAP(CLogPatternUnix, CPropertyPage) + //{{AFX_MSG_MAP(CLogPatternUnix) + ON_BN_CLICKED(IDC_ALERT_ON, OnAlertOn) + ON_BN_CLICKED(IDC_AUTH_ON, OnAuthOn) + ON_BN_CLICKED(IDC_ALERT_XOR, OnAlertXor) + ON_BN_CLICKED(IDC_AUTH_XOR, OnAuthXor) + ON_BN_CLICKED(IDC_CRIT_ON, OnCritOn) + ON_BN_CLICKED(IDC_CRIT_XOR, OnCritXor) + ON_BN_CLICKED(IDC_CRON_ON, OnCronOn) + ON_BN_CLICKED(IDC_CRON_XOR, OnCronXor) + ON_BN_CLICKED(IDC_DAEMON_ON, OnDaemonOn) + ON_BN_CLICKED(IDC_DAEMON_XOR, OnDaemonXor) + ON_BN_CLICKED(IDC_DEBUG_ON, OnDebugOn) + ON_BN_CLICKED(IDC_DEBUG_XOR, OnDebugXor) + ON_BN_CLICKED(IDC_EMERG_ON, OnEmergOn) + ON_BN_CLICKED(IDC_EMERG_XOR, OnEmergXor) + ON_BN_CLICKED(IDC_ERR_ON, OnErrOn) + ON_BN_CLICKED(IDC_ERR_XOR, OnErrXor) + ON_BN_CLICKED(IDC_INFO_ON, OnInfoOn) + ON_BN_CLICKED(IDC_INFO_XOR, OnInfoXor) + ON_BN_CLICKED(IDC_KERNEL_ON, OnKernelOn) + ON_BN_CLICKED(IDC_KERNEL_XOR, OnKernelXor) + ON_BN_CLICKED(IDC_LPR_ON, OnLprOn) + ON_BN_CLICKED(IDC_LPR_XOR, OnLprXor) + ON_BN_CLICKED(IDC_MAIL_ON, OnMailOn) + ON_BN_CLICKED(IDC_MAIL_XOR, OnMailXor) + ON_BN_CLICKED(IDC_NEWS_ON, OnNewsOn) + ON_BN_CLICKED(IDC_NEWS_XOR, OnNewsXor) + ON_BN_CLICKED(IDC_NOTICE_ON, OnNoticeOn) + ON_BN_CLICKED(IDC_NOTICE_XOR, OnNoticeXor) + ON_BN_CLICKED(IDC_SYSLOG_ON, OnSyslogOn) + ON_BN_CLICKED(IDC_SYSLOG_XOR, OnSyslogXor) + ON_BN_CLICKED(IDC_USER_ON, OnUserOn) + ON_BN_CLICKED(IDC_USER_XOR, OnUserXor) + ON_BN_CLICKED(IDC_UUCP_ON, OnUucpOn) + ON_BN_CLICKED(IDC_UUCP_XOR, OnUucpXor) + ON_BN_CLICKED(IDC_WARN_ON, OnWarnOn) + ON_BN_CLICKED(IDC_WARN_XOR, OnWarnXor) + ON_BN_CLICKED(IDC_AUTHPRIV_ON, OnAuthprivOn) + ON_BN_CLICKED(IDC_AUTHPRIV_XOR, OnAuthprivXor) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CLogPatternUnix message handlers + +void CLogPatternUnix::OnAlertOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priAlert,PFROM,PTO); +} +void CLogPatternUnix::OnAlertXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priAlert,PFROM,PTO); +} + +void CLogPatternUnix::OnAuthOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facAuth); +} +void CLogPatternUnix::OnAuthXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facAuth); +} + +void CLogPatternUnix::OnCritOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priCritical,PFROM,PTO); +} +void CLogPatternUnix::OnCritXor() +{ +m_Daddy->PriorityXor(this,CSyslogSocket::priCritical,PFROM,PTO); +} + +void CLogPatternUnix::OnCronOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facCron); +} +void CLogPatternUnix::OnCronXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facCron); +} + +void CLogPatternUnix::OnDaemonOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facDaemon); +} +void CLogPatternUnix::OnDaemonXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facDaemon); +} + +void CLogPatternUnix::OnDebugOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priDebug,PFROM,PTO); +} +void CLogPatternUnix::OnDebugXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priDebug,PFROM,PTO); +} + +void CLogPatternUnix::OnEmergOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priEmergency,PFROM,PTO); +} +void CLogPatternUnix::OnEmergXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priEmergency,PFROM,PTO); +} + +void CLogPatternUnix::OnErrOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priError,PFROM,PTO); +} +void CLogPatternUnix::OnErrXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priError,PFROM,PTO); +} + +void CLogPatternUnix::OnInfoOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priInfo,PFROM,PTO); +} +void CLogPatternUnix::OnInfoXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priInfo,PFROM,PTO); +} + +void CLogPatternUnix::OnKernelOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facKernel); +} +void CLogPatternUnix::OnKernelXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facKernel); +} + +void CLogPatternUnix::OnLprOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facLPR); +} +void CLogPatternUnix::OnLprXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facLPR); +} + +void CLogPatternUnix::OnMailOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facMail); +} +void CLogPatternUnix::OnMailXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facMail); +} + +void CLogPatternUnix::OnNewsOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facNews); +} +void CLogPatternUnix::OnNewsXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facNews); +} + +void CLogPatternUnix::OnNoticeOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priNotice,PFROM,PTO); +} +void CLogPatternUnix::OnNoticeXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priNotice,PFROM,PTO); +} + +void CLogPatternUnix::OnSyslogOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facSyslog); +} +void CLogPatternUnix::OnSyslogXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facSyslog); +} + +void CLogPatternUnix::OnUserOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facUser); +} +void CLogPatternUnix::OnUserXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facUser); +} + +void CLogPatternUnix::OnUucpOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facUUCP); +} +void CLogPatternUnix::OnUucpXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facUUCP); +} + +void CLogPatternUnix::OnWarnOn() +{ + m_Daddy->PriorityOn(this,CSyslogSocket::priWarning,PFROM,PTO); +} +void CLogPatternUnix::OnWarnXor() +{ + m_Daddy->PriorityXor(this,CSyslogSocket::priWarning,PFROM,PTO); +} + +void CLogPatternUnix::OnAuthprivOn() +{ + m_Daddy->FacilityOn(this,CSyslogSocket::facAuthPriv); +} +void CLogPatternUnix::OnAuthprivXor() +{ + m_Daddy->FacilityXor(this,CSyslogSocket::facAuthPriv); +} + +BOOL CLogPatternUnix::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + m_tooltip.Create(this); + m_tooltip.Activate(TRUE); + m_tooltip.AddTool(GetDlgItem(IDC_KERNEL_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_USER_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_MAIL_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_DAEMON_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_AUTH_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_SYSLOG_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_LPR_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_NEWS_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_UUCP_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_CRON_ON),IDS_TIP_FACILITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_AUTHPRIV_ON),IDS_TIP_FACILITY_ON); + + m_tooltip.AddTool(GetDlgItem(IDC_KERNEL_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_USER_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_MAIL_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_DAEMON_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_AUTH_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_SYSLOG_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_LPR_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_NEWS_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_UUCP_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_CRON_XOR),IDS_TIP_FACILITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_AUTHPRIV_XOR),IDS_TIP_FACILITY_XOR); + + m_tooltip.AddTool(GetDlgItem(IDC_EMERG_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_ALERT_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_CRIT_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_ERR_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_WARN_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_INFO_ON),IDS_TIP_PRIORITY_ON); + m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_ON),IDS_TIP_PRIORITY_ON); + + m_tooltip.AddTool(GetDlgItem(IDC_EMERG_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_ALERT_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_CRIT_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_ERR_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_WARN_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_INFO_XOR),IDS_TIP_PRIORITY_XOR); + m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_XOR),IDS_TIP_PRIORITY_XOR); + + m_Daddy->AddTips(m_tooltip,this,PFROM,PTO); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +BOOL CLogPatternUnix::PreTranslateMessage(MSG* pMsg) +{ + m_tooltip.RelayEvent(pMsg); + + return CPropertyPage::PreTranslateMessage(pMsg); +} diff --git a/LogPatternUnix.h b/LogPatternUnix.h new file mode 100644 index 0000000..0cc9355 --- a/dev/null +++ b/LogPatternUnix.h @@ -0,0 +1,80 @@ +// LogPatternUnix.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CLogPatternUnix dialog + +class CLogPattern; +class CLogPatternUnix : public CPropertyPage +{ + DECLARE_DYNCREATE(CLogPatternUnix) + +// Construction +public: + CToolTipCtrl m_tooltip; + CLogPattern* m_Daddy; + CLogPatternUnix(CLogPattern *daddy=NULL); + ~CLogPatternUnix(); + +// Dialog Data + //{{AFX_DATA(CLogPatternUnix) + enum { IDD = IDD_LOG_UNIX }; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CLogPatternUnix) + public: + virtual BOOL PreTranslateMessage(MSG* pMsg); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CLogPatternUnix) + afx_msg void OnAlertOn(); + afx_msg void OnAuthOn(); + afx_msg void OnAlertXor(); + afx_msg void OnAuthXor(); + afx_msg void OnCritOn(); + afx_msg void OnCritXor(); + afx_msg void OnCronOn(); + afx_msg void OnCronXor(); + afx_msg void OnDaemonOn(); + afx_msg void OnDaemonXor(); + afx_msg void OnDebugOn(); + afx_msg void OnDebugXor(); + afx_msg void OnEmergOn(); + afx_msg void OnEmergXor(); + afx_msg void OnErrOn(); + afx_msg void OnErrXor(); + afx_msg void OnInfoOn(); + afx_msg void OnInfoXor(); + afx_msg void OnKernelOn(); + afx_msg void OnKernelXor(); + afx_msg void OnLprOn(); + afx_msg void OnLprXor(); + afx_msg void OnMailOn(); + afx_msg void OnMailXor(); + afx_msg void OnNewsOn(); + afx_msg void OnNewsXor(); + afx_msg void OnNoticeOn(); + afx_msg void OnNoticeXor(); + afx_msg void OnSyslogOn(); + afx_msg void OnSyslogXor(); + afx_msg void OnUserOn(); + afx_msg void OnUserXor(); + afx_msg void OnUucpOn(); + afx_msg void OnUucpXor(); + afx_msg void OnWarnOn(); + afx_msg void OnWarnXor(); + afx_msg void OnAuthprivOn(); + afx_msg void OnAuthprivXor(); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/README b/README new file mode 100644 index 0000000..fbdfd9c --- a/dev/null +++ b/README @@ -0,0 +1,33 @@ + +Before compiling canned install executable the following files should be placed +in the build tree: + +redist/mfc42.dl_ + +Release checklist: + (These are tags stored in KTAGS file. please, keep in sync. Use vim to + jump to these tags. I haven't tried it on windows, though). + +|help-news| - Release notes in help file + +Version number in the following places: + +|about-version| - About box +|vsinfo-numeric-version| - VERSIONINFO numerical File&Prod V +|vsinfo-string-version| - VERSIONINFO string File&Prod V +|install-version| - Version used in install +|install-vsinfo-numeric-version| - install's VERSIONINFO block +|install-vsinfo-string-version| - install's VERSIONINFO block + +If the year flips check these: + +|about-date| - About box +|help-license-date| - license in help file +|license-date| - license in COPYING file +|vsinfo-date| - Copyright in VERSIONINFO block +|install-vsinfo-date| - Copyright in install's VERSIONINFO + block + + +This is for vim (don't remove): + vim:set tags=KTAGS isk=!-~,^*,^\|,^\" ft=help: diff --git a/SyslogSocket.cpp b/SyslogSocket.cpp new file mode 100644 index 0000000..641499f --- a/dev/null +++ b/SyslogSocket.cpp @@ -0,0 +1,192 @@ +#include "stdafx.h" +#include "SyslogSocket.h" + +LPCTSTR CSyslogSocket::m_Priorities[8] = { + "emerg", "alert", "crit", "err", "warn", "notice", "info", "debug" +}; +LPCTSTR CSyslogSocket::m_Facilities[24] = { + "kernel", "user", "mail", "daemon", "auth", "syslog", "lpr","news","uucp","cron","authpriv","reserved0","reserved1","reserved2","reserved3","reserved4","local0","local1","local2","local3","local4","local5","local6","local7" +}; + +BOOL CSyslogSocket::CreateListen(UINT port) +{ + if(!Create(port?port:m_Port,SOCK_DGRAM)) + return FALSE; + DoSelect(); + return TRUE; +} + +CSyslogSocket::CSyslogSocket() +{ + m_Port=514; + m_MaxLine=2048; + m_DefaultPriority=MakePriority(priNotice,facUser); + memset(&m_DefaultHost,0,sizeof(m_DefaultHost)); + m_DefaultHost.sin_family=AF_INET; + m_DefaultHost.sin_addr.s_addr=inet_addr("127.0.0.1"); + m_DefaultHost.sin_port=m_Port; +} + +void CSyslogSocket::DoSelect() +{ + AsyncSelect(FD_CLOSE|FD_READ|(m_Queue.IsEmpty()?0:FD_WRITE)); +} + +void CSyslogSocket::OnReceive(int nErrorCode) +{ + if(nErrorCode){ + TRACE0("Error on receiving socket\n"); + return; + } +SOCKADDR_IN sin; +int sinLength = sizeof(sin); +CString inputLine; +LPTSTR buff = inputLine.GetBuffer(m_MaxLine+1); +int bytes = ReceiveFrom(buff,m_MaxLine,(SOCKADDR*)&sin,&sinLength); + if(bytes==SOCKET_ERROR){ + TRACE0("Failed to receive datagram\n"); + return; + } + buff[bytes]=0; + inputLine.ReleaseBuffer(); +UINT pri = m_DefaultPriority; + if(!inputLine.IsEmpty()){ + if(inputLine[0]=='<'){ + inputLine=inputLine.Mid(1); + CString newPri = inputLine.SpanIncluding("0123456789"); + inputLine=inputLine.Mid(newPri.GetLength()); + if((!inputLine.IsEmpty()) && inputLine[0]=='>') + inputLine=inputLine.Mid(1); + pri = atoi((LPCTSTR)newPri); + } + } + ASSERT(sin.sin_family==AF_INET); + Log(Priority(pri),Facility(pri),inputLine,&sin); + DoSelect(); +} + +void CSyslogSocket::Log(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin) +{ + // Default implementation does nothing. +} + +CString CSyslogSocket::Escape(LPCTSTR str) +{ +CString rv; + while(*str){ + int c = *(str++); + if(iscntrl(c)){ + switch(c){ + case '\n': + c=' '; + break; + case '\t': + c='\t'; + break; + default: + rv+='^'; + c|='@'; + break; + } + } + rv+=(char)c; + } + return rv; +} + +BOOL CSyslogSocket::LogTo(SOCKADDR_IN* sin,UINT pri,UINT fac,LPCTSTR str) +{ + ASSERT(sin); +CString tmp; + tmp.Format("<%u>",MakePriority(pri,fac)); + tmp+=str; + return LogTo(sin,tmp); +} + +BOOL CSyslogSocket::LogTo(SOCKADDR_IN* sin,LPCTSTR str) +{ +CSyslogOutgoingPacket *p = new CSyslogOutgoingPacket; + ASSERT(p); + memmove(&p->m_To,sin,sizeof(p->m_To)); + p->m_What=str; + m_Queue.AddTail(p); + DoSelect(); + return TRUE; +} + +BOOL CSyslogSocket::LogTo(DWORD sinAddr,UINT sinPort,LPCTSTR str) +{ +SOCKADDR_IN sin; + memset(&sin,0,sizeof(sin)); + sin.sin_addr.s_addr=sinAddr; + sin.sin_port=sinPort; + sin.sin_family=AF_INET; + return LogTo(&sin,str); +} + +BOOL CSyslogSocket::LogTo(DWORD sinAddr,UINT sinPort,UINT pri,UINT fac,LPCTSTR str) +{ +SOCKADDR_IN sin; + memset(&sin,0,sizeof(sin)); + sin.sin_addr.s_addr=sinAddr; + sin.sin_port=sinPort; + sin.sin_family=AF_INET; + return LogTo(&sin,pri,fac,str); +} + +BOOL CSyslogSocket::LogTo(DWORD sinAddr,UINT pri,UINT fac,LPCTSTR str) +{ + return LogTo(sinAddr,m_Port,pri,fac,str); +} + +BOOL CSyslogSocket::LogTo(DWORD sinAddr,LPCTSTR str) +{ + return LogTo(sinAddr,m_Port,str); +} + +BOOL CSyslogSocket::LogTo(UINT pri,UINT fac,LPCTSTR str) +{ + return LogTo(&m_DefaultHost,pri,fac,str); +} + +BOOL CSyslogSocket::LogTo(LPCTSTR str) +{ + return LogTo(&m_DefaultHost,str); +} + +UINT CSyslogSocket::Facility(LPCTSTR str) +{ + ASSERT(str); + for(int tmp=0;tmp<(sizeof(m_Facilities)/sizeof(m_Facilities[0]));tmp++) + if(!strcmp(str,m_Facilities[tmp])) + return tmp; + return facNone; +} + +UINT CSyslogSocket::Priority(LPCTSTR str) +{ + ASSERT(str); + for(int tmp=0;tmp<(sizeof(m_Priorities)/sizeof(m_Priorities[0]));tmp++) + if(!strcmp(str,m_Priorities[tmp])) + return tmp; + return priNone; +} + +void CSyslogSocket::OnSend(int nErrorCode) +{ + if(nErrorCode){ + TRACE0("Error on sending socket\n"); + return; + } + if(!m_Queue.IsEmpty()){ + CSyslogOutgoingPacket *p = m_Queue.GetHead(); + ASSERT(p); + m_Queue.RemoveHead(); + int rv = SendTo((LPCTSTR)p->m_What,p->m_What.GetLength(),(SOCKADDR*)&p->m_To,sizeof(SOCKADDR_IN)); + if(rv!=p->m_What.GetLength()){ + TRACE0("Failed to send on socket\n"); + } + delete p; + } + DoSelect(); +} diff --git a/SyslogSocket.h b/SyslogSocket.h new file mode 100644 index 0000000..572560f --- a/dev/null +++ b/SyslogSocket.h @@ -0,0 +1,82 @@ + +struct CSyslogOutgoingPacket { + SOCKADDR_IN m_To; + CString m_What; +}; +typedef CList CSyslogOutgoingPackets; + +class CSyslogSocket : public CAsyncSocket { +public: + virtual void OnSend(int nErrorCode); + static UINT Priority(LPCTSTR str); + static UINT Facility(LPCTSTR str); + BOOL LogTo(LPCTSTR str); + SOCKADDR_IN m_DefaultHost; + BOOL LogTo(UINT pri,UINT fac,LPCTSTR str); + BOOL LogTo(DWORD sinAddr,LPCTSTR str); + BOOL LogTo(DWORD sinAddr,UINT pri,UINT fac,LPCTSTR str); + BOOL LogTo(DWORD sinAddr,UINT sinPort,UINT pri,UINT fac,LPCTSTR str); + BOOL LogTo(DWORD sinAddr,UINT sinPort,LPCTSTR str); + BOOL LogTo(SOCKADDR_IN* sin,LPCTSTR str); + BOOL LogTo(SOCKADDR_IN* sin,UINT pri,UINT fac,LPCTSTR str); + static CString Escape(LPCTSTR str); + virtual void Log(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin); + UINT m_DefaultPriority; + virtual void OnReceive(int nErrorCode); + UINT m_MaxLine; + void DoSelect(); + CSyslogOutgoingPackets m_Queue; + CSyslogSocket(); + UINT m_Port; + BOOL CreateListen(UINT port=0); + static LPCTSTR m_Facilities[24]; + static LPCTSTR m_Priorities[8]; + enum { + maskPriority = 7, + maskFacility = 0x3F8, + shiftFacility = 3, + priNone = 0xFFFF, + facNone = 0xFFFF, + totalPriorities=8, + totalFacilities=24, + + priEmergency=0, + priAlert=1, + priCritical=2, + priError=3, + priWarning=4, + priNotice=5, + priInfo=6, + priDebug=7, + + facKernel=0, + facUser=1, + facMail=2, + facDaemon=3, + facAuth=4, + facSyslog=5, + facLPR=6, + facNews=7, + facUUCP=8, + facCron=9, + facAuthPriv=10, + + facReserved0=11, + facReserved1=12, + facReserved2=13, + facReserved3=14, + facReserved4=15, + + facLocal0=16, + facLocal1=17, + facLocal2=18, + facLocal3=19, + facLocal4=20, + facLocal5=21, + facLocal6=22, + facLocal7=23 + }; + static UINT Priority(UINT pri) { return pri&maskPriority; } + static UINT Facility(UINT pri) { return (pri&maskFacility)>>shiftFacility; } + static UINT MakePriority(UINT pri,UINT fac) { return (pri&maskPriority)|((fac<CheckMenuItem(ID_TRAY_SHOWKLOGWINDOW,MF_BYCOMMAND|(IsWindowVisible()?MF_CHECKED:MF_UNCHECKED)); + popUp->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this); + m_inMenu--; + SendMessage(WM_NULL); + } + break; + case WM_LBUTTONDOWN: + m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWKLOGWINDOW); + break; + } + return 0; +} + +void CTrayer::OnTrayAboutklog() +{ + m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_ABOUTKLOG); +} + +void CTrayer::OnTrayExit() +{ + m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_EXIT); +} + +void CTrayer::OnTrayHelp() +{ + m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_HELP); +} + +void CTrayer::OnTrayShowklogwindow() +{ + m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWKLOGWINDOW); +} diff --git a/Trayer.h b/Trayer.h new file mode 100644 index 0000000..ff170e1 --- a/dev/null +++ b/Trayer.h @@ -0,0 +1,44 @@ +// Trayer.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CTrayer window + +class CKLogDlg; +class CTrayer : public CWnd +{ +// Construction +public: + CKLogDlg * m_Daddy; + CTrayer(CKLogDlg* daddy); + int m_inMenu; + CTrayer(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTrayer) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CTrayer(); + + // Generated message map functions +protected: + //{{AFX_MSG(CTrayer) + afx_msg LRESULT OnTray(WPARAM,LPARAM); + afx_msg void OnTrayAboutklog(); + afx_msg void OnTrayExit(); + afx_msg void OnTrayHelp(); + afx_msg void OnTrayShowklogwindow(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/WarnBlocking.cpp b/WarnBlocking.cpp new file mode 100644 index 0000000..63d647d --- a/dev/null +++ b/WarnBlocking.cpp @@ -0,0 +1,42 @@ +// WarnBlocking.cpp : implementation file +// + +#include "stdafx.h" +#include "KLog.h" +#include "WarnBlocking.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CWarnBlocking dialog + + +CWarnBlocking::CWarnBlocking(CWnd* pParent /*=NULL*/) + : CDialog(CWarnBlocking::IDD, pParent) +{ + //{{AFX_DATA_INIT(CWarnBlocking) + m_bDontWarn = FALSE; + //}}AFX_DATA_INIT +} + + +void CWarnBlocking::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CWarnBlocking) + DDX_Check(pDX, IDC_WARNBLOCKING, m_bDontWarn); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CWarnBlocking, CDialog) + //{{AFX_MSG_MAP(CWarnBlocking) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CWarnBlocking message handlers diff --git a/WarnBlocking.h b/WarnBlocking.h new file mode 100644 index 0000000..21dafa3 --- a/dev/null +++ b/WarnBlocking.h @@ -0,0 +1,34 @@ +// WarnBlocking.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CWarnBlocking dialog + +class CWarnBlocking : public CDialog +{ +// Construction +public: + CWarnBlocking(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CWarnBlocking) + enum { IDD = IDD_WARNBLOCKING }; + BOOL m_bDontWarn; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CWarnBlocking) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CWarnBlocking) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/help/klog.cnt b/help/klog.cnt new file mode 100644 index 0000000..fda9805 --- a/dev/null +++ b/help/klog.cnt @@ -0,0 +1,8 @@ +:Base KLog.hlp>Standard +:Title KLog +1 KLog +2 About KLog=About +2 What's New=News +2 Using KLog=Using +2 Main Window=MainWindow +2 Logging Pattern Dialog=Pattern diff --git a/help/klog.hpj b/help/klog.hpj new file mode 100644 index 0000000..95a05e7 --- a/dev/null +++ b/help/klog.hpj @@ -0,0 +1,26 @@ +; 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=KLog +CNT=klog.cnt +HLP=KLOG.HLP + +[FILES] +klog.rtf + +[ALIAS] +HIDD_ABOUTBOX=About +HIDD_KLOG_DIALOG=MainWindow +HIDD_LOG_LOCAL=Pattern +HIDD_LOG_RESERVED=Pattern +HIDD_LOG_UNIX=Pattern + +[MAP] +#include klog.hm + +[WINDOWS] +Standard="",(66,8,739,884),20740,(r14876671),(r12632256),f2 diff --git a/help/klog.rtf b/help/klog.rtf new file mode 100644 index 0000000..587fbcd --- a/dev/null +++ b/help/klog.rtf @@ -0,0 +1,64 @@ +{\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 KLog} +{ \f1\fs18\b\sb120 Abotu {\b KLog}} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b KLog} is our {\i Win32} implementation of {\b\cf6 *nix}{\i syslog} daemon to support remote logging of messages from {\b\cf6 unix} servers, routers, terminal servers and other syslog-enabled devices/applications. +\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) 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 +#{\footnote News} +${\footnote What's New} +\par\pard\plain\f1\fs24\qc\cf2\b 1.00 Beta 2 - August 19th, 2002 +\par\pard\plain\fi0\li0\f1\fs18 \bullet Change of license and opening the source code +\page + +\pard\plain\keepn +#{\footnote Using} +${\footnote Using KLog} +{ \f1\fs18\b\sb120 Using {\b KLog}} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 When you start {\b KLog} for the first time it is set to the configuration in which it will silently catch all incoming messages and display them in the log window. Scroll length in initial configuration is set to 15 lines. To learn how to modify this initial configuration you may want to proceed to the {\uldb Main Window}{\v MainWindow} section. +\page + +\pard\plain\keepn +#{\footnote MainWindow} +${\footnote Main Window} +{ \f1\fs18\b\sb120 Main Window} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 Essentially, main window is a tabbed collection of 'Destinations'. For each destination you can set the destination itself, events criteria and sound {\b KLog} will produce when triggered by event matching criteria. +\par\sa120\sb120\qj\pard \f1\fs18\sb120 Each tab consists of following fields:\pard +\par \fi0\li0 \bullet {\b Short description} - short descriptive text appearing on the tab on top of window. +\par \fi0\li0 \bullet {\b Log to File/Log to Host/Don't Log radio buttons} - let you specify where to forward the events matching criteria below. +\par \fi0\li0 \bullet {\b File/Host name} - Either file name for logging or host name to forward syslog messages to. (note: host address lookups are performed by blocking call, so if you it takes time to resolve host from it's name {\b Klog} may seem to lock up for a while) +\par \fi0\li0 \bullet {\b IP/mask pairs list} - lets you enter ip address/netmask pairs to specify access list for this destination. If none are entered \endash all hosts activities are logged into selected destination. +\par \fi0\li0 \bullet {\b Facility/priority pattern} - may be set in two ways: either by selecting desired facility from the dropdown list and check appropriate priorities and repeat this procedure for every facility or by clicking '{\uldb edit logging pattern}{\v Pattern}' button and use the dialog box to edit logging pattern. If you have experience with logging you don't need any explanation about logging facilities/priorities what are they all about and why do you need them. If you don't, then you, probably, don't need {\b KLog}. +\par \fi0\li0 \bullet {\b Sound to play when triggered} - whenever event is logged using current destination {\b KLog} may produce the sound to make you aware of its activity. You can select any preset sound or specify your own wave file. +\par \fi0\li0 \bullet {\b Log window} - shows recent activity.\pard +\page + +\pard\plain\keepn +#{\footnote Pattern} +${\footnote Edit Logging Pattern} +{ \f1\fs18\b\sb120 Edit Logging Pattern Dialog} +\par\sa120\sb120\qj\pard \f1\fs18\sb120 Use this tabbed dialog to edit your logging pattern. Logging facilities are separated into three tabs for your convenience. Use top/left rows of buttons to turn a whole bunch of priorities/facilities, bottom/right rows of buttons to toggle the whole column/row, or simply turn on/off individual facility/priority pairs. +\page +} \ No newline at end of file diff --git a/help/klog.xml b/help/klog.xml new file mode 100644 index 0000000..f566200 --- a/dev/null +++ b/help/klog.xml @@ -0,0 +1,38 @@ + + + + Abotu KLog +

KLog is our Win32 implementation of *nix syslog daemon to support remote logging of messages from unix servers, routers, terminal servers and other syslog-enabled devices/applications.

+

+

Enjoy!

+ + +
+ + + Change of license and opening the source code + + + + Using KLog +

When you start KLog for the first time it is set to the configuration in which it will silently catch all incoming messages and display them in the log window. Scroll length in initial configuration is set to 15 lines. To learn how to modify this initial configuration you may want to proceed to the Main Window section.

+
+ + Main Window +

Essentially, main window is a tabbed collection of 'Destinations'. For each destination you can set the destination itself, events criteria and sound KLog will produce when triggered by event matching criteria.

+

Each tab consists of following fields:

+
    +
  • Short description - short descriptive text appearing on the tab on top of window.
  • +
  • Log to File/Log to Host/Don't Log radio buttons - let you specify where to forward the events matching criteria below.
  • +
  • File/Host name - Either file name for logging or host name to forward syslog messages to. (note: host address lookups are performed by blocking call, so if you it takes time to resolve host from it's name Klog may seem to lock up for a while)
  • +
  • IP/mask pairs list - lets you enter ip address/netmask pairs to specify access list for this destination. If none are entered \endash all hosts activities are logged into selected destination.
  • +
  • Facility/priority pattern - may be set in two ways: either by selecting desired facility from the dropdown list and check appropriate priorities and repeat this procedure for every facility or by clicking 'edit logging pattern' button and use the dialog box to edit logging pattern. If you have experience with logging you don't need any explanation about logging facilities/priorities what are they all about and why do you need them. If you don't, then you, probably, don't need KLog.
  • +
  • Sound to play when triggered - whenever event is logged using current destination KLog may produce the sound to make you aware of its activity. You can select any preset sound or specify your own wave file.
  • +
  • Log window - shows recent activity.
  • +
+
+ + Edit Logging Pattern Dialog +

Use this tabbed dialog to edit your logging pattern. Logging facilities are separated into three tabs for your convenience. Use top/left rows of buttons to turn a whole bunch of priorities/facilities, bottom/right rows of buttons to toggle the whole column/row, or simply turn on/off individual facility/priority pairs.

+
+
diff --git a/install/custom.rch b/install/custom.rch new file mode 100644 index 0000000..294d851 --- a/dev/null +++ b/install/custom.rch @@ -0,0 +1,10 @@ +#ifdef STATI_K +klog.ex_ rcdata discardable "../releast/klog.ex_" +#else +klog.ex_ rcdata discardable "../release/klog.ex_" +#endif +klog.cn_ rcdata discardable "../release/klog.cn_" +klog.hl_ rcdata discardable "../release/klog.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..212ad40 --- a/dev/null +++ b/install/install.cpp @@ -0,0 +1,70 @@ +#include "resource.h" +#include "../shared-code/install.h" + +#define KINAME "KLog 1.00 Beta 2" +#define SKINAME "KLog" + +BOOL Install(void) +{ +STRING dPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.", SKINAME "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(" " KINAME,"\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 " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK); + return FALSE; + } + + if(!( + INSTALLFILE(SKINAME ".ex_",path, SKINAME ".exe") && + INSTALLFILE(SKINAME ".hl_",path, SKINAME ".hlp") && + INSTALLFILE(SKINAME ".cn_",path, SKINAME ".cnt") + )){ + MessageBox(NULL,"Failed to install " KINAME "in specified directory",NULL,MB_ICONERROR|MB_OK); + return FALSE; + } + + ADDMENU("Accessories\\Klever Co.",SKINAME,path,SKINAME ".exe"); + strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",SKINAME "Path",path); + strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath",path); + +FILE* inf=CREATE_INF_FILE(path,SKINAME ".INF"); + if(!inf){ + MessageBox(NULL,"Failed to install " KINAME,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,SKINAME "Files",shortPath); + INF_REMOVE_FILE(inf,SKINAME "Files",SKINAME ".exe"); + INF_REMOVE_HELP_FILE(inf,SKINAME "Files",SKINAME); + INF_REMOVE_FILE(inf,SKINAME "Files",SKINAME ".inf"); + + INF_FILE_SECTION(inf,"kReg"); + INF_UNINSTALL_REG(inf,SKINAME); + + INF_FILE_SECTION(inf,"kMenu"); + INF_MENU_GROUP(inf,1,"Accessories\\Klever Co."); + INF_MENU_ITEM(inf,1,SKINAME); + fclose(inf); + REG_UNINSTALL_COMMAND(SKINAME,"Klever " KINAME,shortPath,SKINAME ".INF","Uninstall"); + + MessageBox(NULL,KINAME " installed successfully, you may now run it from Programs/Accessories/Klever Co. menu, move it to your Startup group 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..45bc88b --- 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 1,0,0,2 + PRODUCTVERSION 1,0,0,2 + 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: KLog, logging daemon\0" + VALUE "FileVersion", "1, 0, 0, 2\0" + VALUE "InternalName", "INSTALL\0" + VALUE "LegalCopyright", "Copyright © 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", "KLog\0" + VALUE "ProductVersion", "1, 0, 0, 2\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/klog.clw b/klog.clw new file mode 100644 index 0000000..81ae255 --- a/dev/null +++ b/klog.clw @@ -0,0 +1,502 @@ +; CLW file contains information for the MFC ClassWizard + +[General Info] +Version=1 +LastClass=CKLogDlg +LastTemplate=CDialog +NewFileInclude1=#include "stdafx.h" +NewFileInclude2=#include "KLog.h" + +ClassCount=9 +Class1=CKLogApp +Class2=CKLogDlg +Class3=CAboutDlg + +ResourceCount=7 +Resource1=IDD_LOG_LOCAL +Resource2=IDR_MAINFRAME +Class4=CTrayer +Resource3=IDD_LOG_RESERVED +Resource4=IDD_WARNBLOCKING +Resource5=IDD_LOG_UNIX +Class5=CLogPattern +Class6=CLogPatternUnix +Class7=CLogPatternReserved +Class8=CLogPatternLocal +Resource6=IDD_ABOUTBOX +Class9=CWarnBlocking +Resource7=IDD_KLOG_DIALOG + +[CLS:CKLogApp] +Type=0 +HeaderFile=KLog.h +ImplementationFile=KLog.cpp +Filter=N + +[CLS:CKLogDlg] +Type=0 +HeaderFile=KLogDlg.h +ImplementationFile=KLogDlg.cpp +Filter=W +BaseClass=CDialog +VirtualFilter=dWC +LastObject=IDC_HL_ADD + +[CLS:CAboutDlg] +Type=0 +HeaderFile=KLogDlg.h +ImplementationFile=KLogDlg.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_KLOG_DIALOG] +Type=1 +Class=CKLogDlg +ControlCount=48 +Control1=IDC_STATIC,static,1342308609 +Control2=IDC_DESC,edit,1350631552 +Control3=IDC_TYPE_FILE,button,1342312457 +Control4=IDC_TYPE_HOST,button,1342181385 +Control5=IDC_TYPE_NONE,button,1342181385 +Control6=IDC_HOSTORFILE,static,1342308353 +Control7=IDC_HOSTFILE,edit,1350631552 +Control8=IDC_BROWSE,button,1342242816 +Control9=IDC_STATIC,static,1342177296 +Control10=IDC_STATIC,static,1342308352 +Control11=IDC_STATIC,static,1342177296 +Control12=IDC_STATIC,static,1342308352 +Control13=IDC_FACILITY,combobox,1344340035 +Control14=IDC_LOGPATTERN,button,1342263104 +Control15=IDC_STATIC,button,1342194439 +Control16=IDC_EMERG,button,1342259747 +Control17=IDC_ALERT,button,1342259747 +Control18=IDC_CRIT,button,1342259747 +Control19=IDC_ERR,button,1342259747 +Control20=IDC_WARNING,button,1342259459 +Control21=IDC_NOTICE,button,1342259459 +Control22=IDC_INFO,button,1342259459 +Control23=IDC_DEBUG,button,1342259459 +Control24=IDC_ALL,button,1342242816 +Control25=IDC_NONE,button,1342242816 +Control26=IDC_INVERT,button,1342259200 +Control27=IDC_STATIC,static,1342308608 +Control28=IDC_HL_IP,edit,1350631552 +Control29=IDC_STATIC,static,1342308608 +Control30=IDC_HL_MASK,edit,1350631552 +Control31=IDC_HL_ADD,button,1342259200 +Control32=IDC_HL_REMOVE,button,1342242816 +Control33=IDC_HOSTS,listbox,1345388929 +Control34=IDC_STATIC,button,1342177287 +Control35=IDC_SOUND,combobox,1344340034 +Control36=IDC_BROWSESOUND,button,1342263104 +Control37=IDC_PLAYSOUND,button,1342263104 +Control38=IDC_LOG,listbox,1353793665 +Control39=IDC_ADD,button,1342259200 +Control40=IDC_REMOVE,button,1342242816 +Control41=IDC_EXIT,button,1342242816 +Control42=IDC_TABS,SysTabControl32,1342193664 +Control43=IDC_LOGLENGTH,static,1342308737 +Control44=IDC_LOGLENSPIN,msctls_updown32,1342177463 +Control45=IDC_STATIC_LOGLENGTH,static,1342308737 +Control46=IDOK,button,1073807361 +Control47=IDCANCEL,button,1208025088 +Control48=IDC_FILES,button,1342197504 + +[MNU:IDD_KLOG_DIALOG] +Type=1 +Class=? +Command1=ID_FILES_EXPORT +Command2=ID_FILES_IMPORT +Command3=ID_FILES_RESET +Command4=ID_FILES_EXPORT +Command5=ID_FILES_IMPORT +Command6=ID_FILES_RESET +Command7=ID_TRAY_SHOWKLOGWINDOW +Command8=ID_TRAY_HELP +Command9=ID_TRAY_ABOUTKLOG +Command10=ID_TRAY_EXIT +CommandCount=10 + +[CLS:CTrayer] +Type=0 +HeaderFile=Trayer.h +ImplementationFile=Trayer.cpp +BaseClass=generic CWnd +Filter=W +LastObject=ID_FILES_RESET + +[DLG:IDD_LOG_RESERVED] +Type=1 +Class=CLogPatternReserved +ControlCount=68 +Control1=IDC_EMERG_ON,button,1342263040 +Control2=IDC_ALERT_ON,button,1342263040 +Control3=IDC_CRIT_ON,button,1342263040 +Control4=IDC_ERR_ON,button,1342263040 +Control5=IDC_WARN_ON,button,1342263040 +Control6=IDC_NOTICE_ON,button,1342263040 +Control7=IDC_INFO_ON,button,1342263040 +Control8=IDC_DEBUG_ON,button,1342263040 +Control9=IDC_R0_ON,button,1342263040 +Control10=IDC_R1_ON,button,1342263040 +Control11=IDC_R2_ON,button,1342263040 +Control12=IDC_R3_ON,button,1342263040 +Control13=IDC_R4_ON,button,1342263040 +Control14=IDC_R0_EMERG,button,1342263299 +Control15=IDC_R0_ALERT,button,1342263299 +Control16=IDC_R0_CRIT,button,1342263299 +Control17=IDC_R0_ERR,button,1342263299 +Control18=IDC_R0_WARN,button,1342263299 +Control19=IDC_R0_NOTICE,button,1342263299 +Control20=IDC_R0_INFO,button,1342263299 +Control21=IDC_R0_DEBUG,button,1342263299 +Control22=IDC_R1_EMERG,button,1342263299 +Control23=IDC_R1_ALERT,button,1342263299 +Control24=IDC_R1_CRIT,button,1342263299 +Control25=IDC_R1_ERR,button,1342263299 +Control26=IDC_R1_WARN,button,1342263299 +Control27=IDC_R1_NOTICE,button,1342263299 +Control28=IDC_R1_INFO,button,1342263299 +Control29=IDC_R1_DEBUG,button,1342263299 +Control30=IDC_R2_EMERG,button,1342263299 +Control31=IDC_R2_ALERT,button,1342263299 +Control32=IDC_R2_CRIT,button,1342263299 +Control33=IDC_R2_ERR,button,1342263299 +Control34=IDC_R2_WARN,button,1342263299 +Control35=IDC_R2_NOTICE,button,1342263299 +Control36=IDC_R2_INFO,button,1342263299 +Control37=IDC_R2_DEBUG,button,1342263299 +Control38=IDC_R3_EMERG,button,1342263299 +Control39=IDC_R3_ALERT,button,1342263299 +Control40=IDC_R3_CRIT,button,1342263299 +Control41=IDC_R3_ERR,button,1342263299 +Control42=IDC_R3_WARN,button,1342263299 +Control43=IDC_R3_NOTICE,button,1342263299 +Control44=IDC_R3_INFO,button,1342263299 +Control45=IDC_R3_DEBUG,button,1342263299 +Control46=IDC_R4_EMERG,button,1342263299 +Control47=IDC_R4_ALERT,button,1342263299 +Control48=IDC_R4_CRIT,button,1342263299 +Control49=IDC_R4_ERR,button,1342263299 +Control50=IDC_R4_WARN,button,1342263299 +Control51=IDC_R4_NOTICE,button,1342263299 +Control52=IDC_R4_INFO,button,1342263299 +Control53=IDC_R4_DEBUG,button,1342263299 +Control54=IDC_EMERG_XOR,button,1342263040 +Control55=IDC_ALERT_XOR,button,1342263040 +Control56=IDC_CRIT_XOR,button,1342263040 +Control57=IDC_ERR_XOR,button,1342263040 +Control58=IDC_WARN_XOR,button,1342263040 +Control59=IDC_NOTICE_XOR,button,1342263040 +Control60=IDC_INFO_XOR,button,1342263040 +Control61=IDC_DEBUG_XOR,button,1342263040 +Control62=IDC_R0_XOR,button,1342263040 +Control63=IDC_R1_XOR,button,1342263040 +Control64=IDC_R2_XOR,button,1342263040 +Control65=IDC_R3_XOR,button,1342263040 +Control66=IDC_R4_XOR,button,1342263040 +Control67=IDC_STATIC,static,1342308352 +Control68=IDC_STATIC,static,1342308352 + +[DLG:IDD_LOG_UNIX] +Type=1 +Class=CLogPatternUnix +ControlCount=128 +Control1=IDC_EMERG_ON,button,1342263040 +Control2=IDC_ALERT_ON,button,1342263040 +Control3=IDC_CRIT_ON,button,1342263040 +Control4=IDC_ERR_ON,button,1342263040 +Control5=IDC_WARN_ON,button,1342263040 +Control6=IDC_NOTICE_ON,button,1342263040 +Control7=IDC_INFO_ON,button,1342263040 +Control8=IDC_DEBUG_ON,button,1342263040 +Control9=IDC_KERNEL_ON,button,1342263040 +Control10=IDC_USER_ON,button,1342263040 +Control11=IDC_MAIL_ON,button,1342263040 +Control12=IDC_DAEMON_ON,button,1342263040 +Control13=IDC_AUTH_ON,button,1342263040 +Control14=IDC_SYSLOG_ON,button,1342263040 +Control15=IDC_LPR_ON,button,1342263040 +Control16=IDC_NEWS_ON,button,1342263040 +Control17=IDC_UUCP_ON,button,1342263040 +Control18=IDC_CRON_ON,button,1342263040 +Control19=IDC_KERNEL_EMERG,button,1342263299 +Control20=IDC_KERNEL_ALERT,button,1342263299 +Control21=IDC_KERNEL_CRIT,button,1342263299 +Control22=IDC_KERNEL_ERR,button,1342263299 +Control23=IDC_KERNEL_WARN,button,1342263299 +Control24=IDC_KERNEL_NOTICE,button,1342263299 +Control25=IDC_KERNEL_INFO,button,1342263299 +Control26=IDC_KERNEL_DEBUG,button,1342263299 +Control27=IDC_USER_EMERG,button,1342263299 +Control28=IDC_USER_ALERT,button,1342263299 +Control29=IDC_USER_CRIT,button,1342263299 +Control30=IDC_USER_ERR,button,1342263299 +Control31=IDC_USER_WARN,button,1342263299 +Control32=IDC_USER_NOTICE,button,1342263299 +Control33=IDC_USER_INFO,button,1342263299 +Control34=IDC_USER_DEBUG,button,1342263299 +Control35=IDC_MAIL_EMERG,button,1342263299 +Control36=IDC_MAIL_ALERT,button,1342263299 +Control37=IDC_MAIL_CRIT,button,1342263299 +Control38=IDC_MAIL_ERR,button,1342263299 +Control39=IDC_MAIL_WARN,button,1342263299 +Control40=IDC_MAIL_NOTICE,button,1342263299 +Control41=IDC_MAIL_INFO,button,1342263299 +Control42=IDC_MAIL_DEBUG,button,1342263299 +Control43=IDC_DAEMON_EMERG,button,1342263299 +Control44=IDC_DAEMON_ALERT,button,1342263299 +Control45=IDC_DAEMON_CRIT,button,1342263299 +Control46=IDC_DAEMON_ERR,button,1342263299 +Control47=IDC_DAEMON_WARN,button,1342263299 +Control48=IDC_DAEMON_NOTICE,button,1342263299 +Control49=IDC_DAEMON_INFO,button,1342263299 +Control50=IDC_DAEMON_DEBUG,button,1342263299 +Control51=IDC_AUTH_EMERG,button,1342263299 +Control52=IDC_AUTH_ALERT,button,1342263299 +Control53=IDC_AUTH_CRIT,button,1342263299 +Control54=IDC_AUTH_ERR,button,1342263299 +Control55=IDC_AUTH_WARN,button,1342263299 +Control56=IDC_AUTH_NOTICE,button,1342263299 +Control57=IDC_AUTH_INFO,button,1342263299 +Control58=IDC_AUTH_DEBUG,button,1342263299 +Control59=IDC_SYSLOG_EMERG,button,1342263299 +Control60=IDC_SYSLOG_ALERT,button,1342263299 +Control61=IDC_SYSLOG_CRIT,button,1342263299 +Control62=IDC_SYSLOG_ERR,button,1342263299 +Control63=IDC_SYSLOG_WARN,button,1342263299 +Control64=IDC_SYSLOG_NOTICE,button,1342263299 +Control65=IDC_SYSLOG_INFO,button,1342263299 +Control66=IDC_SYSLOG_DEBUG,button,1342263299 +Control67=IDC_LPR_EMERG,button,1342263299 +Control68=IDC_LPR_ALERT,button,1342263299 +Control69=IDC_LPR_CRIT,button,1342263299 +Control70=IDC_LPR_ERR,button,1342263299 +Control71=IDC_LPR_WARN,button,1342263299 +Control72=IDC_LPR_NOTICE,button,1342263299 +Control73=IDC_LPR_INFO,button,1342263299 +Control74=IDC_LPR_DEBUG,button,1342263299 +Control75=IDC_NEWS_EMERG,button,1342263299 +Control76=IDC_NEWS_ALERT,button,1342263299 +Control77=IDC_NEWS_CRIT,button,1342263299 +Control78=IDC_NEWS_ERR,button,1342263299 +Control79=IDC_NEWS_WARN,button,1342263299 +Control80=IDC_NEWS_NOTICE,button,1342263299 +Control81=IDC_NEWS_INFO,button,1342263299 +Control82=IDC_NEWS_DEBUG,button,1342263299 +Control83=IDC_UUCP_EMERG,button,1342263299 +Control84=IDC_UUCP_ALERT,button,1342263299 +Control85=IDC_UUCP_CRIT,button,1342263299 +Control86=IDC_UUCP_ERR,button,1342263299 +Control87=IDC_UUCP_WARN,button,1342263299 +Control88=IDC_UUCP_NOTICE,button,1342263299 +Control89=IDC_UUCP_INFO,button,1342263299 +Control90=IDC_UUCP_DEBUG,button,1342263299 +Control91=IDC_CRON_EMERG,button,1342263299 +Control92=IDC_CRON_ALERT,button,1342263299 +Control93=IDC_CRON_CRIT,button,1342263299 +Control94=IDC_CRON_ERR,button,1342263299 +Control95=IDC_CRON_WARN,button,1342263299 +Control96=IDC_CRON_NOTICE,button,1342263299 +Control97=IDC_CRON_INFO,button,1342263299 +Control98=IDC_CRON_DEBUG,button,1342263299 +Control99=IDC_EMERG_XOR,button,1342263040 +Control100=IDC_ALERT_XOR,button,1342263040 +Control101=IDC_CRIT_XOR,button,1342263040 +Control102=IDC_ERR_XOR,button,1342263040 +Control103=IDC_WARN_XOR,button,1342263040 +Control104=IDC_NOTICE_XOR,button,1342263040 +Control105=IDC_INFO_XOR,button,1342263040 +Control106=IDC_DEBUG_XOR,button,1342263040 +Control107=IDC_KERNEL_XOR,button,1342263040 +Control108=IDC_USER_XOR,button,1342263040 +Control109=IDC_MAIL_XOR,button,1342263040 +Control110=IDC_DAEMON_XOR,button,1342263040 +Control111=IDC_AUTH_XOR,button,1342263040 +Control112=IDC_SYSLOG_XOR,button,1342263040 +Control113=IDC_LPR_XOR,button,1342263040 +Control114=IDC_NEWS_XOR,button,1342263040 +Control115=IDC_UUCP_XOR,button,1342263040 +Control116=IDC_CRON_XOR,button,1342263040 +Control117=IDC_STATIC,static,1342308352 +Control118=IDC_STATIC,static,1342308352 +Control119=IDC_AUTHPRIV_ON,button,1342263040 +Control120=IDC_AUTHPRIV_EMERG,button,1342263299 +Control121=IDC_AUTHPRIV_ALERT,button,1342263299 +Control122=IDC_AUTHPRIV_CRIT,button,1342263299 +Control123=IDC_AUTHPRIV_ERR,button,1342263299 +Control124=IDC_AUTHPRIV_WARN,button,1342263299 +Control125=IDC_AUTHPRIV_NOTICE,button,1342263299 +Control126=IDC_AUTHPRIV_INFO,button,1342263299 +Control127=IDC_AUTHPRIV_DEBUG,button,1342263299 +Control128=IDC_AUTHPRIV_XOR,button,1342263040 + +[DLG:IDD_LOG_LOCAL] +Type=1 +Class=CLogPatternLocal +ControlCount=98 +Control1=IDC_EMERG_ON,button,1342263040 +Control2=IDC_ALERT_ON,button,1342263040 +Control3=IDC_CRIT_ON,button,1342263040 +Control4=IDC_ERR_ON,button,1342263040 +Control5=IDC_WARN_ON,button,1342263040 +Control6=IDC_NOTICE_ON,button,1342263040 +Control7=IDC_INFO_ON,button,1342263040 +Control8=IDC_DEBUG_ON,button,1342263040 +Control9=IDC_L0_ON,button,1342263040 +Control10=IDC_L1_ON,button,1342263040 +Control11=IDC_L2_ON,button,1342263040 +Control12=IDC_L3_ON,button,1342263040 +Control13=IDC_L4_ON,button,1342263040 +Control14=IDC_L5_ON,button,1342263040 +Control15=IDC_L6_ON,button,1342263040 +Control16=IDC_L7_ON,button,1342263040 +Control17=IDC_L0_EMERG,button,1342263299 +Control18=IDC_L0_ALERT,button,1342263299 +Control19=IDC_L0_CRIT,button,1342263299 +Control20=IDC_L0_ERR,button,1342263299 +Control21=IDC_L0_WARN,button,1342263299 +Control22=IDC_L0_NOTICE,button,1342263299 +Control23=IDC_L0_INFO,button,1342263299 +Control24=IDC_L0_DEBUG,button,1342263299 +Control25=IDC_L1_EMERG,button,1342263299 +Control26=IDC_L1_ALERT,button,1342263299 +Control27=IDC_L1_CRIT,button,1342263299 +Control28=IDC_L1_ERR,button,1342263299 +Control29=IDC_L1_WARN,button,1342263299 +Control30=IDC_L1_NOTICE,button,1342263299 +Control31=IDC_L1_INFO,button,1342263299 +Control32=IDC_L1_DEBUG,button,1342263299 +Control33=IDC_L2_EMERG,button,1342263299 +Control34=IDC_L2_ALERT,button,1342263299 +Control35=IDC_L2_CRIT,button,1342263299 +Control36=IDC_L2_ERR,button,1342263299 +Control37=IDC_L2_WARN,button,1342263299 +Control38=IDC_L2_NOTICE,button,1342263299 +Control39=IDC_L2_INFO,button,1342263299 +Control40=IDC_L2_DEBUG,button,1342263299 +Control41=IDC_L3_EMERG,button,1342263299 +Control42=IDC_L3_ALERT,button,1342263299 +Control43=IDC_L3_CRIT,button,1342263299 +Control44=IDC_L3_ERR,button,1342263299 +Control45=IDC_L3_WARN,button,1342263299 +Control46=IDC_L3_NOTICE,button,1342263299 +Control47=IDC_L3_INFO,button,1342263299 +Control48=IDC_L3_DEBUG,button,1342263299 +Control49=IDC_L4_EMERG,button,1342263299 +Control50=IDC_L4_ALERT,button,1342263299 +Control51=IDC_L4_CRIT,button,1342263299 +Control52=IDC_L4_ERR,button,1342263299 +Control53=IDC_L4_WARN,button,1342263299 +Control54=IDC_L4_NOTICE,button,1342263299 +Control55=IDC_L4_INFO,button,1342263299 +Control56=IDC_L4_DEBUG,button,1342263299 +Control57=IDC_L5_EMERG,button,1342263299 +Control58=IDC_L5_ALERT,button,1342263299 +Control59=IDC_L5_CRIT,button,1342263299 +Control60=IDC_L5_ERR,button,1342263299 +Control61=IDC_L5_WARN,button,1342263299 +Control62=IDC_L5_NOTICE,button,1342263299 +Control63=IDC_L5_INFO,button,1342263299 +Control64=IDC_L5_DEBUG,button,1342263299 +Control65=IDC_L6_EMERG,button,1342263299 +Control66=IDC_L6_ALERT,button,1342263299 +Control67=IDC_L6_CRIT,button,1342263299 +Control68=IDC_L6_ERR,button,1342263299 +Control69=IDC_L6_WARN,button,1342263299 +Control70=IDC_L6_NOTICE,button,1342263299 +Control71=IDC_L6_INFO,button,1342263299 +Control72=IDC_L6_DEBUG,button,1342263299 +Control73=IDC_L7_EMERG,button,1342263299 +Control74=IDC_L7_ALERT,button,1342263299 +Control75=IDC_L7_CRIT,button,1342263299 +Control76=IDC_L7_ERR,button,1342263299 +Control77=IDC_L7_WARN,button,1342263299 +Control78=IDC_L7_NOTICE,button,1342263299 +Control79=IDC_L7_INFO,button,1342263299 +Control80=IDC_L7_DEBUG,button,1342263299 +Control81=IDC_EMERG_XOR,button,1342263040 +Control82=IDC_ALERT_XOR,button,1342263040 +Control83=IDC_CRIT_XOR,button,1342263040 +Control84=IDC_ERR_XOR,button,1342263040 +Control85=IDC_WARN_XOR,button,1342263040 +Control86=IDC_NOTICE_XOR,button,1342263040 +Control87=IDC_INFO_XOR,button,1342263040 +Control88=IDC_DEBUG_XOR,button,1342263040 +Control89=IDC_L0_XOR,button,1342263040 +Control90=IDC_L1_XOR,button,1342263040 +Control91=IDC_L2_XOR,button,1342263040 +Control92=IDC_L3_XOR,button,1342263040 +Control93=IDC_L4_XOR,button,1342263040 +Control94=IDC_L5_XOR,button,1342263040 +Control95=IDC_L6_XOR,button,1342263040 +Control96=IDC_L7_XOR,button,1342263040 +Control97=IDC_STATIC,static,1342308352 +Control98=IDC_STATIC,static,1342308352 + +[CLS:CLogPattern] +Type=0 +HeaderFile=LogPattern.h +ImplementationFile=LogPattern.cpp +BaseClass=CPropertySheet +Filter=W +LastObject=CLogPattern + +[CLS:CLogPatternUnix] +Type=0 +HeaderFile=LogPatternUnix.h +ImplementationFile=LogPatternUnix.cpp +BaseClass=CPropertyPage +Filter=D +LastObject=CLogPatternUnix +VirtualFilter=idWC + +[CLS:CLogPatternReserved] +Type=0 +HeaderFile=LogPatternReserved.h +ImplementationFile=LogPatternReserved.cpp +BaseClass=CPropertyPage +Filter=D +LastObject=IDC_WARN_XOR +VirtualFilter=idWC + +[CLS:CLogPatternLocal] +Type=0 +HeaderFile=LogPatternLocal.h +ImplementationFile=LogPatternLocal.cpp +BaseClass=CPropertyPage +Filter=D +LastObject=CLogPatternLocal +VirtualFilter=idWC + +[DLG:IDD_WARNBLOCKING] +Type=1 +Class=CWarnBlocking +ControlCount=5 +Control1=IDOK,button,1342242817 +Control2=IDCANCEL,button,1342242816 +Control3=IDC_STATIC,static,1342308352 +Control4=IDC_STATIC,static,1342308352 +Control5=IDC_WARNBLOCKING,button,1342254595 + +[CLS:CWarnBlocking] +Type=0 +HeaderFile=WarnBlocking.h +ImplementationFile=WarnBlocking.cpp +BaseClass=CDialog +Filter=D +VirtualFilter=dWC +LastObject=CWarnBlocking + diff --git a/klog.cpp b/klog.cpp new file mode 100644 index 0000000..1f6861d --- a/dev/null +++ b/klog.cpp @@ -0,0 +1,70 @@ +// KLog.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "KLog.h" +#include "SyslogSocket.h" +#include "KLogDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CKLogApp + +BEGIN_MESSAGE_MAP(CKLogApp, CWinApp) + //{{AFX_MSG_MAP(CKLogApp) + //}}AFX_MSG + ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CKLogApp construction + +CKLogApp::CKLogApp() +{ +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CKLogApp object + +CKLogApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CKLogApp initialization + +BOOL CKLogApp::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 + + SetRegistryKey(IDS_REGISTRYKEY); + m_HelpFile = m_pszHelpFilePath; + m_HelpFile+=">Standard"; + m_pszHelpFilePath=(LPCTSTR)m_HelpFile; + + CKLogDlg dlg; + m_pMainWnd = &dlg; + int nResponse = dlg.DoModal(); + + // 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/klog.h b/klog.h new file mode 100644 index 0000000..988dd92 --- a/dev/null +++ b/klog.h @@ -0,0 +1,36 @@ +// KLog.h : main header file for the KLOG application +// + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CKLogApp: +// See KLog.cpp for the implementation of this class +// + +class CKLogApp : public CWinApp +{ +public: + CString m_HelpFile; + CKLogApp(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CKLogApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CKLogApp) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// diff --git a/klog.mak b/klog.mak new file mode 100644 index 0000000..23ac3fe --- a/dev/null +++ b/klog.mak @@ -0,0 +1,1254 @@ +# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Application" 0x0101 + +!IF "$(CFG)" == "" +CFG=Install - Win32 Debug +!MESSAGE No configuration specified. Defaulting to Install - Win32 Debug. +!ENDIF + +!IF "$(CFG)" != "KLog - Win32 Release" && "$(CFG)" != "KLog - Win32 Debug" &&\ + "$(CFG)" != "KLog - Win32 Static Release" && "$(CFG)" !=\ + "Install - Win32 Debug" && "$(CFG)" != "Install - Win32 Pure" && "$(CFG)" !=\ + "Install - Win32 Canned" && "$(CFG)" != "Install - Win32 Static" +!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 "klog.mak" CFG="Install - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "KLog - Win32 Release" (based on "Win32 (x86) Application") +!MESSAGE "KLog - Win32 Debug" (based on "Win32 (x86) Application") +!MESSAGE "KLog - Win32 Static Release" (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 Canned" (based on "Win32 (x86) Application") +!MESSAGE "Install - Win32 Static" (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 "Install - Win32 Static" +CPP=cl.exe +RSC=rc.exe +MTL=mktyplib.exe + +!IF "$(CFG)" == "KLog - 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=klog +# End Custom Macros + +ALL : "$(OUTDIR)\klog.exe" "$(OUTDIR)\klog.ex_" "$(OUTDIR)\klog.hlp"\ + "$(OUTDIR)\klog.cnt" "$(OUTDIR)\klog.hl_" "$(OUTDIR)\klog.cn_" + +CLEAN : + -@erase "$(INTDIR)\klog.cn_" + -@erase "$(INTDIR)\klog.cnt" + -@erase "$(INTDIR)\klog.hl_" + -@erase "$(INTDIR)\klog.hlp" + -@erase "$(INTDIR)\KLog.obj" + -@erase "$(INTDIR)\klog.pch" + -@erase "$(INTDIR)\KLog.res" + -@erase "$(INTDIR)\KLogDlg.obj" + -@erase "$(INTDIR)\LogPattern.obj" + -@erase "$(INTDIR)\LogPatternLocal.obj" + -@erase "$(INTDIR)\LogPatternReserved.obj" + -@erase "$(INTDIR)\LogPatternUnix.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\SyslogSocket.obj" + -@erase "$(INTDIR)\Trayer.obj" + -@erase "$(INTDIR)\WarnBlocking.obj" + -@erase "$(OUTDIR)\klog.ex_" + -@erase "$(OUTDIR)\klog.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)/klog.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)/KLog.res" /d "NDEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/klog.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=/nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/klog.pdb" /machine:I386 /out:"$(OUTDIR)/klog.exe" +LINK32_OBJS= \ + "$(INTDIR)\KLog.obj" \ + "$(INTDIR)\KLog.res" \ + "$(INTDIR)\KLogDlg.obj" \ + "$(INTDIR)\LogPattern.obj" \ + "$(INTDIR)\LogPatternLocal.obj" \ + "$(INTDIR)\LogPatternReserved.obj" \ + "$(INTDIR)\LogPatternUnix.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\SyslogSocket.obj" \ + "$(INTDIR)\Trayer.obj" \ + "$(INTDIR)\WarnBlocking.obj" + +"$(OUTDIR)\klog.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +# Begin Custom Build +OutDir=.\Release +TargetName=klog +InputPath=.\Release\klog.exe +SOURCE=$(InputPath) + +"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_ + +# End Custom Build + +!ELSEIF "$(CFG)" == "KLog - 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=klog +# End Custom Macros + +ALL : "$(OUTDIR)\klog.exe" "$(OUTDIR)\klog.ex_" "$(OUTDIR)\klog.hlp"\ + "$(OUTDIR)\klog.cnt" "$(OUTDIR)\klog.hl_" "$(OUTDIR)\klog.cn_" + +CLEAN : + -@erase "$(INTDIR)\klog.cn_" + -@erase "$(INTDIR)\klog.cnt" + -@erase "$(INTDIR)\klog.hl_" + -@erase "$(INTDIR)\klog.hlp" + -@erase "$(INTDIR)\KLog.obj" + -@erase "$(INTDIR)\klog.pch" + -@erase "$(INTDIR)\KLog.res" + -@erase "$(INTDIR)\KLogDlg.obj" + -@erase "$(INTDIR)\LogPattern.obj" + -@erase "$(INTDIR)\LogPatternLocal.obj" + -@erase "$(INTDIR)\LogPatternReserved.obj" + -@erase "$(INTDIR)\LogPatternUnix.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\SyslogSocket.obj" + -@erase "$(INTDIR)\Trayer.obj" + -@erase "$(INTDIR)\vc40.idb" + -@erase "$(INTDIR)\vc40.pdb" + -@erase "$(INTDIR)\WarnBlocking.obj" + -@erase "$(OUTDIR)\klog.ex_" + -@erase "$(OUTDIR)\klog.exe" + -@erase "$(OUTDIR)\klog.ilk" + -@erase "$(OUTDIR)\klog.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)/klog.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)/KLog.res" /d "_DEBUG" /d "_AFXDLL" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/klog.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=/nologo /subsystem:windows /incremental:yes\ + /pdb:"$(OUTDIR)/klog.pdb" /debug /machine:I386 /out:"$(OUTDIR)/klog.exe" +LINK32_OBJS= \ + "$(INTDIR)\KLog.obj" \ + "$(INTDIR)\KLog.res" \ + "$(INTDIR)\KLogDlg.obj" \ + "$(INTDIR)\LogPattern.obj" \ + "$(INTDIR)\LogPatternLocal.obj" \ + "$(INTDIR)\LogPatternReserved.obj" \ + "$(INTDIR)\LogPatternUnix.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\SyslogSocket.obj" \ + "$(INTDIR)\Trayer.obj" \ + "$(INTDIR)\WarnBlocking.obj" + +"$(OUTDIR)\klog.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +# Begin Custom Build +OutDir=.\Debug +TargetName=klog +InputPath=.\Debug\klog.exe +SOURCE=$(InputPath) + +"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_ + +# End Custom Build + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + +# PROP BASE Use_MFC 6 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "KLog___W" +# PROP BASE Intermediate_Dir "KLog___W" +# 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=klog +# End Custom Macros + +ALL : "$(OUTDIR)\klog.exe" "$(OUTDIR)\klog.hlp" "$(OUTDIR)\klog.cnt"\ + "$(OUTDIR)\klog.hl_" "$(OUTDIR)\klog.cn_" "$(OUTDIR)\klog.ex_" + +CLEAN : + -@erase "$(INTDIR)\klog.cn_" + -@erase "$(INTDIR)\klog.cnt" + -@erase "$(INTDIR)\klog.hl_" + -@erase "$(INTDIR)\klog.hlp" + -@erase "$(INTDIR)\KLog.obj" + -@erase "$(INTDIR)\klog.pch" + -@erase "$(INTDIR)\KLog.res" + -@erase "$(INTDIR)\KLogDlg.obj" + -@erase "$(INTDIR)\LogPattern.obj" + -@erase "$(INTDIR)\LogPatternLocal.obj" + -@erase "$(INTDIR)\LogPatternReserved.obj" + -@erase "$(INTDIR)\LogPatternUnix.obj" + -@erase "$(INTDIR)\StdAfx.obj" + -@erase "$(INTDIR)\SyslogSocket.obj" + -@erase "$(INTDIR)\Trayer.obj" + -@erase "$(INTDIR)\WarnBlocking.obj" + -@erase "$(OUTDIR)\klog.ex_" + -@erase "$(OUTDIR)\klog.exe" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +# ADD BASE CPP /nologo /MD /W3 /GX /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)/klog.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)/KLog.res" /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +BSC32_FLAGS=/nologo /o"$(OUTDIR)/klog.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=/nologo /subsystem:windows /incremental:no\ + /pdb:"$(OUTDIR)/klog.pdb" /machine:I386 /out:"$(OUTDIR)/klog.exe" +LINK32_OBJS= \ + "$(INTDIR)\KLog.obj" \ + "$(INTDIR)\KLog.res" \ + "$(INTDIR)\KLogDlg.obj" \ + "$(INTDIR)\LogPattern.obj" \ + "$(INTDIR)\LogPatternLocal.obj" \ + "$(INTDIR)\LogPatternReserved.obj" \ + "$(INTDIR)\LogPatternUnix.obj" \ + "$(INTDIR)\StdAfx.obj" \ + "$(INTDIR)\SyslogSocket.obj" \ + "$(INTDIR)\Trayer.obj" \ + "$(INTDIR)\WarnBlocking.obj" + +"$(OUTDIR)\klog.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +# Begin Custom Build +OutDir=.\Releast +TargetName=klog +InputPath=.\Releast\klog.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 2 +# 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 : "KLog - 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 /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c +CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\ + /D "_AFXDLL" /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" /d "_AFXDLL" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "_DEBUG" /d "_AFXDLL" +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 shell32.lib version.lib advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib version.lib\ + advapi32.lib uuid.lib ole32.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 2 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Install\Pure" +# PROP BASE Intermediate_Dir "Install\Pure" +# PROP BASE Target_Dir "Install" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 0 +# 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 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c +CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c +CPP_OBJS=.\Install\Pure/ +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)/Install.res" /d "NDEBUG" /d "_AFXDLL" +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 /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib version.lib advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib version.lib\ + advapi32.lib uuid.lib ole32.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 2 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Install\Canned" +# PROP BASE Intermediate_Dir "Install\Canned" +# PROP BASE Target_Dir "Install" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 0 +# 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 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "K_ANNED" /YX /c +CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_AFXDLL" /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" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" /d "K_ANNED" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "_AFXDLL" /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 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib version.lib advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib version.lib\ + advapi32.lib uuid.lib ole32.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 2 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Install\Static" +# PROP BASE Intermediate_Dir "Install\Static" +# PROP BASE Target_Dir "Install" +# PROP Use_MFC 2 +# PROP Use_Debug_Libraries 0 +# 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 /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c +# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "STATI_K" /YX /c +CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_AFXDLL" /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" /win32 +MTL_PROJ=/nologo /D "NDEBUG" /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" +# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" /d "STATI_K" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "_AFXDLL" /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 /nologo /subsystem:windows /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib version.lib advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /machine:I386 +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib version.lib\ + advapi32.lib uuid.lib ole32.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 "KLog - Win32 Release" +# Name "KLog - Win32 Debug" +# Name "KLog - Win32 Static Release" + +!IF "$(CFG)" == "KLog - Win32 Release" + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + +!ENDIF + +################################################################################ +# Begin Source File + +SOURCE=.\KLog.cpp +DEP_CPP_KLOG_=\ + ".\KLog.h"\ + ".\KLogDlg.h"\ + ".\stdafx.h"\ + ".\SyslogSocket.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\KLog.obj" : $(SOURCE) $(DEP_CPP_KLOG_) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\KLog.obj" : $(SOURCE) $(DEP_CPP_KLOG_) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\KLog.obj" : $(SOURCE) $(DEP_CPP_KLOG_) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\KLogDlg.cpp +DEP_CPP_KLOGD=\ + ".\KLog.h"\ + ".\KLogDlg.h"\ + ".\LogPattern.h"\ + ".\stdafx.h"\ + ".\SyslogSocket.h"\ + ".\Trayer.h"\ + ".\WarnBlocking.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\KLogDlg.obj" : $(SOURCE) $(DEP_CPP_KLOGD) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\KLogDlg.obj" : $(SOURCE) $(DEP_CPP_KLOGD) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\KLogDlg.obj" : $(SOURCE) $(DEP_CPP_KLOGD) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\StdAfx.cpp +DEP_CPP_STDAF=\ + ".\stdafx.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + +# ADD CPP /Yc"stdafx.h" + +BuildCmds= \ + $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\ + "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/klog.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c\ + $(SOURCE) \ + + +"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +"$(INTDIR)\klog.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + +# 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)/klog.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/"\ + /Fd"$(INTDIR)/" /c $(SOURCE) \ + + +"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +"$(INTDIR)\klog.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + +# 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)/klog.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \ + + +"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +"$(INTDIR)\klog.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)" + $(BuildCmds) + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\klog.rc +DEP_RSC_KLOG_R=\ + ".\res\fear.wav"\ + ".\res\glass.wav"\ + ".\res\kick.wav"\ + ".\res\klog-icon.ico"\ + ".\res\klog-triggered-icon.ico"\ + ".\res\KLog.ico"\ + ".\res\klog.rc2"\ + ".\res\log-pattern.ico"\ + ".\res\meow.wav"\ + ".\shared-data\browse-icon.ico"\ + ".\shared-data\klever-background.bmp"\ + ".\shared-data\play-icon.ico"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\KLog.res" : $(SOURCE) $(DEP_RSC_KLOG_R) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\KLog.res" : $(SOURCE) $(DEP_RSC_KLOG_R) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\KLog.res" : $(SOURCE) $(DEP_RSC_KLOG_R) "$(INTDIR)" + $(RSC) $(RSC_PROJ) $(SOURCE) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\help\klog.hpj + +!IF "$(CFG)" == "KLog - Win32 Release" + +# Begin Custom Build - Making help file... +OutDir=.\Release +ProjDir=. +TargetName=klog +InputPath=.\help\klog.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)" == "KLog - Win32 Debug" + +# Begin Custom Build - Making help file... +OutDir=.\Debug +ProjDir=. +TargetName=klog +InputPath=.\help\klog.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)" == "KLog - Win32 Static Release" + +# Begin Custom Build - Making help file... +OutDir=.\Releast +ProjDir=. +TargetName=klog +InputPath=.\help\klog.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=.\SyslogSocket.cpp +DEP_CPP_SYSLO=\ + ".\stdafx.h"\ + ".\SyslogSocket.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\SyslogSocket.obj" : $(SOURCE) $(DEP_CPP_SYSLO) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\SyslogSocket.obj" : $(SOURCE) $(DEP_CPP_SYSLO) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\SyslogSocket.obj" : $(SOURCE) $(DEP_CPP_SYSLO) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\Trayer.cpp +DEP_CPP_TRAYE=\ + ".\KLog.h"\ + ".\KLogDlg.h"\ + ".\stdafx.h"\ + ".\SyslogSocket.h"\ + ".\Trayer.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LogPattern.cpp +DEP_CPP_LOGPA=\ + ".\KLog.h"\ + ".\LogPattern.h"\ + ".\LogPatternLocal.h"\ + ".\LogPatternReserved.h"\ + ".\LogPatternUnix.h"\ + ".\stdafx.h"\ + ".\SyslogSocket.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\LogPattern.obj" : $(SOURCE) $(DEP_CPP_LOGPA) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\LogPattern.obj" : $(SOURCE) $(DEP_CPP_LOGPA) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\LogPattern.obj" : $(SOURCE) $(DEP_CPP_LOGPA) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LogPatternUnix.cpp +DEP_CPP_LOGPAT=\ + ".\KLog.h"\ + ".\LogPattern.h"\ + ".\LogPatternUnix.h"\ + ".\stdafx.h"\ + ".\SyslogSocket.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\LogPatternUnix.obj" : $(SOURCE) $(DEP_CPP_LOGPAT) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\LogPatternUnix.obj" : $(SOURCE) $(DEP_CPP_LOGPAT) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\LogPatternUnix.obj" : $(SOURCE) $(DEP_CPP_LOGPAT) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LogPatternReserved.cpp +DEP_CPP_LOGPATT=\ + ".\KLog.h"\ + ".\LogPattern.h"\ + ".\LogPatternReserved.h"\ + ".\stdafx.h"\ + ".\SyslogSocket.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\LogPatternReserved.obj" : $(SOURCE) $(DEP_CPP_LOGPATT) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\LogPatternReserved.obj" : $(SOURCE) $(DEP_CPP_LOGPATT) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\LogPatternReserved.obj" : $(SOURCE) $(DEP_CPP_LOGPATT) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LogPatternLocal.cpp +DEP_CPP_LOGPATTE=\ + ".\KLog.h"\ + ".\LogPattern.h"\ + ".\LogPatternLocal.h"\ + ".\stdafx.h"\ + ".\SyslogSocket.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\LogPatternLocal.obj" : $(SOURCE) $(DEP_CPP_LOGPATTE) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\LogPatternLocal.obj" : $(SOURCE) $(DEP_CPP_LOGPATTE) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\LogPatternLocal.obj" : $(SOURCE) $(DEP_CPP_LOGPATTE) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ENDIF + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\WarnBlocking.cpp +DEP_CPP_WARNB=\ + ".\KLog.h"\ + ".\stdafx.h"\ + ".\WarnBlocking.h"\ + + +!IF "$(CFG)" == "KLog - Win32 Release" + + +"$(INTDIR)\WarnBlocking.obj" : $(SOURCE) $(DEP_CPP_WARNB) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Debug" + + +"$(INTDIR)\WarnBlocking.obj" : $(SOURCE) $(DEP_CPP_WARNB) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ELSEIF "$(CFG)" == "KLog - Win32 Static Release" + + +"$(INTDIR)\WarnBlocking.obj" : $(SOURCE) $(DEP_CPP_WARNB) "$(INTDIR)"\ + "$(INTDIR)\klog.pch" + + +!ENDIF + +# End Source File +# End Target +################################################################################ +# Begin Target + +# Name "Install - Win32 Debug" +# Name "Install - Win32 Pure" +# Name "Install - Win32 Canned" +# Name "Install - Win32 Static" + +!IF "$(CFG)" == "Install - Win32 Debug" + +!ELSEIF "$(CFG)" == "Install - Win32 Pure" + +!ELSEIF "$(CFG)" == "Install - Win32 Canned" + +!ELSEIF "$(CFG)" == "Install - Win32 Static" + +!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" /d\ + "_AFXDLL" $(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" /d\ + "_AFXDLL" $(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\ + "_AFXDLL" /d "K_ANNED" $(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\ + "_AFXDLL" /d "STATI_K" $(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 Canned" + + +"$(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) + + +!ENDIF + +# End Source File +################################################################################ +# Begin Project Dependency + +# Project_Dep_Name "KLog" + +!IF "$(CFG)" == "Install - Win32 Debug" + +"KLog - Win32 Debug" : + $(MAKE) /$(MAKEFLAGS) /F ".\klog.mak" CFG="KLog - Win32 Debug" + +!ELSEIF "$(CFG)" == "Install - Win32 Pure" + +!ELSEIF "$(CFG)" == "Install - Win32 Canned" + +!ELSEIF "$(CFG)" == "Install - Win32 Static" + +!ENDIF + +# End Project Dependency +# End Target +# End Project +################################################################################ diff --git a/klog.rc b/klog.rc new file mode 100644 index 0000000..4b61320 --- a/dev/null +++ b/klog.rc @@ -0,0 +1,1150 @@ +//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\\KLog.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\\klog.ico" +IDI_BROWSE ICON DISCARDABLE "shared-data/browse-icon.ico" +IDI_PREPLAY ICON DISCARDABLE "shared-data/play-icon.ico" +IDI_KLOG ICON DISCARDABLE "res\\klog-icon.ico" +IDI_KLOG_TRIGGERED ICON DISCARDABLE "res\\klog-triggered-icon.ico" +IDI_LOGPATTERN ICON DISCARDABLE "res\\log-pattern.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 70 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About KLog" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,7,17,18,20 + LTEXT "KLog, Version 1.00 Beta 2",IDC_STATIC,40,16,119,8, + SS_NOPREFIX + LTEXT "Copyright © 1998,2002 Klever Group",IDC_STATIC,40,31,119,8 + DEFPUSHBUTTON "OK",IDOK,178,13,32,14,WS_GROUP + PUSHBUTTON "http://www.klever.net/",IDC_KLEVERNET,125,49,85,14 +END + +IDD_KLOG_DIALOG DIALOGEX 0, 0, 291, 286 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP | WS_EX_APPWINDOW +CAPTION "KLog" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + CTEXT "Short de&scription:",IDC_STATIC,11,48,78,8,SS_NOTIFY + EDITTEXT IDC_DESC,91,46,187,13,ES_AUTOHSCROLL,WS_EX_STATICEDGE + CONTROL "Log to &File",IDC_TYPE_FILE,"Button",BS_AUTORADIOBUTTON | + BS_PUSHLIKE | WS_GROUP,11,60,87,19,WS_EX_STATICEDGE + CONTROL "Log to &Host",IDC_TYPE_HOST,"Button",BS_AUTORADIOBUTTON | + BS_PUSHLIKE,101,60,87,19,WS_EX_STATICEDGE + CONTROL "&Don't Log",IDC_TYPE_NONE,"Button",BS_AUTORADIOBUTTON | + BS_PUSHLIKE,191,60,87,19,WS_EX_STATICEDGE + CTEXT "File &name:",IDC_HOSTORFILE,12,84,40,8 + EDITTEXT IDC_HOSTFILE,56,82,201,12,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BROWSE,262,82,17,13,0,WS_EX_STATICEDGE + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,12,99,13,1 + LTEXT "Log data:",IDC_STATIC,27,95,31,8 + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,60,99,218,1 + LTEXT "Fa&cility:",IDC_STATIC,19,108,27,8 + COMBOBOX IDC_FACILITY,48,106,85,104,CBS_DROPDOWNLIST | + CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "[::]",IDC_LOGPATTERN,136,106,23,12,BS_ICON | BS_CENTER | + BS_VCENTER | BS_NOTIFY,WS_EX_STATICEDGE + GROUPBOX " &Priorities: ",IDC_STATIC,162,100,92,53,BS_CENTER | + BS_NOTIFY,WS_EX_TRANSPARENT + CONTROL "emerg",IDC_EMERG,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | + BS_RIGHT | BS_NOTIFY | WS_TABSTOP,169,110,36,10 + CONTROL "alert",IDC_ALERT,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | + BS_RIGHT | BS_NOTIFY | WS_TABSTOP,169,120,36,10 + CONTROL "crit",IDC_CRIT,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | + BS_RIGHT | BS_NOTIFY | WS_TABSTOP,169,130,36,10 + CONTROL "err",IDC_ERR,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT | + BS_RIGHT | BS_NOTIFY | WS_TABSTOP,169,140,36,10 + CONTROL "warn",IDC_WARNING,"Button",BS_AUTOCHECKBOX | BS_LEFT | + BS_NOTIFY | WS_TABSTOP,209,110,36,10 + CONTROL "notice",IDC_NOTICE,"Button",BS_AUTOCHECKBOX | BS_LEFT | + BS_NOTIFY | WS_TABSTOP,209,120,36,10 + CONTROL "info",IDC_INFO,"Button",BS_AUTOCHECKBOX | BS_LEFT | + BS_NOTIFY | WS_TABSTOP,209,130,36,10 + CONTROL "debug",IDC_DEBUG,"Button",BS_AUTOCHECKBOX | BS_LEFT | + BS_NOTIFY | WS_TABSTOP,209,140,36,10 + PUSHBUTTON "all",IDC_ALL,256,105,23,12,0,WS_EX_STATICEDGE + PUSHBUTTON "none",IDC_NONE,256,119,23,12,0,WS_EX_STATICEDGE + PUSHBUTTON "invert",IDC_INVERT,256,132,23,14,BS_NOTIFY, + WS_EX_STATICEDGE + LTEXT "IP:",IDC_STATIC,20,126,10,8,SS_NOTIFY + EDITTEXT IDC_HL_IP,43,124,65,13,ES_AUTOHSCROLL + LTEXT "mask:",IDC_STATIC,20,140,20,8,SS_NOTIFY + EDITTEXT IDC_HL_MASK,43,139,65,13,ES_AUTOHSCROLL + PUSHBUTTON "add",IDC_HL_ADD,111,124,30,12,BS_NOTIFY, + WS_EX_STATICEDGE + PUSHBUTTON "remove",IDC_HL_REMOVE,111,140,30,12,0,WS_EX_STATICEDGE + LISTBOX IDC_HOSTS,12,154,140,33,LBS_USETABSTOPS | + LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL | + WS_HSCROLL | WS_TABSTOP,WS_EX_CLIENTEDGE + GROUPBOX "When &triggered play:",IDC_STATIC,161,154,117,33,0, + WS_EX_TRANSPARENT + COMBOBOX IDC_SOUND,170,167,92,66,CBS_DROPDOWN | CBS_AUTOHSCROLL | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "..",IDC_BROWSESOUND,264,160,12,12,BS_ICON | BS_CENTER | + BS_VCENTER | BS_NOTIFY,WS_EX_STATICEDGE + PUSHBUTTON "..",IDC_PLAYSOUND,264,173,12,12,BS_ICON | BS_CENTER | + BS_VCENTER | BS_NOTIFY,WS_EX_STATICEDGE + LISTBOX IDC_LOG,7,192,277,87,LBS_USETABSTOPS | LBS_NOSEL | + WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,WS_EX_DLGMODALFRAME | + WS_EX_CLIENTEDGE | WS_EX_STATICEDGE + PUSHBUTTON "&Add",IDC_ADD,7,7,39,18,BS_NOTIFY,WS_EX_CLIENTEDGE + PUSHBUTTON "&Remove",IDC_REMOVE,48,7,39,18,0,WS_EX_CLIENTEDGE + PUSHBUTTON "E&xit",IDC_EXIT,245,7,39,18,0,WS_EX_CLIENTEDGE + CONTROL "Tab1",IDC_TABS,"SysTabControl32",TCS_TOOLTIPS,7,31,277, + 161,WS_EX_CLIENTEDGE + CTEXT "10",IDC_LOGLENGTH,166,11,33,12,SS_NOPREFIX | SS_NOTIFY, + WS_EX_DLGMODALFRAME + CONTROL "Spin4",IDC_LOGLENSPIN,"msctls_updown32",UDS_WRAP | + UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | + UDS_ARROWKEYS | UDS_NOTHOUSANDS,189,11,10,12 + CTEXT "Log window length:",IDC_STATIC_LOGLENGTH,89,11,77,12, + SS_NOPREFIX | SS_NOTIFY,WS_EX_DLGMODALFRAME + DEFPUSHBUTTON "",IDOK,0,279,6,7,NOT WS_VISIBLE + PUSHBUTTON "",IDCANCEL,285,279,6,7,NOT WS_VISIBLE | WS_DISABLED + PUSHBUTTON "Files",IDC_FILES,204,7,39,18,BS_CENTER | BS_VCENTER | + BS_NOTIFY | NOT WS_TABSTOP,WS_EX_CLIENTEDGE +END + +IDD_LOG_UNIX DIALOG DISCARDABLE 0, 0, 394, 143 +STYLE DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Unix" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "emerg",IDC_EMERG_ON,7,20,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "alert",IDC_ALERT_ON,7,33,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "crit",IDC_CRIT_ON,7,46,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "err",IDC_ERR_ON,7,59,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "warn",IDC_WARN_ON,7,72,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "notice",IDC_NOTICE_ON,7,85,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "info",IDC_INFO_ON,7,98,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "debug",IDC_DEBUG_ON,7,111,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "kernel",IDC_KERNEL_ON,32,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "user",IDC_USER_ON,62,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "mail",IDC_MAIL_ON,92,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "daemon",IDC_DAEMON_ON,122,7,30,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "auth",IDC_AUTH_ON,152,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "syslog",IDC_SYSLOG_ON,182,7,30,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "lpr",IDC_LPR_ON,212,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "news",IDC_NEWS_ON,242,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "uucp",IDC_UUCP_ON,272,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "cron",IDC_CRON_ON,302,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + CONTROL "",IDC_KERNEL_EMERG,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,21,16,10 + CONTROL "",IDC_KERNEL_ALERT,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,34,16,10 + CONTROL "",IDC_KERNEL_CRIT,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,47,16,10 + CONTROL "",IDC_KERNEL_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,39,60,16,10 + CONTROL "",IDC_KERNEL_WARN,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,73,16,10 + CONTROL "",IDC_KERNEL_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,86,16,10 + CONTROL "",IDC_KERNEL_INFO,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,99,16,10 + CONTROL "",IDC_KERNEL_DEBUG,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,112,16,10 + CONTROL "",IDC_USER_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,69,21,16,10 + CONTROL "",IDC_USER_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,69,34,16,10 + CONTROL "",IDC_USER_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,69,47,16,10 + CONTROL "",IDC_USER_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,69,60,16,10 + CONTROL "",IDC_USER_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,69,73,16,10 + CONTROL "",IDC_USER_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,69,86,16,10 + CONTROL "",IDC_USER_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,69,99,16,10 + CONTROL "",IDC_USER_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,69,112,16,10 + CONTROL "",IDC_MAIL_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,99,21,16,10 + CONTROL "",IDC_MAIL_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,99,34,16,10 + CONTROL "",IDC_MAIL_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,99,47,16,10 + CONTROL "",IDC_MAIL_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,99,60,16,10 + CONTROL "",IDC_MAIL_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,99,73,16,10 + CONTROL "",IDC_MAIL_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,99,86,16,10 + CONTROL "",IDC_MAIL_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,99,99,16,10 + CONTROL "",IDC_MAIL_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,99,112,16,10 + CONTROL "",IDC_DAEMON_EMERG,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,21,16,10 + CONTROL "",IDC_DAEMON_ALERT,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,34,16,10 + CONTROL "",IDC_DAEMON_CRIT,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,47,16,10 + CONTROL "",IDC_DAEMON_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,129,60,16,10 + CONTROL "",IDC_DAEMON_WARN,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,73,16,10 + CONTROL "",IDC_DAEMON_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,86,16,10 + CONTROL "",IDC_DAEMON_INFO,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,99,16,10 + CONTROL "",IDC_DAEMON_DEBUG,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,112,16,10 + CONTROL "",IDC_AUTH_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,159,21,16,10 + CONTROL "",IDC_AUTH_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,159,34,16,10 + CONTROL "",IDC_AUTH_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,159,47,16,10 + CONTROL "",IDC_AUTH_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,159,60,16,10 + CONTROL "",IDC_AUTH_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,159,73,16,10 + CONTROL "",IDC_AUTH_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,159,86,16,10 + CONTROL "",IDC_AUTH_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,159,99,16,10 + CONTROL "",IDC_AUTH_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,159,112,16,10 + CONTROL "",IDC_SYSLOG_EMERG,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,21,16,10 + CONTROL "",IDC_SYSLOG_ALERT,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,34,16,10 + CONTROL "",IDC_SYSLOG_CRIT,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,47,16,10 + CONTROL "",IDC_SYSLOG_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,189,60,16,10 + CONTROL "",IDC_SYSLOG_WARN,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,73,16,10 + CONTROL "",IDC_SYSLOG_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,86,16,10 + CONTROL "",IDC_SYSLOG_INFO,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,99,16,10 + CONTROL "",IDC_SYSLOG_DEBUG,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,112,16,10 + CONTROL "",IDC_LPR_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,219,21,16,10 + CONTROL "",IDC_LPR_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,219,34,16,10 + CONTROL "",IDC_LPR_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,219,47,16,10 + CONTROL "",IDC_LPR_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,219,60,16,10 + CONTROL "",IDC_LPR_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,219,73,16,10 + CONTROL "",IDC_LPR_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,219,86,16,10 + CONTROL "",IDC_LPR_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,219,99,16,10 + CONTROL "",IDC_LPR_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,219,112,16,10 + CONTROL "",IDC_NEWS_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,249,21,16,10 + CONTROL "",IDC_NEWS_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,249,34,16,10 + CONTROL "",IDC_NEWS_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,249,47,16,10 + CONTROL "",IDC_NEWS_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,249,60,16,10 + CONTROL "",IDC_NEWS_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,249,73,16,10 + CONTROL "",IDC_NEWS_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,249,86,16,10 + CONTROL "",IDC_NEWS_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,249,99,16,10 + CONTROL "",IDC_NEWS_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,249,112,16,10 + CONTROL "",IDC_UUCP_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,279,21,16,10 + CONTROL "",IDC_UUCP_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,279,34,16,10 + CONTROL "",IDC_UUCP_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,279,47,16,10 + CONTROL "",IDC_UUCP_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,279,60,16,10 + CONTROL "",IDC_UUCP_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,279,73,16,10 + CONTROL "",IDC_UUCP_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,279,86,16,10 + CONTROL "",IDC_UUCP_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,279,99,16,10 + CONTROL "",IDC_UUCP_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,279,112,16,10 + CONTROL "",IDC_CRON_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,309,21,16,10 + CONTROL "",IDC_CRON_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,309,34,16,10 + CONTROL "",IDC_CRON_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,309,47,16,10 + CONTROL "",IDC_CRON_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,309,60,16,10 + CONTROL "",IDC_CRON_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,309,73,16,10 + CONTROL "",IDC_CRON_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,309,86,16,10 + CONTROL "",IDC_CRON_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,309,99,16,10 + CONTROL "",IDC_CRON_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,309,112,16,10 + PUSHBUTTON "emerg",IDC_EMERG_XOR,362,20,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "alert",IDC_ALERT_XOR,362,33,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "crit",IDC_CRIT_XOR,362,46,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "err",IDC_ERR_XOR,362,59,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "warn",IDC_WARN_XOR,362,72,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "notice",IDC_NOTICE_XOR,362,85,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "info",IDC_INFO_XOR,362,98,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "debug",IDC_DEBUG_XOR,362,111,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "kernel",IDC_KERNEL_XOR,32,124,30,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "user",IDC_USER_XOR,62,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "mail",IDC_MAIL_XOR,92,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "daemon",IDC_DAEMON_XOR,122,124,30,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "auth",IDC_AUTH_XOR,152,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "syslog",IDC_SYSLOG_XOR,182,124,30,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "lpr",IDC_LPR_XOR,212,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "news",IDC_NEWS_XOR,242,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "uucp",IDC_UUCP_XOR,272,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "cron",IDC_CRON_XOR,302,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + LTEXT "Toggle",IDC_STATIC,363,126,23,8 + LTEXT "ON",IDC_STATIC,14,9,12,8 + PUSHBUTTON "authpriv",IDC_AUTHPRIV_ON,332,7,30,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + CONTROL "",IDC_AUTHPRIV_EMERG,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,21,16,10 + CONTROL "",IDC_AUTHPRIV_ALERT,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,34,16,10 + CONTROL "",IDC_AUTHPRIV_CRIT,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,47,16,10 + CONTROL "",IDC_AUTHPRIV_ERR,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,61,16,10 + CONTROL "",IDC_AUTHPRIV_WARN,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,74,16,10 + CONTROL "",IDC_AUTHPRIV_NOTICE,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,87,16,10 + CONTROL "",IDC_AUTHPRIV_INFO,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,99,16,10 + CONTROL "",IDC_AUTHPRIV_DEBUG,"Button",BS_AUTOCHECKBOX | + BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,112,16,10 + PUSHBUTTON "authpriv",IDC_AUTHPRIV_XOR,332,124,30,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY +END + +IDD_LOG_RESERVED DIALOG DISCARDABLE 0, 0, 394, 143 +STYLE DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Reserved" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "emerg",IDC_EMERG_ON,96,20,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "alert",IDC_ALERT_ON,96,33,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "crit",IDC_CRIT_ON,96,46,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "err",IDC_ERR_ON,96,59,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "warn",IDC_WARN_ON,96,72,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "notice",IDC_NOTICE_ON,96,85,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "info",IDC_INFO_ON,96,98,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "debug",IDC_DEBUG_ON,96,111,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "0",IDC_R0_ON,121,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "1",IDC_R1_ON,151,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "2",IDC_R2_ON,181,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "3",IDC_R3_ON,211,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "4",IDC_R4_ON,241,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + CONTROL "",IDC_R0_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,128,21,16,10 + CONTROL "",IDC_R0_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,128,34,16,10 + CONTROL "",IDC_R0_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,128,47,16,10 + CONTROL "",IDC_R0_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,128,60,16,10 + CONTROL "",IDC_R0_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,128,73,16,10 + CONTROL "",IDC_R0_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,128,86,16,10 + CONTROL "",IDC_R0_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,128,99,16,10 + CONTROL "",IDC_R0_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,128,112,16,10 + CONTROL "",IDC_R1_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,158,21,16,10 + CONTROL "",IDC_R1_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,158,34,16,10 + CONTROL "",IDC_R1_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,158,47,16,10 + CONTROL "",IDC_R1_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,158,60,16,10 + CONTROL "",IDC_R1_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,158,73,16,10 + CONTROL "",IDC_R1_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,158,86,16,10 + CONTROL "",IDC_R1_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,158,99,16,10 + CONTROL "",IDC_R1_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,158,112,16,10 + CONTROL "",IDC_R2_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,188,21,16,10 + CONTROL "",IDC_R2_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,188,34,16,10 + CONTROL "",IDC_R2_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,188,47,16,10 + CONTROL "",IDC_R2_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,188,60,16,10 + CONTROL "",IDC_R2_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,188,73,16,10 + CONTROL "",IDC_R2_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,188,86,16,10 + CONTROL "",IDC_R2_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,188,99,16,10 + CONTROL "",IDC_R2_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,188,112,16,10 + CONTROL "",IDC_R3_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,218,21,16,10 + CONTROL "",IDC_R3_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,218,34,16,10 + CONTROL "",IDC_R3_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,218,47,16,10 + CONTROL "",IDC_R3_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,218,60,16,10 + CONTROL "",IDC_R3_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,218,73,16,10 + CONTROL "",IDC_R3_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,218,86,16,10 + CONTROL "",IDC_R3_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,218,99,16,10 + CONTROL "",IDC_R3_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,218,112,16,10 + CONTROL "",IDC_R4_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,248,21,16,10 + CONTROL "",IDC_R4_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,248,34,16,10 + CONTROL "",IDC_R4_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,248,47,16,10 + CONTROL "",IDC_R4_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,248,60,16,10 + CONTROL "",IDC_R4_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,248,73,16,10 + CONTROL "",IDC_R4_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,248,86,16,10 + CONTROL "",IDC_R4_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,248,99,16,10 + CONTROL "",IDC_R4_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,248,112,16,10 + PUSHBUTTON "emerg",IDC_EMERG_XOR,271,20,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "alert",IDC_ALERT_XOR,271,33,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "crit",IDC_CRIT_XOR,271,46,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "err",IDC_ERR_XOR,271,59,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "warn",IDC_WARN_XOR,271,72,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "notice",IDC_NOTICE_XOR,271,85,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "info",IDC_INFO_XOR,271,98,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "debug",IDC_DEBUG_XOR,271,111,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "0",IDC_R0_XOR,121,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "1",IDC_R1_XOR,151,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "2",IDC_R2_XOR,181,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "3",IDC_R3_XOR,211,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "4",IDC_R4_XOR,241,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + LTEXT "Toggle",IDC_STATIC,272,126,23,8 + LTEXT "ON",IDC_STATIC,103,9,12,8 +END + +IDD_LOG_LOCAL DIALOG DISCARDABLE 0, 0, 394, 143 +STYLE DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Local" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "emerg",IDC_EMERG_ON,51,20,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "alert",IDC_ALERT_ON,51,33,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "crit",IDC_CRIT_ON,51,46,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "err",IDC_ERR_ON,51,59,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "warn",IDC_WARN_ON,51,72,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "notice",IDC_NOTICE_ON,51,85,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "info",IDC_INFO_ON,51,98,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "debug",IDC_DEBUG_ON,51,111,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "0",IDC_L0_ON,76,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "1",IDC_L1_ON,106,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "2",IDC_L2_ON,136,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "3",IDC_L3_ON,166,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "4",IDC_L4_ON,196,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "5",IDC_L5_ON,226,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "6",IDC_L6_ON,256,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "7",IDC_L7_ON,286,7,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + CONTROL "",IDC_L0_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,83,21,16,10 + CONTROL "",IDC_L0_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,83,34,16,10 + CONTROL "",IDC_L0_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,83,47,16,10 + CONTROL "",IDC_L0_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,83,60,16,10 + CONTROL "",IDC_L0_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,83,73,16,10 + CONTROL "",IDC_L0_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,83,86,16,10 + CONTROL "",IDC_L0_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,83,99,16,10 + CONTROL "",IDC_L0_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,83,112,16,10 + CONTROL "",IDC_L1_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,113,21,16,10 + CONTROL "",IDC_L1_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,113,34,16,10 + CONTROL "",IDC_L1_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,113,47,16,10 + CONTROL "",IDC_L1_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,113,60,16,10 + CONTROL "",IDC_L1_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,113,73,16,10 + CONTROL "",IDC_L1_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,113,86,16,10 + CONTROL "",IDC_L1_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,113,99,16,10 + CONTROL "",IDC_L1_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,113,112,16,10 + CONTROL "",IDC_L2_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,143,21,16,10 + CONTROL "",IDC_L2_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,143,34,16,10 + CONTROL "",IDC_L2_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,143,47,16,10 + CONTROL "",IDC_L2_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,143,60,16,10 + CONTROL "",IDC_L2_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,143,73,16,10 + CONTROL "",IDC_L2_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,143,86,16,10 + CONTROL "",IDC_L2_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,143,99,16,10 + CONTROL "",IDC_L2_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,143,112,16,10 + CONTROL "",IDC_L3_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,173,21,16,10 + CONTROL "",IDC_L3_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,173,34,16,10 + CONTROL "",IDC_L3_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,173,47,16,10 + CONTROL "",IDC_L3_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,173,60,16,10 + CONTROL "",IDC_L3_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,173,73,16,10 + CONTROL "",IDC_L3_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,173,86,16,10 + CONTROL "",IDC_L3_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,173,99,16,10 + CONTROL "",IDC_L3_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,173,112,16,10 + CONTROL "",IDC_L4_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,203,21,16,10 + CONTROL "",IDC_L4_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,203,34,16,10 + CONTROL "",IDC_L4_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,203,47,16,10 + CONTROL "",IDC_L4_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,203,60,16,10 + CONTROL "",IDC_L4_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,203,73,16,10 + CONTROL "",IDC_L4_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,203,86,16,10 + CONTROL "",IDC_L4_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,203,99,16,10 + CONTROL "",IDC_L4_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,203,112,16,10 + CONTROL "",IDC_L5_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,233,21,16,10 + CONTROL "",IDC_L5_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,233,34,16,10 + CONTROL "",IDC_L5_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,233,47,16,10 + CONTROL "",IDC_L5_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,233,60,16,10 + CONTROL "",IDC_L5_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,233,73,16,10 + CONTROL "",IDC_L5_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,233,86,16,10 + CONTROL "",IDC_L5_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,233,99,16,10 + CONTROL "",IDC_L5_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,233,112,16,10 + CONTROL "",IDC_L6_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,263,21,16,10 + CONTROL "",IDC_L6_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,263,34,16,10 + CONTROL "",IDC_L6_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,263,47,16,10 + CONTROL "",IDC_L6_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,263,60,16,10 + CONTROL "",IDC_L6_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,263,73,16,10 + CONTROL "",IDC_L6_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,263,86,16,10 + CONTROL "",IDC_L6_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,263,99,16,10 + CONTROL "",IDC_L6_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,263,112,16,10 + CONTROL "",IDC_L7_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,293,21,16,10 + CONTROL "",IDC_L7_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,293,34,16,10 + CONTROL "",IDC_L7_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,293,47,16,10 + CONTROL "",IDC_L7_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,293,60,16,10 + CONTROL "",IDC_L7_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,293,73,16,10 + CONTROL "",IDC_L7_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,293,86,16,10 + CONTROL "",IDC_L7_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,293,99,16,10 + CONTROL "",IDC_L7_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | + BS_NOTIFY | WS_TABSTOP,293,112,16,10 + PUSHBUTTON "emerg",IDC_EMERG_XOR,316,20,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "alert",IDC_ALERT_XOR,316,33,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "crit",IDC_CRIT_XOR,316,46,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "err",IDC_ERR_XOR,316,59,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "warn",IDC_WARN_XOR,316,72,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "notice",IDC_NOTICE_XOR,316,85,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "info",IDC_INFO_XOR,316,98,25,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "debug",IDC_DEBUG_XOR,316,111,25,13,BS_CENTER | + BS_VCENTER | BS_NOTIFY + PUSHBUTTON "0",IDC_L0_XOR,76,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "1",IDC_L1_XOR,106,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "2",IDC_L2_XOR,136,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "3",IDC_L3_XOR,166,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "4",IDC_L4_XOR,196,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "5",IDC_L5_XOR,226,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "6",IDC_L6_XOR,256,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + PUSHBUTTON "7",IDC_L7_XOR,286,124,30,13,BS_CENTER | BS_VCENTER | + BS_NOTIFY + LTEXT "Toggle",IDC_STATIC,317,126,23,8 + LTEXT "ON",IDC_STATIC,58,9,12,8 +END + +IDD_WARNBLOCKING DIALOGEX 0, 0, 195, 88 +STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION +EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE +CAPTION " Blocking call warning" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,39,67,50,14 + PUSHBUTTON "Cancel",IDCANCEL,105,67,50,14 + LTEXT "WARNING: ",IDC_STATIC,7,7,38,8 + LTEXT "All host address lookups are performed in a blocking mode, so KLog may temporarily stop responding until host address is resolved or operation failed.", + IDC_STATIC,46,7,142,35 + CONTROL "Enough is said, no need to remind me again. Thanks.", + IDC_WARNBLOCKING,"Button",BS_AUTOCHECKBOX | BS_RIGHT | + BS_VCENTER | BS_MULTILINE | WS_TABSTOP,7,42,123,22, + WS_EX_STATICEDGE +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,2 + PRODUCTVERSION 1,0,0,2 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#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", "KLog, logging daemon\0" + VALUE "FileVersion", "1, 0, 0, 2\0" + VALUE "InternalName", "KLOG\0" + VALUE "LegalCopyright", "Copyright © 1998, 2002 Klever Group (http://www.klever.net/)\0" + VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0" + VALUE "OriginalFilename", "KLOG.EXE\0" + VALUE "ProductName", "KLog\0" + VALUE "ProductVersion", "1, 0, 0, 2\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, 210 + TOPMARGIN, 7 + BOTTOMMARGIN, 63 + END + + IDD_KLOG_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 284 + VERTGUIDE, 12 + VERTGUIDE, 278 + TOPMARGIN, 7 + BOTTOMMARGIN, 279 + HORZGUIDE, 31 + HORZGUIDE, 192 + END + + IDD_LOG_UNIX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 387 + VERTGUIDE, 32 + VERTGUIDE, 362 + TOPMARGIN, 7 + BOTTOMMARGIN, 136 + HORZGUIDE, 20 + HORZGUIDE, 124 + END + + IDD_LOG_RESERVED, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 387 + VERTGUIDE, 96 + VERTGUIDE, 121 + VERTGUIDE, 271 + VERTGUIDE, 296 + TOPMARGIN, 7 + BOTTOMMARGIN, 136 + HORZGUIDE, 20 + HORZGUIDE, 124 + END + + IDD_LOG_LOCAL, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 387 + VERTGUIDE, 51 + VERTGUIDE, 76 + VERTGUIDE, 316 + VERTGUIDE, 341 + TOPMARGIN, 7 + BOTTOMMARGIN, 136 + HORZGUIDE, 20 + HORZGUIDE, 124 + END + + IDD_WARNBLOCKING, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 188 + VERTGUIDE, 130 + TOPMARGIN, 7 + BOTTOMMARGIN, 81 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog Info +// + +IDD_KLOG_DIALOG DLGINIT +BEGIN + IDC_FACILITY, 0x403, 7, 0 +0x656b, 0x6e72, 0x6c65, "\000" + IDC_FACILITY, 0x403, 5, 0 +0x7375, 0x7265, "\000" + IDC_FACILITY, 0x403, 5, 0 +0x616d, 0x6c69, "\000" + IDC_FACILITY, 0x403, 7, 0 +0x6164, 0x6d65, 0x6e6f, "\000" + IDC_FACILITY, 0x403, 5, 0 +0x7561, 0x6874, "\000" + IDC_FACILITY, 0x403, 7, 0 +0x7973, 0x6c73, 0x676f, "\000" + IDC_FACILITY, 0x403, 4, 0 +0x706c, 0x0072, + IDC_FACILITY, 0x403, 5, 0 +0x656e, 0x7377, "\000" + IDC_FACILITY, 0x403, 5, 0 +0x7575, 0x7063, "\000" + IDC_FACILITY, 0x403, 5, 0 +0x7263, 0x6e6f, "\000" + IDC_FACILITY, 0x403, 9, 0 +0x7561, 0x6874, 0x7270, 0x7669, "\000" + IDC_FACILITY, 0x403, 10, 0 +0x6572, 0x6573, 0x7672, 0x6465, 0x0030, + IDC_FACILITY, 0x403, 10, 0 +0x6572, 0x6573, 0x7672, 0x6465, 0x0031, + IDC_FACILITY, 0x403, 10, 0 +0x6572, 0x6573, 0x7672, 0x6465, 0x0032, + IDC_FACILITY, 0x403, 10, 0 +0x6572, 0x6573, 0x7672, 0x6465, 0x0033, + IDC_FACILITY, 0x403, 10, 0 +0x6572, 0x6573, 0x7672, 0x6465, 0x0034, + IDC_FACILITY, 0x403, 7, 0 +0x6f6c, 0x6163, 0x306c, "\000" + IDC_FACILITY, 0x403, 7, 0 +0x6f6c, 0x6163, 0x316c, "\000" + IDC_FACILITY, 0x403, 7, 0 +0x6f6c, 0x6163, 0x326c, "\000" + IDC_FACILITY, 0x403, 7, 0 +0x6f6c, 0x6163, 0x336c, "\000" + IDC_FACILITY, 0x403, 7, 0 +0x6f6c, 0x6163, 0x346c, "\000" + IDC_FACILITY, 0x403, 7, 0 +0x6f6c, 0x6163, 0x356c, "\000" + IDC_FACILITY, 0x403, 7, 0 +0x6f6c, 0x6163, 0x366c, "\000" + IDC_FACILITY, 0x403, 7, 0 +0x6f6c, 0x6163, 0x376c, "\000" + IDC_SOUND, 0x403, 7, 0 +0x6d28, 0x6f65, 0x2977, "\000" + IDC_SOUND, 0x403, 8, 0 +0x6728, 0x616c, 0x7373, 0x0029, + IDC_SOUND, 0x403, 7, 0 +0x6628, 0x6165, 0x2972, "\000" + IDC_SOUND, 0x403, 7, 0 +0x6b28, 0x6369, 0x296b, "\000" + 0 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// WAVE +// + +IDW_SOUND_MEOW WAVE DISCARDABLE "res\\meow.wav" +IDW_SOUND_GLASS WAVE DISCARDABLE "res\\glass.wav" +IDW_SOUND_FEAR WAVE DISCARDABLE "res\\fear.wav" +IDW_SOUND_KICK WAVE DISCARDABLE "res\\kick.wav" + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BACKGROUND BITMAP DISCARDABLE "shared-data/klever-background.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDD_KLOG_DIALOG MENU DISCARDABLE +BEGIN + POPUP "Files" + BEGIN + MENUITEM "&Export", ID_FILES_EXPORT + MENUITEM "&Import", ID_FILES_IMPORT + MENUITEM SEPARATOR + MENUITEM "&Reset", ID_FILES_RESET + END + POPUP "Tray" + BEGIN + MENUITEM "&Export settings", ID_FILES_EXPORT + MENUITEM "&Import settings", ID_FILES_IMPORT + MENUITEM "&Reset configuration", ID_FILES_RESET + MENUITEM SEPARATOR + MENUITEM "&Show KLog Window", ID_TRAY_SHOWKLOGWINDOW + MENUITEM SEPARATOR + MENUITEM "&Help", ID_TRAY_HELP + MENUITEM "&About KLog", ID_TRAY_ABOUTKLOG + MENUITEM "E&xit", ID_TRAY_EXIT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ABOUTBOX "&About KLog..." + IDS_LOGTO_HOST "Host &name:" + IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed." + IDS_LOGTO_FILE "File &name:" + IDS_SOUND_MEOW "(meow)" + IDS_SOUND_GLASS "(glass)" + IDS_SOUND_FEAR "(fear)" + IDS_SOUND_KICK "(kick)" + IDS_WAVFILTER "Wave files (*.wav)|*.wav|All files (*.*)|*.*|" + IDS_SOUND_SELECT "Select sound" + IDS_LOGFILTER "Log files (*.log)|*.log|All files (*.*)|*.*|" +END + +STRINGTABLE DISCARDABLE +BEGIN + ID_FILES_EXPORT "Save current configuration." + ID_FILES_IMPORT "Load configuration from file" + ID_FILES_RESET "Reset to initial configuration" + ID_TRAY_SHOWKLOGWINDOW "Show/Hide KLog wondow" + ID_TRAY_HELP "Help" + ID_TRAY_ABOUTKLOG "About KLog" + ID_TRAY_EXIT "Terminate KLog" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LOG_SELECT "Log To" + IDS_LOG_EXT ".log" + IDS_KLOGFILTER "KLog files (*.klg)|*.klg|All files (*.*)|*.*|" + IDS_KLOG_EXPORT "Export to" + IDS_KLOG_IMPORT "Import from" + IDS_KLOG_EXT ".klg" + IDS_REGISTRYKEY "Klever Group, Inc." + IDS_KLEVERNET_URL "http://www.klever.net/" + IDS_TIP_LOG "%s [%s] %s.%s" + IDS_LOGTIMEFORMAT "%H:%M:%S %B %d" + IDS_LOGPATTERN_TITLE "Logging pattern" + IDS_LOGFILETIMEFORMAT "%c " + IDS_TIP_FACILITY_ON "Turn on logging for given facility" + IDS_TIP_FACILITY_XOR "Invert logging for given facility" + IDS_TIP_PRIORITY_ON "Turn on all logging for given priority" + IDS_TIP_PRIORITY_XOR "Invert logging for given priority" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDC_ADD "Add new logging destination" + IDC_REMOVE "Remove logging destination" + IDC_EXIT "Terminate KLog" + IDC_TYPE_FILE "Log to file on disk" + IDC_TYPE_HOST "Log to remote host" + IDC_TYPE_NONE "Don't log anywhere but log window" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDC_LOGLENGTH "Number of lines to keep in log window" + IDC_FILES "Import/Export KLog settings" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDC_LOG "Recent activity" + IDC_HOSTS "Hosts access list for given destination" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDC_LOGPATTERN "Edit logging pattern" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LOGFILEPRIFACEFORMAT "(%s.%s) " + IDS_LOGFILESOURCEFORMAT "[%s] " + IDS_LOGHOSTSOURCEFORMAT "[%s] " + IDS_MSG_LOOKUPFAILED "Host address lookup for '%s' failed." + IDS_MSG_FAILEDTOEXPORT "Unable to create file." + IDS_MSG_FAILEDTOIMPORT "Unable to read file." + IDS_MSG_FAILEDTOSTORE "Database is too big to store as system default." +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\klog.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/makehelp.bat b/makehelp.bat new file mode 100644 index 0000000..1e4e179 --- 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 KLOG.HPJ. >"help\klog.hm" +echo. >>"help\klog.hm" +echo // Commands (ID_* and IDM_*) >>"help\klog.hm" +makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h >>"help\klog.hm" +echo. >>"help\klog.hm" +echo // Prompts (IDP_*) >>"help\klog.hm" +makehm IDP_,HIDP_,0x30000 resource.h >>"help\klog.hm" +echo. >>"help\klog.hm" +echo // Resources (IDR_*) >>"help\klog.hm" +makehm IDR_,HIDR_,0x20000 resource.h >>"help\klog.hm" +echo. >>"help\klog.hm" +echo // Dialogs (IDD_*) >>"help\klog.hm" +makehm IDD_,HIDD_,0x20000 resource.h >>"help\klog.hm" +echo. >>"help\klog.hm" +echo // Frame Controls (IDW_*) >>"help\klog.hm" +makehm IDW_,HIDW_,0x50000 resource.h >>"help\klog.hm" +REM -- Make help for Project KLOG + +echo Building RTF file +xsltproc -o help/klog.rtf shared-code/kinhelp.xsl help/klog.xml +echo Building Win32 Help files +start /wait hcrtf -x "help\klog.hpj" +echo. +if exist Debug\nul copy "help\klog.hlp" Debug +if exist Debug\nul copy "help\klog.cnt" Debug +if exist Release\nul copy "help\klog.hlp" Release +if exist Release\nul copy "help\klog.cnt" Release +if exist Releast\nul copy "help\klog.hlp" Releast +if exist Releast\nul copy "help\klog.cnt" Releast +echo. + diff --git a/res/fear.wav b/res/fear.wav new file mode 100644 index 0000000..4c9fe3c --- a/dev/null +++ b/res/fear.wav Binary files differ diff --git a/res/glass.wav b/res/glass.wav new file mode 100644 index 0000000..ab03bc5 --- a/dev/null +++ b/res/glass.wav Binary files differ diff --git a/res/kick.wav b/res/kick.wav new file mode 100644 index 0000000..6f116c7 --- a/dev/null +++ b/res/kick.wav Binary files differ diff --git a/res/klog-icon.ico b/res/klog-icon.ico new file mode 100644 index 0000000..b04c3ae --- a/dev/null +++ b/res/klog-icon.ico Binary files differ diff --git a/res/klog-triggered-icon.ico b/res/klog-triggered-icon.ico new file mode 100644 index 0000000..c31ef68 --- a/dev/null +++ b/res/klog-triggered-icon.ico Binary files differ diff --git a/res/klog.ico b/res/klog.ico new file mode 100644 index 0000000..bdef6db --- a/dev/null +++ b/res/klog.ico Binary files differ diff --git a/res/klog.rc2 b/res/klog.rc2 new file mode 100644 index 0000000..d12f36b --- a/dev/null +++ b/res/klog.rc2 @@ -0,0 +1,13 @@ +// +// KLOG.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/log-pattern.ico b/res/log-pattern.ico new file mode 100644 index 0000000..11cc1bd --- a/dev/null +++ b/res/log-pattern.ico Binary files differ diff --git a/res/meow.wav b/res/meow.wav new file mode 100644 index 0000000..2df5f2a --- a/dev/null +++ b/res/meow.wav Binary files differ diff --git a/resource.h b/resource.h new file mode 100644 index 0000000..33cf881 --- a/dev/null +++ b/resource.h @@ -0,0 +1,370 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by KLog.rc +// +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDC_TRAYICON 101 +#define IDD_KLOG_DIALOG 102 +#define IDS_LOGTO_HOST 102 +#define IDP_SOCKETS_INIT_FAILED 103 +#define IDS_LOGTO_FILE 104 +#define IDS_SOUND_MEOW 105 +#define IDS_SOUND_GLASS 106 +#define IDS_SOUND_FEAR 107 +#define IDS_SOUND_KICK 108 +#define IDS_WAVFILTER 109 +#define IDS_SOUND_SELECT 110 +#define IDS_LOGFILTER 111 +#define IDS_LOG_SELECT 112 +#define IDS_LOG_EXT 113 +#define IDS_KLOGFILTER 114 +#define IDS_KLOG_EXPORT 115 +#define IDS_KLOG_IMPORT 116 +#define IDS_KLOG_EXT 117 +#define IDS_REGISTRYKEY 118 +#define IDS_KLEVERNET_URL 119 +#define IDS_TIP_LOG 120 +#define IDS_LOGTIMEFORMAT 121 +#define IDS_LOGPATTERN_TITLE 122 +#define IDS_LOGFILETIMEFORMAT 123 +#define IDS_TIP_FACILITY_ON 124 +#define IDS_TIP_FACILITY_XOR 125 +#define IDS_TIP_PRIORITY_ON 126 +#define IDS_TIP_PRIORITY_XOR 127 +#define IDR_MAINFRAME 128 +#define IDS_LOGFILEPRIFACEFORMAT 128 +#define IDS_LOGFILESOURCEFORMAT 129 +#define IDI_KLOG 130 +#define IDS_LOGHOSTSOURCEFORMAT 130 +#define IDI_KLOG_TRIGGERED 131 +#define IDS_MSG_LOOKUPFAILED 131 +#define IDS_MSG_FAILEDTOEXPORT 132 +#define IDS_MSG_FAILEDTOIMPORT 133 +#define IDS_MSG_FAILEDTOSTORE 134 +#define IDW_SOUND_MEOW 137 +#define IDW_SOUND_GLASS 138 +#define IDW_SOUND_FEAR 139 +#define IDI_PREPLAY 140 +#define IDW_SOUND_KICK 140 +#define IDI_BROWSE 141 +#define IDB_BACKGROUND 141 +#define IDD_LOG_UNIX 143 +#define IDD_LOG_RESERVED 144 +#define IDI_LOGPATTERN 144 +#define IDD_LOG_LOCAL 145 +#define IDD_WARNBLOCKING 146 +#define IDC_TABS 1001 +#define IDC_ADD 1002 +#define IDC_REMOVE 1003 +#define IDC_EXIT 1004 +#define IDC_TYPE_FILE 1005 +#define IDC_TYPE_HOST 1006 +#define IDC_TYPE_NONE 1007 +#define IDC_HOSTORFILE 1008 +#define IDC_HOSTFILE 1009 +#define IDC_BROWSE 1010 +#define IDC_DESC 1011 +#define IDC_FACILITY 1017 +#define IDC_EMERG 1018 +#define IDC_ALERT 1019 +#define IDC_CRIT 1020 +#define IDC_ERR 1021 +#define IDC_WARNING 1022 +#define IDC_WARN_ON 1022 +#define IDC_NOTICE 1023 +#define IDC_WARN_XOR 1023 +#define IDC_INFO 1024 +#define IDC_DEBUG 1025 +#define IDC_BROWSESOUND 1027 +#define IDC_SOUND 1028 +#define IDC_LOG 1029 +#define IDC_PLAYSOUND 1030 +#define IDC_ALL 1031 +#define IDC_NONE 1032 +#define IDC_HOSTS 1034 +#define IDC_HL_IP 1035 +#define IDC_HL_MASK 1036 +#define IDC_HL_ADD 1037 +#define IDC_HL_REMOVE 1038 +#define IDC_INVERT 1040 +#define IDC_LOGLENSPIN 1047 +#define IDC_LOGLENGTH 1048 +#define IDC_FILES 1052 +#define IDC_KLEVERNET 1053 +#define IDC_STATIC_LOGLENGTH 1054 +#define IDC_EMERG_ON 1058 +#define IDC_ALERT_ON 1059 +#define IDC_CRIT_ON 1060 +#define IDC_ERR_ON 1061 +#define IDC_NOTICE_ON 1062 +#define IDC_INFO_ON 1063 +#define IDC_DEBUG_ON 1064 +#define IDC_KERNEL_ON 1065 +#define IDC_USER_ON 1066 +#define IDC_MAIL_ON 1067 +#define IDC_DAEMON_ON 1068 +#define IDC_AUTH_ON 1069 +#define IDC_SYSLOG_ON 1070 +#define IDC_LPR_ON 1071 +#define IDC_NEWS_ON 1072 +#define IDC_UUCP_ON 1073 +#define IDC_CRON_ON 1074 +#define IDC_KERNEL_EMERG 1075 +#define IDC_NOTICE_XOR 1076 +#define IDC_INFO_XOR 1077 +#define IDC_DEBUG_XOR 1078 +#define IDC_KERNEL_XOR 1079 +#define IDC_KERNEL_ALERT 1080 +#define IDC_KERNEL_CRIT 1081 +#define IDC_KERNEL_ERR 1082 +#define IDC_KERNEL_WARN 1083 +#define IDC_KERNEL_NOTICE 1084 +#define IDC_KERNEL_INFO 1085 +#define IDC_KERNEL_DEBUG 1086 +#define IDC_USER_EMERG 1087 +#define IDC_USER_ALERT 1088 +#define IDC_USER_CRIT 1089 +#define IDC_USER_ERR 1090 +#define IDC_USER_WARN 1091 +#define IDC_USER_NOTICE 1092 +#define IDC_USER_INFO 1093 +#define IDC_USER_DEBUG 1094 +#define IDC_MAIL_EMERG 1095 +#define IDC_MAIL_ALERT 1096 +#define IDC_MAIL_CRIT 1097 +#define IDC_MAIL_ERR 1098 +#define IDC_MAIL_WARN 1099 +#define IDC_MAIL_NOTICE 1100 +#define IDC_MAIL_INFO 1101 +#define IDC_MAIL_DEBUG 1102 +#define IDC_DAEMON_EMERG 1103 +#define IDC_DAEMON_ALERT 1104 +#define IDC_DAEMON_CRIT 1105 +#define IDC_DAEMON_ERR 1106 +#define IDC_DAEMON_WARN 1107 +#define IDC_DAEMON_NOTICE 1108 +#define IDC_DAEMON_INFO 1109 +#define IDC_DAEMON_DEBUG 1110 +#define IDC_AUTH_EMERG 1111 +#define IDC_AUTH_ALERT 1112 +#define IDC_AUTH_CRIT 1113 +#define IDC_AUTH_ERR 1114 +#define IDC_AUTH_WARN 1115 +#define IDC_AUTH_NOTICE 1116 +#define IDC_AUTH_INFO 1117 +#define IDC_AUTH_DEBUG 1118 +#define IDC_SYSLOG_EMERG 1119 +#define IDC_SYSLOG_ALERT 1120 +#define IDC_SYSLOG_CRIT 1121 +#define IDC_SYSLOG_ERR 1122 +#define IDC_SYSLOG_WARN 1123 +#define IDC_SYSLOG_NOTICE 1124 +#define IDC_SYSLOG_INFO 1125 +#define IDC_SYSLOG_DEBUG 1126 +#define IDC_LPR_EMERG 1127 +#define IDC_LPR_ALERT 1128 +#define IDC_LPR_CRIT 1129 +#define IDC_LPR_ERR 1130 +#define IDC_LPR_WARN 1131 +#define IDC_LPR_NOTICE 1132 +#define IDC_LPR_INFO 1133 +#define IDC_LPR_DEBUG 1134 +#define IDC_NEWS_EMERG 1135 +#define IDC_NEWS_ALERT 1136 +#define IDC_NEWS_CRIT 1137 +#define IDC_NEWS_ERR 1138 +#define IDC_NEWS_WARN 1139 +#define IDC_NEWS_NOTICE 1140 +#define IDC_NEWS_INFO 1141 +#define IDC_NEWS_DEBUG 1142 +#define IDC_UUCP_EMERG 1143 +#define IDC_UUCP_ALERT 1144 +#define IDC_UUCP_CRIT 1145 +#define IDC_UUCP_ERR 1146 +#define IDC_UUCP_WARN 1147 +#define IDC_UUCP_NOTICE 1148 +#define IDC_UUCP_INFO 1149 +#define IDC_UUCP_DEBUG 1150 +#define IDC_CRON_EMERG 1151 +#define IDC_CRON_ALERT 1152 +#define IDC_CRON_CRIT 1153 +#define IDC_CRON_ERR 1154 +#define IDC_CRON_WARN 1155 +#define IDC_CRON_NOTICE 1156 +#define IDC_CRON_INFO 1157 +#define IDC_CRON_DEBUG 1158 +#define IDC_EMERG_XOR 1159 +#define IDC_ALERT_XOR 1160 +#define IDC_CRIT_XOR 1161 +#define IDC_ERR_XOR 1162 +#define IDC_USER_XOR 1163 +#define IDC_MAIL_XOR 1164 +#define IDC_DAEMON_XOR 1165 +#define IDC_AUTH_XOR 1166 +#define IDC_SYSLOG_XOR 1167 +#define IDC_LPR_XOR 1168 +#define IDC_NEWS_XOR 1169 +#define IDC_UUCP_XOR 1170 +#define IDC_CRON_XOR 1171 +#define IDC_R0_ON 1172 +#define IDC_AUTHPRIV_ON 1172 +#define IDC_R1_ON 1173 +#define IDC_AUTHPRIV_EMERG 1173 +#define IDC_R2_ON 1174 +#define IDC_AUTHPRIV_ALERT 1174 +#define IDC_R3_ON 1175 +#define IDC_AUTHPRIV_CRIT 1175 +#define IDC_R4_ON 1176 +#define IDC_AUTHPRIV_ERR 1176 +#define IDC_R0_XOR 1177 +#define IDC_AUTHPRIV_WARN 1177 +#define IDC_R1_XOR 1178 +#define IDC_AUTHPRIV_NOTICE 1178 +#define IDC_R2_XOR 1179 +#define IDC_AUTHPRIV_INFO 1179 +#define IDC_R3_XOR 1180 +#define IDC_AUTHPRIV_DEBUG 1180 +#define IDC_R4_XOR 1181 +#define IDC_R0_EMERG 1182 +#define IDC_AUTHPRIV_XOR 1182 +#define IDC_R0_ALERT 1183 +#define IDC_R0_CRIT 1184 +#define IDC_R0_ERR 1185 +#define IDC_R0_WARN 1186 +#define IDC_R0_NOTICE 1187 +#define IDC_R0_INFO 1188 +#define IDC_R0_DEBUG 1189 +#define IDC_R1_EMERG 1190 +#define IDC_R1_ALERT 1191 +#define IDC_R1_CRIT 1192 +#define IDC_R1_ERR 1193 +#define IDC_R1_WARN 1194 +#define IDC_R1_NOTICE 1195 +#define IDC_R1_INFO 1196 +#define IDC_R1_DEBUG 1197 +#define IDC_R2_EMERG 1198 +#define IDC_R2_ALERT 1199 +#define IDC_R2_CRIT 1200 +#define IDC_R2_ERR 1201 +#define IDC_R2_WARN 1202 +#define IDC_R2_NOTICE 1203 +#define IDC_R2_INFO 1204 +#define IDC_R2_DEBUG 1205 +#define IDC_R3_EMERG 1206 +#define IDC_R3_ALERT 1207 +#define IDC_R3_CRIT 1208 +#define IDC_R3_ERR 1209 +#define IDC_R3_WARN 1210 +#define IDC_R3_NOTICE 1211 +#define IDC_R3_INFO 1212 +#define IDC_R3_DEBUG 1213 +#define IDC_R4_EMERG 1214 +#define IDC_R4_ALERT 1215 +#define IDC_R4_CRIT 1216 +#define IDC_R4_ERR 1217 +#define IDC_R4_WARN 1218 +#define IDC_R4_NOTICE 1219 +#define IDC_R4_INFO 1220 +#define IDC_R4_DEBUG 1221 +#define IDC_L0_ON 1222 +#define IDC_L1_ON 1223 +#define IDC_L2_ON 1224 +#define IDC_L3_ON 1225 +#define IDC_L4_ON 1226 +#define IDC_L5_ON 1227 +#define IDC_L6_ON 1228 +#define IDC_L7_ON 1229 +#define IDC_L0_XOR 1230 +#define IDC_L1_XOR 1231 +#define IDC_L2_XOR 1232 +#define IDC_L3_XOR 1233 +#define IDC_L4_XOR 1234 +#define IDC_L5_XOR 1235 +#define IDC_L6_XOR 1236 +#define IDC_L7_XOR 1237 +#define IDC_L0_EMERG 1238 +#define IDC_L0_ALERT 1239 +#define IDC_L0_CRIT 1240 +#define IDC_L0_ERR 1241 +#define IDC_L0_WARN 1242 +#define IDC_L0_NOTICE 1243 +#define IDC_L0_INFO 1244 +#define IDC_L0_DEBUG 1245 +#define IDC_L1_EMERG 1246 +#define IDC_L1_ALERT 1247 +#define IDC_L1_CRIT 1248 +#define IDC_L1_ERR 1249 +#define IDC_L1_WARN 1250 +#define IDC_L1_NOTICE 1251 +#define IDC_L1_INFO 1252 +#define IDC_L1_DEBUG 1253 +#define IDC_L2_EMERG 1254 +#define IDC_L2_ALERT 1255 +#define IDC_L2_CRIT 1256 +#define IDC_L2_ERR 1257 +#define IDC_L2_WARN 1258 +#define IDC_L2_NOTICE 1259 +#define IDC_L2_INFO 1260 +#define IDC_L2_DEBUG 1261 +#define IDC_L3_EMERG 1262 +#define IDC_L3_ALERT 1263 +#define IDC_L3_CRIT 1264 +#define IDC_L3_ERR 1265 +#define IDC_L3_WARN 1266 +#define IDC_L3_NOTICE 1267 +#define IDC_L3_INFO 1268 +#define IDC_L3_DEBUG 1269 +#define IDC_L4_EMERG 1270 +#define IDC_L4_ALERT 1271 +#define IDC_L4_CRIT 1272 +#define IDC_L4_ERR 1273 +#define IDC_L4_WARN 1274 +#define IDC_L4_NOTICE 1275 +#define IDC_L4_INFO 1276 +#define IDC_L4_DEBUG 1277 +#define IDC_L5_EMERG 1278 +#define IDC_L5_ALERT 1279 +#define IDC_L5_CRIT 1280 +#define IDC_L5_ERR 1281 +#define IDC_L5_WARN 1282 +#define IDC_L5_NOTICE 1283 +#define IDC_L5_INFO 1284 +#define IDC_L5_DEBUG 1285 +#define IDC_L6_EMERG 1286 +#define IDC_L6_ALERT 1287 +#define IDC_L6_CRIT 1288 +#define IDC_L6_ERR 1289 +#define IDC_L6_WARN 1290 +#define IDC_L6_NOTICE 1291 +#define IDC_L6_INFO 1292 +#define IDC_L6_DEBUG 1293 +#define IDC_L7_EMERG 1294 +#define IDC_L7_ALERT 1295 +#define IDC_L7_CRIT 1296 +#define IDC_L7_ERR 1297 +#define IDC_L7_WARN 1298 +#define IDC_L7_NOTICE 1299 +#define IDC_L7_INFO 1300 +#define IDC_L7_DEBUG 1301 +#define IDC_LOGPATTERN 1302 +#define IDC_WARNBLOCKING 1303 +#define ID_FILES_EXPORT 32771 +#define ID_FILES_IMPORT 32772 +#define ID_FILES_RESET 32773 +#define ID_TRAY_SHOWKLOGWINDOW 32774 +#define ID_TRAY_HELP 32776 +#define ID_TRAY_ABOUTKLOG 32777 +#define ID_TRAY_EXIT 32778 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 147 +#define _APS_NEXT_COMMAND_VALUE 32779 +#define _APS_NEXT_CONTROL_VALUE 1304 +#define _APS_NEXT_SYMED_VALUE 102 +#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..3291f7c --- a/dev/null +++ b/stdafx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// KLog.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..670c71b --- a/dev/null +++ b/stdafx.h @@ -0,0 +1,24 @@ +// 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 +// CG: The following line was added by the Windows Multimedia component. +#pragma comment(lib, "winmm.lib") + +enum { + WM_TRAYICON = WM_USER, +}; \ No newline at end of file -- cgit v0.9.0.2