summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitignore36
-rw-r--r--COPYING19
-rw-r--r--KLogDlg.cpp1367
-rw-r--r--KLogDlg.h198
-rw-r--r--KTAGS12
-rw-r--r--LogPattern.cpp157
-rw-r--r--LogPattern.h53
-rw-r--r--LogPatternLocal.cpp282
-rw-r--r--LogPatternLocal.h74
-rw-r--r--LogPatternReserved.cpp241
-rw-r--r--LogPatternReserved.h68
-rw-r--r--LogPatternUnix.cpp320
-rw-r--r--LogPatternUnix.h80
-rw-r--r--README33
-rw-r--r--SyslogSocket.cpp192
-rw-r--r--SyslogSocket.h82
-rw-r--r--Trayer.cpp94
-rw-r--r--Trayer.h44
-rw-r--r--WarnBlocking.cpp42
-rw-r--r--WarnBlocking.h34
-rw-r--r--help/klog.cnt8
-rw-r--r--help/klog.hpj26
-rw-r--r--help/klog.rtf64
-rw-r--r--help/klog.xml38
-rw-r--r--install/custom.rch10
-rw-r--r--install/install.cpp70
-rw-r--r--install/install.rc182
-rw-r--r--install/resource.h24
-rw-r--r--klog.clw502
-rw-r--r--klog.cpp70
-rw-r--r--klog.h36
-rw-r--r--klog.mak1254
-rw-r--r--klog.rc1150
-rw-r--r--makehelp.bat33
-rw-r--r--res/fear.wavbin0 -> 10074 bytes
-rw-r--r--res/glass.wavbin0 -> 10330 bytes
-rw-r--r--res/kick.wavbin0 -> 3162 bytes
-rw-r--r--res/klog-icon.icobin0 -> 4710 bytes
-rw-r--r--res/klog-triggered-icon.icobin0 -> 4710 bytes
-rw-r--r--res/klog.icobin0 -> 4710 bytes
-rw-r--r--res/klog.rc213
-rw-r--r--res/log-pattern.icobin0 -> 766 bytes
-rw-r--r--res/meow.wavbin0 -> 5466 bytes
-rw-r--r--resource.h370
-rw-r--r--shared-code/BTreendex.h595
-rw-r--r--shared-code/BellsNWhistles.h146
-rw-r--r--shared-code/BitSet.h105
-rw-r--r--shared-code/Dynamide.h443
-rw-r--r--shared-code/FindIFace.h125
-rw-r--r--shared-code/LRUCache.h113
-rw-r--r--shared-code/RegEx.cpp1697
-rw-r--r--shared-code/RegEx.h158
-rw-r--r--shared-code/SNMPExtDll.h252
-rw-r--r--shared-code/SNMPOIDs.h221
-rw-r--r--shared-code/SNMPeer.h286
-rw-r--r--shared-code/install.h370
-rw-r--r--shared-code/ip_icmp.h91
-rw-r--r--shared-code/kHelpers.h159
-rw-r--r--shared-code/kICMP.cpp300
-rw-r--r--shared-code/kICMP.h80
-rw-r--r--shared-code/kinhelp.xsl250
-rw-r--r--shared-code/ms_icmp.h77
-rw-r--r--shared-data/browse-icon.icobin0 -> 1078 bytes
-rw-r--r--shared-data/install-icon.icobin0 -> 2998 bytes
-rw-r--r--shared-data/klever-background.bmpbin0 -> 2578 bytes
-rw-r--r--shared-data/play-icon.icobin0 -> 1078 bytes
-rw-r--r--stdafx.cpp6
-rw-r--r--stdafx.h24
68 files changed, 12776 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f47982c
--- a/dev/null
+++ b/.gitignore
@@ -0,0 +1,36 @@
1
2# /
3/Debug
4/Release
5/Releast
6/debug
7/release
8/releast
9/DEBUG
10/RELEASE
11/RELEAST
12/*.mdp
13/*.ncb
14/*.aps
15/redist
16
17# /help/
18/help/KLOG.HLP
19/help/klog.LOG
20/help/klog.hm
21/help/klog.GID
22
23# /install/
24/install/debug
25/install/pure
26/install/canned
27/install/static
28/install/Debug
29/install/Pure
30/install/Canned
31/install/Static
32/install/DEBUG
33/install/PURE
34/install/CANNED
35/install/STATIC
36/install/*.aps
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..997e508
--- a/dev/null
+++ b/COPYING
@@ -0,0 +1,19 @@
1Copyright (c) 1998, 2002 Klever Group (http://www.klever.net/)
2
3Permission is hereby granted, free of charge, to any person obtaining a copy of
4this software and associated documentation files (the "Software"), to deal in
5the Software without restriction, including without limitation the rights to
6use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7of the Software, and to permit persons to whom the Software is furnished to do
8so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in all
11copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19SOFTWARE.
diff --git a/KLogDlg.cpp b/KLogDlg.cpp
new file mode 100644
index 0000000..5f1c6c0
--- a/dev/null
+++ b/KLogDlg.cpp
@@ -0,0 +1,1367 @@
1// KLogDlg.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "SyslogSocket.h"
7#include "KLogDlg.h"
8
9#include "Trayer.h"
10#include "LogPattern.h"
11#include "WarnBlocking.h"
12
13#ifdef _DEBUG
14#define new DEBUG_NEW
15#undef THIS_FILE
16static char THIS_FILE[] = __FILE__;
17#endif
18
19IMPLEMENT_SERIAL( CKLogDlg, CDialog, VERSIONABLE_SCHEMA|1 );
20IMPLEMENT_SERIAL( CLogger, CObject, VERSIONABLE_SCHEMA|1 );
21IMPLEMENT_SERIAL( CLogEntry, CObject, VERSIONABLE_SCHEMA|1 );
22IMPLEMENT_SERIAL( CHostMask, CObject, VERSIONABLE_SCHEMA|1 );
23
24/////////////////////////////////////////////////////////////////////////////
25// CAboutDlg dialog used for App About
26
27class CAboutDlg : public CDialog
28{
29public:
30 CAboutDlg();
31
32// Dialog Data
33 //{{AFX_DATA(CAboutDlg)
34 enum { IDD = IDD_ABOUTBOX };
35 //}}AFX_DATA
36
37 // ClassWizard generated virtual function overrides
38 //{{AFX_VIRTUAL(CAboutDlg)
39 protected:
40 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
41 //}}AFX_VIRTUAL
42
43// Implementation
44protected:
45 //{{AFX_MSG(CAboutDlg)
46 afx_msg void OnKlevernet();
47 //}}AFX_MSG
48 DECLARE_MESSAGE_MAP()
49};
50
51CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
52{
53 //{{AFX_DATA_INIT(CAboutDlg)
54 //}}AFX_DATA_INIT
55}
56
57void CAboutDlg::DoDataExchange(CDataExchange* pDX)
58{
59 CDialog::DoDataExchange(pDX);
60 //{{AFX_DATA_MAP(CAboutDlg)
61 //}}AFX_DATA_MAP
62}
63
64BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
65 //{{AFX_MSG_MAP(CAboutDlg)
66 ON_BN_CLICKED(IDC_KLEVERNET, OnKlevernet)
67 //}}AFX_MSG_MAP
68END_MESSAGE_MAP()
69
70/////////////////////////////////////////////////////////////////////////////
71// CKLogDlg dialog
72
73CKLogDlg::CKLogDlg(CWnd* pParent /*=NULL*/)
74 : CDialog(CKLogDlg::IDD, pParent)
75{
76 m_Logger=NULL;
77 m_LogItems=15;
78 m_bShown=TRUE;
79 m_bExiting=FALSE;
80 m_bWarnBlocking=TRUE;
81 m_bDontWarn=TRUE;
82 //{{AFX_DATA_INIT(CKLogDlg)
83 m_Logto = -1;
84 m_Desc = _T("");
85 m_Facility = _T("");
86 m_HFName = _T("");
87 m_HFNameCaption = _T("");
88 m_hlIP = _T("");
89 m_hlMask = _T("");
90 m_Sound = _T("");
91 //}}AFX_DATA_INIT
92 // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
93 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
94 m_bmpBack.LoadBitmap(IDB_BACKGROUND);
95 m_bmpBack.GetBitmap(&m_bitmapBack);
96 m_Trayer = new CTrayer(this);
97 ASSERT(m_Trayer);
98 LoadSettings();
99}
100
101void CKLogDlg::DoDataExchange(CDataExchange* pDX)
102{
103 CDialog::DoDataExchange(pDX);
104 //{{AFX_DATA_MAP(CKLogDlg)
105 DDX_Control(pDX, IDC_LOGPATTERN, m_LogPatternCtl);
106 DDX_Control(pDX, IDC_FILES, m_FilesCtl);
107 DDX_Control(pDX, IDC_LOGLENSPIN, m_LogLenSpinCtl);
108 DDX_Control(pDX, IDC_LOGLENGTH, m_LogLengthCtl);
109 DDX_Control(pDX, IDC_INVERT, m_PriInvertCtl);
110 DDX_Control(pDX, IDC_TYPE_FILE, m_LogtoFileCtl);
111 DDX_Control(pDX, IDC_TYPE_HOST, m_LogtoHostCtl);
112 DDX_Control(pDX, IDC_TYPE_NONE, m_LogtoNoneCtl);
113 DDX_Control(pDX, IDC_HOSTORFILE, m_HFNameCaptionCtl);
114 DDX_Control(pDX, IDC_HOSTS, m_hlCtl);
115 DDX_Control(pDX, IDC_BROWSESOUND, m_BrowseSoundCtl);
116 DDX_Control(pDX, IDC_NONE, m_PriNoneCtl);
117 DDX_Control(pDX, IDC_HL_REMOVE, m_hlRemoveCtl);
118 DDX_Control(pDX, IDC_HL_MASK, m_hlMaskCtl);
119 DDX_Control(pDX, IDC_HL_IP, m_hlIPCtl);
120 DDX_Control(pDX, IDC_HL_ADD, m_hlAddCtl);
121 DDX_Control(pDX, IDC_ALL, m_PriAllCtl);
122 DDX_Control(pDX, IDC_SOUND, m_SoundCtl);
123 DDX_Control(pDX, IDC_REMOVE, m_RemoveCtl);
124 DDX_Control(pDX, IDC_PLAYSOUND, m_PlaySoundCtl);
125 DDX_Control(pDX, IDC_LOG, m_Log);
126 DDX_Control(pDX, IDC_HOSTFILE, m_HFNameCtl);
127 DDX_Control(pDX, IDC_FACILITY, m_FacilityCtl);
128 DDX_Control(pDX, IDC_BROWSE, m_BrowseCtl);
129 DDX_Control(pDX, IDC_DESC, m_DescCtl);
130 DDX_Control(pDX, IDC_TABS, m_Tabs);
131 DDX_Radio(pDX, IDC_TYPE_FILE, m_Logto);
132 DDX_Text(pDX, IDC_DESC, m_Desc);
133 DDV_MaxChars(pDX, m_Desc, 50);
134 DDX_CBString(pDX, IDC_FACILITY, m_Facility);
135 DDX_Text(pDX, IDC_HOSTFILE, m_HFName);
136 DDX_Text(pDX, IDC_HOSTORFILE, m_HFNameCaption);
137 DDX_Text(pDX, IDC_HL_IP, m_hlIP);
138 DDV_MaxChars(pDX, m_hlIP, 15);
139 DDX_Text(pDX, IDC_HL_MASK, m_hlMask);
140 DDV_MaxChars(pDX, m_hlMask, 15);
141 DDX_CBString(pDX, IDC_SOUND, m_Sound);
142 //}}AFX_DATA_MAP
143}
144
145BEGIN_MESSAGE_MAP(CKLogDlg, CDialog)
146 //{{AFX_MSG_MAP(CKLogDlg)
147 ON_WM_SYSCOMMAND()
148 ON_WM_DESTROY()
149 ON_WM_PAINT()
150 ON_WM_QUERYDRAGICON()
151 ON_BN_CLICKED(IDC_ADD, OnAdd)
152 ON_NOTIFY(TCN_SELCHANGE, IDC_TABS, OnSelchangeTabs)
153 ON_CBN_SELCHANGE(IDC_FACILITY, OnSelchangeFacility)
154 ON_BN_CLICKED(IDC_ALERT, OnPriority)
155 ON_BN_CLICKED(IDC_TYPE_FILE, OnLogto)
156 ON_BN_CLICKED(IDC_ALL, OnPriAll)
157 ON_BN_CLICKED(IDC_NONE, OnPriNone)
158 ON_EN_CHANGE(IDC_DESC, OnChangeDesc)
159 ON_BN_CLICKED(IDC_INVERT, OnPriInvert)
160 ON_BN_CLICKED(IDC_HL_ADD, OnHlAdd)
161 ON_LBN_SELCHANGE(IDC_HOSTS, OnSelchangeHosts)
162 ON_BN_CLICKED(IDC_HL_REMOVE, OnHlRemove)
163 ON_BN_CLICKED(IDC_REMOVE, OnRemove)
164 ON_BN_CLICKED(IDC_PLAYSOUND, OnPlaysound)
165 ON_CBN_EDITCHANGE(IDC_SOUND, OnEditchangeSound)
166 ON_CBN_KILLFOCUS(IDC_SOUND, OnKillfocusSound)
167 ON_NOTIFY(UDN_DELTAPOS, IDC_LOGLENSPIN, OnDeltaposLoglenspin)
168 ON_BN_CLICKED(IDC_EXIT, OnExit)
169 ON_BN_CLICKED(IDC_FILES, OnFiles)
170 ON_COMMAND(ID_FILES_EXPORT, OnFilesExport)
171 ON_COMMAND(ID_FILES_IMPORT, OnFilesImport)
172 ON_BN_CLICKED(IDC_BROWSESOUND, OnBrowsesound)
173 ON_EN_KILLFOCUS(IDC_HOSTFILE, OnKillfocusHostfile)
174 ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
175 ON_COMMAND(ID_FILES_RESET, OnFilesReset)
176 ON_LBN_SELCHANGE(IDC_LOG, OnSelchangeLog)
177 ON_WM_CREATE()
178 ON_WM_CLOSE()
179 ON_COMMAND(ID_TRAY_ABOUTKLOG, OnTrayAboutklog)
180 ON_COMMAND(ID_TRAY_EXIT, OnTrayExit)
181 ON_COMMAND(ID_TRAY_SHOWKLOGWINDOW, OnTrayShowklogwindow)
182 ON_WM_WINDOWPOSCHANGING()
183 ON_BN_CLICKED(IDC_LOGPATTERN, OnLogpattern)
184 ON_BN_CLICKED(IDC_CRIT, OnPriority)
185 ON_BN_CLICKED(IDC_DEBUG, OnPriority)
186 ON_BN_CLICKED(IDC_EMERG, OnPriority)
187 ON_BN_CLICKED(IDC_ERR, OnPriority)
188 ON_BN_CLICKED(IDC_INFO, OnPriority)
189 ON_BN_CLICKED(IDC_NOTICE, OnPriority)
190 ON_BN_CLICKED(IDC_WARNING, OnPriority)
191 ON_BN_CLICKED(IDC_TYPE_HOST, OnLogto)
192 ON_BN_CLICKED(IDC_TYPE_NONE, OnLogto)
193 //}}AFX_MSG_MAP
194END_MESSAGE_MAP()
195
196/////////////////////////////////////////////////////////////////////////////
197// CKLogDlg message handlers
198
199BOOL CKLogDlg::OnInitDialog()
200{
201 CDialog::OnInitDialog();
202
203 // Add "About..." menu item to system menu.
204
205 // IDM_ABOUTBOX must be in the system command range.
206 ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
207 ASSERT(IDM_ABOUTBOX < 0xF000);
208
209 CMenu* pSysMenu = GetSystemMenu(FALSE);
210 CString strAboutMenu;
211 strAboutMenu.LoadString(IDS_ABOUTBOX);
212 if (!strAboutMenu.IsEmpty())
213 {
214 pSysMenu->AppendMenu(MF_SEPARATOR);
215 pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
216 }
217
218 // Set the icon for this dialog. The framework does this automatically
219 // when the application's main window is not a dialog
220 SetIcon(m_hIcon, TRUE); // Set big icon
221 SetIcon(m_hIcon, FALSE); // Set small icon
222
223 m_KLS.m_Daddy=this;
224 VERIFY(m_KLS.CreateListen());
225 m_SLS.Create(0,SOCK_DGRAM);
226
227 m_LogLenSpinCtl.SetRange(5,50);
228 UpdateLogLength(FALSE,FALSE);
229
230 // Adjust Tab control rectangle size and padding
231CRect rbrc,tcrc;
232 m_DescCtl.GetWindowRect(&rbrc);
233 m_Tabs.GetClientRect(&tcrc);
234 m_Tabs.ClientToScreen(&tcrc);
235 m_Tabs.SetItemSize(CSize(0,rbrc.top-tcrc.top-4));
236 m_Tabs.SetPadding(CSize(5,5));
237
238 // Load Image List
239 m_Images.Create(16,16,TRUE,2,1);
240 m_iNormal=m_Images.Add(AfxGetApp()->LoadIcon(IDI_KLOG));
241 m_iTriggered=m_Images.Add(AfxGetApp()->LoadIcon(IDI_KLOG_TRIGGERED));
242 m_Tabs.SetImageList(&m_Images);
243
244 // Set Icons
245 m_BrowseSoundCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_BROWSE));
246 m_PlaySoundCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_PREPLAY));
247 m_LogPatternCtl.SetIcon(AfxGetApp()->LoadIcon(IDI_LOGPATTERN));
248
249 // Create ToolTip Control
250 m_tooltip.Create(this);
251 m_tooltip.Activate(TRUE);
252
253 // Restore Layout
254 OnFilesReset();
255
256 SetWindowPos(NULL,6,6,0,0,SWP_NOZORDER|SWP_NOACTIVATE|SWP_NOSIZE);
257
258 if(m_bShown)
259 ShowWindow(SW_SHOW);
260 else
261 ShowWindow(SW_HIDE);
262
263 // Add Tips captions
264 m_tooltip.AddTool(GetDlgItem(IDC_ADD),IDC_ADD);
265 m_tooltip.AddTool(&m_RemoveCtl,IDC_REMOVE);
266 m_tooltip.AddTool(&m_LogLengthCtl,IDC_LOGLENGTH);
267 m_tooltip.AddTool(&m_LogLenSpinCtl,IDC_LOGLENGTH);
268 m_tooltip.AddTool(GetDlgItem(IDC_STATIC_LOGLENGTH),IDC_LOGLENGTH);
269 m_tooltip.AddTool(GetDlgItem(IDC_FILES),IDC_FILES);
270 m_tooltip.AddTool(GetDlgItem(IDC_EXIT),IDC_EXIT);
271 m_tooltip.AddTool(&m_LogtoFileCtl,IDC_TYPE_FILE);
272 m_tooltip.AddTool(&m_LogtoHostCtl,IDC_TYPE_HOST);
273 m_tooltip.AddTool(&m_LogtoNoneCtl,IDC_TYPE_NONE);
274 m_tooltip.AddTool(&m_hlCtl,IDC_HOSTS);
275 m_tooltip.AddTool(&m_Log,IDC_LOG);
276 m_tooltip.AddTool(&m_LogPatternCtl,IDC_LOGPATTERN);
277
278 return TRUE; // return TRUE unless you set the focus to a control
279}
280
281void CKLogDlg::OnSysCommand(UINT nID, LPARAM lParam)
282{
283 switch(nID&0xFFF0){
284 case IDM_ABOUTBOX:
285 {
286 OnTrayAboutklog();
287 }
288 break;
289 case SC_CONTEXTHELP:
290 AfxGetApp()->WinHelp(0,HELP_FINDER);
291 break;
292 default:
293 CDialog::OnSysCommand(nID, lParam);
294 break;
295 }
296}
297
298void CKLogDlg::OnDestroy()
299{
300NOTIFYICONDATA nid;
301 memset(&nid,0,sizeof(nid));
302 nid.cbSize=sizeof(nid);
303 nid.hWnd=m_Trayer->m_hWnd;
304 nid.uID=IDC_TRAYICON;
305 nid.uFlags=0;
306 VERIFY(Shell_NotifyIcon(NIM_DELETE,&nid));
307
308 WinHelp(0L, HELP_QUIT);
309 CDialog::OnDestroy();
310}
311
312// If you add a minimize button to your dialog, you will need the code below
313// to draw the icon. For MFC applications using the document/view model,
314// this is automatically done for you by the framework.
315
316void CKLogDlg::OnPaint()
317{
318 if (IsIconic())
319 {
320 CPaintDC dc(this); // device context for painting
321
322 SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
323
324 // Center icon in client rectangle
325 int cxIcon = GetSystemMetrics(SM_CXICON);
326 int cyIcon = GetSystemMetrics(SM_CYICON);
327 CRect rect;
328 GetClientRect(&rect);
329 int x = (rect.Width() - cxIcon + 1) / 2;
330 int y = (rect.Height() - cyIcon + 1) / 2;
331
332 // Draw the icon
333 dc.DrawIcon(x, y, m_hIcon);
334 }
335 else
336 {
337 CPaintDC pDC(this);
338 CDC bmpDC;
339 bmpDC.CreateCompatibleDC(&pDC);
340 bmpDC.SelectObject(&m_bmpBack);
341 CRect rc;
342 GetClientRect(&rc);
343 for(int x=-m_bitmapBack.bmWidth*2/4;x<rc.Width();x+=m_bitmapBack.bmWidth)
344 for(int y=-m_bitmapBack.bmHeight*2/4;y<rc.Height();y+=m_bitmapBack.bmHeight)
345 pDC.BitBlt(x,y,m_bitmapBack.bmWidth,m_bitmapBack.bmHeight,&bmpDC,0,0,SRCCOPY);
346 bmpDC.DeleteDC();
347 CDialog::OnPaint();
348 }
349}
350
351// The system calls this to obtain the cursor to display while the user drags
352// the minimized window.
353HCURSOR CKLogDlg::OnQueryDragIcon()
354{
355 return (HCURSOR) m_hIcon;
356}
357
358void CKLogDlg::OnAdd()
359{
360CLogger *l = new CLogger(m_Tabs.GetItemCount()?FALSE:TRUE);
361 ASSERT(l);
362 m_Logs[l]=l;
363TC_ITEM ptc;
364 memset(&ptc,0,sizeof(ptc));
365 ptc.mask=TCIF_TEXT|TCIF_IMAGE|TCIF_PARAM;
366 ptc.pszText=(LPTSTR)(LPCTSTR)l->m_Desc;
367 ptc.iImage=m_iNormal;
368 ptc.lParam=(LPARAM)l;
369int tmp=m_Tabs.InsertItem(m_Tabs.GetItemCount(),&ptc);
370 m_Tabs.SetCurSel(tmp);
371 SetTab(l);
372 m_RemoveCtl.EnableWindow(m_Tabs.GetItemCount()>1);
373}
374
375void CKLogDlg::OnSelchangeTabs(NMHDR* pNMHDR, LRESULT* pResult)
376{
377int cs = m_Tabs.GetCurSel();
378 ASSERT(cs>=0);
379TC_ITEM ptci;
380 memset(&ptci,0,sizeof(ptci));
381 ptci.mask=TCIF_PARAM;
382 VERIFY(m_Tabs.GetItem(cs,&ptci));
383CLogger *l = (CLogger*)ptci.lParam;
384 memset(&ptci,0,sizeof(ptci));
385 ptci.mask=TCIF_IMAGE;
386 ptci.iImage=m_iNormal;
387 VERIFY(m_Tabs.SetItem(cs,&ptci));
388 ASSERT(l);
389 SetTab(l);
390 if(pResult)
391 *pResult = 0;
392}
393
394 UINTCKLogDlg::m_PriorityCtls[CSyslogSocket::totalPriorities] = {
395 IDC_EMERG,IDC_ALERT,IDC_CRIT,IDC_ERR,IDC_WARNING,IDC_NOTICE,IDC_INFO,IDC_DEBUG
396};
397void CKLogDlg::SetTab(CLogger* l)
398{
399 ASSERT(l);
400 m_Logger=l;
401 m_Desc=m_Logger->m_Desc;
402 UpdateLogto(FALSE,FALSE);
403 UpdatePriface(FALSE,FALSE);
404 // HOST LIST
405 m_hlCtl.ResetContent();
406 m_hlRemoveCtl.EnableWindow(FALSE);
407POSITION p = m_Logger->m_Hosts.GetHeadPosition();
408 while(p){
409 CHostMask *hm = m_Logger->m_Hosts.GetNext(p);
410 ASSERT(hm);
411 CString hms = hm->String();
412 int i = m_hlCtl.AddString(hms);
413 ASSERT(i>=0);
414 m_hlCtl.SetItemData(i,(DWORD)hm);
415 }
416 // SOUND
417 m_Sound=m_Logger->m_Sound;
418 // EVENTS
419 m_Log.ResetContent();
420 p = m_Logger->m_Log.GetHeadPosition();
421 while(p){
422 CLogEntry *le = m_Logger->m_Log.GetNext(p);
423 ASSERT(le);
424 AddLogLine(le);
425 }
426
427 UpdateData(FALSE);
428}
429
430CLogger::CLogger(BOOL bAll)
431{
432 m_Desc=bAll?"All events":"New";
433 memset(m_LogPattern,bAll,sizeof(m_LogPattern));
434 m_LogTo=logToNone;
435 m_LogToHost.sin_addr.s_addr = INADDR_NONE;
436}
437
438void CKLogDlg::UpdatePriface(BOOL bSave,BOOL update)
439{
440 ASSERT(m_Logger);
441int f = CSyslogSocket::Facility(m_Facility);
442 if(bSave){
443 if(f==CSyslogSocket::facNone)
444 return;
445 for(int tmp=0;tmp<CSyslogSocket::totalPriorities;tmp++)
446 m_Logger->m_LogPattern[f][tmp]=(IsDlgButtonChecked(m_PriorityCtls[tmp])!=0);
447 }else{
448 if(f==CSyslogSocket::facNone){
449 for(int tmp=0;tmp<CSyslogSocket::totalPriorities;tmp++){
450 CheckDlgButton(m_PriorityCtls[tmp],0);
451 GetDlgItem(m_PriorityCtls[tmp])->EnableWindow(FALSE);
452 }
453 m_PriAllCtl.EnableWindow(FALSE);
454 m_PriNoneCtl.EnableWindow(FALSE);
455 m_PriInvertCtl.EnableWindow(FALSE);
456 }else{
457 for(int tmp=0;tmp<CSyslogSocket::totalPriorities;tmp++){
458 CheckDlgButton(m_PriorityCtls[tmp],m_Logger->m_LogPattern[f][tmp]?1:0);
459 GetDlgItem(m_PriorityCtls[tmp])->EnableWindow(TRUE);
460 }
461 m_PriAllCtl.EnableWindow(TRUE);
462 m_PriNoneCtl.EnableWindow(TRUE);
463 m_PriInvertCtl.EnableWindow(TRUE);
464 if(update)
465 UpdateData(FALSE);
466 }
467 }
468}
469
470void CKLogDlg::OnSelchangeFacility()
471{
472 ASSERT(m_Logger);
473 UpdatePriface(TRUE,FALSE);
474 UpdateData(TRUE);
475 UpdatePriface(FALSE,TRUE);
476}
477
478void CKLogDlg::OnPriority()
479{
480 UpdatePriface(TRUE,FALSE);
481}
482
483void CKLogDlg::UpdateLogto(BOOL bSave,BOOL update)
484{
485 if(bSave){
486 m_Logger->m_LogTo=m_Logto;
487 if(m_Logto!=CLogger::logToNone){
488 m_Logger->m_LogToName=m_HFName;
489 switch(m_Logto){
490 case CLogger::logToFile:
491 // ??? Do nothing
492 break;
493 case CLogger::logToHost:
494 m_Logger->LookupHost(this);
495 break;
496 #ifndefNDEBUG
497 default:
498 ASSERT(FALSE);
499 break;
500#endif
501 }
502 }
503 }else{
504 m_Logto=m_Logger->m_LogTo;
505 m_HFNameCaption.Empty();
506 m_HFName=m_Logger->m_LogToName;
507 BOOL doLog = TRUE;
508 BOOL doBrowse = FALSE;
509 switch(m_Logger->m_LogTo){
510 case CLogger::logToNone:
511 doLog=FALSE;
512 m_HFName.Empty();
513 break;
514 case CLogger::logToFile:
515 m_HFNameCaption.LoadString(IDS_LOGTO_FILE);
516 doBrowse=TRUE;
517 break;
518 case CLogger::logToHost:
519 m_HFNameCaption.LoadString(IDS_LOGTO_HOST);
520 break;
521 default:
522 ASSERT(FALSE);
523 break;
524 }
525 m_HFNameCtl.EnableWindow(doLog);
526 m_HFNameCaptionCtl.EnableWindow(doLog);
527 m_BrowseCtl.EnableWindow(doBrowse);
528 if(update)
529 UpdateData(FALSE);
530 }
531}
532
533void CKLogDlg::OnLogto()
534{
535 ASSERT(m_Logger);
536 UpdateData(TRUE);
537 m_HFName=m_Logger->m_LogToName;
538 UpdateLogto(TRUE,FALSE);
539 UpdateLogto(FALSE,TRUE);
540}
541
542void CKLogDlg::OnPriAll()
543{
544 ASSERT(m_Logger);
545 UpdateData(TRUE);
546 UpdatePriface(TRUE,FALSE);
547int f = CSyslogSocket::Facility(m_Facility);
548 for(int tmp=0;tmp<CSyslogSocket::totalPriorities;tmp++)
549 m_Logger->m_LogPattern[f][tmp]=TRUE;
550 UpdatePriface(FALSE,TRUE);
551}
552
553void CKLogDlg::OnPriNone()
554{
555 ASSERT(m_Logger);
556 UpdateData(TRUE);
557 UpdatePriface(TRUE,FALSE);
558int f = CSyslogSocket::Facility(m_Facility);
559 for(int tmp=0;tmp<CSyslogSocket::totalPriorities;tmp++)
560 m_Logger->m_LogPattern[f][tmp]=FALSE;
561 UpdatePriface(FALSE,TRUE);
562}
563
564void CKLogDlg::OnPriInvert()
565{
566 ASSERT(m_Logger);
567 UpdateData(TRUE);
568 UpdatePriface(TRUE,FALSE);
569int f = CSyslogSocket::Facility(m_Facility);
570 for(int tmp=0;tmp<CSyslogSocket::totalPriorities;tmp++)
571 m_Logger->m_LogPattern[f][tmp]=!m_Logger->m_LogPattern[f][tmp];
572 UpdatePriface(FALSE,TRUE);
573}
574
575void CKLogDlg::OnChangeDesc()
576{
577 ASSERT(m_Logger);
578 UpdateData(TRUE);
579 m_Logger->m_Desc=m_Desc;
580 intcs = m_Tabs.GetCurSel();
581 ASSERT(cs>=0);
582TC_ITEM ptci;
583 memset(&ptci,0,sizeof(ptci));
584 ptci.mask=TCIF_TEXT;
585 ptci.pszText=(LPTSTR)(LPCTSTR)m_Logger->m_Desc;
586 VERIFY(m_Tabs.SetItem(cs,&ptci));
587}
588
589CString CHostMask::String()
590{
591CString rv;
592 rv = inet_ntoa(*(in_addr*)&m_Host);
593 rv+=" / ";
594 rv+= inet_ntoa(*(in_addr*)&m_Mask);
595 return rv;
596}
597
598void CKLogDlg::OnHlAdd()
599{
600 ASSERT(m_Logger);
601 UpdateData(TRUE);
602DWORD h = (DWORD)inet_addr(m_hlIP);
603DWORD m = (DWORD)inet_addr(m_hlMask);
604 if(h==INADDR_NONE){
605 TRACE0("Bad host address\n");
606 m_hlIPCtl.SetFocus();
607 return;
608 }
609 if(m==INADDR_NONE && m_hlMask!="255.255.255.255"){ // 255.255.255.255 stands for INADDR_NONE
610 TRACE0("Bad host mask\n");
611 m_hlMaskCtl.SetFocus();
612 return;
613 }
614 if(!(m && h)){
615 TRACE0("Both zeros\n");
616 m_hlIPCtl.SetFocus();
617 return;
618 }
619CHostMask *hm = new CHostMask(h,m);
620 ASSERT(hm);
621 m_Logger->m_Hosts.AddTail(hm);
622CString hms = hm->String();
623int i = m_hlCtl.AddString(hms);
624 ASSERT(i>=0);
625 m_hlCtl.SetItemData(i,(DWORD)hm);
626}
627
628void CKLogDlg::OnSelchangeHosts()
629{
630int i = m_hlCtl.GetCurSel();
631 if(i<0){
632 m_hlRemoveCtl.EnableWindow(FALSE);
633 return;
634 }
635CHostMask *hm = (CHostMask*)m_hlCtl.GetItemData(i);
636 ASSERT(hm);
637 m_hlIP=inet_ntoa(*(in_addr*)&hm->m_Host);
638 m_hlMask=inet_ntoa(*(in_addr*)&hm->m_Mask);
639 UpdateData(FALSE);
640 m_hlRemoveCtl.EnableWindow(TRUE);
641}
642
643void CKLogDlg::OnHlRemove()
644{
645int i = m_hlCtl.GetCurSel();
646 if(i<0){
647 m_hlRemoveCtl.EnableWindow(FALSE);
648 return;
649 }
650CHostMask *hm = (CHostMask*)m_hlCtl.GetItemData(i);
651 m_hlCtl.DeleteString(i);
652 ASSERT(hm);
653 ASSERT(m_Logger);
654POSITION p = m_Logger->m_Hosts.Find(hm);
655 ASSERT(p);
656 m_Logger->m_Hosts.RemoveAt(p);
657 delete hm;
658 m_hlRemoveCtl.EnableWindow(m_hlCtl.GetCurSel()>=0);
659}
660
661void CKLogDlg::OnRemove()
662{
663 ASSERT(m_Tabs.GetItemCount()>1);
664int t = m_Tabs.GetCurSel();
665 ASSERT(t>=0);
666 ASSERT(m_Logger);
667TC_ITEM tci;
668 memset(&tci,0,sizeof(tci));
669 tci.mask=TCIF_PARAM;
670 VERIFY(m_Tabs.GetItem(t,&tci));
671 ASSERT(tci.lParam==(LPARAM)m_Logger);
672 VERIFY(m_Tabs.DeleteItem(t));
673 VERIFY(m_Logs.RemoveKey(m_Logger));
674 delete m_Logger;
675 m_Logger=NULL;
676 m_Tabs.SetCurSel(t);
677 t=m_Tabs.GetCurSel();
678 if(t<0)
679 VERIFY(m_Tabs.SetCurSel(t=0));
680 memset(&tci,0,sizeof(tci));
681 tci.mask=TCIF_PARAM;
682 VERIFY(m_Tabs.GetItem(t,&tci));
683CLogger *l = (CLogger*)tci.lParam;
684 ASSERT(l);
685 SetTab(l);
686 m_RemoveCtl.EnableWindow(m_Tabs.GetItemCount()>1);
687}
688
689void CLogger::PlayWave()
690{
691 if(m_Sound.IsEmpty())
692 return;
693CString tmp;
694 tmp.LoadString(IDS_SOUND_MEOW);
695 if(!tmp.CompareNoCase(m_Sound)){
696 ::PlaySound((LPCTSTR)IDW_SOUND_MEOW,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE);
697 return;
698 }
699 tmp.LoadString(IDS_SOUND_GLASS);
700 if(!tmp.CompareNoCase(m_Sound)){
701 ::PlaySound((LPCTSTR)IDW_SOUND_GLASS,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE);
702 return;
703 }
704 tmp.LoadString(IDS_SOUND_FEAR);
705 if(!tmp.CompareNoCase(m_Sound)){
706 ::PlaySound((LPCTSTR)IDW_SOUND_FEAR,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE);
707 return;
708 }
709 tmp.LoadString(IDS_SOUND_KICK);
710 if(!tmp.CompareNoCase(m_Sound)){
711 ::PlaySound((LPCTSTR)IDW_SOUND_KICK,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_RESOURCE);
712 return;
713 }
714 ::PlaySound(m_Sound,AfxGetApp()->m_hInstance,SND_ASYNC|SND_NODEFAULT|SND_NOSTOP|SND_NOWAIT|SND_FILENAME);
715}
716
717void CKLogDlg::OnPlaysound()
718{
719 ASSERT(m_Logger);
720 m_Logger->PlayWave();
721}
722
723void CKLogDlg::OnEditchangeSound()
724{
725 ASSERT(m_Logger);
726 UpdateData(TRUE);
727 m_Logger->m_Sound=m_Sound;
728}
729
730void CKLogDlg::OnKillfocusSound()
731{
732 ASSERT(m_Logger);
733 UpdateData(TRUE);
734 m_Logger->m_Sound=m_Sound;
735}
736
737void CKLogDlg::UpdateLogLength(BOOL bSave,BOOL update)
738{
739 if(bSave){
740 int sbp = m_LogLenSpinCtl.GetPos();
741 if(sbp&(0xFFFFl<<16)){
742 sbp = 15;
743 m_LogLenSpinCtl.SetPos(sbp);
744 }
745 m_LogItems=sbp;
746 }else{
747 m_LogLenSpinCtl.SetPos(m_LogItems);
748 }
749}
750
751void CKLogDlg::OnDeltaposLoglenspin(NMHDR* pNMHDR, LRESULT* pResult)
752{
753 NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
754 UpdateLogLength(TRUE,FALSE);
755 *pResult = 0;
756}
757
758void CKLogDlg::OnExit()
759{
760 SaveSettings();
761 TotalCleanUp();
762 m_bExiting=TRUE;
763 EndDialog(IDOK);
764}
765
766void CKLogDlg::TotalCleanUp()
767{
768POSITION p = m_Logs.GetStartPosition();
769 while(p){
770 CLogger *l, *ll;
771 m_Logs.GetNextAssoc(p,l,ll);
772 ASSERT(l);
773 ASSERT(l==ll);
774 delete l;
775 }
776 m_Logs.RemoveAll();
777 m_Tabs.DeleteAllItems();
778 RedrawWindow();
779}
780
781CLogger::~CLogger()
782{
783POSITION p = m_Hosts.GetHeadPosition();
784 while(p){
785 CHostMask *hm = m_Hosts.GetNext(p);
786 ASSERT(hm);
787 delete hm;
788 }
789 m_Hosts.RemoveAll();
790 p = m_Log.GetHeadPosition();
791 while(p){
792 CLogEntry *le = m_Log.GetNext(p);
793 ASSERT(le);
794 delete le;
795 }
796 m_Log.RemoveAll();
797}
798
799void CKLogDlg::OnFiles()
800{
801CRect rc;
802 m_FilesCtl.GetWindowRect(&rc);
803CPoint pt = rc.TopLeft();
804CMenu menu;
805 VERIFY(menu.LoadMenu(IDD));
806CMenu *filesMenu = menu.GetSubMenu(0);
807 ASSERT(filesMenu);
808 filesMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON,pt.x,pt.y,this);
809}
810
811void CKLogDlg::OnFilesExport()
812{
813 TRACE0("Export\n");
814CString filter;
815 filter.LoadString(IDS_KLOGFILTER);
816CString title, ext;
817 title.LoadString(IDS_KLOG_EXPORT);
818 ext.LoadString(IDS_KLOG_EXT);
819CFileDialog cfd(FALSE,ext,NULL,OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,filter,this);
820 cfd.m_ofn.lpstrTitle=title;
821 if(cfd.DoModal()==IDOK){
822 CFile klo;
823 if(klo.Open(cfd.GetPathName(),CFile::modeCreate|CFile::modeWrite)){
824 TRY{
825 CArchive ar(&klo,CArchive::store);
826 Serialize(ar);
827 ar.Close();
828 }CATCH(CException, e){
829 CString tmp;
830 tmp.LoadString(IDS_MSG_FAILEDTOEXPORT);
831 MessageBox(tmp,NULL,MB_ICONHAND|MB_OK);
832 }END_CATCH
833 }else{
834 CString tmp;
835 tmp.LoadString(IDS_MSG_FAILEDTOEXPORT);
836 MessageBox(tmp,NULL,MB_ICONHAND|MB_OK);
837 }
838 }
839}
840
841void CKLogDlg::OnFilesImport()
842{
843 TRACE0("Import\n");
844CString filter;
845 filter.LoadString(IDS_KLOGFILTER);
846CString title;
847 title.LoadString(IDS_KLOG_IMPORT);
848CFileDialog cfd(TRUE,NULL,NULL,OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,filter,this);
849 cfd.m_ofn.lpstrTitle=title;
850 if(cfd.DoModal()==IDOK){
851 CFile klo;
852 if(klo.Open(cfd.GetPathName(),CFile::modeRead)){
853 TRY{
854 CArchive ar(&klo,CArchive::load);
855 Serialize(ar);
856 ar.Close();
857 }CATCH(CException, e){
858 CString tmp;
859 tmp.LoadString(IDS_MSG_FAILEDTOIMPORT);
860 MessageBox(tmp,NULL,MB_ICONHAND|MB_OK);
861 }END_CATCH
862 }else{
863 CString tmp;
864 tmp.LoadString(IDS_MSG_FAILEDTOIMPORT);
865 MessageBox(tmp,NULL,MB_ICONHAND|MB_OK);
866 }
867 }
868}
869
870void CKLogDlg::OnBrowsesound()
871{
872CString filter;
873 filter.LoadString(IDS_WAVFILTER);
874CString title;
875 title.LoadString(IDS_SOUND_SELECT);
876CFileDialog cfd(TRUE,NULL,NULL,OFN_EXPLORER|OFN_FILEMUSTEXIST|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,filter,this);
877 cfd.m_ofn.lpstrTitle=title;
878 if(cfd.DoModal()==IDOK){
879 m_Sound=cfd.GetPathName();
880 ASSERT(m_Logger);
881 UpdateData(FALSE);
882 m_Logger->m_Sound=m_Sound;
883 }
884}
885
886void CKLogDlg::OnKillfocusHostfile()
887{
888 UpdateData(TRUE);
889 if(m_HFName.Compare(m_Logger->m_LogToName))
890 UpdateLogto(TRUE,FALSE);
891}
892
893void CKLogDlg::OnOK()
894{
895 UpdateData(TRUE);
896 UpdateLogto(TRUE,FALSE);
897}
898
899void CKLogDlg::OnBrowse()
900{
901CString filter;
902 filter.LoadString(IDS_LOGFILTER);
903CString title, ext;
904 title.LoadString(IDS_LOG_SELECT);
905 ext.LoadString(IDS_LOG_EXT);
906CFileDialog cfd(FALSE,ext,NULL,OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY,filter,this);
907 cfd.m_ofn.lpstrTitle=title;
908 if(cfd.DoModal()==IDOK){
909 m_HFName=cfd.GetPathName();
910 ASSERT(m_Logger);
911 UpdateData(FALSE);
912 m_Logger->m_LogToName=m_HFName;
913 }
914}
915
916void CKLogDlg::Serialize(CArchive& ar)
917{
918 ASSERT_VALID(this);
919
920 ar.MapObject(this);
921 ar.SerializeClass(RUNTIME_CLASS(CKLogDlg));
922
923 if(ar.IsStoring()){
924 // Store
925 TRACE0("Store Klog\n");
926 intnCount = m_Tabs.GetItemCount();
927 ar << nCount;
928 for(int tmp=0;tmp<nCount;tmp++){
929 TC_ITEM ptci;
930 memset(&ptci,0,sizeof(ptci));
931 ptci.mask=TCIF_PARAM;
932 VERIFY(m_Tabs.GetItem(tmp,&ptci));
933 CLogger *l = (CLogger*)ptci.lParam;
934 ASSERT(l);
935 l->Serialize(ar);
936 }
937 }else{
938 // Retrieve
939 UINT schema = ar.GetObjectSchema();
940#ifndef NDEBUG
941 {
942 CString tmp;
943 tmp.Format("Doc-OSchema: %u\n",schema);
944 TRACE0(tmp);
945 }
946#endif
947 // Do the cleanup
948 TotalCleanUp();
949 int nCount;
950 ar >> nCount;
951 ASSERT(nCount);
952 for(int tmp=0;tmp<nCount;tmp++){
953 CLogger *l = new CLogger();
954 l->Serialize(ar);
955 m_Logs[l]=l;
956 TC_ITEM ptc;
957 memset(&ptc,0,sizeof(ptc));
958 ptc.mask=TCIF_TEXT|TCIF_IMAGE|TCIF_PARAM;
959 ptc.pszText=(LPTSTR)(LPCTSTR)l->m_Desc;
960 ptc.iImage=m_iNormal;
961 ptc.lParam=(LPARAM)l;
962 int tmp=m_Tabs.InsertItem(m_Tabs.GetItemCount(),&ptc);
963 if(l->m_LogTo==CLogger::logToHost)
964 l->LookupHost(this);
965 }
966 m_Tabs.SetCurSel(0);
967 OnSelchangeTabs(NULL,NULL);
968 m_RemoveCtl.EnableWindow(nCount>1);
969 }
970}
971
972void CLogger::Serialize(CArchive& ar)
973{
974 ASSERT_VALID(this);
975
976 ar.MapObject(this);
977 ar.SerializeClass(RUNTIME_CLASS(CLogger));
978
979 if(ar.IsStoring()){
980 // Store
981 TRACE0("Store Klogger\n");
982 ar << m_Desc;
983 ar.Write(&m_LogPattern,sizeof(m_LogPattern));
984 ar << m_LogTo;
985 ar << m_LogToName;
986 ar << m_Sound;
987 m_Hosts.Serialize(ar);
988 }else{
989 // Retrieve
990UINT schema = ar.GetObjectSchema();
991#ifndef NDEBUG
992 {
993 CString tmp;
994 tmp.Format("Doc-OSchema: %u\n",schema);
995 TRACE0(tmp);
996 }
997#endif
998 ar >> m_Desc;
999 ar.Read(&m_LogPattern,sizeof(m_LogPattern));
1000 ar >> m_LogTo;
1001 ar >> m_LogToName;
1002 ar >> m_Sound;
1003 m_Hosts.Serialize(ar);
1004 }
1005}
1006
1007void CHostMask::Serialize(CArchive& ar)
1008{
1009 ASSERT_VALID(this);
1010
1011 if(ar.IsStoring()){
1012 // Store
1013 ar << m_Host;
1014 ar << m_Mask;
1015 }else{
1016 // Retrieve
1017 ar >> m_Host;
1018 ar >> m_Mask;
1019 }
1020}
1021
1022void CKLogDlg::OnFilesReset()
1023{
1024 TotalCleanUp();
1025BYTE *pData = NULL;
1026UINT dataLength = 0;
1027 if(AfxGetApp()->GetProfileBinary("Layout","Destinations",&pData,&dataLength)){
1028 CMemFile mf(pData,dataLength);
1029 CArchive ar(&mf,CArchive::load);
1030 Serialize(ar);
1031 ar.Close();
1032 delete mf.Detach();
1033 }else
1034 OnAdd();
1035}
1036
1037void CAboutDlg::OnKlevernet()
1038{
1039CString url;
1040 url.LoadString(IDS_KLEVERNET_URL);
1041 ShellExecute(::GetDesktopWindow(),"open",url,NULL,NULL,SW_SHOWMAXIMIZED);
1042}
1043
1044void CKLogSocket::Log(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin)
1045{
1046CString str = Escape(line);
1047 m_Daddy->LogMessage(pri,fac,str,sin);
1048}
1049
1050void CKLogDlg::LogMessage(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin)
1051{
1052 // Setting up defaults:
1053UINT ap = pri, af = fac;
1054 if(ap>=CSyslogSocket::totalPriorities)
1055 ap=CSyslogSocket::priInfo;
1056 if(af>=CSyslogSocket::totalFacilities)
1057 af=CSyslogSocket::facUser;
1058POSITION p = m_Logs.GetStartPosition();
1059 while(p){
1060 CLogger *l,*ll;
1061 m_Logs.GetNextAssoc(p,l,ll);
1062 ASSERT(l);
1063 ASSERT(l==ll);
1064 if(l->m_LogPattern[af][ap] && l->IsHostFine(sin->sin_addr.s_addr))
1065 l->LogLine(this,ap,af,line,sin);
1066 }
1067}
1068
1069CLogEntry::CLogEntry()
1070{
1071 m_Time==CTime::GetCurrentTime();
1072 m_Priority=CSyslogSocket::priNone;
1073 m_Facility=CSyslogSocket::facNone;
1074}
1075
1076BOOL CLogger::IsHostFine(DWORD saddr)
1077{
1078 if(m_Hosts.IsEmpty())
1079 return TRUE;
1080POSITION p = m_Hosts.GetHeadPosition();
1081 while(p){
1082 CHostMask *hm = m_Hosts.GetNext(p);
1083 ASSERT(hm);
1084 if(hm->IsThis(saddr))
1085 return TRUE;
1086 }
1087 return FALSE;
1088}
1089
1090void CLogger::LogLine(CKLogDlg *dad,UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin)
1091{
1092CLogEntry *le = NULL;
1093 while(m_Log.GetCount()>=dad->m_LogItems){
1094 le = m_Log.GetHead();
1095 ASSERT(le);
1096 if(dad->m_Logger==this){
1097 ASSERT((CLogEntry*)dad->m_Log.GetItemData(0)==le);
1098 dad->m_Log.DeleteString(0);
1099 }
1100 m_Log.RemoveHead();
1101 if(m_Log.GetCount()>dad->m_LogItems){
1102 delete le;
1103 le=NULL;
1104 }
1105 }
1106 if(!le)
1107 le = new CLogEntry();
1108 ASSERT(le);
1109 le->m_Time=CTime::GetCurrentTime();
1110 le->m_Priority=pri;
1111 le->m_Facility=fac;
1112 le->m_Data=line;
1113 le->m_Source=inet_ntoa(sin->sin_addr);
1114 m_Log.AddTail(le);
1115 if(dad->m_Logger==this){
1116 dad->AddLogLine(le);
1117 }else{
1118 int c = dad->m_Tabs.GetItemCount();
1119 ASSERT(c>0);
1120 for(int i=0;i<c;i++){
1121 TC_ITEM ptci;
1122 memset(&ptci,0,sizeof(ptci));
1123 ptci.mask=TCIF_PARAM;
1124 VERIFY(dad->m_Tabs.GetItem(i,&ptci));
1125 CLogger *l = (CLogger*)ptci.lParam;
1126 if(l==this){
1127 memset(&ptci,0,sizeof(ptci));
1128 ptci.mask=TCIF_IMAGE;
1129 ptci.iImage=dad->m_iTriggered;
1130 VERIFY(dad->m_Tabs.SetItem(i,&ptci));
1131 }
1132 }
1133 }
1134 PlayWave();
1135 switch(m_LogTo){
1136 case logToFile:
1137 if(!m_LogToName.IsEmpty()){
1138 TRY{
1139 CFile file(m_LogToName,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::shareDenyWrite|CFile::typeBinary);
1140 file.SeekToEnd();
1141 CString tmp = le->m_Time.Format(IDS_LOGFILETIMEFORMAT);
1142 file.Write((LPCTSTR)tmp,tmp.GetLength());
1143 tmp.Format(IDS_LOGFILESOURCEFORMAT,le->m_Source);
1144 file.Write((LPCTSTR)tmp,tmp.GetLength());
1145 tmp.Format(IDS_LOGFILEPRIFACEFORMAT,CSyslogSocket::m_Facilities[fac],CSyslogSocket::m_Priorities[pri]);
1146 file.Write((LPCTSTR)tmp,tmp.GetLength());
1147 file.Write(line,strlen(line));
1148 file.Write("\r\n",2);
1149 file.Close();
1150 }CATCH(CFileException, e){
1151 #ifndefNDEBUG
1152 afxDump << "Logging error: " << e->m_cause << "\n";
1153#endif
1154 }END_CATCH
1155 }
1156 break;
1157 case logToHost:
1158 if(m_LogToHost.sin_addr.s_addr!=INADDR_NONE){
1159 CString tmp;
1160 tmp.Format(IDS_LOGHOSTSOURCEFORMAT,le->m_Source);
1161 tmp+=line;
1162 dad->m_SLS.LogTo(m_LogToHost.sin_addr.s_addr,pri,fac,tmp);
1163 }
1164 break;
1165 }
1166}
1167
1168CLogEntry& CLogEntry::operator=(CLogEntry& src)
1169{
1170 m_Data=src.m_Data;
1171 m_Facility=src.m_Facility;
1172 m_Priority=src.m_Priority;
1173 m_Source=src.m_Source;
1174 m_Time=src.m_Time;
1175 return *this;
1176}
1177
1178CLogEntry::CLogEntry(CLogEntry& src)
1179{
1180 (*this)=src;
1181}
1182
1183void CKLogDlg::AddLogLine(CLogEntry *le)
1184{
1185 ASSERT(le);
1186int i = m_Log.AddString(le->m_Data);
1187 m_Log.SetItemData(i,(DWORD)le);
1188 m_Log.SetCurSel(i);
1189}
1190
1191BOOL CKLogDlg::PreTranslateMessage(MSG* pMsg)
1192{
1193 // CG: The following block was added by the ToolTips component.
1194 {
1195 // Let the ToolTip process this message.
1196 m_tooltip.RelayEvent(pMsg);
1197
1198 return CDialog::PreTranslateMessage(pMsg);
1199 }
1200}
1201
1202void CKLogDlg::OnSelchangeLog()
1203{
1204int i = m_Log.GetCurSel();
1205 if(i==LB_ERR)
1206 return;
1207CLogEntry *le = (CLogEntry*)m_Log.GetItemData(i);
1208 ASSERT(le);
1209CString tmp;
1210 tmp.Format(IDS_TIP_LOG,
1211 (LPCTSTR)le->m_Time.Format(IDS_LOGTIMEFORMAT),
1212 (LPCTSTR)le->m_Source,
1213 CSyslogSocket::m_Facilities[le->m_Facility],
1214 CSyslogSocket::m_Priorities[le->m_Priority]
1215 );
1216 m_tooltip.UpdateTipText(tmp,&m_Log);
1217}
1218
1219int CKLogDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
1220{
1221 if (CDialog::OnCreate(lpCreateStruct) == -1)
1222 return -1;
1223
1224 if(!m_Trayer->Create(NULL,"PumpKIN TrayIcon",WS_CHILD,CRect(0,0,0,0),this,0)){
1225 TRACE0("Failed to create trayer\n");
1226 return -1;
1227 }
1228
1229NOTIFYICONDATA nid;
1230 memset(&nid,0,sizeof(nid));
1231 nid.cbSize=sizeof(nid);
1232 nid.hWnd=m_Trayer->m_hWnd;
1233 nid.uID=IDC_TRAYICON;
1234 nid.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;
1235 nid.uCallbackMessage=WM_TRAYICON;
1236 nid.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
1237 // *** Load from resource
1238 strcpy(nid.szTip,"KLog");
1239 VERIFY(Shell_NotifyIcon(NIM_ADD,&nid));
1240
1241 return 0;
1242}
1243
1244void CKLogDlg::OnClose()
1245{
1246 OnTrayShowklogwindow();
1247}
1248
1249void CKLogDlg::OnTrayAboutklog()
1250{
1251CAboutDlg dlgAbout;
1252 dlgAbout.DoModal();
1253}
1254
1255void CKLogDlg::OnTrayExit()
1256{
1257 OnExit();
1258}
1259
1260void CKLogDlg::OnTrayShowklogwindow()
1261{
1262 if(IsWindowVisible()){
1263 m_bShown=FALSE;
1264 ShowWindow(SW_HIDE);
1265 }else{
1266 m_bShown=TRUE;
1267 ShowWindow(SW_SHOW);
1268 SetForegroundWindow();
1269 SetFocus();
1270 }
1271}
1272
1273void CKLogDlg::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
1274{
1275 CDialog::OnWindowPosChanging(lpwndpos);
1276
1277 if(!m_bExiting){
1278 if(m_bShown){
1279 lpwndpos->flags&=~SWP_HIDEWINDOW;
1280 lpwndpos->flags|=SWP_SHOWWINDOW;
1281 }else{
1282 lpwndpos->flags&=~SWP_SHOWWINDOW;
1283 lpwndpos->flags|=SWP_HIDEWINDOW;
1284 if(::GetForegroundWindow()==m_hWnd && (m_Trayer && !m_Trayer->m_inMenu))
1285 GetDesktopWindow()->SetForegroundWindow();
1286 }
1287 }
1288}
1289
1290void CKLogDlg::LoadSettings()
1291{
1292CWinApp *app = AfxGetApp();
1293 ASSERT(app);
1294 m_LogItems=app->GetProfileInt("UISettings","LogLength",m_LogItems);
1295 m_bShown=app->GetProfileInt("UISettings","Visible",m_bShown);
1296 m_bWarnBlocking=app->GetProfileInt("Resolve","WarnBlocking",m_bWarnBlocking);
1297 m_bDontWarn=app->GetProfileInt("Resolve","DontWarn",m_bDontWarn);
1298}
1299
1300void CKLogDlg::SaveSettings()
1301{
1302CWinApp *app = AfxGetApp();
1303 ASSERT(app);
1304 app->WriteProfileInt("UISettings","LogLength",m_LogItems);
1305 app->WriteProfileInt("UISettings","Visible",m_bShown);
1306 app->WriteProfileInt("Resolve","WarnBlocking",m_bWarnBlocking);
1307 app->WriteProfileInt("Resolve","DontWarn",m_bDontWarn);
1308CMemFile mf(4096);
1309CArchive ar(&mf,CArchive::store);
1310 Serialize(ar);
1311 ar.Close();
1312DWORD dataLength = mf.GetLength();
1313 if(dataLength&0xFFFF0000l){
1314 CString tmp;
1315 tmp.LoadString(IDS_MSG_FAILEDTOSTORE);
1316 MessageBox(tmp,NULL,MB_ICONHAND|MB_OK);
1317 }else{
1318 UINT dl = (UINT)dataLength;
1319 BYTE *data = mf.Detach();
1320 app->WriteProfileBinary("Layout","Destinations",data,dl);
1321 delete data;
1322 }
1323}
1324
1325CKLogDlg::~CKLogDlg()
1326{
1327 delete m_Trayer;
1328}
1329
1330void CKLogDlg::OnLogpattern()
1331{
1332CLogPattern lp(IDS_LOGPATTERN_TITLE,this);
1333 memmove(lp.m_Pattern,m_Logger->m_LogPattern,sizeof(lp.m_Pattern));
1334 if(lp.DoModal()==IDOK){
1335 memmove(m_Logger->m_LogPattern,lp.m_Pattern,sizeof(m_Logger->m_LogPattern));
1336 UpdatePriface(FALSE,TRUE);
1337 }
1338}
1339
1340void CLogger::LookupHost(CKLogDlg *daddy)
1341{
1342 m_LogToHost.sin_addr.s_addr=inet_addr((LPCTSTR)m_LogToName);
1343 if(m_LogToHost.sin_addr.s_addr==INADDR_NONE){
1344 if(daddy->m_bWarnBlocking){
1345 CWarnBlocking wb(::IsWindow(daddy->m_hWnd)?daddy:NULL);
1346 wb.m_bDontWarn = daddy->m_bDontWarn;
1347 if(wb.DoModal()!=IDOK)
1348 return;
1349 daddy->m_bDontWarn=wb.m_bDontWarn;
1350 daddy->m_bWarnBlocking=!wb.m_bDontWarn;
1351 }
1352 daddy->BeginWaitCursor();
1353 hostent *he = gethostbyname(m_LogToName);
1354 daddy->EndWaitCursor();
1355 if(he){
1356 m_LogToHost.sin_addr.s_addr = *(DWORD*)he->h_addr;
1357 }else{
1358 m_LogToHost.sin_addr.s_addr = INADDR_NONE;
1359 if(daddy->m_bWarnBlocking){
1360 CString sux;
1361 sux.Format(IDS_MSG_LOOKUPFAILED,(LPCTSTR)m_LogToName);
1362 daddy->MessageBox(sux,NULL,MB_ICONSTOP|MB_OK);
1363 }else
1364 MessageBeep(MB_ICONHAND);
1365 }
1366 }
1367}
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 @@
1// KLogDlg.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CKLogDlg dialog
6
7class CKLogDlg;
8class CKLogSocket : public CSyslogSocket {
9public:
10 CKLogDlg* m_Daddy;
11 virtual void Log(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin);
12};
13
14 class CHostMask: public CObject{
15public:
16 virtual void Serialize(CArchive& ar);
17 DWORDm_Host;
18 DWORDm_Mask;
19 BOOL IsThis(DWORD host){ return (host&m_Mask)==(m_Host&m_Mask); }
20 CHostMask(): m_Host(0), m_Mask(0) {}
21 CHostMask(DWORD host,DWORD mask) : m_Host(host), m_Mask(mask) {}
22 CString String();
23
24 DECLARE_SERIAL( CHostMask )
25};
26 class CLogEntry: public CObject {
27public:
28 CLogEntry(CLogEntry& src);
29 CLogEntry& operator=(CLogEntry& src);
30 CTime m_Time;
31 CString m_Source;
32 CString m_Data;
33 UINT m_Priority;
34 UINT m_Facility;
35 DECLARE_SERIAL( CLogEntry )
36public:
37 CLogEntry();
38};
39
40 typedefCTypedPtrList<CObList,CHostMask*> CAccessList;
41typedef CList<CLogEntry*,CLogEntry*> CLog;
42
43 class CLogger : public CObject{
44public:
45 void LookupHost(CKLogDlg *daddy);
46 void LogLine(CKLogDlg *dad,UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin);
47 BOOL IsHostFine(DWORD saddr);
48 virtual void Serialize(CArchive& ar);
49 virtual ~CLogger();
50 void PlayWave();
51 CLogger(BOOL bAll=FALSE);
52 CStringm_Desc;
53 enum{
54 logToFile=0, logToHost=1, logToNone=2,
55 };
56 int m_LogTo;
57 CStringm_LogToName;
58 SOCKADDR_IN m_LogToHost;
59 BOOL m_LogPattern[CSyslogSocket::totalFacilities][CSyslogSocket::totalPriorities];
60 CAccessList m_Hosts;
61 CStringm_Sound;
62 CLog m_Log;
63 DECLARE_SERIAL( CLogger )
64};
65
66typedef CMap<CLogger*,CLogger*,CLogger*,CLogger*> CLoggers;
67
68class CTrayer;
69class CKLogDlg : public CDialog
70{
71// Construction
72public:
73 BOOL m_bDontWarn;
74 BOOL m_bWarnBlocking;
75 CSyslogSocket m_SLS;
76 virtual ~CKLogDlg();
77 void SaveSettings();
78 void LoadSettings();
79 BOOL m_bExiting;
80 BOOL m_bShown;
81 CTrayer* m_Trayer;
82 virtual BOOL PreTranslateMessage(MSG* pMsg);
83 void AddLogLine(CLogEntry *le);
84 void LogMessage(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin);
85 CKLogSocket m_KLS;
86 virtual void Serialize(CArchive& ar);
87 void TotalCleanUp();
88 BITMAP m_bitmapBack;
89 CBitmap m_bmpBack;
90 void UpdateLogLength(BOOL bSave=TRUE,BOOL update=FALSE);
91 int m_LogItems;
92 void UpdateLogto(BOOL bSave=TRUE,BOOL update=TRUE);
93 void UpdatePriface(BOOL bSave=TRUE,BOOL update=TRUE);
94 static UINT m_PriorityCtls[CSyslogSocket::totalPriorities];
95 CLogger* m_Logger;
96 void SetTab(CLogger* l);
97 int m_iTriggered;
98 int m_iNormal;
99 CImageList m_Images;
100 CLoggers m_Logs;
101 CKLogDlg(CWnd* pParent = NULL);// standard constructor
102
103 DECLARE_SERIAL( CKLogDlg )
104
105// Dialog Data
106 //{{AFX_DATA(CKLogDlg)
107 enum { IDD = IDD_KLOG_DIALOG };
108 CButtonm_LogPatternCtl;
109 CButtonm_FilesCtl;
110 CSpinButtonCtrlm_LogLenSpinCtl;
111 CStaticm_LogLengthCtl;
112 CButtonm_PriInvertCtl;
113 CButtonm_LogtoFileCtl;
114 CButtonm_LogtoHostCtl;
115 CButtonm_LogtoNoneCtl;
116 CStaticm_HFNameCaptionCtl;
117 CListBoxm_hlCtl;
118 CButtonm_BrowseSoundCtl;
119 CButtonm_PriNoneCtl;
120 CButtonm_hlRemoveCtl;
121 CEditm_hlMaskCtl;
122 CEditm_hlIPCtl;
123 CButtonm_hlAddCtl;
124 CButtonm_PriAllCtl;
125 CComboBoxm_SoundCtl;
126 CButtonm_RemoveCtl;
127 CButtonm_PlaySoundCtl;
128 CListBoxm_Log;
129 CEditm_HFNameCtl;
130 CComboBoxm_FacilityCtl;
131 CButtonm_BrowseCtl;
132 CEditm_DescCtl;
133 CTabCtrlm_Tabs;
134 int m_Logto;
135 CStringm_Desc;
136 CStringm_Facility;
137 CStringm_HFName;
138 CStringm_HFNameCaption;
139 CStringm_hlIP;
140 CStringm_hlMask;
141 CStringm_Sound;
142 //}}AFX_DATA
143
144 // ClassWizard generated virtual function overrides
145 //{{AFX_VIRTUAL(CKLogDlg)
146 protected:
147 virtual void DoDataExchange(CDataExchange* pDX);// DDX/DDV support
148 //}}AFX_VIRTUAL
149
150// Implementation
151protected:
152 CToolTipCtrl m_tooltip;
153 HICON m_hIcon;
154
155 // Generated message map functions
156 //{{AFX_MSG(CKLogDlg)
157 virtual BOOL OnInitDialog();
158 afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
159 afx_msg void OnDestroy();
160 afx_msg void OnPaint();
161 afx_msg HCURSOR OnQueryDragIcon();
162 afx_msg void OnAdd();
163 afx_msg void OnSelchangeTabs(NMHDR* pNMHDR, LRESULT* pResult);
164 afx_msg void OnSelchangeFacility();
165 afx_msg void OnPriority();
166 afx_msg void OnLogto();
167 afx_msg void OnPriAll();
168 afx_msg void OnPriNone();
169 afx_msg void OnChangeDesc();
170 afx_msg void OnPriInvert();
171 afx_msg void OnHlAdd();
172 afx_msg void OnSelchangeHosts();
173 afx_msg void OnHlRemove();
174 afx_msg void OnRemove();
175 afx_msg void OnPlaysound();
176 afx_msg void OnEditchangeSound();
177 afx_msg void OnKillfocusSound();
178 afx_msg void OnDeltaposLoglenspin(NMHDR* pNMHDR, LRESULT* pResult);
179 afx_msg void OnExit();
180 afx_msg void OnFiles();
181 afx_msg void OnFilesExport();
182 afx_msg void OnFilesImport();
183 afx_msg void OnBrowsesound();
184 afx_msg void OnKillfocusHostfile();
185 virtual void OnOK();
186 afx_msg void OnBrowse();
187 afx_msg void OnFilesReset();
188 afx_msg void OnSelchangeLog();
189 afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
190 afx_msg void OnClose();
191 afx_msg void OnTrayAboutklog();
192 afx_msg void OnTrayExit();
193 afx_msg void OnTrayShowklogwindow();
194 afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
195 afx_msg void OnLogpattern();
196 //}}AFX_MSG
197 DECLARE_MESSAGE_MAP()
198};
diff --git a/KTAGS b/KTAGS
new file mode 100644
index 0000000..81b6fc2
--- a/dev/null
+++ b/KTAGS
@@ -0,0 +1,12 @@
1 about-date klog.rc /LTEXT\s\+"Copyright /;"kind:d
2 about-version klog.rc /LTEXT\s\+"KLog, Version /;"kind:v
3 help-license-date ./help/klog.xml /<license\s/;"kind:d
4 help-news ./help/klog.xml/<newsfor\s/
5 install-version ./install/install.cpp /^#define\s\+KINAME\s\+"/;"kind:v
6 install-vsinfo-date install/install.rc /^\s\+VALUE\s\+"LegalCopyright",/;"kind:d
7 install-vsinfo-numeric-version install/install.rc /^\s\+FILEVERSION\s\+/;"kind:v
8 install-vsinfo-string-version install/install.rc /^\s\+VALUE\s\+"FileVersion",/;"kind:v
9 license-date COPYING :1;"kind:d
10 vsinfo-date klog.rc /VALUE\s\+"LegalCopyright",/;"kind:d
11 vsinfo-numeric-version klog.rc /^\s\+FILEVERSION\s\+/;"kind:v
12 vsinfo-string-version klog.rc /^\s\+VALUE\s\+"FileVersion",/;"kind:v
diff --git a/LogPattern.cpp b/LogPattern.cpp
new file mode 100644
index 0000000..649fe52
--- a/dev/null
+++ b/LogPattern.cpp
@@ -0,0 +1,157 @@
1// LogPattern.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "SyslogSocket.h"
7#include "LogPattern.h"
8
9#include "LogPatternUnix.h"
10#include "LogPatternReserved.h"
11#include "LogPatternLocal.h"
12
13#ifdef _DEBUG
14#define new DEBUG_NEW
15#undef THIS_FILE
16static char THIS_FILE[] = __FILE__;
17#endif
18
19/////////////////////////////////////////////////////////////////////////////
20// CLogPattern
21
22UINT CLogPattern::m_ID[CSyslogSocket::totalFacilities][CSyslogSocket::totalPriorities] = {
23 // Unix
24 { IDC_KERNEL_EMERG,IDC_KERNEL_ALERT,IDC_KERNEL_CRIT,IDC_KERNEL_ERR,IDC_KERNEL_WARN,IDC_KERNEL_NOTICE,IDC_KERNEL_INFO,IDC_KERNEL_DEBUG },
25 { IDC_USER_EMERG,IDC_USER_ALERT,IDC_USER_CRIT,IDC_USER_ERR,IDC_USER_WARN,IDC_USER_NOTICE,IDC_USER_INFO,IDC_USER_DEBUG },
26 { IDC_MAIL_EMERG,IDC_MAIL_ALERT,IDC_MAIL_CRIT,IDC_MAIL_ERR,IDC_MAIL_WARN,IDC_MAIL_NOTICE,IDC_MAIL_INFO,IDC_MAIL_DEBUG },
27 { IDC_DAEMON_EMERG,IDC_DAEMON_ALERT,IDC_DAEMON_CRIT,IDC_DAEMON_ERR,IDC_DAEMON_WARN,IDC_DAEMON_NOTICE,IDC_DAEMON_INFO,IDC_DAEMON_DEBUG },
28 { IDC_AUTH_EMERG,IDC_AUTH_ALERT,IDC_AUTH_CRIT,IDC_AUTH_ERR,IDC_AUTH_WARN,IDC_AUTH_NOTICE,IDC_AUTH_INFO,IDC_AUTH_DEBUG },
29 { IDC_SYSLOG_EMERG,IDC_SYSLOG_ALERT,IDC_SYSLOG_CRIT,IDC_SYSLOG_ERR,IDC_SYSLOG_WARN,IDC_SYSLOG_NOTICE,IDC_SYSLOG_INFO,IDC_SYSLOG_DEBUG },
30 { IDC_LPR_EMERG,IDC_LPR_ALERT,IDC_LPR_CRIT,IDC_LPR_ERR,IDC_LPR_WARN,IDC_LPR_NOTICE,IDC_LPR_INFO,IDC_LPR_DEBUG },
31 { IDC_NEWS_EMERG,IDC_NEWS_ALERT,IDC_NEWS_CRIT,IDC_NEWS_ERR,IDC_NEWS_WARN,IDC_NEWS_NOTICE,IDC_NEWS_INFO,IDC_NEWS_DEBUG },
32 { IDC_UUCP_EMERG,IDC_UUCP_ALERT,IDC_UUCP_CRIT,IDC_UUCP_ERR,IDC_UUCP_WARN,IDC_UUCP_NOTICE,IDC_UUCP_INFO,IDC_UUCP_DEBUG },
33 { IDC_CRON_EMERG,IDC_CRON_ALERT,IDC_CRON_CRIT,IDC_CRON_ERR,IDC_CRON_WARN,IDC_CRON_NOTICE,IDC_CRON_INFO,IDC_CRON_DEBUG },
34 { IDC_AUTHPRIV_EMERG,IDC_AUTHPRIV_ALERT,IDC_AUTHPRIV_CRIT,IDC_AUTHPRIV_ERR,IDC_AUTHPRIV_WARN,IDC_AUTHPRIV_NOTICE,IDC_AUTHPRIV_INFO,IDC_AUTHPRIV_DEBUG },
35 // Reserved
36 { IDC_R0_EMERG,IDC_R0_ALERT,IDC_R0_CRIT,IDC_R0_ERR,IDC_R0_WARN,IDC_R0_NOTICE,IDC_R0_INFO,IDC_R0_DEBUG },
37 { IDC_R1_EMERG,IDC_R1_ALERT,IDC_R1_CRIT,IDC_R1_ERR,IDC_R1_WARN,IDC_R1_NOTICE,IDC_R1_INFO,IDC_R1_DEBUG },
38 { IDC_R2_EMERG,IDC_R2_ALERT,IDC_R2_CRIT,IDC_R2_ERR,IDC_R2_WARN,IDC_R2_NOTICE,IDC_R2_INFO,IDC_R2_DEBUG },
39 { IDC_R3_EMERG,IDC_R3_ALERT,IDC_R3_CRIT,IDC_R3_ERR,IDC_R3_WARN,IDC_R3_NOTICE,IDC_R3_INFO,IDC_R3_DEBUG },
40 { IDC_R4_EMERG,IDC_R4_ALERT,IDC_R4_CRIT,IDC_R4_ERR,IDC_R4_WARN,IDC_R4_NOTICE,IDC_R4_INFO,IDC_R4_DEBUG },
41 // Local
42 { IDC_L0_EMERG,IDC_L0_ALERT,IDC_L0_CRIT,IDC_L0_ERR,IDC_L0_WARN,IDC_L0_NOTICE,IDC_L0_INFO,IDC_L0_DEBUG },
43 { IDC_L1_EMERG,IDC_L1_ALERT,IDC_L1_CRIT,IDC_L1_ERR,IDC_L1_WARN,IDC_L1_NOTICE,IDC_L1_INFO,IDC_L1_DEBUG },
44 { IDC_L2_EMERG,IDC_L2_ALERT,IDC_L2_CRIT,IDC_L2_ERR,IDC_L2_WARN,IDC_L2_NOTICE,IDC_L2_INFO,IDC_L2_DEBUG },
45 { IDC_L3_EMERG,IDC_L3_ALERT,IDC_L3_CRIT,IDC_L3_ERR,IDC_L3_WARN,IDC_L3_NOTICE,IDC_L3_INFO,IDC_L3_DEBUG },
46 { IDC_L4_EMERG,IDC_L4_ALERT,IDC_L4_CRIT,IDC_L4_ERR,IDC_L4_WARN,IDC_L4_NOTICE,IDC_L4_INFO,IDC_L4_DEBUG },
47 { IDC_L5_EMERG,IDC_L5_ALERT,IDC_L5_CRIT,IDC_L5_ERR,IDC_L5_WARN,IDC_L5_NOTICE,IDC_L5_INFO,IDC_L5_DEBUG },
48 { IDC_L6_EMERG,IDC_L6_ALERT,IDC_L6_CRIT,IDC_L6_ERR,IDC_L6_WARN,IDC_L6_NOTICE,IDC_L6_INFO,IDC_L6_DEBUG },
49 { IDC_L7_EMERG,IDC_L7_ALERT,IDC_L7_CRIT,IDC_L7_ERR,IDC_L7_WARN,IDC_L7_NOTICE,IDC_L7_INFO,IDC_L7_DEBUG }
50};
51
52IMPLEMENT_DYNAMIC(CLogPattern, CPropertySheet)
53
54CLogPattern::CLogPattern(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
55 :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
56{
57 AddPages();
58}
59
60CLogPattern::CLogPattern(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
61 :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
62{
63 AddPages();
64}
65
66CLogPattern::~CLogPattern()
67{
68 delete m_Unix;
69 delete m_Reserved;
70 delete m_Local;
71}
72
73
74BEGIN_MESSAGE_MAP(CLogPattern, CPropertySheet)
75 //{{AFX_MSG_MAP(CLogPattern)
76 //}}AFX_MSG_MAP
77END_MESSAGE_MAP()
78
79/////////////////////////////////////////////////////////////////////////////
80// CLogPattern message handlers
81
82void CLogPattern::AddPages()
83{
84 m_Unix = new CLogPatternUnix(this);
85 ASSERT(m_Unix);
86 AddPage(m_Unix);
87 m_Reserved = new CLogPatternReserved(this);
88 ASSERT(m_Reserved);
89 AddPage(m_Reserved);
90 m_Local = new CLogPatternLocal(this);
91 ASSERT(m_Local);
92 AddPage(m_Local);
93}
94
95void CLogPattern::ExchangeData(CDataExchange *pDX,UINT from,UINT to)
96{
97 if(pDX->m_bSaveAndValidate){
98 for(UINT f=from;f<=to;f++){
99 for(UINT p=0;p<CSyslogSocket::totalPriorities;p++){
100 switch(pDX->m_pDlgWnd->IsDlgButtonChecked(m_ID[f][p])){
101 case 0:
102 m_Pattern[f][p]=FALSE;
103 break;
104 case 1:
105 m_Pattern[f][p]=TRUE;
106 break;
107 #ifndefNDEBUG
108 default:
109 ASSERT(FALSE);
110 break;
111#endif
112 }
113 }
114 }
115 }else{
116 for(UINT f=from;f<=to;f++){
117 for(UINT p=0;p<CSyslogSocket::totalPriorities;p++){
118 pDX->m_pDlgWnd->CheckDlgButton(m_ID[f][p],m_Pattern[f][p]?1:0);
119 }
120 }
121 }
122}
123
124void CLogPattern::PriorityOn(CWnd *pWnd,UINT pri,UINT from,UINT to)
125{
126 for(UINT f=from;f<=to;f++)
127 pWnd->CheckDlgButton(m_ID[f][pri],1);
128}
129
130void CLogPattern::PriorityXor(CWnd *pWnd,UINT pri,UINT from,UINT to)
131{
132 for(UINT f=from;f<=to;f++)
133 pWnd->CheckDlgButton(m_ID[f][pri],pWnd->IsDlgButtonChecked(m_ID[f][pri])?0:1);
134}
135
136void CLogPattern::FacilityOn(CWnd *pWnd,UINT fac)
137{
138 for(int p=0;p<CSyslogSocket::totalPriorities;p++)
139 pWnd->CheckDlgButton(m_ID[fac][p],1);
140}
141
142void CLogPattern::FacilityXor(CWnd *pWnd,UINT fac)
143{
144 for(int p=0;p<CSyslogSocket::totalPriorities;p++)
145 pWnd->CheckDlgButton(m_ID[fac][p],pWnd->IsDlgButtonChecked(m_ID[fac][p])?0:1);
146}
147
148void CLogPattern::AddTips(CToolTipCtrl& tt,CWnd *pWnd,UINT from,UINT to)
149{
150CString ttt;
151 for(UINT f=from;f<to;f++){
152 for(UINT p=0;p<CSyslogSocket::totalPriorities;p++){
153 ttt.Format("%s.%s",CSyslogSocket::m_Facilities[f],CSyslogSocket::m_Priorities[p]);
154 tt.AddTool(pWnd->GetDlgItem(m_ID[f][p]),ttt);
155 }
156 }
157}
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 @@
1// LogPattern.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CLogPattern
6
7 classCLogPatternUnix;
8 classCLogPatternReserved;
9 classCLogPatternLocal;
10class CLogPattern : public CPropertySheet
11{
12 DECLARE_DYNAMIC(CLogPattern)
13
14// Construction
15public:
16 void AddTips(CToolTipCtrl& tt,CWnd *pWnd,UINT from,UINT to);
17 void FacilityXor(CWnd *pWnd,UINT fac);
18 void FacilityOn(CWnd *pWnd,UINT fac);
19 void PriorityXor(CWnd *pWnd,UINT pri,UINT from,UINT to);
20 void PriorityOn(CWnd *pWnd,UINT pri,UINT from,UINT to);
21 void ExchangeData(CDataExchange *pDX,UINT from,UINT to);
22 static UINT m_ID[CSyslogSocket::totalFacilities][CSyslogSocket::totalPriorities];
23 CLogPatternLocal *m_Local;
24 CLogPatternReserved *m_Reserved;
25 CLogPatternUnix *m_Unix;
26 void AddPages();
27 BOOL m_Pattern[CSyslogSocket::totalFacilities][CSyslogSocket::totalPriorities];
28 CLogPattern(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
29 CLogPattern(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
30
31// Attributes
32public:
33
34// Operations
35public:
36
37// Overrides
38 // ClassWizard generated virtual function overrides
39 //{{AFX_VIRTUAL(CLogPattern)
40 //}}AFX_VIRTUAL
41
42// Implementation
43public:
44 virtual ~CLogPattern();
45
46 // Generated message map functions
47protected:
48 //{{AFX_MSG(CLogPattern)
49 //}}AFX_MSG
50 DECLARE_MESSAGE_MAP()
51};
52
53/////////////////////////////////////////////////////////////////////////////
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 @@
1// LogPatternLocal.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "LogPatternLocal.h"
7
8#include "SyslogSocket.h"
9#include "LogPattern.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CLogPatternLocal property page
19
20 #definePFROM CSyslogSocket::facLocal0
21 #define PTO CSyslogSocket::facLocal7
22
23IMPLEMENT_DYNCREATE(CLogPatternLocal, CPropertyPage)
24
25CLogPatternLocal::CLogPatternLocal(CLogPattern* daddy) : CPropertyPage(CLogPatternLocal::IDD), m_Daddy(daddy)
26{
27 //{{AFX_DATA_INIT(CLogPatternLocal)
28 //}}AFX_DATA_INIT
29}
30
31CLogPatternLocal::~CLogPatternLocal()
32{
33}
34
35void CLogPatternLocal::DoDataExchange(CDataExchange* pDX)
36{
37 CPropertyPage::DoDataExchange(pDX);
38 //{{AFX_DATA_MAP(CLogPatternLocal)
39 //}}AFX_DATA_MAP
40 m_Daddy->ExchangeData(pDX,PFROM,PTO);
41}
42
43
44BEGIN_MESSAGE_MAP(CLogPatternLocal, CPropertyPage)
45 //{{AFX_MSG_MAP(CLogPatternLocal)
46 ON_BN_CLICKED(IDC_ALERT_ON, OnAlertOn)
47 ON_BN_CLICKED(IDC_ALERT_XOR, OnAlertXor)
48 ON_BN_CLICKED(IDC_CRIT_ON, OnCritOn)
49 ON_BN_CLICKED(IDC_CRIT_XOR, OnCritXor)
50 ON_BN_CLICKED(IDC_DEBUG_ON, OnDebugOn)
51 ON_BN_CLICKED(IDC_DEBUG_XOR, OnDebugXor)
52 ON_BN_CLICKED(IDC_EMERG_ON, OnEmergOn)
53 ON_BN_CLICKED(IDC_EMERG_XOR, OnEmergXor)
54 ON_BN_CLICKED(IDC_ERR_ON, OnErrOn)
55 ON_BN_CLICKED(IDC_ERR_XOR, OnErrXor)
56 ON_BN_CLICKED(IDC_INFO_ON, OnInfoOn)
57 ON_BN_CLICKED(IDC_INFO_XOR, OnInfoXor)
58 ON_BN_CLICKED(IDC_L0_ON, OnL0On)
59 ON_BN_CLICKED(IDC_L0_XOR, OnL0Xor)
60 ON_BN_CLICKED(IDC_L1_ON, OnL1On)
61 ON_BN_CLICKED(IDC_L1_XOR, OnL1Xor)
62 ON_BN_CLICKED(IDC_L2_ON, OnL2On)
63 ON_BN_CLICKED(IDC_L2_XOR, OnL2Xor)
64 ON_BN_CLICKED(IDC_L3_ON, OnL3On)
65 ON_BN_CLICKED(IDC_L3_XOR, OnL3Xor)
66 ON_BN_CLICKED(IDC_L4_ON, OnL4On)
67 ON_BN_CLICKED(IDC_L4_XOR, OnL4Xor)
68 ON_BN_CLICKED(IDC_L5_ON, OnL5On)
69 ON_BN_CLICKED(IDC_L5_XOR, OnL5Xor)
70 ON_BN_CLICKED(IDC_L6_ON, OnL6On)
71 ON_BN_CLICKED(IDC_L6_XOR, OnL6Xor)
72 ON_BN_CLICKED(IDC_L7_ON, OnL7On)
73 ON_BN_CLICKED(IDC_L7_XOR, OnL7Xor)
74 ON_BN_CLICKED(IDC_NOTICE_ON, OnNoticeOn)
75 ON_BN_CLICKED(IDC_NOTICE_XOR, OnNoticeXor)
76 ON_BN_CLICKED(IDC_WARN_ON, OnWarnOn)
77 ON_BN_CLICKED(IDC_WARN_XOR, OnWarnXor)
78 //}}AFX_MSG_MAP
79END_MESSAGE_MAP()
80
81/////////////////////////////////////////////////////////////////////////////
82// CLogPatternLocal message handlers
83
84void CLogPatternLocal::OnAlertOn()
85{
86 m_Daddy->PriorityOn(this,CSyslogSocket::priAlert,PFROM,PTO);
87}
88void CLogPatternLocal::OnAlertXor()
89{
90 m_Daddy->PriorityXor(this,CSyslogSocket::priAlert,PFROM,PTO);
91}
92
93void CLogPatternLocal::OnCritOn()
94{
95 m_Daddy->PriorityOn(this,CSyslogSocket::priCritical,PFROM,PTO);
96}
97void CLogPatternLocal::OnCritXor()
98{
99 m_Daddy->PriorityXor(this,CSyslogSocket::priCritical,PFROM,PTO);
100}
101
102void CLogPatternLocal::OnDebugOn()
103{
104 m_Daddy->PriorityOn(this,CSyslogSocket::priDebug,PFROM,PTO);
105}
106void CLogPatternLocal::OnDebugXor()
107{
108 m_Daddy->PriorityXor(this,CSyslogSocket::priDebug,PFROM,PTO);
109}
110
111void CLogPatternLocal::OnEmergOn()
112{
113 m_Daddy->PriorityOn(this,CSyslogSocket::priEmergency,PFROM,PTO);
114}
115void CLogPatternLocal::OnEmergXor()
116{
117 m_Daddy->PriorityXor(this,CSyslogSocket::priEmergency,PFROM,PTO);
118}
119
120void CLogPatternLocal::OnErrOn()
121{
122 m_Daddy->PriorityOn(this,CSyslogSocket::priError,PFROM,PTO);
123}
124void CLogPatternLocal::OnErrXor()
125{
126 m_Daddy->PriorityXor(this,CSyslogSocket::priError,PFROM,PTO);
127}
128
129void CLogPatternLocal::OnInfoOn()
130{
131 m_Daddy->PriorityOn(this,CSyslogSocket::priInfo,PFROM,PTO);
132}
133void CLogPatternLocal::OnInfoXor()
134{
135 m_Daddy->PriorityXor(this,CSyslogSocket::priInfo,PFROM,PTO);
136}
137
138void CLogPatternLocal::OnL0On()
139{
140 m_Daddy->FacilityOn(this,CSyslogSocket::facLocal0);
141}
142void CLogPatternLocal::OnL0Xor()
143{
144 m_Daddy->FacilityXor(this,CSyslogSocket::facLocal0);
145}
146
147void CLogPatternLocal::OnL1On()
148{
149 m_Daddy->FacilityOn(this,CSyslogSocket::facLocal1);
150}
151void CLogPatternLocal::OnL1Xor()
152{
153 m_Daddy->FacilityXor(this,CSyslogSocket::facLocal1);
154}
155
156void CLogPatternLocal::OnL2On()
157{
158 m_Daddy->FacilityOn(this,CSyslogSocket::facLocal2);
159}
160void CLogPatternLocal::OnL2Xor()
161{
162 m_Daddy->FacilityXor(this,CSyslogSocket::facLocal2);
163}
164
165void CLogPatternLocal::OnL3On()
166{
167 m_Daddy->FacilityOn(this,CSyslogSocket::facLocal3);
168}
169void CLogPatternLocal::OnL3Xor()
170{
171 m_Daddy->FacilityXor(this,CSyslogSocket::facLocal3);
172}
173
174void CLogPatternLocal::OnL4On()
175{
176 m_Daddy->FacilityOn(this,CSyslogSocket::facLocal4);
177}
178void CLogPatternLocal::OnL4Xor()
179{
180 m_Daddy->FacilityXor(this,CSyslogSocket::facLocal4);
181}
182
183void CLogPatternLocal::OnL5On()
184{
185 m_Daddy->FacilityOn(this,CSyslogSocket::facLocal5);
186}
187void CLogPatternLocal::OnL5Xor()
188{
189 m_Daddy->FacilityXor(this,CSyslogSocket::facLocal5);
190}
191
192void CLogPatternLocal::OnL6On()
193{
194 m_Daddy->FacilityOn(this,CSyslogSocket::facLocal6);
195
196}
197void CLogPatternLocal::OnL6Xor()
198{
199 m_Daddy->FacilityXor(this,CSyslogSocket::facLocal6);
200}
201
202void CLogPatternLocal::OnL7On()
203{
204 m_Daddy->FacilityOn(this,CSyslogSocket::facLocal7);
205}
206void CLogPatternLocal::OnL7Xor()
207{
208 m_Daddy->FacilityXor(this,CSyslogSocket::facLocal7);
209}
210
211void CLogPatternLocal::OnNoticeOn()
212{
213 m_Daddy->PriorityOn(this,CSyslogSocket::priNotice,PFROM,PTO);
214}
215void CLogPatternLocal::OnNoticeXor()
216{
217 m_Daddy->PriorityXor(this,CSyslogSocket::priNotice,PFROM,PTO);
218}
219
220void CLogPatternLocal::OnWarnOn()
221{
222 m_Daddy->PriorityOn(this,CSyslogSocket::priWarning,PFROM,PTO);
223}
224void CLogPatternLocal::OnWarnXor()
225{
226 m_Daddy->PriorityXor(this,CSyslogSocket::priWarning,PFROM,PTO);
227}
228
229BOOL CLogPatternLocal::OnInitDialog()
230{
231 CPropertyPage::OnInitDialog();
232
233 m_tooltip.Create(this);
234 m_tooltip.Activate(TRUE);
235 m_tooltip.AddTool(GetDlgItem(IDC_L0_ON),IDS_TIP_FACILITY_ON);
236 m_tooltip.AddTool(GetDlgItem(IDC_L1_ON),IDS_TIP_FACILITY_ON);
237 m_tooltip.AddTool(GetDlgItem(IDC_L2_ON),IDS_TIP_FACILITY_ON);
238 m_tooltip.AddTool(GetDlgItem(IDC_L3_ON),IDS_TIP_FACILITY_ON);
239 m_tooltip.AddTool(GetDlgItem(IDC_L4_ON),IDS_TIP_FACILITY_ON);
240 m_tooltip.AddTool(GetDlgItem(IDC_L5_ON),IDS_TIP_FACILITY_ON);
241 m_tooltip.AddTool(GetDlgItem(IDC_L6_ON),IDS_TIP_FACILITY_ON);
242 m_tooltip.AddTool(GetDlgItem(IDC_L7_ON),IDS_TIP_FACILITY_ON);
243
244 m_tooltip.AddTool(GetDlgItem(IDC_L0_XOR),IDS_TIP_FACILITY_XOR);
245 m_tooltip.AddTool(GetDlgItem(IDC_L1_XOR),IDS_TIP_FACILITY_XOR);
246 m_tooltip.AddTool(GetDlgItem(IDC_L2_XOR),IDS_TIP_FACILITY_XOR);
247 m_tooltip.AddTool(GetDlgItem(IDC_L3_XOR),IDS_TIP_FACILITY_XOR);
248 m_tooltip.AddTool(GetDlgItem(IDC_L4_XOR),IDS_TIP_FACILITY_XOR);
249 m_tooltip.AddTool(GetDlgItem(IDC_L5_XOR),IDS_TIP_FACILITY_XOR);
250 m_tooltip.AddTool(GetDlgItem(IDC_L6_XOR),IDS_TIP_FACILITY_XOR);
251 m_tooltip.AddTool(GetDlgItem(IDC_L7_XOR),IDS_TIP_FACILITY_XOR);
252
253 m_tooltip.AddTool(GetDlgItem(IDC_EMERG_ON),IDS_TIP_PRIORITY_ON);
254 m_tooltip.AddTool(GetDlgItem(IDC_ALERT_ON),IDS_TIP_PRIORITY_ON);
255 m_tooltip.AddTool(GetDlgItem(IDC_CRIT_ON),IDS_TIP_PRIORITY_ON);
256 m_tooltip.AddTool(GetDlgItem(IDC_ERR_ON),IDS_TIP_PRIORITY_ON);
257 m_tooltip.AddTool(GetDlgItem(IDC_WARN_ON),IDS_TIP_PRIORITY_ON);
258 m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_ON),IDS_TIP_PRIORITY_ON);
259 m_tooltip.AddTool(GetDlgItem(IDC_INFO_ON),IDS_TIP_PRIORITY_ON);
260 m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_ON),IDS_TIP_PRIORITY_ON);
261
262 m_tooltip.AddTool(GetDlgItem(IDC_EMERG_XOR),IDS_TIP_PRIORITY_XOR);
263 m_tooltip.AddTool(GetDlgItem(IDC_ALERT_XOR),IDS_TIP_PRIORITY_XOR);
264 m_tooltip.AddTool(GetDlgItem(IDC_CRIT_XOR),IDS_TIP_PRIORITY_XOR);
265 m_tooltip.AddTool(GetDlgItem(IDC_ERR_XOR),IDS_TIP_PRIORITY_XOR);
266 m_tooltip.AddTool(GetDlgItem(IDC_WARN_XOR),IDS_TIP_PRIORITY_XOR);
267 m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_XOR),IDS_TIP_PRIORITY_XOR);
268 m_tooltip.AddTool(GetDlgItem(IDC_INFO_XOR),IDS_TIP_PRIORITY_XOR);
269 m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_XOR),IDS_TIP_PRIORITY_XOR);
270
271 m_Daddy->AddTips(m_tooltip,this,PFROM,PTO);
272
273 return TRUE; // return TRUE unless you set the focus to a control
274 // EXCEPTION: OCX Property Pages should return FALSE
275}
276
277BOOL CLogPatternLocal::PreTranslateMessage(MSG* pMsg)
278{
279 m_tooltip.RelayEvent(pMsg);
280
281 return CPropertyPage::PreTranslateMessage(pMsg);
282}
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 @@
1// LogPatternLocal.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CLogPatternLocal dialog
6
7class CLogPattern;
8class CLogPatternLocal : public CPropertyPage
9{
10 DECLARE_DYNCREATE(CLogPatternLocal)
11
12// Construction
13public:
14 CToolTipCtrl m_tooltip;
15 CLogPattern* m_Daddy;
16 CLogPatternLocal(CLogPattern *daddy=NULL);
17 ~CLogPatternLocal();
18
19// Dialog Data
20 //{{AFX_DATA(CLogPatternLocal)
21 enum { IDD = IDD_LOG_LOCAL };
22 //}}AFX_DATA
23
24
25// Overrides
26 // ClassWizard generate virtual function overrides
27 //{{AFX_VIRTUAL(CLogPatternLocal)
28 public:
29 virtual BOOL PreTranslateMessage(MSG* pMsg);
30 protected:
31 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
32 //}}AFX_VIRTUAL
33
34// Implementation
35protected:
36 // Generated message map functions
37 //{{AFX_MSG(CLogPatternLocal)
38 afx_msg void OnAlertOn();
39 afx_msg void OnAlertXor();
40 afx_msg void OnCritOn();
41 afx_msg void OnCritXor();
42 afx_msg void OnDebugOn();
43 afx_msg void OnDebugXor();
44 afx_msg void OnEmergOn();
45 afx_msg void OnEmergXor();
46 afx_msg void OnErrOn();
47 afx_msg void OnErrXor();
48 afx_msg void OnInfoOn();
49 afx_msg void OnInfoXor();
50 afx_msg void OnL0On();
51 afx_msg void OnL0Xor();
52 afx_msg void OnL1On();
53 afx_msg void OnL1Xor();
54 afx_msg void OnL2On();
55 afx_msg void OnL2Xor();
56 afx_msg void OnL3On();
57 afx_msg void OnL3Xor();
58 afx_msg void OnL4On();
59 afx_msg void OnL4Xor();
60 afx_msg void OnL5On();
61 afx_msg void OnL5Xor();
62 afx_msg void OnL6On();
63 afx_msg void OnL6Xor();
64 afx_msg void OnL7On();
65 afx_msg void OnL7Xor();
66 afx_msg void OnNoticeOn();
67 afx_msg void OnNoticeXor();
68 afx_msg void OnWarnOn();
69 afx_msg void OnWarnXor();
70 virtual BOOL OnInitDialog();
71 //}}AFX_MSG
72 DECLARE_MESSAGE_MAP()
73
74};
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 @@
1// LogPatternReserved.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "LogPatternReserved.h"
7
8#include "SyslogSocket.h"
9#include "LogPattern.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CLogPatternReserved property page
19
20 #definePFROM CSyslogSocket::facReserved0
21 #define PTO CSyslogSocket::facReserved4
22
23IMPLEMENT_DYNCREATE(CLogPatternReserved, CPropertyPage)
24
25CLogPatternReserved::CLogPatternReserved(CLogPattern *daddy) : CPropertyPage(CLogPatternReserved::IDD), m_Daddy(daddy)
26{
27 //{{AFX_DATA_INIT(CLogPatternReserved)
28 //}}AFX_DATA_INIT
29}
30
31CLogPatternReserved::~CLogPatternReserved()
32{
33}
34
35void CLogPatternReserved::DoDataExchange(CDataExchange* pDX)
36{
37 CPropertyPage::DoDataExchange(pDX);
38 //{{AFX_DATA_MAP(CLogPatternReserved)
39 //}}AFX_DATA_MAP
40 m_Daddy->ExchangeData(pDX,PFROM,PTO);
41}
42
43
44BEGIN_MESSAGE_MAP(CLogPatternReserved, CPropertyPage)
45 //{{AFX_MSG_MAP(CLogPatternReserved)
46 ON_BN_CLICKED(IDC_ALERT_ON, OnAlertOn)
47 ON_BN_CLICKED(IDC_ALERT_XOR, OnAlertXor)
48 ON_BN_CLICKED(IDC_CRIT_ON, OnCritOn)
49 ON_BN_CLICKED(IDC_CRIT_XOR, OnCritXor)
50 ON_BN_CLICKED(IDC_DEBUG_ON, OnDebugOn)
51 ON_BN_CLICKED(IDC_DEBUG_XOR, OnDebugXor)
52 ON_BN_CLICKED(IDC_EMERG_ON, OnEmergOn)
53 ON_BN_CLICKED(IDC_EMERG_XOR, OnEmergXor)
54 ON_BN_CLICKED(IDC_ERR_ON, OnErrOn)
55 ON_BN_CLICKED(IDC_ERR_XOR, OnErrXor)
56 ON_BN_CLICKED(IDC_INFO_ON, OnInfoOn)
57 ON_BN_CLICKED(IDC_INFO_XOR, OnInfoXor)
58 ON_BN_CLICKED(IDC_NOTICE_ON, OnNoticeOn)
59 ON_BN_CLICKED(IDC_NOTICE_XOR, OnNoticeXor)
60 ON_BN_CLICKED(IDC_R0_ON, OnR0On)
61 ON_BN_CLICKED(IDC_R0_XOR, OnR0Xor)
62 ON_BN_CLICKED(IDC_R1_ON, OnR1On)
63 ON_BN_CLICKED(IDC_R1_XOR, OnR1Xor)
64 ON_BN_CLICKED(IDC_R2_ON, OnR2On)
65 ON_BN_CLICKED(IDC_R2_XOR, OnR2Xor)
66 ON_BN_CLICKED(IDC_R3_ON, OnR3On)
67 ON_BN_CLICKED(IDC_R3_XOR, OnR3Xor)
68 ON_BN_CLICKED(IDC_R4_ON, OnR4On)
69 ON_BN_CLICKED(IDC_R4_XOR, OnR4Xor)
70 ON_BN_CLICKED(IDC_WARN_ON, OnWarnOn)
71 ON_BN_CLICKED(IDC_WARN_XOR, OnWarnXor)
72 //}}AFX_MSG_MAP
73END_MESSAGE_MAP()
74
75/////////////////////////////////////////////////////////////////////////////
76// CLogPatternReserved message handlers
77
78void CLogPatternReserved::OnAlertOn()
79{
80 m_Daddy->PriorityOn(this,CSyslogSocket::priAlert,PFROM,PTO);
81}
82void CLogPatternReserved::OnAlertXor()
83{
84 m_Daddy->PriorityXor(this,CSyslogSocket::priAlert,PFROM,PTO);
85}
86
87void CLogPatternReserved::OnCritOn()
88{
89 m_Daddy->PriorityOn(this,CSyslogSocket::priCritical,PFROM,PTO);
90}
91void CLogPatternReserved::OnCritXor()
92{
93 m_Daddy->PriorityXor(this,CSyslogSocket::priCritical,PFROM,PTO);
94}
95
96void CLogPatternReserved::OnDebugOn()
97{
98 m_Daddy->PriorityOn(this,CSyslogSocket::priDebug,PFROM,PTO);
99}
100void CLogPatternReserved::OnDebugXor()
101{
102 m_Daddy->PriorityXor(this,CSyslogSocket::priDebug,PFROM,PTO);
103}
104
105void CLogPatternReserved::OnEmergOn()
106{
107 m_Daddy->PriorityOn(this,CSyslogSocket::priEmergency,PFROM,PTO);
108}
109void CLogPatternReserved::OnEmergXor()
110{
111 m_Daddy->PriorityXor(this,CSyslogSocket::priEmergency,PFROM,PTO);
112}
113
114void CLogPatternReserved::OnErrOn()
115{
116 m_Daddy->PriorityOn(this,CSyslogSocket::priError,PFROM,PTO);
117}
118void CLogPatternReserved::OnErrXor()
119{
120 m_Daddy->PriorityXor(this,CSyslogSocket::priError,PFROM,PTO);
121}
122
123void CLogPatternReserved::OnInfoOn()
124{
125 m_Daddy->PriorityOn(this,CSyslogSocket::priInfo,PFROM,PTO);
126}
127void CLogPatternReserved::OnInfoXor()
128{
129 m_Daddy->PriorityXor(this,CSyslogSocket::priInfo,PFROM,PTO);
130}
131
132void CLogPatternReserved::OnNoticeOn()
133{
134 m_Daddy->PriorityOn(this,CSyslogSocket::priNotice,PFROM,PTO);
135}
136void CLogPatternReserved::OnNoticeXor()
137{
138 m_Daddy->PriorityXor(this,CSyslogSocket::priNotice,PFROM,PTO);
139}
140
141void CLogPatternReserved::OnR0On()
142{
143 m_Daddy->FacilityOn(this,CSyslogSocket::facReserved0);
144}
145void CLogPatternReserved::OnR0Xor()
146{
147 m_Daddy->FacilityXor(this,CSyslogSocket::facReserved0);
148}
149
150void CLogPatternReserved::OnR1On()
151{
152 m_Daddy->FacilityOn(this,CSyslogSocket::facReserved1);
153}
154void CLogPatternReserved::OnR1Xor()
155{
156 m_Daddy->FacilityXor(this,CSyslogSocket::facReserved1);
157}
158
159void CLogPatternReserved::OnR2On()
160{
161 m_Daddy->FacilityOn(this,CSyslogSocket::facReserved2);
162}
163void CLogPatternReserved::OnR2Xor()
164{
165 m_Daddy->FacilityXor(this,CSyslogSocket::facReserved2);
166}
167
168void CLogPatternReserved::OnR3On()
169{
170 m_Daddy->FacilityOn(this,CSyslogSocket::facReserved3);
171}
172void CLogPatternReserved::OnR3Xor()
173{
174 m_Daddy->FacilityXor(this,CSyslogSocket::facReserved3);
175}
176
177void CLogPatternReserved::OnR4On()
178{
179 m_Daddy->FacilityOn(this,CSyslogSocket::facReserved4);
180}
181void CLogPatternReserved::OnR4Xor()
182{
183 m_Daddy->FacilityXor(this,CSyslogSocket::facReserved4);
184}
185
186void CLogPatternReserved::OnWarnOn()
187{
188 m_Daddy->PriorityOn(this,CSyslogSocket::priWarning,PFROM,PTO);
189}
190void CLogPatternReserved::OnWarnXor()
191{
192 m_Daddy->PriorityXor(this,CSyslogSocket::priWarning,PFROM,PTO);
193}
194
195BOOL CLogPatternReserved::OnInitDialog()
196{
197 CPropertyPage::OnInitDialog();
198
199 m_tooltip.Create(this);
200 m_tooltip.Activate(TRUE);
201 m_tooltip.AddTool(GetDlgItem(IDC_R0_ON),IDS_TIP_FACILITY_ON);
202 m_tooltip.AddTool(GetDlgItem(IDC_R1_ON),IDS_TIP_FACILITY_ON);
203 m_tooltip.AddTool(GetDlgItem(IDC_R2_ON),IDS_TIP_FACILITY_ON);
204 m_tooltip.AddTool(GetDlgItem(IDC_R3_ON),IDS_TIP_FACILITY_ON);
205 m_tooltip.AddTool(GetDlgItem(IDC_R4_ON),IDS_TIP_FACILITY_ON);
206
207 m_tooltip.AddTool(GetDlgItem(IDC_R0_XOR),IDS_TIP_FACILITY_XOR);
208 m_tooltip.AddTool(GetDlgItem(IDC_R1_XOR),IDS_TIP_FACILITY_XOR);
209 m_tooltip.AddTool(GetDlgItem(IDC_R2_XOR),IDS_TIP_FACILITY_XOR);
210 m_tooltip.AddTool(GetDlgItem(IDC_R3_XOR),IDS_TIP_FACILITY_XOR);
211
212 m_tooltip.AddTool(GetDlgItem(IDC_EMERG_ON),IDS_TIP_PRIORITY_ON);
213 m_tooltip.AddTool(GetDlgItem(IDC_ALERT_ON),IDS_TIP_PRIORITY_ON);
214 m_tooltip.AddTool(GetDlgItem(IDC_CRIT_ON),IDS_TIP_PRIORITY_ON);
215 m_tooltip.AddTool(GetDlgItem(IDC_ERR_ON),IDS_TIP_PRIORITY_ON);
216 m_tooltip.AddTool(GetDlgItem(IDC_WARN_ON),IDS_TIP_PRIORITY_ON);
217 m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_ON),IDS_TIP_PRIORITY_ON);
218 m_tooltip.AddTool(GetDlgItem(IDC_INFO_ON),IDS_TIP_PRIORITY_ON);
219 m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_ON),IDS_TIP_PRIORITY_ON);
220
221 m_tooltip.AddTool(GetDlgItem(IDC_EMERG_XOR),IDS_TIP_PRIORITY_XOR);
222 m_tooltip.AddTool(GetDlgItem(IDC_ALERT_XOR),IDS_TIP_PRIORITY_XOR);
223 m_tooltip.AddTool(GetDlgItem(IDC_CRIT_XOR),IDS_TIP_PRIORITY_XOR);
224 m_tooltip.AddTool(GetDlgItem(IDC_ERR_XOR),IDS_TIP_PRIORITY_XOR);
225 m_tooltip.AddTool(GetDlgItem(IDC_WARN_XOR),IDS_TIP_PRIORITY_XOR);
226 m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_XOR),IDS_TIP_PRIORITY_XOR);
227 m_tooltip.AddTool(GetDlgItem(IDC_INFO_XOR),IDS_TIP_PRIORITY_XOR);
228 m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_XOR),IDS_TIP_PRIORITY_XOR);
229
230 m_Daddy->AddTips(m_tooltip,this,PFROM,PTO);
231
232 return TRUE; // return TRUE unless you set the focus to a control
233 // EXCEPTION: OCX Property Pages should return FALSE
234}
235
236BOOL CLogPatternReserved::PreTranslateMessage(MSG* pMsg)
237{
238 m_tooltip.RelayEvent(pMsg);
239
240 return CPropertyPage::PreTranslateMessage(pMsg);
241}
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 @@
1// LogPatternReserved.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CLogPatternReserved dialog
6
7class CLogPattern;
8class CLogPatternReserved : public CPropertyPage
9{
10 DECLARE_DYNCREATE(CLogPatternReserved)
11
12// Construction
13public:
14 CToolTipCtrl m_tooltip;
15 CLogPattern* m_Daddy;
16 CLogPatternReserved(CLogPattern *daddy=NULL);
17 ~CLogPatternReserved();
18
19// Dialog Data
20 //{{AFX_DATA(CLogPatternReserved)
21 enum { IDD = IDD_LOG_RESERVED };
22 //}}AFX_DATA
23
24
25// Overrides
26 // ClassWizard generate virtual function overrides
27 //{{AFX_VIRTUAL(CLogPatternReserved)
28 public:
29 virtual BOOL PreTranslateMessage(MSG* pMsg);
30 protected:
31 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
32 //}}AFX_VIRTUAL
33
34// Implementation
35protected:
36 // Generated message map functions
37 //{{AFX_MSG(CLogPatternReserved)
38 afx_msg void OnAlertOn();
39 afx_msg void OnAlertXor();
40 afx_msg void OnCritOn();
41 afx_msg void OnCritXor();
42 afx_msg void OnDebugOn();
43 afx_msg void OnDebugXor();
44 afx_msg void OnEmergOn();
45 afx_msg void OnEmergXor();
46 afx_msg void OnErrOn();
47 afx_msg void OnErrXor();
48 afx_msg void OnInfoOn();
49 afx_msg void OnInfoXor();
50 afx_msg void OnNoticeOn();
51 afx_msg void OnNoticeXor();
52 afx_msg void OnR0On();
53 afx_msg void OnR0Xor();
54 afx_msg void OnR1On();
55 afx_msg void OnR1Xor();
56 afx_msg void OnR2On();
57 afx_msg void OnR2Xor();
58 afx_msg void OnR3On();
59 afx_msg void OnR3Xor();
60 afx_msg void OnR4On();
61 afx_msg void OnR4Xor();
62 afx_msg void OnWarnOn();
63 afx_msg void OnWarnXor();
64 virtual BOOL OnInitDialog();
65 //}}AFX_MSG
66 DECLARE_MESSAGE_MAP()
67
68};
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 @@
1// LogPatternUnix.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "LogPatternUnix.h"
7
8#include "SyslogSocket.h"
9#include "LogPattern.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CLogPatternUnix property page
19
20 #definePFROM CSyslogSocket::facKernel
21 #define PTO CSyslogSocket::facAuthPriv
22
23IMPLEMENT_DYNCREATE(CLogPatternUnix, CPropertyPage)
24
25CLogPatternUnix::CLogPatternUnix(CLogPattern* daddy) : CPropertyPage(CLogPatternUnix::IDD), m_Daddy(daddy)
26{
27 //{{AFX_DATA_INIT(CLogPatternUnix)
28 //}}AFX_DATA_INIT
29}
30
31CLogPatternUnix::~CLogPatternUnix()
32{
33}
34
35void CLogPatternUnix::DoDataExchange(CDataExchange* pDX)
36{
37 CPropertyPage::DoDataExchange(pDX);
38 //{{AFX_DATA_MAP(CLogPatternUnix)
39 //}}AFX_DATA_MAP
40 m_Daddy->ExchangeData(pDX,PFROM,PTO);
41}
42
43
44BEGIN_MESSAGE_MAP(CLogPatternUnix, CPropertyPage)
45 //{{AFX_MSG_MAP(CLogPatternUnix)
46 ON_BN_CLICKED(IDC_ALERT_ON, OnAlertOn)
47 ON_BN_CLICKED(IDC_AUTH_ON, OnAuthOn)
48 ON_BN_CLICKED(IDC_ALERT_XOR, OnAlertXor)
49 ON_BN_CLICKED(IDC_AUTH_XOR, OnAuthXor)
50 ON_BN_CLICKED(IDC_CRIT_ON, OnCritOn)
51 ON_BN_CLICKED(IDC_CRIT_XOR, OnCritXor)
52 ON_BN_CLICKED(IDC_CRON_ON, OnCronOn)
53 ON_BN_CLICKED(IDC_CRON_XOR, OnCronXor)
54 ON_BN_CLICKED(IDC_DAEMON_ON, OnDaemonOn)
55 ON_BN_CLICKED(IDC_DAEMON_XOR, OnDaemonXor)
56 ON_BN_CLICKED(IDC_DEBUG_ON, OnDebugOn)
57 ON_BN_CLICKED(IDC_DEBUG_XOR, OnDebugXor)
58 ON_BN_CLICKED(IDC_EMERG_ON, OnEmergOn)
59 ON_BN_CLICKED(IDC_EMERG_XOR, OnEmergXor)
60 ON_BN_CLICKED(IDC_ERR_ON, OnErrOn)
61 ON_BN_CLICKED(IDC_ERR_XOR, OnErrXor)
62 ON_BN_CLICKED(IDC_INFO_ON, OnInfoOn)
63 ON_BN_CLICKED(IDC_INFO_XOR, OnInfoXor)
64 ON_BN_CLICKED(IDC_KERNEL_ON, OnKernelOn)
65 ON_BN_CLICKED(IDC_KERNEL_XOR, OnKernelXor)
66 ON_BN_CLICKED(IDC_LPR_ON, OnLprOn)
67 ON_BN_CLICKED(IDC_LPR_XOR, OnLprXor)
68 ON_BN_CLICKED(IDC_MAIL_ON, OnMailOn)
69 ON_BN_CLICKED(IDC_MAIL_XOR, OnMailXor)
70 ON_BN_CLICKED(IDC_NEWS_ON, OnNewsOn)
71 ON_BN_CLICKED(IDC_NEWS_XOR, OnNewsXor)
72 ON_BN_CLICKED(IDC_NOTICE_ON, OnNoticeOn)
73 ON_BN_CLICKED(IDC_NOTICE_XOR, OnNoticeXor)
74 ON_BN_CLICKED(IDC_SYSLOG_ON, OnSyslogOn)
75 ON_BN_CLICKED(IDC_SYSLOG_XOR, OnSyslogXor)
76 ON_BN_CLICKED(IDC_USER_ON, OnUserOn)
77 ON_BN_CLICKED(IDC_USER_XOR, OnUserXor)
78 ON_BN_CLICKED(IDC_UUCP_ON, OnUucpOn)
79 ON_BN_CLICKED(IDC_UUCP_XOR, OnUucpXor)
80 ON_BN_CLICKED(IDC_WARN_ON, OnWarnOn)
81 ON_BN_CLICKED(IDC_WARN_XOR, OnWarnXor)
82 ON_BN_CLICKED(IDC_AUTHPRIV_ON, OnAuthprivOn)
83 ON_BN_CLICKED(IDC_AUTHPRIV_XOR, OnAuthprivXor)
84 //}}AFX_MSG_MAP
85END_MESSAGE_MAP()
86
87/////////////////////////////////////////////////////////////////////////////
88// CLogPatternUnix message handlers
89
90void CLogPatternUnix::OnAlertOn()
91{
92 m_Daddy->PriorityOn(this,CSyslogSocket::priAlert,PFROM,PTO);
93}
94void CLogPatternUnix::OnAlertXor()
95{
96 m_Daddy->PriorityXor(this,CSyslogSocket::priAlert,PFROM,PTO);
97}
98
99void CLogPatternUnix::OnAuthOn()
100{
101 m_Daddy->FacilityOn(this,CSyslogSocket::facAuth);
102}
103void CLogPatternUnix::OnAuthXor()
104{
105 m_Daddy->FacilityXor(this,CSyslogSocket::facAuth);
106}
107
108void CLogPatternUnix::OnCritOn()
109{
110 m_Daddy->PriorityOn(this,CSyslogSocket::priCritical,PFROM,PTO);
111}
112void CLogPatternUnix::OnCritXor()
113{
114m_Daddy->PriorityXor(this,CSyslogSocket::priCritical,PFROM,PTO);
115}
116
117void CLogPatternUnix::OnCronOn()
118{
119 m_Daddy->FacilityOn(this,CSyslogSocket::facCron);
120}
121void CLogPatternUnix::OnCronXor()
122{
123 m_Daddy->FacilityXor(this,CSyslogSocket::facCron);
124}
125
126void CLogPatternUnix::OnDaemonOn()
127{
128 m_Daddy->FacilityOn(this,CSyslogSocket::facDaemon);
129}
130void CLogPatternUnix::OnDaemonXor()
131{
132 m_Daddy->FacilityXor(this,CSyslogSocket::facDaemon);
133}
134
135void CLogPatternUnix::OnDebugOn()
136{
137 m_Daddy->PriorityOn(this,CSyslogSocket::priDebug,PFROM,PTO);
138}
139void CLogPatternUnix::OnDebugXor()
140{
141 m_Daddy->PriorityXor(this,CSyslogSocket::priDebug,PFROM,PTO);
142}
143
144void CLogPatternUnix::OnEmergOn()
145{
146 m_Daddy->PriorityOn(this,CSyslogSocket::priEmergency,PFROM,PTO);
147}
148void CLogPatternUnix::OnEmergXor()
149{
150 m_Daddy->PriorityXor(this,CSyslogSocket::priEmergency,PFROM,PTO);
151}
152
153void CLogPatternUnix::OnErrOn()
154{
155 m_Daddy->PriorityOn(this,CSyslogSocket::priError,PFROM,PTO);
156}
157void CLogPatternUnix::OnErrXor()
158{
159 m_Daddy->PriorityXor(this,CSyslogSocket::priError,PFROM,PTO);
160}
161
162void CLogPatternUnix::OnInfoOn()
163{
164 m_Daddy->PriorityOn(this,CSyslogSocket::priInfo,PFROM,PTO);
165}
166void CLogPatternUnix::OnInfoXor()
167{
168 m_Daddy->PriorityXor(this,CSyslogSocket::priInfo,PFROM,PTO);
169}
170
171void CLogPatternUnix::OnKernelOn()
172{
173 m_Daddy->FacilityOn(this,CSyslogSocket::facKernel);
174}
175void CLogPatternUnix::OnKernelXor()
176{
177 m_Daddy->FacilityXor(this,CSyslogSocket::facKernel);
178}
179
180void CLogPatternUnix::OnLprOn()
181{
182 m_Daddy->FacilityOn(this,CSyslogSocket::facLPR);
183}
184void CLogPatternUnix::OnLprXor()
185{
186 m_Daddy->FacilityXor(this,CSyslogSocket::facLPR);
187}
188
189void CLogPatternUnix::OnMailOn()
190{
191 m_Daddy->FacilityOn(this,CSyslogSocket::facMail);
192}
193void CLogPatternUnix::OnMailXor()
194{
195 m_Daddy->FacilityXor(this,CSyslogSocket::facMail);
196}
197
198void CLogPatternUnix::OnNewsOn()
199{
200 m_Daddy->FacilityOn(this,CSyslogSocket::facNews);
201}
202void CLogPatternUnix::OnNewsXor()
203{
204 m_Daddy->FacilityXor(this,CSyslogSocket::facNews);
205}
206
207void CLogPatternUnix::OnNoticeOn()
208{
209 m_Daddy->PriorityOn(this,CSyslogSocket::priNotice,PFROM,PTO);
210}
211void CLogPatternUnix::OnNoticeXor()
212{
213 m_Daddy->PriorityXor(this,CSyslogSocket::priNotice,PFROM,PTO);
214}
215
216void CLogPatternUnix::OnSyslogOn()
217{
218 m_Daddy->FacilityOn(this,CSyslogSocket::facSyslog);
219}
220void CLogPatternUnix::OnSyslogXor()
221{
222 m_Daddy->FacilityXor(this,CSyslogSocket::facSyslog);
223}
224
225void CLogPatternUnix::OnUserOn()
226{
227 m_Daddy->FacilityOn(this,CSyslogSocket::facUser);
228}
229void CLogPatternUnix::OnUserXor()
230{
231 m_Daddy->FacilityXor(this,CSyslogSocket::facUser);
232}
233
234void CLogPatternUnix::OnUucpOn()
235{
236 m_Daddy->FacilityOn(this,CSyslogSocket::facUUCP);
237}
238void CLogPatternUnix::OnUucpXor()
239{
240 m_Daddy->FacilityXor(this,CSyslogSocket::facUUCP);
241}
242
243void CLogPatternUnix::OnWarnOn()
244{
245 m_Daddy->PriorityOn(this,CSyslogSocket::priWarning,PFROM,PTO);
246}
247void CLogPatternUnix::OnWarnXor()
248{
249 m_Daddy->PriorityXor(this,CSyslogSocket::priWarning,PFROM,PTO);
250}
251
252void CLogPatternUnix::OnAuthprivOn()
253{
254 m_Daddy->FacilityOn(this,CSyslogSocket::facAuthPriv);
255}
256void CLogPatternUnix::OnAuthprivXor()
257{
258 m_Daddy->FacilityXor(this,CSyslogSocket::facAuthPriv);
259}
260
261BOOL CLogPatternUnix::OnInitDialog()
262{
263 CPropertyPage::OnInitDialog();
264
265 m_tooltip.Create(this);
266 m_tooltip.Activate(TRUE);
267 m_tooltip.AddTool(GetDlgItem(IDC_KERNEL_ON),IDS_TIP_FACILITY_ON);
268 m_tooltip.AddTool(GetDlgItem(IDC_USER_ON),IDS_TIP_FACILITY_ON);
269 m_tooltip.AddTool(GetDlgItem(IDC_MAIL_ON),IDS_TIP_FACILITY_ON);
270 m_tooltip.AddTool(GetDlgItem(IDC_DAEMON_ON),IDS_TIP_FACILITY_ON);
271 m_tooltip.AddTool(GetDlgItem(IDC_AUTH_ON),IDS_TIP_FACILITY_ON);
272 m_tooltip.AddTool(GetDlgItem(IDC_SYSLOG_ON),IDS_TIP_FACILITY_ON);
273 m_tooltip.AddTool(GetDlgItem(IDC_LPR_ON),IDS_TIP_FACILITY_ON);
274 m_tooltip.AddTool(GetDlgItem(IDC_NEWS_ON),IDS_TIP_FACILITY_ON);
275 m_tooltip.AddTool(GetDlgItem(IDC_UUCP_ON),IDS_TIP_FACILITY_ON);
276 m_tooltip.AddTool(GetDlgItem(IDC_CRON_ON),IDS_TIP_FACILITY_ON);
277 m_tooltip.AddTool(GetDlgItem(IDC_AUTHPRIV_ON),IDS_TIP_FACILITY_ON);
278
279 m_tooltip.AddTool(GetDlgItem(IDC_KERNEL_XOR),IDS_TIP_FACILITY_XOR);
280 m_tooltip.AddTool(GetDlgItem(IDC_USER_XOR),IDS_TIP_FACILITY_XOR);
281 m_tooltip.AddTool(GetDlgItem(IDC_MAIL_XOR),IDS_TIP_FACILITY_XOR);
282 m_tooltip.AddTool(GetDlgItem(IDC_DAEMON_XOR),IDS_TIP_FACILITY_XOR);
283 m_tooltip.AddTool(GetDlgItem(IDC_AUTH_XOR),IDS_TIP_FACILITY_XOR);
284 m_tooltip.AddTool(GetDlgItem(IDC_SYSLOG_XOR),IDS_TIP_FACILITY_XOR);
285 m_tooltip.AddTool(GetDlgItem(IDC_LPR_XOR),IDS_TIP_FACILITY_XOR);
286 m_tooltip.AddTool(GetDlgItem(IDC_NEWS_XOR),IDS_TIP_FACILITY_XOR);
287 m_tooltip.AddTool(GetDlgItem(IDC_UUCP_XOR),IDS_TIP_FACILITY_XOR);
288 m_tooltip.AddTool(GetDlgItem(IDC_CRON_XOR),IDS_TIP_FACILITY_XOR);
289 m_tooltip.AddTool(GetDlgItem(IDC_AUTHPRIV_XOR),IDS_TIP_FACILITY_XOR);
290
291 m_tooltip.AddTool(GetDlgItem(IDC_EMERG_ON),IDS_TIP_PRIORITY_ON);
292 m_tooltip.AddTool(GetDlgItem(IDC_ALERT_ON),IDS_TIP_PRIORITY_ON);
293 m_tooltip.AddTool(GetDlgItem(IDC_CRIT_ON),IDS_TIP_PRIORITY_ON);
294 m_tooltip.AddTool(GetDlgItem(IDC_ERR_ON),IDS_TIP_PRIORITY_ON);
295 m_tooltip.AddTool(GetDlgItem(IDC_WARN_ON),IDS_TIP_PRIORITY_ON);
296 m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_ON),IDS_TIP_PRIORITY_ON);
297 m_tooltip.AddTool(GetDlgItem(IDC_INFO_ON),IDS_TIP_PRIORITY_ON);
298 m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_ON),IDS_TIP_PRIORITY_ON);
299
300 m_tooltip.AddTool(GetDlgItem(IDC_EMERG_XOR),IDS_TIP_PRIORITY_XOR);
301 m_tooltip.AddTool(GetDlgItem(IDC_ALERT_XOR),IDS_TIP_PRIORITY_XOR);
302 m_tooltip.AddTool(GetDlgItem(IDC_CRIT_XOR),IDS_TIP_PRIORITY_XOR);
303 m_tooltip.AddTool(GetDlgItem(IDC_ERR_XOR),IDS_TIP_PRIORITY_XOR);
304 m_tooltip.AddTool(GetDlgItem(IDC_WARN_XOR),IDS_TIP_PRIORITY_XOR);
305 m_tooltip.AddTool(GetDlgItem(IDC_NOTICE_XOR),IDS_TIP_PRIORITY_XOR);
306 m_tooltip.AddTool(GetDlgItem(IDC_INFO_XOR),IDS_TIP_PRIORITY_XOR);
307 m_tooltip.AddTool(GetDlgItem(IDC_DEBUG_XOR),IDS_TIP_PRIORITY_XOR);
308
309 m_Daddy->AddTips(m_tooltip,this,PFROM,PTO);
310
311 return TRUE; // return TRUE unless you set the focus to a control
312 // EXCEPTION: OCX Property Pages should return FALSE
313}
314
315BOOL CLogPatternUnix::PreTranslateMessage(MSG* pMsg)
316{
317 m_tooltip.RelayEvent(pMsg);
318
319 return CPropertyPage::PreTranslateMessage(pMsg);
320}
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 @@
1// LogPatternUnix.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CLogPatternUnix dialog
6
7class CLogPattern;
8class CLogPatternUnix : public CPropertyPage
9{
10 DECLARE_DYNCREATE(CLogPatternUnix)
11
12// Construction
13public:
14 CToolTipCtrl m_tooltip;
15 CLogPattern* m_Daddy;
16 CLogPatternUnix(CLogPattern *daddy=NULL);
17 ~CLogPatternUnix();
18
19// Dialog Data
20 //{{AFX_DATA(CLogPatternUnix)
21 enum { IDD = IDD_LOG_UNIX };
22 //}}AFX_DATA
23
24
25// Overrides
26 // ClassWizard generate virtual function overrides
27 //{{AFX_VIRTUAL(CLogPatternUnix)
28 public:
29 virtual BOOL PreTranslateMessage(MSG* pMsg);
30 protected:
31 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
32 //}}AFX_VIRTUAL
33
34// Implementation
35protected:
36 // Generated message map functions
37 //{{AFX_MSG(CLogPatternUnix)
38 afx_msg void OnAlertOn();
39 afx_msg void OnAuthOn();
40 afx_msg void OnAlertXor();
41 afx_msg void OnAuthXor();
42 afx_msg void OnCritOn();
43 afx_msg void OnCritXor();
44 afx_msg void OnCronOn();
45 afx_msg void OnCronXor();
46 afx_msg void OnDaemonOn();
47 afx_msg void OnDaemonXor();
48 afx_msg void OnDebugOn();
49 afx_msg void OnDebugXor();
50 afx_msg void OnEmergOn();
51 afx_msg void OnEmergXor();
52 afx_msg void OnErrOn();
53 afx_msg void OnErrXor();
54 afx_msg void OnInfoOn();
55 afx_msg void OnInfoXor();
56 afx_msg void OnKernelOn();
57 afx_msg void OnKernelXor();
58 afx_msg void OnLprOn();
59 afx_msg void OnLprXor();
60 afx_msg void OnMailOn();
61 afx_msg void OnMailXor();
62 afx_msg void OnNewsOn();
63 afx_msg void OnNewsXor();
64 afx_msg void OnNoticeOn();
65 afx_msg void OnNoticeXor();
66 afx_msg void OnSyslogOn();
67 afx_msg void OnSyslogXor();
68 afx_msg void OnUserOn();
69 afx_msg void OnUserXor();
70 afx_msg void OnUucpOn();
71 afx_msg void OnUucpXor();
72 afx_msg void OnWarnOn();
73 afx_msg void OnWarnXor();
74 afx_msg void OnAuthprivOn();
75 afx_msg void OnAuthprivXor();
76 virtual BOOL OnInitDialog();
77 //}}AFX_MSG
78 DECLARE_MESSAGE_MAP()
79
80};
diff --git a/README b/README
new file mode 100644
index 0000000..fbdfd9c
--- a/dev/null
+++ b/README
@@ -0,0 +1,33 @@
1
2Before compiling canned install executable the following files should be placed
3in the build tree:
4
5redist/mfc42.dl_
6
7Release checklist:
8 (These are tags stored in KTAGS file. please, keep in sync. Use vim to
9 jump to these tags. I haven't tried it on windows, though).
10
11 |help-news| - Release notes in help file
12
13Version number in the following places:
14
15 |about-version| - About box
16 |vsinfo-numeric-version| - VERSIONINFO numerical File&Prod V
17 |vsinfo-string-version| - VERSIONINFO string File&Prod V
18 |install-version| - Version used in install
19 |install-vsinfo-numeric-version|- install's VERSIONINFO block
20 |install-vsinfo-string-version| - install's VERSIONINFO block
21
22If the year flips check these:
23
24 |about-date| - About box
25 |help-license-date| - license in help file
26 |license-date| - license in COPYING file
27 |vsinfo-date| - Copyright in VERSIONINFO block
28 |install-vsinfo-date| - Copyright in install's VERSIONINFO
29 block
30
31
32This is for vim (don't remove):
33 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 @@
1#include "stdafx.h"
2#include "SyslogSocket.h"
3
4LPCTSTR CSyslogSocket::m_Priorities[8] = {
5 "emerg", "alert", "crit", "err", "warn", "notice", "info", "debug"
6};
7LPCTSTR CSyslogSocket::m_Facilities[24] = {
8 "kernel", "user", "mail", "daemon", "auth", "syslog", "lpr","news","uucp","cron","authpriv","reserved0","reserved1","reserved2","reserved3","reserved4","local0","local1","local2","local3","local4","local5","local6","local7"
9};
10
11BOOL CSyslogSocket::CreateListen(UINT port)
12{
13 if(!Create(port?port:m_Port,SOCK_DGRAM))
14 return FALSE;
15 DoSelect();
16 return TRUE;
17}
18
19CSyslogSocket::CSyslogSocket()
20{
21 m_Port=514;
22 m_MaxLine=2048;
23 m_DefaultPriority=MakePriority(priNotice,facUser);
24 memset(&m_DefaultHost,0,sizeof(m_DefaultHost));
25 m_DefaultHost.sin_family=AF_INET;
26 m_DefaultHost.sin_addr.s_addr=inet_addr("127.0.0.1");
27 m_DefaultHost.sin_port=m_Port;
28}
29
30void CSyslogSocket::DoSelect()
31{
32 AsyncSelect(FD_CLOSE|FD_READ|(m_Queue.IsEmpty()?0:FD_WRITE));
33}
34
35void CSyslogSocket::OnReceive(int nErrorCode)
36{
37 if(nErrorCode){
38 TRACE0("Error on receiving socket\n");
39 return;
40 }
41SOCKADDR_IN sin;
42int sinLength = sizeof(sin);
43CString inputLine;
44LPTSTR buff = inputLine.GetBuffer(m_MaxLine+1);
45int bytes = ReceiveFrom(buff,m_MaxLine,(SOCKADDR*)&sin,&sinLength);
46 if(bytes==SOCKET_ERROR){
47 TRACE0("Failed to receive datagram\n");
48 return;
49 }
50 buff[bytes]=0;
51 inputLine.ReleaseBuffer();
52UINT pri = m_DefaultPriority;
53 if(!inputLine.IsEmpty()){
54 if(inputLine[0]=='<'){
55 inputLine=inputLine.Mid(1);
56 CString newPri = inputLine.SpanIncluding("0123456789");
57 inputLine=inputLine.Mid(newPri.GetLength());
58 if((!inputLine.IsEmpty()) && inputLine[0]=='>')
59 inputLine=inputLine.Mid(1);
60 pri = atoi((LPCTSTR)newPri);
61 }
62 }
63 ASSERT(sin.sin_family==AF_INET);
64 Log(Priority(pri),Facility(pri),inputLine,&sin);
65 DoSelect();
66}
67
68void CSyslogSocket::Log(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin)
69{
70 // Default implementation does nothing.
71}
72
73CString CSyslogSocket::Escape(LPCTSTR str)
74{
75CString rv;
76 while(*str){
77 int c = *(str++);
78 if(iscntrl(c)){
79 switch(c){
80 case '\n':
81 c=' ';
82 break;
83 case '\t':
84 c='\t';
85 break;
86 default:
87 rv+='^';
88 c|='@';
89 break;
90 }
91 }
92 rv+=(char)c;
93 }
94 return rv;
95}
96
97BOOL CSyslogSocket::LogTo(SOCKADDR_IN* sin,UINT pri,UINT fac,LPCTSTR str)
98{
99 ASSERT(sin);
100CString tmp;
101 tmp.Format("<%u>",MakePriority(pri,fac));
102 tmp+=str;
103 return LogTo(sin,tmp);
104}
105
106BOOL CSyslogSocket::LogTo(SOCKADDR_IN* sin,LPCTSTR str)
107{
108CSyslogOutgoingPacket *p = new CSyslogOutgoingPacket;
109 ASSERT(p);
110 memmove(&p->m_To,sin,sizeof(p->m_To));
111 p->m_What=str;
112 m_Queue.AddTail(p);
113 DoSelect();
114 return TRUE;
115}
116
117BOOL CSyslogSocket::LogTo(DWORD sinAddr,UINT sinPort,LPCTSTR str)
118{
119SOCKADDR_IN sin;
120 memset(&sin,0,sizeof(sin));
121 sin.sin_addr.s_addr=sinAddr;
122 sin.sin_port=sinPort;
123 sin.sin_family=AF_INET;
124 return LogTo(&sin,str);
125}
126
127BOOL CSyslogSocket::LogTo(DWORD sinAddr,UINT sinPort,UINT pri,UINT fac,LPCTSTR str)
128{
129SOCKADDR_IN sin;
130 memset(&sin,0,sizeof(sin));
131 sin.sin_addr.s_addr=sinAddr;
132 sin.sin_port=sinPort;
133 sin.sin_family=AF_INET;
134 return LogTo(&sin,pri,fac,str);
135}
136
137BOOL CSyslogSocket::LogTo(DWORD sinAddr,UINT pri,UINT fac,LPCTSTR str)
138{
139 return LogTo(sinAddr,m_Port,pri,fac,str);
140}
141
142BOOL CSyslogSocket::LogTo(DWORD sinAddr,LPCTSTR str)
143{
144 return LogTo(sinAddr,m_Port,str);
145}
146
147BOOL CSyslogSocket::LogTo(UINT pri,UINT fac,LPCTSTR str)
148{
149 return LogTo(&m_DefaultHost,pri,fac,str);
150}
151
152BOOL CSyslogSocket::LogTo(LPCTSTR str)
153{
154 return LogTo(&m_DefaultHost,str);
155}
156
157UINT CSyslogSocket::Facility(LPCTSTR str)
158{
159 ASSERT(str);
160 for(int tmp=0;tmp<(sizeof(m_Facilities)/sizeof(m_Facilities[0]));tmp++)
161 if(!strcmp(str,m_Facilities[tmp]))
162 return tmp;
163 return facNone;
164}
165
166UINT CSyslogSocket::Priority(LPCTSTR str)
167{
168 ASSERT(str);
169 for(int tmp=0;tmp<(sizeof(m_Priorities)/sizeof(m_Priorities[0]));tmp++)
170 if(!strcmp(str,m_Priorities[tmp]))
171 return tmp;
172 return priNone;
173}
174
175void CSyslogSocket::OnSend(int nErrorCode)
176{
177 if(nErrorCode){
178 TRACE0("Error on sending socket\n");
179 return;
180 }
181 if(!m_Queue.IsEmpty()){
182 CSyslogOutgoingPacket *p = m_Queue.GetHead();
183 ASSERT(p);
184 m_Queue.RemoveHead();
185 int rv = SendTo((LPCTSTR)p->m_What,p->m_What.GetLength(),(SOCKADDR*)&p->m_To,sizeof(SOCKADDR_IN));
186 if(rv!=p->m_What.GetLength()){
187 TRACE0("Failed to send on socket\n");
188 }
189 delete p;
190 }
191 DoSelect();
192}
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 @@
1
2 struct CSyslogOutgoingPacket{
3 SOCKADDR_IN m_To;
4 CString m_What;
5};
6typedef CList<CSyslogOutgoingPacket*,CSyslogOutgoingPacket*> CSyslogOutgoingPackets;
7
8 class CSyslogSocket : public CAsyncSocket{
9public:
10 virtual void OnSend(int nErrorCode);
11 static UINT Priority(LPCTSTR str);
12 static UINT Facility(LPCTSTR str);
13 BOOL LogTo(LPCTSTR str);
14 SOCKADDR_IN m_DefaultHost;
15 BOOL LogTo(UINT pri,UINT fac,LPCTSTR str);
16 BOOL LogTo(DWORD sinAddr,LPCTSTR str);
17 BOOL LogTo(DWORD sinAddr,UINT pri,UINT fac,LPCTSTR str);
18 BOOL LogTo(DWORD sinAddr,UINT sinPort,UINT pri,UINT fac,LPCTSTR str);
19 BOOL LogTo(DWORD sinAddr,UINT sinPort,LPCTSTR str);
20 BOOL LogTo(SOCKADDR_IN* sin,LPCTSTR str);
21 BOOL LogTo(SOCKADDR_IN* sin,UINT pri,UINT fac,LPCTSTR str);
22 static CString Escape(LPCTSTR str);
23 virtual void Log(UINT pri,UINT fac,LPCTSTR line,SOCKADDR_IN *sin);
24 UINT m_DefaultPriority;
25 virtual void OnReceive(int nErrorCode);
26 UINT m_MaxLine;
27 void DoSelect();
28 CSyslogOutgoingPackets m_Queue;
29 CSyslogSocket();
30 UINT m_Port;
31 BOOL CreateListen(UINT port=0);
32 static LPCTSTR m_Facilities[24];
33 static LPCTSTR m_Priorities[8];
34 enum{
35 maskPriority = 7,
36 maskFacility = 0x3F8,
37 shiftFacility = 3,
38 priNone = 0xFFFF,
39 facNone = 0xFFFF,
40 totalPriorities=8,
41 totalFacilities=24,
42
43 priEmergency=0,
44 priAlert=1,
45 priCritical=2,
46 priError=3,
47 priWarning=4,
48 priNotice=5,
49 priInfo=6,
50 priDebug=7,
51
52 facKernel=0,
53 facUser=1,
54 facMail=2,
55 facDaemon=3,
56 facAuth=4,
57 facSyslog=5,
58 facLPR=6,
59 facNews=7,
60 facUUCP=8,
61 facCron=9,
62 facAuthPriv=10,
63
64 facReserved0=11,
65 facReserved1=12,
66 facReserved2=13,
67 facReserved3=14,
68 facReserved4=15,
69
70 facLocal0=16,
71 facLocal1=17,
72 facLocal2=18,
73 facLocal3=19,
74 facLocal4=20,
75 facLocal5=21,
76 facLocal6=22,
77 facLocal7=23
78 };
79 static UINT Priority(UINT pri){ return pri&maskPriority; }
80 static UINT Facility(UINT pri){ return (pri&maskFacility)>>shiftFacility; }
81 static UINT MakePriority(UINT pri,UINT fac) { return (pri&maskPriority)|((fac<<shiftFacility)&maskFacility); }
82}; \ No newline at end of file
diff --git a/Trayer.cpp b/Trayer.cpp
new file mode 100644
index 0000000..cf2a8ac
--- a/dev/null
+++ b/Trayer.cpp
@@ -0,0 +1,94 @@
1// Trayer.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "Trayer.h"
7
8#include "SyslogSocket.h"
9#include "KLogDlg.h"
10
11#ifdef _DEBUG
12#define new DEBUG_NEW
13#undef THIS_FILE
14static char THIS_FILE[] = __FILE__;
15#endif
16
17/////////////////////////////////////////////////////////////////////////////
18// CTrayer
19
20CTrayer::CTrayer()
21{
22 m_inMenu=0;
23}
24
25CTrayer::~CTrayer()
26{
27}
28
29
30BEGIN_MESSAGE_MAP(CTrayer, CWnd)
31 //{{AFX_MSG_MAP(CTrayer)
32 ON_MESSAGE(WM_TRAYICON, OnTray)
33 ON_COMMAND(ID_TRAY_ABOUTKLOG, OnTrayAboutklog)
34 ON_COMMAND(ID_TRAY_EXIT, OnTrayExit)
35 ON_COMMAND(ID_TRAY_HELP, OnTrayHelp)
36 ON_COMMAND(ID_TRAY_SHOWKLOGWINDOW, OnTrayShowklogwindow)
37 //}}AFX_MSG_MAP
38END_MESSAGE_MAP()
39
40
41/////////////////////////////////////////////////////////////////////////////
42// CTrayer message handlers
43
44CTrayer::CTrayer(CKLogDlg* daddy)
45: m_inMenu(0), m_Daddy(daddy)
46{
47}
48
49LRESULT CTrayer::OnTray(WPARAM wP,LPARAM lP)
50{
51 ASSERT(wP==IDC_TRAYICON);
52 switch(lP){
53 case WM_RBUTTONDOWN:
54 {
55 CMenu menu;
56 VERIFY(menu.LoadMenu(IDD_KLOG_DIALOG));
57 CMenu *popUp = menu.GetSubMenu(1);
58 ASSERT(popUp);
59 CPoint pt;
60 VERIFY(::GetCursorPos(&pt));
61 m_inMenu++;
62 SetForegroundWindow();
63 popUp->CheckMenuItem(ID_TRAY_SHOWKLOGWINDOW,MF_BYCOMMAND|(IsWindowVisible()?MF_CHECKED:MF_UNCHECKED));
64 popUp->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this);
65 m_inMenu--;
66 SendMessage(WM_NULL);
67 }
68 break;
69 case WM_LBUTTONDOWN:
70 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWKLOGWINDOW);
71 break;
72 }
73 return 0;
74}
75
76void CTrayer::OnTrayAboutklog()
77{
78 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_ABOUTKLOG);
79}
80
81void CTrayer::OnTrayExit()
82{
83 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_EXIT);
84}
85
86void CTrayer::OnTrayHelp()
87{
88 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_HELP);
89}
90
91void CTrayer::OnTrayShowklogwindow()
92{
93 m_Daddy->SendMessage(WM_COMMAND,ID_TRAY_SHOWKLOGWINDOW);
94}
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 @@
1// Trayer.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CTrayer window
6
7class CKLogDlg;
8class CTrayer : public CWnd
9{
10// Construction
11public:
12 CKLogDlg * m_Daddy;
13 CTrayer(CKLogDlg* daddy);
14 int m_inMenu;
15 CTrayer();
16
17// Attributes
18public:
19
20// Operations
21public:
22
23// Overrides
24 // ClassWizard generated virtual function overrides
25 //{{AFX_VIRTUAL(CTrayer)
26 //}}AFX_VIRTUAL
27
28// Implementation
29public:
30 virtual ~CTrayer();
31
32 // Generated message map functions
33protected:
34 //{{AFX_MSG(CTrayer)
35 afx_msg LRESULT OnTray(WPARAM,LPARAM);
36 afx_msg void OnTrayAboutklog();
37 afx_msg void OnTrayExit();
38 afx_msg void OnTrayHelp();
39 afx_msg void OnTrayShowklogwindow();
40 //}}AFX_MSG
41 DECLARE_MESSAGE_MAP()
42};
43
44/////////////////////////////////////////////////////////////////////////////
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 @@
1// WarnBlocking.cpp : implementation file
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "WarnBlocking.h"
7
8#ifdef _DEBUG
9#define new DEBUG_NEW
10#undef THIS_FILE
11static char THIS_FILE[] = __FILE__;
12#endif
13
14/////////////////////////////////////////////////////////////////////////////
15// CWarnBlocking dialog
16
17
18CWarnBlocking::CWarnBlocking(CWnd* pParent /*=NULL*/)
19 : CDialog(CWarnBlocking::IDD, pParent)
20{
21 //{{AFX_DATA_INIT(CWarnBlocking)
22 m_bDontWarn = FALSE;
23 //}}AFX_DATA_INIT
24}
25
26
27void CWarnBlocking::DoDataExchange(CDataExchange* pDX)
28{
29 CDialog::DoDataExchange(pDX);
30 //{{AFX_DATA_MAP(CWarnBlocking)
31 DDX_Check(pDX, IDC_WARNBLOCKING, m_bDontWarn);
32 //}}AFX_DATA_MAP
33}
34
35
36BEGIN_MESSAGE_MAP(CWarnBlocking, CDialog)
37 //{{AFX_MSG_MAP(CWarnBlocking)
38 //}}AFX_MSG_MAP
39END_MESSAGE_MAP()
40
41/////////////////////////////////////////////////////////////////////////////
42// 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 @@
1// WarnBlocking.h : header file
2//
3
4/////////////////////////////////////////////////////////////////////////////
5// CWarnBlocking dialog
6
7class CWarnBlocking : public CDialog
8{
9// Construction
10public:
11 CWarnBlocking(CWnd* pParent = NULL); // standard constructor
12
13// Dialog Data
14 //{{AFX_DATA(CWarnBlocking)
15 enum { IDD = IDD_WARNBLOCKING };
16 BOOLm_bDontWarn;
17 //}}AFX_DATA
18
19
20// Overrides
21 // ClassWizard generated virtual function overrides
22 //{{AFX_VIRTUAL(CWarnBlocking)
23 protected:
24 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
25 //}}AFX_VIRTUAL
26
27// Implementation
28protected:
29
30 // Generated message map functions
31 //{{AFX_MSG(CWarnBlocking)
32 //}}AFX_MSG
33 DECLARE_MESSAGE_MAP()
34};
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 @@
1:Base KLog.hlp>Standard
2:Title KLog
31 KLog
42 About KLog=About
52 What's New=News
62 Using KLog=Using
72 Main Window=MainWindow
82 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 @@
1; This file is maintained by HCW. Do not modify this file directly.
2
3[OPTIONS]
4COMPRESS=12 Hall Zeck
5LCID=0x409 0x0 0x0 ; English (United States)
6REPORT=Yes
7CONTENTS=About
8TITLE=KLog
9CNT=klog.cnt
10HLP=KLOG.HLP
11
12[FILES]
13klog.rtf
14
15[ALIAS]
16HIDD_ABOUTBOX=About
17HIDD_KLOG_DIALOG=MainWindow
18HIDD_LOG_LOCAL=Pattern
19HIDD_LOG_RESERVED=Pattern
20HIDD_LOG_UNIX=Pattern
21
22[MAP]
23#include klog.hm
24
25[WINDOWS]
26Standard="",(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 @@
1{\rtf1\ansi
2@{\footnote
3THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.
4DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD
5}
6{\fonttbl{\f0\froman Times New Roman;}{\f1\fswiss Arial;}{\f3\froman Symbol;}}{\colortbl;
7 \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
8 \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
9 \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
10 \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
11
12\pard\plain\keepn
13#{\footnote About}
14${\footnote About KLog}
15{ \f1\fs18\b\sb120 Abotu {\b KLog}}
16\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.
17\par\sa120\sb120\qj\pard \f1\fs18\sb120
18\par\sa120\sb120\qj\pard \f1\fs18\sb120 {\b {\i Enjoy!}}
19{
20\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/")}
21\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:
22\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
23\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.
24}
25\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")}
26\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}
27\page
28
29\pard\plain
30#{\footnote News}
31${\footnote What's New}
32\par\pard\plain\f1\fs24\qc\cf2\b 1.00 Beta 2 - August 19th, 2002
33\par\pard\plain\fi0\li0\f1\fs18 \bullet Change of license and opening the source code
34\page
35
36\pard\plain\keepn
37#{\footnote Using}
38${\footnote Using KLog}
39{ \f1\fs18\b\sb120 Using {\b KLog}}
40\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.
41\page
42
43\pard\plain\keepn
44#{\footnote MainWindow}
45${\footnote Main Window}
46{ \f1\fs18\b\sb120 Main Window}
47\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.
48\par\sa120\sb120\qj\pard \f1\fs18\sb120 Each tab consists of following fields:\pard
49\par \fi0\li0 \bullet {\b Short description} - short descriptive text appearing on the tab on top of window.
50\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.
51\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)
52\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.
53\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}.
54\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.
55\par \fi0\li0 \bullet {\b Log window} - shows recent activity.\pard
56\page
57
58\pard\plain\keepn
59#{\footnote Pattern}
60${\footnote Edit Logging Pattern}
61{ \f1\fs18\b\sb120 Edit Logging Pattern Dialog}
62\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.
63\page
64} \ 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 @@
1<?xml version="1.0"?>
2<winhelp>
3 <topic id="About" title="About KLog">
4 <heading scroll="no">Abotu <kin>KLog</kin></heading>
5 <p><kin>KLog</kin> is our <term>Win32</term> implementation of <product>*nix</product> <term>syslog</term> daemon to support remote logging of messages from <product>unix</product> servers, routers, terminal servers and other syslog-enabled devices/applications.</p>
6 <p/>
7 <p><b><i>Enjoy!</i></b></p>
8 <license years="1998, 2002"/>
9 <credits/>
10 </topic>
11 <topic id="News" title="What's New">
12 <newsfor version="1.00 Beta 2" date="August 19th, 2002">
13 <ni>Change of license and opening the source code</ni>
14 </newsfor>
15 </topic>
16 <topic id="Using" title="Using KLog">
17 <heading scroll="no">Using <kin>KLog</kin></heading>
18 <p>When you start <kin>KLog</kin> 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 <a href="#MainWindow">Main Window</a> section.</p>
19 </topic>
20 <topic id="MainWindow" title="Main Window">
21 <heading scroll="no">Main Window</heading>
22 <p>Essentially, main window is a tabbed collection of 'Destinations'. For each destination you can set the destination itself, events criteria and sound <kin>KLog</kin> will produce when triggered by event matching criteria.</p>
23 <p>Each tab consists of following fields:</p>
24 <ul>
25 <li><b>Short description</b> - short descriptive text appearing on the tab on top of window.</li>
26 <li><b>Log to File/Log to Host/Don't Log radio buttons</b> - let you specify where to forward the events matching criteria below.</li>
27 <li><b>File/Host name</b> - 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 <kin>Klog</kin> may seem to lock up for a while)</li>
28 <li><b>IP/mask pairs list</b> - 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.</li>
29 <li><b>Facility/priority pattern</b> - 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 '<a href="#Pattern">edit logging pattern</a>' 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 <kin>KLog</kin>.</li>
30 <li><b>Sound to play when triggered</b> - whenever event is logged using current destination <kin>KLog</kin> may produce the sound to make you aware of its activity. You can select any preset sound or specify your own wave file.</li>
31 <li><b>Log window</b> - shows recent activity.</li>
32 </ul>
33 </topic>
34 <topic id="Pattern" title="Edit Logging Pattern">
35 <heading scroll="no">Edit Logging Pattern Dialog</heading>
36 <p>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.</p>
37 </topic>
38</winhelp>
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 @@
1 #ifdefSTATI_K
2klog.ex_ rcdata discardable "../releast/klog.ex_"
3#else
4klog.ex_ rcdata discardable "../release/klog.ex_"
5#endif
6klog.cn_ rcdata discardable "../release/klog.cn_"
7klog.hl_ rcdata discardable "../release/klog.hl_"
8#ifdef K_ANNED
9mfc42.dl_ rcdata discardable "../redist/mfc42.dl_"
10#endif
diff --git a/install/install.cpp b/install/install.cpp
new file mode 100644
index 0000000..212ad40
--- a/dev/null
+++ b/install/install.cpp
@@ -0,0 +1,70 @@
1#include "resource.h"
2#include "../shared-code/install.h"
3
4 #define KINAME"KLog 1.00 Beta 2"
5 #define SKINAME"KLog"
6
7BOOL Install(void)
8{
9STRING dPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.", SKINAME "Path");
10STRING kPath = strFETCH_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath");
11LPCSTR qPath = ((LPCSTR)dPath)?(LPCSTR)dPath:(((LPCSTR)kPath)?(LPSTR)kPath:"C:\\Program Files\\Klever\\Nothings");
12STRING path = REQUESTPATH(" " KINAME,"\nEnter destination path:",qPath);
13 if(!path)
14 return NULL;
15 #ifdefK_ANNED
16STRING sysDir(_MAX_PATH);
17 GetSystemDirectory(sysDir,_MAX_PATH);
18 INSTALLFILE("mfc42.dl_",sysDir,"mfc42.dll");
19#endif
20
21 MAKE_PATH(path);
22STRING shortPath = GET_SHORT_PATH(path);
23 if(!shortPath){
24 MessageBox(NULL,"Failed to install " KINAME " in specified directory",NULL,MB_ICONERROR|MB_OK);
25 return FALSE;
26 }
27
28 if(!(
29 INSTALLFILE(SKINAME ".ex_",path, SKINAME ".exe") &&
30 INSTALLFILE(SKINAME ".hl_",path, SKINAME ".hlp") &&
31 INSTALLFILE(SKINAME ".cn_",path, SKINAME ".cnt")
32 )){
33 MessageBox(NULL,"Failed to install " KINAME "in specified directory",NULL,MB_ICONERROR|MB_OK);
34 return FALSE;
35 }
36
37 ADDMENU("Accessories\\Klever Co.",SKINAME,path,SKINAME ".exe");
38 strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.",SKINAME "Path",path);
39 strSET_REG_KEY(HKEY_LOCAL_MACHINE,"Software\\Klever Group, Inc.","KINPath",path);
40
41FILE* inf=CREATE_INF_FILE(path,SKINAME ".INF");
42 if(!inf){
43 MessageBox(NULL,"Failed to install " KINAME,NULL,MB_ICONERROR|MB_OK);
44 return FALSE;
45
46 }
47
48 INF_FILE_HEADER(inf);
49 INF_FILE_SECTION(inf,"Uninstall");
50 fprintf(inf,"AddReg=kFiles\nDelReg=kReg\nUpdateInis=kMenu\n");
51
52 INF_FILE_SECTION(inf,"kFiles");
53 INF_REMOVE_ROOT(inf,SKINAME "Files",shortPath);
54 INF_REMOVE_FILE(inf,SKINAME "Files",SKINAME ".exe");
55 INF_REMOVE_HELP_FILE(inf,SKINAME "Files",SKINAME);
56 INF_REMOVE_FILE(inf,SKINAME "Files",SKINAME ".inf");
57
58 INF_FILE_SECTION(inf,"kReg");
59 INF_UNINSTALL_REG(inf,SKINAME);
60
61 INF_FILE_SECTION(inf,"kMenu");
62 INF_MENU_GROUP(inf,1,"Accessories\\Klever Co.");
63 INF_MENU_ITEM(inf,1,SKINAME);
64 fclose(inf);
65 REG_UNINSTALL_COMMAND(SKINAME,"Klever " KINAME,shortPath,SKINAME ".INF","Uninstall");
66
67 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);
68
69 return TRUE;
70}
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 @@
1//Microsoft Developer Studio generated resource script.
2//
3#include "resource.h"
4
5#define APSTUDIO_READONLY_SYMBOLS
6/////////////////////////////////////////////////////////////////////////////
7//
8// Generated from the TEXTINCLUDE 2 resource.
9//
10#include "afxres.h"
11
12/////////////////////////////////////////////////////////////////////////////
13#undef APSTUDIO_READONLY_SYMBOLS
14
15/////////////////////////////////////////////////////////////////////////////
16// English (U.S.) resources
17
18#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19#ifdef _WIN32
20LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21#pragma code_page(1252)
22#endif //_WIN32
23
24/////////////////////////////////////////////////////////////////////////////
25//
26// Dialog
27//
28
29#if defined(APSTUDIO_INVOKED) || defined(FALSE)
30#if defined(APSTUDIO_INVOKED)
31IDD_INSTALLING$(FALSE) DIALOGEX 0, 0, 200, 74
32#else
33IDD_INSTALLING DIALOGEX 0, 0, 200, 74
34#endif
35STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP
36FONT 8, "MS Sans Serif", 0, 0, 0x1
37BEGIN
38 PUSHBUTTON "Cancel",IDCANCEL,143,53,50,14,BS_CENTER | BS_VCENTER |
39 BS_NOTIFY | BS_FLAT,WS_EX_DLGMODALFRAME
40 CONTROL "Animate1",IDC_DISKS,"SysAnimate32",ACS_TRANSPARENT |
41 ACS_AUTOPLAY | WS_TABSTOP,161,7,32,32
42 LTEXT "",IDC_STATE,7,7,150,32,SS_NOPREFIX | SS_NOTIFY
43 CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,45,
44 186,7,WS_EX_DLGMODALFRAME
45END
46#endif
47
48IDD_PATH DIALOGEX 0, 0, 255, 73
49STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
50 WS_VISIBLE | WS_CAPTION
51EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
52FONT 8, "MS Sans Serif", 0, 0, 0x1
53BEGIN
54 LTEXT "",IDC_PROMPT,7,7,241,30
55 EDITTEXT IDC_PATH,7,37,195,12,ES_AUTOHSCROLL
56 PUSHBUTTON "B&rowse..",IDC_BROWSE,208,37,40,12
57 DEFPUSHBUTTON "OK",IDOK,69,52,50,14
58 PUSHBUTTON "Cancel",IDCANCEL,135,52,50,14
59END
60
61
62/////////////////////////////////////////////////////////////////////////////
63//
64// DESIGNINFO
65//
66
67#ifdef APSTUDIO_INVOKED
68GUIDELINES DESIGNINFO DISCARDABLE
69BEGIN
70 "IDD_INSTALLING$(FALSE)", DIALOG
71 BEGIN
72 LEFTMARGIN, 7
73 RIGHTMARGIN, 193
74 TOPMARGIN, 7
75 BOTTOMMARGIN, 67
76 HORZGUIDE, 39
77 END
78
79 IDD_PATH, DIALOG
80 BEGIN
81 LEFTMARGIN, 7
82 RIGHTMARGIN, 248
83 VERTGUIDE, 202
84 VERTGUIDE, 208
85 TOPMARGIN, 7
86 BOTTOMMARGIN, 66
87 HORZGUIDE, 37
88 END
89END
90#endif // APSTUDIO_INVOKED
91
92
93#ifdef APSTUDIO_INVOKED
94/////////////////////////////////////////////////////////////////////////////
95//
96// TEXTINCLUDE
97//
98
991 TEXTINCLUDE DISCARDABLE
100BEGIN
101 "resource.h\0"
102END
103
1042 TEXTINCLUDE DISCARDABLE
105BEGIN
106 "#include ""afxres.h""\r\n"
107 "\0"
108END
109
1103 TEXTINCLUDE DISCARDABLE
111BEGIN
112 "#include ""custom.rch""\0"
113END
114
115#endif // APSTUDIO_INVOKED
116
117
118/////////////////////////////////////////////////////////////////////////////
119//
120// Icon
121//
122
123// Icon with lowest ID value placed first to ensure application icon
124// remains consistent on all systems.
125IDI_ICON ICON DISCARDABLE "../shared-data/install-icon.ico"
126
127#ifndef _MAC
128/////////////////////////////////////////////////////////////////////////////
129//
130// Version
131//
132
133VS_VERSION_INFO VERSIONINFO
134 FILEVERSION 1,0,0,2
135 PRODUCTVERSION 1,0,0,2
136 FILEFLAGSMASK 0x3fL
137#ifdef _DEBUG
138 FILEFLAGS 0x1L
139#else
140 FILEFLAGS 0x0L
141#endif
142 FILEOS 0x40004L
143 FILETYPE 0x1L
144 FILESUBTYPE 0x0L
145BEGIN
146 BLOCK "StringFileInfo"
147 BEGIN
148 BLOCK "040904b0"
149 BEGIN
150 VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
151 VALUE "FileDescription", "INSTALL: KLog, logging daemon\0"
152 VALUE "FileVersion", "1, 0, 0, 2\0"
153 VALUE "InternalName", "INSTALL\0"
154 VALUE "LegalCopyright", "Copyright © 1998, 2002 Klever Group (http://www.klever.net/)\0"
155 VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
156 VALUE "OriginalFilename", "INSTALL.EXE\0"
157 VALUE "ProductName", "KLog\0"
158 VALUE "ProductVersion", "1, 0, 0, 2\0"
159 END
160 END
161 BLOCK "VarFileInfo"
162 BEGIN
163 VALUE "Translation", 0x409, 1200
164 END
165END
166
167#endif // !_MAC
168
169#endif // English (U.S.) resources
170/////////////////////////////////////////////////////////////////////////////
171
172
173
174#ifndef APSTUDIO_INVOKED
175/////////////////////////////////////////////////////////////////////////////
176//
177// Generated from the TEXTINCLUDE 3 resource.
178//
179#include "custom.rch"
180/////////////////////////////////////////////////////////////////////////////
181#endif // not APSTUDIO_INVOKED
182
diff --git a/install/resource.h b/install/resource.h
new file mode 100644
index 0000000..ebf7991
--- a/dev/null
+++ b/install/resource.h
@@ -0,0 +1,24 @@
1//{{NO_DEPENDENCIES}}
2// Microsoft Developer Studio generated include file.
3// Used by Install.rc
4//
5#define IDD_INSTALLING 101
6#define IDD_PATH 102
7#define IDI_ICON 105
8#define IDC_DISKS 1000
9#define IDC_STATE 1001
10#define IDC_PROGRESS 1002
11#define IDC_PROMPT 1003
12#define IDC_PATH 1004
13#define IDC_BROWSE 1005
14
15// Next default values for new objects
16//
17#ifdef APSTUDIO_INVOKED
18#ifndef APSTUDIO_READONLY_SYMBOLS
19#define _APS_NEXT_RESOURCE_VALUE 107
20#define _APS_NEXT_COMMAND_VALUE 40001
21#define _APS_NEXT_CONTROL_VALUE 1006
22#define _APS_NEXT_SYMED_VALUE 101
23#endif
24#endif
diff --git a/klog.clw b/klog.clw
new file mode 100644
index 0000000..81ae255
--- a/dev/null
+++ b/klog.clw
@@ -0,0 +1,502 @@
1; CLW file contains information for the MFC ClassWizard
2
3[General Info]
4Version=1
5LastClass=CKLogDlg
6LastTemplate=CDialog
7NewFileInclude1=#include "stdafx.h"
8NewFileInclude2=#include "KLog.h"
9
10ClassCount=9
11Class1=CKLogApp
12Class2=CKLogDlg
13Class3=CAboutDlg
14
15ResourceCount=7
16Resource1=IDD_LOG_LOCAL
17Resource2=IDR_MAINFRAME
18Class4=CTrayer
19Resource3=IDD_LOG_RESERVED
20Resource4=IDD_WARNBLOCKING
21Resource5=IDD_LOG_UNIX
22Class5=CLogPattern
23Class6=CLogPatternUnix
24Class7=CLogPatternReserved
25Class8=CLogPatternLocal
26Resource6=IDD_ABOUTBOX
27Class9=CWarnBlocking
28Resource7=IDD_KLOG_DIALOG
29
30[CLS:CKLogApp]
31Type=0
32HeaderFile=KLog.h
33ImplementationFile=KLog.cpp
34Filter=N
35
36[CLS:CKLogDlg]
37Type=0
38HeaderFile=KLogDlg.h
39ImplementationFile=KLogDlg.cpp
40Filter=W
41BaseClass=CDialog
42VirtualFilter=dWC
43LastObject=IDC_HL_ADD
44
45[CLS:CAboutDlg]
46Type=0
47HeaderFile=KLogDlg.h
48ImplementationFile=KLogDlg.cpp
49Filter=D
50BaseClass=CDialog
51VirtualFilter=dWC
52LastObject=IDC_KLEVERNET
53
54[DLG:IDD_ABOUTBOX]
55Type=1
56Class=CAboutDlg
57ControlCount=5
58Control1=IDC_STATIC,static,1342177283
59Control2=IDC_STATIC,static,1342308480
60Control3=IDC_STATIC,static,1342308352
61Control4=IDOK,button,1342373889
62Control5=IDC_KLEVERNET,button,1342242816
63
64[DLG:IDD_KLOG_DIALOG]
65Type=1
66Class=CKLogDlg
67ControlCount=48
68Control1=IDC_STATIC,static,1342308609
69Control2=IDC_DESC,edit,1350631552
70Control3=IDC_TYPE_FILE,button,1342312457
71Control4=IDC_TYPE_HOST,button,1342181385
72Control5=IDC_TYPE_NONE,button,1342181385
73Control6=IDC_HOSTORFILE,static,1342308353
74Control7=IDC_HOSTFILE,edit,1350631552
75Control8=IDC_BROWSE,button,1342242816
76Control9=IDC_STATIC,static,1342177296
77Control10=IDC_STATIC,static,1342308352
78Control11=IDC_STATIC,static,1342177296
79Control12=IDC_STATIC,static,1342308352
80Control13=IDC_FACILITY,combobox,1344340035
81Control14=IDC_LOGPATTERN,button,1342263104
82Control15=IDC_STATIC,button,1342194439
83Control16=IDC_EMERG,button,1342259747
84Control17=IDC_ALERT,button,1342259747
85Control18=IDC_CRIT,button,1342259747
86Control19=IDC_ERR,button,1342259747
87Control20=IDC_WARNING,button,1342259459
88Control21=IDC_NOTICE,button,1342259459
89Control22=IDC_INFO,button,1342259459
90Control23=IDC_DEBUG,button,1342259459
91Control24=IDC_ALL,button,1342242816
92Control25=IDC_NONE,button,1342242816
93Control26=IDC_INVERT,button,1342259200
94Control27=IDC_STATIC,static,1342308608
95Control28=IDC_HL_IP,edit,1350631552
96Control29=IDC_STATIC,static,1342308608
97Control30=IDC_HL_MASK,edit,1350631552
98Control31=IDC_HL_ADD,button,1342259200
99Control32=IDC_HL_REMOVE,button,1342242816
100Control33=IDC_HOSTS,listbox,1345388929
101Control34=IDC_STATIC,button,1342177287
102Control35=IDC_SOUND,combobox,1344340034
103Control36=IDC_BROWSESOUND,button,1342263104
104Control37=IDC_PLAYSOUND,button,1342263104
105Control38=IDC_LOG,listbox,1353793665
106Control39=IDC_ADD,button,1342259200
107Control40=IDC_REMOVE,button,1342242816
108Control41=IDC_EXIT,button,1342242816
109Control42=IDC_TABS,SysTabControl32,1342193664
110Control43=IDC_LOGLENGTH,static,1342308737
111Control44=IDC_LOGLENSPIN,msctls_updown32,1342177463
112Control45=IDC_STATIC_LOGLENGTH,static,1342308737
113Control46=IDOK,button,1073807361
114Control47=IDCANCEL,button,1208025088
115Control48=IDC_FILES,button,1342197504
116
117[MNU:IDD_KLOG_DIALOG]
118Type=1
119Class=?
120Command1=ID_FILES_EXPORT
121Command2=ID_FILES_IMPORT
122Command3=ID_FILES_RESET
123Command4=ID_FILES_EXPORT
124Command5=ID_FILES_IMPORT
125Command6=ID_FILES_RESET
126Command7=ID_TRAY_SHOWKLOGWINDOW
127Command8=ID_TRAY_HELP
128Command9=ID_TRAY_ABOUTKLOG
129Command10=ID_TRAY_EXIT
130CommandCount=10
131
132[CLS:CTrayer]
133Type=0
134HeaderFile=Trayer.h
135ImplementationFile=Trayer.cpp
136BaseClass=generic CWnd
137Filter=W
138LastObject=ID_FILES_RESET
139
140[DLG:IDD_LOG_RESERVED]
141Type=1
142Class=CLogPatternReserved
143ControlCount=68
144Control1=IDC_EMERG_ON,button,1342263040
145Control2=IDC_ALERT_ON,button,1342263040
146Control3=IDC_CRIT_ON,button,1342263040
147Control4=IDC_ERR_ON,button,1342263040
148Control5=IDC_WARN_ON,button,1342263040
149Control6=IDC_NOTICE_ON,button,1342263040
150Control7=IDC_INFO_ON,button,1342263040
151Control8=IDC_DEBUG_ON,button,1342263040
152Control9=IDC_R0_ON,button,1342263040
153Control10=IDC_R1_ON,button,1342263040
154Control11=IDC_R2_ON,button,1342263040
155Control12=IDC_R3_ON,button,1342263040
156Control13=IDC_R4_ON,button,1342263040
157Control14=IDC_R0_EMERG,button,1342263299
158Control15=IDC_R0_ALERT,button,1342263299
159Control16=IDC_R0_CRIT,button,1342263299
160Control17=IDC_R0_ERR,button,1342263299
161Control18=IDC_R0_WARN,button,1342263299
162Control19=IDC_R0_NOTICE,button,1342263299
163Control20=IDC_R0_INFO,button,1342263299
164Control21=IDC_R0_DEBUG,button,1342263299
165Control22=IDC_R1_EMERG,button,1342263299
166Control23=IDC_R1_ALERT,button,1342263299
167Control24=IDC_R1_CRIT,button,1342263299
168Control25=IDC_R1_ERR,button,1342263299
169Control26=IDC_R1_WARN,button,1342263299
170Control27=IDC_R1_NOTICE,button,1342263299
171Control28=IDC_R1_INFO,button,1342263299
172Control29=IDC_R1_DEBUG,button,1342263299
173Control30=IDC_R2_EMERG,button,1342263299
174Control31=IDC_R2_ALERT,button,1342263299
175Control32=IDC_R2_CRIT,button,1342263299
176Control33=IDC_R2_ERR,button,1342263299
177Control34=IDC_R2_WARN,button,1342263299
178Control35=IDC_R2_NOTICE,button,1342263299
179Control36=IDC_R2_INFO,button,1342263299
180Control37=IDC_R2_DEBUG,button,1342263299
181Control38=IDC_R3_EMERG,button,1342263299
182Control39=IDC_R3_ALERT,button,1342263299
183Control40=IDC_R3_CRIT,button,1342263299
184Control41=IDC_R3_ERR,button,1342263299
185Control42=IDC_R3_WARN,button,1342263299
186Control43=IDC_R3_NOTICE,button,1342263299
187Control44=IDC_R3_INFO,button,1342263299
188Control45=IDC_R3_DEBUG,button,1342263299
189Control46=IDC_R4_EMERG,button,1342263299
190Control47=IDC_R4_ALERT,button,1342263299
191Control48=IDC_R4_CRIT,button,1342263299
192Control49=IDC_R4_ERR,button,1342263299
193Control50=IDC_R4_WARN,button,1342263299
194Control51=IDC_R4_NOTICE,button,1342263299
195Control52=IDC_R4_INFO,button,1342263299
196Control53=IDC_R4_DEBUG,button,1342263299
197Control54=IDC_EMERG_XOR,button,1342263040
198Control55=IDC_ALERT_XOR,button,1342263040
199Control56=IDC_CRIT_XOR,button,1342263040
200Control57=IDC_ERR_XOR,button,1342263040
201Control58=IDC_WARN_XOR,button,1342263040
202Control59=IDC_NOTICE_XOR,button,1342263040
203Control60=IDC_INFO_XOR,button,1342263040
204Control61=IDC_DEBUG_XOR,button,1342263040
205Control62=IDC_R0_XOR,button,1342263040
206Control63=IDC_R1_XOR,button,1342263040
207Control64=IDC_R2_XOR,button,1342263040
208Control65=IDC_R3_XOR,button,1342263040
209Control66=IDC_R4_XOR,button,1342263040
210Control67=IDC_STATIC,static,1342308352
211Control68=IDC_STATIC,static,1342308352
212
213[DLG:IDD_LOG_UNIX]
214Type=1
215Class=CLogPatternUnix
216ControlCount=128
217Control1=IDC_EMERG_ON,button,1342263040
218Control2=IDC_ALERT_ON,button,1342263040
219Control3=IDC_CRIT_ON,button,1342263040
220Control4=IDC_ERR_ON,button,1342263040
221Control5=IDC_WARN_ON,button,1342263040
222Control6=IDC_NOTICE_ON,button,1342263040
223Control7=IDC_INFO_ON,button,1342263040
224Control8=IDC_DEBUG_ON,button,1342263040
225Control9=IDC_KERNEL_ON,button,1342263040
226Control10=IDC_USER_ON,button,1342263040
227Control11=IDC_MAIL_ON,button,1342263040
228Control12=IDC_DAEMON_ON,button,1342263040
229Control13=IDC_AUTH_ON,button,1342263040
230Control14=IDC_SYSLOG_ON,button,1342263040
231Control15=IDC_LPR_ON,button,1342263040
232Control16=IDC_NEWS_ON,button,1342263040
233Control17=IDC_UUCP_ON,button,1342263040
234Control18=IDC_CRON_ON,button,1342263040
235Control19=IDC_KERNEL_EMERG,button,1342263299
236Control20=IDC_KERNEL_ALERT,button,1342263299
237Control21=IDC_KERNEL_CRIT,button,1342263299
238Control22=IDC_KERNEL_ERR,button,1342263299
239Control23=IDC_KERNEL_WARN,button,1342263299
240Control24=IDC_KERNEL_NOTICE,button,1342263299
241Control25=IDC_KERNEL_INFO,button,1342263299
242Control26=IDC_KERNEL_DEBUG,button,1342263299
243Control27=IDC_USER_EMERG,button,1342263299
244Control28=IDC_USER_ALERT,button,1342263299
245Control29=IDC_USER_CRIT,button,1342263299
246Control30=IDC_USER_ERR,button,1342263299
247Control31=IDC_USER_WARN,button,1342263299
248Control32=IDC_USER_NOTICE,button,1342263299
249Control33=IDC_USER_INFO,button,1342263299
250Control34=IDC_USER_DEBUG,button,1342263299
251Control35=IDC_MAIL_EMERG,button,1342263299
252Control36=IDC_MAIL_ALERT,button,1342263299
253Control37=IDC_MAIL_CRIT,button,1342263299
254Control38=IDC_MAIL_ERR,button,1342263299
255Control39=IDC_MAIL_WARN,button,1342263299
256Control40=IDC_MAIL_NOTICE,button,1342263299
257Control41=IDC_MAIL_INFO,button,1342263299
258Control42=IDC_MAIL_DEBUG,button,1342263299
259Control43=IDC_DAEMON_EMERG,button,1342263299
260Control44=IDC_DAEMON_ALERT,button,1342263299
261Control45=IDC_DAEMON_CRIT,button,1342263299
262Control46=IDC_DAEMON_ERR,button,1342263299
263Control47=IDC_DAEMON_WARN,button,1342263299
264Control48=IDC_DAEMON_NOTICE,button,1342263299
265Control49=IDC_DAEMON_INFO,button,1342263299
266Control50=IDC_DAEMON_DEBUG,button,1342263299
267Control51=IDC_AUTH_EMERG,button,1342263299
268Control52=IDC_AUTH_ALERT,button,1342263299
269Control53=IDC_AUTH_CRIT,button,1342263299
270Control54=IDC_AUTH_ERR,button,1342263299
271Control55=IDC_AUTH_WARN,button,1342263299
272Control56=IDC_AUTH_NOTICE,button,1342263299
273Control57=IDC_AUTH_INFO,button,1342263299
274Control58=IDC_AUTH_DEBUG,button,1342263299
275Control59=IDC_SYSLOG_EMERG,button,1342263299
276Control60=IDC_SYSLOG_ALERT,button,1342263299
277Control61=IDC_SYSLOG_CRIT,button,1342263299
278Control62=IDC_SYSLOG_ERR,button,1342263299
279Control63=IDC_SYSLOG_WARN,button,1342263299
280Control64=IDC_SYSLOG_NOTICE,button,1342263299
281Control65=IDC_SYSLOG_INFO,button,1342263299
282Control66=IDC_SYSLOG_DEBUG,button,1342263299
283Control67=IDC_LPR_EMERG,button,1342263299
284Control68=IDC_LPR_ALERT,button,1342263299
285Control69=IDC_LPR_CRIT,button,1342263299
286Control70=IDC_LPR_ERR,button,1342263299
287Control71=IDC_LPR_WARN,button,1342263299
288Control72=IDC_LPR_NOTICE,button,1342263299
289Control73=IDC_LPR_INFO,button,1342263299
290Control74=IDC_LPR_DEBUG,button,1342263299
291Control75=IDC_NEWS_EMERG,button,1342263299
292Control76=IDC_NEWS_ALERT,button,1342263299
293Control77=IDC_NEWS_CRIT,button,1342263299
294Control78=IDC_NEWS_ERR,button,1342263299
295Control79=IDC_NEWS_WARN,button,1342263299
296Control80=IDC_NEWS_NOTICE,button,1342263299
297Control81=IDC_NEWS_INFO,button,1342263299
298Control82=IDC_NEWS_DEBUG,button,1342263299
299Control83=IDC_UUCP_EMERG,button,1342263299
300Control84=IDC_UUCP_ALERT,button,1342263299
301Control85=IDC_UUCP_CRIT,button,1342263299
302Control86=IDC_UUCP_ERR,button,1342263299
303Control87=IDC_UUCP_WARN,button,1342263299
304Control88=IDC_UUCP_NOTICE,button,1342263299
305Control89=IDC_UUCP_INFO,button,1342263299
306Control90=IDC_UUCP_DEBUG,button,1342263299
307Control91=IDC_CRON_EMERG,button,1342263299
308Control92=IDC_CRON_ALERT,button,1342263299
309Control93=IDC_CRON_CRIT,button,1342263299
310Control94=IDC_CRON_ERR,button,1342263299
311Control95=IDC_CRON_WARN,button,1342263299
312Control96=IDC_CRON_NOTICE,button,1342263299
313Control97=IDC_CRON_INFO,button,1342263299
314Control98=IDC_CRON_DEBUG,button,1342263299
315Control99=IDC_EMERG_XOR,button,1342263040
316Control100=IDC_ALERT_XOR,button,1342263040
317Control101=IDC_CRIT_XOR,button,1342263040
318Control102=IDC_ERR_XOR,button,1342263040
319Control103=IDC_WARN_XOR,button,1342263040
320Control104=IDC_NOTICE_XOR,button,1342263040
321Control105=IDC_INFO_XOR,button,1342263040
322Control106=IDC_DEBUG_XOR,button,1342263040
323Control107=IDC_KERNEL_XOR,button,1342263040
324Control108=IDC_USER_XOR,button,1342263040
325Control109=IDC_MAIL_XOR,button,1342263040
326Control110=IDC_DAEMON_XOR,button,1342263040
327Control111=IDC_AUTH_XOR,button,1342263040
328Control112=IDC_SYSLOG_XOR,button,1342263040
329Control113=IDC_LPR_XOR,button,1342263040
330Control114=IDC_NEWS_XOR,button,1342263040
331Control115=IDC_UUCP_XOR,button,1342263040
332Control116=IDC_CRON_XOR,button,1342263040
333Control117=IDC_STATIC,static,1342308352
334Control118=IDC_STATIC,static,1342308352
335Control119=IDC_AUTHPRIV_ON,button,1342263040
336Control120=IDC_AUTHPRIV_EMERG,button,1342263299
337Control121=IDC_AUTHPRIV_ALERT,button,1342263299
338Control122=IDC_AUTHPRIV_CRIT,button,1342263299
339Control123=IDC_AUTHPRIV_ERR,button,1342263299
340Control124=IDC_AUTHPRIV_WARN,button,1342263299
341Control125=IDC_AUTHPRIV_NOTICE,button,1342263299
342Control126=IDC_AUTHPRIV_INFO,button,1342263299
343Control127=IDC_AUTHPRIV_DEBUG,button,1342263299
344Control128=IDC_AUTHPRIV_XOR,button,1342263040
345
346[DLG:IDD_LOG_LOCAL]
347Type=1
348Class=CLogPatternLocal
349ControlCount=98
350Control1=IDC_EMERG_ON,button,1342263040
351Control2=IDC_ALERT_ON,button,1342263040
352Control3=IDC_CRIT_ON,button,1342263040
353Control4=IDC_ERR_ON,button,1342263040
354Control5=IDC_WARN_ON,button,1342263040
355Control6=IDC_NOTICE_ON,button,1342263040
356Control7=IDC_INFO_ON,button,1342263040
357Control8=IDC_DEBUG_ON,button,1342263040
358Control9=IDC_L0_ON,button,1342263040
359Control10=IDC_L1_ON,button,1342263040
360Control11=IDC_L2_ON,button,1342263040
361Control12=IDC_L3_ON,button,1342263040
362Control13=IDC_L4_ON,button,1342263040
363Control14=IDC_L5_ON,button,1342263040
364Control15=IDC_L6_ON,button,1342263040
365Control16=IDC_L7_ON,button,1342263040
366Control17=IDC_L0_EMERG,button,1342263299
367Control18=IDC_L0_ALERT,button,1342263299
368Control19=IDC_L0_CRIT,button,1342263299
369Control20=IDC_L0_ERR,button,1342263299
370Control21=IDC_L0_WARN,button,1342263299
371Control22=IDC_L0_NOTICE,button,1342263299
372Control23=IDC_L0_INFO,button,1342263299
373Control24=IDC_L0_DEBUG,button,1342263299
374Control25=IDC_L1_EMERG,button,1342263299
375Control26=IDC_L1_ALERT,button,1342263299
376Control27=IDC_L1_CRIT,button,1342263299
377Control28=IDC_L1_ERR,button,1342263299
378Control29=IDC_L1_WARN,button,1342263299
379Control30=IDC_L1_NOTICE,button,1342263299
380Control31=IDC_L1_INFO,button,1342263299
381Control32=IDC_L1_DEBUG,button,1342263299
382Control33=IDC_L2_EMERG,button,1342263299
383Control34=IDC_L2_ALERT,button,1342263299
384Control35=IDC_L2_CRIT,button,1342263299
385Control36=IDC_L2_ERR,button,1342263299
386Control37=IDC_L2_WARN,button,1342263299
387Control38=IDC_L2_NOTICE,button,1342263299
388Control39=IDC_L2_INFO,button,1342263299
389Control40=IDC_L2_DEBUG,button,1342263299
390Control41=IDC_L3_EMERG,button,1342263299
391Control42=IDC_L3_ALERT,button,1342263299
392Control43=IDC_L3_CRIT,button,1342263299
393Control44=IDC_L3_ERR,button,1342263299
394Control45=IDC_L3_WARN,button,1342263299
395Control46=IDC_L3_NOTICE,button,1342263299
396Control47=IDC_L3_INFO,button,1342263299
397Control48=IDC_L3_DEBUG,button,1342263299
398Control49=IDC_L4_EMERG,button,1342263299
399Control50=IDC_L4_ALERT,button,1342263299
400Control51=IDC_L4_CRIT,button,1342263299
401Control52=IDC_L4_ERR,button,1342263299
402Control53=IDC_L4_WARN,button,1342263299
403Control54=IDC_L4_NOTICE,button,1342263299
404Control55=IDC_L4_INFO,button,1342263299
405Control56=IDC_L4_DEBUG,button,1342263299
406Control57=IDC_L5_EMERG,button,1342263299
407Control58=IDC_L5_ALERT,button,1342263299
408Control59=IDC_L5_CRIT,button,1342263299
409Control60=IDC_L5_ERR,button,1342263299
410Control61=IDC_L5_WARN,button,1342263299
411Control62=IDC_L5_NOTICE,button,1342263299
412Control63=IDC_L5_INFO,button,1342263299
413Control64=IDC_L5_DEBUG,button,1342263299
414Control65=IDC_L6_EMERG,button,1342263299
415Control66=IDC_L6_ALERT,button,1342263299
416Control67=IDC_L6_CRIT,button,1342263299
417Control68=IDC_L6_ERR,button,1342263299
418Control69=IDC_L6_WARN,button,1342263299
419Control70=IDC_L6_NOTICE,button,1342263299
420Control71=IDC_L6_INFO,button,1342263299
421Control72=IDC_L6_DEBUG,button,1342263299
422Control73=IDC_L7_EMERG,button,1342263299
423Control74=IDC_L7_ALERT,button,1342263299
424Control75=IDC_L7_CRIT,button,1342263299
425Control76=IDC_L7_ERR,button,1342263299
426Control77=IDC_L7_WARN,button,1342263299
427Control78=IDC_L7_NOTICE,button,1342263299
428Control79=IDC_L7_INFO,button,1342263299
429Control80=IDC_L7_DEBUG,button,1342263299
430Control81=IDC_EMERG_XOR,button,1342263040
431Control82=IDC_ALERT_XOR,button,1342263040
432Control83=IDC_CRIT_XOR,button,1342263040
433Control84=IDC_ERR_XOR,button,1342263040
434Control85=IDC_WARN_XOR,button,1342263040
435Control86=IDC_NOTICE_XOR,button,1342263040
436Control87=IDC_INFO_XOR,button,1342263040
437Control88=IDC_DEBUG_XOR,button,1342263040
438Control89=IDC_L0_XOR,button,1342263040
439Control90=IDC_L1_XOR,button,1342263040
440Control91=IDC_L2_XOR,button,1342263040
441Control92=IDC_L3_XOR,button,1342263040
442Control93=IDC_L4_XOR,button,1342263040
443Control94=IDC_L5_XOR,button,1342263040
444Control95=IDC_L6_XOR,button,1342263040
445Control96=IDC_L7_XOR,button,1342263040
446Control97=IDC_STATIC,static,1342308352
447Control98=IDC_STATIC,static,1342308352
448
449[CLS:CLogPattern]
450Type=0
451HeaderFile=LogPattern.h
452ImplementationFile=LogPattern.cpp
453BaseClass=CPropertySheet
454Filter=W
455LastObject=CLogPattern
456
457[CLS:CLogPatternUnix]
458Type=0
459HeaderFile=LogPatternUnix.h
460ImplementationFile=LogPatternUnix.cpp
461BaseClass=CPropertyPage
462Filter=D
463LastObject=CLogPatternUnix
464VirtualFilter=idWC
465
466[CLS:CLogPatternReserved]
467Type=0
468HeaderFile=LogPatternReserved.h
469ImplementationFile=LogPatternReserved.cpp
470BaseClass=CPropertyPage
471Filter=D
472LastObject=IDC_WARN_XOR
473VirtualFilter=idWC
474
475[CLS:CLogPatternLocal]
476Type=0
477HeaderFile=LogPatternLocal.h
478ImplementationFile=LogPatternLocal.cpp
479BaseClass=CPropertyPage
480Filter=D
481LastObject=CLogPatternLocal
482VirtualFilter=idWC
483
484[DLG:IDD_WARNBLOCKING]
485Type=1
486Class=CWarnBlocking
487ControlCount=5
488Control1=IDOK,button,1342242817
489Control2=IDCANCEL,button,1342242816
490Control3=IDC_STATIC,static,1342308352
491Control4=IDC_STATIC,static,1342308352
492Control5=IDC_WARNBLOCKING,button,1342254595
493
494[CLS:CWarnBlocking]
495Type=0
496HeaderFile=WarnBlocking.h
497ImplementationFile=WarnBlocking.cpp
498BaseClass=CDialog
499Filter=D
500VirtualFilter=dWC
501LastObject=CWarnBlocking
502
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 @@
1// KLog.cpp : Defines the class behaviors for the application.
2//
3
4#include "stdafx.h"
5#include "KLog.h"
6#include "SyslogSocket.h"
7#include "KLogDlg.h"
8
9#ifdef _DEBUG
10#define new DEBUG_NEW
11#undef THIS_FILE
12static char THIS_FILE[] = __FILE__;
13#endif
14
15/////////////////////////////////////////////////////////////////////////////
16// CKLogApp
17
18BEGIN_MESSAGE_MAP(CKLogApp, CWinApp)
19 //{{AFX_MSG_MAP(CKLogApp)
20 //}}AFX_MSG
21 ON_COMMAND(ID_HELP, CWinApp::OnHelp)
22END_MESSAGE_MAP()
23
24/////////////////////////////////////////////////////////////////////////////
25// CKLogApp construction
26
27CKLogApp::CKLogApp()
28{
29}
30
31/////////////////////////////////////////////////////////////////////////////
32// The one and only CKLogApp object
33
34CKLogApp theApp;
35
36/////////////////////////////////////////////////////////////////////////////
37// CKLogApp initialization
38
39BOOL CKLogApp::InitInstance()
40{
41 if (!AfxSocketInit())
42 {
43 AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
44 return FALSE;
45 }
46
47 // Standard initialization
48 // If you are not using these features and wish to reduce the size
49 // of your final executable, you should remove from the following
50 // the specific initialization routines you do not need.
51
52#ifdef _AFXDLL
53 Enable3dControls(); // Call this when using MFC in a shared DLL
54#else
55 Enable3dControlsStatic();// Call this when linking to MFC statically
56#endif
57
58 SetRegistryKey(IDS_REGISTRYKEY);
59 m_HelpFile = m_pszHelpFilePath;
60 m_HelpFile+=">Standard";
61 m_pszHelpFilePath=(LPCTSTR)m_HelpFile;
62
63 CKLogDlg dlg;
64 m_pMainWnd = &dlg;
65 int nResponse = dlg.DoModal();
66
67 // Since the dialog has been closed, return FALSE so that we exit the
68 // application, rather than start the application's message pump.
69 return FALSE;
70}
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 @@
1// KLog.h : main header file for the KLOG application
2//
3
4#ifndef __AFXWIN_H__
5 #error include 'stdafx.h' before including this file for PCH
6#endif
7
8 #include "resource.h" // main symbols
9
10/////////////////////////////////////////////////////////////////////////////
11// CKLogApp:
12// See KLog.cpp for the implementation of this class
13//
14
15class CKLogApp : public CWinApp
16{
17public:
18 CString m_HelpFile;
19 CKLogApp();
20
21// Overrides
22 // ClassWizard generated virtual function overrides
23 //{{AFX_VIRTUAL(CKLogApp)
24 public:
25 virtual BOOL InitInstance();
26 //}}AFX_VIRTUAL
27
28// Implementation
29
30 //{{AFX_MSG(CKLogApp)
31 //}}AFX_MSG
32 DECLARE_MESSAGE_MAP()
33};
34
35
36/////////////////////////////////////////////////////////////////////////////
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 @@
1# Microsoft Developer Studio Generated NMAKE File, Format Version 4.20
2# ** DO NOT EDIT **
3
4# TARGTYPE "Win32 (x86) Application" 0x0101
5
6!IF "$(CFG)" == ""
7CFG=Install - Win32 Debug
8!MESSAGE No configuration specified. Defaulting to Install - Win32 Debug.
9!ENDIF
10
11!IF "$(CFG)" != "KLog - Win32 Release" && "$(CFG)" != "KLog - Win32 Debug" &&\
12 "$(CFG)" != "KLog - Win32 Static Release" && "$(CFG)" !=\
13 "Install - Win32 Debug" && "$(CFG)" != "Install - Win32 Pure" && "$(CFG)" !=\
14 "Install - Win32 Canned" && "$(CFG)" != "Install - Win32 Static"
15!MESSAGE Invalid configuration "$(CFG)" specified.
16!MESSAGE You can specify a configuration when running NMAKE on this makefile
17!MESSAGE by defining the macro CFG on the command line. For example:
18!MESSAGE
19!MESSAGE NMAKE /f "klog.mak" CFG="Install - Win32 Debug"
20!MESSAGE
21!MESSAGE Possible choices for configuration are:
22!MESSAGE
23!MESSAGE "KLog - Win32 Release" (based on "Win32 (x86) Application")
24!MESSAGE "KLog - Win32 Debug" (based on "Win32 (x86) Application")
25!MESSAGE "KLog - Win32 Static Release" (based on "Win32 (x86) Application")
26!MESSAGE "Install - Win32 Debug" (based on "Win32 (x86) Application")
27!MESSAGE "Install - Win32 Pure" (based on "Win32 (x86) Application")
28!MESSAGE "Install - Win32 Canned" (based on "Win32 (x86) Application")
29!MESSAGE "Install - Win32 Static" (based on "Win32 (x86) Application")
30!MESSAGE
31!ERROR An invalid configuration is specified.
32!ENDIF
33
34!IF "$(OS)" == "Windows_NT"
35NULL=
36!ELSE
37NULL=nul
38!ENDIF
39################################################################################
40# Begin Project
41# PROP Target_Last_Scanned "Install - Win32 Static"
42CPP=cl.exe
43RSC=rc.exe
44MTL=mktyplib.exe
45
46!IF "$(CFG)" == "KLog - Win32 Release"
47
48# PROP BASE Use_MFC 6
49# PROP BASE Use_Debug_Libraries 0
50# PROP BASE Output_Dir "Release"
51# PROP BASE Intermediate_Dir "Release"
52# PROP BASE Target_Dir ""
53# PROP Use_MFC 6
54# PROP Use_Debug_Libraries 0
55# PROP Output_Dir "Release"
56# PROP Intermediate_Dir "Release"
57# PROP Target_Dir ""
58OUTDIR=.\Release
59INTDIR=.\Release
60# Begin Custom Macros
61OutDir=.\Release
62TargetName=klog
63# End Custom Macros
64
65ALL : "$(OUTDIR)\klog.exe" "$(OUTDIR)\klog.ex_" "$(OUTDIR)\klog.hlp"\
66 "$(OUTDIR)\klog.cnt" "$(OUTDIR)\klog.hl_" "$(OUTDIR)\klog.cn_"
67
68CLEAN :
69 -@erase "$(INTDIR)\klog.cn_"
70 -@erase "$(INTDIR)\klog.cnt"
71 -@erase "$(INTDIR)\klog.hl_"
72 -@erase "$(INTDIR)\klog.hlp"
73 -@erase "$(INTDIR)\KLog.obj"
74 -@erase "$(INTDIR)\klog.pch"
75 -@erase "$(INTDIR)\KLog.res"
76 -@erase "$(INTDIR)\KLogDlg.obj"
77 -@erase "$(INTDIR)\LogPattern.obj"
78 -@erase "$(INTDIR)\LogPatternLocal.obj"
79 -@erase "$(INTDIR)\LogPatternReserved.obj"
80 -@erase "$(INTDIR)\LogPatternUnix.obj"
81 -@erase "$(INTDIR)\StdAfx.obj"
82 -@erase "$(INTDIR)\SyslogSocket.obj"
83 -@erase "$(INTDIR)\Trayer.obj"
84 -@erase "$(INTDIR)\WarnBlocking.obj"
85 -@erase "$(OUTDIR)\klog.ex_"
86 -@erase "$(OUTDIR)\klog.exe"
87
88"$(OUTDIR)" :
89 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
90
91# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
92# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
93CPP_PROJ=/nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
94 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/klog.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c
95CPP_OBJS=.\Release/
96CPP_SBRS=.\.
97# ADD BASE MTL /nologo /D "NDEBUG" /win32
98# ADD MTL /nologo /D "NDEBUG" /win32
99MTL_PROJ=/nologo /D "NDEBUG" /win32
100# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
101# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
102RSC_PROJ=/l 0x409 /fo"$(INTDIR)/KLog.res" /d "NDEBUG" /d "_AFXDLL"
103BSC32=bscmake.exe
104# ADD BASE BSC32 /nologo
105# ADD BSC32 /nologo
106BSC32_FLAGS=/nologo /o"$(OUTDIR)/klog.bsc"
107BSC32_SBRS= \
108
109LINK32=link.exe
110# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
111# ADD LINK32 /nologo /subsystem:windows /machine:I386
112LINK32_FLAGS=/nologo /subsystem:windows /incremental:no\
113 /pdb:"$(OUTDIR)/klog.pdb" /machine:I386 /out:"$(OUTDIR)/klog.exe"
114LINK32_OBJS= \
115 "$(INTDIR)\KLog.obj" \
116 "$(INTDIR)\KLog.res" \
117 "$(INTDIR)\KLogDlg.obj" \
118 "$(INTDIR)\LogPattern.obj" \
119 "$(INTDIR)\LogPatternLocal.obj" \
120 "$(INTDIR)\LogPatternReserved.obj" \
121 "$(INTDIR)\LogPatternUnix.obj" \
122 "$(INTDIR)\StdAfx.obj" \
123 "$(INTDIR)\SyslogSocket.obj" \
124 "$(INTDIR)\Trayer.obj" \
125 "$(INTDIR)\WarnBlocking.obj"
126
127"$(OUTDIR)\klog.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
128 $(LINK32) @<<
129 $(LINK32_FLAGS) $(LINK32_OBJS)
130<<
131
132# Begin Custom Build
133OutDir=.\Release
134TargetName=klog
135InputPath=.\Release\klog.exe
136SOURCE=$(InputPath)
137
138"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
139 compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
140
141# End Custom Build
142
143!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
144
145# PROP BASE Use_MFC 6
146# PROP BASE Use_Debug_Libraries 1
147# PROP BASE Output_Dir "Debug"
148# PROP BASE Intermediate_Dir "Debug"
149# PROP BASE Target_Dir ""
150# PROP Use_MFC 6
151# PROP Use_Debug_Libraries 1
152# PROP Output_Dir "Debug"
153# PROP Intermediate_Dir "Debug"
154# PROP Target_Dir ""
155OUTDIR=.\Debug
156INTDIR=.\Debug
157# Begin Custom Macros
158OutDir=.\Debug
159TargetName=klog
160# End Custom Macros
161
162ALL : "$(OUTDIR)\klog.exe" "$(OUTDIR)\klog.ex_" "$(OUTDIR)\klog.hlp"\
163 "$(OUTDIR)\klog.cnt" "$(OUTDIR)\klog.hl_" "$(OUTDIR)\klog.cn_"
164
165CLEAN :
166 -@erase "$(INTDIR)\klog.cn_"
167 -@erase "$(INTDIR)\klog.cnt"
168 -@erase "$(INTDIR)\klog.hl_"
169 -@erase "$(INTDIR)\klog.hlp"
170 -@erase "$(INTDIR)\KLog.obj"
171 -@erase "$(INTDIR)\klog.pch"
172 -@erase "$(INTDIR)\KLog.res"
173 -@erase "$(INTDIR)\KLogDlg.obj"
174 -@erase "$(INTDIR)\LogPattern.obj"
175 -@erase "$(INTDIR)\LogPatternLocal.obj"
176 -@erase "$(INTDIR)\LogPatternReserved.obj"
177 -@erase "$(INTDIR)\LogPatternUnix.obj"
178 -@erase "$(INTDIR)\StdAfx.obj"
179 -@erase "$(INTDIR)\SyslogSocket.obj"
180 -@erase "$(INTDIR)\Trayer.obj"
181 -@erase "$(INTDIR)\vc40.idb"
182 -@erase "$(INTDIR)\vc40.pdb"
183 -@erase "$(INTDIR)\WarnBlocking.obj"
184 -@erase "$(OUTDIR)\klog.ex_"
185 -@erase "$(OUTDIR)\klog.exe"
186 -@erase "$(OUTDIR)\klog.ilk"
187 -@erase "$(OUTDIR)\klog.pdb"
188
189"$(OUTDIR)" :
190 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
191
192# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
193# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
194CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
195 /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/klog.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/"\
196 /Fd"$(INTDIR)/" /c
197CPP_OBJS=.\Debug/
198CPP_SBRS=.\.
199# ADD BASE MTL /nologo /D "_DEBUG" /win32
200# ADD MTL /nologo /D "_DEBUG" /win32
201MTL_PROJ=/nologo /D "_DEBUG" /win32
202# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
203# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
204RSC_PROJ=/l 0x409 /fo"$(INTDIR)/KLog.res" /d "_DEBUG" /d "_AFXDLL"
205BSC32=bscmake.exe
206# ADD BASE BSC32 /nologo
207# ADD BSC32 /nologo
208BSC32_FLAGS=/nologo /o"$(OUTDIR)/klog.bsc"
209BSC32_SBRS= \
210
211LINK32=link.exe
212# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
213# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386
214LINK32_FLAGS=/nologo /subsystem:windows /incremental:yes\
215 /pdb:"$(OUTDIR)/klog.pdb" /debug /machine:I386 /out:"$(OUTDIR)/klog.exe"
216LINK32_OBJS= \
217 "$(INTDIR)\KLog.obj" \
218 "$(INTDIR)\KLog.res" \
219 "$(INTDIR)\KLogDlg.obj" \
220 "$(INTDIR)\LogPattern.obj" \
221 "$(INTDIR)\LogPatternLocal.obj" \
222 "$(INTDIR)\LogPatternReserved.obj" \
223 "$(INTDIR)\LogPatternUnix.obj" \
224 "$(INTDIR)\StdAfx.obj" \
225 "$(INTDIR)\SyslogSocket.obj" \
226 "$(INTDIR)\Trayer.obj" \
227 "$(INTDIR)\WarnBlocking.obj"
228
229"$(OUTDIR)\klog.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
230 $(LINK32) @<<
231 $(LINK32_FLAGS) $(LINK32_OBJS)
232<<
233
234# Begin Custom Build
235OutDir=.\Debug
236TargetName=klog
237InputPath=.\Debug\klog.exe
238SOURCE=$(InputPath)
239
240"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
241 compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
242
243# End Custom Build
244
245!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
246
247# PROP BASE Use_MFC 6
248# PROP BASE Use_Debug_Libraries 0
249# PROP BASE Output_Dir "KLog___W"
250# PROP BASE Intermediate_Dir "KLog___W"
251# PROP BASE Target_Dir ""
252# PROP Use_MFC 5
253# PROP Use_Debug_Libraries 0
254# PROP Output_Dir "Releast"
255# PROP Intermediate_Dir "Releast"
256# PROP Target_Dir ""
257OUTDIR=.\Releast
258INTDIR=.\Releast
259# Begin Custom Macros
260OutDir=.\Releast
261TargetName=klog
262# End Custom Macros
263
264ALL : "$(OUTDIR)\klog.exe" "$(OUTDIR)\klog.hlp" "$(OUTDIR)\klog.cnt"\
265 "$(OUTDIR)\klog.hl_" "$(OUTDIR)\klog.cn_" "$(OUTDIR)\klog.ex_"
266
267CLEAN :
268 -@erase "$(INTDIR)\klog.cn_"
269 -@erase "$(INTDIR)\klog.cnt"
270 -@erase "$(INTDIR)\klog.hl_"
271 -@erase "$(INTDIR)\klog.hlp"
272 -@erase "$(INTDIR)\KLog.obj"
273 -@erase "$(INTDIR)\klog.pch"
274 -@erase "$(INTDIR)\KLog.res"
275 -@erase "$(INTDIR)\KLogDlg.obj"
276 -@erase "$(INTDIR)\LogPattern.obj"
277 -@erase "$(INTDIR)\LogPatternLocal.obj"
278 -@erase "$(INTDIR)\LogPatternReserved.obj"
279 -@erase "$(INTDIR)\LogPatternUnix.obj"
280 -@erase "$(INTDIR)\StdAfx.obj"
281 -@erase "$(INTDIR)\SyslogSocket.obj"
282 -@erase "$(INTDIR)\Trayer.obj"
283 -@erase "$(INTDIR)\WarnBlocking.obj"
284 -@erase "$(OUTDIR)\klog.ex_"
285 -@erase "$(OUTDIR)\klog.exe"
286
287"$(OUTDIR)" :
288 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
289
290# ADD BASE CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /c
291# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /c
292CPP_PROJ=/nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
293 "_MBCS" /Fp"$(INTDIR)/klog.pch" /Yu"stdafx.h" /Fo"$(INTDIR)/" /c
294CPP_OBJS=.\Releast/
295CPP_SBRS=.\.
296# ADD BASE MTL /nologo /D "NDEBUG" /win32
297# ADD MTL /nologo /D "NDEBUG" /win32
298MTL_PROJ=/nologo /D "NDEBUG" /win32
299# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
300# ADD RSC /l 0x409 /d "NDEBUG"
301RSC_PROJ=/l 0x409 /fo"$(INTDIR)/KLog.res" /d "NDEBUG"
302BSC32=bscmake.exe
303# ADD BASE BSC32 /nologo
304# ADD BSC32 /nologo
305BSC32_FLAGS=/nologo /o"$(OUTDIR)/klog.bsc"
306BSC32_SBRS= \
307
308LINK32=link.exe
309# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
310# ADD LINK32 /nologo /subsystem:windows /machine:I386
311LINK32_FLAGS=/nologo /subsystem:windows /incremental:no\
312 /pdb:"$(OUTDIR)/klog.pdb" /machine:I386 /out:"$(OUTDIR)/klog.exe"
313LINK32_OBJS= \
314 "$(INTDIR)\KLog.obj" \
315 "$(INTDIR)\KLog.res" \
316 "$(INTDIR)\KLogDlg.obj" \
317 "$(INTDIR)\LogPattern.obj" \
318 "$(INTDIR)\LogPatternLocal.obj" \
319 "$(INTDIR)\LogPatternReserved.obj" \
320 "$(INTDIR)\LogPatternUnix.obj" \
321 "$(INTDIR)\StdAfx.obj" \
322 "$(INTDIR)\SyslogSocket.obj" \
323 "$(INTDIR)\Trayer.obj" \
324 "$(INTDIR)\WarnBlocking.obj"
325
326"$(OUTDIR)\klog.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
327 $(LINK32) @<<
328 $(LINK32_FLAGS) $(LINK32_OBJS)
329<<
330
331# Begin Custom Build
332OutDir=.\Releast
333TargetName=klog
334InputPath=.\Releast\klog.exe
335SOURCE=$(InputPath)
336
337"$(OutDir)\$(TargetName).ex_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
338 compress $(OutDir)\$(TargetName).exe $(OutDir)\$(TargetName).ex_
339
340# End Custom Build
341
342!ELSEIF "$(CFG)" == "Install - Win32 Debug"
343
344# PROP BASE Use_MFC 2
345# PROP BASE Use_Debug_Libraries 1
346# PROP BASE Output_Dir "Install\Debug"
347# PROP BASE Intermediate_Dir "Install\Debug"
348# PROP BASE Target_Dir "Install"
349# PROP Use_MFC 2
350# PROP Use_Debug_Libraries 1
351# PROP Output_Dir "Install\Debug"
352# PROP Intermediate_Dir "Install\Debug"
353# PROP Target_Dir "Install"
354OUTDIR=.\Install\Debug
355INTDIR=.\Install\Debug
356
357ALL : "KLog - Win32 Debug" "$(OUTDIR)\Install.exe"
358
359CLEAN :
360 -@erase "$(INTDIR)\install.obj"
361 -@erase "$(INTDIR)\Install.res"
362 -@erase "$(INTDIR)\vc40.idb"
363 -@erase "$(INTDIR)\vc40.pdb"
364 -@erase "$(OUTDIR)\Install.exe"
365 -@erase "$(OUTDIR)\Install.ilk"
366 -@erase "$(OUTDIR)\Install.pdb"
367
368"$(OUTDIR)" :
369 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
370
371# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c
372# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c
373CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
374 /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/"\
375 /Fd"$(INTDIR)/" /c
376CPP_OBJS=.\Install\Debug/
377CPP_SBRS=.\.
378# ADD BASE MTL /nologo /D "_DEBUG" /win32
379# ADD MTL /nologo /D "_DEBUG" /win32
380MTL_PROJ=/nologo /D "_DEBUG" /win32
381# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
382# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
383RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "_DEBUG" /d "_AFXDLL"
384BSC32=bscmake.exe
385# ADD BASE BSC32 /nologo
386# ADD BSC32 /nologo
387BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
388BSC32_SBRS= \
389
390LINK32=link.exe
391# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386
392# ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib version.lib advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386
393LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib version.lib\
394 advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /incremental:yes\
395 /pdb:"$(OUTDIR)/Install.pdb" /debug /machine:I386 /out:"$(OUTDIR)/Install.exe"
396LINK32_OBJS= \
397 "$(INTDIR)\install.obj" \
398 "$(INTDIR)\Install.res"
399
400"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
401 $(LINK32) @<<
402 $(LINK32_FLAGS) $(LINK32_OBJS)
403<<
404
405!ELSEIF "$(CFG)" == "Install - Win32 Pure"
406
407# PROP BASE Use_MFC 2
408# PROP BASE Use_Debug_Libraries 0
409# PROP BASE Output_Dir "Install\Pure"
410# PROP BASE Intermediate_Dir "Install\Pure"
411# PROP BASE Target_Dir "Install"
412# PROP Use_MFC 2
413# PROP Use_Debug_Libraries 0
414# PROP Output_Dir "Install\Pure"
415# PROP Intermediate_Dir "Install\Pure"
416# PROP Target_Dir "Install"
417OUTDIR=.\Install\Pure
418INTDIR=.\Install\Pure
419
420ALL : "$(OUTDIR)\Install.exe"
421
422CLEAN :
423 -@erase "$(INTDIR)\install.obj"
424 -@erase "$(INTDIR)\Install.res"
425 -@erase "$(OUTDIR)\Install.exe"
426
427"$(OUTDIR)" :
428 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
429
430# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c
431# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c
432CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
433 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/Install.pch" /YX /Fo"$(INTDIR)/" /c
434CPP_OBJS=.\Install\Pure/
435CPP_SBRS=.\.
436# ADD BASE MTL /nologo /D "NDEBUG" /win32
437# ADD MTL /nologo /D "NDEBUG" /win32
438MTL_PROJ=/nologo /D "NDEBUG" /win32
439# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
440# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
441RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "_AFXDLL"
442BSC32=bscmake.exe
443# ADD BASE BSC32 /nologo
444# ADD BSC32 /nologo
445BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
446BSC32_SBRS= \
447
448LINK32=link.exe
449# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
450# ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib version.lib advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /machine:I386
451LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib version.lib\
452 advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /incremental:no\
453 /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe"
454LINK32_OBJS= \
455 "$(INTDIR)\install.obj" \
456 "$(INTDIR)\Install.res"
457
458"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
459 $(LINK32) @<<
460 $(LINK32_FLAGS) $(LINK32_OBJS)
461<<
462
463!ELSEIF "$(CFG)" == "Install - Win32 Canned"
464
465# PROP BASE Use_MFC 2
466# PROP BASE Use_Debug_Libraries 0
467# PROP BASE Output_Dir "Install\Canned"
468# PROP BASE Intermediate_Dir "Install\Canned"
469# PROP BASE Target_Dir "Install"
470# PROP Use_MFC 2
471# PROP Use_Debug_Libraries 0
472# PROP Output_Dir "Install\Canned"
473# PROP Intermediate_Dir "Install\Canned"
474# PROP Target_Dir "Install"
475OUTDIR=.\Install\Canned
476INTDIR=.\Install\Canned
477
478ALL : "$(OUTDIR)\Install.exe"
479
480CLEAN :
481 -@erase "$(INTDIR)\install.obj"
482 -@erase "$(INTDIR)\Install.res"
483 -@erase "$(OUTDIR)\Install.exe"
484
485"$(OUTDIR)" :
486 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
487
488# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c
489# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "K_ANNED" /YX /c
490CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
491 "_AFXDLL" /D "_MBCS" /D "K_ANNED" /Fp"$(INTDIR)/Install.pch" /YX\
492 /Fo"$(INTDIR)/" /c
493CPP_OBJS=.\Install\Canned/
494CPP_SBRS=.\.
495# ADD BASE MTL /nologo /D "NDEBUG" /win32
496# ADD MTL /nologo /D "NDEBUG" /win32
497MTL_PROJ=/nologo /D "NDEBUG" /win32
498# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
499# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" /d "K_ANNED"
500RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "_AFXDLL" /d\
501 "K_ANNED"
502BSC32=bscmake.exe
503# ADD BASE BSC32 /nologo
504# ADD BSC32 /nologo
505BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
506BSC32_SBRS= \
507
508LINK32=link.exe
509# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
510# ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib version.lib advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /machine:I386
511LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib version.lib\
512 advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /incremental:no\
513 /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe"
514LINK32_OBJS= \
515 "$(INTDIR)\install.obj" \
516 "$(INTDIR)\Install.res"
517
518"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
519 $(LINK32) @<<
520 $(LINK32_FLAGS) $(LINK32_OBJS)
521<<
522
523!ELSEIF "$(CFG)" == "Install - Win32 Static"
524
525# PROP BASE Use_MFC 2
526# PROP BASE Use_Debug_Libraries 0
527# PROP BASE Output_Dir "Install\Static"
528# PROP BASE Intermediate_Dir "Install\Static"
529# PROP BASE Target_Dir "Install"
530# PROP Use_MFC 2
531# PROP Use_Debug_Libraries 0
532# PROP Output_Dir "Install\Static"
533# PROP Intermediate_Dir "Install\Static"
534# PROP Target_Dir "Install"
535OUTDIR=.\Install\Static
536INTDIR=.\Install\Static
537
538ALL : "$(OUTDIR)\Install.exe"
539
540CLEAN :
541 -@erase "$(INTDIR)\install.obj"
542 -@erase "$(INTDIR)\Install.res"
543 -@erase "$(OUTDIR)\Install.exe"
544
545"$(OUTDIR)" :
546 if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
547
548# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /YX /c
549# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "STATI_K" /YX /c
550CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
551 "_AFXDLL" /D "_MBCS" /D "STATI_K" /Fp"$(INTDIR)/Install.pch" /YX\
552 /Fo"$(INTDIR)/" /c
553CPP_OBJS=.\Install\Static/
554CPP_SBRS=.\.
555# ADD BASE MTL /nologo /D "NDEBUG" /win32
556# ADD MTL /nologo /D "NDEBUG" /win32
557MTL_PROJ=/nologo /D "NDEBUG" /win32
558# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
559# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL" /d "STATI_K"
560RSC_PROJ=/l 0x409 /fo"$(INTDIR)/Install.res" /d "NDEBUG" /d "_AFXDLL" /d\
561 "STATI_K"
562BSC32=bscmake.exe
563# ADD BASE BSC32 /nologo
564# ADD BSC32 /nologo
565BSC32_FLAGS=/nologo /o"$(OUTDIR)/Install.bsc"
566BSC32_SBRS= \
567
568LINK32=link.exe
569# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
570# ADD LINK32 kernel32.lib user32.lib gdi32.lib shell32.lib version.lib advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /machine:I386
571LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib version.lib\
572 advapi32.lib uuid.lib ole32.lib /nologo /subsystem:windows /incremental:no\
573 /pdb:"$(OUTDIR)/Install.pdb" /machine:I386 /out:"$(OUTDIR)/Install.exe"
574LINK32_OBJS= \
575 "$(INTDIR)\install.obj" \
576 "$(INTDIR)\Install.res"
577
578"$(OUTDIR)\Install.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
579 $(LINK32) @<<
580 $(LINK32_FLAGS) $(LINK32_OBJS)
581<<
582
583!ENDIF
584
585.c{$(CPP_OBJS)}.obj:
586 $(CPP) $(CPP_PROJ) $<
587
588.cpp{$(CPP_OBJS)}.obj:
589 $(CPP) $(CPP_PROJ) $<
590
591.cxx{$(CPP_OBJS)}.obj:
592 $(CPP) $(CPP_PROJ) $<
593
594.c{$(CPP_SBRS)}.sbr:
595 $(CPP) $(CPP_PROJ) $<
596
597.cpp{$(CPP_SBRS)}.sbr:
598 $(CPP) $(CPP_PROJ) $<
599
600.cxx{$(CPP_SBRS)}.sbr:
601 $(CPP) $(CPP_PROJ) $<
602
603################################################################################
604# Begin Target
605
606# Name "KLog - Win32 Release"
607# Name "KLog - Win32 Debug"
608# Name "KLog - Win32 Static Release"
609
610!IF "$(CFG)" == "KLog - Win32 Release"
611
612!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
613
614!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
615
616!ENDIF
617
618################################################################################
619# Begin Source File
620
621SOURCE=.\KLog.cpp
622DEP_CPP_KLOG_=\
623 ".\KLog.h"\
624 ".\KLogDlg.h"\
625 ".\stdafx.h"\
626 ".\SyslogSocket.h"\
627
628
629!IF "$(CFG)" == "KLog - Win32 Release"
630
631
632"$(INTDIR)\KLog.obj" : $(SOURCE) $(DEP_CPP_KLOG_) "$(INTDIR)"\
633 "$(INTDIR)\klog.pch"
634
635
636!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
637
638
639"$(INTDIR)\KLog.obj" : $(SOURCE) $(DEP_CPP_KLOG_) "$(INTDIR)"\
640 "$(INTDIR)\klog.pch"
641
642
643!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
644
645
646"$(INTDIR)\KLog.obj" : $(SOURCE) $(DEP_CPP_KLOG_) "$(INTDIR)"\
647 "$(INTDIR)\klog.pch"
648
649
650!ENDIF
651
652# End Source File
653################################################################################
654# Begin Source File
655
656SOURCE=.\KLogDlg.cpp
657DEP_CPP_KLOGD=\
658 ".\KLog.h"\
659 ".\KLogDlg.h"\
660 ".\LogPattern.h"\
661 ".\stdafx.h"\
662 ".\SyslogSocket.h"\
663 ".\Trayer.h"\
664 ".\WarnBlocking.h"\
665
666
667!IF "$(CFG)" == "KLog - Win32 Release"
668
669
670"$(INTDIR)\KLogDlg.obj" : $(SOURCE) $(DEP_CPP_KLOGD) "$(INTDIR)"\
671 "$(INTDIR)\klog.pch"
672
673
674!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
675
676
677"$(INTDIR)\KLogDlg.obj" : $(SOURCE) $(DEP_CPP_KLOGD) "$(INTDIR)"\
678 "$(INTDIR)\klog.pch"
679
680
681!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
682
683
684"$(INTDIR)\KLogDlg.obj" : $(SOURCE) $(DEP_CPP_KLOGD) "$(INTDIR)"\
685 "$(INTDIR)\klog.pch"
686
687
688!ENDIF
689
690# End Source File
691################################################################################
692# Begin Source File
693
694SOURCE=.\StdAfx.cpp
695DEP_CPP_STDAF=\
696 ".\stdafx.h"\
697
698
699!IF "$(CFG)" == "KLog - Win32 Release"
700
701# ADD CPP /Yc"stdafx.h"
702
703BuildCmds= \
704 $(CPP) /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D\
705 "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/klog.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c\
706 $(SOURCE) \
707
708
709"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
710 $(BuildCmds)
711
712"$(INTDIR)\klog.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
713 $(BuildCmds)
714
715!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
716
717# ADD CPP /Yc"stdafx.h"
718
719BuildCmds= \
720 $(CPP) /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
721 /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)/klog.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/"\
722 /Fd"$(INTDIR)/" /c $(SOURCE) \
723
724
725"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
726 $(BuildCmds)
727
728"$(INTDIR)\klog.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
729 $(BuildCmds)
730
731!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
732
733# ADD BASE CPP /Yc"stdafx.h"
734# ADD CPP /Yc"stdafx.h"
735
736BuildCmds= \
737 $(CPP) /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS"\
738 /Fp"$(INTDIR)/klog.pch" /Yc"stdafx.h" /Fo"$(INTDIR)/" /c $(SOURCE) \
739
740
741"$(INTDIR)\StdAfx.obj" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
742 $(BuildCmds)
743
744"$(INTDIR)\klog.pch" : $(SOURCE) $(DEP_CPP_STDAF) "$(INTDIR)"
745 $(BuildCmds)
746
747!ENDIF
748
749# End Source File
750################################################################################
751# Begin Source File
752
753SOURCE=.\klog.rc
754DEP_RSC_KLOG_R=\
755 ".\res\fear.wav"\
756 ".\res\glass.wav"\
757 ".\res\kick.wav"\
758 ".\res\klog-icon.ico"\
759 ".\res\klog-triggered-icon.ico"\
760 ".\res\KLog.ico"\
761 ".\res\klog.rc2"\
762 ".\res\log-pattern.ico"\
763 ".\res\meow.wav"\
764 ".\shared-data\browse-icon.ico"\
765 ".\shared-data\klever-background.bmp"\
766 ".\shared-data\play-icon.ico"\
767
768
769!IF "$(CFG)" == "KLog - Win32 Release"
770
771
772"$(INTDIR)\KLog.res" : $(SOURCE) $(DEP_RSC_KLOG_R) "$(INTDIR)"
773 $(RSC) $(RSC_PROJ) $(SOURCE)
774
775
776!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
777
778
779"$(INTDIR)\KLog.res" : $(SOURCE) $(DEP_RSC_KLOG_R) "$(INTDIR)"
780 $(RSC) $(RSC_PROJ) $(SOURCE)
781
782
783!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
784
785
786"$(INTDIR)\KLog.res" : $(SOURCE) $(DEP_RSC_KLOG_R) "$(INTDIR)"
787 $(RSC) $(RSC_PROJ) $(SOURCE)
788
789
790!ENDIF
791
792# End Source File
793################################################################################
794# Begin Source File
795
796SOURCE=.\help\klog.hpj
797
798!IF "$(CFG)" == "KLog - Win32 Release"
799
800# Begin Custom Build - Making help file...
801OutDir=.\Release
802ProjDir=.
803TargetName=klog
804InputPath=.\help\klog.hpj
805
806BuildCmds= \
807 "$(ProjDir)\makehelp.bat" \
808 compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
809 compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
810
811
812"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
813 $(BuildCmds)
814
815"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
816 $(BuildCmds)
817
818"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
819 $(BuildCmds)
820
821"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
822 $(BuildCmds)
823# End Custom Build
824
825!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
826
827# Begin Custom Build - Making help file...
828OutDir=.\Debug
829ProjDir=.
830TargetName=klog
831InputPath=.\help\klog.hpj
832
833BuildCmds= \
834 "$(ProjDir)\makehelp.bat" \
835 compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
836 compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
837
838
839"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
840 $(BuildCmds)
841
842"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
843 $(BuildCmds)
844
845"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
846 $(BuildCmds)
847
848"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
849 $(BuildCmds)
850# End Custom Build
851
852!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
853
854# Begin Custom Build - Making help file...
855OutDir=.\Releast
856ProjDir=.
857TargetName=klog
858InputPath=.\help\klog.hpj
859
860BuildCmds= \
861 "$(ProjDir)\makehelp.bat" \
862 compress $(OutDir)\$(TargetName).hlp $(OutDir)\$(TargetName).hl_ \
863 compress $(OutDir)\$(TargetName).cnt $(OutDir)\$(TargetName).cn_ \
864
865
866"$(OutDir)\$(TargetName).hlp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
867 $(BuildCmds)
868
869"$(OutDir)\$(TargetName).cnt" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
870 $(BuildCmds)
871
872"$(OutDir)\$(TargetName).hl_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
873 $(BuildCmds)
874
875"$(OutDir)\$(TargetName).cn_" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
876 $(BuildCmds)
877# End Custom Build
878
879!ENDIF
880
881# End Source File
882################################################################################
883# Begin Source File
884
885SOURCE=.\SyslogSocket.cpp
886DEP_CPP_SYSLO=\
887 ".\stdafx.h"\
888 ".\SyslogSocket.h"\
889
890
891!IF "$(CFG)" == "KLog - Win32 Release"
892
893
894"$(INTDIR)\SyslogSocket.obj" : $(SOURCE) $(DEP_CPP_SYSLO) "$(INTDIR)"\
895 "$(INTDIR)\klog.pch"
896
897
898!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
899
900
901"$(INTDIR)\SyslogSocket.obj" : $(SOURCE) $(DEP_CPP_SYSLO) "$(INTDIR)"\
902 "$(INTDIR)\klog.pch"
903
904
905!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
906
907
908"$(INTDIR)\SyslogSocket.obj" : $(SOURCE) $(DEP_CPP_SYSLO) "$(INTDIR)"\
909 "$(INTDIR)\klog.pch"
910
911
912!ENDIF
913
914# End Source File
915################################################################################
916# Begin Source File
917
918SOURCE=.\Trayer.cpp
919DEP_CPP_TRAYE=\
920 ".\KLog.h"\
921 ".\KLogDlg.h"\
922 ".\stdafx.h"\
923 ".\SyslogSocket.h"\
924 ".\Trayer.h"\
925
926
927!IF "$(CFG)" == "KLog - Win32 Release"
928
929
930"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\
931 "$(INTDIR)\klog.pch"
932
933
934!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
935
936
937"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\
938 "$(INTDIR)\klog.pch"
939
940
941!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
942
943
944"$(INTDIR)\Trayer.obj" : $(SOURCE) $(DEP_CPP_TRAYE) "$(INTDIR)"\
945 "$(INTDIR)\klog.pch"
946
947
948!ENDIF
949
950# End Source File
951################################################################################
952# Begin Source File
953
954SOURCE=.\LogPattern.cpp
955DEP_CPP_LOGPA=\
956 ".\KLog.h"\
957 ".\LogPattern.h"\
958 ".\LogPatternLocal.h"\
959 ".\LogPatternReserved.h"\
960 ".\LogPatternUnix.h"\
961 ".\stdafx.h"\
962 ".\SyslogSocket.h"\
963
964
965!IF "$(CFG)" == "KLog - Win32 Release"
966
967
968"$(INTDIR)\LogPattern.obj" : $(SOURCE) $(DEP_CPP_LOGPA) "$(INTDIR)"\
969 "$(INTDIR)\klog.pch"
970
971
972!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
973
974
975"$(INTDIR)\LogPattern.obj" : $(SOURCE) $(DEP_CPP_LOGPA) "$(INTDIR)"\
976 "$(INTDIR)\klog.pch"
977
978
979!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
980
981
982"$(INTDIR)\LogPattern.obj" : $(SOURCE) $(DEP_CPP_LOGPA) "$(INTDIR)"\
983 "$(INTDIR)\klog.pch"
984
985
986!ENDIF
987
988# End Source File
989################################################################################
990# Begin Source File
991
992SOURCE=.\LogPatternUnix.cpp
993DEP_CPP_LOGPAT=\
994 ".\KLog.h"\
995 ".\LogPattern.h"\
996 ".\LogPatternUnix.h"\
997 ".\stdafx.h"\
998 ".\SyslogSocket.h"\
999
1000
1001!IF "$(CFG)" == "KLog - Win32 Release"
1002
1003
1004"$(INTDIR)\LogPatternUnix.obj" : $(SOURCE) $(DEP_CPP_LOGPAT) "$(INTDIR)"\
1005 "$(INTDIR)\klog.pch"
1006
1007
1008!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
1009
1010
1011"$(INTDIR)\LogPatternUnix.obj" : $(SOURCE) $(DEP_CPP_LOGPAT) "$(INTDIR)"\
1012 "$(INTDIR)\klog.pch"
1013
1014
1015!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
1016
1017
1018"$(INTDIR)\LogPatternUnix.obj" : $(SOURCE) $(DEP_CPP_LOGPAT) "$(INTDIR)"\
1019 "$(INTDIR)\klog.pch"
1020
1021
1022!ENDIF
1023
1024# End Source File
1025################################################################################
1026# Begin Source File
1027
1028SOURCE=.\LogPatternReserved.cpp
1029DEP_CPP_LOGPATT=\
1030 ".\KLog.h"\
1031 ".\LogPattern.h"\
1032 ".\LogPatternReserved.h"\
1033 ".\stdafx.h"\
1034 ".\SyslogSocket.h"\
1035
1036
1037!IF "$(CFG)" == "KLog - Win32 Release"
1038
1039
1040"$(INTDIR)\LogPatternReserved.obj" : $(SOURCE) $(DEP_CPP_LOGPATT) "$(INTDIR)"\
1041 "$(INTDIR)\klog.pch"
1042
1043
1044!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
1045
1046
1047"$(INTDIR)\LogPatternReserved.obj" : $(SOURCE) $(DEP_CPP_LOGPATT) "$(INTDIR)"\
1048 "$(INTDIR)\klog.pch"
1049
1050
1051!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
1052
1053
1054"$(INTDIR)\LogPatternReserved.obj" : $(SOURCE) $(DEP_CPP_LOGPATT) "$(INTDIR)"\
1055 "$(INTDIR)\klog.pch"
1056
1057
1058!ENDIF
1059
1060# End Source File
1061################################################################################
1062# Begin Source File
1063
1064SOURCE=.\LogPatternLocal.cpp
1065DEP_CPP_LOGPATTE=\
1066 ".\KLog.h"\
1067 ".\LogPattern.h"\
1068 ".\LogPatternLocal.h"\
1069 ".\stdafx.h"\
1070 ".\SyslogSocket.h"\
1071
1072
1073!IF "$(CFG)" == "KLog - Win32 Release"
1074
1075
1076"$(INTDIR)\LogPatternLocal.obj" : $(SOURCE) $(DEP_CPP_LOGPATTE) "$(INTDIR)"\
1077 "$(INTDIR)\klog.pch"
1078
1079
1080!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
1081
1082
1083"$(INTDIR)\LogPatternLocal.obj" : $(SOURCE) $(DEP_CPP_LOGPATTE) "$(INTDIR)"\
1084 "$(INTDIR)\klog.pch"
1085
1086
1087!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
1088
1089
1090"$(INTDIR)\LogPatternLocal.obj" : $(SOURCE) $(DEP_CPP_LOGPATTE) "$(INTDIR)"\
1091 "$(INTDIR)\klog.pch"
1092
1093
1094!ENDIF
1095
1096# End Source File
1097################################################################################
1098# Begin Source File
1099
1100SOURCE=.\WarnBlocking.cpp
1101DEP_CPP_WARNB=\
1102 ".\KLog.h"\
1103 ".\stdafx.h"\
1104 ".\WarnBlocking.h"\
1105
1106
1107!IF "$(CFG)" == "KLog - Win32 Release"
1108
1109
1110"$(INTDIR)\WarnBlocking.obj" : $(SOURCE) $(DEP_CPP_WARNB) "$(INTDIR)"\
1111 "$(INTDIR)\klog.pch"
1112
1113
1114!ELSEIF "$(CFG)" == "KLog - Win32 Debug"
1115
1116
1117"$(INTDIR)\WarnBlocking.obj" : $(SOURCE) $(DEP_CPP_WARNB) "$(INTDIR)"\
1118 "$(INTDIR)\klog.pch"
1119
1120
1121!ELSEIF "$(CFG)" == "KLog - Win32 Static Release"
1122
1123
1124"$(INTDIR)\WarnBlocking.obj" : $(SOURCE) $(DEP_CPP_WARNB) "$(INTDIR)"\
1125 "$(INTDIR)\klog.pch"
1126
1127
1128!ENDIF
1129
1130# End Source File
1131# End Target
1132################################################################################
1133# Begin Target
1134
1135# Name "Install - Win32 Debug"
1136# Name "Install - Win32 Pure"
1137# Name "Install - Win32 Canned"
1138# Name "Install - Win32 Static"
1139
1140!IF "$(CFG)" == "Install - Win32 Debug"
1141
1142!ELSEIF "$(CFG)" == "Install - Win32 Pure"
1143
1144!ELSEIF "$(CFG)" == "Install - Win32 Canned"
1145
1146!ELSEIF "$(CFG)" == "Install - Win32 Static"
1147
1148!ENDIF
1149
1150################################################################################
1151# Begin Source File
1152
1153SOURCE=.\Install\Install.rc
1154DEP_RSC_INSTA=\
1155 ".\Install\custom.rch"\
1156 ".\shared-data\install-icon.ico"\
1157
1158
1159!IF "$(CFG)" == "Install - Win32 Debug"
1160
1161
1162"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
1163 $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "_DEBUG" /d\
1164 "_AFXDLL" $(SOURCE)
1165
1166
1167!ELSEIF "$(CFG)" == "Install - Win32 Pure"
1168
1169
1170"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
1171 $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG" /d\
1172 "_AFXDLL" $(SOURCE)
1173
1174
1175!ELSEIF "$(CFG)" == "Install - Win32 Canned"
1176
1177
1178"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
1179 $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG" /d\
1180 "_AFXDLL" /d "K_ANNED" $(SOURCE)
1181
1182
1183!ELSEIF "$(CFG)" == "Install - Win32 Static"
1184
1185
1186"$(INTDIR)\Install.res" : $(SOURCE) $(DEP_RSC_INSTA) "$(INTDIR)"
1187 $(RSC) /l 0x409 /fo"$(INTDIR)/Install.res" /i "Install" /d "NDEBUG" /d\
1188 "_AFXDLL" /d "STATI_K" $(SOURCE)
1189
1190
1191!ENDIF
1192
1193# End Source File
1194################################################################################
1195# Begin Source File
1196
1197SOURCE=.\Install\install.cpp
1198DEP_CPP_INSTAL=\
1199 ".\shared-code\install.h"\
1200
1201
1202!IF "$(CFG)" == "Install - Win32 Debug"
1203
1204
1205"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
1206 $(CPP) $(CPP_PROJ) $(SOURCE)
1207
1208
1209!ELSEIF "$(CFG)" == "Install - Win32 Pure"
1210
1211
1212"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
1213 $(CPP) $(CPP_PROJ) $(SOURCE)
1214
1215
1216!ELSEIF "$(CFG)" == "Install - Win32 Canned"
1217
1218
1219"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
1220 $(CPP) $(CPP_PROJ) $(SOURCE)
1221
1222
1223!ELSEIF "$(CFG)" == "Install - Win32 Static"
1224
1225
1226"$(INTDIR)\install.obj" : $(SOURCE) $(DEP_CPP_INSTAL) "$(INTDIR)"
1227 $(CPP) $(CPP_PROJ) $(SOURCE)
1228
1229
1230!ENDIF
1231
1232# End Source File
1233################################################################################
1234# Begin Project Dependency
1235
1236# Project_Dep_Name "KLog"
1237
1238!IF "$(CFG)" == "Install - Win32 Debug"
1239
1240"KLog - Win32 Debug" :
1241 $(MAKE) /$(MAKEFLAGS) /F ".\klog.mak" CFG="KLog - Win32 Debug"
1242
1243!ELSEIF "$(CFG)" == "Install - Win32 Pure"
1244
1245!ELSEIF "$(CFG)" == "Install - Win32 Canned"
1246
1247!ELSEIF "$(CFG)" == "Install - Win32 Static"
1248
1249!ENDIF
1250
1251# End Project Dependency
1252# End Target
1253# End Project
1254################################################################################
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 @@
1//Microsoft Developer Studio generated resource script.
2//
3#include "resource.h"
4
5#define APSTUDIO_READONLY_SYMBOLS
6/////////////////////////////////////////////////////////////////////////////
7//
8// Generated from the TEXTINCLUDE 2 resource.
9//
10#include "afxres.h"
11
12/////////////////////////////////////////////////////////////////////////////
13#undef APSTUDIO_READONLY_SYMBOLS
14
15/////////////////////////////////////////////////////////////////////////////
16// English (U.S.) resources
17
18#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19#ifdef _WIN32
20LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21#pragma code_page(1252)
22#endif //_WIN32
23
24#ifdef APSTUDIO_INVOKED
25/////////////////////////////////////////////////////////////////////////////
26//
27// TEXTINCLUDE
28//
29
301 TEXTINCLUDE DISCARDABLE
31BEGIN
32 "resource.h\0"
33END
34
352 TEXTINCLUDE DISCARDABLE
36BEGIN
37 "#include ""afxres.h""\r\n"
38 "\0"
39END
40
413 TEXTINCLUDE DISCARDABLE
42BEGIN
43 "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
44 "#define _AFX_NO_OLE_RESOURCES\r\n"
45 "#define _AFX_NO_TRACKER_RESOURCES\r\n"
46 "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
47 "\r\n"
48 "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
49 "#ifdef _WIN32\r\n"
50 "LANGUAGE 9, 1\r\n"
51 "#pragma code_page(1252)\r\n"
52 "#endif\r\n"
53 "#include ""res\\KLog.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
54 "#include ""afxres.rc"" // Standard components\r\n"
55 "#endif\0"
56END
57
58#endif // APSTUDIO_INVOKED
59
60
61/////////////////////////////////////////////////////////////////////////////
62//
63// Icon
64//
65
66// Icon with lowest ID value placed first to ensure application icon
67// remains consistent on all systems.
68IDR_MAINFRAME ICON DISCARDABLE "res\\klog.ico"
69IDI_BROWSE ICON DISCARDABLE "shared-data/browse-icon.ico"
70IDI_PREPLAY ICON DISCARDABLE "shared-data/play-icon.ico"
71IDI_KLOG ICON DISCARDABLE "res\\klog-icon.ico"
72IDI_KLOG_TRIGGERED ICON DISCARDABLE "res\\klog-triggered-icon.ico"
73IDI_LOGPATTERN ICON DISCARDABLE "res\\log-pattern.ico"
74
75/////////////////////////////////////////////////////////////////////////////
76//
77// Dialog
78//
79
80IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 70
81STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
82CAPTION "About KLog"
83FONT 8, "MS Sans Serif"
84BEGIN
85 ICON IDR_MAINFRAME,IDC_STATIC,7,17,18,20
86 LTEXT "KLog, Version 1.00 Beta 2",IDC_STATIC,40,16,119,8,
87 SS_NOPREFIX
88 LTEXT "Copyright © 1998,2002 Klever Group",IDC_STATIC,40,31,119,8
89 DEFPUSHBUTTON "OK",IDOK,178,13,32,14,WS_GROUP
90 PUSHBUTTON "http://www.klever.net/",IDC_KLEVERNET,125,49,85,14
91END
92
93IDD_KLOG_DIALOG DIALOGEX 0, 0, 291, 286
94STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
95EXSTYLE WS_EX_CLIENTEDGE | WS_EX_CONTEXTHELP | WS_EX_APPWINDOW
96CAPTION "KLog"
97FONT 8, "MS Sans Serif", 0, 0, 0x1
98BEGIN
99 CTEXT "Short de&scription:",IDC_STATIC,11,48,78,8,SS_NOTIFY
100 EDITTEXT IDC_DESC,91,46,187,13,ES_AUTOHSCROLL,WS_EX_STATICEDGE
101 CONTROL "Log to &File",IDC_TYPE_FILE,"Button",BS_AUTORADIOBUTTON |
102 BS_PUSHLIKE | WS_GROUP,11,60,87,19,WS_EX_STATICEDGE
103 CONTROL "Log to &Host",IDC_TYPE_HOST,"Button",BS_AUTORADIOBUTTON |
104 BS_PUSHLIKE,101,60,87,19,WS_EX_STATICEDGE
105 CONTROL "&Don't Log",IDC_TYPE_NONE,"Button",BS_AUTORADIOBUTTON |
106 BS_PUSHLIKE,191,60,87,19,WS_EX_STATICEDGE
107 CTEXT "File &name:",IDC_HOSTORFILE,12,84,40,8
108 EDITTEXT IDC_HOSTFILE,56,82,201,12,ES_AUTOHSCROLL
109 PUSHBUTTON "...",IDC_BROWSE,262,82,17,13,0,WS_EX_STATICEDGE
110 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,12,99,13,1
111 LTEXT "Log data:",IDC_STATIC,27,95,31,8
112 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,60,99,218,1
113 LTEXT "Fa&cility:",IDC_STATIC,19,108,27,8
114 COMBOBOX IDC_FACILITY,48,106,85,104,CBS_DROPDOWNLIST |
115 CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
116 PUSHBUTTON "[::]",IDC_LOGPATTERN,136,106,23,12,BS_ICON | BS_CENTER |
117 BS_VCENTER | BS_NOTIFY,WS_EX_STATICEDGE
118 GROUPBOX " &Priorities: ",IDC_STATIC,162,100,92,53,BS_CENTER |
119 BS_NOTIFY,WS_EX_TRANSPARENT
120 CONTROL "emerg",IDC_EMERG,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT |
121 BS_RIGHT | BS_NOTIFY | WS_TABSTOP,169,110,36,10
122 CONTROL "alert",IDC_ALERT,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT |
123 BS_RIGHT | BS_NOTIFY | WS_TABSTOP,169,120,36,10
124 CONTROL "crit",IDC_CRIT,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT |
125 BS_RIGHT | BS_NOTIFY | WS_TABSTOP,169,130,36,10
126 CONTROL "err",IDC_ERR,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT |
127 BS_RIGHT | BS_NOTIFY | WS_TABSTOP,169,140,36,10
128 CONTROL "warn",IDC_WARNING,"Button",BS_AUTOCHECKBOX | BS_LEFT |
129 BS_NOTIFY | WS_TABSTOP,209,110,36,10
130 CONTROL "notice",IDC_NOTICE,"Button",BS_AUTOCHECKBOX | BS_LEFT |
131 BS_NOTIFY | WS_TABSTOP,209,120,36,10
132 CONTROL "info",IDC_INFO,"Button",BS_AUTOCHECKBOX | BS_LEFT |
133 BS_NOTIFY | WS_TABSTOP,209,130,36,10
134 CONTROL "debug",IDC_DEBUG,"Button",BS_AUTOCHECKBOX | BS_LEFT |
135 BS_NOTIFY | WS_TABSTOP,209,140,36,10
136 PUSHBUTTON "all",IDC_ALL,256,105,23,12,0,WS_EX_STATICEDGE
137 PUSHBUTTON "none",IDC_NONE,256,119,23,12,0,WS_EX_STATICEDGE
138 PUSHBUTTON "invert",IDC_INVERT,256,132,23,14,BS_NOTIFY,
139 WS_EX_STATICEDGE
140 LTEXT "IP:",IDC_STATIC,20,126,10,8,SS_NOTIFY
141 EDITTEXT IDC_HL_IP,43,124,65,13,ES_AUTOHSCROLL
142 LTEXT "mask:",IDC_STATIC,20,140,20,8,SS_NOTIFY
143 EDITTEXT IDC_HL_MASK,43,139,65,13,ES_AUTOHSCROLL
144 PUSHBUTTON "add",IDC_HL_ADD,111,124,30,12,BS_NOTIFY,
145 WS_EX_STATICEDGE
146 PUSHBUTTON "remove",IDC_HL_REMOVE,111,140,30,12,0,WS_EX_STATICEDGE
147 LISTBOX IDC_HOSTS,12,154,140,33,LBS_USETABSTOPS |
148 LBS_NOINTEGRALHEIGHT | NOT WS_BORDER | WS_VSCROLL |
149 WS_HSCROLL | WS_TABSTOP,WS_EX_CLIENTEDGE
150 GROUPBOX "When &triggered play:",IDC_STATIC,161,154,117,33,0,
151 WS_EX_TRANSPARENT
152 COMBOBOX IDC_SOUND,170,167,92,66,CBS_DROPDOWN | CBS_AUTOHSCROLL |
153 WS_VSCROLL | WS_TABSTOP
154 PUSHBUTTON "..",IDC_BROWSESOUND,264,160,12,12,BS_ICON | BS_CENTER |
155 BS_VCENTER | BS_NOTIFY,WS_EX_STATICEDGE
156 PUSHBUTTON "..",IDC_PLAYSOUND,264,173,12,12,BS_ICON | BS_CENTER |
157 BS_VCENTER | BS_NOTIFY,WS_EX_STATICEDGE
158 LISTBOX IDC_LOG,7,192,277,87,LBS_USETABSTOPS | LBS_NOSEL |
159 WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,WS_EX_DLGMODALFRAME |
160 WS_EX_CLIENTEDGE | WS_EX_STATICEDGE
161 PUSHBUTTON "&Add",IDC_ADD,7,7,39,18,BS_NOTIFY,WS_EX_CLIENTEDGE
162 PUSHBUTTON "&Remove",IDC_REMOVE,48,7,39,18,0,WS_EX_CLIENTEDGE
163 PUSHBUTTON "E&xit",IDC_EXIT,245,7,39,18,0,WS_EX_CLIENTEDGE
164 CONTROL "Tab1",IDC_TABS,"SysTabControl32",TCS_TOOLTIPS,7,31,277,
165 161,WS_EX_CLIENTEDGE
166 CTEXT "10",IDC_LOGLENGTH,166,11,33,12,SS_NOPREFIX | SS_NOTIFY,
167 WS_EX_DLGMODALFRAME
168 CONTROL "Spin4",IDC_LOGLENSPIN,"msctls_updown32",UDS_WRAP |
169 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
170 UDS_ARROWKEYS | UDS_NOTHOUSANDS,189,11,10,12
171 CTEXT "Log window length:",IDC_STATIC_LOGLENGTH,89,11,77,12,
172 SS_NOPREFIX | SS_NOTIFY,WS_EX_DLGMODALFRAME
173 DEFPUSHBUTTON "",IDOK,0,279,6,7,NOT WS_VISIBLE
174 PUSHBUTTON "",IDCANCEL,285,279,6,7,NOT WS_VISIBLE | WS_DISABLED
175 PUSHBUTTON "Files",IDC_FILES,204,7,39,18,BS_CENTER | BS_VCENTER |
176 BS_NOTIFY | NOT WS_TABSTOP,WS_EX_CLIENTEDGE
177END
178
179IDD_LOG_UNIX DIALOG DISCARDABLE 0, 0, 394, 143
180STYLE DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION
181CAPTION "Unix"
182FONT 8, "MS Sans Serif"
183BEGIN
184 PUSHBUTTON "emerg",IDC_EMERG_ON,7,20,25,13,BS_CENTER | BS_VCENTER |
185 BS_NOTIFY
186 PUSHBUTTON "alert",IDC_ALERT_ON,7,33,25,13,BS_CENTER | BS_VCENTER |
187 BS_NOTIFY
188 PUSHBUTTON "crit",IDC_CRIT_ON,7,46,25,13,BS_CENTER | BS_VCENTER |
189 BS_NOTIFY
190 PUSHBUTTON "err",IDC_ERR_ON,7,59,25,13,BS_CENTER | BS_VCENTER |
191 BS_NOTIFY
192 PUSHBUTTON "warn",IDC_WARN_ON,7,72,25,13,BS_CENTER | BS_VCENTER |
193 BS_NOTIFY
194 PUSHBUTTON "notice",IDC_NOTICE_ON,7,85,25,13,BS_CENTER | BS_VCENTER |
195 BS_NOTIFY
196 PUSHBUTTON "info",IDC_INFO_ON,7,98,25,13,BS_CENTER | BS_VCENTER |
197 BS_NOTIFY
198 PUSHBUTTON "debug",IDC_DEBUG_ON,7,111,25,13,BS_CENTER | BS_VCENTER |
199 BS_NOTIFY
200 PUSHBUTTON "kernel",IDC_KERNEL_ON,32,7,30,13,BS_CENTER | BS_VCENTER |
201 BS_NOTIFY
202 PUSHBUTTON "user",IDC_USER_ON,62,7,30,13,BS_CENTER | BS_VCENTER |
203 BS_NOTIFY
204 PUSHBUTTON "mail",IDC_MAIL_ON,92,7,30,13,BS_CENTER | BS_VCENTER |
205 BS_NOTIFY
206 PUSHBUTTON "daemon",IDC_DAEMON_ON,122,7,30,13,BS_CENTER |
207 BS_VCENTER | BS_NOTIFY
208 PUSHBUTTON "auth",IDC_AUTH_ON,152,7,30,13,BS_CENTER | BS_VCENTER |
209 BS_NOTIFY
210 PUSHBUTTON "syslog",IDC_SYSLOG_ON,182,7,30,13,BS_CENTER |
211 BS_VCENTER | BS_NOTIFY
212 PUSHBUTTON "lpr",IDC_LPR_ON,212,7,30,13,BS_CENTER | BS_VCENTER |
213 BS_NOTIFY
214 PUSHBUTTON "news",IDC_NEWS_ON,242,7,30,13,BS_CENTER | BS_VCENTER |
215 BS_NOTIFY
216 PUSHBUTTON "uucp",IDC_UUCP_ON,272,7,30,13,BS_CENTER | BS_VCENTER |
217 BS_NOTIFY
218 PUSHBUTTON "cron",IDC_CRON_ON,302,7,30,13,BS_CENTER | BS_VCENTER |
219 BS_NOTIFY
220 CONTROL "",IDC_KERNEL_EMERG,"Button",BS_AUTOCHECKBOX |
221 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,21,16,10
222 CONTROL "",IDC_KERNEL_ALERT,"Button",BS_AUTOCHECKBOX |
223 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,34,16,10
224 CONTROL "",IDC_KERNEL_CRIT,"Button",BS_AUTOCHECKBOX |
225 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,47,16,10
226 CONTROL "",IDC_KERNEL_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
227 BS_NOTIFY | WS_TABSTOP,39,60,16,10
228 CONTROL "",IDC_KERNEL_WARN,"Button",BS_AUTOCHECKBOX |
229 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,73,16,10
230 CONTROL "",IDC_KERNEL_NOTICE,"Button",BS_AUTOCHECKBOX |
231 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,86,16,10
232 CONTROL "",IDC_KERNEL_INFO,"Button",BS_AUTOCHECKBOX |
233 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,99,16,10
234 CONTROL "",IDC_KERNEL_DEBUG,"Button",BS_AUTOCHECKBOX |
235 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,39,112,16,10
236 CONTROL "",IDC_USER_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
237 BS_NOTIFY | WS_TABSTOP,69,21,16,10
238 CONTROL "",IDC_USER_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
239 BS_NOTIFY | WS_TABSTOP,69,34,16,10
240 CONTROL "",IDC_USER_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
241 BS_NOTIFY | WS_TABSTOP,69,47,16,10
242 CONTROL "",IDC_USER_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
243 BS_NOTIFY | WS_TABSTOP,69,60,16,10
244 CONTROL "",IDC_USER_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
245 BS_NOTIFY | WS_TABSTOP,69,73,16,10
246 CONTROL "",IDC_USER_NOTICE,"Button",BS_AUTOCHECKBOX |
247 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,69,86,16,10
248 CONTROL "",IDC_USER_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
249 BS_NOTIFY | WS_TABSTOP,69,99,16,10
250 CONTROL "",IDC_USER_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
251 BS_NOTIFY | WS_TABSTOP,69,112,16,10
252 CONTROL "",IDC_MAIL_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
253 BS_NOTIFY | WS_TABSTOP,99,21,16,10
254 CONTROL "",IDC_MAIL_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
255 BS_NOTIFY | WS_TABSTOP,99,34,16,10
256 CONTROL "",IDC_MAIL_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
257 BS_NOTIFY | WS_TABSTOP,99,47,16,10
258 CONTROL "",IDC_MAIL_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
259 BS_NOTIFY | WS_TABSTOP,99,60,16,10
260 CONTROL "",IDC_MAIL_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
261 BS_NOTIFY | WS_TABSTOP,99,73,16,10
262 CONTROL "",IDC_MAIL_NOTICE,"Button",BS_AUTOCHECKBOX |
263 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,99,86,16,10
264 CONTROL "",IDC_MAIL_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
265 BS_NOTIFY | WS_TABSTOP,99,99,16,10
266 CONTROL "",IDC_MAIL_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
267 BS_NOTIFY | WS_TABSTOP,99,112,16,10
268 CONTROL "",IDC_DAEMON_EMERG,"Button",BS_AUTOCHECKBOX |
269 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,21,16,10
270 CONTROL "",IDC_DAEMON_ALERT,"Button",BS_AUTOCHECKBOX |
271 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,34,16,10
272 CONTROL "",IDC_DAEMON_CRIT,"Button",BS_AUTOCHECKBOX |
273 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,47,16,10
274 CONTROL "",IDC_DAEMON_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
275 BS_NOTIFY | WS_TABSTOP,129,60,16,10
276 CONTROL "",IDC_DAEMON_WARN,"Button",BS_AUTOCHECKBOX |
277 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,73,16,10
278 CONTROL "",IDC_DAEMON_NOTICE,"Button",BS_AUTOCHECKBOX |
279 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,86,16,10
280 CONTROL "",IDC_DAEMON_INFO,"Button",BS_AUTOCHECKBOX |
281 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,99,16,10
282 CONTROL "",IDC_DAEMON_DEBUG,"Button",BS_AUTOCHECKBOX |
283 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,129,112,16,10
284 CONTROL "",IDC_AUTH_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
285 BS_NOTIFY | WS_TABSTOP,159,21,16,10
286 CONTROL "",IDC_AUTH_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
287 BS_NOTIFY | WS_TABSTOP,159,34,16,10
288 CONTROL "",IDC_AUTH_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
289 BS_NOTIFY | WS_TABSTOP,159,47,16,10
290 CONTROL "",IDC_AUTH_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
291 BS_NOTIFY | WS_TABSTOP,159,60,16,10
292 CONTROL "",IDC_AUTH_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
293 BS_NOTIFY | WS_TABSTOP,159,73,16,10
294 CONTROL "",IDC_AUTH_NOTICE,"Button",BS_AUTOCHECKBOX |
295 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,159,86,16,10
296 CONTROL "",IDC_AUTH_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
297 BS_NOTIFY | WS_TABSTOP,159,99,16,10
298 CONTROL "",IDC_AUTH_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
299 BS_NOTIFY | WS_TABSTOP,159,112,16,10
300 CONTROL "",IDC_SYSLOG_EMERG,"Button",BS_AUTOCHECKBOX |
301 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,21,16,10
302 CONTROL "",IDC_SYSLOG_ALERT,"Button",BS_AUTOCHECKBOX |
303 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,34,16,10
304 CONTROL "",IDC_SYSLOG_CRIT,"Button",BS_AUTOCHECKBOX |
305 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,47,16,10
306 CONTROL "",IDC_SYSLOG_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
307 BS_NOTIFY | WS_TABSTOP,189,60,16,10
308 CONTROL "",IDC_SYSLOG_WARN,"Button",BS_AUTOCHECKBOX |
309 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,73,16,10
310 CONTROL "",IDC_SYSLOG_NOTICE,"Button",BS_AUTOCHECKBOX |
311 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,86,16,10
312 CONTROL "",IDC_SYSLOG_INFO,"Button",BS_AUTOCHECKBOX |
313 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,99,16,10
314 CONTROL "",IDC_SYSLOG_DEBUG,"Button",BS_AUTOCHECKBOX |
315 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,189,112,16,10
316 CONTROL "",IDC_LPR_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
317 BS_NOTIFY | WS_TABSTOP,219,21,16,10
318 CONTROL "",IDC_LPR_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
319 BS_NOTIFY | WS_TABSTOP,219,34,16,10
320 CONTROL "",IDC_LPR_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
321 BS_NOTIFY | WS_TABSTOP,219,47,16,10
322 CONTROL "",IDC_LPR_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
323 BS_NOTIFY | WS_TABSTOP,219,60,16,10
324 CONTROL "",IDC_LPR_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
325 BS_NOTIFY | WS_TABSTOP,219,73,16,10
326 CONTROL "",IDC_LPR_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
327 BS_NOTIFY | WS_TABSTOP,219,86,16,10
328 CONTROL "",IDC_LPR_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
329 BS_NOTIFY | WS_TABSTOP,219,99,16,10
330 CONTROL "",IDC_LPR_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
331 BS_NOTIFY | WS_TABSTOP,219,112,16,10
332 CONTROL "",IDC_NEWS_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
333 BS_NOTIFY | WS_TABSTOP,249,21,16,10
334 CONTROL "",IDC_NEWS_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
335 BS_NOTIFY | WS_TABSTOP,249,34,16,10
336 CONTROL "",IDC_NEWS_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
337 BS_NOTIFY | WS_TABSTOP,249,47,16,10
338 CONTROL "",IDC_NEWS_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
339 BS_NOTIFY | WS_TABSTOP,249,60,16,10
340 CONTROL "",IDC_NEWS_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
341 BS_NOTIFY | WS_TABSTOP,249,73,16,10
342 CONTROL "",IDC_NEWS_NOTICE,"Button",BS_AUTOCHECKBOX |
343 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,249,86,16,10
344 CONTROL "",IDC_NEWS_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
345 BS_NOTIFY | WS_TABSTOP,249,99,16,10
346 CONTROL "",IDC_NEWS_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
347 BS_NOTIFY | WS_TABSTOP,249,112,16,10
348 CONTROL "",IDC_UUCP_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
349 BS_NOTIFY | WS_TABSTOP,279,21,16,10
350 CONTROL "",IDC_UUCP_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
351 BS_NOTIFY | WS_TABSTOP,279,34,16,10
352 CONTROL "",IDC_UUCP_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
353 BS_NOTIFY | WS_TABSTOP,279,47,16,10
354 CONTROL "",IDC_UUCP_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
355 BS_NOTIFY | WS_TABSTOP,279,60,16,10
356 CONTROL "",IDC_UUCP_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
357 BS_NOTIFY | WS_TABSTOP,279,73,16,10
358 CONTROL "",IDC_UUCP_NOTICE,"Button",BS_AUTOCHECKBOX |
359 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,279,86,16,10
360 CONTROL "",IDC_UUCP_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
361 BS_NOTIFY | WS_TABSTOP,279,99,16,10
362 CONTROL "",IDC_UUCP_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
363 BS_NOTIFY | WS_TABSTOP,279,112,16,10
364 CONTROL "",IDC_CRON_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
365 BS_NOTIFY | WS_TABSTOP,309,21,16,10
366 CONTROL "",IDC_CRON_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
367 BS_NOTIFY | WS_TABSTOP,309,34,16,10
368 CONTROL "",IDC_CRON_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
369 BS_NOTIFY | WS_TABSTOP,309,47,16,10
370 CONTROL "",IDC_CRON_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
371 BS_NOTIFY | WS_TABSTOP,309,60,16,10
372 CONTROL "",IDC_CRON_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
373 BS_NOTIFY | WS_TABSTOP,309,73,16,10
374 CONTROL "",IDC_CRON_NOTICE,"Button",BS_AUTOCHECKBOX |
375 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,309,86,16,10
376 CONTROL "",IDC_CRON_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
377 BS_NOTIFY | WS_TABSTOP,309,99,16,10
378 CONTROL "",IDC_CRON_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
379 BS_NOTIFY | WS_TABSTOP,309,112,16,10
380 PUSHBUTTON "emerg",IDC_EMERG_XOR,362,20,25,13,BS_CENTER |
381 BS_VCENTER | BS_NOTIFY
382 PUSHBUTTON "alert",IDC_ALERT_XOR,362,33,25,13,BS_CENTER |
383 BS_VCENTER | BS_NOTIFY
384 PUSHBUTTON "crit",IDC_CRIT_XOR,362,46,25,13,BS_CENTER | BS_VCENTER |
385 BS_NOTIFY
386 PUSHBUTTON "err",IDC_ERR_XOR,362,59,25,13,BS_CENTER | BS_VCENTER |
387 BS_NOTIFY
388 PUSHBUTTON "warn",IDC_WARN_XOR,362,72,25,13,BS_CENTER | BS_VCENTER |
389 BS_NOTIFY
390 PUSHBUTTON "notice",IDC_NOTICE_XOR,362,85,25,13,BS_CENTER |
391 BS_VCENTER | BS_NOTIFY
392 PUSHBUTTON "info",IDC_INFO_XOR,362,98,25,13,BS_CENTER | BS_VCENTER |
393 BS_NOTIFY
394 PUSHBUTTON "debug",IDC_DEBUG_XOR,362,111,25,13,BS_CENTER |
395 BS_VCENTER | BS_NOTIFY
396 PUSHBUTTON "kernel",IDC_KERNEL_XOR,32,124,30,13,BS_CENTER |
397 BS_VCENTER | BS_NOTIFY
398 PUSHBUTTON "user",IDC_USER_XOR,62,124,30,13,BS_CENTER | BS_VCENTER |
399 BS_NOTIFY
400 PUSHBUTTON "mail",IDC_MAIL_XOR,92,124,30,13,BS_CENTER | BS_VCENTER |
401 BS_NOTIFY
402 PUSHBUTTON "daemon",IDC_DAEMON_XOR,122,124,30,13,BS_CENTER |
403 BS_VCENTER | BS_NOTIFY
404 PUSHBUTTON "auth",IDC_AUTH_XOR,152,124,30,13,BS_CENTER | BS_VCENTER |
405 BS_NOTIFY
406 PUSHBUTTON "syslog",IDC_SYSLOG_XOR,182,124,30,13,BS_CENTER |
407 BS_VCENTER | BS_NOTIFY
408 PUSHBUTTON "lpr",IDC_LPR_XOR,212,124,30,13,BS_CENTER | BS_VCENTER |
409 BS_NOTIFY
410 PUSHBUTTON "news",IDC_NEWS_XOR,242,124,30,13,BS_CENTER | BS_VCENTER |
411 BS_NOTIFY
412 PUSHBUTTON "uucp",IDC_UUCP_XOR,272,124,30,13,BS_CENTER | BS_VCENTER |
413 BS_NOTIFY
414 PUSHBUTTON "cron",IDC_CRON_XOR,302,124,30,13,BS_CENTER | BS_VCENTER |
415 BS_NOTIFY
416 LTEXT "Toggle",IDC_STATIC,363,126,23,8
417 LTEXT "ON",IDC_STATIC,14,9,12,8
418 PUSHBUTTON "authpriv",IDC_AUTHPRIV_ON,332,7,30,13,BS_CENTER |
419 BS_VCENTER | BS_NOTIFY
420 CONTROL "",IDC_AUTHPRIV_EMERG,"Button",BS_AUTOCHECKBOX |
421 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,21,16,10
422 CONTROL "",IDC_AUTHPRIV_ALERT,"Button",BS_AUTOCHECKBOX |
423 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,34,16,10
424 CONTROL "",IDC_AUTHPRIV_CRIT,"Button",BS_AUTOCHECKBOX |
425 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,47,16,10
426 CONTROL "",IDC_AUTHPRIV_ERR,"Button",BS_AUTOCHECKBOX |
427 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,61,16,10
428 CONTROL "",IDC_AUTHPRIV_WARN,"Button",BS_AUTOCHECKBOX |
429 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,74,16,10
430 CONTROL "",IDC_AUTHPRIV_NOTICE,"Button",BS_AUTOCHECKBOX |
431 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,87,16,10
432 CONTROL "",IDC_AUTHPRIV_INFO,"Button",BS_AUTOCHECKBOX |
433 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,99,16,10
434 CONTROL "",IDC_AUTHPRIV_DEBUG,"Button",BS_AUTOCHECKBOX |
435 BS_PUSHLIKE | BS_NOTIFY | WS_TABSTOP,339,112,16,10
436 PUSHBUTTON "authpriv",IDC_AUTHPRIV_XOR,332,124,30,13,BS_CENTER |
437 BS_VCENTER | BS_NOTIFY
438END
439
440IDD_LOG_RESERVED DIALOG DISCARDABLE 0, 0, 394, 143
441STYLE DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION
442CAPTION "Reserved"
443FONT 8, "MS Sans Serif"
444BEGIN
445 PUSHBUTTON "emerg",IDC_EMERG_ON,96,20,25,13,BS_CENTER | BS_VCENTER |
446 BS_NOTIFY
447 PUSHBUTTON "alert",IDC_ALERT_ON,96,33,25,13,BS_CENTER | BS_VCENTER |
448 BS_NOTIFY
449 PUSHBUTTON "crit",IDC_CRIT_ON,96,46,25,13,BS_CENTER | BS_VCENTER |
450 BS_NOTIFY
451 PUSHBUTTON "err",IDC_ERR_ON,96,59,25,13,BS_CENTER | BS_VCENTER |
452 BS_NOTIFY
453 PUSHBUTTON "warn",IDC_WARN_ON,96,72,25,13,BS_CENTER | BS_VCENTER |
454 BS_NOTIFY
455 PUSHBUTTON "notice",IDC_NOTICE_ON,96,85,25,13,BS_CENTER |
456 BS_VCENTER | BS_NOTIFY
457 PUSHBUTTON "info",IDC_INFO_ON,96,98,25,13,BS_CENTER | BS_VCENTER |
458 BS_NOTIFY
459 PUSHBUTTON "debug",IDC_DEBUG_ON,96,111,25,13,BS_CENTER | BS_VCENTER |
460 BS_NOTIFY
461 PUSHBUTTON "0",IDC_R0_ON,121,7,30,13,BS_CENTER | BS_VCENTER |
462 BS_NOTIFY
463 PUSHBUTTON "1",IDC_R1_ON,151,7,30,13,BS_CENTER | BS_VCENTER |
464 BS_NOTIFY
465 PUSHBUTTON "2",IDC_R2_ON,181,7,30,13,BS_CENTER | BS_VCENTER |
466 BS_NOTIFY
467 PUSHBUTTON "3",IDC_R3_ON,211,7,30,13,BS_CENTER | BS_VCENTER |
468 BS_NOTIFY
469 PUSHBUTTON "4",IDC_R4_ON,241,7,30,13,BS_CENTER | BS_VCENTER |
470 BS_NOTIFY
471 CONTROL "",IDC_R0_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
472 BS_NOTIFY | WS_TABSTOP,128,21,16,10
473 CONTROL "",IDC_R0_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
474 BS_NOTIFY | WS_TABSTOP,128,34,16,10
475 CONTROL "",IDC_R0_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
476 BS_NOTIFY | WS_TABSTOP,128,47,16,10
477 CONTROL "",IDC_R0_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
478 BS_NOTIFY | WS_TABSTOP,128,60,16,10
479 CONTROL "",IDC_R0_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
480 BS_NOTIFY | WS_TABSTOP,128,73,16,10
481 CONTROL "",IDC_R0_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
482 BS_NOTIFY | WS_TABSTOP,128,86,16,10
483 CONTROL "",IDC_R0_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
484 BS_NOTIFY | WS_TABSTOP,128,99,16,10
485 CONTROL "",IDC_R0_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
486 BS_NOTIFY | WS_TABSTOP,128,112,16,10
487 CONTROL "",IDC_R1_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
488 BS_NOTIFY | WS_TABSTOP,158,21,16,10
489 CONTROL "",IDC_R1_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
490 BS_NOTIFY | WS_TABSTOP,158,34,16,10
491 CONTROL "",IDC_R1_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
492 BS_NOTIFY | WS_TABSTOP,158,47,16,10
493 CONTROL "",IDC_R1_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
494 BS_NOTIFY | WS_TABSTOP,158,60,16,10
495 CONTROL "",IDC_R1_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
496 BS_NOTIFY | WS_TABSTOP,158,73,16,10
497 CONTROL "",IDC_R1_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
498 BS_NOTIFY | WS_TABSTOP,158,86,16,10
499 CONTROL "",IDC_R1_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
500 BS_NOTIFY | WS_TABSTOP,158,99,16,10
501 CONTROL "",IDC_R1_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
502 BS_NOTIFY | WS_TABSTOP,158,112,16,10
503 CONTROL "",IDC_R2_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
504 BS_NOTIFY | WS_TABSTOP,188,21,16,10
505 CONTROL "",IDC_R2_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
506 BS_NOTIFY | WS_TABSTOP,188,34,16,10
507 CONTROL "",IDC_R2_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
508 BS_NOTIFY | WS_TABSTOP,188,47,16,10
509 CONTROL "",IDC_R2_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
510 BS_NOTIFY | WS_TABSTOP,188,60,16,10
511 CONTROL "",IDC_R2_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
512 BS_NOTIFY | WS_TABSTOP,188,73,16,10
513 CONTROL "",IDC_R2_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
514 BS_NOTIFY | WS_TABSTOP,188,86,16,10
515 CONTROL "",IDC_R2_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
516 BS_NOTIFY | WS_TABSTOP,188,99,16,10
517 CONTROL "",IDC_R2_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
518 BS_NOTIFY | WS_TABSTOP,188,112,16,10
519 CONTROL "",IDC_R3_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
520 BS_NOTIFY | WS_TABSTOP,218,21,16,10
521 CONTROL "",IDC_R3_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
522 BS_NOTIFY | WS_TABSTOP,218,34,16,10
523 CONTROL "",IDC_R3_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
524 BS_NOTIFY | WS_TABSTOP,218,47,16,10
525 CONTROL "",IDC_R3_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
526 BS_NOTIFY | WS_TABSTOP,218,60,16,10
527 CONTROL "",IDC_R3_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
528 BS_NOTIFY | WS_TABSTOP,218,73,16,10
529 CONTROL "",IDC_R3_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
530 BS_NOTIFY | WS_TABSTOP,218,86,16,10
531 CONTROL "",IDC_R3_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
532 BS_NOTIFY | WS_TABSTOP,218,99,16,10
533 CONTROL "",IDC_R3_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
534 BS_NOTIFY | WS_TABSTOP,218,112,16,10
535 CONTROL "",IDC_R4_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
536 BS_NOTIFY | WS_TABSTOP,248,21,16,10
537 CONTROL "",IDC_R4_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
538 BS_NOTIFY | WS_TABSTOP,248,34,16,10
539 CONTROL "",IDC_R4_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
540 BS_NOTIFY | WS_TABSTOP,248,47,16,10
541 CONTROL "",IDC_R4_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
542 BS_NOTIFY | WS_TABSTOP,248,60,16,10
543 CONTROL "",IDC_R4_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
544 BS_NOTIFY | WS_TABSTOP,248,73,16,10
545 CONTROL "",IDC_R4_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
546 BS_NOTIFY | WS_TABSTOP,248,86,16,10
547 CONTROL "",IDC_R4_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
548 BS_NOTIFY | WS_TABSTOP,248,99,16,10
549 CONTROL "",IDC_R4_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
550 BS_NOTIFY | WS_TABSTOP,248,112,16,10
551 PUSHBUTTON "emerg",IDC_EMERG_XOR,271,20,25,13,BS_CENTER |
552 BS_VCENTER | BS_NOTIFY
553 PUSHBUTTON "alert",IDC_ALERT_XOR,271,33,25,13,BS_CENTER |
554 BS_VCENTER | BS_NOTIFY
555 PUSHBUTTON "crit",IDC_CRIT_XOR,271,46,25,13,BS_CENTER | BS_VCENTER |
556 BS_NOTIFY
557 PUSHBUTTON "err",IDC_ERR_XOR,271,59,25,13,BS_CENTER | BS_VCENTER |
558 BS_NOTIFY
559 PUSHBUTTON "warn",IDC_WARN_XOR,271,72,25,13,BS_CENTER | BS_VCENTER |
560 BS_NOTIFY
561 PUSHBUTTON "notice",IDC_NOTICE_XOR,271,85,25,13,BS_CENTER |
562 BS_VCENTER | BS_NOTIFY
563 PUSHBUTTON "info",IDC_INFO_XOR,271,98,25,13,BS_CENTER | BS_VCENTER |
564 BS_NOTIFY
565 PUSHBUTTON "debug",IDC_DEBUG_XOR,271,111,25,13,BS_CENTER |
566 BS_VCENTER | BS_NOTIFY
567 PUSHBUTTON "0",IDC_R0_XOR,121,124,30,13,BS_CENTER | BS_VCENTER |
568 BS_NOTIFY
569 PUSHBUTTON "1",IDC_R1_XOR,151,124,30,13,BS_CENTER | BS_VCENTER |
570 BS_NOTIFY
571 PUSHBUTTON "2",IDC_R2_XOR,181,124,30,13,BS_CENTER | BS_VCENTER |
572 BS_NOTIFY
573 PUSHBUTTON "3",IDC_R3_XOR,211,124,30,13,BS_CENTER | BS_VCENTER |
574 BS_NOTIFY
575 PUSHBUTTON "4",IDC_R4_XOR,241,124,30,13,BS_CENTER | BS_VCENTER |
576 BS_NOTIFY
577 LTEXT "Toggle",IDC_STATIC,272,126,23,8
578 LTEXT "ON",IDC_STATIC,103,9,12,8
579END
580
581IDD_LOG_LOCAL DIALOG DISCARDABLE 0, 0, 394, 143
582STYLE DS_3DLOOK | WS_CHILD | WS_DISABLED | WS_CAPTION
583CAPTION "Local"
584FONT 8, "MS Sans Serif"
585BEGIN
586 PUSHBUTTON "emerg",IDC_EMERG_ON,51,20,25,13,BS_CENTER | BS_VCENTER |
587 BS_NOTIFY
588 PUSHBUTTON "alert",IDC_ALERT_ON,51,33,25,13,BS_CENTER | BS_VCENTER |
589 BS_NOTIFY
590 PUSHBUTTON "crit",IDC_CRIT_ON,51,46,25,13,BS_CENTER | BS_VCENTER |
591 BS_NOTIFY
592 PUSHBUTTON "err",IDC_ERR_ON,51,59,25,13,BS_CENTER | BS_VCENTER |
593 BS_NOTIFY
594 PUSHBUTTON "warn",IDC_WARN_ON,51,72,25,13,BS_CENTER | BS_VCENTER |
595 BS_NOTIFY
596 PUSHBUTTON "notice",IDC_NOTICE_ON,51,85,25,13,BS_CENTER |
597 BS_VCENTER | BS_NOTIFY
598 PUSHBUTTON "info",IDC_INFO_ON,51,98,25,13,BS_CENTER | BS_VCENTER |
599 BS_NOTIFY
600 PUSHBUTTON "debug",IDC_DEBUG_ON,51,111,25,13,BS_CENTER | BS_VCENTER |
601 BS_NOTIFY
602 PUSHBUTTON "0",IDC_L0_ON,76,7,30,13,BS_CENTER | BS_VCENTER |
603 BS_NOTIFY
604 PUSHBUTTON "1",IDC_L1_ON,106,7,30,13,BS_CENTER | BS_VCENTER |
605 BS_NOTIFY
606 PUSHBUTTON "2",IDC_L2_ON,136,7,30,13,BS_CENTER | BS_VCENTER |
607 BS_NOTIFY
608 PUSHBUTTON "3",IDC_L3_ON,166,7,30,13,BS_CENTER | BS_VCENTER |
609 BS_NOTIFY
610 PUSHBUTTON "4",IDC_L4_ON,196,7,30,13,BS_CENTER | BS_VCENTER |
611 BS_NOTIFY
612 PUSHBUTTON "5",IDC_L5_ON,226,7,30,13,BS_CENTER | BS_VCENTER |
613 BS_NOTIFY
614 PUSHBUTTON "6",IDC_L6_ON,256,7,30,13,BS_CENTER | BS_VCENTER |
615 BS_NOTIFY
616 PUSHBUTTON "7",IDC_L7_ON,286,7,30,13,BS_CENTER | BS_VCENTER |
617 BS_NOTIFY
618 CONTROL "",IDC_L0_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
619 BS_NOTIFY | WS_TABSTOP,83,21,16,10
620 CONTROL "",IDC_L0_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
621 BS_NOTIFY | WS_TABSTOP,83,34,16,10
622 CONTROL "",IDC_L0_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
623 BS_NOTIFY | WS_TABSTOP,83,47,16,10
624 CONTROL "",IDC_L0_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
625 BS_NOTIFY | WS_TABSTOP,83,60,16,10
626 CONTROL "",IDC_L0_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
627 BS_NOTIFY | WS_TABSTOP,83,73,16,10
628 CONTROL "",IDC_L0_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
629 BS_NOTIFY | WS_TABSTOP,83,86,16,10
630 CONTROL "",IDC_L0_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
631 BS_NOTIFY | WS_TABSTOP,83,99,16,10
632 CONTROL "",IDC_L0_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
633 BS_NOTIFY | WS_TABSTOP,83,112,16,10
634 CONTROL "",IDC_L1_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
635 BS_NOTIFY | WS_TABSTOP,113,21,16,10
636 CONTROL "",IDC_L1_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
637 BS_NOTIFY | WS_TABSTOP,113,34,16,10
638 CONTROL "",IDC_L1_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
639 BS_NOTIFY | WS_TABSTOP,113,47,16,10
640 CONTROL "",IDC_L1_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
641 BS_NOTIFY | WS_TABSTOP,113,60,16,10
642 CONTROL "",IDC_L1_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
643 BS_NOTIFY | WS_TABSTOP,113,73,16,10
644 CONTROL "",IDC_L1_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
645 BS_NOTIFY | WS_TABSTOP,113,86,16,10
646 CONTROL "",IDC_L1_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
647 BS_NOTIFY | WS_TABSTOP,113,99,16,10
648 CONTROL "",IDC_L1_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
649 BS_NOTIFY | WS_TABSTOP,113,112,16,10
650 CONTROL "",IDC_L2_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
651 BS_NOTIFY | WS_TABSTOP,143,21,16,10
652 CONTROL "",IDC_L2_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
653 BS_NOTIFY | WS_TABSTOP,143,34,16,10
654 CONTROL "",IDC_L2_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
655 BS_NOTIFY | WS_TABSTOP,143,47,16,10
656 CONTROL "",IDC_L2_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
657 BS_NOTIFY | WS_TABSTOP,143,60,16,10
658 CONTROL "",IDC_L2_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
659 BS_NOTIFY | WS_TABSTOP,143,73,16,10
660 CONTROL "",IDC_L2_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
661 BS_NOTIFY | WS_TABSTOP,143,86,16,10
662 CONTROL "",IDC_L2_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
663 BS_NOTIFY | WS_TABSTOP,143,99,16,10
664 CONTROL "",IDC_L2_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
665 BS_NOTIFY | WS_TABSTOP,143,112,16,10
666 CONTROL "",IDC_L3_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
667 BS_NOTIFY | WS_TABSTOP,173,21,16,10
668 CONTROL "",IDC_L3_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
669 BS_NOTIFY | WS_TABSTOP,173,34,16,10
670 CONTROL "",IDC_L3_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
671 BS_NOTIFY | WS_TABSTOP,173,47,16,10
672 CONTROL "",IDC_L3_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
673 BS_NOTIFY | WS_TABSTOP,173,60,16,10
674 CONTROL "",IDC_L3_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
675 BS_NOTIFY | WS_TABSTOP,173,73,16,10
676 CONTROL "",IDC_L3_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
677 BS_NOTIFY | WS_TABSTOP,173,86,16,10
678 CONTROL "",IDC_L3_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
679 BS_NOTIFY | WS_TABSTOP,173,99,16,10
680 CONTROL "",IDC_L3_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
681 BS_NOTIFY | WS_TABSTOP,173,112,16,10
682 CONTROL "",IDC_L4_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
683 BS_NOTIFY | WS_TABSTOP,203,21,16,10
684 CONTROL "",IDC_L4_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
685 BS_NOTIFY | WS_TABSTOP,203,34,16,10
686 CONTROL "",IDC_L4_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
687 BS_NOTIFY | WS_TABSTOP,203,47,16,10
688 CONTROL "",IDC_L4_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
689 BS_NOTIFY | WS_TABSTOP,203,60,16,10
690 CONTROL "",IDC_L4_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
691 BS_NOTIFY | WS_TABSTOP,203,73,16,10
692 CONTROL "",IDC_L4_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
693 BS_NOTIFY | WS_TABSTOP,203,86,16,10
694 CONTROL "",IDC_L4_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
695 BS_NOTIFY | WS_TABSTOP,203,99,16,10
696 CONTROL "",IDC_L4_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
697 BS_NOTIFY | WS_TABSTOP,203,112,16,10
698 CONTROL "",IDC_L5_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
699 BS_NOTIFY | WS_TABSTOP,233,21,16,10
700 CONTROL "",IDC_L5_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
701 BS_NOTIFY | WS_TABSTOP,233,34,16,10
702 CONTROL "",IDC_L5_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
703 BS_NOTIFY | WS_TABSTOP,233,47,16,10
704 CONTROL "",IDC_L5_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
705 BS_NOTIFY | WS_TABSTOP,233,60,16,10
706 CONTROL "",IDC_L5_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
707 BS_NOTIFY | WS_TABSTOP,233,73,16,10
708 CONTROL "",IDC_L5_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
709 BS_NOTIFY | WS_TABSTOP,233,86,16,10
710 CONTROL "",IDC_L5_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
711 BS_NOTIFY | WS_TABSTOP,233,99,16,10
712 CONTROL "",IDC_L5_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
713 BS_NOTIFY | WS_TABSTOP,233,112,16,10
714 CONTROL "",IDC_L6_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
715 BS_NOTIFY | WS_TABSTOP,263,21,16,10
716 CONTROL "",IDC_L6_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
717 BS_NOTIFY | WS_TABSTOP,263,34,16,10
718 CONTROL "",IDC_L6_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
719 BS_NOTIFY | WS_TABSTOP,263,47,16,10
720 CONTROL "",IDC_L6_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
721 BS_NOTIFY | WS_TABSTOP,263,60,16,10
722 CONTROL "",IDC_L6_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
723 BS_NOTIFY | WS_TABSTOP,263,73,16,10
724 CONTROL "",IDC_L6_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
725 BS_NOTIFY | WS_TABSTOP,263,86,16,10
726 CONTROL "",IDC_L6_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
727 BS_NOTIFY | WS_TABSTOP,263,99,16,10
728 CONTROL "",IDC_L6_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
729 BS_NOTIFY | WS_TABSTOP,263,112,16,10
730 CONTROL "",IDC_L7_EMERG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
731 BS_NOTIFY | WS_TABSTOP,293,21,16,10
732 CONTROL "",IDC_L7_ALERT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
733 BS_NOTIFY | WS_TABSTOP,293,34,16,10
734 CONTROL "",IDC_L7_CRIT,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
735 BS_NOTIFY | WS_TABSTOP,293,47,16,10
736 CONTROL "",IDC_L7_ERR,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
737 BS_NOTIFY | WS_TABSTOP,293,60,16,10
738 CONTROL "",IDC_L7_WARN,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
739 BS_NOTIFY | WS_TABSTOP,293,73,16,10
740 CONTROL "",IDC_L7_NOTICE,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
741 BS_NOTIFY | WS_TABSTOP,293,86,16,10
742 CONTROL "",IDC_L7_INFO,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
743 BS_NOTIFY | WS_TABSTOP,293,99,16,10
744 CONTROL "",IDC_L7_DEBUG,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE |
745 BS_NOTIFY | WS_TABSTOP,293,112,16,10
746 PUSHBUTTON "emerg",IDC_EMERG_XOR,316,20,25,13,BS_CENTER |
747 BS_VCENTER | BS_NOTIFY
748 PUSHBUTTON "alert",IDC_ALERT_XOR,316,33,25,13,BS_CENTER |
749 BS_VCENTER | BS_NOTIFY
750 PUSHBUTTON "crit",IDC_CRIT_XOR,316,46,25,13,BS_CENTER | BS_VCENTER |
751 BS_NOTIFY
752 PUSHBUTTON "err",IDC_ERR_XOR,316,59,25,13,BS_CENTER | BS_VCENTER |
753 BS_NOTIFY
754 PUSHBUTTON "warn",IDC_WARN_XOR,316,72,25,13,BS_CENTER | BS_VCENTER |
755 BS_NOTIFY
756 PUSHBUTTON "notice",IDC_NOTICE_XOR,316,85,25,13,BS_CENTER |
757 BS_VCENTER | BS_NOTIFY
758 PUSHBUTTON "info",IDC_INFO_XOR,316,98,25,13,BS_CENTER | BS_VCENTER |
759 BS_NOTIFY
760 PUSHBUTTON "debug",IDC_DEBUG_XOR,316,111,25,13,BS_CENTER |
761 BS_VCENTER | BS_NOTIFY
762 PUSHBUTTON "0",IDC_L0_XOR,76,124,30,13,BS_CENTER | BS_VCENTER |
763 BS_NOTIFY
764 PUSHBUTTON "1",IDC_L1_XOR,106,124,30,13,BS_CENTER | BS_VCENTER |
765 BS_NOTIFY
766 PUSHBUTTON "2",IDC_L2_XOR,136,124,30,13,BS_CENTER | BS_VCENTER |
767 BS_NOTIFY
768 PUSHBUTTON "3",IDC_L3_XOR,166,124,30,13,BS_CENTER | BS_VCENTER |
769 BS_NOTIFY
770 PUSHBUTTON "4",IDC_L4_XOR,196,124,30,13,BS_CENTER | BS_VCENTER |
771 BS_NOTIFY
772 PUSHBUTTON "5",IDC_L5_XOR,226,124,30,13,BS_CENTER | BS_VCENTER |
773 BS_NOTIFY
774 PUSHBUTTON "6",IDC_L6_XOR,256,124,30,13,BS_CENTER | BS_VCENTER |
775 BS_NOTIFY
776 PUSHBUTTON "7",IDC_L7_XOR,286,124,30,13,BS_CENTER | BS_VCENTER |
777 BS_NOTIFY
778 LTEXT "Toggle",IDC_STATIC,317,126,23,8
779 LTEXT "ON",IDC_STATIC,58,9,12,8
780END
781
782IDD_WARNBLOCKING DIALOGEX 0, 0, 195, 88
783STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_CAPTION
784EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
785CAPTION " Blocking call warning"
786FONT 8, "MS Sans Serif", 0, 0, 0x1
787BEGIN
788 DEFPUSHBUTTON "OK",IDOK,39,67,50,14
789 PUSHBUTTON "Cancel",IDCANCEL,105,67,50,14
790 LTEXT "WARNING: ",IDC_STATIC,7,7,38,8
791 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.",
792 IDC_STATIC,46,7,142,35
793 CONTROL "Enough is said, no need to remind me again. Thanks.",
794 IDC_WARNBLOCKING,"Button",BS_AUTOCHECKBOX | BS_RIGHT |
795 BS_VCENTER | BS_MULTILINE | WS_TABSTOP,7,42,123,22,
796 WS_EX_STATICEDGE
797END
798
799
800#ifndef _MAC
801/////////////////////////////////////////////////////////////////////////////
802//
803// Version
804//
805
806VS_VERSION_INFO VERSIONINFO
807 FILEVERSION 1,0,0,2
808 PRODUCTVERSION 1,0,0,2
809 FILEFLAGSMASK 0x3fL
810#ifdef _DEBUG
811 FILEFLAGS 0x1L
812#else
813 FILEFLAGS 0x0L
814#endif
815 FILEOS 0x4L
816 FILETYPE 0x1L
817 FILESUBTYPE 0x0L
818BEGIN
819 BLOCK "StringFileInfo"
820 BEGIN
821 BLOCK "040904b0"
822 BEGIN
823 VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
824 VALUE "FileDescription", "KLog, logging daemon\0"
825 VALUE "FileVersion", "1, 0, 0, 2\0"
826 VALUE "InternalName", "KLOG\0"
827 VALUE "LegalCopyright", "Copyright © 1998, 2002 Klever Group (http://www.klever.net/)\0"
828 VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
829 VALUE "OriginalFilename", "KLOG.EXE\0"
830 VALUE "ProductName", "KLog\0"
831 VALUE "ProductVersion", "1, 0, 0, 2\0"
832 END
833 END
834 BLOCK "VarFileInfo"
835 BEGIN
836 VALUE "Translation", 0x409, 1200
837 END
838END
839
840#endif // !_MAC
841
842
843/////////////////////////////////////////////////////////////////////////////
844//
845// DESIGNINFO
846//
847
848#ifdef APSTUDIO_INVOKED
849GUIDELINES DESIGNINFO DISCARDABLE
850BEGIN
851 IDD_ABOUTBOX, DIALOG
852 BEGIN
853 LEFTMARGIN, 7
854 RIGHTMARGIN, 210
855 TOPMARGIN, 7
856 BOTTOMMARGIN, 63
857 END
858
859 IDD_KLOG_DIALOG, DIALOG
860 BEGIN
861 LEFTMARGIN, 7
862 RIGHTMARGIN, 284
863 VERTGUIDE, 12
864 VERTGUIDE, 278
865 TOPMARGIN, 7
866 BOTTOMMARGIN, 279
867 HORZGUIDE, 31
868 HORZGUIDE, 192
869 END
870
871 IDD_LOG_UNIX, DIALOG
872 BEGIN
873 LEFTMARGIN, 7
874 RIGHTMARGIN, 387
875 VERTGUIDE, 32
876 VERTGUIDE, 362
877 TOPMARGIN, 7
878 BOTTOMMARGIN, 136
879 HORZGUIDE, 20
880 HORZGUIDE, 124
881 END
882
883 IDD_LOG_RESERVED, DIALOG
884 BEGIN
885 LEFTMARGIN, 7
886 RIGHTMARGIN, 387
887 VERTGUIDE, 96
888 VERTGUIDE, 121
889 VERTGUIDE, 271
890 VERTGUIDE, 296
891 TOPMARGIN, 7
892 BOTTOMMARGIN, 136
893 HORZGUIDE, 20
894 HORZGUIDE, 124
895 END
896
897 IDD_LOG_LOCAL, DIALOG
898 BEGIN
899 LEFTMARGIN, 7
900 RIGHTMARGIN, 387
901 VERTGUIDE, 51
902 VERTGUIDE, 76
903 VERTGUIDE, 316
904 VERTGUIDE, 341
905 TOPMARGIN, 7
906 BOTTOMMARGIN, 136
907 HORZGUIDE, 20
908 HORZGUIDE, 124
909 END
910
911 IDD_WARNBLOCKING, DIALOG
912 BEGIN
913 LEFTMARGIN, 7
914 RIGHTMARGIN, 188
915 VERTGUIDE, 130
916 TOPMARGIN, 7
917 BOTTOMMARGIN, 81
918 END
919END
920#endif // APSTUDIO_INVOKED
921
922
923/////////////////////////////////////////////////////////////////////////////
924//
925// Dialog Info
926//
927
928IDD_KLOG_DIALOG DLGINIT
929BEGIN
930 IDC_FACILITY, 0x403, 7, 0
9310x656b, 0x6e72, 0x6c65, "\000"
932 IDC_FACILITY, 0x403, 5, 0
9330x7375, 0x7265, "\000"
934 IDC_FACILITY, 0x403, 5, 0
9350x616d, 0x6c69, "\000"
936 IDC_FACILITY, 0x403, 7, 0
9370x6164, 0x6d65, 0x6e6f, "\000"
938 IDC_FACILITY, 0x403, 5, 0
9390x7561, 0x6874, "\000"
940 IDC_FACILITY, 0x403, 7, 0
9410x7973, 0x6c73, 0x676f, "\000"
942 IDC_FACILITY, 0x403, 4, 0
9430x706c, 0x0072,
944 IDC_FACILITY, 0x403, 5, 0
9450x656e, 0x7377, "\000"
946 IDC_FACILITY, 0x403, 5, 0
9470x7575, 0x7063, "\000"
948 IDC_FACILITY, 0x403, 5, 0
9490x7263, 0x6e6f, "\000"
950 IDC_FACILITY, 0x403, 9, 0
9510x7561, 0x6874, 0x7270, 0x7669, "\000"
952 IDC_FACILITY, 0x403, 10, 0
9530x6572, 0x6573, 0x7672, 0x6465, 0x0030,
954 IDC_FACILITY, 0x403, 10, 0
9550x6572, 0x6573, 0x7672, 0x6465, 0x0031,
956 IDC_FACILITY, 0x403, 10, 0
9570x6572, 0x6573, 0x7672, 0x6465, 0x0032,
958 IDC_FACILITY, 0x403, 10, 0
9590x6572, 0x6573, 0x7672, 0x6465, 0x0033,
960 IDC_FACILITY, 0x403, 10, 0
9610x6572, 0x6573, 0x7672, 0x6465, 0x0034,
962 IDC_FACILITY, 0x403, 7, 0
9630x6f6c, 0x6163, 0x306c, "\000"
964 IDC_FACILITY, 0x403, 7, 0
9650x6f6c, 0x6163, 0x316c, "\000"
966 IDC_FACILITY, 0x403, 7, 0
9670x6f6c, 0x6163, 0x326c, "\000"
968 IDC_FACILITY, 0x403, 7, 0
9690x6f6c, 0x6163, 0x336c, "\000"
970 IDC_FACILITY, 0x403, 7, 0
9710x6f6c, 0x6163, 0x346c, "\000"
972 IDC_FACILITY, 0x403, 7, 0
9730x6f6c, 0x6163, 0x356c, "\000"
974 IDC_FACILITY, 0x403, 7, 0
9750x6f6c, 0x6163, 0x366c, "\000"
976 IDC_FACILITY, 0x403, 7, 0
9770x6f6c, 0x6163, 0x376c, "\000"
978 IDC_SOUND, 0x403, 7, 0
9790x6d28, 0x6f65, 0x2977, "\000"
980 IDC_SOUND, 0x403, 8, 0
9810x6728, 0x616c, 0x7373, 0x0029,
982 IDC_SOUND, 0x403, 7, 0
9830x6628, 0x6165, 0x2972, "\000"
984 IDC_SOUND, 0x403, 7, 0
9850x6b28, 0x6369, 0x296b, "\000"
986 0
987END
988
989
990/////////////////////////////////////////////////////////////////////////////
991//
992// WAVE
993//
994
995IDW_SOUND_MEOW WAVE DISCARDABLE "res\\meow.wav"
996IDW_SOUND_GLASS WAVE DISCARDABLE "res\\glass.wav"
997IDW_SOUND_FEAR WAVE DISCARDABLE "res\\fear.wav"
998IDW_SOUND_KICK WAVE DISCARDABLE "res\\kick.wav"
999
1000/////////////////////////////////////////////////////////////////////////////
1001//
1002// Bitmap
1003//
1004
1005IDB_BACKGROUND BITMAP DISCARDABLE "shared-data/klever-background.bmp"
1006
1007/////////////////////////////////////////////////////////////////////////////
1008//
1009// Menu
1010//
1011
1012IDD_KLOG_DIALOG MENU DISCARDABLE
1013BEGIN
1014 POPUP "Files"
1015 BEGIN
1016 MENUITEM "&Export", ID_FILES_EXPORT
1017 MENUITEM "&Import", ID_FILES_IMPORT
1018 MENUITEM SEPARATOR
1019 MENUITEM "&Reset", ID_FILES_RESET
1020 END
1021 POPUP "Tray"
1022 BEGIN
1023 MENUITEM "&Export settings", ID_FILES_EXPORT
1024 MENUITEM "&Import settings", ID_FILES_IMPORT
1025 MENUITEM "&Reset configuration", ID_FILES_RESET
1026 MENUITEM SEPARATOR
1027 MENUITEM "&Show KLog Window", ID_TRAY_SHOWKLOGWINDOW
1028 MENUITEM SEPARATOR
1029 MENUITEM "&Help", ID_TRAY_HELP
1030 MENUITEM "&About KLog", ID_TRAY_ABOUTKLOG
1031 MENUITEM "E&xit", ID_TRAY_EXIT
1032 END
1033END
1034
1035
1036/////////////////////////////////////////////////////////////////////////////
1037//
1038// String Table
1039//
1040
1041STRINGTABLE DISCARDABLE
1042BEGIN
1043 IDS_ABOUTBOX "&About KLog..."
1044 IDS_LOGTO_HOST "Host &name:"
1045 IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed."
1046 IDS_LOGTO_FILE "File &name:"
1047 IDS_SOUND_MEOW "(meow)"
1048 IDS_SOUND_GLASS "(glass)"
1049 IDS_SOUND_FEAR "(fear)"
1050 IDS_SOUND_KICK "(kick)"
1051 IDS_WAVFILTER "Wave files (*.wav)|*.wav|All files (*.*)|*.*|"
1052 IDS_SOUND_SELECT "Select sound"
1053 IDS_LOGFILTER "Log files (*.log)|*.log|All files (*.*)|*.*|"
1054END
1055
1056STRINGTABLE DISCARDABLE
1057BEGIN
1058 ID_FILES_EXPORT "Save current configuration."
1059 ID_FILES_IMPORT "Load configuration from file"
1060 ID_FILES_RESET "Reset to initial configuration"
1061 ID_TRAY_SHOWKLOGWINDOW "Show/Hide KLog wondow"
1062 ID_TRAY_HELP "Help"
1063 ID_TRAY_ABOUTKLOG "About KLog"
1064 ID_TRAY_EXIT "Terminate KLog"
1065END
1066
1067STRINGTABLE DISCARDABLE
1068BEGIN
1069 IDS_LOG_SELECT "Log To"
1070 IDS_LOG_EXT ".log"
1071 IDS_KLOGFILTER "KLog files (*.klg)|*.klg|All files (*.*)|*.*|"
1072 IDS_KLOG_EXPORT "Export to"
1073 IDS_KLOG_IMPORT "Import from"
1074 IDS_KLOG_EXT ".klg"
1075 IDS_REGISTRYKEY "Klever Group, Inc."
1076 IDS_KLEVERNET_URL "http://www.klever.net/"
1077 IDS_TIP_LOG "%s [%s] %s.%s"
1078 IDS_LOGTIMEFORMAT "%H:%M:%S %B %d"
1079 IDS_LOGPATTERN_TITLE "Logging pattern"
1080 IDS_LOGFILETIMEFORMAT "%c "
1081 IDS_TIP_FACILITY_ON "Turn on logging for given facility"
1082 IDS_TIP_FACILITY_XOR "Invert logging for given facility"
1083 IDS_TIP_PRIORITY_ON "Turn on all logging for given priority"
1084 IDS_TIP_PRIORITY_XOR "Invert logging for given priority"
1085END
1086
1087STRINGTABLE DISCARDABLE
1088BEGIN
1089 IDC_ADD "Add new logging destination"
1090 IDC_REMOVE "Remove logging destination"
1091 IDC_EXIT "Terminate KLog"
1092 IDC_TYPE_FILE "Log to file on disk"
1093 IDC_TYPE_HOST "Log to remote host"
1094 IDC_TYPE_NONE "Don't log anywhere but log window"
1095END
1096
1097STRINGTABLE DISCARDABLE
1098BEGIN
1099 IDC_LOGLENGTH "Number of lines to keep in log window"
1100 IDC_FILES "Import/Export KLog settings"
1101END
1102
1103STRINGTABLE DISCARDABLE
1104BEGIN
1105 IDC_LOG "Recent activity"
1106 IDC_HOSTS "Hosts access list for given destination"
1107END
1108
1109STRINGTABLE DISCARDABLE
1110BEGIN
1111 IDC_LOGPATTERN "Edit logging pattern"
1112END
1113
1114STRINGTABLE DISCARDABLE
1115BEGIN
1116 IDS_LOGFILEPRIFACEFORMAT "(%s.%s) "
1117 IDS_LOGFILESOURCEFORMAT "[%s] "
1118 IDS_LOGHOSTSOURCEFORMAT "[%s] "
1119 IDS_MSG_LOOKUPFAILED "Host address lookup for '%s' failed."
1120 IDS_MSG_FAILEDTOEXPORT "Unable to create file."
1121 IDS_MSG_FAILEDTOIMPORT "Unable to read file."
1122 IDS_MSG_FAILEDTOSTORE "Database is too big to store as system default."
1123END
1124
1125#endif // English (U.S.) resources
1126/////////////////////////////////////////////////////////////////////////////
1127
1128
1129
1130#ifndef APSTUDIO_INVOKED
1131/////////////////////////////////////////////////////////////////////////////
1132//
1133// Generated from the TEXTINCLUDE 3 resource.
1134//
1135#define _AFX_NO_SPLITTER_RESOURCES
1136#define _AFX_NO_OLE_RESOURCES
1137#define _AFX_NO_TRACKER_RESOURCES
1138#define _AFX_NO_PROPERTY_RESOURCES
1139
1140#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
1141#ifdef _WIN32
1142LANGUAGE 9, 1
1143#pragma code_page(1252)
1144#endif
1145#include "res\klog.rc2" // non-Microsoft Visual C++ edited resources
1146#include "afxres.rc" // Standard components
1147#endif
1148/////////////////////////////////////////////////////////////////////////////
1149#endif // not APSTUDIO_INVOKED
1150
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 @@
1@echo off
2REM -- First make map file from Microsoft Visual C++ generated resource.h
3echo // MAKEHELP.BAT generated Help Map file. Used by KLOG.HPJ. >"help\klog.hm"
4echo. >>"help\klog.hm"
5echo // Commands (ID_* and IDM_*) >>"help\klog.hm"
6makehm ID_,HID_,0x10000 IDM_,HIDM_,0x10000 resource.h >>"help\klog.hm"
7echo. >>"help\klog.hm"
8echo // Prompts (IDP_*) >>"help\klog.hm"
9makehm IDP_,HIDP_,0x30000 resource.h >>"help\klog.hm"
10echo. >>"help\klog.hm"
11echo // Resources (IDR_*) >>"help\klog.hm"
12makehm IDR_,HIDR_,0x20000 resource.h >>"help\klog.hm"
13echo. >>"help\klog.hm"
14echo // Dialogs (IDD_*) >>"help\klog.hm"
15makehm IDD_,HIDD_,0x20000 resource.h >>"help\klog.hm"
16echo. >>"help\klog.hm"
17echo // Frame Controls (IDW_*) >>"help\klog.hm"
18makehm IDW_,HIDW_,0x50000 resource.h >>"help\klog.hm"
19REM -- Make help for Project KLOG
20
21echo Building RTF file
22xsltproc -o help/klog.rtf shared-code/kinhelp.xsl help/klog.xml
23echo Building Win32 Help files
24start /wait hcrtf -x "help\klog.hpj"
25echo.
26if exist Debug\nul copy "help\klog.hlp" Debug
27if exist Debug\nul copy "help\klog.cnt" Debug
28if exist Release\nul copy "help\klog.hlp" Release
29if exist Release\nul copy "help\klog.cnt" Release
30if exist Releast\nul copy "help\klog.hlp" Releast
31if exist Releast\nul copy "help\klog.cnt" Releast
32echo.
33
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 @@
1//
2// KLOG.RC2 - resources Microsoft Visual C++ does not edit directly
3//
4
5#ifdef APSTUDIO_INVOKED
6 #error this file is not editable by Microsoft Visual C++
7#endif //APSTUDIO_INVOKED
8
9
10/////////////////////////////////////////////////////////////////////////////
11// Add manually edited resources here...
12
13/////////////////////////////////////////////////////////////////////////////
diff --git a/res/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 @@
1//{{NO_DEPENDENCIES}}
2// Microsoft Developer Studio generated include file.
3// Used by KLog.rc
4//
5#define IDM_ABOUTBOX 0x0010
6#define IDD_ABOUTBOX 100
7#define IDS_ABOUTBOX 101
8#define IDC_TRAYICON 101
9#define IDD_KLOG_DIALOG 102
10#define IDS_LOGTO_HOST 102
11#define IDP_SOCKETS_INIT_FAILED 103
12#define IDS_LOGTO_FILE 104
13#define IDS_SOUND_MEOW 105
14#define IDS_SOUND_GLASS 106
15#define IDS_SOUND_FEAR 107
16#define IDS_SOUND_KICK 108
17#define IDS_WAVFILTER 109
18#define IDS_SOUND_SELECT 110
19#define IDS_LOGFILTER 111
20#define IDS_LOG_SELECT 112
21#define IDS_LOG_EXT 113
22#define IDS_KLOGFILTER 114
23#define IDS_KLOG_EXPORT 115
24#define IDS_KLOG_IMPORT 116
25#define IDS_KLOG_EXT 117
26#define IDS_REGISTRYKEY 118
27#define IDS_KLEVERNET_URL 119
28#define IDS_TIP_LOG 120
29#define IDS_LOGTIMEFORMAT 121
30#define IDS_LOGPATTERN_TITLE 122
31#define IDS_LOGFILETIMEFORMAT 123
32#define IDS_TIP_FACILITY_ON 124
33#define IDS_TIP_FACILITY_XOR 125
34#define IDS_TIP_PRIORITY_ON 126
35#define IDS_TIP_PRIORITY_XOR 127
36#define IDR_MAINFRAME 128
37#define IDS_LOGFILEPRIFACEFORMAT 128
38#define IDS_LOGFILESOURCEFORMAT 129
39#define IDI_KLOG 130
40#define IDS_LOGHOSTSOURCEFORMAT 130
41#define IDI_KLOG_TRIGGERED 131
42#define IDS_MSG_LOOKUPFAILED 131
43#define IDS_MSG_FAILEDTOEXPORT 132
44#define IDS_MSG_FAILEDTOIMPORT 133
45#define IDS_MSG_FAILEDTOSTORE 134
46#define IDW_SOUND_MEOW 137
47#define IDW_SOUND_GLASS 138
48#define IDW_SOUND_FEAR 139
49#define IDI_PREPLAY 140
50#define IDW_SOUND_KICK 140
51#define IDI_BROWSE 141
52#define IDB_BACKGROUND 141
53#define IDD_LOG_UNIX 143
54#define IDD_LOG_RESERVED 144
55#define IDI_LOGPATTERN 144
56#define IDD_LOG_LOCAL 145
57#define IDD_WARNBLOCKING 146
58#define IDC_TABS 1001
59#define IDC_ADD 1002
60#define IDC_REMOVE 1003
61#define IDC_EXIT 1004
62#define IDC_TYPE_FILE 1005
63#define IDC_TYPE_HOST 1006
64#define IDC_TYPE_NONE 1007
65#define IDC_HOSTORFILE 1008
66#define IDC_HOSTFILE 1009
67#define IDC_BROWSE 1010
68#define IDC_DESC 1011
69#define IDC_FACILITY 1017
70#define IDC_EMERG 1018
71#define IDC_ALERT 1019
72#define IDC_CRIT 1020
73#define IDC_ERR 1021
74#define IDC_WARNING 1022
75#define IDC_WARN_ON 1022
76#define IDC_NOTICE 1023
77#define IDC_WARN_XOR 1023
78#define IDC_INFO 1024
79#define IDC_DEBUG 1025
80#define IDC_BROWSESOUND 1027
81#define IDC_SOUND 1028
82#define IDC_LOG 1029
83#define IDC_PLAYSOUND 1030
84#define IDC_ALL 1031
85#define IDC_NONE 1032
86#define IDC_HOSTS 1034
87#define IDC_HL_IP 1035
88#define IDC_HL_MASK 1036
89#define IDC_HL_ADD 1037
90#define IDC_HL_REMOVE 1038
91#define IDC_INVERT 1040
92#define IDC_LOGLENSPIN 1047
93#define IDC_LOGLENGTH 1048
94#define IDC_FILES 1052
95#define IDC_KLEVERNET 1053
96#define IDC_STATIC_LOGLENGTH 1054
97#define IDC_EMERG_ON 1058
98#define IDC_ALERT_ON 1059
99#define IDC_CRIT_ON 1060
100#define IDC_ERR_ON 1061
101#define IDC_NOTICE_ON 1062
102#define IDC_INFO_ON 1063
103#define IDC_DEBUG_ON 1064
104#define IDC_KERNEL_ON 1065
105#define IDC_USER_ON 1066
106#define IDC_MAIL_ON 1067
107#define IDC_DAEMON_ON 1068
108#define IDC_AUTH_ON 1069
109#define IDC_SYSLOG_ON 1070
110#define IDC_LPR_ON 1071
111#define IDC_NEWS_ON 1072
112#define IDC_UUCP_ON 1073
113#define IDC_CRON_ON 1074
114#define IDC_KERNEL_EMERG 1075
115#define IDC_NOTICE_XOR 1076
116#define IDC_INFO_XOR 1077
117#define IDC_DEBUG_XOR 1078
118#define IDC_KERNEL_XOR 1079
119#define IDC_KERNEL_ALERT 1080
120#define IDC_KERNEL_CRIT 1081
121#define IDC_KERNEL_ERR 1082
122#define IDC_KERNEL_WARN 1083
123#define IDC_KERNEL_NOTICE 1084
124#define IDC_KERNEL_INFO 1085
125#define IDC_KERNEL_DEBUG 1086
126#define IDC_USER_EMERG 1087
127#define IDC_USER_ALERT 1088
128#define IDC_USER_CRIT 1089
129#define IDC_USER_ERR 1090
130#define IDC_USER_WARN 1091
131#define IDC_USER_NOTICE 1092
132#define IDC_USER_INFO 1093
133#define IDC_USER_DEBUG 1094
134#define IDC_MAIL_EMERG 1095
135#define IDC_MAIL_ALERT 1096
136#define IDC_MAIL_CRIT 1097
137#define IDC_MAIL_ERR 1098
138#define IDC_MAIL_WARN 1099
139#define IDC_MAIL_NOTICE 1100
140#define IDC_MAIL_INFO 1101
141#define IDC_MAIL_DEBUG 1102
142#define IDC_DAEMON_EMERG 1103
143#define IDC_DAEMON_ALERT 1104
144#define IDC_DAEMON_CRIT 1105
145#define IDC_DAEMON_ERR 1106
146#define IDC_DAEMON_WARN 1107
147#define IDC_DAEMON_NOTICE 1108
148#define IDC_DAEMON_INFO 1109
149#define IDC_DAEMON_DEBUG 1110
150#define IDC_AUTH_EMERG 1111
151#define IDC_AUTH_ALERT 1112
152#define IDC_AUTH_CRIT 1113
153#define IDC_AUTH_ERR 1114
154#define IDC_AUTH_WARN 1115
155#define IDC_AUTH_NOTICE 1116
156#define IDC_AUTH_INFO 1117
157#define IDC_AUTH_DEBUG 1118
158#define IDC_SYSLOG_EMERG 1119
159#define IDC_SYSLOG_ALERT 1120
160#define IDC_SYSLOG_CRIT 1121
161#define IDC_SYSLOG_ERR 1122
162#define IDC_SYSLOG_WARN 1123
163#define IDC_SYSLOG_NOTICE 1124
164#define IDC_SYSLOG_INFO 1125
165#define IDC_SYSLOG_DEBUG 1126
166#define IDC_LPR_EMERG 1127
167#define IDC_LPR_ALERT 1128
168#define IDC_LPR_CRIT 1129
169#define IDC_LPR_ERR 1130
170#define IDC_LPR_WARN 1131
171#define IDC_LPR_NOTICE 1132
172#define IDC_LPR_INFO 1133
173#define IDC_LPR_DEBUG 1134
174#define IDC_NEWS_EMERG 1135
175#define IDC_NEWS_ALERT 1136
176#define IDC_NEWS_CRIT 1137
177#define IDC_NEWS_ERR 1138
178#define IDC_NEWS_WARN 1139
179#define IDC_NEWS_NOTICE 1140
180#define IDC_NEWS_INFO 1141
181#define IDC_NEWS_DEBUG 1142
182#define IDC_UUCP_EMERG 1143
183#define IDC_UUCP_ALERT 1144
184#define IDC_UUCP_CRIT 1145
185#define IDC_UUCP_ERR 1146
186#define IDC_UUCP_WARN 1147
187#define IDC_UUCP_NOTICE 1148
188#define IDC_UUCP_INFO 1149
189#define IDC_UUCP_DEBUG 1150
190#define IDC_CRON_EMERG 1151
191#define IDC_CRON_ALERT 1152
192#define IDC_CRON_CRIT 1153
193#define IDC_CRON_ERR 1154
194#define IDC_CRON_WARN 1155
195#define IDC_CRON_NOTICE 1156
196#define IDC_CRON_INFO 1157
197#define IDC_CRON_DEBUG 1158
198#define IDC_EMERG_XOR 1159
199#define IDC_ALERT_XOR 1160
200#define IDC_CRIT_XOR 1161
201#define IDC_ERR_XOR 1162
202#define IDC_USER_XOR 1163
203#define IDC_MAIL_XOR 1164
204#define IDC_DAEMON_XOR 1165
205#define IDC_AUTH_XOR 1166
206#define IDC_SYSLOG_XOR 1167
207#define IDC_LPR_XOR 1168
208#define IDC_NEWS_XOR 1169
209#define IDC_UUCP_XOR 1170
210#define IDC_CRON_XOR 1171
211#define IDC_R0_ON 1172
212#define IDC_AUTHPRIV_ON 1172
213#define IDC_R1_ON 1173
214#define IDC_AUTHPRIV_EMERG 1173
215#define IDC_R2_ON 1174
216#define IDC_AUTHPRIV_ALERT 1174
217#define IDC_R3_ON 1175
218#define IDC_AUTHPRIV_CRIT 1175
219#define IDC_R4_ON 1176
220#define IDC_AUTHPRIV_ERR 1176
221#define IDC_R0_XOR 1177
222#define IDC_AUTHPRIV_WARN 1177
223#define IDC_R1_XOR 1178
224#define IDC_AUTHPRIV_NOTICE 1178
225#define IDC_R2_XOR 1179
226#define IDC_AUTHPRIV_INFO 1179
227#define IDC_R3_XOR 1180
228#define IDC_AUTHPRIV_DEBUG 1180
229#define IDC_R4_XOR 1181
230#define IDC_R0_EMERG 1182
231#define IDC_AUTHPRIV_XOR 1182
232#define IDC_R0_ALERT 1183
233#define IDC_R0_CRIT 1184
234#define IDC_R0_ERR 1185
235#define IDC_R0_WARN 1186
236#define IDC_R0_NOTICE 1187
237#define IDC_R0_INFO 1188
238#define IDC_R0_DEBUG 1189
239#define IDC_R1_EMERG 1190
240#define IDC_R1_ALERT 1191
241#define IDC_R1_CRIT 1192
242#define IDC_R1_ERR 1193
243#define IDC_R1_WARN 1194
244#define IDC_R1_NOTICE 1195
245#define IDC_R1_INFO 1196
246#define IDC_R1_DEBUG 1197
247#define IDC_R2_EMERG 1198
248#define IDC_R2_ALERT 1199
249#define IDC_R2_CRIT 1200
250#define IDC_R2_ERR 1201
251#define IDC_R2_WARN 1202
252#define IDC_R2_NOTICE 1203
253#define IDC_R2_INFO 1204
254#define IDC_R2_DEBUG 1205
255#define IDC_R3_EMERG 1206
256#define IDC_R3_ALERT 1207
257#define IDC_R3_CRIT 1208
258#define IDC_R3_ERR 1209
259#define IDC_R3_WARN 1210
260#define IDC_R3_NOTICE 1211
261#define IDC_R3_INFO 1212
262#define IDC_R3_DEBUG 1213
263#define IDC_R4_EMERG 1214
264#define IDC_R4_ALERT 1215
265#define IDC_R4_CRIT 1216
266#define IDC_R4_ERR 1217
267#define IDC_R4_WARN 1218
268#define IDC_R4_NOTICE 1219
269#define IDC_R4_INFO 1220
270#define IDC_R4_DEBUG 1221
271#define IDC_L0_ON 1222
272#define IDC_L1_ON 1223
273#define IDC_L2_ON 1224
274#define IDC_L3_ON 1225
275#define IDC_L4_ON 1226
276#define IDC_L5_ON 1227
277#define IDC_L6_ON 1228
278#define IDC_L7_ON 1229
279#define IDC_L0_XOR 1230
280#define IDC_L1_XOR 1231
281#define IDC_L2_XOR 1232
282#define IDC_L3_XOR 1233
283#define IDC_L4_XOR 1234
284#define IDC_L5_XOR 1235
285#define IDC_L6_XOR 1236
286#define IDC_L7_XOR 1237
287#define IDC_L0_EMERG 1238
288#define IDC_L0_ALERT 1239
289#define IDC_L0_CRIT 1240
290#define IDC_L0_ERR 1241
291#define IDC_L0_WARN 1242
292#define IDC_L0_NOTICE 1243
293#define IDC_L0_INFO 1244
294#define IDC_L0_DEBUG 1245
295#define IDC_L1_EMERG 1246
296#define IDC_L1_ALERT 1247
297#define IDC_L1_CRIT 1248
298#define IDC_L1_ERR 1249
299#define IDC_L1_WARN 1250
300#define IDC_L1_NOTICE 1251
301#define IDC_L1_INFO 1252
302#define IDC_L1_DEBUG 1253
303#define IDC_L2_EMERG 1254
304#define IDC_L2_ALERT 1255
305#define IDC_L2_CRIT 1256
306#define IDC_L2_ERR 1257
307#define IDC_L2_WARN 1258
308#define IDC_L2_NOTICE 1259
309#define IDC_L2_INFO 1260
310#define IDC_L2_DEBUG 1261
311#define IDC_L3_EMERG 1262
312#define IDC_L3_ALERT 1263
313#define IDC_L3_CRIT 1264
314#define IDC_L3_ERR 1265
315#define IDC_L3_WARN 1266
316#define IDC_L3_NOTICE 1267
317#define IDC_L3_INFO 1268
318#define IDC_L3_DEBUG 1269
319#define IDC_L4_EMERG 1270
320#define IDC_L4_ALERT 1271
321#define IDC_L4_CRIT 1272
322#define IDC_L4_ERR 1273
323#define IDC_L4_WARN 1274
324#define IDC_L4_NOTICE 1275
325#define IDC_L4_INFO 1276
326#define IDC_L4_DEBUG 1277
327#define IDC_L5_EMERG 1278
328#define IDC_L5_ALERT 1279
329#define IDC_L5_CRIT 1280
330#define IDC_L5_ERR 1281
331#define IDC_L5_WARN 1282
332#define IDC_L5_NOTICE 1283
333#define IDC_L5_INFO 1284
334#define IDC_L5_DEBUG 1285
335#define IDC_L6_EMERG 1286
336#define IDC_L6_ALERT 1287
337#define IDC_L6_CRIT 1288
338#define IDC_L6_ERR 1289
339#define IDC_L6_WARN 1290
340#define IDC_L6_NOTICE 1291
341#define IDC_L6_INFO 1292
342#define IDC_L6_DEBUG 1293
343#define IDC_L7_EMERG 1294
344#define IDC_L7_ALERT 1295
345#define IDC_L7_CRIT 1296
346#define IDC_L7_ERR 1297
347#define IDC_L7_WARN 1298
348#define IDC_L7_NOTICE 1299
349#define IDC_L7_INFO 1300
350#define IDC_L7_DEBUG 1301
351#define IDC_LOGPATTERN 1302
352#define IDC_WARNBLOCKING 1303
353#define ID_FILES_EXPORT 32771
354#define ID_FILES_IMPORT 32772
355#define ID_FILES_RESET 32773
356#define ID_TRAY_SHOWKLOGWINDOW 32774
357#define ID_TRAY_HELP 32776
358#define ID_TRAY_ABOUTKLOG 32777
359#define ID_TRAY_EXIT 32778
360
361// Next default values for new objects
362//
363#ifdef APSTUDIO_INVOKED
364#ifndef APSTUDIO_READONLY_SYMBOLS
365#define _APS_NEXT_RESOURCE_VALUE 147
366#define _APS_NEXT_COMMAND_VALUE 32779
367#define _APS_NEXT_CONTROL_VALUE 1304
368#define _APS_NEXT_SYMED_VALUE 102
369#endif
370#endif
diff --git a/shared-code/BTreendex.h b/shared-code/BTreendex.h
new file mode 100644
index 0000000..88109ab
--- a/dev/null
+++ b/shared-code/BTreendex.h
@@ -0,0 +1,595 @@
1 #ifndef__BTREENDEX_H
2 #define__BTREENDEX_H
3
4#include "Dynamide.h"
5
6namespace Klever {
7
8template<class key,class value,int treeOrder,int cluster>
9 class CBTreendex : public CObject{
10public:
11 typedef LONG CBTPageRef;
12 struct CBTRecordRef {
13 CBTPageRef m_Page;
14 INT m_Offset;
15 CBTRecordRef(CBTPageRef page=-1,INT offset=-1) : m_Page(page), m_Offset(offset) {}
16 };
17 class CBTRecord : public CObject {
18 public:
19 CBTPageRef m_ptrLeft;
20 CBTPageRef m_ptrRight;
21 key m_Key;
22 value m_Value;
23 CBTRecord() : m_ptrLeft(-1), m_ptrRight(-1) {}
24 CBTRecord(key& _key,value& _value,CBTPageRef left=-1,CBTPageRef right=-1) : m_Key(_key), m_Value(_value), m_ptrLeft(left), m_ptrRight(right) {}
25 CBTRecord(CBTRecord& r) : m_Key(r.m_Key), m_Value(r.m_Value), m_ptrLeft(r.m_ptrLeft), m_ptrRight(r.m_ptrRight) {}
26
27 CBTRecord& operator=(CBTRecord& r) {m_Key=r.m_Key, m_Value=r.m_Value, m_ptrLeft=r.m_ptrLeft, m_ptrRight=r.m_ptrRight;return *this;}
28
29 void Serialize(CArchive& ar) {
30 if(ar.IsStoring()){
31 ar << m_ptrLeft;
32 ar << m_ptrRight;
33 }else{
34 ar >> m_ptrLeft;
35 ar >> m_ptrRight;
36 }
37 SerializeElements(ar,&m_Key,1);
38 SerializeElements(ar,&m_Value,1);
39 }
40 };
41 class CBTPage : public CArray<CBTRecord,CBTRecord&> {
42 public:
43 void Serialize(CArchive& ar) {
44 int nCount = -1;
45 if(ar.IsStoring()){
46 nCount = GetSize();
47 ar << nCount;
48 }else{
49 nCount = 0;
50 ar >> nCount;
51 RemoveAll();
52 SetSize(nCount);
53 }
54 for(int tmp=0;tmp<nCount;tmp++)
55 ElementAt(tmp).Serialize(ar);
56 }
57 };
58 typedef CDynamide<256,cluster> CBTDyna;
59 typedef CBTDyna::CDynaFile CBTDynaFile;
60 typedef CArray<CBTRecordRef,CBTRecordRef&> CBTRStack;
61
62 CBTDyna m_BT;
63 struct_btCrap {
64 BOOL m_bRootSet;
65 CBTPageRef m_Root;
66 } *m_BTCrap;
67 BOOL m_bRO;
68 CBTRStack m_btStack;
69 CBTPage m_stackTop;
70
71 CBTreendex() {}
72 ~CBTreendex() { Close(); }
73 BOOL Attach(CFile* file,BOOL bAutodelete) {
74 m_bRO = FALSE;
75 if(!m_BT.Attach(file,bAutodelete))
76 return FALSE;
77 return Attach();
78 }
79 BOOL Open(LPCTSTR file,BOOL bReadOnly) {
80 if(!m_BT.Open(file,bReadOnly))
81 return FALSE;
82 m_bRO = bReadOnly;
83 return Attach();
84 }
85 BOOL Create(LPCTSTR file) {
86 try{
87 CFile* f = new CFile(file,CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead|CFile::shareDenyWrite|CFile::typeBinary);
88 ASSERT(f);
89 return Attach(f,TRUE);
90 }catch(CException* e){
91 e->Delete();
92 return FALSE;
93 }
94 }
95 BOOL Attach() {
96 ASSERT(m_BT.IsOpened());
97 m_BTCrap = (_btCrap*)m_BT.m_FB.crap;
98 if(!m_BTCrap->m_bRootSet){
99 m_BTCrap->m_Root = AllocatePage();
100 if(m_BTCrap->m_Root<0)
101 return FALSE;
102 m_BTCrap->m_bRootSet = TRUE;
103 m_BT.Write1stBlock();
104 }
105 return TRUE;
106 }
107 BOOL Close() {
108 m_BT.Close();
109 return TRUE;
110 }
111 BOOL IsOpened() {
112 return m_BT.IsOpened();
113 }
114
115 BOOL Lookup(key& _key,value& value) {
116 if(!IsOpened())
117 return FALSE;
118 ASSERT(m_BTCrap->m_bRootSet);
119 if(!SeekToPage(_key))
120 return FALSE;
121 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
122 if(rr.m_Offset<0)
123 return FALSE;
124 ASSERT(rr.m_Offset<m_stackTop.GetSize());
125 if(_key != m_stackTop[rr.m_Offset].m_Key)
126 return FALSE;
127 value = m_stackTop[rr.m_Offset].m_Value;
128 return TRUE;
129 }
130 BOOL Add(key& _key,value& _value) {
131 if(!IsOpened())
132 return FALSE;
133 ASSERT(m_BTCrap->m_bRootSet);
134 if(!SeekToPage(_key))
135 return FALSE;
136 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
137 CBTRecord nuRecord(_key,_value);
138 if(rr.m_Offset<0){
139 if(m_stackTop.GetSize())
140 nuRecord.m_ptrLeft = m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight;
141 }else if(rr.m_Offset==0){
142 nuRecord.m_ptrRight = m_stackTop[0].m_ptrLeft;
143 }else{
144 nuRecord.m_ptrLeft = m_stackTop[rr.m_Offset-1].m_ptrRight;
145 nuRecord.m_ptrRight = m_stackTop[rr.m_Offset].m_ptrLeft;
146 }
147 // ASSERT(rr.m_Offset==0 || (m_stackTop[rr.m_Offset-1].m_Key<_key && m_stackTop[rr.m_Offset-1].m_ptrRight<0));
148 // ASSERT(rr.m_Offset<0 || m_stackTop[rr.m_Offset].m_Key>=_key && m_stackTop[rr.m_Offset].m_ptrLeft<0);
149 if(rr.m_Offset>=0 && m_stackTop[rr.m_Offset].m_Key==_key){
150 // Exact match found - just replace.
151 m_stackTop[rr.m_Offset].m_Value = _value;
152 if(!SavePage(rr.m_Page,m_stackTop))
153 return FALSE;
154 return TRUE;
155 }
156 // Split the page and propagate the split if needed..
157 // Insert new element at rr.m_Offset..
158 BOOL nuisnew = TRUE;
159 for(int sp=m_btStack.GetUpperBound();sp>=0;sp--){
160 CBTPageRef opr = m_btStack[sp].m_Page;
161 int iAt = m_btStack[sp].m_Offset;
162 CBTPage op;
163 VERIFY(LoadPage(opr,op));
164 if(iAt<0)
165 iAt = op.GetSize();
166 else{
167 if(op[iAt].m_Key<nuRecord.m_Key)
168 iAt++;
169 ASSERT(iAt==op.GetSize() || op[iAt].m_Key > nuRecord.m_Key);
170 }
171 op.InsertAt(iAt,nuRecord);
172 if(iAt>0)
173 op[iAt-1].m_ptrRight=nuRecord.m_ptrLeft;
174 if(iAt<op.GetUpperBound())
175 op[iAt+1].m_ptrLeft=nuRecord.m_ptrRight;
176 if(op.GetSize()<=treeOrder*2){
177 // This isn't causing overflow
178 VERIFY(SavePage(opr,op));
179 return TRUE;
180 }
181 TRACE0("Split\n");
182 ASSERT(op.GetSize()==(treeOrder*2+1));
183 CBTPageRef npr = AllocatePage();
184 ASSERT(npr>=0);
185 CBTPage np;
186 ASSERT(LoadPage(npr,np));
187 ASSERT(!np.GetSize());
188 nuRecord = op[treeOrder];
189 if(iAt==treeOrder){
190 // We're inserting central element! - drop out the stack top if this is still new one
191 for(int tmp=0;tmp<treeOrder;tmp++)
192 np.InsertAt(tmp,op[tmp]);
193 op.RemoveAt(0,treeOrder+1);
194 nuRecord.m_ptrLeft = npr;
195 nuRecord.m_ptrRight = opr;
196 if(nuisnew)
197 m_btStack.RemoveAt(m_btStack.GetUpperBound());
198 }else{
199 if(iAt<treeOrder){
200 // We're inserting in the left subtree.
201 // Make newpage the right one and forget it.
202 for(int tmp=0;tmp<treeOrder;tmp++)
203 np.InsertAt(tmp,op[tmp+treeOrder+1]);
204 op.RemoveAt(treeOrder,treeOrder+1);
205 nuRecord.m_ptrLeft = opr;
206 nuRecord.m_ptrRight = npr;
207 }else{
208 // We're inserting in the right subtree.
209 // Make newpage the left one, forget it, but also adjust offset in the stack
210 for(int tmp=0;tmp<treeOrder;tmp++)
211 np.InsertAt(tmp,op[tmp]);
212 op.RemoveAt(0,treeOrder+1);
213 nuRecord.m_ptrLeft = npr;
214 nuRecord.m_ptrRight = opr;
215 m_btStack[sp].m_Offset-=treeOrder+1;
216 }
217 // Note that we're not inserting new element anymore.
218 nuisnew = FALSE;
219 }
220 // Do, excessive sanity checks and save pages
221 ASSERT(op.GetSize());
222 ASSERT(np.GetSize());
223 VERIFY(SavePage(opr,op));
224 VERIFY(SavePage(npr,np));
225 }
226 // Here we have root page overflow, which means that we're simply putting new
227 // record in this brand new root page and also inserting this page on the bottom of the stack
228 CBTPageRef nuroot = AllocatePage();
229 ASSERT(nuroot>=0);
230 CBTPage nurpa;
231 ASSERT(LoadPage(nuroot,nurpa));
232 ASSERT(!nurpa.GetSize());
233 nurpa.Add(nuRecord);
234 VERIFY(SavePage(nuroot,nurpa));
235 m_btStack.InsertAt(0,CBTRecordRef(nuroot,0));
236 m_BTCrap->m_Root = nuroot;
237 m_BT.Write1stBlock();
238 return TRUE;
239 }
240 BOOL Delete(key& _key) {
241 if(!IsOpened())
242 return FALSE;
243 ASSERT(m_BTCrap->m_bRootSet);
244 value _value;
245 if(!Lookup(_key,_value))
246 return FALSE;
247 // Found key, check if it's a leaf
248 {
249 CBTRecordRef* rr = &m_btStack[m_btStack.GetUpperBound()];
250 int rrIdx = m_btStack.GetUpperBound();
251 if(m_stackTop[rr->m_Offset].m_ptrLeft>=0){
252 ASSERT(m_stackTop[rr->m_Offset].m_ptrRight>=0);
253 // It isn't - scan for the _next_ key and do dirty deeds
254 m_btStack.Add(CBTRecordRef(m_stackTop[rr->m_Offset].m_ptrRight,0));
255 for(;;){
256 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
257 if(!LoadPage(rr.m_Page,m_stackTop))
258 return FALSE;
259 if(m_stackTop[0].m_ptrLeft<0)
260 break;
261 m_btStack.Add(CBTRecordRef(m_stackTop[0].m_ptrLeft,0));
262 }
263 // We have a leaf node here, replace victim with the first element and kill it.
264 CBTPage uppage;
265 rr = &m_btStack[rrIdx];
266 if(!LoadPage(rr->m_Page,uppage))
267 return FALSE;
268 uppage[rr->m_Offset].m_Key=m_stackTop[0].m_Key; uppage[rr->m_Offset].m_Value=m_stackTop[0].m_Value;
269 m_stackTop.RemoveAt(0);
270 if(!(SavePage(rr->m_Page,uppage) && SavePage(m_btStack[m_btStack.GetUpperBound()].m_Page,m_stackTop)))
271 return FALSE;
272 }else{
273 ASSERT(m_stackTop[rr->m_Offset].m_ptrRight<0);
274 m_stackTop.RemoveAt(rr->m_Offset);
275 if(!SavePage(rr->m_Page,m_stackTop))
276 return FALSE;
277 }
278 }
279 // We have a page to check for underflow at the top of the stack now.
280 for(;;){
281 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
282 if(!LoadPage(rr.m_Page,m_stackTop))
283 return FALSE;
284 if(m_stackTop.GetSize()>=treeOrder || m_btStack.GetSize()==1)
285 return TRUE;
286 CBTRecordRef& rr1 = m_btStack[m_btStack.GetUpperBound()-1];
287 CBTPage daddy;
288 if(!LoadPage(rr1.m_Page,daddy))
289 return FALSE;
290 CBTPageRef nPage = daddy[rr1.m_Offset].m_ptrRight;
291 BOOL bRight=TRUE;
292 if(nPage<0 || nPage==rr.m_Page){
293 nPage = daddy[rr1.m_Offset].m_ptrLeft;
294 bRight = FALSE;
295 }
296 ASSERT(nPage>=0 && nPage!=rr.m_Page);
297 CBTPage neighbor;
298 if(!LoadPage(nPage,neighbor))
299 return FALSE;
300 // Here we have possibly two cases:
301 // 1. Neighboring page can share some data with use, then do share and leave
302 // 2. Neighboring page is of treeorder in size, then merge and propagate
303 if(neighbor.GetSize()>treeOrder){
304 TRACE0("Redistributing..\n");
305 // Borrow some data from there.
306 int toBorrow = neighbor.GetSize()-treeOrder;
307 toBorrow=toBorrow/2+1;
308 ASSERT(toBorrow);
309 if(bRight)
310 m_stackTop.Add(CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight,neighbor[0].m_ptrLeft));
311 else
312 m_stackTop.InsertAt(0,CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,neighbor[neighbor.GetUpperBound()].m_ptrRight,m_stackTop[0].m_ptrLeft));
313 for(toBorrow--;toBorrow;toBorrow--){
314 if(bRight){
315 m_stackTop.Add(neighbor[0]);
316 neighbor.RemoveAt(0);
317 }else{
318 m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]);
319 neighbor.RemoveAt(neighbor.GetUpperBound());
320 }
321 }
322 daddy[rr1.m_Offset].m_Key = neighbor[bRight?0:neighbor.GetUpperBound()].m_Key; daddy[rr1.m_Offset].m_Value = neighbor[bRight?0:neighbor.GetUpperBound()].m_Value;
323 neighbor.RemoveAt(bRight?0:neighbor.GetUpperBound());
324 if(!(SavePage(rr1.m_Page,daddy) && SavePage(nPage,neighbor) && SavePage(rr.m_Page,m_stackTop)))
325 return FALSE;
326 rr.m_Offset = -1;// *** Point to the next??
327 return TRUE;
328 }
329 TRACE0("Merging..\n");
330 // We need to merge pages here..
331 // We will merge them at stacktop, then we'll discard neighbor guy..
332 if(bRight)
333 m_stackTop.Add(CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,m_stackTop[m_stackTop.GetUpperBound()].m_ptrRight,neighbor[0].m_ptrLeft));
334 else
335 m_stackTop.InsertAt(0,CBTRecord(daddy[rr1.m_Offset].m_Key,daddy[rr1.m_Offset].m_Value,neighbor[neighbor.GetUpperBound()].m_ptrRight,m_stackTop[0].m_ptrLeft));
336 if(bRight){
337 while(neighbor.GetSize()){
338 m_stackTop.Add(neighbor[0]);
339 neighbor.RemoveAt(0);
340 }
341 }else{
342 while(neighbor.GetSize()){
343 m_stackTop.InsertAt(0,neighbor[neighbor.GetUpperBound()]);
344 neighbor.RemoveAt(neighbor.GetUpperBound());
345 }
346 }
347 if(rr1.m_Offset>0)
348 daddy[rr1.m_Offset-1].m_ptrRight=rr.m_Page;
349 if(rr1.m_Offset<daddy.GetUpperBound())
350 daddy[rr1.m_Offset+1].m_ptrLeft=rr.m_Page;
351 daddy.RemoveAt(rr1.m_Offset);
352 if(!(SavePage(rr1.m_Page,daddy) && SavePage(rr.m_Page,m_stackTop)))
353 return FALSE;
354 VERIFY(DeallocatePage(nPage));
355 m_btStack.RemoveAt(m_btStack.GetUpperBound());
356 }
357 return FALSE;
358 }
359 BOOL GoFirst() {
360 if(!IsOpened())
361 return FALSE;
362 ASSERT(m_BTCrap->m_bRootSet);
363 m_btStack.RemoveAll();
364 m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
365 for(;;){
366 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
367 if(!LoadPage(rr.m_Page,m_stackTop))
368 return FALSE;
369 if(!m_stackTop.GetSize()){
370 ASSERT(m_btStack.GetSize()==1);
371 return FALSE;
372 }
373 rr.m_Offset = 0;
374 if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
375 return TRUE;
376 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
377 }
378 }
379 BOOL GoLast() {
380 if(!IsOpened())
381 return FALSE;
382 ASSERT(m_BTCrap->m_bRootSet);
383 m_btStack.RemoveAll();
384 m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
385 for(;;){
386 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
387 if(!LoadPage(rr.m_Page,m_stackTop))
388 return FALSE;
389 if(!m_stackTop.GetSize()){
390 ASSERT(m_btStack.GetSize()==1);
391 return FALSE;
392 }
393 rr.m_Offset = m_stackTop.GetUpperBound();
394 if(m_stackTop[rr.m_Offset].m_ptrRight<0)
395 return TRUE;
396 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1));
397 }
398 }
399 BOOL GoNext() {
400 if(!IsOpened())
401 return FALSE;
402 if(!(m_btStack.GetSize() && m_btStack[m_btStack.GetUpperBound()].m_Offset>=0))
403 return FALSE;
404 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
405 if(!LoadPage(rr.m_Page,m_stackTop))
406 return FALSE;
407 ASSERT(rr.m_Offset<m_stackTop.GetSize());
408 if(m_stackTop[rr.m_Offset].m_ptrRight>=0){
409 // Advance pointer in this page and dive into subtree
410 // going left and left until we have nowhere to go.
411 // TRACE1("Dive into page %lu",m_stackTop[rr.m_Offset].m_ptrRight);
412 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,0));
413 for(;;){
414 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
415 ASSERT(rr.m_Offset==0);
416 if(!LoadPage(rr.m_Page,m_stackTop))
417 return FALSE;
418 if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
419 break;
420 // TRACE1(", %lu",m_stackTop[rr.m_Offset].m_ptrLeft);
421 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,0));
422 }
423 // TRACE0("\n");
424 return TRUE;
425 }else if(rr.m_Offset<m_stackTop.GetUpperBound()){
426 rr.m_Offset++;
427 return TRUE;
428 }
429 // We're at the end of page go up until we're done or we have data.
430 m_btStack.RemoveAt(m_btStack.GetUpperBound());
431 // TRACE0("Go up");
432 while(m_btStack.GetSize()){
433 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
434 if(!LoadPage(rr.m_Page,m_stackTop))
435 return FALSE;
436 if(rr.m_Offset<m_stackTop.GetSize()){
437 // TRACE0("\n");
438 return TRUE;
439 }
440 // TRACE0(", up");
441 m_btStack.RemoveAt(m_btStack.GetUpperBound());
442 }
443 // TRACE0("\nBtree is done\n");
444 return FALSE;
445 }
446 BOOL GoPrev() {
447 if(!IsOpened())
448 return FALSE;
449 if(!(m_btStack.GetSize() && m_btStack[m_btStack.GetUpperBound()].m_Offset>=0))
450 return FALSE;
451 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
452 if(!LoadPage(rr.m_Page,m_stackTop))
453 return FALSE;
454 ASSERT(rr.m_Offset<m_stackTop.GetSize());
455 if(m_stackTop[rr.m_Offset].m_ptrLeft>=0){
456 // Dive in and go right and right from the rightmost until
457 // we have nowhere to go.
458 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
459 for(;;){
460 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
461 if(!LoadPage(rr.m_Page,m_stackTop))
462 return FALSE;
463 rr.m_Offset = m_stackTop.GetUpperBound();
464 if(m_stackTop[rr.m_Offset].m_ptrRight<0)
465 return TRUE;
466 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset++].m_ptrRight,-1));
467 }
468 return TRUE;
469 }else if(rr.m_Offset>0){
470 rr.m_Offset--;
471 return TRUE;
472 }
473 // We're at the leftmost element in page - go up and left until we're
474 // done or we have data.
475 m_btStack.RemoveAt(m_btStack.GetUpperBound());
476 while(m_btStack.GetSize()){
477 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
478 if(!LoadPage(rr.m_Page,m_stackTop))
479 return FALSE;
480 rr.m_Offset--;
481 if(rr.m_Offset>=0)
482 return TRUE;
483 m_btStack.RemoveAt(m_btStack.GetUpperBound());
484 }
485 // No more data - we were at the first element in tree.
486 return FALSE;
487 }
488 BOOL GetThis(key& _key,value& _value) {
489 if(!IsOpened())
490 return FALSE;
491 // *** MORE CHECKING
492 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
493 if(!LoadPage(rr.m_Page,m_stackTop))
494 return FALSE;
495 _key = m_stackTop[rr.m_Offset].m_Key;
496 _value = m_stackTop[rr.m_Offset].m_Value;
497 return TRUE;
498 }
499
500 BOOL SeekToPage(const key& _key) {
501 ASSERT(IsOpened());
502 ASSERT(m_BTCrap->m_bRootSet);
503 m_btStack.RemoveAll();
504 m_btStack.Add(CBTRecordRef(m_BTCrap->m_Root,-1));
505 for(;;){
506 CBTRecordRef& rr = m_btStack[m_btStack.GetUpperBound()];
507 if(!LoadPage(rr.m_Page,m_stackTop))
508 return FALSE;
509 ASSERT(m_stackTop.GetSize() || !m_btStack.GetUpperBound());
510 if(!m_stackTop.GetSize()){
511 rr.m_Offset=-1;
512 return TRUE;
513 }
514 for(rr.m_Offset=0;rr.m_Offset<m_stackTop.GetSize();rr.m_Offset++){
515 if(_key == m_stackTop[rr.m_Offset].m_Key)
516 return TRUE;
517 if(_key < m_stackTop[rr.m_Offset].m_Key){
518 ASSERT(rr.m_Offset==0 || m_stackTop[rr.m_Offset].m_ptrLeft==m_stackTop[rr.m_Offset-1].m_ptrRight);
519 if(m_stackTop[rr.m_Offset].m_ptrLeft<0)
520 return TRUE;
521 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrLeft,-1));
522 break;
523 }
524 if(rr.m_Offset==m_stackTop.GetUpperBound()){
525 if(m_stackTop[rr.m_Offset].m_ptrRight<0){
526 rr.m_Offset=-1;
527 return TRUE;
528 }
529 m_btStack.Add(CBTRecordRef(m_stackTop[rr.m_Offset].m_ptrRight,-1));
530 break;
531 }
532 }
533 }
534 }
535
536 BOOL LoadPage(CBTPageRef ref,CBTPage& page) {
537 CFile* pageFile = m_BT.OpenFile(ref);
538 if(!pageFile)
539 return FALSE;
540 BOOL rv = TRUE;
541 try{
542 CArchive ar(pageFile,CArchive::load);
543 page.Serialize(ar);
544 if(m_bRO)
545 page.FreeExtra();// ** ???
546 ar.Close();
547 }catch(CException* e){
548 e->Delete();
549 rv = FALSE;
550 }
551 delete pageFile;
552 return rv;
553 }
554 BOOL SavePage(CBTPageRef ref,CBTPage& page) {
555 CFile* pageFile = m_BT.OpenFile(ref);
556 if(!pageFile)
557 return FALSE;
558 BOOL rv = TRUE;
559 try{
560 CArchive ar(pageFile,CArchive::store);
561 page.Serialize(ar);
562 ar.Close();
563 }catch(CException* e){
564 e->Delete();
565 rv = FALSE;
566 }
567 delete pageFile;
568 return rv;
569 }
570 CBTPageRef AllocatePage() {
571 CBTDynaFile* pageFile = m_BT.CreateFile();
572 if(!pageFile)
573 return -1;
574 CBTPage nothing;
575 CBTPageRef rv = pageFile->GetFile();
576 try{
577 CArchive ar(pageFile,CArchive::store);
578 nothing.Serialize(ar);
579 ar.Close();
580 }catch(CException* e){
581 e->Delete();
582 rv = -1;
583 }
584 delete pageFile;
585 return rv;
586 }
587 BOOL DeallocatePage(CBTPageRef ref) {
588 return m_BT.DeleteFile(ref);
589 }
590
591};
592
593};
594
595 #endif// __BTREENDEX_H
diff --git a/shared-code/BellsNWhistles.h b/shared-code/BellsNWhistles.h
new file mode 100644
index 0000000..1de77ae
--- a/dev/null
+++ b/shared-code/BellsNWhistles.h
@@ -0,0 +1,146 @@
1 #ifndef__BELLSNWHISTLES_H
2#define __BELLSNWHISTLES_H
3
4 class CBellsNWhistles{
5public:
6 class CBang {
7 public:
8 CString m_codeName;
9 enum_bangType {
10 bangNone, bangSpeaker, bangSystem, bangResource,
11 bangWaveform
12 }m_type;
13 BOOL m_bLoop;
14 union{
15 UINT system;
16 LPCTSTR resource;
17 LPCTSTR wave;
18
19 LPCTSTR str;
20 UINT id;
21 };
22 CString m_strWave;
23 CBang() : m_type(bangNone), m_bLoop(FALSE) {}
24 };
25 typedef CTypedPtrMap<CMapStringToPtr,CString,CBang*> CBangs;
26 structCBelling {
27 LPCSTR snd;
28 HMODULE hm;
29 DWORD flags;
30 CBelling(LPCSTR snd,HMODULE hm,DWORD flags) : snd(snd), hm(hm),
31 flags(flags) {}
32 CBelling(CBelling& s) : snd(s.snd), hm(s.hm), flags(s.flags) {}
33 CBelling& operator=(CBelling& s) {
34 snd=s.snd; hm=s.hm; flags=s.flags;
35 return *this;
36 }
37 };
38 typedef CBelling* Whistling;
39
40 CBangs m_bangs;
41
42 ~CBellsNWhistles() {
43 POSITION p = m_bangs.GetStartPosition();
44 while(p){
45 CString s; CBang* b;
46 m_bangs.GetNextAssoc(p,s,b);
47 delete b;
48 }
49 m_bangs.RemoveAll();
50 }
51
52 BOOL AssignSound(LPCTSTR codeName,LPCTSTR id,CBang::_bangType type=CBang::bangWaveform) {
53 CString cn = codeName;
54 cn.MakeLower();
55 CBang* b;
56 if(!m_bangs.Lookup(cn,b)) {
57 b = new CBang;
58 b->m_codeName=cn;
59 m_bangs[cn]=b;
60 }
61 b->m_type=type;
62 b->str = id;
63 if(type==CBang::bangWaveform){
64 b->m_strWave=id; b->str = b->m_strWave;
65 }
66 return TRUE;
67 }
68 BOOL AssignSound(LPCTSTR codeName,UINT nID,CBang::_bangType type=CBang::bangResource) {
69 CString cn = codeName;
70 cn.MakeLower();
71 CBang* b;
72 if(!m_bangs.Lookup(cn,b)) {
73 b = new CBang;
74 b->m_codeName=cn;
75 m_bangs[cn]=b;
76 }
77 b->m_type=type;
78 b->id = nID;
79 ASSERT(type!=CBang::bangWaveform);
80 return TRUE;
81 }
82 BOOL UnassignSound(LPCTSTR codeName) {
83 CString cn = codeName;
84 cn.MakeLower();
85 CBang* b;
86 if(m_bangs.Lookup(cn,b)) {
87 m_bangs.RemoveKey(cn);
88 delete b;
89 return TRUE;
90 }
91 return FALSE;
92 }
93
94 Whistling StartSound(LPCTSTR codeName) {
95 Whistling* rv = NULL;
96 CString cn = codeName;
97 CBang* b;
98 if(!m_bangs.Lookup(cn,b)){
99 ::PlaySound(cn,AfxGetInstanceHandle(),SND_ASYNC|SND_NODEFAULT|SND_NOWAIT|SND_FILENAME);
100 return NULL;
101 }
102 UINT flags = SND_ASYNC|SND_NODEFAULT|SND_NOWAIT;
103 LPCSTR snd = NULL;
104 switch(b->m_type){
105 case CBang::bangNone: return NULL;
106 case CBang::bangSpeaker: MessageBeep(0xFFFFFFFF); return NULL;
107 case CBang::bangSystem: MessageBeep(b->system); return NULL;
108 case CBang::bangResource:
109 snd = b->resource;
110 flags|=SND_RESOURCE; break;
111 case CBang::bangWaveform:
112 snd = b->wave;
113 flags|=SND_FILENAME; break;
114#ifdef _DEBUG
115 default:
116 ASSERT(FALSE); return NULL;
117#endif
118 }
119 if(b->m_bLoop)
120 flags|=SND_LOOP;
121 HMODULE hm = AfxGetInstanceHandle();
122 if(!::PlaySound(snd,hm,flags))
123 return NULL;
124 return b->m_bLoop?new CBelling(snd,hm,flags):NULL;
125 }
126 BOOL StopSound(Whistling whistle) {
127 if(!whistle)
128 return FALSE;
129 ::PlaySound(whistle->snd,whistle->hm,whistle->flags|SND_PURGE);
130 delete whistle;
131 return TRUE;
132 }
133 UINT FillInCombo(CComboBox* combo) {
134 POSITION p = m_bangs.GetStartPosition();
135 UINT rv = 0;
136 while(p) {
137 CString s;
138 CBang* b;
139 m_bangs.GetNextAssoc(p,s,b);
140 combo->AddString(s);
141 }
142 return rv;
143 }
144};
145
146 #endif// _BELLSNWHISTLES_H \ No newline at end of file
diff --git a/shared-code/BitSet.h b/shared-code/BitSet.h
new file mode 100644
index 0000000..cf36e3b
--- a/dev/null
+++ b/shared-code/BitSet.h
@@ -0,0 +1,105 @@
1 #ifndef__BITSET_H
2#define __BITSET_H
3
4namespace Klever {
5
6 class CBitSet: public CObject {
7public:
8 CWordArray m_Bits;
9 ULONG m_BitsInSet;
10 enum{
11 bitsPerWord = sizeof(WORD)*8
12 };
13
14 CBitSet(ULONG size = 0) : m_BitsInSet(0) { SetSize(size); }
15 CBitSet(CBitSet& o) : m_BitsInSet(0) { CopyFrom(o); }
16
17 void SetSize(ULONG size,BOOL bFillOnes=FALSE) {
18 UINT os = m_Bits.GetSize();
19 UINT ns = (size+bitsPerWord-1)/bitsPerWord;
20 if(os==ns){
21 if(os){
22 if(bFillOnes)
23 m_Bits[m_BitsInSet/bitsPerWord]|=(~(WORD)0)<<(m_BitsInSet%bitsPerWord);
24 else
25 m_Bits[m_BitsInSet/bitsPerWord]&=~((~(WORD)0)<<(m_BitsInSet%bitsPerWord));
26 }
27 m_BitsInSet=size;
28 }else{
29 // *?* ASSERT((!os) || (((os-1)*bitsPerWord)<=m_BitsInSet && m_BitsInSet<(os*bitsPerWord)));
30 if(os<ns){
31 m_Bits.SetSize(ns);
32 if(bFillOnes)
33 m_Bits[m_BitsInSet/bitsPerWord]|=(~(WORD)0)<<(m_BitsInSet%bitsPerWord);
34 else
35 m_Bits[m_BitsInSet/bitsPerWord]&=~((~(WORD)0)<<(m_BitsInSet%bitsPerWord));
36 WORD* ws = m_Bits.GetData();
37 ASSERT(ws);
38 memset(&ws[os],bFillOnes?0xFF:0,(ns-os)*sizeof(WORD));
39 m_BitsInSet=size;
40 }else{
41 m_Bits.SetSize(ns);
42 m_BitsInSet=size;
43 }
44 }
45 }
46 BOOL BitSet(UINT bit,BOOL bGrow=TRUE) { return SetBit(bit,TRUE,bGrow); }
47 BOOL BitClear(UINT bit,BOOL bGrow=TRUE) { return SetBit(bit,FALSE,bGrow); }
48 BOOL SetBit(UINT bit,BOOL state,BOOL bGrow=TRUE) {
49 if(m_BitsInSet<=bit){
50 if(!bGrow)
51 return FALSE;
52 SetSize(bit+1);
53 }
54 WORD mask = ((WORD)1)<<(bit%bitsPerWord);
55 if(state)
56 m_Bits[bit/bitsPerWord]|=mask;
57 else
58 m_Bits[bit/bitsPerWord]&=~mask;
59 return TRUE;
60 }
61 BOOL IsSet(UINT bit) {
62 if(m_BitsInSet<=bit)
63 return FALSE;
64 return (m_Bits[bit/bitsPerWord]&(((WORD)1)<<(bit%bitsPerWord)))!=0;
65 }
66 void Invert() {
67 for(int i=m_Bits.GetUpperBound();i>=0;i--)
68 m_Bits[i]=~m_Bits[i];
69 }
70 CBitSet& operator&=(CBitSet& o) {
71 if(o.m_BitsInSet<m_BitsInSet)
72 SetSize(o.m_BitsInSet);
73 for(int i=m_Bits.GetUpperBound();i>=0;i--)
74 m_Bits[i]&=o.m_Bits[i];
75 return *this;
76 }
77 CBitSet& operator|=(CBitSet& o) {
78 if(o.m_BitsInSet>m_BitsInSet)
79 SetSize(o.m_BitsInSet);
80 for(int i=o.m_Bits.GetUpperBound();i>=0;i--)
81 m_Bits[i]|=o.m_Bits[i];
82 return *this;
83 }
84 CBitSet& operator=(CBitSet& o) {
85 CopyFrom(o);
86 return *this;
87 }
88 void CopyFrom(CBitSet& o) {
89 m_BitsInSet=o.m_BitsInSet;
90 m_Bits.Copy(o.m_Bits);
91 }
92 void Serialize(CArchive& ar) {
93 if(ar.IsStoring()){
94 ar << m_BitsInSet;
95 m_Bits.Serialize(ar);
96 }else{
97 ar >> m_BitsInSet;
98 m_Bits.Serialize(ar);
99 }
100 }
101};
102
103};
104
105#endif // __BITSET_H
diff --git a/shared-code/Dynamide.h b/shared-code/Dynamide.h
new file mode 100644
index 0000000..32c93f7
--- a/dev/null
+++ b/shared-code/Dynamide.h
@@ -0,0 +1,443 @@
1#ifndef __DYNAMIDE_H
2#define __DYNAMIDE_H
3
4#include "LRUCache.h"
5
6namespace Klever {
7
8template<int fbSize,int bSize>
9class CDynamide : public CObject {
10 structfirstBlock {
11 LONGfreeFile;
12 BYTEcrap[fbSize-sizeof(LONG)];
13 };
14 structtheBlock {
15 LONGnext;
16 BYTEdata[bSize-sizeof(LONG)];
17 };
18public:
19 static firstBlock FirstBlock;
20 static theBlock TheBlock;
21private:
22 classCDynaCache : public CLRUCache<DWORD,DWORD,theBlock> {
23 public:
24 CFile* m_File;
25 BOOL m_bAutodelete;
26 CDynaCache(CFile* file,BOOL bAutodelete=TRUE) : CLRUCache<DWORD,DWORD,theBlock>(64) {
27 m_File=file;
28 m_bAutodelete=bAutodelete;
29 }
30 virtual ~CDynaCache() {
31 Flush();
32 if(m_bAutodelete){
33 m_File->Close();
34 delete m_File;
35 }
36 }
37 virtual BOOL _ReadIn(DWORD idx,theBlock* data) {
38 LONG p = sizeof(firstBlock)+idx*sizeof(theBlock);
39 LONG s = m_File->Seek(p,CFile::begin);
40 if(p==s){
41 UINT rb = m_File->Read(data,sizeof(*data));
42 if(rb==sizeof(*data))
43 return TRUE;
44 if(rb)
45 return FALSE;
46 memset(data,0,sizeof(*data));
47 data->next=-1;
48 try{
49 m_File->Write(data,sizeof(*data));
50 }catch(CException* e){
51 e->Delete();
52 return FALSE;
53 }
54 }else{
55 LONG togo = p-s;
56 ASSERT(togo>0);
57 ASSERT(!(togo%sizeof(theBlock)));
58 memset(data,0,sizeof(*data));
59 data->next=-1;
60 while(togo>=0){
61 try{
62 m_File->Write(data,sizeof(*data));
63 }catch(CException* e){
64 e->Delete();
65 return FALSE;
66 }
67 }
68 }
69 return TRUE;
70 }
71 virtual BOOL _WriteOut(DWORD idx,theBlock* data) {
72 LONG p = sizeof(firstBlock)+idx*sizeof(theBlock);
73 LONG s = m_File->Seek(p,CFile::begin);
74 if(p!=s)
75 return FALSE;
76 try{
77 m_File->Write(data,sizeof(*data));
78 }catch(CException* e){
79 e->Delete();
80 return FALSE;
81 }
82 return TRUE;
83 }
84 DWORD AllocateNode() {
85 LONG l = m_File->GetLength();
86 ASSERT(!((l-sizeof(firstBlock))%sizeof(theBlock)));
87 m_File->SetLength(l+sizeof(theBlock));
88 return (l-sizeof(firstBlock))/sizeof(theBlock);
89 }
90 BOOL Read1stBlock(firstBlock* fb) {
91 m_File->SeekToBegin();
92 UINT rb = m_File->Read(fb,sizeof(*fb));
93 if(rb==sizeof(*fb))
94 return TRUE;
95 if(rb)
96 return FALSE;
97 memset(fb,0,sizeof(*fb));
98 fb->freeFile = -1;
99 try{
100 m_File->Write(fb,sizeof(*fb));
101 }catch(CException* e){
102 e->Delete();
103 return FALSE;
104 }
105 return TRUE;
106 }
107 BOOL Write1stBlock(firstBlock* fb) {
108 m_File->SeekToBegin();
109 try{
110 m_File->Write(fb,sizeof(*fb));
111 }catch(CException* e){
112 e->Delete();
113 return FALSE;
114 }
115 return TRUE;
116 }
117 };
118public:
119 class CDynaFile : public CFile{
120 public:
121 CDynamide<fbSize,bSize>* m_Daddy;
122 CArray<LONG,LONG> m_Blocks;
123 LONG m_Position;
124
125 CDynaFile(CDynamide<fbSize,bSize>* daddy) : m_Daddy(NULL) { AttachToDaddy(daddy); }
126 virtual ~CDynaFile() { Close(); DetachFromDaddy(); }
127
128 void AttachToDaddy(CDynamide<fbSize,bSize>* daddy) {
129 ASSERT(!m_Daddy);
130 ASSERT(daddy);
131 m_Daddy=daddy;
132 m_Daddy->AttachDynaFile(this);
133 }
134 void DetachFromDaddy() {
135 ASSERT(m_Daddy);
136 ASSERT(!IsOpened());
137 m_Daddy->DetachDynaFile(this);
138 m_Daddy=NULL;
139 }
140
141 BOOL Create() {
142 if(IsOpened())
143 return FALSE;
144 m_Blocks.SetAtGrow(0,m_Daddy->Allocate());
145 ASSERT(m_Blocks[0]>=0);
146 m_Position=0;
147 return TRUE;
148 }
149 BOOL Open(LONG fb) {
150 if(IsOpened())
151 return FALSE;
152 ASSERT(fb>=0);
153 theBlock* b;
154 do{
155 m_Blocks.Add(fb);
156 b = m_Daddy->m_File->GetCached(fb);
157 ASSERT(b);
158 fb=b->next;
159 if(m_Blocks[m_Blocks.GetUpperBound()]==fb)
160 return FALSE;
161 }while(fb>=0);
162 m_Position=0;
163 return TRUE;
164 }
165
166 LONG GetFile() {
167 if(!IsOpened())
168 return -1;
169 return m_Blocks[0];
170 }
171 virtual DWORD GetPosition() const {
172 if(!IsOpened())
173 return 0;
174 if(m_Position<0)
175 return 0;
176 if(m_Position>GetLength())
177 return GetLength();
178 return m_Position;
179 }
180 virtual CString GetFileName() {
181 CString rv;
182 if(IsOpened())
183 rv.Format("0x%08lX",m_Blocks[0]);
184 else
185 rv.Format("None");
186 return rv;
187 }
188 virtual CString GetFileTitle() { return GetFileName(); }
189 virtual CString GetFilePath() { return GetFileName(); }
190 virtual void SetFilePath(LPCTSTR lpszNewName) { ASSERT(FALSE); }
191
192 virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags, CFileException* pError = NULL) { ASSERT(FALSE); return FALSE; }
193 virtual CFile* Duplicate() { ASSERT(FALSE); return NULL; }
194
195 virtual LONG Seek(LONG lOff, UINT nFrom) {
196 if(!IsOpened())
197 return -1;
198 switch(nFrom){
199 case CFile::begin:
200 m_Position=lOff;
201 break;
202 case CFile::current:
203 m_Position+=lOff;
204 break;
205 case CFile::end:
206 m_Position=GetLength()+lOff;
207 break;
208 default:
209 ASSERT(FALSE);
210 return -1;
211 }
212 if(m_Position<0)
213 m_Position=0;
214 if(m_Position>GetLength())
215 m_Position=GetLength();
216 return m_Position;
217 }
218 virtual void SetLength(DWORD dwNewLen) {
219 if(!IsOpened())
220 return;
221 if(dwNewLen<GetLength()){
222 dwNewLen=dwNewLen+sizeof(TheBlock.data);
223 dwNewLen-=dwNewLen%sizeof(TheBlock.data);
224 while(dwNewLen<GetLength() && m_Blocks.GetSize()>1){
225 LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
226 LONG mb1 = m_Blocks[m_Blocks.GetUpperBound()-1];
227 theBlock* b = m_Daddy->m_File->GetCached(mb1);
228 ASSERT(b);
229 ASSERT(b->next==mb);
230 b->next=-1;
231 m_Daddy->m_File->MakeDirty(mb1);
232 m_Daddy->Deallocate(mb);
233 m_Blocks.SetSize(m_Blocks.GetSize()-1);
234 }
235 }else{
236 while(dwNewLen>GetLength()){
237 LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
238 LONG newBlock = m_Daddy->Allocate();
239 ASSERT(newBlock>=0);
240 theBlock* b = m_Daddy->m_File->GetCached(mb);
241 ASSERT(b);
242 ASSERT(b->next<0);
243 b->next=newBlock;
244 m_Daddy->m_File->MakeDirty(mb);
245 m_Blocks.Add(newBlock);
246 }
247 }
248 }
249 virtual DWORD GetLength() const {
250 return ((long)m_Blocks.GetSize())*((long)sizeof(TheBlock.data));
251 }
252
253 virtual UINT Read(void* lpBuf, UINT nCount) {
254 UINT rv = 0;
255 ASSERT(m_Position>=0 && m_Position<=GetLength());
256 LPBYTE data = (LPBYTE)lpBuf;
257 while(nCount && m_Position<GetLength()){
258 UINT bn = m_Position/sizeof(TheBlock.data);
259 UINT bo = m_Position%sizeof(TheBlock.data);
260 theBlock* b = m_Daddy->m_File->GetCached(m_Blocks[bn]);
261 ASSERT(b);
262 UINT bc = min(nCount,sizeof(TheBlock.data)-bo);
263 memmove(data,&b->data[bo],bc);
264 nCount-=bc;
265 data=&data[bc];
266 rv+=bc;
267 m_Position+=bc;
268 }
269 return rv;
270 }
271 virtual void Write(const void* lpBuf, UINT nCount) {
272 ASSERT(m_Position>=0 && m_Position<=GetLength());
273 LPBYTE data = (LPBYTE)lpBuf;
274 while(nCount){
275 UINT bn = m_Position/sizeof(TheBlock.data);
276 UINT bo = m_Position%sizeof(TheBlock.data);
277 while(bn>=m_Blocks.GetSize()){
278 LONG mb = m_Blocks[m_Blocks.GetUpperBound()];
279 LONG newBlock = m_Daddy->Allocate();
280 ASSERT(newBlock>=0);
281 theBlock* b = m_Daddy->m_File->GetCached(mb);
282 ASSERT(b);
283 ASSERT(b->next<0);
284 b->next=newBlock;
285 m_Daddy->m_File->MakeDirty(mb);
286 m_Blocks.Add(newBlock);
287 }
288 theBlock* b = m_Daddy->m_File->GetCached(m_Blocks[bn]);
289 ASSERT(b);
290 UINT bc = min(nCount,sizeof(TheBlock.data)-bo);
291 memmove(&b->data[bo],data,bc);
292 m_Daddy->m_File->MakeDirty(m_Blocks[bn]);
293 nCount-=bc;
294 data=&data[bc];
295 m_Position+=bc;
296 }
297 }
298
299 virtual void LockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); }
300 virtual void UnlockRange(DWORD dwPos, DWORD dwCount) { ASSERT(FALSE); }
301
302 virtual void Abort() { ASSERT(FALSE); }
303 virtual void Flush() {
304 m_Daddy->m_File->Flush();
305 }
306 virtual void Close() {
307 m_Blocks.RemoveAll();
308 }
309
310 BOOL IsOpened() const { return m_Blocks.GetSize()!=0; }
311 };
312
313 CDynaCache* m_File;
314 firstBlock m_FB;
315
316 CDynamide() : m_File(NULL) {}
317 ~CDynamide() { Close(); }
318
319 BOOL AttachDynaFile(CDynaFile* f) {
320 //ASSERT(!m_Files.Find(f));
321 //m_Files.AddHead(f);
322 return TRUE;
323 }
324 BOOL DetachDynaFile(CDynaFile* f) {
325 //POSITION p = m_Files.Find(f);
326 //ASSERT(p);
327 //m_Files.RemoveAt(p);
328 return TRUE;
329 }
330
331 BOOL Open(LPCTSTR file,BOOL bRO=FALSE) {
332 Close();
333 try{
334 CFile* f = new CFile(file,CFile::typeBinary|(bRO?CFile::modeRead|CFile::shareDenyWrite:CFile::modeReadWrite|CFile::shareDenyRead));
335 return Attach(f,TRUE);
336 }catch(CException* e){
337 e->Delete();
338 return FALSE;
339 }
340 }
341 BOOL Create(LPCTSTR file) {
342 Close();
343 try{
344 CFile* f = new CFile(file,CFile::typeBinary|CFile::modeCreate|CFile::modeReadWrite|CFile::shareDenyRead);
345 return Attach(f,TRUE);
346 }catch(CException* e){
347 e->Delete();
348 return FALSE;
349 }
350 }
351 BOOL Attach(CFile* file,BOOL bAutodelete=TRUE) {
352 if(IsOpened())
353 return FALSE;
354 m_File = new CDynaCache(file,bAutodelete);
355 if(!m_File->Read1stBlock(&m_FB)){
356 memset(&m_FB,0,sizeof(m_FB));
357 m_FB.freeFile=-1;
358 VERIFY(m_File->Write1stBlock(&m_FB));
359 }
360 return IsOpened();
361 }
362 // CFile* Detach();
363 BOOL Close() {
364 if(!IsOpened())
365 return FALSE;
366 m_File->Write1stBlock(&m_FB);
367 delete m_File;
368 m_File=NULL;
369 return TRUE;
370 }
371 BOOL IsOpened() {
372 return m_File != NULL;
373 }
374 BOOL Write1stBlock(void) {
375 if(!IsOpened())
376 return FALSE;
377 VERIFY(m_File->Write1stBlock(&m_FB));
378 return TRUE;
379 }
380
381 CDynaFile* CreateFile() {
382 CDynaFile* rv = new CDynaFile(this);
383 if(rv->Create())
384 return rv;
385 delete rv;
386 return NULL;
387 }
388 CDynaFile* OpenFile(LONG fb) {
389 CDynaFile* rv = new CDynaFile(this);
390 if(rv->Open(fb))
391 return rv;
392 delete rv;
393 return NULL;
394 }
395 BOOL DeleteFile(LONG fb) {
396 while(fb>=0){
397 theBlock* b = m_File->GetCached(fb);
398 LONG nb = b->next;
399 Deallocate(fb);
400 fb=nb;
401 }
402 return TRUE;
403 }
404
405 LONG Allocate() {
406 if(!IsOpened())
407 return -1;
408 if(m_FB.freeFile<0){
409 LONG rv = m_File->AllocateNode();
410 theBlock *b = m_File->GetCached(rv);
411 b->next=-1;
412 m_File->MakeDirty(rv);
413 return rv;
414 }
415 LONG rv = m_FB.freeFile;
416 theBlock *b = m_File->GetCached(rv);
417 m_FB.freeFile=b->next;
418 b->next=-1;
419 m_File->MakeDirty(rv);
420 m_File->Write1stBlock(&m_FB);
421 return rv;
422 }
423 BOOL Deallocate(LONG bk) {
424 if(!IsOpened())
425 return FALSE;
426 theBlock* b = m_File->GetCached(bk);
427 ASSERT(b);
428 if(m_FB.freeFile<0){
429 b->next=-1;
430 m_FB.freeFile=bk;
431 }else{
432 b->next=m_FB.freeFile;
433 m_FB.freeFile=bk;
434 }
435 m_File->MakeDirty(bk);
436 m_File->Write1stBlock(&m_FB);
437 return TRUE;
438 }
439};
440
441};
442
443#endif // __DYNAMIDE_H
diff --git a/shared-code/FindIFace.h b/shared-code/FindIFace.h
new file mode 100644
index 0000000..8dec8c4
--- a/dev/null
+++ b/shared-code/FindIFace.h
@@ -0,0 +1,125 @@
1 #ifndef__FINDIFACE_H
2 #define__FINDIFACE_H
3
4#include "SNMPeer.h"
5#include "SNMPExtDLL.h"
6#include "SNMPOIDs.h"
7
8namespace Klever {
9
10inline BOOL FindIFace(in_addr& target,in_addr& source)
11{
12 DEFINE_OID(ipRouteDest, OIDipRouteDest);
13 DEFINE_OID(ipRouteMask, OIDipRouteMask);
14 DEFINE_OID(ipRouteIfIndex,OIDipRouteIfIndex);
15 DEFINE_OID(ipRouteMetric1,OIDipRouteMetric1);
16 DEFINE_OID(ipAdEntIfIndex,OIDipAdEntIfIndex);
17 DEFINE_OID(ipAdEntAddr, OIDipAdEntAddr);
18 struct _route{
19 int iface;
20 int metric;
21 DWORD nm;
22 }routes[16];
23int nRoutes = 0;
24CSNMPVarBindList vbl;
25 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteDest,sizeof(ipRouteDest))));
26 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMask,sizeof(ipRouteMask))));
27 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteIfIndex,sizeof(ipRouteIfIndex))));
28 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipRouteMetric1,sizeof(ipRouteMetric1))));
29CSNMPExtDLL snmp("INETMIB1");
30 while(nRoutes<(sizeof(routes)/sizeof(routes[0]))){
31 if(
32 snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl)
33 && vbl.GetCount() == 4
34 ){
35 POSITION p = vbl.GetHeadPosition();
36 _route r = {-1,-1};
37 in_addr d, m;
38 BOOL bD = FALSE, bM = FALSE;
39 while(p){
40 CSNMPVarBind& vb = vbl.GetNext(p);
41 if(
42 vb.IsName(ipRouteDest,sizeof(ipRouteDest))
43 && vb.value.type==CASNAny::typeASNIP
44 ){
45 d.s_addr=vb.value.value.ip.s_addr; bD = TRUE;
46 }else if(
47 vb.IsName(ipRouteMask,sizeof(ipRouteMask))
48 && vb.value.type==CASNAny::typeASNIP
49 ){
50 m.s_addr=vb.value.value.ip.s_addr; bM = TRUE;
51 }else if(
52 vb.IsName(ipRouteIfIndex,sizeof(ipRouteIfIndex))
53 && vb.value.type==CASNAny::typeASNInteger
54 ){
55 r.iface=vb.value.value.number;
56 }else if(
57 vb.IsName(ipRouteMetric1,sizeof(ipRouteMetric1))
58 && vb.value.type==CASNAny::typeASNInteger
59 ){
60 r.metric=vb.value.value.number;
61 }else
62 break;
63 }
64 if(r.iface<0 || r.metric<0 || (!bD) || (!bM))
65 break;
66 if((target.s_addr&m.s_addr)==(d.s_addr&m.s_addr)){
67 r.nm=htonl(m.s_addr);
68 memmove(&routes[nRoutes++],&r,sizeof(routes[0]));
69 }
70 }else
71 break;
72 }
73 if(!nRoutes)
74 return FALSE;
75int rn = 0;
76 if(nRoutes>1){
77 for(int tmp=1;tmp<nRoutes;tmp++)
78 if(
79 routes[tmp].metric<routes[rn].metric
80 || routes[tmp].nm>routes[rn].nm
81 )
82 rn = tmp;
83 }
84int iface = routes[rn].iface;
85 vbl.RemoveAll();
86 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntAddr,sizeof(ipAdEntAddr))));
87 vbl.AddTail(CSNMPVarBind(CASNAny(CASNAny::typeASNOID,ipAdEntIfIndex,sizeof(ipAdEntIfIndex))));
88 for(;;){
89 if(
90 snmp.Request(CASNAny::typeASNGetNextRequest,vbl,vbl)
91 && vbl.GetCount()==2
92 ){
93 in_addr a; a.s_addr = INADDR_NONE;
94 int ifn = -1;
95 POSITION p = vbl.GetHeadPosition();
96 while(p){
97 CSNMPVarBind& vb = vbl.GetNext(p);
98 if(
99 vb.IsName(ipAdEntAddr,sizeof(ipAdEntAddr))
100 && vb.value.type==CASNAny::typeASNIP
101 ){
102 a.s_addr=vb.value.value.ip.s_addr;
103 }else if(
104 vb.IsName(ipAdEntIfIndex,sizeof(ipAdEntIfIndex))
105 && vb.value.type==CASNAny::typeASNInteger
106 ){
107 ifn = vb.value.value.number;
108 }else
109 break;
110 }
111 if(ifn<0)
112 break;
113 if(ifn==iface){
114 source.s_addr=a.s_addr;
115 return TRUE;
116 }
117 }else
118 break;
119 }
120 return FALSE;
121}
122
123};
124
125 #endif// __FINDIFACE_H
diff --git a/shared-code/LRUCache.h b/shared-code/LRUCache.h
new file mode 100644
index 0000000..569e829
--- a/dev/null
+++ b/shared-code/LRUCache.h
@@ -0,0 +1,113 @@
1 #ifndef__LRUCACHE_H
2 #define__LRUCACHE_H
3
4namespace Klever {
5
6template<class IDX,class ARGIDX,class DATA>
7class CLRUCache : public CObject {
8public:
9 struct CacheEntry{
10 enum cacheState{
11 cacheClean, cacheDirty, cacheEmpty
12 };
13 cacheStatem_State;
14 UINT m_hits;
15
16 IDX m_idx;
17 DATA* m_pData;
18
19 CacheEntry() { m_State=cacheEmpty; VERIFY(m_pData=new DATA); m_hits=0; }
20 virtual ~CacheEntry() { delete m_pData; }
21 };
22 typedef CMap<IDX,ARGIDX,CacheEntry*,CacheEntry*> CCacheMap;
23 typedef CList<CacheEntry*,CacheEntry*> CCacheList;
24
25 CCacheList m_Cache;
26 CCacheMap m_Map;
27
28 CLRUCache(UINT cacheSize){
29 for(int tmp=0;tmp<cacheSize;tmp++){
30 CacheEntry* p = new CacheEntry;
31 m_Cache.AddTail(p);
32 }
33 }
34 virtual ~CLRUCache(){
35 Flush();
36 POSITION p = m_Cache.GetHeadPosition();
37 while(p){
38 CacheEntry* c = m_Cache.GetNext(p);
39 delete c;
40 }
41 }
42
43 DATA* GetCached(ARGIDX idx,BOOL bLoad=TRUE) {
44 CacheEntry* rv;
45 if(m_Map.Lookup(idx,rv)){
46 rv->m_hits++;
47 PopUp(rv);
48 return rv->m_pData;
49 }
50 if(!bLoad)
51 return NULL;
52 rv = m_Cache.GetTail();
53 ASSERT(rv);
54 switch(rv->m_State){
55 case CacheEntry::cacheDirty:
56 FlushEntry(rv);
57 case CacheEntry::cacheClean:
58 m_Map.RemoveKey(rv->m_idx);
59 rv->m_State=CacheEntry::cacheEmpty;
60 case CacheEntry::cacheEmpty:
61 break;
62 default:
63 ASSERT(FALSE);
64 }
65 if(!_ReadIn(idx,rv->m_pData))
66 return NULL;
67 rv->m_hits=1;
68 rv->m_State=CacheEntry::cacheClean;
69 rv->m_idx=idx;
70 m_Map[idx]=rv;
71 PopUp(rv);
72 return rv->m_pData;
73 }
74 BOOL MakeDirty(ARGIDX idx) {
75 CacheEntry* pEntry;
76 if(m_Map.Lookup(idx,pEntry)){
77 ASSERT(pEntry->m_State==CacheEntry::cacheClean || pEntry->m_State==CacheEntry::cacheDirty);
78 pEntry->m_State=CacheEntry::cacheDirty;
79 return TRUE;
80 }
81 return FALSE;
82 }
83 BOOL Flush() {
84 POSITION p = m_Cache.GetHeadPosition();
85 while(p){
86 CacheEntry* pEntry = m_Cache.GetNext(p);
87 ASSERT(pEntry);
88 FlushEntry(pEntry);
89 }
90 return TRUE;
91 }
92 BOOL FlushEntry(CacheEntry* pEntry) {
93 if(pEntry->m_State==CacheEntry::cacheDirty){
94 BOOL rv = _WriteOut(pEntry->m_idx,pEntry->m_pData);
95 if(rv)
96 pEntry->m_State=CacheEntry::cacheClean;
97 }
98 return FALSE;
99 }
100 void PopUp(CacheEntry* pEntry) {
101 POSITION p = m_Cache.Find(pEntry);
102 ASSERT(p);
103 m_Cache.RemoveAt(p);
104 VERIFY(m_Cache.AddHead(pEntry));
105 }
106
107 virtualBOOL _ReadIn(ARGIDX idx,DATA* data) = 0;
108 virtual BOOL _WriteOut(ARGIDX idx,DATA* data) = 0;
109};
110
111};
112
113 #endif// __LRUCACHE_H
diff --git a/shared-code/RegEx.cpp b/shared-code/RegEx.cpp
new file mode 100644
index 0000000..b7bab62
--- a/dev/null
+++ b/shared-code/RegEx.cpp
@@ -0,0 +1,1697 @@
1#include "../stdafx.h"
2#include "RegEx.h"
3
4 #defineisWordableChar(c) (isalnum(c) || (c)=='_')
5
6BOOL CRegEx::Compile(LPCTSTR regex,int flags)
7{
8 ASSERT(!((flags&regExtended) && (flags&regLiteral)));
9 m_Matches.RemoveAll();
10 m_Strip.RemoveAll();
11 m_Strip.SetSize(0,15);
12 m_Pattern=regex;
13 m_ParsePointer=0;
14 m_Error=0;
15 m_Sets.RemoveAll();
16 m_Flags=flags;
17 m_iFlags=0;
18 m_BOLs=m_EOLs=0;
19 m_Subexps = 0;
20 m_Categories=1;// 0 is 'everything else'
21 m_bBackRefs=FALSE;
22 memset(m_Category,0,sizeof(m_Category));
23
24 // Go ahead.
25 m_Error || m_Strip.Add(CSop(CSop::opEnd));
26 if(flags&regExtended){
27 ParseERE();
28 }else if(flags&regLiteral){
29 ParseLiteral();
30 }else{
31 ParseBRE();
32 }
33 m_Error || m_Strip.Add(CSop(CSop::opEnd));
34 Categorize();
35 m_Strip.FreeExtra();
36 FigureMust();
37 m_Pluses=CountPluses();
38 if(m_iFlags&iflagsBad){
39 m_Error || (m_Error=regeAssert);
40 // ??? point to nuls? ;-)
41 }
42 // We may wish to free some memory here if we're erroneous (ie. m_Error..)
43 m_ParseParens.RemoveAll();
44#ifdef _DEBUG
45 if(m_Error){
46 CString tmp;
47 tmp.Format("RE: ParseError: %d\n",m_Error);
48 TRACE0(tmp);
49 }
50 //DumpStrip(afxDump);
51#endif
52 return (m_bCompiled=(!m_Error));
53}
54
55BOOL CRegEx::Match(LPCTSTR src,int flags)
56{
57 if(!m_bCompiled)
58 return FALSE;
59 if(m_iFlags&iflagsBad)
60 return FALSE;
61 m_Input=src;
62 m_mFlags=flags;
63 m_mPointer=m_Input;
64 m_mBegin=m_Input;
65 m_mEnd=&m_mBegin[m_Input.GetLength()];
66 ASSERT(m_mPointer<=m_mEnd);
67 m_Matches.RemoveAll();
68 if(!m_Must.IsEmpty()){
69 if(m_Input.Find(m_Must)<0)
70 return FALSE;
71 }
72 // Go ahead..
73int stripLen = m_Strip.GetSize();
74 m_mLastPos.SetSize(0);
75 for(int tmp=0;tmp<stripLen;tmp++)
76 m_Strip[tmp].m_MatchData=0;
77LPCTSTR beginp = m_mBegin;
78LPCTSTR endp;
79 for(;;){
80 endp = MatchFast(beginp);
81 if(!endp)
82 return FALSE;
83 if((m_mFlags&regNoSubExpressions) && !m_bBackRefs)
84 break;
85 ASSERT(m_cOldP);
86 for(;;){
87 endp = MatchSlow(m_cOldP,m_mEnd,1,stripLen-1);
88 if(endp)
89 break;
90 ASSERT(m_cOldP<m_mEnd);
91 m_cOldP++;
92 }
93 if((m_mFlags&regOneMatch) && !m_bBackRefs)
94 break;
95 // Oh, his, we want the subexpression..
96 m_Matches.SetSize(m_Subexps+1);
97 LPCTSTR dp;
98 if(!m_bBackRefs && !(m_mFlags&regBackRefs)){
99 dp = MatchDissect(m_cOldP,endp,1,stripLen-1);
100 }else{
101 if(m_Pluses>0 && !m_mLastPos.GetSize())
102 m_mLastPos.SetSize(m_Pluses);
103 dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0);
104 }
105 if(dp)
106 break;
107 // Uh.. oh.. we couldn't find a subexpression-level match
108 ASSERT(m_bBackRefs);
109 ASSERT(m_Pluses==0 || m_mLastPos.GetSize());
110 for(;;){
111 if(dp || endp <= m_cOldP)
112 break;// defeat.. ?
113 endp = MatchSlow(m_cOldP,endp-1,1,stripLen-1);
114 if(!endp)
115 break;// defeat.. ?
116 // Try it on a shorter possibility..
117#ifdef _DEBUG
118 for(tmp=1;tmp<=m_Subexps;tmp++)
119 ASSERT(m_Matches[tmp].m_Begin<0 && m_Matches[tmp].m_End<0);
120#endif
121 dp = MatchBackRef(m_cOldP,endp,1,stripLen-1,0);
122 }
123 ASSERT((!dp) || dp==endp);
124 if(dp)// Found a shorter one..
125 break;
126 // Despite initial appearances, there is no match here
127 beginp = m_cOldP+1;
128 ASSERT(beginp<=m_mEnd);
129 }
130 // Fill in the detail if so requested..
131 if(!(m_mFlags&regNoSubExpressions)){
132 if(!m_Matches.GetSize())
133 m_Matches.SetSize(1);
134 m_Matches[0].m_Begin=m_cOldP-m_mBegin;
135 m_Matches[0].m_End=endp-m_mBegin;
136 }
137 m_mLastPos.RemoveAll();
138 return TRUE;
139}
140
141CString CRegEx::Replace(LPCTSTR src,LPCTSTR rep,int flags)
142{
143 // ***
144 return CString();
145}
146
147void CRegEx::ParseERE(int stop)
148{
149UCHAR c;
150BOOL first=TRUE;
151int prevF, prevB;
152 for(;;){
153 int co = m_Strip.GetSize();
154 while(m_ParsePointer < m_Pattern.GetLength() && ((c=m_Pattern[m_ParsePointer])!='|') && c!=stop)
155 ParseEREexp();
156 if(m_Strip.GetSize()==co){
157 m_Error || (m_Error=regeEmpty);
158 // ??? point to nuls?
159 }
160 if(m_ParsePointer>=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='|')
161 break;
162 else
163 m_ParsePointer++;
164 if(first){
165 StripInsert(co,CSop(CSop::opChoice0,m_Strip.GetSize()-co+1));
166 prevF = prevB = co;
167 first=FALSE;
168 }
169 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-prevB));
170 prevB = m_Strip.GetSize()-1;
171 m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF);
172 prevF = m_Strip.GetSize();
173 m_Error || m_Strip.Add(CSop(CSop::opOr1,0));// offset isn't really right.. very so..
174 }
175 if(!first){
176 m_Error || (m_Strip[prevF].m_Operand=m_Strip.GetSize()-prevF);
177 m_Error || m_Strip.Add(CSop(CSop::opChoice1,m_Strip.GetSize()-prevB));
178 }
179 ASSERT(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]==stop);
180}
181
182void CRegEx::ParseEREexp()
183{
184 ASSERT(m_ParsePointer < m_Pattern.GetLength());
185UCHAR c = m_Pattern[m_ParsePointer++];
186int pos = m_Strip.GetSize();
187int subno;
188int count, count2;
189BOOL wascaret=FALSE;
190 switch(c){
191 case '(':
192 if(!(m_ParsePointer<m_Pattern.GetLength())){
193 TRACE0("RE: '(' at the end of the pattern\n");
194 if(!m_Error)
195 m_Error = regeParen;
196 // ??? point to nuls?
197 }
198 m_Subexps++;
199 subno=m_Subexps;
200 m_ParseParens.SetAtGrow(m_Subexps,CParenthesis(m_Strip.GetSize()));
201 m_Error || m_Strip.Add(CSop(CSop::opLeftParen,subno));
202 if(m_ParsePointer>=m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!=')')
203 ParseERE(')');
204 VERIFY(m_ParseParens[m_Subexps].m_End = m_Strip.GetSize());
205 m_Error || m_Strip.Add(CSop(CSop::opRightParen,subno));
206 if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer++]!=')'){
207 TRACE0("RE: No matching ')'\n");
208 if(!m_Error)
209 m_Error = regeParen;
210 // ??? point to nuls?
211 }
212 break;
213 case '^':
214 m_Error || m_Strip.Add(CSop(CSop::opBOL));
215 m_iFlags|=iflagsUseBOL;
216 m_BOLs++;
217 wascaret=TRUE;
218 break;
219 case '$':
220 m_Error || m_Strip.Add(CSop(CSop::opEOL));
221 m_iFlags|=iflagsUseEOL;
222 m_EOLs++;
223 break;
224 case '|':
225 TRACE0("RE: '|' outside of expression\n");
226 if(!m_Error)
227 m_Error = regeEmpty;
228 // ??? point to nuls?
229 break;
230 case '*':
231 case '+':
232 case '?':
233 TRACE0("RE: '*'/'+'/'?' with no previous expression\n");
234 if(!m_Error)
235 m_Error = regeBadRepeat;
236 // ??? point to nuls?
237 break;
238 case '.':
239 if(m_Flags&regNewLine)
240 EmitNonNewLineAny();
241 else
242 m_Error || m_Strip.Add(CSop(CSop::opAny));
243 break;
244 case '[':
245 ParseBracket();
246 break;
247 case '\\':
248 if(m_ParsePointer >= m_Pattern.GetLength()){
249 TRACE0("RE: '\\' at the end of the pattern\n");
250 if(!m_Error)
251 m_Error = regeEscape;
252 // ??? point to nuls?
253 }else{
254 c = m_Pattern[m_ParsePointer++];
255 EmitOrdinary(c);
256 }
257 break;
258 case '{':
259 if(m_ParsePointer >= m_Pattern.GetLength() || !isdigit(m_Pattern[m_ParsePointer])){
260 TRACE0("RE: '{' with no repeat count\n");
261 if(!m_Error)
262 m_Error = regeBadRepeat;
263 // ??? point to nuls?
264 }
265 // Fallthrough..
266 default:
267 EmitOrdinary(c);
268 break;
269 }
270 if(m_ParsePointer >= m_Pattern.GetLength())
271 return;
272 c = m_Pattern[m_ParsePointer];
273 // Call a '{' repetition if followed by a digit
274 if (!(c=='*' || c=='+' || c=='?' || ( c=='{' && (m_ParsePointer+1) < m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer+1])) ))
275 return; // No repetitor - done.
276 m_ParsePointer++;
277 if(wascaret){
278 TRACE0("RE: repetitive '^' detected\n");
279 if(!m_Error)
280 m_Error = regeBadRepeat;
281 // ??? point to nuls?
282 }
283 switch(c){
284 case '*':// Implemeted as +?
285 // + expression
286 StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
287 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
288 // ? expression
289 StripInsert(pos,CSop(CSop::opQuest0,m_Strip.GetSize()-pos+1));
290 m_Error || m_Strip.Add(CSop(CSop::opQuest1,m_Strip.GetSize()-pos));
291 break;
292 case '+':
293 // + expression
294 StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
295 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
296 break;
297 case '?':
298 // Kludge - emit y? as (y|) until subtle bug gets fixed :-)
299 StripInsert(pos,CSop(CSop::opChoice0,m_Strip.GetSize()-pos+1));
300 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
301 m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
302 m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
303 m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
304 break;
305 case '{':
306 count = ParseCount();
307 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==','){
308 m_ParsePointer++;
309 if(isdigit(m_Pattern[m_ParsePointer])){ // HHH Personally, I doubt it is always available
310 count2=ParseCount();
311 if(!(count<=count2)){
312 TRACE0("RE: Disbalanced counts in '{}' repeater\n");
313 m_Error || (m_Error=regeBadBrace);
314 // ??? point to nuls?
315 }
316 }else // Single number with comma
317 count2=256; // Infinity
318 }else // Single number
319 count2=count;
320 EmitRepeat(pos,count,count2);
321 if(m_ParsePointer >= m_Pattern.GetLength() || m_Pattern[m_ParsePointer]!='}'){
322 // No '}'..
323 TRACE0("RE: No immediately following '}' of '{' expression\n");
324 while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!='}')
325 m_ParsePointer++;
326 if(m_ParsePointer >= m_Pattern.GetLength()){
327 TRACE0("RE: No closing '}' found\n");
328 m_Error || (m_Error=regeBrace);
329 }else
330 m_Error || (m_Error=regeBadBrace);
331 // ??? point to nuls?
332 }else
333 m_ParsePointer++;
334 break;
335 }
336 if(m_ParsePointer >= m_Pattern.GetLength())
337 return;
338 c = m_Pattern[m_ParsePointer];
339 if(!(c=='*' || c=='+' || c=='?' || (c=='{' && (m_ParsePointer+1)<m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer+1]))))
340 return;
341 TRACE0("RE: Double repeater\n");
342 m_Error || (m_Error=regeBadRepeat);
343 // ??? point to nuls?
344}
345
346void CRegEx::StripInsert(int pos,CSop& sop)
347{
348 if(m_Error)
349 return;
350int sn = m_Strip.GetSize();
351 m_Strip.InsertAt(pos,sop);
352 for(int tmp=1;tmp<m_ParseParens.GetSize();tmp++){
353 if(m_ParseParens[tmp].m_Begin>=pos)
354 m_ParseParens[tmp].m_Begin++;
355 if(m_ParseParens[tmp].m_End>=pos)
356 m_ParseParens[tmp].m_End++;
357 }
358}
359
360void CRegEx::EmitOrdinary(UCHAR c)
361{
362 if(m_Flags&regIgnoreCase && isalpha(c) && (tolower(c) !=toupper(c))){
363 // Emit both cases
364 CString savePattern = m_Pattern;
365 int savePointer = m_ParsePointer;
366 m_Pattern=c;
367 m_Pattern+=']';
368 m_ParsePointer=0;
369 ParseBracket();
370 m_Pattern=savePattern;
371 m_ParsePointer=savePointer;
372 }else{
373 m_Error || m_Strip.Add(CSop(CSop::opChar,c));
374 if(!m_Category[(BYTE)c])
375 m_Category[(BYTE)c]=m_Categories++;
376 }
377}
378
379void CRegEx::EmitNonNewLineAny()
380{
381 // Kludges're going on and on..
382CString savePattern = m_Pattern;
383int savePointer = m_ParsePointer;
384 m_Pattern="^\n]";
385 m_ParsePointer=0;
386 ParseBracket();
387 m_Pattern=savePattern;
388 m_ParsePointer=savePointer;
389}
390
391int CRegEx::ParseCount()
392{
393BOOL nonEmpty=FALSE;
394int rv = 0;
395UCHAR c;
396 while(m_ParsePointer < m_Pattern.GetLength() && isdigit(c=m_Pattern[m_ParsePointer]) && rv <=255){
397 rv = rv*10 + c-'0';
398 nonEmpty=TRUE;
399 m_ParsePointer++;
400 }
401 if(rv>255 || !nonEmpty){
402 m_Error || (m_Error=regeBadBrace);
403 // ??? point to nuls?
404 }
405 return rv;
406}
407
408void CRegEx::ParseBracket()
409{
410 // Dept. of truly sickening special case kludges
411 if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:<]]")){
412 m_Error || m_Strip.Add(CSop(CSop::opBOW));
413 m_ParsePointer+=6;
414 return;
415 }
416 if((m_ParsePointer+5) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,6).Compare("[:>]]")){
417 m_Error || m_Strip.Add(CSop(CSop::opEOW));
418 m_ParsePointer+=6;
419 return;
420 }
421BOOL invert=TRUE;
422 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='^')
423 m_ParsePointer++;
424 else
425 invert=FALSE;
426CSet cset;
427 if(m_ParsePointer < m_Pattern.GetLength()){
428 switch(m_Pattern[m_ParsePointer]){
429 case ']':
430 case '-':
431 cset.Add(m_Pattern[m_ParsePointer]);
432 m_ParsePointer++;
433 break;
434 }
435 }
436 while(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]!=']' && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("-]")))
437 ParseBracketTerm(cset);
438 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-'){
439 m_ParsePointer++;
440 cset.Add('-');
441 }
442 if(m_ParsePointer < m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==']')
443 m_ParsePointer++;
444 else{
445 m_Error || (m_Error=regeBracket);
446 // ??? point to nuls?
447 return;
448 }
449 if(m_Flags&regIgnoreCase){
450 for(int tmp=CSet::size-1;tmp>=0;tmp--){
451 if(cset.IsIn(tmp) && isalpha(tmp) && (toupper(tmp)!=tolower(tmp)))
452 cset.Add(isupper(tmp)?tolower(tmp):toupper(tmp));
453 }
454 /*
455 if(!cset->m_Multis.IsEmpty())
456 cset.CollatingCase();
457 */
458 }
459 if(invert){
460 for(int tmp=CSet::size-1;tmp>=0;tmp--)
461 if(cset.IsIn(tmp))
462 cset.Sub(tmp);
463 else
464 cset.Add(tmp);
465 if(m_Flags&regNewLine)
466 cset.Sub('\n');
467 /*
468 if(!cset.m_Multis.IsEmpty())
469 cset.CollatingInvert();
470 */
471 }
472UCHAR c = cset.GetOnly();
473 if(c){
474 EmitOrdinary(c);
475 }else
476 m_Error || m_Strip.Add(CSop(CSop::opAnyOf,StoreSet(cset)));
477}
478
479void CRegEx::CSet::Add(UCHAR c)
480{
481 m_Set[(BYTE)c]=TRUE;
482 m_Hash+=c;
483}
484
485BOOL CRegEx::CSet::IsIn(UCHAR c)
486{
487 return m_Set[(BYTE)c];
488}
489
490void CRegEx::CSet::Sub(UCHAR c)
491{
492 m_Set[(BYTE)c]=FALSE;
493 m_Hash-=c;
494}
495
496UCHAR CRegEx::CSet::GetOnly()
497{
498int rv = 0;
499UCHAR only = 0;
500 for(int tmp=0;tmp<size;tmp++){
501 rv+=m_Set[tmp]?(only=tmp,1):0;
502 }
503 return (rv==1)?only:0;
504}
505
506int CRegEx::StoreSet(CSet& cset)
507{
508 for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
509 if(m_Sets[tmp]==cset)
510 return tmp;
511 return m_Sets.Add(cset);
512}
513
514void CRegEx::ParseBracketTerm(CSet& cset)
515{
516UCHAR c;
517 switch((m_ParsePointer<m_Pattern.GetLength())?m_Pattern[m_ParsePointer]:0){
518 case '[':
519 c = ((m_ParsePointer+1)<m_Pattern.GetLength())?m_Pattern[m_ParsePointer+1]:0;
520 break;
521 case '-':
522 m_Error || (m_Error=regeRange);
523 // ??? point to nuls?
524 return;
525 default:
526 c = 0;
527 break;
528 }
529 switch(c){
530 case ':':// Character class
531 m_ParsePointer+=2;
532 if(m_ParsePointer>=m_Pattern.GetLength()){
533 m_Error || (m_Error=regeBracket);
534 // ??? point to nuls?
535 }
536 c = m_Pattern[m_ParsePointer];
537 if(c== '-' || c==']'){
538 m_Error || (m_Error=regeCType);
539 // ??? point to nuls?
540 }
541 ParseBracketCClass(cset);
542 if(m_ParsePointer>=m_Pattern.GetLength()){
543 m_Error || (m_Error=regeBracket);
544 // ??? point to nuls?
545 }
546 if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare(":]"))){
547 m_Error || (m_Error=regeCType);
548 // ??? point to nuls?
549 }else
550 m_ParsePointer+=2;
551 break;
552 case '=':// Equivalence class
553 m_ParsePointer+=2;
554 if(m_ParsePointer >= m_Pattern.GetLength()){
555 m_Error || (m_Error=regeBracket);
556 // ??? point to nuls?
557 }
558 c = m_Pattern[m_ParsePointer];
559 if(c== '-' || c==']'){
560 m_Error || (m_Error=regeCollate);
561 // ??? point to nuls?
562 }
563 ParseBracketEClass(cset);
564 if((m_ParsePointer+1)>=m_Pattern.GetLength() || (m_Pattern.Mid(m_ParsePointer,2).Compare("=]"))){
565 m_Error || (m_Error=regeCollate);
566 // ??? point to nuls?
567 }else
568 m_ParsePointer+=2;
569 break;
570 default:// Symbol, character or range
571 {
572 UCHAR start, finish;
573 start = ParseBracketSymbol();
574 if((m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-') /*&& (m_ParsePointer+1)<m_Pattern.GetLength() && m_Pattern[m_ParsePointer+1]==']'*/){
575 // I believe the expression above is seetwo..
576 // range.
577 m_ParsePointer++;
578 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='-'){
579 m_ParsePointer++;
580 finish='-';
581 }else
582 finish=ParseBracketSymbol();
583 }else
584 finish=start;
585 if(((BYTE)start)>((BYTE)finish)){
586 m_Error || (m_Error=regeRange);
587 // ??? point to nuls?
588 }
589 for(int tmp=start;tmp<=(BYTE)finish;tmp++)
590 cset.Add(tmp);
591 }
592 break;
593 }
594}
595
596void CRegEx::ParseBracketCClass(CSet& cset)
597{
598 static struct{
599 char *className;
600 char *classChars;
601 }cc[] = {
602 {"alnum","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"},
603 {"alpha","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},
604 {"blank"," \t"},
605 {"cntrl","\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177"},
606 {"digit","0123456789"},
607 {"graph","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"},
608 {"lower","abcdefghijklmnopqrstuvwxyz"},
609 {"print","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ "},
610 {"punct","!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"},
611 {"space","\t\n\v\f\r "},
612 {"upper","ABCDEFGHIJKLMNOPQRSTUVWXYZ"},
613 {"xdigit","0123456789ABCDEFabcdef"}
614};
615CString cclass;
616UCHAR c;
617 while(m_ParsePointer < m_Pattern.GetLength() && isalpha(c=m_Pattern[m_ParsePointer])){
618 cclass+=c;
619 m_ParsePointer++;
620 }
621char *classChars = NULL;
622 for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++){
623 if(!cclass.CompareNoCase(cc[tmp].className)){
624 classChars=cc[tmp].classChars;
625 break;
626 }
627 }
628 if(!classChars){
629 m_Error || (m_Error=regeCType);
630 // ??? point to nuls?
631 return;
632 }
633 while(*classChars)
634 cset.Add(*(classChars++));
635 // --- multis
636}
637
638void CRegEx::ParseBracketEClass(CSet& cset)
639{
640 cset.Add(ParseBracketCollatingElement('='));;
641}
642
643UCHAR CRegEx::ParseBracketCollatingElement(UCHAR term)
644{
645 static struct{
646 char *entityName;
647 char entity;
648 }cc[] = { {"NUL",'\0'},{"SOH",'\001'},{"STX",'\002'},{"ETX",'\003'},{"EOT",'\004'},{"ENQ",'\005'},{"ACK",'\006'},{"BEL",'\007'},{"alert",'\007'},{"BS",'\010'},{"backspace",'\b'},{"HT",'\011'},{"tab",'\t'},{"LF",'\012'},{"newline",'\n'},{"VT",'\013'},{"vertical-tab",'\v'},{"FF",'\014'},{"form-feed",'\f'},{"CR",'\015'},{"carriage-return",'\r'},{"SO",'\016'},{"SI",'\017'},{"DLE",'\020'},{"DC1",'\021'},{"DC2",'\022'},{"DC3",'\023'},{"DC4",'\024'},{"NAK",'\025'},{"SYN",'\026'},{"ETB",'\027'},{"CAN",'\030'},{"EM",'\031'},{"SUB",'\032'},{"ESC",'\033'},{"IS4",'\034'},{"FS",'\034'},{"IS3",'\035'},{"GS",'\035'},{"IS2",'\036'},{"RS",'\036'},{"IS1",'\037'},{"US",'\037'},{"space",' '},{"exclamation-mark",'!'},{"quotation-mark",'"'},{"number-sign",'#'},{"dollar-sign",'$'},{"percent-sign",'%'},{"ampersand",'&'},{"apostrophe",'\''},{"left-parenthesis",'('},{"right-parenthesis",')'},{"asterisk",'*'},{"plus-sign",'+'},{"comma",','},{"hyphen",'-'},{"hyphen-minus",'-'},{"period",'.'},{"full-stop",'.'},{"slash",'/'},{"solidus",'/'},{"zero",'0'},{"one",'1'},{"two",'2'},{"three",'3'},{"four",'4'},{"five",'5'},{"six",'6'},{"seven",'7'},{"eight",'8'},{"nine",'9'},{"colon",':'},{"semicolon",';'},{"less-than-sign",'<'},{"equals-sign",'='},{"greater-than-sign",'>'},{"question-mark",'?'},{"commercial-at",'@'},{"left-square-bracket",'['},{"backslash",'\\'},{"reverse-solidus",'\\'},{"right-square-bracket",']'},{"circumflex",'^'},{"circumflex-accent",'^'},{"underscore",'_'},{"low-line",'_'},{"grave-accent",'`'},{"left-brace",'{'},{"left-curly-bracket",'{'},{"vertical-line",'|'},{"right-brace",'}'},{"right-curly-bracket",'}'},{"tilde",'~'},{"DEL",'\177'} };
649CString seeTwo;
650 seeTwo=term;
651 seeTwo+=']';
652CString entityName;
653 while(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare(seeTwo)))
654 entityName+=m_Pattern[m_ParsePointer++];
655 if(m_ParsePointer>=m_Pattern.GetLength()){
656 m_Error || (m_Error=regeBracket);
657 // ??? point to nuls?
658 return 0;
659 }
660 for(int tmp=0;tmp<(sizeof(cc)/sizeof(cc[0]));tmp++)
661 if(!entityName.CompareNoCase(cc[tmp].entityName))
662 return cc[tmp].entity;
663 if(entityName.GetLength()==1)
664 return entityName[0];
665 m_Error || (m_Error=regeCollate);
666 // ??? point to nuls?
667 return 0;
668}
669
670UCHAR CRegEx::ParseBracketSymbol()
671{
672 if(m_ParsePointer>=m_Pattern.GetLength()){
673 m_Error || (m_Error=regeBracket);
674 // ??? point to nuls?
675 }
676 if((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("[."))
677 m_ParsePointer+=2;
678 else
679 return m_Pattern[m_ParsePointer++];
680 // Collating symbol
681UCHAR rv = ParseBracketCollatingElement('.');
682 if((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("[."))
683 m_ParsePointer+=2;
684 else{
685 m_Error || (m_Error=regeCollate);
686 // ??? point to nuls?
687 }
688 return rv;
689}
690
691void CRegEx::EmitRepeat(int pos,int from,int to)
692{
693 if(m_Error)
694 return;
695 ASSERT(from<=to);
696int finish = m_Strip.GetSize();
697int copy;
698 #defineN 2
699#define INF 3
700#define REP(f,t) ((f)*8+(t))
701#define MAP(n) (((n)<=1)?(n):((n)==256)?INF:N)
702 switch(REP(MAP(from),MAP(to))){
703 case REP(0,0):// must be user doing ths??
704 m_Strip.SetSize(pos);
705 break;
706 case REP(0,1):// as in '?'
707 case REP(0,N):// as in '{1,n}?'
708 case REP(0,INF):// as in '{1,}?'
709 // Kludge - emit y? as (y|) until something gets fixed..
710 StripInsert(pos,CSop(CSop::opChoice0,pos));
711 EmitRepeat(pos+1,1,to);
712 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
713 m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
714 m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
715 m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
716 break;
717 case REP(1,1):
718 break;
719 case REP(1,N):// as in 'x?x{1,n-1}'
720 // Kludge again..
721 StripInsert(pos,CSop(CSop::opChoice0,pos));
722 m_Error || m_Strip.Add(CSop(CSop::opOr0,m_Strip.GetSize()-pos));
723 m_Error || (m_Strip[pos].m_Operand=m_Strip.GetSize()-pos);
724 m_Error || m_Strip.Add(CSop(CSop::opOr1,1));
725 m_Error || m_Strip.Add(CSop(CSop::opChoice1,2));
726 copy = StripDuplicate(pos+1,finish+1);
727 ASSERT(copy==(finish+4));
728 EmitRepeat(copy,1,to-1);
729 break;
730 case REP(1,INF): // as in '+'
731 StripInsert(pos,CSop(CSop::opPlus0,pos));
732 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
733 break;
734 case REP(N,N):// as in 'xx{from-1,to-1}'
735 copy = StripDuplicate(pos,finish);
736 EmitRepeat(copy,from-1,to-1);
737 break;
738 case REP(N,INF): // as in 'xx{n-1,}'
739 copy = StripDuplicate(pos,finish);
740 EmitRepeat(copy,from-1,to);
741 break;
742#ifndef NDEBUG
743 default:
744 ASSERT(FALSE);
745 break;
746#endif
747 }
748#undef MAP
749#undef REP
750#undef INF
751#undef N
752}
753
754int CRegEx::StripDuplicate(int from,int to)
755{
756int rv = m_Strip.GetSize();
757 ASSERT(from<=to);
758 if(from==to)
759 return rv;
760 // Maybe should be optimized for copying the whole thing.
761 for(int tmp=from;tmp<to;tmp++)
762 m_Strip.Add(m_Strip[tmp]);
763 return rv;
764}
765
766void CRegEx::Categorize()
767{
768 if(m_Error)
769 return;
770 for(int tmp=0;tmp<(sizeof(m_Category)/sizeof(m_Category[0]));tmp++)
771 if((!m_Category[tmp]) && IsInSets(tmp)){
772 int cat = m_Categories++;
773 m_Category[tmp]=cat;
774 for(int c=tmp+1;c<(sizeof(m_Category)/sizeof(m_Category[0]));c++)
775 if((!m_Category[c]) && IsInSameSets(tmp,c))
776 m_Category[c]=cat;
777 }
778}
779
780BOOL CRegEx::IsInSets(UCHAR c)
781{
782 for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
783 if(m_Sets[tmp].IsIn(c))
784 return TRUE;
785 return FALSE;
786}
787
788BOOL CRegEx::IsInSameSets(UCHAR c1,UCHAR c2)
789{
790 for(int tmp=0;tmp<m_Sets.GetSize();tmp++)
791 if(m_Sets[tmp].IsIn(c1)!=m_Sets[tmp].IsIn(c2))
792 return FALSE;
793 return TRUE;
794}
795
796void CRegEx::FigureMust()
797{
798 if(m_Error)
799 return;
800 m_Must.Empty();
801int stripLen = m_Strip.GetSize();
802int seqStart, seqLength = 0;
803int mustStart, mustLength = 0;
804 for(int tmp=1;tmp<stripLen;tmp++){
805 switch(m_Strip[tmp].m_Operator){
806 case CSop::opChar:
807 if(!seqLength)
808 seqStart=tmp;
809 seqLength++;
810 break;
811 case CSop::opPlus0:
812 case CSop::opLeftParen:
813 case CSop::opRightParen:
814 break;// Break, since they don't break the sequence
815 case CSop::opQuest0:
816 case CSop::opChoice0:
817 // These ones we skip.
818 do{
819 tmp+=m_Strip[tmp].m_Operand;
820 // I still think it could be ASSERTed..
821 if(m_Strip[tmp].m_Operator!=CSop::opQuest1 && m_Strip[tmp].m_Operator!=CSop::opChoice1 && m_Strip[tmp].m_Operator!=CSop::opOr1){
822 m_iFlags|=iflagsBad;
823 return;
824 }
825 }while(m_Strip[tmp].m_Operator!=CSop::opQuest1 && m_Strip[tmp].m_Operator!=CSop::opChoice1);
826 // Fallthrough..
827 default:
828 // End of sequence
829 if(seqLength>mustLength){
830 mustStart=seqStart;
831 mustLength=seqLength;
832 }
833 seqLength=0;
834 break;
835 }
836 }// Hmm.. originally it's meant to be do while not opEnd..
837 if(!mustLength)
838 return;
839 // Turn into string, but, wait, personally I'm sure it could be put in the main loop.. or maybe not..
840 for(tmp=0;tmp<seqLength;tmp++){
841 while(m_Strip[seqStart+tmp].m_Operator!=CSop::opChar)
842 ASSERT(tmp<seqLength);
843 m_Must+=m_Strip[tmp].m_Operand;
844 }
845}
846
847int CRegEx::CountPluses()
848{
849 if(m_Error)
850 return 0;
851int stripLen = m_Strip.GetSize();
852int rv = 0;
853int nest = 0;
854 for(int tmp=0;tmp<stripLen;tmp++){
855 switch(m_Strip[tmp].m_Operator){
856 case CSop::opPlus0:
857 nest++;
858 break;
859 case CSop::opPlus1:
860 if(nest>rv)
861 rv = nest;
862 nest--;
863 break;
864 }
865 }// Again, originally we were supposed to scan till opEnd..
866 if(nest)
867 m_iFlags|=iflagsBad;// Could this be an ASSERTion?
868 return rv;
869}
870
871void CRegEx::ParseLiteral()
872{
873 if(!m_Pattern.GetLength()){
874 m_Error || (m_Error=regeEmpty);
875 // ??? point to nuls?
876 }
877 while(m_ParsePointer < m_Pattern.GetLength())
878 EmitOrdinary(m_Pattern[m_ParsePointer++]);
879}
880
881void CRegEx::ParseBRE(int stopa,int stopb)
882{
883int start = m_Strip.GetSize();
884BOOL first=TRUE;
885BOOL wasDollar=FALSE;
886 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='^'){
887 m_ParsePointer++;
888 m_Error || m_Strip.Add(CSop(CSop::opBOL,0));
889 m_iFlags|=iflagsUseBOL;
890 m_BOLs++;
891 }
892CString stopstr;
893 if(stopa){
894 stopstr+=stopa;
895 if(stopb)
896 stopstr+=stopb;
897 }
898 while(m_ParsePointer < m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare(stopstr))){
899 wasDollar = ParseBREexp(first);
900 first=FALSE;
901 }
902 if(wasDollar){// Trailing anchor that was..
903 m_Strip.SetSize(m_Strip.GetSize()-1);
904 m_Error || m_Strip.Add(CSop(CSop::opEOL,0));
905 m_iFlags|=iflagsUseEOL;
906 m_EOLs++;
907 }
908 if(m_Strip.GetSize()==start){
909 m_Error || (m_Error=regeEmpty);
910 // ??? point to nuls?
911 }
912}
913
914BOOL CRegEx::ParseBREexp(BOOL ordinaryStar)
915{
916int subno;
917int pos = m_Strip.GetSize();
918 ASSERT(m_ParsePointer<m_Pattern.GetLength());
919int c = m_Pattern[m_ParsePointer++];
920 if(c=='\\'){
921 if(m_ParsePointer>=m_Pattern.GetLength()){
922 m_Error || (m_Error=regeEscape);
923 // ??? point to nuls
924 }else
925 c = 0x100|m_Pattern[m_ParsePointer++];
926 }
927 switch(c){
928 case '.':
929 if(m_Flags&regNewLine)
930 EmitNonNewLineAny();
931 else
932 m_Error || m_Strip.Add(CSop(CSop::opAny,0));
933 break;
934 case '[':
935 ParseBracket();
936 break;
937 case 0x100|'{':
938 m_Error || (m_Error=regeBadRepeat);
939 // ??? point to nuls?
940 break;
941 case 0x100|'(':
942 m_Subexps++;
943 subno=m_Subexps;
944 m_ParseParens.SetAtGrow(m_Subexps,CParenthesis(m_Strip.GetSize()));
945 m_Error || m_Strip.Add(CSop(CSop::opLeftParen,subno));
946 if(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\)")))
947 ParseBRE('\\',')');
948 VERIFY(m_ParseParens[m_Subexps].m_End = m_Strip.GetSize());
949 m_Error || m_Strip.Add(CSop(CSop::opRightParen,subno));
950 if((m_ParsePointer+1) < m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\)"))
951 m_ParsePointer+=2;
952 else{
953 m_Error || (m_Error=regeParen);
954 // ??? point to nuls?
955 }
956 break;
957 case 0x100|')':
958 case 0x100|'}':
959 // Can this possibly happen?!
960 m_Error || (m_Error=regeParen);
961 // ??? point to nuls?
962 break;
963 case 0x100|'1':
964 case 0x100|'2':
965 case 0x100|'3':
966 case 0x100|'4':
967 case 0x100|'5':
968 case 0x100|'6':
969 case 0x100|'7':
970 case 0x100|'8':
971 case 0x100|'9':
972 {
973 int i = (c&0xFF)-'0';
974 if(i < m_ParseParens.GetSize() && m_ParseParens[i].m_End){
975 m_Error || m_Strip.Add(CSop(CSop::opBackRef0,i));
976 ASSERT(m_ParseParens[i].m_Begin);
977 ASSERT(m_Strip[m_ParseParens[i].m_Begin].m_Operator==CSop::opLeftParen);
978 ASSERT(m_Strip[m_ParseParens[i].m_End].m_Operator==CSop::opRightParen);
979 StripDuplicate(m_ParseParens[i].m_Begin+1,m_ParseParens[i].m_End);
980 m_Error || m_Strip.Add(CSop(CSop::opBackRef1,i));
981 }else{
982 m_Error || (m_Error=regeSubReg);
983 // ??? point to nuls?
984 }
985 m_bBackRefs=TRUE;
986 }
987 break;
988 case '*':
989 if(!ordinaryStar){
990 m_Error || (m_Error=regeBadRepeat);
991 // ??? point to nuls?
992 }
993 // Fallthrough..
994 default:
995 EmitOrdinary(c&0xFF);
996 break;
997 }
998 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]=='*'){
999 m_ParsePointer++;
1000 // as in '+?'
1001 StripInsert(pos,CSop(CSop::opPlus0,m_Strip.GetSize()-pos+1));
1002 m_Error || m_Strip.Add(CSop(CSop::opPlus1,m_Strip.GetSize()-pos));
1003 StripInsert(pos,CSop(CSop::opQuest0,m_Strip.GetSize()-pos+1));
1004 m_Error || m_Strip.Add(CSop(CSop::opQuest1,m_Strip.GetSize()-pos));
1005 }else if ((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\{")){
1006 m_ParsePointer+=2;
1007 int count = ParseCount();
1008 int count2;
1009 if(m_ParsePointer<m_Pattern.GetLength() && m_Pattern[m_ParsePointer]==','){
1010 m_ParsePointer++;
1011 if(m_ParsePointer<m_Pattern.GetLength() && isdigit(m_Pattern[m_ParsePointer])){
1012 count2=ParseCount();
1013 if(count>count2){
1014 m_Error || (m_Error=regeBadBrace);
1015 // ??? poin to nuls?
1016 }
1017 }else // Single number with comma
1018 count2=256;
1019 }else // Single number
1020 count2=count;
1021 EmitRepeat(pos,count,count2);
1022 if((m_ParsePointer+1)>=m_Pattern.GetLength() || m_Pattern.Mid(m_ParsePointer,2).Compare("\\}")){
1023 while(m_ParsePointer<m_Pattern.GetLength() && !((m_ParsePointer+1)<m_Pattern.GetLength() && !m_Pattern.Mid(m_ParsePointer,2).Compare("\\}")))
1024 m_ParsePointer++;
1025 if(m_ParsePointer>=m_Pattern.GetLength()){
1026 m_Error || (m_Error=regeBrace);
1027 // ??? point to nuls?
1028 }
1029 m_Error || (m_Error=regeBadBrace);
1030 }else
1031 m_ParsePointer+=2;
1032 }else if(c=='$')
1033 return TRUE;
1034 return FALSE;
1035}
1036
1037CRegEx::CRegEx()
1038{
1039 m_bCompiled=FALSE;
1040}
1041
1042LPCTSTR CRegEx::MatchFast(LPCTSTR begin)
1043{
1044 MatchStatesClear(CSop::stCurrent);
1045 m_Strip[1].m_MatchData|=CSop::stCurrent;
1046int stripLen = m_Strip.GetSize();
1047 MatchStep(1,stripLen-1,CSop::stCurrent,charNothing,CSop::stCurrent);
1048 MatchStatesCopy(CSop::stFresh,CSop::stCurrent);
1049LPCTSTR coldp = NULL;
1050LPCTSTR p = begin;
1051int c = (begin==m_mBegin)?charOut:((int)(BYTE)m_mPointer[-1]);
1052 for(;;){
1053 // next character..
1054 int lastc = c;
1055 c = (p==m_mEnd)?charOut:(int)*(BYTE*)p;
1056 if(MatchStatesEqual(CSop::stCurrent,CSop::stFresh))
1057 coldp=p;
1058 // Is there an EOL and/or BOL between lastc and c? - they ask..
1059 intflagc=0;
1060 inti = 0;
1061 if((lastc=='\n' && m_Flags&regNewLine) || (lastc==charOut && !(m_mFlags&regNotBOL))){
1062 flagc=charBOL;
1063 i=m_BOLs;
1064 }
1065 if((c=='\n' && m_Flags&regNewLine) || (c==charOut && !(m_mFlags&regNotEOL))){
1066 flagc=(flagc==charBOL)?charBOLEOL:charEOL;
1067 i+=m_EOLs;
1068 }
1069 if(i){
1070 for(;i>0;i--)
1071 MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent);
1072 }
1073 // What about a word boundary? - they wonder..
1074 if((flagc==charBOL || (lastc!=charOut && !isWordableChar(c))) && (c!=charOut && isWordableChar(c)))
1075 flagc = charBOW;
1076 if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c))))
1077 flagc = charEOW;
1078 if(flagc==charBOW || flagc==charEOW){
1079 MatchStep(1,stripLen-1,CSop::stCurrent,flagc,CSop::stCurrent);
1080 }
1081 // Are we done? Now WE wonder..
1082 if((m_Strip[stripLen-1].m_MatchData&CSop::stCurrent) || p==m_mEnd)
1083 break;// They insist I need to note break out.. Okay, I do..
1084 // Nope, we're not done. We have to face this character..
1085 MatchStatesCopy(CSop::stTemp,CSop::stCurrent);
1086 MatchStatesCopy(CSop::stCurrent,CSop::stFresh);
1087 ASSERT(c!=charOut);
1088 MatchStep(1,stripLen-1,CSop::stTemp,c,CSop::stCurrent);
1089 p++;
1090 }
1091 ASSERT(coldp);
1092 m_cOldP=coldp;// *** I believe this variable can be changed 'in-place'
1093 if(m_Strip[stripLen-1].m_MatchData&CSop::stCurrent)
1094 return &p[1];
1095 else
1096 return NULL;
1097}
1098
1099void CRegEx::MatchStatesClear(BYTE mask)
1100{
1101int stripLen = m_Strip.GetSize();
1102 for(int tmp=0;tmp<stripLen;tmp++)
1103 m_Strip[tmp].m_MatchData&=~mask;
1104}
1105
1106void CRegEx::MatchStep(int from,int to,BYTE maskBefore,int charCode,BYTE maskAfter)
1107{
1108BOOL i;
1109int look;
1110int here = from;
1111 for(int pc=from;pc!=to;pc++,here++){
1112 CSop s=m_Strip[pc];
1113 switch(s.m_Operator){
1114 case CSop::opEnd:
1115 ASSERT(pc==(to-1));
1116 break;
1117 case CSop::opChar:
1118 // Only characters can match..
1119 ASSERT((charCode<charOut) || charCode!=s.m_Operand);
1120 if(charCode==s.m_Operand)
1121 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1122 break;
1123 case CSop::opBOL:
1124 if(charCode==charBOL || charCode==charBOLEOL)
1125 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1126 break;
1127 case CSop::opEOL:
1128 if(charCode==charEOL || charCode==charBOLEOL)
1129 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1130 break;
1131 case CSop::opBOW:
1132 if(charCode==charBOW)
1133 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1134 break;
1135 case CSop::opEOW:
1136 if(charCode==charEOW)
1137 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1138 break;
1139 case CSop::opAny:
1140 if(charCode<charOut)
1141 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1142 break;
1143 case CSop::opAnyOf:
1144 if(charCode<charOut && m_Sets[s.m_Operand].m_Set[charCode])
1145 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskBefore)?maskAfter:0;
1146 break;
1147 case CSop::opBackRef0:// Ignored here..
1148 case CSop::opBackRef1:
1149 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1150 break;
1151 case CSop::opPlus0:
1152 // Forward, this is just an empty, comment says..
1153 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1154 break;
1155 case CSop::opPlus1:
1156 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1157 i =(m_Strip[here-s.m_Operand].m_MatchData&maskAfter)!=0;
1158 m_Strip[here-s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1159 if(!i && (m_Strip[here-s.m_Operand].m_MatchData&maskAfter)){
1160 // oho, must reconsider loop body, comment says.. what's so 'oho' about it?
1161 pc-=s.m_Operand+1;
1162 here=pc;
1163 }
1164 break;
1165 case CSop::opQuest0:
1166 // two branches, both forward..
1167 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1168 m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1169 break;
1170 case CSop::opQuest1:
1171 // just an empty.. aren't we tired of justanempties?
1172 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1173 break;
1174 case CSop::opLeftParen: // they say it's not significan there..
1175 case CSop::opRightParen:
1176 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1177 break;
1178 case CSop::opChoice0:// mark the first two branches..
1179 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1180 ASSERT(m_Strip[pc+s.m_Operand].m_Operator==CSop::opOr1);
1181 m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1182 break;
1183 case CSop::opOr0:// done a branch, find the end of choice..
1184 if(m_Strip[here].m_MatchData&maskAfter){
1185 for(look=1;(s=m_Strip[pc+look]).m_Operator!=CSop::opChoice1;look+=s.m_Operand)
1186 ASSERT(s.m_Operator==CSop::opOr1);
1187 m_Strip[here+look].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1188 }
1189 break;
1190 case CSop::opOr1: // Propagate Choice's marking..
1191 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1192 if(m_Strip[pc+s.m_Operand].m_Operator!=CSop::opChoice1){
1193 ASSERT(m_Strip[pc+s.m_Operand].m_Operator==CSop::opOr1);
1194 m_Strip[here+s.m_Operand].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1195 }
1196 break;
1197 case CSop::opChoice1: // Just empty.. :-)..
1198 m_Strip[here+1].m_MatchData|=(m_Strip[here].m_MatchData&maskAfter)?maskAfter:0;
1199 break;
1200#ifdef _DEBUG
1201 default:
1202 ASSERT(FALSE);
1203 break;
1204#endif
1205 }
1206 }
1207}
1208
1209void CRegEx::MatchStatesCopy(BYTE dst,BYTE src)
1210{
1211int stripLen = m_Strip.GetSize();
1212 for(int tmp=0;tmp<stripLen;tmp++){
1213 // I believe this can be optimized, easily..
1214 m_Strip[tmp].m_MatchData&=~dst;
1215 m_Strip[tmp].m_MatchData|=(m_Strip[tmp].m_MatchData&src)?dst:0;
1216 }
1217}
1218
1219BOOL CRegEx::MatchStatesEqual(BYTE m1,BYTE m2)
1220{
1221int stripLen = m_Strip.GetSize();
1222 for(int tmp=0;tmp<stripLen;tmp++){
1223 BYTE mm = m_Strip[tmp].m_MatchData;
1224 if(((mm&m1) && (mm&m2)) || !(mm&(m1|m2)))
1225 continue;
1226 return FALSE;
1227 }
1228 return TRUE;
1229}
1230
1231LPCTSTR CRegEx::MatchSlow(LPCTSTR begin,LPCTSTR end,int from,int to)
1232{
1233 MatchStatesClear(CSop::stCurrent);
1234 m_Strip[from].m_MatchData|=CSop::stCurrent;
1235 MatchStep(from,to,CSop::stCurrent,charNothing,CSop::stCurrent);
1236LPCTSTR mp = NULL;
1237int c = (m_mBegin==m_mPointer)?charOut:(int)(BYTE)begin[-1];
1238LPCTSTR p = begin;
1239 for(;;){
1240 // next character..
1241 int lastc = c;
1242 c = (p==m_mEnd)?charOut:(int)*(BYTE*)p;
1243 // Now we start to wonder if there is an EOL and/or BOL between lastc and c
1244 int flagc = 0;
1245 int i = 0;
1246 if((lastc=='\n' && m_Flags&regNewLine) || (lastc==charOut && !(m_mFlags&regNotBOL))){
1247 flagc = charBOL;
1248 i = m_BOLs;
1249 }
1250 if((c=='\n' && m_Flags&regNewLine) || (c==charOut && !(m_mFlags&regNotEOL))){
1251 flagc = (flagc==charBOL)?charBOLEOL:charEOL;
1252 i+=m_EOLs;
1253 }
1254 if(i){
1255 for(;i>0;i--)
1256 MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent);
1257 }
1258 // Now we wonder about word boundaries..
1259 if((flagc==charBOL || (lastc!=charOut && !isWordableChar(lastc))) && (c!=charOut && isWordableChar(c)))
1260 flagc=charBOW;
1261 if((lastc!=charOut && isWordableChar(lastc)) && (flagc==charEOL || (c!=charOut && !isWordableChar(c))))
1262 flagc=charEOW;
1263 if(flagc==charBOW || flagc==charEOW){
1264 MatchStep(from,to,CSop::stCurrent,flagc,CSop::stCurrent);
1265 }
1266 // Are we done we all wonder??
1267 if(m_Strip[to].m_MatchData&CSop::stCurrent)
1268 mp=p;
1269 if(MatchStatesEqual(CSop::stCurrent,CSop::stEmpty) || p==end)
1270 break;// Again, we're obliged to note break out. We do.
1271 // Sucks.. we have to face this character..
1272 MatchStatesCopy(CSop::stTemp,CSop::stCurrent);
1273 MatchStatesCopy(CSop::stCurrent,CSop::stEmpty);
1274 ASSERT(c!=charOut);
1275 MatchStep(from,to,CSop::stTemp,c,CSop::stCurrent);
1276 MatchStep(from,to,CSop::stCurrent,charNothing,CSop::stCurrent);
1277 p++;
1278 }
1279 return mp;
1280}
1281
1282LPCTSTR CRegEx::MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to)
1283{
1284LPCTSTR sp = begin, dp;
1285LPCTSTR stp, rest, tail, ssp, oldssp, sep;
1286int ssub, esub;
1287int es;
1288int i;
1289 for(int ss=from;ss<to;ss = es){
1290 // Identify end of SubRE
1291 es = ss;
1292 switch(m_Strip[es].m_Operator){
1293 case CSop::opPlus0:
1294 case CSop::opQuest0:
1295 es+=m_Strip[es].m_Operand;
1296 break;
1297 case CSop::opChoice0:
1298 while(m_Strip[es].m_Operator!=CSop::opChoice1)
1299 es+=m_Strip[es].m_Operand;
1300 break;
1301 }
1302 es++;
1303 // Figure out what it matched
1304 switch(m_Strip[ss].m_Operator){
1305 case CSop::opEnd:
1306 ASSERT(FALSE);
1307 break;
1308 case CSop::opChar:
1309 sp++;
1310 break;
1311 case CSop::opBOL:
1312 case CSop::opEOL:
1313 case CSop::opBOW:
1314 case CSop::opEOW:
1315 break;
1316 case CSop::opAny:
1317 case CSop::opAnyOf:
1318 sp++;
1319 break;
1320 case CSop::opBackRef0:
1321 case CSop::opBackRef1:
1322 ASSERT(FALSE);
1323 break;
1324 // Cases where lenght of match is hard to find..
1325 case CSop::opQuest0:
1326 stp=end;
1327 for(;;){
1328 // How long could this one be??
1329 rest = MatchSlow(sp,stp,ss,es);
1330 ASSERT(rest);// It did match.. It should've..
1331 // Could the rest match the rest? (good question)
1332 tail = MatchSlow(rest,end,es,to);
1333 if(tail==end)
1334 break;// yup.
1335 // nope, try a shorter match for this one..
1336 stp=rest-1;
1337 ASSERT(stp>=sp);// It did work.. It should've..
1338 }
1339 ssub=ss+1;
1340 esub=es-1;
1341 // Did innards match?
1342 if(MatchSlow(sp,rest,ssub,esub)){
1343 dp = MatchDissect(sp,rest,ssub,esub);
1344 ASSERT(dp==rest);
1345 }else// nope..
1346 ASSERT(sp==rest);
1347 sp = rest;
1348 break;
1349 case CSop::opPlus0:
1350 stp=end;
1351 for(;;){
1352 // How long could this one be??
1353 rest = MatchSlow(sp,stp,ss,es);
1354 ASSERT(rest);// It did.. It should've..
1355 // Could the rest match the rest?
1356 tail = MatchSlow(rest,end,es,to);
1357 if(tail==end)
1358 break;// yup.
1359 // nope..
1360 stp=rest-1;
1361 ASSERT(stp>=sp);// It should've worked, we believe..
1362 }
1363 ssub=ss+1;
1364 esub=es-1;
1365 ssp=sp;
1366 oldssp=ssp;
1367 for(;;){// Find last match of innards..
1368 sep = MatchSlow(ssp,rest,ssub,esub);
1369 if((!sep) || sep==ssp)
1370 break; // Failed or matched nothin'
1371 oldssp=ssp;
1372 ssp=sep;
1373 }
1374 if(!sep){
1375 // Last successfull..
1376 sep=ssp;
1377 ssp=oldssp;
1378 }
1379 ASSERT(sep=rest);// Must exhaust substring they say..
1380 VERIFY(MatchSlow(ssp,sep,ssub,esub)==rest);// Assert or verify - that is the question..
1381 dp = MatchDissect(ssp,sep,ssub,esub);
1382 ASSERT(dp==sep);
1383 sp=rest;
1384 break;
1385 case CSop::opChoice0:
1386 stp = end;
1387 for(;;){
1388 // how long..
1389 rest = MatchSlow(sp,stp,ss,es);
1390 ASSERT(rest);
1391 // Could it..
1392 tail = MatchSlow(rest,end,es,to);
1393 if(tail==end)
1394 break;// y
1395 // n
1396 stp = rest-1;
1397 ASSERT(stp>=sp);
1398 }
1399 ssub=ss+1;
1400 esub=ss+m_Strip[ss].m_Operand-1;
1401 ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
1402 for(;;){// Find first matching branch..
1403 if(MatchSlow(sp,rest,ssub,esub)==rest)
1404 break;
1405 // this one missed, try next..
1406 ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
1407 esub++;
1408 ASSERT(m_Strip[esub].m_Operator==CSop::opOr1);
1409 ssub=esub+1;
1410 esub+=m_Strip[esub].m_Operand;
1411 if(m_Strip[esub].m_Operator==CSop::opOr1)
1412 esub--;
1413 else
1414 ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1);
1415 }
1416 dp = MatchDissect(sp,rest,ssub,esub);
1417 ASSERT(dp==rest);
1418 sp=rest;
1419 break;
1420 case CSop::opPlus1:
1421 case CSop::opQuest1:
1422 case CSop::opOr0:
1423 case CSop::opOr1:
1424 case CSop::opChoice1:
1425 ASSERT(FALSE);
1426 break;
1427 case CSop::opLeftParen:
1428 i = m_Strip[ss].m_Operand;
1429 ASSERT(0<i && i<=m_Subexps);
1430 m_Matches[i].m_Begin=sp-m_mBegin;
1431 break;
1432 case CSop::opRightParen:
1433 i = m_Strip[ss].m_Operand;
1434 ASSERT(0<i && i<=m_Subexps);
1435 m_Matches[i].m_End=sp-m_mBegin;
1436 break;
1437#ifdef _DEBUG
1438 default:// Uh.. oh..
1439 ASSERT(FALSE);
1440 break;
1441#endif
1442 }
1443 }
1444 ASSERT(sp==end);
1445 return sp;
1446}
1447
1448LPCTSTR CRegEx::MatchBackRef(LPCTSTR begin,LPCTSTR end,int from,int to,int level)
1449{
1450LPCTSTR sp = begin;
1451BOOL hard = FALSE;
1452 // Get as far as we can as long as it's easy
1453 for(int ss=from;!hard && ss<to;ss++){
1454 CSop s = m_Strip[ss];
1455 switch(s.m_Operator){
1456 case CSop::opChar:
1457 if(sp==end || *sp++ != s.m_Operand)
1458 return NULL;
1459 break;
1460 case CSop::opAny:
1461 if(sp==end)
1462 return NULL;
1463 sp++;// I'm sure this ++ could be embedded in previous expression..
1464 break;
1465 case CSop::opAnyOf:
1466 if(sp==end || !m_Sets[s.m_Operand].IsIn(*sp++))
1467 return NULL;
1468 break;
1469 case CSop::opBOL:
1470 if(!((sp==m_mBegin && !(m_mFlags&regNotBOL)) || (sp<m_mEnd && *(sp-1)=='\n' && (m_Flags&regNewLine))))
1471 return NULL;
1472 break;
1473 case CSop::opEOL:
1474 if(!((sp==m_mEnd && !(m_mFlags&regNotEOL)) || (sp<m_mEnd && *sp=='\n' && (m_Flags&regNewLine))))
1475 return NULL;
1476 break;
1477 case CSop::opBOW:
1478 if(!(((sp==m_mBegin && !(m_mFlags&regNotBOL)) || (sp<m_mEnd && *(sp-1)=='\n' && (m_Flags&regNewLine)) || (sp>m_mBegin && !isWordableChar(*(sp-1)))) && (sp<m_mEnd && isWordableChar(*sp))))
1479 return NULL;
1480 break;
1481 case CSop::opEOW:
1482 if(!(((sp==m_mEnd && !(m_mFlags&regNotEOL)) || (sp<m_mEnd && *sp=='\n' && (m_Flags&regNewLine)) || (sp<m_mEnd && !isWordableChar(*sp))) && (sp>m_mBegin && isWordableChar(*(sp-1)))))
1483 return NULL;
1484 break;
1485 case CSop::opQuest1:
1486 break;
1487 case CSop::opOr0:// Matches null, but needs to skip
1488 ss++;
1489 s = m_Strip[ss];
1490 do{
1491 ASSERT(s.m_Operator==CSop::opOr1);
1492 ss+=s.m_Operand;
1493 }while((s=m_Strip[ss]).m_Operator!=CSop::opChoice1);
1494 // Now we should note that ss++ gets us past the Choice1..
1495 break;
1496 default:
1497 // Have to make a choice..
1498 hard=TRUE;
1499 break;
1500 }
1501 }
1502 if(!hard){// That was it..
1503 if(sp!=end)
1504 return NULL;
1505 return sp;
1506 }
1507 ss--;// Adjust for ther for's final increment..
1508 // Hard stuff.. is going on and on..
1509CSop s = m_Strip[ss];
1510int i, len, offsave;
1511int ssub,esub;
1512LPCTSTR ssp, dp;
1513 switch(s.m_Operator){
1514 case CSop::opBackRef0:// The vilest depths they say.. If I only knew what the 'viles' stands for..
1515 i = s.m_Operand;
1516 ASSERT(0<i && i<=m_Subexps);
1517 if(m_Matches[i].m_End<0)
1518 return NULL;
1519 ASSERT(m_Matches[i].m_Begin>=0);
1520 len = m_Matches[i].GetLength();
1521 ASSERT((end-m_mBegin)>=len);
1522 if(sp>end-len)
1523 return NULL;// Not enough left to match..
1524 ssp = m_mBegin+m_Matches[i].m_Begin;
1525 if(memcmp(sp,ssp,len))
1526 return NULL;
1527 while(m_Strip[ss]!=CSop(CSop::opBackRef1,i))
1528 ss++;
1529 return MatchBackRef(sp+len,end,ss+1,to,level-1);
1530 break;
1531 case CSop::opQuest0:// to null or not they wonder..
1532 dp = MatchBackRef(sp,end,ss+1,to,level);
1533 if(dp)
1534 return dp;// not..
1535 return MatchBackRef(sp,end,ss+s.m_Operand+1,to,level-1);
1536 break;
1537 case CSop::opPlus0:
1538 ASSERT(m_mLastPos.GetSize());
1539 ASSERT(level+1 <= m_Pluses);
1540 m_mLastPos[level+1]=sp;
1541 return MatchBackRef(sp,end,ss+1,to,level+1);
1542 break;
1543 case CSop::opPlus1:
1544 if(sp == m_mLastPos[level])// Last pass matched null
1545 return MatchBackRef(sp,end,ss+1,to,level-1);
1546 // Try another pass..
1547 m_mLastPos[level]=sp;
1548 dp = MatchBackRef(sp,end,ss-s.m_Operand+1,to,level);
1549 if(dp)
1550 return dp;
1551 return MatchBackRef(sp,end,ss+1,to,level-1);
1552 break;
1553 case CSop::opChoice0:// find the right one, ifany
1554 ssub = ss+1;
1555 esub = ss+s.m_Operand-1;
1556 ASSERT(m_Strip[esub].m_Operator==CSop::opOr0);
1557 for(;;){// Find first matching branch.
1558 dp = MatchBackRef(sp,end,ssub,esub,level);
1559 if(dp)
1560 return dp;
1561 // This one missed, try next one..
1562 if(m_Strip[esub].m_Operator==CSop::opChoice1)
1563 return NULL;// There is none..
1564 esub++;
1565 ASSERT(m_Strip[esub].m_Operator==CSop::opOr1);
1566 ssub=esub+1;
1567 esub+=m_Strip[esub].m_Operand;
1568 if(m_Strip[esub].m_Operator==CSop::opOr1)
1569 esub--;
1570 else
1571 ASSERT(m_Strip[esub].m_Operator==CSop::opChoice1);
1572 }
1573 break;
1574 case CSop::opLeftParen:// Must undo assignment if rest fails..
1575 i = s.m_Operand;
1576 ASSERT(0<i && i<=m_Subexps);
1577 offsave = m_Matches[i].m_Begin;
1578 m_Matches[i].m_Begin = sp-m_mBegin;
1579 dp = MatchBackRef(sp,end,ss+1,to,level);
1580 if(dp)
1581 return dp;
1582 m_Matches[i].m_Begin=offsave;
1583 return NULL;
1584 break;
1585 case CSop::opRightParen: // Must undo assignment if rest fails..
1586 i = s.m_Operand;
1587 ASSERT(0<i && i<=m_Subexps);
1588 offsave = m_Matches[i].m_End;
1589 m_Matches[i].m_End = sp-m_mBegin;
1590 dp = MatchBackRef(sp,end,ss+1,to,level);
1591 if(dp)
1592 return dp;
1593 m_Matches[i].m_End = offsave;
1594 return NULL;
1595 break;
1596 #ifdef_DEBUG
1597 default:
1598 ASSERT(FALSE);
1599 break;
1600#endif
1601 }
1602 ASSERT(FALSE);
1603 return NULL;// Anyway - we can never get here..
1604}
1605
1606 #ifdef_DEBUG
1607void CRegEx::CSop::Dump(CDumpContext& dc)
1608{
1609 switch(m_Operator){
1610 case opEnd:
1611 dc << "end";
1612 break;
1613 case opChar:
1614 dc << "char('" << (char)m_Operand << "')";
1615 break;
1616 case opBOL:
1617 dc << "BOL";
1618 break;
1619 case opEOL:
1620 dc << "EOL";
1621 break;
1622 case opAny:
1623 dc << "any";
1624 break;
1625 case opAnyOf:
1626 dc << "anyOf(" << m_Operand << ")";
1627 break;
1628 case opBackRef0:
1629 dc << "[ backref(" << m_Operand << ")";
1630 break;
1631 case opBackRef1:
1632 dc << "] backref(" << m_Operand << ")";
1633 break;
1634 case opPlus0:
1635 dc << "[ + (" << m_Operand << ")";
1636 break;
1637 case opPlus1:
1638 dc << "] + (" << m_Operand << ")";
1639 break;
1640 case opQuest0:
1641 dc << "[ ? (" << m_Operand << ")";
1642 break;
1643 case opQuest1:
1644 dc << "] ? (" << m_Operand << ")";
1645 break;
1646 case opLeftParen:
1647 dc << "[ ( (" << m_Operand << ")";
1648 break;
1649 case opRightParen:
1650 dc << "] ) (" << m_Operand << ")";
1651 break;
1652 case opChoice0:
1653 dc << "[ choice (" << m_Operand << ")";
1654 break;
1655 case opOr0:
1656 dc << "[ | (" << m_Operand << ")";
1657 break;
1658 case opOr1:
1659 dc << "] | (" << m_Operand << ")";
1660 break;
1661 case opChoice1:
1662 dc << "] choice (" << m_Operand << ")";
1663 break;
1664 case opBOW:
1665 dc << "BOW";
1666 break;
1667 case opEOW:
1668 dc << "EOW";
1669 break;
1670 }
1671}
1672void CRegEx::DumpStrip(CDumpContext& dc)
1673{
1674 for(int tmp=0;tmp<m_Strip.GetSize();tmp++)
1675 dc << tmp << ": " << m_Strip[tmp] << ";\n";
1676}
1677#endif
1678
1679
1680CString CRegEx::GetMatch(int match)
1681{
1682CString rv;
1683 if(!m_Matches.GetSize())
1684 return rv;
1685 ASSERT(m_Matches[0].m_Begin<m_Input.GetLength() && m_Matches[0].m_End<=m_Input.GetLength());
1686 if(match==matchPreMatch)
1687 return m_Input.Left(m_Matches[0].m_Begin);
1688 if(match==matchPostMatch)
1689 return m_Input.Mid(m_Matches[0].m_End);
1690 if(match<0 || match >= m_Matches.GetSize())
1691 return rv;
1692 if(m_Matches[match].m_Begin<0 || m_Matches[match].m_End<0)
1693 return rv;
1694 ASSERT(m_Matches[match].m_Begin<m_Input.GetLength() && m_Matches[match].m_End<=m_Input.GetLength());
1695 rv = m_Input.Mid(m_Matches[match].m_Begin,m_Matches[match].m_End-m_Matches[match].m_Begin);
1696 return rv;
1697}
diff --git a/shared-code/RegEx.h b/shared-code/RegEx.h
new file mode 100644
index 0000000..2534768
--- a/dev/null
+++ b/shared-code/RegEx.h
@@ -0,0 +1,158 @@
1#ifndef __REGEX_H
2#define __REGEX_H
3
4 class CRegEx{
5public:
6 CString GetMatch(int match=0);
7 CString m_Input;
8 struct CMatch{
9 CMatch() : m_Begin(-1), m_End(-1) {}
10 int GetLength() { return m_End-m_Begin; }
11 int m_Begin;
12 int m_End;
13 };
14 typedefCArray<CMatch,CMatch&> CMatchBox;
15 enum{
16 matchMatch = 0,
17 matchPreMatch = -1,
18 matchPostMatch = -2
19 };
20 CMatchBox m_Matches;
21 enum{
22 charOut = 256,
23 charBOL, charEOL, charBOLEOL, charNothing, charBOW, charEOW,
24 charMaxCode = charEOW,
25 charNNChars = (charMaxCode-255)
26 };
27 int m_mFlags;
28 enum{
29 regeSuccess = 0,
30 regeNoMatch = 1, regeBadPattern, regeCollate, regeCType, regeEscape, regeSubReg, regeBracket,
31 regeParen, regeBrace, regeBadBrace, regeRange, regeSpace, regeBadRepeat, regeEmpty, regeAssert,
32 regeInvArg
33 };
34 int m_Error;
35 CRegEx();
36 BOOL m_bCompiled;
37 CString m_Pattern;
38 BOOL m_bBackRefs;
39 int m_Pluses;
40 CString m_Must;
41 BYTE m_Category[CHAR_MAX-CHAR_MIN+1];
42 int m_Categories;
43 int m_EOLs;
44 int m_BOLs;
45 int m_iFlags;
46 int m_Subexps;
47 struct CSop {
48 void Dump(CDumpContext& dc);
49 CSop(){}
50 CSop(BYTE op,DWORD opnd=0) : m_Operator(op), m_Operand(opnd) {}
51 BOOL operator==(CSop& other) {return m_Operator==other.m_Operator && m_Operand==other.m_Operand;}
52 BOOL operator!=(CSop& other) { return !((*this)==other);}
53 enum{
54 opEnd = 1, opChar, opBOL, opEOL, opAny, opAnyOf, opBackRef0, opBackRef1,
55 opPlus0, opPlus1, opQuest0, opQuest1, opLeftParen, opRightParen, opChoice0,
56 opOr0, opOr1, opChoice1, opBOW, opEOW
57 };
58 BYTE m_Operator;
59 DWORD m_Operand;
60 enum{
61 stCurrent = 1, stFresh = 2, stTemp = 4, stEmpty = 8
62 };
63 BYTE m_MatchData;
64 };
65 typedef CArray<CSop,CSop&> CStrip;
66 CStrip m_Strip;
67 int m_Flags;
68 struct CSet{
69 CSet() : m_Hash(0) { memset(m_Set,0,sizeof(m_Set)); }
70 CSet(CSet& src) { (*this)=src; }
71 CSet& operator=(CSet& src) { memmove(this,&src,sizeof(*this)); return *this; }
72 BOOL operator==(CSet& other) { if(m_Hash!=other.m_Hash)return FALSE;return !memcmp(m_Set,other.m_Set,sizeof(m_Set)); }
73 enum{
74 size = (CHAR_MAX-CHAR_MIN+1)
75 };
76 BOOL m_Set[size];
77 BYTE m_Hash;
78 public:
79 UCHAR GetOnly();
80 void Sub(UCHAR c);
81 BOOL IsIn(UCHAR c);
82 void Add(UCHAR c);
83 };
84 typedef CArray<CSet,CSet&> CSets;
85 CSets m_Sets;
86 enum{
87 // Compile flags
88 regBasic = 0, regExtended = 1,
89 regIgnoreCase = 2,
90 regNoSubExpressions = 4,// Also works for matching.
91 regNewLine = 16,
92 regLiteral = 32,
93 // Match Flags
94 regNotBOL = 1,
95 regNotEOL = 2,
96 regOneMatch=64,
97 regBackRefs=128,
98 // iFlags
99 iflagsUseBOL=1, iflagsUseEOL=2, iflagsBad=4
100 };
101 CString Replace(LPCTSTR src,LPCTSTR rep,int flags=0);
102 BOOL Match(LPCTSTR src,int flags=0);
103 BOOL Compile(LPCTSTR regex,int flags=0);
104private:
105 #ifdef_DEBUG
106 void DumpStrip(CDumpContext& dc);
107#endif
108 LPCTSTR MatchBackRef(LPCTSTR begin,LPCTSTR end,int from,int to,int level);
109 typedef CArray<LPCTSTR,LPCTSTR> CStrPtrArray;
110 CStrPtrArray m_mLastPos;
111 LPCTSTR MatchDissect(LPCTSTR begin,LPCTSTR end,int from,int to);
112 LPCTSTR MatchSlow(LPCTSTR begin,LPCTSTR end,int from,int to);
113 LPCTSTR m_cOldP;
114 BOOL MatchStatesEqual(BYTE m1,BYTE m2);
115 LPCTSTR m_mBegin;
116 void MatchStatesCopy(BYTE dst,BYTE src);
117 void MatchStep(int from,int to,BYTE maskBefore,int charCode,BYTE maskAfter);
118 void MatchStatesClear(BYTE mask);
119 LPCTSTR MatchFast(LPCTSTR begin);
120 LPCTSTR m_mEnd;
121 LPCTSTR m_mPointer;
122 BOOL ParseBREexp(BOOL ordinaryStar);
123 void ParseBRE(int stopa=0,int stopb=0);
124 void ParseLiteral();
125 int CountPluses();
126 void FigureMust();
127 BOOL IsInSameSets(UCHAR c1,UCHAR c2);
128 BOOL IsInSets(UCHAR c);
129 void Categorize();
130 int StripDuplicate(int from,int to);
131 void EmitRepeat(int pos,int from,int to);
132 UCHAR ParseBracketSymbol();
133 UCHAR ParseBracketCollatingElement(UCHAR term);
134 void ParseBracketEClass(CSet& cset);
135 void ParseBracketCClass(CSet& cset);
136 void ParseBracketTerm(CSet& cset);
137 int StoreSet(CSet& cset);
138 void ParseBracket();
139 int ParseCount();
140 void EmitNonNewLineAny();
141 void EmitOrdinary(UCHAR c);
142 void StripInsert(int pos,CSop& sop);
143 void ParseEREexp();
144 void ParseERE(int stop=0);
145 struct CParenthesis{
146 long m_Begin;
147 long m_End;
148 CParenthesis(long b=0,long e=0) : m_Begin(b), m_End(e) {}
149 };
150 typedef CArray<CParenthesis,CParenthesis&> CParens;
151 CParens m_ParseParens;
152 int m_ParsePointer;
153};
154 #ifdef_DEBUG
155inline CDumpContext& operator<<(CDumpContext& dc, CRegEx::CSop& sop) { sop.Dump(dc); return dc; }
156#endif
157
158#endif // __REGEX_H \ No newline at end of file
diff --git a/shared-code/SNMPExtDll.h b/shared-code/SNMPExtDll.h
new file mode 100644
index 0000000..14c920d
--- a/dev/null
+++ b/shared-code/SNMPExtDll.h
@@ -0,0 +1,252 @@
1 #ifndef__SNMPEXTDLL_H
2#define __SNMPEXTDLL_H
3
4#include "snmpeer.h"
5
6#include <snmp.h>
7
8namespace Klever {
9
10 class CSNMPExtDLL : public CSNMPeer{
11public:
12 HINSTANCE m_hInstance;
13 HANDLE m_hEvent;
14 AsnObjectIdentifier m_OID;
15 BOOL (SNMP_FUNC_TYPE *m_extInit)(DWORD dw,HANDLE h,AsnObjectIdentifier* aoid);
16 BOOL (SNMP_FUNC_TYPE *m_extQuery)(BYTE b,RFC1157VarBindList* rvbl,AsnInteger* ai1,AsnInteger* ai2);
17 BOOL (SNMP_FUNC_TYPE *m_extTrap)(AsnObjectIdentifier*,AsnNetworkAddress*,AsnInteger*,AsnInteger*,AsnTimeticks*,RFC1157VarBindList*);
18
19 HINSTANCE m_hSNMPAPI;
20 void (SNMP_FUNC_TYPE *m_snmpOIDFree)(AsnObjectIdentifier*);
21 LPVOID (SNMP_FUNC_TYPE *m_snmpAlloc)(UINT);
22 void (SNMP_FUNC_TYPE *m_snmpFree)(LPVOID);
23 void (SNMP_FUNC_TYPE *m_snmpVBLFree)(RFC1157VarBindList* vbl);
24 void InitSNMP() {
25 m_hSNMPAPI = ::LoadLibraryEx("SNMPAPI",NULL,0);
26 if(!m_hSNMPAPI)
27 return;
28 *(FARPROC*)&m_snmpOIDFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilOidFree");
29 *(FARPROC*)&m_snmpAlloc = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemAlloc");
30 *(FARPROC*)&m_snmpFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilMemFree");
31 *(FARPROC*)&m_snmpVBLFree = ::GetProcAddress(m_hSNMPAPI,"SnmpUtilVarBindListFree");
32 if(
33 (m_snmpFree && !m_snmpAlloc) ||
34 (m_snmpAlloc && !m_snmpFree)
35 )
36 DeinitSNMP();
37 }
38 void DeinitSNMP() {
39 if(!m_hSNMPAPI)
40 return;
41 ::FreeLibrary(m_hSNMPAPI);
42 m_hSNMPAPI=NULL;
43 }
44 void SNMPFreeOID(AsnObjectIdentifier* oid) {
45 if(m_hSNMPAPI && m_snmpOIDFree)
46 (*m_snmpOIDFree)(oid);
47 else
48 ::GlobalFree((HGLOBAL)oid->ids);
49 }
50 LPVOID SNMPAlloc(UINT size) {
51 if(m_hSNMPAPI && m_snmpAlloc)
52 return (*m_snmpAlloc)(size);
53 else
54 return ::GlobalAlloc(GMEM_FIXED,size);
55 }
56 void SNMPFree(LPVOID addr) {
57 if(m_hSNMPAPI && m_snmpFree)
58 (*m_snmpFree)(addr);
59 else
60 :: GlobalFree((HGLOBAL)addr);
61 }
62 void SNMPFreeVBL(RFC1157VarBindList& vbl) {
63 if(m_hSNMPAPI && m_snmpVBLFree)
64 (*m_snmpVBLFree)(&vbl);
65 else{
66 for(UINT tmp=0;tmp<vbl.len;tmp++) {
67 SNMPFree(vbl.list[tmp].name.ids);
68 switch(vbl.list[tmp].value.asnType){
69 case ASN_OCTETSTRING:
70 case ASN_SEQUENCE:
71 case ASN_RFC1155_IPADDRESS:
72 case ASN_RFC1155_OPAQUE:
73 // case ASN_RFC1213_DISPSTRING:
74 if(vbl.list[tmp].value.asnValue.arbitrary.dynamic)
75 SNMPFree(vbl.list[tmp].value.asnValue.arbitrary.stream);
76 break;
77 case ASN_OBJECTIDENTIFIER:
78 SNMPFree(vbl.list[tmp].value.asnValue.object.ids);
79 break;
80 default:
81 break;
82 }
83 }
84 SNMPFree(vbl.list);
85 }
86 }
87
88 BOOL SNMPBuildVBL(RFC1157VarBindList& vbl,CSNMPVarBindList& in) {
89 vbl.len = in.GetCount();
90 vbl.list = (RFC1157VarBind*)SNMPAlloc(sizeof(RFC1157VarBind)*vbl.len);
91 POSITION p = in.GetHeadPosition();
92 UINT ptr = 0;
93 while(p){
94 CSNMPVarBind& vb = in.GetNext(p);
95 ASSERT(ptr<vbl.len);
96 SNMPBuildVB(vbl.list[ptr++],vb);
97 }
98 return TRUE;
99 }
100 BOOL SNMPBuildVB(RFC1157VarBind& vb,CSNMPVarBind& in) {
101 ASSERT(in.name.type==CASNAny::typeASNOID);
102 return SNMPBuildOID(vb.name,in.name.value.oid) && SNMPBuildAA(vb.value,in.value);
103 }
104 BOOL SNMPBuildAA(AsnAny& aa,CASNAny& in) {
105 aa.asnType=in.type;
106 switch(in.type) {
107 case CASNAny::typeASNInteger:
108 aa.asnValue.number=in.value.number; break;
109 case CASNAny::typeASNOctetString:
110 // case CASNAny::typeASNDispString:
111 SNMPBuildOS(aa.asnValue.string,in.value.string); break;
112 case CASNAny::typeASNNull:
113 break;
114 case CASNAny::typeASNOID:
115 SNMPBuildOID(aa.asnValue.object,in.value.oid); break;
116 case CASNAny::typeASNSequence:
117 // case CASNAny::typeASNSequenceOf:
118 SNMPBuildOS(aa.asnValue.sequence,in.value.sequence); break;
119 case CASNAny::typeASNIP:
120 SNMPBuildFLOS(aa.asnValue.address,(LPBYTE)&in.value.ip,sizeof(in.value.ip)); break;
121 case CASNAny::typeASNCounter:
122 aa.asnValue.counter = in.value.counter; break;
123 case CASNAny::typeASNGauge:
124 aa.asnValue.gauge = in.value.gauge; break;
125 case CASNAny::typeASNTicks:
126 aa.asnValue.ticks = in.value.ticks; break;
127 case CASNAny::typeASNOpaque:
128 ASSERT(in.storeType==CASNAny::storeDynamic);
129 SNMPBuildOS(aa.asnValue.arbitrary,in.value.data); break;
130 break;
131 default:
132 ASSERT(FALSE);
133 return FALSE;
134 }
135 return TRUE;
136 }
137 BOOL SNMPBuildOS(AsnOctetString& os,CASNAny::asnOctetString& in) {
138 return SNMPBuildFLOS(os,in.data,in.size);
139 }
140 BOOL SNMPBuildOID(AsnObjectIdentifier& oid,CASNAny::asnOID& in) {
141 oid.idLength = in.size/sizeof(UINT);
142 ASSERT(!(in.size%sizeof(UINT)));
143 VERIFY(oid.ids = (UINT*)SNMPAlloc(in.size));
144 memmove(oid.ids,in.data,in.size);
145 return TRUE;
146 }
147 BOOL SNMPBuildFLOS(AsnOctetString& os,LPBYTE data,UINT size) {
148 os.length = size;
149 VERIFY(os.stream = (BYTE*)SNMPAlloc(os.length));
150 os.dynamic=TRUE;
151 memmove(os.stream,data,size);
152 return TRUE;
153 }
154 BOOL SNMPParseVBL(RFC1157VarBindList& vbl,CSNMPVarBindList& ou) {
155 for(UINT tmp=0;tmp<vbl.len;tmp++){
156 CSNMPVarBind vb;
157 SNMPParseVB(vbl.list[tmp],vb);
158 ou.AddTail(vb);
159 }
160 return TRUE;
161 }
162 BOOL SNMPParseVB(RFC1157VarBind& vb,CSNMPVarBind& ou) {
163 ou.name.Set(CASNAny::typeASNOID,(LPBYTE)vb.name.ids,vb.name.idLength*sizeof(UINT));
164 return SNMPParseAA(vb.value,ou.value);
165 }
166 BOOL SNMPParseAA(AsnAny& aa,CASNAny& ou) {
167 switch(aa.asnType){
168 case ASN_INTEGER:
169 ou.Set(CASNAny::typeASNInteger,aa.asnValue.number); break;
170 case ASN_OCTETSTRING:
171 // case ASN_RFC1213_DISPSTRING:
172 ou.Set(CASNAny::typeASNOctetString,aa.asnValue.string.stream,aa.asnValue.string.length); break;
173 case ASN_OBJECTIDENTIFIER:
174 ou.Set(CASNAny::typeASNOID,(LPBYTE)aa.asnValue.object.ids,aa.asnValue.object.idLength);
175 SNMPParseOID(aa.asnValue.object,ou.value.oid); break;
176 case ASN_SEQUENCE:
177 ou.Set(CASNAny::typeASNSequence,aa.asnValue.sequence.stream,aa.asnValue.sequence.length); break;
178 case ASN_RFC1155_IPADDRESS:
179 SNMPParseIP(aa.asnValue.address,ou); break;
180 case ASN_RFC1155_COUNTER:
181 ou.Set(CASNAny::typeASNCounter,(LONG)aa.asnValue.counter); break;
182 case ASN_RFC1155_GAUGE:
183 ou.Set(CASNAny::typeASNGauge,(LONG)aa.asnValue.gauge); break;
184 case ASN_RFC1155_TIMETICKS:
185 ou.Set(CASNAny::typeASNTicks,(LONG)aa.asnValue.ticks); break;
186 case ASN_RFC1155_OPAQUE:
187 ou.Set(CASNAny::typeASNOpaque,aa.asnValue.arbitrary.stream,aa.asnValue.arbitrary.length); break;
188 case ASN_NULL:
189 ou.Free(); break;
190 default:
191 ASSERT(FALSE);
192 return FALSE;
193 }
194 return TRUE;
195 }
196 BOOL SNMPParseOID(AsnObjectIdentifier& oid,CASNAny::asnOID& ou) {
197 ASSERT(ou.size==(oid.idLength*sizeof(UINT)));
198 memmove(ou.data,oid.ids,ou.size);
199 return TRUE;
200 }
201 BOOL SNMPParseIP(AsnIPAddress& ip,CASNAny& ou) {
202 in_addr i;
203 if(ip.length>sizeof(i))
204 return FALSE;
205 i.s_addr=0;
206 memmove(&i,ip.stream,ip.length);
207 ou.Set(i);
208 return TRUE;
209 }
210
211
212 CSNMPExtDLL(LPCTSTR dllName) : m_hInstance(NULL) { InitSNMP(); Init(dllName); }
213 ~CSNMPExtDLL() { Deinit(); DeinitSNMP(); }
214
215 BOOL Init(LPCTSTR dllName) {
216 Deinit();
217 m_hInstance = ::LoadLibraryEx(dllName,NULL,0);
218 if(!m_hInstance)
219 return FALSE;
220 *(FARPROC*)&m_extInit = ::GetProcAddress(m_hInstance,"SnmpExtensionInit");
221 *(FARPROC*)&m_extQuery = ::GetProcAddress(m_hInstance,"SnmpExtensionQuery");
222 *(FARPROC*)&m_extTrap = ::GetProcAddress(m_hInstance,"SnmpExtensionTrap");
223 if(!(m_extInit && m_extQuery && m_extTrap)){
224 Deinit();
225 return FALSE;
226 }
227 if(!((*m_extInit)(GetCurrentTime(),&m_hEvent,&m_OID))){
228 Deinit();
229 return FALSE;
230 }
231 return TRUE;
232 }
233 void Deinit() {
234 if(!m_hInstance)
235 return;
236 ::FreeLibrary(m_hInstance);
237 }
238 virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) {
239 RFC1157VarBindList vbl;
240 SNMPBuildVBL(vbl,in);
241 AsnInteger errorStatus, errorIndex;
242 (*m_extQuery)(type,&vbl,&errorStatus,&errorIndex);
243 ou.RemoveAll();
244 SNMPParseVBL(vbl,ou);
245 SNMPFreeVBL(vbl);
246 return TRUE;
247 }
248};
249
250};
251
252 #endif// __SNMPEXTDLL_H
diff --git a/shared-code/SNMPOIDs.h b/shared-code/SNMPOIDs.h
new file mode 100644
index 0000000..68ee659
--- a/dev/null
+++ b/shared-code/SNMPOIDs.h
@@ -0,0 +1,221 @@
1 #ifndef__SNMPOIDS_H
2 #define__SNMPOIDS_H
3
4 #define DEFINE_OID(name,oid)static UINT name[] = oid
5
6 // MIB-II OIDs
7
8#define OIDccitt {0}
9#define OIDnull {0,0}
10#define OIDiso {1}
11#define OIDorg {1,3}
12#define OIDdod {1,3,6}
13#define OIDinternet {1,3,6,1}
14#define OIDdirectory {1,3,6,1,1}
15#define OIDmgmt {1,3,6,1,2}
16#define OIDmib_2 {1,3,6,1,2,1}
17#define OIDsystem {1,3,6,1,2,1,1}
18#define OIDsysDescr {1,3,6,1,2,1,1,1}
19#define OIDsysObjectID {1,3,6,1,2,1,1,2}
20#define OIDsysUpTime {1,3,6,1,2,1,1,3}
21#define OIDsysContact {1,3,6,1,2,1,1,4}
22#define OIDsysName {1,3,6,1,2,1,1,5}
23#define OIDsysLocation {1,3,6,1,2,1,1,6}
24#define OIDsysServices {1,3,6,1,2,1,1,7}
25#define OIDtransmission {1,3,6,1,2,1,10}
26#define OIDsnmp {1,3,6,1,2,1,11}
27#define OIDsnmpInPkts {1,3,6,1,2,1,11,1}
28#define OIDsnmpInBadValues {1,3,6,1,2,1,11,10}
29#define OIDsnmpInReadOnlys {1,3,6,1,2,1,11,11}
30#define OIDsnmpInGenErrs {1,3,6,1,2,1,11,12}
31#define OIDsnmpInTotalReqVars {1,3,6,1,2,1,11,13}
32#define OIDsnmpInTotalSetVars {1,3,6,1,2,1,11,14}
33#define OIDsnmpInGetRequests {1,3,6,1,2,1,11,15}
34#define OIDsnmpInGetNexts {1,3,6,1,2,1,11,16}
35#define OIDsnmpInSetRequests {1,3,6,1,2,1,11,17}
36#define OIDsnmpInGetResponses {1,3,6,1,2,1,11,18}
37#define OIDsnmpInTraps {1,3,6,1,2,1,11,19}
38#define OIDsnmpOutPkts {1,3,6,1,2,1,11,2}
39#define OIDsnmpOutTooBigs {1,3,6,1,2,1,11,20}
40#define OIDsnmpOutNoSuchNames {1,3,6,1,2,1,11,21}
41#define OIDsnmpOutBadValues {1,3,6,1,2,1,11,22}
42#define OIDsnmpOutGenErrs {1,3,6,1,2,1,11,24}
43#define OIDsnmpOutGetRequests {1,3,6,1,2,1,11,25}
44#define OIDsnmpOutGetNexts {1,3,6,1,2,1,11,26}
45#define OIDsnmpOutSetRequests {1,3,6,1,2,1,11,27}
46#define OIDsnmpOutGetResponses {1,3,6,1,2,1,11,28}
47#define OIDsnmpOutTraps {1,3,6,1,2,1,11,29}
48#define OIDsnmpInBadVersions {1,3,6,1,2,1,11,3}
49#define OIDsnmpEnableAuthenTraps {1,3,6,1,2,1,11,30}
50#define OIDsnmpInBadCommunityNames {1,3,6,1,2,1,11,4}
51#define OIDsnmpInBadCommunityUses {1,3,6,1,2,1,11,5}
52#define OIDsnmpInASNParseErrs {1,3,6,1,2,1,11,6}
53#define OIDsnmpInTooBigs {1,3,6,1,2,1,11,8}
54#define OIDsnmpInNoSuchNames {1,3,6,1,2,1,11,9}
55#define OIDinterfaces {1,3,6,1,2,1,2}
56#define OIDifNumber {1,3,6,1,2,1,2,1}
57#define OIDifTable {1,3,6,1,2,1,2,2}
58#define OIDifEntry {1,3,6,1,2,1,2,2,1}
59#define OIDifIndex {1,3,6,1,2,1,2,2,1,1}
60#define OIDifInOctets {1,3,6,1,2,1,2,2,1,10}
61#define OIDifInUcastPkts {1,3,6,1,2,1,2,2,1,11}
62#define OIDifInNUcastPkts {1,3,6,1,2,1,2,2,1,12}
63#define OIDifInDiscards {1,3,6,1,2,1,2,2,1,13}
64#define OIDifInErrors {1,3,6,1,2,1,2,2,1,14}
65#define OIDifInUnknownProtos {1,3,6,1,2,1,2,2,1,15}
66#define OIDifOutOctets {1,3,6,1,2,1,2,2,1,16}
67#define OIDifOutUcastPkts {1,3,6,1,2,1,2,2,1,17}
68#define OIDifOutNUcastPkts {1,3,6,1,2,1,2,2,1,18}
69#define OIDifOutDiscards {1,3,6,1,2,1,2,2,1,19}
70#define OIDifDescr {1,3,6,1,2,1,2,2,1,2}
71#define OIDifOutErrors {1,3,6,1,2,1,2,2,1,20}
72#define OIDifOutQLen {1,3,6,1,2,1,2,2,1,21}
73#define OIDifSpecific {1,3,6,1,2,1,2,2,1,22}
74#define OIDifType {1,3,6,1,2,1,2,2,1,3}
75#define OIDifMtu {1,3,6,1,2,1,2,2,1,4}
76#define OIDifSpeed {1,3,6,1,2,1,2,2,1,5}
77#define OIDifPhysAddress {1,3,6,1,2,1,2,2,1,6}
78#define OIDifAdminStatus {1,3,6,1,2,1,2,2,1,7}
79#define OIDifOperStatus {1,3,6,1,2,1,2,2,1,8}
80#define OIDifLastChange {1,3,6,1,2,1,2,2,1,9}
81#define OIDat {1,3,6,1,2,1,3}
82#define OIDatTable {1,3,6,1,2,1,3,1}
83#define OIDatEntry {1,3,6,1,2,1,3,1,1}
84#define OIDatIfIndex {1,3,6,1,2,1,3,1,1,1}
85#define OIDatPhysAddress {1,3,6,1,2,1,3,1,1,2}
86#define OIDatNetAddress {1,3,6,1,2,1,3,1,1,3}
87#define OIDip {1,3,6,1,2,1,4}
88#define OIDipForwarding {1,3,6,1,2,1,4,1}
89#define OIDipOutRequests {1,3,6,1,2,1,4,10}
90#define OIDipOutDiscards {1,3,6,1,2,1,4,11}
91#define OIDipOutNoRoutes {1,3,6,1,2,1,4,12}
92#define OIDipReasmTimeout {1,3,6,1,2,1,4,13}
93#define OIDipReasmReqds {1,3,6,1,2,1,4,14}
94#define OIDipReasmOKs {1,3,6,1,2,1,4,15}
95#define OIDipReasmFails {1,3,6,1,2,1,4,16}
96#define OIDipFragOKs {1,3,6,1,2,1,4,17}
97#define OIDipFragFails {1,3,6,1,2,1,4,18}
98#define OIDipFragCreates {1,3,6,1,2,1,4,19}
99#define OIDipDefaultTTL {1,3,6,1,2,1,4,2}
100#define OIDipAddrTable {1,3,6,1,2,1,4,20}
101#define OIDipAddrEntry {1,3,6,1,2,1,4,20,1}
102#define OIDipAdEntAddr {1,3,6,1,2,1,4,20,1,1}
103#define OIDipAdEntIfIndex {1,3,6,1,2,1,4,20,1,2}
104#define OIDipAdEntNetMask {1,3,6,1,2,1,4,20,1,3}
105#define OIDipAdEntBcastAddr {1,3,6,1,2,1,4,20,1,4}
106#define OIDipAdEntReasmMaxSize {1,3,6,1,2,1,4,20,1,5}
107#define OIDipRouteTable {1,3,6,1,2,1,4,21}
108#define OIDipRouteEntry {1,3,6,1,2,1,4,21,1}
109#define OIDipRouteDest {1,3,6,1,2,1,4,21,1,1}
110#define OIDipRouteAge {1,3,6,1,2,1,4,21,1,10}
111#define OIDipRouteMask {1,3,6,1,2,1,4,21,1,11}
112#define OIDipRouteMetric5 {1,3,6,1,2,1,4,21,1,12}
113#define OIDipRouteInfo {1,3,6,1,2,1,4,21,1,13}
114#define OIDipRouteIfIndex {1,3,6,1,2,1,4,21,1,2}
115#define OIDipRouteMetric1 {1,3,6,1,2,1,4,21,1,3}
116#define OIDipRouteMetric2 {1,3,6,1,2,1,4,21,1,4}
117#define OIDipRouteMetric3 {1,3,6,1,2,1,4,21,1,5}
118#define OIDipRouteMetric4 {1,3,6,1,2,1,4,21,1,6}
119#define OIDipRouteNextHop {1,3,6,1,2,1,4,21,1,7}
120#define OIDipRouteType {1,3,6,1,2,1,4,21,1,8}
121#define OIDipRouteProto {1,3,6,1,2,1,4,21,1,9}
122#define OIDipNetToMediaTable {1,3,6,1,2,1,4,22}
123#define OIDipNetToMediaEntry {1,3,6,1,2,1,4,22,1}
124#define OIDipNetToMediaIfIndex {1,3,6,1,2,1,4,22,1,1}
125#define OIDipNetToMediaPhysAddress {1,3,6,1,2,1,4,22,1,2}
126#define OIDipNetToMediaNetAddress {1,3,6,1,2,1,4,22,1,3}
127#define OIDipNetToMediaType {1,3,6,1,2,1,4,22,1,4}
128#define OIDipRoutingDiscards {1,3,6,1,2,1,4,23}
129#define OIDipInReceives {1,3,6,1,2,1,4,3}
130#define OIDipInHdrErrors {1,3,6,1,2,1,4,4}
131#define OIDipInAddrErrors {1,3,6,1,2,1,4,5}
132#define OIDipForwDatagrams {1,3,6,1,2,1,4,6}
133#define OIDipInUnknownProtos {1,3,6,1,2,1,4,7}
134#define OIDipInDiscards {1,3,6,1,2,1,4,8}
135#define OIDipInDelivers {1,3,6,1,2,1,4,9}
136#define OIDicmp {1,3,6,1,2,1,5}
137#define OIDicmpInMsgs {1,3,6,1,2,1,5,1}
138#define OIDicmpInTimestamps {1,3,6,1,2,1,5,10}
139#define OIDicmpInTimestampReps {1,3,6,1,2,1,5,11}
140#define OIDicmpInAddrMasks {1,3,6,1,2,1,5,12}
141#define OIDicmpInAddrMaskReps {1,3,6,1,2,1,5,13}
142#define OIDicmpOutMsgs {1,3,6,1,2,1,5,14}
143#define OIDicmpOutErrors {1,3,6,1,2,1,5,15}
144#define OIDicmpOutDestUnreachs {1,3,6,1,2,1,5,16}
145#define OIDicmpOutTimeExcds {1,3,6,1,2,1,5,17}
146#define OIDicmpOutParmProbs {1,3,6,1,2,1,5,18}
147#define OIDicmpOutSrcQuenchs {1,3,6,1,2,1,5,19}
148#define OIDicmpInErrors {1,3,6,1,2,1,5,2}
149#define OIDicmpOutRedirects {1,3,6,1,2,1,5,20}
150#define OIDicmpOutEchos {1,3,6,1,2,1,5,21}
151#define OIDicmpOutEchoReps {1,3,6,1,2,1,5,22}
152#define OIDicmpOutTimestamps {1,3,6,1,2,1,5,23}
153#define OIDicmpOutTimestampReps {1,3,6,1,2,1,5,24}
154#define OIDicmpOutAddrMasks {1,3,6,1,2,1,5,25}
155#define OIDicmpOutAddrMaskReps {1,3,6,1,2,1,5,26}
156#define OIDicmpInDestUnreachs {1,3,6,1,2,1,5,3}
157#define OIDicmpInTimeExcds {1,3,6,1,2,1,5,4}
158#define OIDicmpInParmProbs {1,3,6,1,2,1,5,5}
159#define OIDicmpInSrcQuenchs {1,3,6,1,2,1,5,6}
160#define OIDicmpInRedirects {1,3,6,1,2,1,5,7}
161#define OIDicmpInEchos {1,3,6,1,2,1,5,8}
162#define OIDicmpInEchoReps {1,3,6,1,2,1,5,9}
163#define OIDtcp {1,3,6,1,2,1,6}
164#define OIDtcpRtoAlgorithm {1,3,6,1,2,1,6,1}
165#define OIDtcpInSegs {1,3,6,1,2,1,6,10}
166#define OIDtcpOutSegs {1,3,6,1,2,1,6,11}
167#define OIDtcpRetransSegs {1,3,6,1,2,1,6,12}
168#define OIDtcpConnTable {1,3,6,1,2,1,6,13}
169#define OIDtcpConnEntry {1,3,6,1,2,1,6,13,1}
170#define OIDtcpConnState {1,3,6,1,2,1,6,13,1,1}
171#define OIDtcpConnLocalAddress {1,3,6,1,2,1,6,13,1,2}
172#define OIDtcpConnLocalPort {1,3,6,1,2,1,6,13,1,3}
173#define OIDtcpConnRemAddress {1,3,6,1,2,1,6,13,1,4}
174#define OIDtcpConnRemPort {1,3,6,1,2,1,6,13,1,5}
175#define OIDtcpInErrs {1,3,6,1,2,1,6,14}
176#define OIDtcpOutRsts {1,3,6,1,2,1,6,15}
177#define OIDtcpRtoMin {1,3,6,1,2,1,6,2}
178#define OIDtcpRtoMax {1,3,6,1,2,1,6,3}
179#define OIDtcpMaxConn {1,3,6,1,2,1,6,4}
180#define OIDtcpActiveOpens {1,3,6,1,2,1,6,5}
181#define OIDtcpPassiveOpens {1,3,6,1,2,1,6,6}
182#define OIDtcpAttemptFails {1,3,6,1,2,1,6,7}
183#define OIDtcpEstabResets {1,3,6,1,2,1,6,8}
184#define OIDtcpCurrEstab {1,3,6,1,2,1,6,9}
185#define OIDudp {1,3,6,1,2,1,7}
186#define OIDudpInDatagrams {1,3,6,1,2,1,7,1}
187#define OIDudpNoPorts {1,3,6,1,2,1,7,2}
188#define OIDudpInErrors {1,3,6,1,2,1,7,3}
189#define OIDudpOutDatagrams {1,3,6,1,2,1,7,4}
190#define OIDudpTable {1,3,6,1,2,1,7,5}
191#define OIDudpEntry {1,3,6,1,2,1,7,5,1}
192#define OIDudpLocalAddress {1,3,6,1,2,1,7,5,1,1}
193#define OIDudpLocalPort {1,3,6,1,2,1,7,5,1,2}
194#define OIDegp {1,3,6,1,2,1,8}
195#define OIDegpInMsgs {1,3,6,1,2,1,8,1}
196#define OIDegpInErrors {1,3,6,1,2,1,8,2}
197#define OIDegpOutMsgs {1,3,6,1,2,1,8,3}
198#define OIDegpOutErrors {1,3,6,1,2,1,8,4}
199#define OIDegpNeighTable {1,3,6,1,2,1,8,5}
200#define OIDegpNeighEntry {1,3,6,1,2,1,8,5,1}
201#define OIDegpNeighState {1,3,6,1,2,1,8,5,1,1}
202#define OIDegpNeighStateUps {1,3,6,1,2,1,8,5,1,10}
203#define OIDegpNeighStateDowns {1,3,6,1,2,1,8,5,1,11}
204#define OIDegpNeighIntervalHello {1,3,6,1,2,1,8,5,1,12}
205#define OIDegpNeighIntervalPoll {1,3,6,1,2,1,8,5,1,13}
206#define OIDegpNeighMode {1,3,6,1,2,1,8,5,1,14}
207#define OIDegpNeighEventTrigger {1,3,6,1,2,1,8,5,1,15}
208#define OIDegpNeighAddr {1,3,6,1,2,1,8,5,1,2}
209#define OIDegpNeighAs {1,3,6,1,2,1,8,5,1,3}
210#define OIDegpNeighInMsgs {1,3,6,1,2,1,8,5,1,4}
211#define OIDegpNeighInErrs {1,3,6,1,2,1,8,5,1,5}
212#define OIDegpNeighOutMsgs {1,3,6,1,2,1,8,5,1,6}
213#define OIDegpNeighOutErrs {1,3,6,1,2,1,8,5,1,7}
214#define OIDegpNeighInErrMsgs {1,3,6,1,2,1,8,5,1,8}
215#define OIDegpNeighOutErrMsgs {1,3,6,1,2,1,8,5,1,9}
216#define OIDegpAs {1,3,6,1,2,1,8,6}
217#define OIDexperimental {1,3,6,1,3}
218#define OIDprivate {1,3,6,1,4}
219#define OIDenterprises {1,3,6,1,4,1}
220
221 #endif// __SNMPOIDS_H \ No newline at end of file
diff --git a/shared-code/SNMPeer.h b/shared-code/SNMPeer.h
new file mode 100644
index 0000000..68f2efe
--- a/dev/null
+++ b/shared-code/SNMPeer.h
@@ -0,0 +1,286 @@
1 #ifndef__SNMPEER_H
2#define __SNMPEER_H
3
4namespace Klever {
5
6 class CASNAny{
7public:
8 enum{
9 asnCls = 0xC0,
10 asnClsUniversal = 0x00,
11 asnClsApplication = 0x40,
12 asnClsContextSpecific = 0x80,
13 asnClsPrivate = 0xC0,
14 asnConstructed = 0x20,
15 asnPrimitive = 0x00,
16 asnTag = 0x1F,
17 // ASN.1 Primitive Tags
18 asnTagInteger = 0x02,
19 asnTagOctetString = 0x04,
20 asnTagNull = 0x05,
21 asnTagOID = 0x06,
22 // ASN.1 Constructed Tags
23 asnTagSequence = 0x10,
24 // RFC1155 Primitive Tags
25 asnTagIP = 0x00,
26 asnTagCounter = 0x01,
27 asnTagGauge = 0x02,
28 asnTagTicks = 0x03,
29 asnTagOpaque = 0x04,
30 // RFC1213 alias
31 asnTagDispString = 0x04,// (ASN.1 Octet string)
32 // RFC1157 Constructed Tags
33 asnTagGetRequest = 0x00,
34 asnTagGetNextRequest = 0x01,
35 asnTagGetResponse = 0x02,
36 asnTagSetRequest = 0x03,
37 asnTagTrap = 0x04
38 };
39 enum{
40 typeASNInteger = (asnClsUniversal|asnPrimitive|asnTagInteger),
41 typeASNOctetString = (asnClsUniversal|asnPrimitive|asnTagOctetString),
42 typeASNNull = (asnClsUniversal|asnPrimitive|asnTagNull),
43 typeASNOID = (asnClsUniversal|asnPrimitive|asnTagOID),
44
45 typeASNSequence = (asnClsUniversal|asnConstructed|asnTagSequence),
46 typeASNSequenceOf = (asnClsUniversal|asnConstructed|asnTagSequence),
47
48 typeASNIP = (asnClsApplication|asnPrimitive|asnTagIP),
49 typeASNCounter = (asnClsApplication|asnPrimitive|asnTagCounter),
50 typeASNGauge = (asnClsApplication|asnPrimitive|asnTagGauge),
51 typeASNTicks = (asnClsApplication|asnPrimitive|asnTagTicks),
52 typeASNOpaque = (asnClsApplication|asnPrimitive|asnTagOpaque),
53 typeASNDispString = (asnClsUniversal|asnPrimitive|asnTagOctetString),
54
55 typeASNGetRequest = (asnClsContextSpecific|asnConstructed|asnTagGetRequest),
56 typeASNGetNextRequest = (asnClsContextSpecific|asnConstructed|asnTagGetNextRequest),
57 typeASNGetResponse = (asnClsContextSpecific|asnConstructed|asnTagGetResponse),
58 typeASNSetRequest = (asnClsContextSpecific|asnConstructed|asnTagSetRequest),
59 typeASNTrap = (asnClsContextSpecific|asnConstructed|asnTagTrap)
60 };
61
62 typedefLONG asnInteger;
63 typedef LARGE_INTEGER asnInteger64;
64 typedefDWORD asnCounter;
65 typedef ULARGE_INTEGER asnCounter64;
66 typedef DWORD asnGauge;
67 typedef ULARGE_INTEGER asnGauge64;
68 typedefDWORD asnTicks;
69 typedef ULARGE_INTEGER asnTicks64;
70 struct asnDynamic{
71 UINT size;
72 LPBYTE data;
73 BOOL Allocate(UINT size) {
74 BOOL rv = Free();
75 if(size)
76 rv=rv&&(data=new BYTE[size]);
77 if(rv)
78 asnDynamic::size=size;
79 return rv;
80 }
81 BOOL Set(LPBYTE data,UINT size) {
82 BOOL rv = Allocate(size);
83 if(rv && size)
84 memmove(asnDynamic::data,data,size);
85 return rv;
86 }
87 BOOL Free() {
88 if(!size)
89 return TRUE;
90 delete data;
91 size=0;
92 data=0;
93 return TRUE;
94 }
95 void Clean() {
96 size=0;
97 data=0;
98 }
99 BOOL Copy(asnDynamic& src) {
100 BOOL rv = Free();
101 if(rv){
102 if(src.size)
103 rv=rv&&(data = new BYTE[src.size]);
104 if(rv){
105 if(size=src.size)
106 memmove(data,src.data,size);
107 }
108 }
109 return rv;
110 }
111 };
112 typedefasnDynamic asnOctetString;
113 typedef asnDynamic asnOID;
114 typedef in_addr asnIP;
115 typedef asnDynamic asnSequence;
116
117 BYTE type;
118 enum _storeType{
119 storeDynamic,
120 storeStatic
121 }storeType;
122 union{
123 asnInteger number;
124 asnInteger64 number64;
125 asnOctetString string;
126 asnOID oid;
127 asnSequence sequence;
128 asnIP ip;
129 asnCounter counter;
130 asnCounter64 counter64;
131 asnGauge gauge;
132 asnGauge64 gauge64;
133 asnTicks ticks;
134 asnTicks64 ticks64;
135 asnDynamic data;
136 } value;
137
138 CASNAny() : type(typeASNNull), storeType(storeStatic) { value.data.Clean(); }
139 CASNAny(CASNAny& src) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Copy(src); }
140 CASNAny(BYTE type) : type(type), storeType(storeStatic) { value.data.Clean(); }
141 CASNAny(BYTE type,LONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); }
142 CASNAny(BYTE type,LONGLONG number) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,number); }
143 CASNAny(BYTE type,LPCTSTR string) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,string); }
144 CASNAny(BYTE type,LPBYTE data,UINT length) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,data,length); }
145 CASNAny(BYTE type,UINT* data,UINT size) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(type,(LPBYTE)data,size); }
146 CASNAny(in_addr& ip) : type(typeASNNull), storeType(storeStatic) { value.data.Clean();Set(ip); }
147 ~CASNAny() { Free(); }
148
149 BOOL Set(BYTE type) {
150 BOOL rv = Free();
151 CASNAny::type=type;
152 return rv;
153 }
154 BOOL Set(BYTE type,LONG number) {
155 BOOL rv = Free();
156 CASNAny::type=type;
157 value.number=number;
158 storeType=storeStatic;
159 return rv;
160 }
161 BOOL Set(BYTE type,LONGLONG number) {
162 BOOL rv = Free();
163 CASNAny::type=type;
164 value.number64.QuadPart = number;
165 storeType=storeStatic;
166 return rv;
167 }
168 BOOL Set(BYTE type,LPCTSTR string) {
169 BOOL rv = Free();
170 CASNAny::type=type;
171 rv=rv&&value.string.Set((LPBYTE)string,strlen(string)+1);
172 if(rv){
173 value.string.size--;
174 storeType=storeDynamic;
175 }
176 return rv;
177 }
178 BOOL Set(BYTE type,LPBYTE data,UINT length) {
179 BOOL rv = Free();
180 CASNAny::type=type;
181 rv=rv&&value.data.Set(data,length);
182 if(rv)
183 storeType=storeDynamic;
184 return rv;
185 }
186 BOOL Set(in_addr& ip) {
187 BOOL rv = Free();
188 memmove(&value.ip,&ip,sizeof(value.ip));
189 type=typeASNIP;
190 storeType=storeStatic;
191 return rv;
192 }
193 BOOL Free() {
194 if(storeType==storeDynamic)
195 value.data.Free();
196 else{
197 memset(&value,0,sizeof(value));
198 value.data.Clean();
199 }
200 storeType=storeStatic;
201 type=typeASNNull;
202 return TRUE;
203 }
204 BOOL Copy(CASNAny& src) {
205 BOOL rv = Free();
206 if(src.storeType==storeDynamic){
207 rv=rv&&value.data.Copy(src.value.data);
208 if(rv){
209 type=src.type;
210 storeType=src.storeType;
211 }
212 }else{
213 memmove(this,&src,sizeof(*this));
214 }
215 return rv;
216 }
217 CASNAny& operator=(CASNAny& src) {
218 VERIFY(Copy(src));
219 return *this;
220 }
221
222 // High Level
223 CString GetString() {
224 ASSERT(storeType==storeDynamic);
225 CString rv;
226 LPTSTR b = rv.GetBuffer(value.data.size+1);
227 ASSERT(b);
228 b[value.data.size]=0;
229 memmove(b,value.data.data,value.data.size);
230 rv.ReleaseBuffer();
231 return rv;
232 }
233};
234
235
236 class CSNMPVarBind{
237public:
238 CASNAny name;
239 CASNAny value;
240
241 CSNMPVarBind() {}
242 CSNMPVarBind(CASNAny& name,CASNAny& value) : name(name), value(value) {}
243 CSNMPVarBind(CASNAny& name) : name(name) {}
244 CSNMPVarBind(CSNMPVarBind& src) { Copy(src); }
245 BOOL Copy(CSNMPVarBind& src) {
246 name.Copy(src.name);
247 value.Copy(src.value);
248 return TRUE;
249 }
250 CSNMPVarBind& operator=(CSNMPVarBind& src) {
251 Copy(src);
252 return *this;
253 }
254 // High level
255 BOOL IsName(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) {
256 if(name.type!=CASNAny::typeASNOID)
257 return FALSE;
258 if(name.value.oid.size<prefixSize)
259 return FALSE;
260 if(bExact && (name.value.oid.size!=prefixSize))
261 return FALSE;
262 return !memcmp(prefix,name.value.oid.data,prefixSize);
263 }
264};
265
266 class CSNMPVarBindList: public CList<CSNMPVarBind,CSNMPVarBind&> {
267public:
268 CSNMPVarBind* GetVarBind(UINT* prefix,UINT prefixSize,BOOL bExact=FALSE) {
269 POSITION p = GetHeadPosition();
270 while(p){
271 CSNMPVarBind& vb = GetNext(p);
272 if(vb.IsName(prefix,prefixSize,bExact))
273 return &vb;
274 }
275 return NULL;
276 }
277};
278
279 class CSNMPeer{
280public:
281 virtual BOOL Request(BYTE type,CSNMPVarBindList& in,CSNMPVarBindList& ou) = 0;
282};
283
284};
285
286 #endif// __SNMPEER_H
diff --git a/shared-code/install.h b/shared-code/install.h
new file mode 100644
index 0000000..8c55ca9
--- a/dev/null
+++ b/shared-code/install.h
@@ -0,0 +1,370 @@
1 #defineWIN32_LEAN_AND_MEAN
2#define VC_EXTRALEAN
3#define WIN32_EXTRALEAN
4#include <windows.h>
5#include <shlobj.h>
6#include <winver.h>
7#include <crtdbg.h>
8#include <string.h>
9#include <stdio.h>
10
11extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID);
12
13 template<class T> class Smart{
14public:
15 T *pT;
16
17 Smart() : pT(NULL) {}
18 Smart(int cb) : pT(new T[cb]) {}
19 Smart(T* p) : pT(p) {}
20 ~Smart() { if(pT)delete pT; }
21
22 Smart& operator=(T* p) { if(pT)delete pT; pT=p; return *this; }
23 operator T* () { return pT; }
24
25 //T& operator[](int ndx) { return pT[ndx]; }
26
27 T* Detach() { T* rv = pT; pT=NULL; return rv; }
28};
29 typedefSmart<char> STRING;
30
31 #define APPEND_SLASH(str) if((str)[strlen(str)-1]!='\\')strcat(str,"\\")
32
33HINSTANCE theInstance;
34
35LPSTR strFETCH_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR val)
36{
37HKEY hkey;
38 if(RegOpenKeyEx(hRoot,subKey,0,KEY_QUERY_VALUE,&hkey)!=ERROR_SUCCESS)
39 return NULL;
40DWORD kType,cb=0;
41STRING rv;
42 if(RegQueryValueEx(hkey,val,NULL,&kType,NULL,&cb)==ERROR_SUCCESS && kType==REG_SZ){
43 rv= new char[cb];
44 _ASSERT(rv!=NULL);
45 if(RegQueryValueEx(hkey,val,NULL,&kType,(LPBYTE)(LPSTR)rv,&cb)!=ERROR_SUCCESS)
46 rv=NULL;
47 }
48 RegCloseKey(hkey);
49 return rv.Detach();
50}
51
52BOOL strSET_REG_KEY(HKEY hRoot,LPCSTR subKey,LPCSTR valName,LPCSTR val)
53{
54HKEY hkey;
55DWORD dw;
56 if(RegCreateKeyEx(hRoot,subKey,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&hkey,&dw)!=ERROR_SUCCESS)
57 return FALSE;
58BOOL rv = (RegSetValueEx(hkey,valName,0,REG_SZ,(LPBYTE)val,strlen(val)+1)==ERROR_SUCCESS);
59 RegCloseKey(hkey);
60 return rv;
61}
62
63void MAKE_PATH(LPCSTR path)
64{
65STRING tmp(strlen(path)+1);
66LPCSTR t0=path;
67LPSTR t1=tmp;
68 while(*t0){
69 if((*t0)=='\\'){
70 *t1=0;
71 CreateDirectory(tmp,NULL);
72 }
73 *(t1++)=*(t0++);
74 }
75 *t1=0;
76 CreateDirectory(tmp,NULL);
77}
78
79BOOL ADDMENU(LPCSTR menu,LPCSTR item,LPCSTR path,LPCSTR program)
80{
81STRING stm = strFETCH_REG_KEY(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders","Programs");
82 if(!stm)
83 return FALSE;
84int pil = 1+strlen(path)+1+strlen(program)+1+1;
85STRING pi(pil);
86 strcpy(pi,path);
87 APPEND_SLASH(pi);
88 strcat(pi,program);
89int ipl = strlen(stm)+1+strlen(menu)+1+strlen(item)+4+1;
90STRING ip(ipl);
91 memmove(ip,stm,strlen(stm)+1);
92 APPEND_SLASH(ip);
93 strcat(ip,menu);
94 MAKE_PATH(ip);
95 APPEND_SLASH(ip);
96 strcat(ip,item);
97 strcat(ip,".lnk");
98IShellLink* sl = NULL;
99IPersistFile* pf = NULL;
100BOOL rv = FALSE;
101 do{
102 HRESULT hrv = CoCreateInstance(CLSID_ShellLink,NULL,CLSCTX_INPROC_SERVER,IID_IShellLink,(LPVOID*)&sl);
103 if(!SUCCEEDED(hrv))
104 break;
105 sl->SetDescription(item);
106 sl->SetPath(pi);
107 hrv = sl->QueryInterface(IID_IPersistFile,(LPVOID*)&pf);
108 if(!SUCCEEDED(hrv))
109 break;
110 WORD wsz[MAX_PATH];
111 MultiByteToWideChar(CP_ACP,0,ip,-1,wsz,MAX_PATH);
112 hrv = pf->Save(wsz,TRUE);
113 if(SUCCEEDED(hrv))
114 rv=TRUE;
115 }while(FALSE);
116 if(pf)
117 pf->Release();
118 if(sl)
119 sl->Release();
120 return rv;
121}
122
123FILE* CREATE_INF_FILE(LPCSTR path,LPCSTR file)
124{
125STRING fn(strlen(path)+1+strlen(file)+1);
126 strcpy(fn,path);
127 APPEND_SLASH(fn);
128 strcat(fn,file);
129 return fopen(fn,"wt");
130}
131
132BOOL INSTALLFILE(LPCSTR res,LPCSTR path,LPCSTR file)
133{
134STRING temp(MAX_PATH);
135 if(!GetTempPath(MAX_PATH,temp)) return FALSE;
136STRING tf(MAX_PATH);
137 if(!GetTempFileName(temp,"KGI",0,tf)) return FALSE;
138HRSRC hrsrc = FindResource(NULL,res,MAKEINTRESOURCE(RT_RCDATA));
139 if(!hrsrc) return FALSE;
140DWORD sor = SizeofResource(NULL,hrsrc);
141 if(!sor) return FALSE;
142HGLOBAL hglobal = LoadResource(NULL,hrsrc);
143 if(!hglobal) return FALSE;
144LPVOID lpv = LockResource(hglobal);
145 if(!lpv) return FALSE;
146HANDLE hf = CreateFile(tf,GENERIC_READ|GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
147 if(!hf) return FALSE;
148DWORD written = 0;
149 if(!WriteFile(hf,lpv,sor,&written,NULL) || written!=sor){
150 CloseHandle(hf);
151 return FALSE;
152 }
153 CloseHandle(hf);
154STRING toKill(strlen(tf)+1);
155 strcpy(toKill,tf);
156 for(int tmp=strlen(tf)-1;tmp>0 && ((tf[tmp])!='\\');tmp--);
157 if(tf[tmp]=='\\')
158 tf[tmp++]=0;
159STRING nothing(_MAX_PATH);
160UINT nothingLength=_MAX_PATH;
161 if(VerInstallFile(0,&tf[tmp],(LPSTR)file,tf,(LPSTR)path,NULL,nothing,&nothingLength)){
162 DeleteFile(toKill);
163 return FALSE;
164 }
165 DeleteFile(toKill);
166 return TRUE;
167}
168
169LPCSTR pdTitle, pdPrompt;
170char pdPath[_MAX_PATH];
171BOOL CALLBACK pathDlgProc(HWND hwnd,UINT uMsg,WPARAM wP,LPARAM lP)
172{
173 switch(uMsg){
174 case WM_INITDIALOG:
175 SetWindowText(hwnd,pdTitle);
176 SetDlgItemText(hwnd,IDC_PROMPT,pdPrompt);
177 SetDlgItemText(hwnd,IDC_PATH,pdPath);
178 SetWindowPos(hwnd,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
179 return 1;
180 case WM_COMMAND:
181 switch(LOWORD(wP)){ // ID
182 case IDC_BROWSE:
183 switch(HIWORD(wP)){
184 case BN_CLICKED:
185 {
186 BROWSEINFO bi;
187 memset(&bi,0,sizeof(bi));
188 bi.hwndOwner=hwnd;
189 bi.pszDisplayName=pdPath;
190 bi.lpszTitle="Select Folder..";
191 bi.ulFlags=BIF_RETURNONLYFSDIRS;
192 LPITEMIDLIST lpidl=SHBrowseForFolder(&bi);
193 if(lpidl){
194 SHGetPathFromIDList(lpidl,pdPath);
195 SHFree(lpidl);
196 SetDlgItemText(hwnd,IDC_PATH,pdPath);
197 }
198 }
199 return 1;
200 }
201 break;
202 case IDOK:
203 switch(HIWORD(wP)){
204 case BN_CLICKED:
205 if(GetDlgItemText(hwnd,IDC_PATH,pdPath,sizeof(pdPath)))
206 EndDialog(hwnd,IDOK);
207 else
208 // *** Error message
209 EndDialog(hwnd,IDCANCEL);
210 return 1;
211 }
212 break;
213 case IDCANCEL:
214 switch(HIWORD(wP)){
215 case BN_CLICKED:
216 EndDialog(hwnd,IDCANCEL);
217 return 1;
218 }
219 break;
220 };
221 break;
222 }
223 return 0;
224}
225
226LPSTR REQUESTPATH(LPCSTR title,LPCSTR prompt,LPCSTR defPath)
227{
228 pdTitle=title;pdPrompt=prompt;
229 strcpy(pdPath,defPath);
230 if(DialogBox(NULL,MAKEINTRESOURCE(IDD_PATH),NULL/*Parent*/,(DLGPROC)&pathDlgProc)!=IDOK)
231 return NULL;
232STRING rv(strlen(pdPath)+1);
233 strcpy(rv,pdPath);
234 return rv.Detach();
235}
236
237HKEY uninstallKey(LPCSTR regKey) {
238 STRING rk(100+strlen(regKey)+1);
239 sprintf(rk,"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s",regKey);
240 HKEY rv = NULL;
241 DWORD dw;
242 if(RegCreateKeyEx(HKEY_LOCAL_MACHINE,rk,0,REG_NONE,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE,NULL,&rv,&dw)!=ERROR_SUCCESS)
243 return NULL;
244 return rv;
245}
246
247BOOL REG_UNINSTALL_COMMAND(LPCSTR regKey,LPCSTR dName,LPCSTR iPath,LPCSTR iFile,LPCSTR iSection)
248{
249 HKEY hKey = uninstallKey(regKey);
250 if(!hKey)
251 return FALSE;
252 BOOL rv=FALSE;
253 do{
254 if(RegSetValueEx(hKey,"DisplayName",0,REG_SZ,(LPBYTE)dName,strlen(dName)+1)!=ERROR_SUCCESS)
255 break;
256 STRING us(50+strlen(iPath)+1+strlen(iFile)+strlen(iSection)+1);
257 strcpy(us,"RunDll32 setupapi.dll,InstallHinfSection ");
258 strcat(us,iSection);
259 strcat(us," 132 ");
260 strcat(us,iPath);
261 APPEND_SLASH(us);
262 strcat(us,iFile);
263 if(RegSetValueEx(hKey,"UninstallString",0,REG_SZ,(LPBYTE)(LPCSTR)us,strlen(us)+1)!=ERROR_SUCCESS)
264 break;
265 rv=TRUE;
266 }while(FALSE);
267 RegCloseKey(hKey);
268 return rv;
269}
270BOOL REG_UNINSTALL_ICON(LPCSTR regKey,LPCSTR path,LPCSTR file,int n) {
271 HKEY hKey = uninstallKey(regKey);
272 if(!hKey)
273 return FALSE;
274 STRING uis(strlen(path)+1+strlen(file)+7);
275 strcpy(uis,path);
276 APPEND_SLASH(uis);
277 strcat(uis,file);
278 char tmp[8];
279 sprintf(tmp,";%d",n);
280 strcat(uis,tmp);
281 BOOL rv = TRUE;
282 if(RegSetValueEx(hKey,"DisplayIcon",0,REG_SZ,(LPBYTE)(LPCSTR)uis,strlen(uis)+1)!=ERROR_SUCCESS)
283 rv = FALSE;
284 RegCloseKey(hKey);
285 return rv;
286}
287BOOL REG_UNINSTALL_COMMENT(LPCSTR regKey,LPCSTR comment) {
288 HKEY hKey = uninstallKey(regKey);
289 if(!hKey)
290 return FALSE;
291 BOOL rv = TRUE;
292 if(RegSetValueEx(hKey,"lComment",0,REG_SZ,(LPBYTE)comment,strlen(comment)+1)!=ERROR_SUCCESS)
293 rv = FALSE;
294 RegCloseKey(hKey);
295 return rv;
296}
297BOOL REG_UNINSTALL_VERSION(LPCSTR regKey,LPCSTR version) {
298 HKEY hKey = uninstallKey(regKey);
299 if(!hKey)
300 return FALSE;
301 BOOL rv = TRUE;
302 if(RegSetValueEx(hKey,"DisplayVersion",0,REG_SZ,(LPBYTE)version,strlen(version)+1)!=ERROR_SUCCESS)
303 rv = FALSE;
304 RegCloseKey(hKey);
305 return rv;
306}
307BOOL REG_UNINSTALL_LOCATION(LPCSTR regKey,LPCSTR location) {
308 HKEY hKey = uninstallKey(regKey);
309 if(!hKey)
310 return FALSE;
311 BOOL rv = TRUE;
312 if(RegSetValueEx(hKey,"InstallLocation",0,REG_SZ,(LPBYTE)location,strlen(location)+1)!=ERROR_SUCCESS)
313 rv = FALSE;
314 RegCloseKey(hKey);
315 return rv;
316}
317BOOL REG_UNINSTALL_PUBLISHER(LPCSTR regKey,LPCSTR publisher) {
318 HKEY hKey = uninstallKey(regKey);
319 if(!hKey)
320 return FALSE;
321 BOOL rv = TRUE;
322 if(RegSetValueEx(hKey,"Publisher",0,REG_SZ,(LPBYTE)publisher,strlen(publisher)+1)!=ERROR_SUCCESS)
323 rv = FALSE;
324 RegCloseKey(hKey);
325 return rv;
326}
327BOOL REG_UNINSTALL_URLS(LPCSTR regKey,LPCSTR about,LPCSTR update) {
328 HKEY hKey = uninstallKey(regKey);
329 if(!hKey)
330 return FALSE;
331 BOOL rv = TRUE;
332 if(RegSetValueEx(hKey,"URLInfoAbout",0,REG_SZ,(LPBYTE)about,strlen(about)+1)!=ERROR_SUCCESS)
333 rv = FALSE;
334 if(RegSetValueEx(hKey,"URLUpdateInfo",0,REG_SZ,(LPBYTE)update,strlen(update)+1)!=ERROR_SUCCESS)
335 rv = FALSE;
336 RegCloseKey(hKey);
337 return rv;
338}
339
340 #defineINF_FILE_HEADER(i) fprintf(i,"[Version]\nSignature=\"$CHICAGO$\"\n\n")
341#define INF_FILE_SECTION(i,s) fprintf(i,"\n[%s]\n",s)
342 #defineINF_UNINSTALL_REG(i,p) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s\nHKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s,DisplayName\nHKLM,Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\%s,UninstallString\n",p,p,p)
343#define INF_MENU_GROUP(i,n,m) fprintf(i,"setup.ini, progman.groups,,\"group%d=%s\"\n",n,m)
344#define INF_MENU_ITEM(i,n,m) fprintf(i,"setup.ini, group%d,, \"\"\"%s\"\"\"\n",n,m);
345#define INF_REMOVE_ROOT(i,g,r) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,,,\"%s\"\n",g,r)
346#define INF_REMOVE_FILE(i,g,f) fprintf(i,"HKLM,Software\\Microsoft\\Windows\\CurrentVersion\\DeleteFiles\\%s,%s,,\"%s\"\n",g,f,f)
347#define INF_REMOVE_HELP_FILE(i,g,f) {INF_REMOVE_FILE(i,g,f".hlp");INF_REMOVE_FILE(i,g,f".cnt");INF_REMOVE_FILE(i,g,f".GID");INF_REMOVE_FILE(i,g,f".FTS");}
348
349LPSTR GET_SHORT_PATH(LPCSTR path)
350{
351char tmp;
352DWORD len = GetShortPathName(path,&tmp,1);
353 if(!len)
354 return NULL;
355STRING rv(len+1);
356 if(!GetShortPathName(path,rv,len+1))
357 return NULL;
358 return rv.Detach();
359}
360
361BOOL Install(void);
362
363int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE,LPSTR,int)
364{
365 theInstance=hInstance;
366 CoInitialize(NULL);
367 Install();
368 CoUninitialize();
369 return 0;
370}
diff --git a/shared-code/ip_icmp.h b/shared-code/ip_icmp.h
new file mode 100644
index 0000000..acaf7e9
--- a/dev/null
+++ b/shared-code/ip_icmp.h
@@ -0,0 +1,91 @@
1#ifndef IP_ICMPHEADER
2
3#define IP_ICMPHEADER
4
5struct icmp {
6 BYTE icmp_type;
7 BYTE icmp_code;
8 WORD icmp_cksum;
9 WORD icmp_id;
10 WORD icmp_seq;
11 char icmp_data[1];
12};
13
14#define SIZE_ICMP_HDR 8
15#define SIZE_TIME_DATA 8
16
17struct ip {
18 BYTE ip_hl:4, /* header length */
19 ip_v:4; /* version */
20 BYTE ip_tos; /* type of service */
21 short ip_len; /* total length */
22 u_short ip_id; /* identification */
23 short ip_off; /* fragment offset field */
24 BYTE ip_ttl; /* time to live */
25 BYTE ip_p; /* protocol */
26 u_short ip_sum; /* checksum */
27 struct in_addr ip_src,ip_dst; /* source and dest address */
28};
29
30#define ICMP_ECHOREPLY 0 /* echo reply */
31#define ICMP_UNREACH 3 /* dest unreachable, codes: */
32#define ICMP_UNREACH_NET 0 /* bad net */
33#define ICMP_UNREACH_HOST 1 /* bad host */
34#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
35#define ICMP_UNREACH_PORT 3 /* bad port */
36#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
37#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
38#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
39#define ICMP_REDIRECT 5 /* shorter route, codes: */
40#define ICMP_REDIRECT_NET 0 /* for network */
41#define ICMP_REDIRECT_HOST 1 /* for host */
42#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
43#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
44#define ICMP_ECHO 8 /* echo service */
45#define ICMP_TIMXCEED 11 /* time exceeded, code: */
46#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
47#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
48#define ICMP_PARAMPROB 12 /* ip header bad */
49#define ICMP_TSTAMP 13 /* timestamp request */
50#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
51#define ICMP_IREQ 15 /* information request */
52#define ICMP_IREQREPLY 16 /* information reply */
53#define ICMP_MASKREQ 17 /* address mask request */
54#define ICMP_MASKREPLY 18 /* address mask reply */
55
56#define ICMP_MAXTYPE 18
57
58#define ICMP_MINLEN 8 /* abs minimum */
59#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
60#define ICMP_MASKLEN 12 /* address mask */
61#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
62#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
63
64#define STNORM 0
65
66/* Definition of the lowest telnet byte following an IAC byte */
67#define LOW_TEL_OPT 236
68
69#define TEL_EOF 236
70#define SUSP 237
71#define ABORT 238
72
73#define SE 240
74#define NOP 241
75#define DM 242
76#define BREAK 243
77#define IP 244
78#define AO 245
79#define AYT 246
80#define EC 247
81#define EL 248
82#define GOAHEAD 249
83#define SB 250
84#define WILL 251
85#define WONT 252
86#define DO 253
87#define DONT 254
88#define IAC 255
89
90#endif
91
diff --git a/shared-code/kHelpers.h b/shared-code/kHelpers.h
new file mode 100644
index 0000000..209c6b0
--- a/dev/null
+++ b/shared-code/kHelpers.h
@@ -0,0 +1,159 @@
1 #ifndef__KHELPERS_H
2#define __KHELPERS_H
3
4#include <shlobj.h>
5
6extern "C" WINSHELLAPI void WINAPI SHFree( LPVOID);
7
8namespace Klever {
9
10 inline BOOL BrowseForFolder(CString& folder,LPCTSTR title=NULL,CWnd* pParent=NULL) {
11 BROWSEINFO bi;
12 memset(&bi,0,sizeof(bi));
13 if(pParent)
14 bi.hwndOwner=pParent->GetSafeHwnd();
15 CString rv;
16 bi.pszDisplayName=rv.GetBuffer(MAX_PATH);
17 bi.lpszTitle=title;
18 bi.ulFlags=BIF_RETURNONLYFSDIRS;
19 LPITEMIDLIST lpidl = SHBrowseForFolder(&bi);
20 if(lpidl){
21 SHGetPathFromIDList(lpidl,bi.pszDisplayName);
22 SHFree(lpidl);
23 rv.ReleaseBuffer();
24 folder=rv;
25 return TRUE;
26 }
27 rv.ReleaseBuffer();
28 return FALSE;
29 }
30 inline BOOL BrowseForFolder(CString& folder,UINT idTitle,CWnd* pParent=NULL) {
31 CString title;
32 VERIFY(title.LoadString(idTitle));
33 return BrowseForFolder(folder,title,pParent);
34 }
35 inline CString GluePathAndFile(LPCTSTR path,LPCTSTR file) {
36 CString rv = path;
37 while((!rv.IsEmpty()) && rv[rv.GetLength()-1]=='\\')
38 rv=rv.Left(rv.GetLength()-1);
39 rv+='\\';
40 while(*file && *file=='\\')
41 file++;
42 rv+=file;
43 return rv;
44 }
45 inline UINT TokenizeString(CStringList& rv,LPCTSTR string,LPCTSTR delimiter) {
46 CString s = string;
47 int found;
48 int delength = strlen(delimiter);
49 int rvc = 0;
50 while((found=s.Find(delimiter))>=0){
51 rv.AddTail(s.Left(found));
52 rvc++;
53 s=s.Mid(found+delength);
54 }
55 if(!s.IsEmpty()){
56 rv.AddTail(s);
57 rvc++;
58 }
59 return rvc;
60 }
61 inline BOOL LogRecord(LPCTSTR logFile,LPCTSTR logRecord) {
62 try{
63 CFile f(logFile,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite|CFile::shareDenyWrite);
64 f.SeekToEnd();
65 CString s = CTime::GetCurrentTime().Format("[%c] ")+logRecord+"\r\n";
66 f.Write((LPCTSTR)s,s.GetLength());
67 }catch(CException* e){
68 e->Delete();
69 return FALSE;
70 }
71 return TRUE;
72 }
73 inline BOOL ReadString(CFile* file,CString& rv) {
74 rv.Empty();
75 int nBuffer = 256;
76 TCHAR* ch = rv.GetBuffer(nBuffer);
77 int nPos = 0;
78 BOOL bRV = FALSE;
79 for(;;){
80 TCHAR c;
81 try{
82 if(file->Read(&c,sizeof(c))!=sizeof(c))
83 break;
84 bRV=TRUE;
85 }catch(CException* e){
86 e->Delete();
87 TRACE0("Exception in ReadString\n");
88 return FALSE;
89 }
90 if(nPos>=(nBuffer-1)){
91 rv.ReleaseBuffer();
92 ch = rv.GetBuffer(nBuffer=nBuffer+256);
93 ASSERT(ch);
94 }
95 if(c=='\n')
96 break;
97 ch[nPos++]=c;
98 }
99 ch[nPos]=0;
100 for(;;){
101 nPos--;
102 if(nPos<0)
103 break;
104 if(ch[nPos]!='\r')
105 break;
106 ch[nPos]=0;
107 }
108 rv.ReleaseBuffer();
109 rv.FreeExtra();
110 return bRV;
111 }
112
113 inline int LoadStringList(CStringList& list,LPCTSTR section) {
114 CString n;
115 list.RemoveAll();
116 CWinApp* app = AfxGetApp();
117 ASSERT(app);
118 for(int tmp=0;;tmp++){
119 n.Format("%d",tmp);
120 CString str = app->GetProfileString(section,n,NULL);
121 if(str.IsEmpty())
122 break;
123 list.AddTail(str);
124 }
125 return tmp;
126 }
127 inline int SaveStringList(CStringList& list,LPCTSTR section) {
128 CString n;
129 CWinApp* app = AfxGetApp();
130 ASSERT(app);
131 POSITION p = list.GetHeadPosition();
132 for(int tmp=0;p;tmp++){
133 n.Format("%d",tmp);
134 app->WriteProfileString(section,n,list.GetNext(p));
135 }
136 n.Format("%d",tmp);
137 app->WriteProfileString(section,n,NULL);
138 return tmp;
139 }
140
141 inline BOOL WriteProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR str) {
142 CWinApp* app = AfxGetApp();
143 return app->WriteProfileBinary(section,entry,(LPBYTE)str,strlen(str)+1);
144 }
145 inline CString GetProfileString(LPCTSTR section,LPCTSTR entry,LPCTSTR defval) {
146 CWinApp* app = AfxGetApp();
147 LPBYTE pData;
148 UINT nCount;
149 CString rv = defval;
150 if(app->GetProfileBinary(section,entry,&pData,&nCount)){
151 rv = (LPCTSTR)pData;
152 delete pData;
153 }
154 return rv;
155 }
156
157};
158
159#endif // __KHELPERS_H
diff --git a/shared-code/kICMP.cpp b/shared-code/kICMP.cpp
new file mode 100644
index 0000000..09a8f94
--- a/dev/null
+++ b/shared-code/kICMP.cpp
@@ -0,0 +1,300 @@
1#include "../stdafx.h"
2#include "kICMP.h"
3
4CICMP::_mechanismus CICMP::m_mechanismus = CICMP::_icmpUndetermined;
5
6BOOL CICMPDll::Initialize()
7{
8 if(m_hICMP!=INVALID_HANDLE_VALUE || m_hICMPDLL)
9 Deinitialize();
10 m_hICMPDLL = ::LoadLibraryEx("ICMP",NULL,0);
11 if(!m_hICMPDLL)
12 return FALSE;
13 *(FARPROC*)&m_icmpCF = ::GetProcAddress(m_hICMPDLL,"IcmpCreateFile");
14 *(FARPROC*)&m_icmpSE = ::GetProcAddress(m_hICMPDLL,"IcmpSendEcho");
15 *(FARPROC*)&m_icmpCH = ::GetProcAddress(m_hICMPDLL,"IcmpCloseHandle");
16 if(!(m_icmpCF && m_icmpSE && m_icmpCH)){
17 Deinitialize(); return FALSE;
18 }
19 m_hICMP = (*m_icmpCF)();
20 if(m_hICMP==INVALID_HANDLE_VALUE){
21 Deinitialize(); return FALSE;
22 }
23 TRACE0("ICMP-DLL Initialized\n");
24 return TRUE;
25}
26void CICMPDll::Deinitialize()
27{
28 if(m_hICMPDLL){
29 if(m_hICMP!=INVALID_HANDLE_VALUE && m_icmpCH)
30 (*m_icmpCH)(m_hICMP);
31 ::FreeLibrary(m_hICMPDLL); m_hICMPDLL = NULL;
32 m_icmpCF = NULL;
33 m_icmpSE = NULL;
34 m_icmpCH = NULL;
35 }
36 m_hICMP=INVALID_HANDLE_VALUE;
37 if(m_sizeOut && m_bsOut){
38 delete m_bsOut;
39 m_bsOut = NULL; m_sizeOut = 0;
40 }
41 if(m_sizeIn && m_bsIn){
42 delete m_bsIn;
43 m_bsIn = NULL; m_sizeIn = 0;
44 }
45}
46
47LONG CICMPDll::Ping(const in_addr host,const UINT packetSize,
48 const UINT timeOut,LPINT pStatus)
49{
50 if(!(m_hICMP && m_hICMPDLL && m_icmpSE)){
51 if(pStatus)
52 (*pStatus) = icmpNotInitialized;
53 return -1;
54 }
55 VERIFY(AdjustBuffers(packetSize));
56IPINFO ipi;
57 memset(&ipi,0,sizeof(ipi));
58 ipi.Ttl = 30;
59 for(UINT tmp=0;tmp<packetSize;tmp++)
60 m_bsOut[tmp]=tmp&0xFF;
61LPICMPECHO pRep = (LPICMPECHO)m_bsIn;
62 pRep->Status = 0xFFFFFFFFl;
63 if((*m_icmpSE)(m_hICMP,host.s_addr,m_bsOut,packetSize,
64 &ipi,pRep,m_sizeIn,timeOut))
65 TRACE0("ICMP-SendEcho succeeded\n");
66 else
67 TRACE0("ICMP-SendEcho failed\n");
68LONG lrv = -1;
69INT rv = ipUnknown;
70 switch(pRep->Status){
71 case IP_SUCCESS:
72 lrv = pRep->RTTime; rv = ipSuccess;
73 break;
74 case IP_BUF_TOO_SMALL: rv = ipBuffTooSmall; break;
75 case IP_DEST_NET_UNREACHABLE: rv = ipDestNetUnreachable; break;
76 case IP_DEST_HOST_UNREACHABLE: rv = ipDestHostUnreachable; break;
77 case IP_DEST_PROT_UNREACHABLE: rv = ipDestProtUnreachable; break;
78 case IP_DEST_PORT_UNREACHABLE: rv = ipDestPortUnreachable; break;
79 case IP_NO_RESOURCES: rv = ipNoResources; break;
80 case IP_BAD_OPTION: rv = ipBadOption; break;
81 case IP_HW_ERROR: rv = ipHWError; break;
82 case IP_PACKET_TOO_BIG: rv = ipPacketTooBig; break;
83 case IP_REQ_TIMED_OUT: rv = ipTimeOut; break;
84 case IP_BAD_REQ: rv = ipBadRequest; break;
85 case IP_BAD_ROUTE: rv = ipBadRoute; break;
86 case IP_TTL_EXPIRED_TRANSIT: rv = ipTTLExpiredInTransit; break;
87 case IP_TTL_EXPIRED_REASSEM: rv = ipTTLExpiredInReasm; break;
88 case IP_PARAM_PROBLEM: rv = ipParamProblem; break;
89 case IP_SOURCE_QUENCH: rv = ipSourceQuench; break;
90 case IP_OPTION_TOO_BIG: rv = ipOptionTooBig; break;
91 case IP_BAD_DESTINATION: rv = ipBadDest; break;
92 }
93 if(pStatus)
94 (*pStatus)=rv;
95 return lrv;
96}
97
98BOOL CICMPDll::AdjustBuffers(UINT packetSize)
99{
100 if(!packetSize)
101 packetSize=1;
102 if(packetSize>m_sizeOut){
103 if(m_sizeOut && m_bsOut)
104 delete m_bsOut;
105 m_bsOut = new BYTE[m_sizeOut=packetSize];
106 if(!m_bsOut)
107 return FALSE;
108 }
109UINT sin = sizeof(ICMPECHO)+SIZE_ICMP_HDR+packetSize;
110 if(sin>m_sizeIn){
111 if(m_sizeIn && m_bsIn)
112 delete m_bsIn;
113 m_bsIn = new BYTE[m_sizeIn=sin];
114 if(!m_bsIn)
115 return FALSE;
116 }
117 return TRUE;
118}
119
120
121WORD CICMPWS::m_icmpSeq = 0;
122
123BOOL CICMPWS::Initialize()
124{
125 if(m_socket!=INVALID_SOCKET)
126 Deinitialize();
127 m_socket = socket(AF_INET,SOCK_RAW,1/*ICMP*/);
128 if(m_socket==INVALID_SOCKET)
129 return FALSE;
130 TRACE0("ICMP-WS Initialized\n");
131 return TRUE;
132}
133void CICMPWS::Deinitialize()
134{
135 if(m_socket!=INVALID_SOCKET){
136 closesocket(m_socket);
137 m_socket=INVALID_SOCKET;
138 }
139 if(m_sizeOut && m_bsOut){
140 delete m_bsOut;
141 m_bsOut = NULL; m_sizeOut = 0;
142 }
143 if(m_sizeIn && m_bsIn){
144 delete m_bsIn;
145 m_bsIn = NULL; m_sizeIn = 0;
146 }
147}
148LONG CICMPWS::Ping(const in_addr host,const UINT packetSize,
149 const UINT timeOut,LPINT pStatus)
150{
151 if(m_socket==INVALID_SOCKET){
152 if(pStatus)
153 (*pStatus)=icmpNotInitialized;
154 }
155 VERIFY(AdjustBuffers(packetSize));
156icmp* pPacket = (icmp*)m_bsOut;
157 memset(pPacket,0,m_sizeOut);
158 pPacket->icmp_type = ICMP_ECHO;
159 pPacket->icmp_seq = m_icmpSeq++;
160 pPacket->icmp_id = (WORD)(::GetCurrentThreadId()&0xFFFF);
161 for(UINT tmp=0;tmp<packetSize;tmp++)
162 pPacket->icmp_data[tmp]=tmp&0xFF;
163 pPacket->icmp_cksum = cksum(pPacket,SIZE_ICMP_HDR+packetSize);
164sockaddr_in to;
165 memset(&to,0,sizeof(to));
166 to.sin_addr.s_addr = host.s_addr;
167 to.sin_family = AF_INET;
168 if(sendto(m_socket,(char*)pPacket,SIZE_ICMP_HDR+packetSize,0,
169 (SOCKADDR*)&to,sizeof(to)) != (int)(SIZE_ICMP_HDR+packetSize)){
170 TRACE1("sendto: %lu\n",WSAGetLastError());
171 if(pStatus)
172 (*pStatus)=icmpSocketError;
173 return -1;
174 }
175DWORD sentTime = ::GetTickCount();
176sockaddr_in from;
177 memset(&from,0,sizeof(from));
178 from.sin_family=AF_INET;
179 from.sin_addr.s_addr=INADDR_ANY;
180fd_set fds;
181 FD_ZERO(&fds);
182 FD_SET(m_socket,&fds);
183long lrv = -1;
184INT rv = ipTimeOut;
185 for(;;){
186 DWORD ct = ::GetTickCount();
187 if((ct-sentTime)>=timeOut){
188 TRACE0("Timeout\n");
189 break;
190 }
191 timeval tv = {
192 (timeOut-ct+sentTime)/1000,
193 (timeOut-ct+sentTime)%1000
194 };// tv_sec, tv_usec (secs,microsecs)
195 if(!select(m_socket,&fds,NULL,NULL,&tv)){
196 TRACE1("select: %d\n",WSAGetLastError());
197 break;
198 }
199 DWORD rtime = ::GetTickCount();
200 ASSERT(FD_ISSET(m_socket,&fds));
201 int fl = sizeof(from);
202 int rb = recvfrom(m_socket,(char*)m_bsIn,m_sizeIn,0,(SOCKADDR*)&from,&fl);
203 ip* pIP = (ip*)m_bsIn;
204 icmp* pICMP = (icmp*)&m_bsIn[sizeof(ip)];
205 if(pICMP->icmp_id!=pPacket->icmp_id)
206 continue;
207 if(pICMP->icmp_seq!=pPacket->icmp_seq)
208 continue;
209 if(from.sin_addr.s_addr!=host.s_addr)
210 continue;
211 if(pICMP->icmp_type==ICMP_ECHOREPLY){
212 lrv=rtime-sentTime;
213 rv=ipSuccess;
214 break;
215 }
216 rv = ipUnknown;// ***
217 break;
218 }
219 if(pStatus)
220 (*pStatus)=rv;
221 return lrv;
222}
223
224BOOL CICMPWS::AdjustBuffers(UINT packetSize)
225{
226 if(!packetSize)
227 packetSize=0;
228UINT osize = packetSize+SIZE_ICMP_HDR;
229 if(m_sizeOut<osize){
230 if(m_sizeOut && m_bsOut)
231 delete m_bsOut;
232 m_bsOut = new BYTE[m_sizeOut=osize];
233 if(!m_bsOut)
234 return FALSE;
235 }
236UINT isize = osize+sizeof(ip);
237 if(m_sizeIn<isize){
238 if(m_sizeIn && m_bsIn)
239 delete m_bsIn;
240 m_bsIn = new BYTE[m_sizeIn=isize];
241 if(!m_bsIn)
242 return FALSE;
243 }
244 return TRUE;
245}
246
247WORD CICMPWS::cksum(LPVOID data,int count)
248{
249long lSum = 0;
250WORD *pData = (WORD*)data;
251 while(count>0){
252 if(count>1){
253 lSum+=*(pData++);
254 count-=2;
255 }else{
256 lSum+=((WORD)*(BYTE*)pData)&0xFF;
257 count--;
258 }
259 }
260 lSum = (lSum&0xFFFF)+(lSum>>16);
261 lSum += (lSum>>16);
262 return (~lSum)&0xFFFF;
263}
264
265CICMP* CICMP::CreateICMP()
266{
267 if(m_mechanismus==_icmpUndetermined)
268 GuessMechanismus();
269 switch(m_mechanismus){
270 case _icmpWinsock:
271 return new CICMPWS;
272 break;
273 case _icmpDLL:
274 return new CICMPDll;
275 break;
276 }
277 return NULL;
278}
279
280void CICMP::GuessMechanismus()
281{
282 m_mechanismus=_icmpUndetermined;
283SOCKET testSocket = socket(AF_INET,SOCK_RAW,1);
284 if(testSocket!=INVALID_SOCKET){
285 closesocket(testSocket);
286 m_mechanismus=_icmpWinsock;
287 }else{
288 HINSTANCE hICMP = ::LoadLibraryEx("ICMP",NULL,0);
289 if(!hICMP)
290 return;
291 BOOL isThere = (
292 ::GetProcAddress(hICMP,"IcmpCreateFile")
293 && ::GetProcAddress(hICMP,"IcmpSendEcho")
294 && ::GetProcAddress(hICMP,"IcmpCloseHandle")
295 );
296 ::FreeLibrary(hICMP);
297 if(isThere)
298 m_mechanismus=_icmpDLL;
299 }
300} \ No newline at end of file
diff --git a/shared-code/kICMP.h b/shared-code/kICMP.h
new file mode 100644
index 0000000..7a5ceaa
--- a/dev/null
+++ b/shared-code/kICMP.h
@@ -0,0 +1,80 @@
1 #ifndef__KICMP_H
2#define __KICMP_H
3
4class CICMP {
5 enum _mechanismus {
6 _icmpUndetermined = -1,
7 _icmpWinsock = 0, _icmpDLL
8 };
9static _mechanismus m_mechanismus;
10static void GuessMechanismus();
11public:
12static
13 CICMP* CreateICMP();
14
15 enum {
16 ipSuccess = 0,
17 ipBuffTooSmall, ipDestNetUnreachable, ipDestHostUnreachable,
18 ipDestProtUnreachable, ipDestPortUnreachable, ipNoResources,
19 ipBadOption, ipHWError, ipPacketTooBig, ipTimeOut, ipBadRequest,
20 ipBadRoute, ipTTLExpiredInTransit, ipTTLExpiredInReasm,
21 ipParamProblem, ipSourceQuench, ipOptionTooBig, ipBadDest,
22 ipUnknown = -1,
23 icmpNotInitialized = -2,
24 icmpSocketError = -3
25 };
26
27 virtual BOOL Initialize() = 0;
28 virtual void Deinitialize() = 0;
29
30 virtual LONG Ping(const in_addr host,const UINT packetSize=0,
31 const UINT timeOut=10000,LPINT pStatus=NULL) = 0;
32};
33
34class CICMPDll : public CICMP {
35 HANDLE(WINAPI *m_icmpCF)(VOID);
36 BOOL(WINAPI *m_icmpSE)(HANDLE,ULONG,LPVOID,WORD,
37 PIPINFO,LPVOID,DWORD,DWORD);
38 BOOL(WINAPI *m_icmpCH)(HANDLE);
39public:
40 HINSTANCE m_hICMPDLL;
41 HANDLE m_hICMP;
42 LPBYTE m_bsIn, m_bsOut;
43 UINT m_sizeIn, m_sizeOut;
44
45 CICMPDll() : m_hICMP(INVALID_HANDLE_VALUE), m_hICMPDLL(NULL),
46 m_bsIn(NULL), m_bsOut(NULL), m_sizeIn(0), m_sizeOut(0) {}
47 virtual ~CICMPDll() { Deinitialize(); }
48
49 virtual BOOL Initialize();
50 virtual void Deinitialize();
51
52 virtual LONG Ping(const in_addr host,const UINT packetSize=0,
53 const UINT timeOut=10000,LPINT pStatus=NULL);
54
55 BOOL AdjustBuffers(UINT packetSize=0);
56};
57
58class CICMPWS : public CICMP {
59static
60 WORD m_icmpSeq;
61public:
62 SOCKET m_socket;
63 LPBYTE m_bsIn, m_bsOut;
64 UINT m_sizeIn, m_sizeOut;
65
66 CICMPWS() : m_socket(INVALID_SOCKET), m_bsIn(NULL), m_bsOut(NULL),
67 m_sizeIn(0), m_sizeOut(0) {}
68 virtual ~CICMPWS() { Deinitialize(); }
69
70 virtual BOOL Initialize();
71 virtual void Deinitialize();
72
73 virtual LONG Ping(const in_addr host,const UINT packetSize=0,
74 const UINT timeOut=10000,LPINT pStatus=NULL);
75
76 BOOL AdjustBuffers(UINT packetSize=0);
77 WORD cksum(LPVOID data,int count);
78};
79
80#endif // __KICMP_H \ No newline at end of file
diff --git a/shared-code/kinhelp.xsl b/shared-code/kinhelp.xsl
new file mode 100644
index 0000000..0bb384a
--- a/dev/null
+++ b/shared-code/kinhelp.xsl
@@ -0,0 +1,250 @@
1<?xml version="1.0"?>
2<xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 >
5 <xsl:output
6 method="text"
7 encoding="us-ascii"/>
8 <xsl:strip-space elements="*"/>
9
10 <xsl:template match="winhelp">
11 <xsl:text>{\rtf1\ansi</xsl:text>
12 <xsl:text>&#xA;@{\footnote</xsl:text>
13 <xsl:text>&#xA;THIS FILE WAS AUTOMATICALLY GENERATED FROM XML DOCUMENT.</xsl:text>
14 <xsl:text>&#xA;DO NOT MODIFY THIS FILE DIRECTLY. EDIT XML DOCUMENT INSTEAD</xsl:text>
15 <xsl:text>&#xA;}&#xA;</xsl:text>
16 <xsl:call-template name="fonttbl"/>
17 <xsl:call-template name="colortbl"/>
18 <xsl:apply-templates/>
19 <xsl:text>}</xsl:text>
20 </xsl:template>
21
22 <xsl:template match="topic">
23 <xsl:text>&#xA;\pard\plain</xsl:text>
24 <xsl:if test="descendant::*[ (@scroll='no') and
25 count(preceding-sibling::*[not(@scroll='no') and (name()!='a' and @name)])=0] ">
26 <xsl:text>\keepn</xsl:text>
27 </xsl:if>
28 <xsl:if test="@id">
29 <xsl:text>&#xA;#{\footnote </xsl:text>
30 <xsl:value-of select="@id"/>
31 <xsl:text>}</xsl:text>
32 </xsl:if>
33 <xsl:if test="@title">
34 <xsl:text>&#xA;${\footnote </xsl:text>
35 <xsl:value-of select="@title"/>
36 <xsl:text>}</xsl:text>
37 </xsl:if>
38 <xsl:if test="@keywords">
39 <xsl:text>&#xA;K{\footnote </xsl:text>
40 <xsl:value-of select="@keywords"/>
41 <xsl:text>}</xsl:text>
42 </xsl:if>
43 <xsl:apply-templates/>
44 <xsl:text>&#xA;\page&#xA;</xsl:text>
45 </xsl:template>
46
47 <xsl:template match="a[@name]">
48 <xsl:text>{#{\footnote </xsl:text>
49 <xsl:value-of select="@name"/>
50 <xsl:text>}}</xsl:text>
51 </xsl:template>
52 <xsl:template match="a[@href]">
53 <xsl:call-template name="hyperref">
54 <xsl:with-param name="href" select="@href"/>
55 <xsl:with-param name="inset"><xsl:apply-templates/></xsl:with-param>
56 </xsl:call-template>
57 </xsl:template>
58 <xsl:template name="hyperref">
59 <xsl:param name="href"/>
60 <xsl:param name="inset"/>
61 <xsl:choose>
62 <xsl:when test="starts-with($href,'http:') or starts-with($href,'mailto:') or
63 starts-with($href,'ftp:')">
64 <xsl:text>{\uldb </xsl:text>
65 <xsl:value-of select="$inset"/>
66 <xsl:text>}{\v %!ExecFile("</xsl:text>
67 <xsl:value-of select="$href"/>
68 <xsl:text>")}</xsl:text>
69 </xsl:when>
70 <xsl:when test="starts-with($href,'#')">
71 <xsl:text>{\uldb </xsl:text>
72 <xsl:value-of select="$inset"/>
73 <xsl:text>}{\v </xsl:text>
74 <xsl:value-of select="substring($href,2)"/>
75 <xsl:text>}</xsl:text>
76 </xsl:when>
77 <xsl:otherwise>
78 <xsl:message>Warining: Unqualified hyper-reference. Using as help-internal</xsl:message>
79 <xsl:text>{\uldb </xsl:text>
80 <xsl:value-of select="$inset"/>
81 <xsl:text>}{\v </xsl:text>
82 <xsl:value-of select="$href"/>
83 <xsl:text>}</xsl:text>
84 </xsl:otherwise>
85 </xsl:choose>
86 </xsl:template>
87
88 <xsl:template match="heading">
89 <xsl:text>&#xA;</xsl:text>
90 <xsl:if test="@scroll!='no'">
91 <xsl:text>\pard </xsl:text>
92 </xsl:if>
93 <xsl:text>{ \f1\fs18\b\sb120 </xsl:text>
94 <xsl:apply-templates/>
95 <xsl:text>}</xsl:text>
96 </xsl:template>
97
98 <xsl:template match="p">
99 <xsl:text>&#xA;\par\sa120\sb120\qj</xsl:text>
100 <xsl:if test="@scroll!='no'">
101 <xsl:text>\pard</xsl:text>
102 </xsl:if>
103 <xsl:text> \f1\fs18\sb120 </xsl:text>
104 <xsl:apply-templates/>
105 </xsl:template>
106
107 <xsl:template match="note">
108 <xsl:text>&#xA;\par\sa120\sb120\qj\f1\fs16 </xsl:text>
109 <xsl:apply-templates/>
110 </xsl:template>
111
112 <xsl:template match="dedication">
113 <xsl:text>&#xA;\par\sa120\sb120\qr\f1\fs16 </xsl:text>
114 <xsl:apply-templates/>
115 </xsl:template>
116
117 <xsl:template match="image">
118 <xsl:text>\{bmct </xsl:text>
119 <xsl:value-of select="@source"/>
120 <xsl:text>\}</xsl:text>
121 </xsl:template>
122
123 <xsl:template match="newsfor">
124 <xsl:text>&#xA;\par\pard\plain\f1\fs24\qc\cf2\b </xsl:text>
125 <xsl:value-of select="@version"/>
126 <xsl:text> - </xsl:text>
127 <xsl:value-of select="@date"/>
128 <xsl:apply-templates/>
129 </xsl:template>
130 <xsl:template match="ni">
131 <xsl:text>&#xA;\par\pard\plain\fi0\li0\f1\fs18 \bullet </xsl:text>
132 <xsl:apply-templates/>
133 </xsl:template>
134
135 <xsl:template match="b">
136 <xsl:text>{\b </xsl:text>
137 <xsl:apply-templates/>
138 <xsl:text>}</xsl:text>
139 </xsl:template>
140 <xsl:template match="i">
141 <xsl:text>{\i </xsl:text>
142 <xsl:apply-templates/>
143 <xsl:text>}</xsl:text>
144 </xsl:template>
145 <xsl:template match="u">
146 <xsl:text>{\ul </xsl:text>
147 <xsl:apply-templates/>
148 <xsl:text>}</xsl:text>
149 </xsl:template>
150 <xsl:template match="strike">
151 <xsl:text>{\strike </xsl:text>
152 <xsl:apply-templates/>
153 <xsl:text>}</xsl:text>
154 </xsl:template>
155
156 <xsl:template match="kin">
157 <xsl:choose>
158 <xsl:when test="@href">
159 <xsl:call-template name="hyperref">
160 <xsl:with-param name="href" select="@href"/>
161 <xsl:with-param name="inset"><xsl:text>{\b </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param>
162 </xsl:call-template>
163 </xsl:when>
164 <xsl:otherwise>
165 <xsl:text>{\b </xsl:text>
166 <xsl:apply-templates/>
167 <xsl:text>}</xsl:text>
168 </xsl:otherwise>
169 </xsl:choose>
170 </xsl:template>
171 <xsl:template match="product">
172 <xsl:choose>
173 <xsl:when test="@href">
174 <xsl:call-template name="hyperref">
175 <xsl:with-param name="href" select="@href"/>
176 <xsl:with-param name="inset"><xsl:text>{\b\cf6 </xsl:text><xsl:apply-templates/><xsl:text>}</xsl:text></xsl:with-param>
177 </xsl:call-template>
178 </xsl:when>
179 <xsl:otherwise>
180 <xsl:text>{\b\cf6 </xsl:text>
181 <xsl:apply-templates/>
182 <xsl:text>}</xsl:text>
183 </xsl:otherwise>
184 </xsl:choose>
185 </xsl:template>
186 <xsl:template match="term">
187 <xsl:text>{\i </xsl:text>
188 <xsl:apply-templates/>
189 <xsl:text>}</xsl:text>
190 </xsl:template>
191
192 <xsl:template match="rfc">
193 <xsl:call-template name="hyperref">
194 <xsl:with-param name="href" select="concat('http://www.rfc-editor.org/rfc/rfc',@num,'.txt')"/>
195 <xsl:with-param name="inset" select="concat('{\b RFC',@num,'}')"/>
196 </xsl:call-template>
197 </xsl:template>
198
199 <xsl:template match="license">
200 <xsl:text>&#xA;{</xsl:text>
201 <xsl:text>&#xA;\par\pard\plain\sb360\sa120 \f1\fs16 Copyright (c) </xsl:text>
202 <xsl:value-of select="@years"/>
203 <xsl:text> {\uldb\cf0 Klever Group (http://www.klever.net/)}{\v %!ExecFile("http://www.klever.net/")}</xsl:text>
204 <xsl:text>&#xA;\par\qj\sb120\sa120</xsl:text>
205 <xsl:text>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</xsl:text>
206 <xsl:text>&#xA;\par The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</xsl:text>
207 <xsl:text>&#xA;\par \sa360 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</xsl:text>
208 <xsl:text>&#xA;}</xsl:text>
209 </xsl:template>
210 <xsl:template match="credits">
211 <xsl:text>&#xA;\par \sa0\sb120\ql \f1\fs16 Author: {\b\uldb\cf11 Michael Krelin ({\i hacker@klever.net})}{\v %!ExecFile("mailto:hacker@klever.net")}</xsl:text>
212 <xsl:text>&#xA;\par \sa0\sb0 Fan mail send to {\i\uldb gefilte@klever.net}{\v %!ExecFile("mailto:gefilte@klever.net")}</xsl:text>
213 </xsl:template>
214
215 <xsl:template match="ul">
216 <xsl:text>\pard</xsl:text>
217 <xsl:apply-templates/>
218 <xsl:text>\pard</xsl:text>
219 </xsl:template>
220 <xsl:template match="li">
221 <!-- TODO: could be done better, but you never know with winhelp.. -->
222 <xsl:variable name="li" select=" count(ancestor::ul) "/>
223 <xsl:text>&#xA;\par \fi0\li</xsl:text><xsl:value-of
224 select="0"/><xsl:text> \bullet </xsl:text>
225 <xsl:apply-templates/>
226 </xsl:template>
227
228 <xsl:template match="topic/text()">
229 <!-- maybe only omit spaces? -->
230 </xsl:template>
231 <xsl:template match="ul/text()">
232 </xsl:template>
233
234 <xsl:template name="colortbl">
235 <xsl:text>{\colortbl;
236 \red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;
237 \red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;
238 \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;
239 \red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
240 </xsl:text>
241 </xsl:template>
242 <xsl:template name="fonttbl">
243 <xsl:text>{\fonttbl</xsl:text>
244 <xsl:text>{\f0\froman Times New Roman;}</xsl:text>
245 <xsl:text>{\f1\fswiss Arial;}</xsl:text>
246 <xsl:text>{\f3\froman Symbol;}</xsl:text>
247 <xsl:text>}</xsl:text>
248 </xsl:template>
249
250</xsl:stylesheet>
diff --git a/shared-code/ms_icmp.h b/shared-code/ms_icmp.h
new file mode 100644
index 0000000..32d97f5
--- a/dev/null
+++ b/shared-code/ms_icmp.h
@@ -0,0 +1,77 @@
1/*------------------------------------------------------------------
2* Filename: MS_ICMP.H
3*
4* Description: Prototypes of Microsoft's ICMP.DLL functions for
5* access to Internet Control Message Protocol (their stacks do
6* not support the standard Berkeley Sockets raw socket API).
7* Use this to do "ping" or "traceroute," although beware that
8* Microsoft discourages its use.
9*/
10
11
12/* Note 2: For the most part, you can refer to RFC 791 for detials on
13* how to fill in values for the IP option information structure. */
14typedef struct ip_option_information {
15 u_char Ttl; /* Time To Live (used for traceroute) */
16 u_char Tos; /* Type Of Service (usually 0) */
17 u_char Flags; /* IP header flags (usually 0) */
18 u_char OptionsSize; /* Size of options data (usually 0, max 40) */
19 u_char FAR *OptionsData;/* Options data buffer */
20 }IPINFO, *PIPINFO, FAR *LPIPINFO;
21
22/* Note 1: The Reply Buffer will have an array of ICMP_ECHO_REPLY
23* structures, followed by options and the data in ICMP echo reply
24* datagram received. You must have room for at least one ICMP
25* echo reply structure, plus 8 bytes for an ICMP header. */
26typedef struct icmp_echo_reply {
27 u_long Address; /* source address */
28 u_long Status; /* IP status value (see below) */
29 u_long RTTime; /* Round Trip Time in milliseconds */
30 u_short DataSize; /* reply data size */
31 u_short Reserved; /* */
32 void FAR *Data; /* reply data buffer */
33 typedef struct ip_option_information Options; /* reply options */
34 }ICMPECHO, *PICMPECHO, FAR *LPICMPECHO;
35
36#define IP_STATUS_BASE 11000
37#define IP_SUCCESS 0
38#define IP_BUF_TOO_SMALL (IP_STATUS_BASE + 1)
39#define IP_DEST_NET_UNREACHABLE (IP_STATUS_BASE + 2)
40#define IP_DEST_HOST_UNREACHABLE (IP_STATUS_BASE + 3)
41#define IP_DEST_PROT_UNREACHABLE (IP_STATUS_BASE + 4)
42#define IP_DEST_PORT_UNREACHABLE (IP_STATUS_BASE + 5)
43#define IP_NO_RESOURCES (IP_STATUS_BASE + 6)
44#define IP_BAD_OPTION (IP_STATUS_BASE + 7)
45#define IP_HW_ERROR (IP_STATUS_BASE + 8)
46#define IP_PACKET_TOO_BIG (IP_STATUS_BASE + 9)
47#define IP_REQ_TIMED_OUT (IP_STATUS_BASE + 10)
48#define IP_BAD_REQ (IP_STATUS_BASE + 11)
49#define IP_BAD_ROUTE (IP_STATUS_BASE + 12)
50#define IP_TTL_EXPIRED_TRANSIT (IP_STATUS_BASE + 13)
51#define IP_TTL_EXPIRED_REASSEM (IP_STATUS_BASE + 14)
52#define IP_PARAM_PROBLEM (IP_STATUS_BASE + 15)
53#define IP_SOURCE_QUENCH (IP_STATUS_BASE + 16)
54#define IP_OPTION_TOO_BIG (IP_STATUS_BASE + 17)
55#define IP_BAD_DESTINATION (IP_STATUS_BASE + 18)
56#define IP_ADDR_DELETED (IP_STATUS_BASE + 19)
57#define IP_SPEC_MTU_CHANGE (IP_STATUS_BASE + 20)
58#define IP_MTU_CHANGE (IP_STATUS_BASE + 21)
59#define IP_UNLOAD (IP_STATUS_BASE + 22)
60#define IP_GENERAL_FAILURE (IP_STATUS_BASE + 50)
61#define MAX_IP_STATUS IP_GENERAL_FAILURE
62#define IP_PENDING (IP_STATUS_BASE + 255)
63
64
65HANDLE WINAPI PASCAL IcmpCreateFile(VOID); /* INVALID_HANDLE_VALUE on error */
66BOOL WINAPI PASCAL IcmpCloseHandle(HANDLE IcmpHandle); /* FALSE on error */
67DWORD WINAPI PASCAL IcmpSendEcho(
68 HANDLE IcmpHandle, /* handle returned from IcmpCreateFile() */
69 u_long DestAddress, /* destination IP address (in network order) */
70 LPVOID RequestData, /* pointer to buffer to send */
71 WORD RequestSize, /* length of data in buffer */
72 LPIPINFO RequestOptns, /* see Note 2 below */
73 LPVOID ReplyBuffer, /* see Note 1 below */
74 DWORD ReplySize, /* length of reply (must allow at least 1 reply) */
75 DWORD Timeout /* time in milliseconds to wait for reply */
76);
77
diff --git a/shared-data/browse-icon.ico b/shared-data/browse-icon.ico
new file mode 100644
index 0000000..d2d1b3c
--- a/dev/null
+++ b/shared-data/browse-icon.ico
Binary files differ
diff --git a/shared-data/install-icon.ico b/shared-data/install-icon.ico
new file mode 100644
index 0000000..23e86a6
--- a/dev/null
+++ b/shared-data/install-icon.ico
Binary files differ
diff --git a/shared-data/klever-background.bmp b/shared-data/klever-background.bmp
new file mode 100644
index 0000000..e4d87ec
--- a/dev/null
+++ b/shared-data/klever-background.bmp
Binary files differ
diff --git a/shared-data/play-icon.ico b/shared-data/play-icon.ico
new file mode 100644
index 0000000..3d2a11e
--- a/dev/null
+++ b/shared-data/play-icon.ico
Binary files differ
diff --git a/stdafx.cpp b/stdafx.cpp
new file mode 100644
index 0000000..3291f7c
--- a/dev/null
+++ b/stdafx.cpp
@@ -0,0 +1,6 @@
1// stdafx.cpp : source file that includes just the standard includes
2 //KLog.pch will be the pre-compiled header
3 //stdafx.obj will contain the pre-compiled type information
4
5#include "stdafx.h"
6
diff --git a/stdafx.h b/stdafx.h
new file mode 100644
index 0000000..670c71b
--- a/dev/null
+++ b/stdafx.h
@@ -0,0 +1,24 @@
1// stdafx.h : include file for standard system include files,
2// or project specific include files that are used frequently, but
3// are changed infrequently
4//
5
6 #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
7
8#include <afxwin.h> // MFC core and standard components
9#include <afxext.h> // MFC extensions
10#ifndef _AFX_NO_AFXCMN_SUPPORT
11 #include <afxcmn.h> // MFC support for Windows 95 Common Controls
12#endif // _AFX_NO_AFXCMN_SUPPORT
13
14 #include <afxsock.h> // MFC socket extensions
15
16#include <afxtempl.h>
17
18#include <MMSystem.h>
19// CG: The following line was added by the Windows Multimedia component.
20#pragma comment(lib, "winmm.lib")
21
22 enum{
23 WM_TRAYICON = WM_USER,
24}; \ No newline at end of file