2 * ReactOS Win32 Applications
3 * Copyright (C) 2007 ReactOS Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 * COPYRIGHT : See COPYING in the top level directory
21 * PROJECT : Event Log Viewer
23 * PROGRAMMER: Marc Piulachs (marc.piulachs at codexchange [dot] net)
40 static const WCHAR szWindowClass
[] = L
"EVENTVWR"; /* the main window class name */
41 static const WCHAR EVENTLOG_BASE_KEY
[] = L
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\";
43 // MessageFile message buffer size
44 #define EVENT_MESSAGE_EVENTTEXT_BUFFER 1024*10
45 #define EVENT_MESSAGE_FILE_BUFFER 1024*10
46 #define EVENT_DLL_SEPARATOR L";"
47 #define EVENT_MESSAGE_FILE L"EventMessageFile"
48 #define EVENT_CATEGORY_MESSAGE_FILE L"CategoryMessageFile"
49 #define EVENT_PARAMETER_MESSAGE_FILE L"ParameterMessageFile"
51 #define MAX_LOADSTRING 255
52 #define ENTRY_SIZE 2056
55 HINSTANCE hInst
; /* current instance */
56 WCHAR szTitle
[MAX_LOADSTRING
]; /* The title bar text */
57 WCHAR szTitleTemplate
[MAX_LOADSTRING
]; /* The logged-on title bar text */
58 WCHAR szSaveFilter
[MAX_LOADSTRING
]; /* Filter Mask for the save Dialog */
59 HWND hwndMainWindow
; /* Main window */
60 HWND hwndListView
; /* ListView control */
61 HWND hwndStatus
; /* Status bar */
62 HMENU hMainMenu
; /* The application's main menu */
63 WCHAR szStatusBarTemplate
[MAX_LOADSTRING
]; /* The status bar text */
64 PEVENTLOGRECORD
*g_RecordPtrs
= NULL
;
65 DWORD g_TotalRecords
= 0;
68 LPWSTR lpSourceLogName
= NULL
;
69 LPWSTR lpComputerName
= NULL
;
74 /* Forward declarations of functions included in this code module: */
75 ATOM
MyRegisterClass(HINSTANCE hInstance
);
76 BOOL
InitInstance(HINSTANCE
, int);
77 LRESULT CALLBACK
WndProc(HWND
, UINT
, WPARAM
, LPARAM
);
78 INT_PTR CALLBACK
About(HWND
, UINT
, WPARAM
, LPARAM
);
79 INT_PTR CALLBACK
EventDetails(HWND
, UINT
, WPARAM
, LPARAM
);
80 static INT_PTR CALLBACK
StatusMessageWindowProc (HWND
, UINT
, WPARAM
, LPARAM
);
84 wWinMain(HINSTANCE hInstance
,
85 HINSTANCE hPrevInstance
,
91 INITCOMMONCONTROLSEX iccx
;
93 UNREFERENCED_PARAMETER(hPrevInstance
);
94 UNREFERENCED_PARAMETER(lpCmdLine
);
96 /* Whenever any of the common controls are used in your app,
97 * you must call InitCommonControlsEx() to register the classes
98 * for those controls. */
99 iccx
.dwSize
= sizeof(iccx
);
100 iccx
.dwICC
= ICC_LISTVIEW_CLASSES
;
101 InitCommonControlsEx(&iccx
);
103 /* Initialize global strings */
104 LoadStringW(hInstance
, IDS_APP_TITLE
, szTitle
, ARRAYSIZE(szTitle
));
105 LoadStringW(hInstance
, IDS_APP_TITLE_EX
, szTitleTemplate
, ARRAYSIZE(szTitleTemplate
));
106 LoadStringW(hInstance
, IDS_STATUS_MSG
, szStatusBarTemplate
, ARRAYSIZE(szStatusBarTemplate
));
107 MyRegisterClass(hInstance
);
109 /* Perform application initialization: */
110 if (!InitInstance(hInstance
, nCmdShow
))
115 hAccelTable
= LoadAcceleratorsW(hInstance
, MAKEINTRESOURCEW(IDA_EVENTVWR
));
117 /* Main message loop: */
118 while (GetMessageW(&msg
, NULL
, 0, 0))
120 if (!TranslateAcceleratorW(msg
.hwnd
, hAccelTable
, &msg
))
122 TranslateMessage(&msg
);
123 DispatchMessageW(&msg
);
127 return (int)msg
.wParam
;
130 static void FreeRecords(void)
137 for (iIndex
= 0; iIndex
< g_TotalRecords
; iIndex
++)
138 HeapFree(GetProcessHeap(), 0, g_RecordPtrs
[iIndex
]);
139 HeapFree(GetProcessHeap(), 0, g_RecordPtrs
);
144 ShowLastWin32Error(VOID
)
147 LPWSTR lpMessageBuffer
;
149 dwError
= GetLastError();
150 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM
,
154 (LPWSTR
)&lpMessageBuffer
,
158 MessageBoxW(hwndMainWindow
, lpMessageBuffer
, szTitle
, MB_OK
| MB_ICONERROR
);
159 LocalFree(lpMessageBuffer
);
163 EventTimeToSystemTime(DWORD EventTime
,
164 SYSTEMTIME
*pSystemTime
)
166 SYSTEMTIME st1970
= { 1970, 1, 0, 1, 0, 0, 0, 0 };
174 uUCT
.ft
.dwHighDateTime
= 0;
175 uUCT
.ft
.dwLowDateTime
= EventTime
;
176 SystemTimeToFileTime(&st1970
, &u1970
.ft
);
177 uUCT
.ll
= uUCT
.ll
* 10000000 + u1970
.ll
;
178 FileTimeToLocalFileTime(&uUCT
.ft
, &ftLocal
);
179 FileTimeToSystemTime(&ftLocal
, pSystemTime
);
190 c
= s
+ wcslen(s
) - 1;
191 while (c
>= s
&& iswspace(*c
))
199 GetEventMessageFileDLL(IN LPCWSTR lpLogName
,
200 IN LPCWSTR SourceName
,
201 IN LPCWSTR EntryName
,
202 OUT PWCHAR ExpandedName
)
205 WCHAR szModuleName
[MAX_PATH
];
206 WCHAR szKeyName
[MAX_PATH
];
208 HKEY hSourceKey
= NULL
;
209 BOOL bReturn
= FALSE
;
211 StringCbCopyW(szKeyName
, sizeof(szKeyName
), L
"SYSTEM\\CurrentControlSet\\Services\\EventLog\\");
212 StringCbCatW(szKeyName
, sizeof(szKeyName
), lpLogName
);
214 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
,
218 &hAppKey
) == ERROR_SUCCESS
)
220 if (RegOpenKeyExW(hAppKey
,
224 &hSourceKey
) == ERROR_SUCCESS
)
226 dwSize
= sizeof(szModuleName
);
227 if (RegQueryValueExW(hSourceKey
,
231 (LPBYTE
)szModuleName
,
232 &dwSize
) == ERROR_SUCCESS
)
234 /* Returns a string containing the requested substituted environment variable. */
235 ExpandEnvironmentStringsW(szModuleName
, ExpandedName
, MAX_PATH
);
244 ShowLastWin32Error();
247 if (hSourceKey
!= NULL
)
248 RegCloseKey(hSourceKey
);
251 RegCloseKey(hAppKey
);
258 GetEventCategory(IN LPCWSTR KeyName
,
259 IN LPCWSTR SourceName
,
260 IN EVENTLOGRECORD
*pevlr
,
261 OUT PWCHAR CategoryName
)
263 HANDLE hLibrary
= NULL
;
264 WCHAR szMessageDLL
[MAX_PATH
];
265 LPVOID lpMsgBuf
= NULL
;
267 if (GetEventMessageFileDLL(KeyName
, SourceName
, EVENT_CATEGORY_MESSAGE_FILE
, szMessageDLL
))
269 hLibrary
= LoadLibraryExW(szMessageDLL
, NULL
,
270 DONT_RESOLVE_DLL_REFERENCES
| LOAD_LIBRARY_AS_DATAFILE
);
271 if (hLibrary
!= NULL
)
273 /* Retrieve the message string. */
274 if (FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_HMODULE
| FORMAT_MESSAGE_ARGUMENT_ARRAY
,
276 pevlr
->EventCategory
,
277 MAKELANGID(LANG_NEUTRAL
, SUBLANG_DEFAULT
),
279 EVENT_MESSAGE_FILE_BUFFER
,
282 /* Trim the string */
285 /* Copy the category name */
286 StringCchCopyW(CategoryName
, MAX_PATH
, lpMsgBuf
);
290 LoadStringW(hInst
, IDS_NONE
, CategoryName
, MAX_PATH
);
293 if (hLibrary
!= NULL
)
294 FreeLibrary(hLibrary
);
296 /* Free the buffer allocated by FormatMessage */
304 LoadStringW(hInst
, IDS_NONE
, CategoryName
, MAX_PATH
);
311 GetEventMessage(IN LPCWSTR KeyName
,
312 IN LPCWSTR SourceName
,
313 IN EVENTLOGRECORD
*pevlr
,
314 OUT PWCHAR EventText
)
317 HANDLE hLibrary
= NULL
;
318 WCHAR SourceModuleName
[1000];
319 WCHAR ParameterModuleName
[1000];
320 LPWSTR lpMsgBuf
= NULL
;
321 WCHAR szStringIDNotFound
[MAX_LOADSTRING
];
327 /* TODO : GetEventMessageFileDLL can return a comma separated list of DLLs */
328 if (GetEventMessageFileDLL(KeyName
, SourceName
, EVENT_MESSAGE_FILE
, SourceModuleName
))
330 /* Get the event message */
331 szMessage
= (LPWSTR
)((LPBYTE
)pevlr
+ pevlr
->StringOffset
);
333 /* Allocate space for parameters */
334 szArguments
= malloc(sizeof(LPVOID
) * pevlr
->NumStrings
);
340 for (i
= 0; i
< pevlr
->NumStrings
; i
++)
342 if (wcsstr(szMessage
, L
"%%"))
344 if (GetEventMessageFileDLL(KeyName
, SourceName
, EVENT_PARAMETER_MESSAGE_FILE
, ParameterModuleName
))
346 /* Not yet support for reading messages from parameter message DLL */
350 szArguments
[i
] = szMessage
;
351 szMessage
+= wcslen(szMessage
) + 1;
354 szDll
= wcstok(SourceModuleName
, EVENT_DLL_SEPARATOR
);
355 while ((szDll
!= NULL
) && (!bDone
))
357 hLibrary
= LoadLibraryExW(szDll
, NULL
,
358 DONT_RESOLVE_DLL_REFERENCES
| LOAD_LIBRARY_AS_DATAFILE
);
359 if (hLibrary
== NULL
)
361 /* The DLL could not be loaded try the next one (if any) */
362 szDll
= wcstok(NULL
, EVENT_DLL_SEPARATOR
);
366 /* Retrieve the message string. */
367 if (FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
|
368 FORMAT_MESSAGE_ALLOCATE_BUFFER
|
369 FORMAT_MESSAGE_FROM_HMODULE
|
370 FORMAT_MESSAGE_ARGUMENT_ARRAY
,
373 MAKELANGID(LANG_NEUTRAL
, SUBLANG_DEFAULT
),
376 (va_list*)szArguments
) == 0)
378 /* We haven't found the string , get next DLL (if any) */
379 szDll
= wcstok(NULL
, EVENT_DLL_SEPARATOR
);
385 /* The ID was found and the message was formated */
388 /* Trim the string */
389 TrimNulls((LPWSTR
)lpMsgBuf
);
391 /* Copy the event text */
392 StringCchCopyW(EventText
, EVENT_MESSAGE_EVENTTEXT_BUFFER
, lpMsgBuf
);
396 FreeLibrary(hLibrary
);
402 LoadStringW(hInst
, IDS_EVENTSTRINGIDNOTFOUND
, szStringIDNotFound
, ARRAYSIZE(szStringIDNotFound
));
403 StringCchPrintfW(EventText
, EVENT_MESSAGE_EVENTTEXT_BUFFER
, szStringIDNotFound
, (pevlr
->EventID
& 0xFFFF), SourceName
);
408 /* No more dlls to try, return result */
412 LoadStringW(hInst
, IDS_EVENTSTRINGIDNOTFOUND
, szStringIDNotFound
, ARRAYSIZE(szStringIDNotFound
));
413 StringCchPrintfW(EventText
, EVENT_MESSAGE_EVENTTEXT_BUFFER
, szStringIDNotFound
, (pevlr
->EventID
& 0xFFFF), SourceName
);
420 GetEventType(IN WORD dwEventType
,
421 OUT PWCHAR eventTypeText
)
425 case EVENTLOG_ERROR_TYPE
:
426 LoadStringW(hInst
, IDS_EVENTLOG_ERROR_TYPE
, eventTypeText
, MAX_LOADSTRING
);
428 case EVENTLOG_WARNING_TYPE
:
429 LoadStringW(hInst
, IDS_EVENTLOG_WARNING_TYPE
, eventTypeText
, MAX_LOADSTRING
);
431 case EVENTLOG_INFORMATION_TYPE
:
432 LoadStringW(hInst
, IDS_EVENTLOG_INFORMATION_TYPE
, eventTypeText
, MAX_LOADSTRING
);
434 case EVENTLOG_AUDIT_SUCCESS
:
435 LoadStringW(hInst
, IDS_EVENTLOG_AUDIT_SUCCESS
, eventTypeText
, MAX_LOADSTRING
);
437 case EVENTLOG_AUDIT_FAILURE
:
438 LoadStringW(hInst
, IDS_EVENTLOG_AUDIT_FAILURE
, eventTypeText
, MAX_LOADSTRING
);
440 case EVENTLOG_SUCCESS
:
441 LoadStringW(hInst
, IDS_EVENTLOG_SUCCESS
, eventTypeText
, MAX_LOADSTRING
);
444 LoadStringW(hInst
, IDS_EVENTLOG_UNKNOWN_TYPE
, eventTypeText
, MAX_LOADSTRING
);
450 GetEventUserName(EVENTLOGRECORD
*pelr
,
455 WCHAR szDomain
[1024];
458 DWORD cbDomain
= 1024;
460 /* Point to the SID. */
461 lpSid
= (PSID
)((LPBYTE
)pelr
+ pelr
->UserSidOffset
);
464 if (pelr
->UserSidLength
> 0)
466 if (LookupAccountSidW(NULL
,
474 StringCchCopyW(pszUser
, MAX_PATH
, szName
);
484 ShowStatusMessageThread(IN LPVOID lpParameter
)
486 HWND
*phWnd
= (HWND
*)lpParameter
;
490 hWnd
= CreateDialogParamW(hInst
,
491 MAKEINTRESOURCEW(IDD_PROGRESSBOX
),
493 StatusMessageWindowProc
,
500 ShowWindow(hWnd
, SW_SHOW
);
502 /* Message loop for the Status window */
503 while (GetMessageW(&Msg
, NULL
, 0, 0))
505 TranslateMessage(&Msg
);
506 DispatchMessageW(&Msg
);
514 QueryEventMessages(LPWSTR lpMachineName
,
519 EVENTLOGRECORD
*pevlr
;
520 DWORD dwRead
, dwNeeded
, dwThisRecord
, dwTotalRecords
= 0, dwCurrentRecord
= 0, dwRecordsToRead
= 0, dwFlags
, dwMaxLength
;
523 LPWSTR lpComputerName
;
525 BOOL bResult
= TRUE
; /* Read succeeded. */
527 WCHAR szWindowTitle
[MAX_PATH
];
528 WCHAR szStatusText
[MAX_PATH
];
529 WCHAR szLocalDate
[MAX_PATH
];
530 WCHAR szLocalTime
[MAX_PATH
];
531 WCHAR szEventID
[MAX_PATH
];
532 WCHAR szEventTypeText
[MAX_LOADSTRING
];
533 WCHAR szCategoryID
[MAX_PATH
];
534 WCHAR szUsername
[MAX_PATH
];
535 WCHAR szEventText
[EVENT_MESSAGE_FILE_BUFFER
];
536 WCHAR szCategory
[MAX_PATH
];
537 WCHAR szData
[MAX_PATH
];
538 PWCHAR lpTitleTemplateEnd
;
541 LVITEMW lviEventItem
;
543 dwFlags
= EVENTLOG_FORWARDS_READ
| EVENTLOG_SEQUENTIAL_READ
;
545 /* Open the event log. */
546 hEventLog
= OpenEventLogW(lpMachineName
, lpLogName
);
547 if (hEventLog
== NULL
)
549 ShowLastWin32Error();
553 lpSourceLogName
= lpLogName
;
554 lpComputerName
= lpMachineName
;
556 /* Disable listview redraw */
557 SendMessageW(hwndListView
, WM_SETREDRAW
, FALSE
, 0);
559 /* Clear the list view */
560 (void)ListView_DeleteAllItems (hwndListView
);
563 GetOldestEventLogRecord(hEventLog
, &dwThisRecord
);
565 /* Get the total number of event log records. */
566 GetNumberOfEventLogRecords (hEventLog
, &dwTotalRecords
);
567 g_TotalRecords
= dwTotalRecords
;
569 if (dwTotalRecords
> 0)
571 EnableMenuItem(hMainMenu
, IDM_CLEAR_EVENTS
, MF_BYCOMMAND
| MF_ENABLED
);
572 EnableMenuItem(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_ENABLED
);
576 EnableMenuItem(hMainMenu
, IDM_CLEAR_EVENTS
, MF_BYCOMMAND
| MF_GRAYED
);
577 EnableMenuItem(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_GRAYED
);
580 g_RecordPtrs
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, dwTotalRecords
* sizeof(*g_RecordPtrs
));
582 /* If we have at least 1000 records show the waiting dialog */
583 if (dwTotalRecords
> 1000)
585 CloseHandle(CreateThread(NULL
,
587 ShowStatusMessageThread
,
593 while (dwCurrentRecord
< dwTotalRecords
)
595 pevlr
= HeapAlloc(GetProcessHeap(), 0, sizeof(*pevlr
));
596 g_RecordPtrs
[dwCurrentRecord
] = pevlr
;
598 bResult
= ReadEventLogW(hEventLog
, // Event log handle
599 dwFlags
, // Sequential read
600 0, // Ignored for sequential read
601 pevlr
, // Pointer to buffer
602 sizeof(*pevlr
), // Size of buffer
603 &dwRead
, // Number of bytes read
604 &dwNeeded
); // Bytes in the next record
605 if ((!bResult
) && (GetLastError () == ERROR_INSUFFICIENT_BUFFER
))
607 HeapFree(GetProcessHeap(), 0, pevlr
);
608 pevlr
= HeapAlloc(GetProcessHeap(), 0, dwNeeded
);
609 g_RecordPtrs
[dwCurrentRecord
] = pevlr
;
611 ReadEventLogW(hEventLog
, // event log handle
612 dwFlags
, // read flags
613 0, // offset; default is 0
614 pevlr
, // pointer to buffer
615 dwNeeded
, // size of buffer
616 &dwRead
, // number of bytes read
617 &dwNeeded
); // bytes in next record
622 LoadStringW(hInst
, IDS_NOT_AVAILABLE
, szUsername
, MAX_PATH
);
623 LoadStringW(hInst
, IDS_NOT_AVAILABLE
, szEventText
, MAX_PATH
);
624 LoadStringW(hInst
, IDS_NONE
, szCategory
, MAX_PATH
);
626 // Get the event source name.
627 lpSourceName
= (LPWSTR
)((LPBYTE
)pevlr
+ sizeof(EVENTLOGRECORD
));
629 // Get the computer name
630 lpComputerName
= (LPWSTR
)((LPBYTE
)pevlr
+ sizeof(EVENTLOGRECORD
) + (wcslen(lpSourceName
) + 1) * sizeof(WCHAR
));
632 // This is the data section of the current event
633 lpData
= (LPSTR
)((LPBYTE
)pevlr
+ pevlr
->DataOffset
);
635 // Compute the event type
636 EventTimeToSystemTime(pevlr
->TimeWritten
, &time
);
638 // Get the username that generated the event
639 GetEventUserName(pevlr
, szUsername
);
641 GetDateFormatW(LOCALE_USER_DEFAULT
, DATE_SHORTDATE
, &time
, NULL
, szLocalDate
, MAX_PATH
);
642 GetTimeFormatW(LOCALE_USER_DEFAULT
, 0, &time
, NULL
, szLocalTime
, MAX_PATH
);
644 GetEventType(pevlr
->EventType
, szEventTypeText
);
645 GetEventCategory(lpLogName
, lpSourceName
, pevlr
, szCategory
);
647 StringCbPrintfW(szEventID
, sizeof(szEventID
), L
"%u", (pevlr
->EventID
& 0xFFFF));
648 StringCbPrintfW(szCategoryID
, sizeof(szCategoryID
), L
"%u", pevlr
->EventCategory
);
650 lviEventItem
.mask
= LVIF_IMAGE
| LVIF_TEXT
| LVIF_PARAM
;
651 lviEventItem
.iItem
= 0;
652 lviEventItem
.iSubItem
= 0;
653 lviEventItem
.lParam
= (LPARAM
)pevlr
;
654 lviEventItem
.pszText
= szEventTypeText
;
656 switch (pevlr
->EventType
)
658 case EVENTLOG_ERROR_TYPE
:
659 lviEventItem
.iImage
= 2;
662 case EVENTLOG_AUDIT_FAILURE
:
663 lviEventItem
.iImage
= 2;
666 case EVENTLOG_WARNING_TYPE
:
667 lviEventItem
.iImage
= 1;
670 case EVENTLOG_INFORMATION_TYPE
:
671 lviEventItem
.iImage
= 0;
674 case EVENTLOG_AUDIT_SUCCESS
:
675 lviEventItem
.iImage
= 0;
678 case EVENTLOG_SUCCESS
:
679 lviEventItem
.iImage
= 0;
683 lviEventItem
.iItem
= ListView_InsertItem(hwndListView
, &lviEventItem
);
685 ListView_SetItemText(hwndListView
, lviEventItem
.iItem
, 1, szLocalDate
);
686 ListView_SetItemText(hwndListView
, lviEventItem
.iItem
, 2, szLocalTime
);
687 ListView_SetItemText(hwndListView
, lviEventItem
.iItem
, 3, lpSourceName
);
688 ListView_SetItemText(hwndListView
, lviEventItem
.iItem
, 4, szCategory
);
689 ListView_SetItemText(hwndListView
, lviEventItem
.iItem
, 5, szEventID
);
690 ListView_SetItemText(hwndListView
, lviEventItem
.iItem
, 6, szUsername
);
691 ListView_SetItemText(hwndListView
, lviEventItem
.iItem
, 7, lpComputerName
);
692 MultiByteToWideChar(CP_ACP
,
698 ListView_SetItemText(hwndListView
, lviEventItem
.iItem
, 8, szData
); // Event Text
700 dwRead
-= pevlr
->Length
;
701 pevlr
= (EVENTLOGRECORD
*)((LPBYTE
) pevlr
+ pevlr
->Length
);
710 EndDialog(hwndDlg
, 0);
712 StringCchPrintfExW(szWindowTitle
,
713 ARRAYSIZE(szWindowTitle
),
717 szTitleTemplate
, szTitle
, lpLogName
); /* i = number of characters written */
718 /* lpComputerName can be NULL here if no records was read */
719 dwMaxLength
= (DWORD
)cchRemaining
;
721 GetComputerNameW(lpTitleTemplateEnd
, &dwMaxLength
);
723 StringCchCopyW(lpTitleTemplateEnd
, dwMaxLength
, lpComputerName
);
725 StringCbPrintfW(szStatusText
, sizeof(szStatusText
), szStatusBarTemplate
, lpLogName
, dwTotalRecords
);
727 // Update the status bar
728 SendMessageW(hwndStatus
, SB_SETTEXT
, (WPARAM
)0, (LPARAM
)szStatusText
);
730 // Set the window title
731 SetWindowTextW(hwndMainWindow
, szWindowTitle
);
733 // Resume list view redraw
734 SendMessageW(hwndListView
, WM_SETREDRAW
, TRUE
, 0);
736 // Close the event log.
737 CloseEventLog(hEventLog
);
747 WCHAR szFileName
[MAX_PATH
];
749 ZeroMemory(szFileName
, sizeof(szFileName
));
751 sfn
.lpstrFile
= szFileName
;
752 sfn
.nMaxFile
= ARRAYSIZE(szFileName
);
754 if (!GetSaveFileNameW(&sfn
))
759 hEventLog
= OpenEventLogW(lpComputerName
, lpSourceLogName
);
762 ShowLastWin32Error();
766 if (!BackupEventLogW(hEventLog
, szFileName
))
768 ShowLastWin32Error();
771 CloseEventLog(hEventLog
);
779 WCHAR szFileName
[MAX_PATH
];
780 WCHAR szMessage
[MAX_LOADSTRING
];
782 ZeroMemory(szFileName
, sizeof(szFileName
));
783 ZeroMemory(szMessage
, sizeof(szMessage
));
785 LoadStringW(hInst
, IDS_CLEAREVENTS_MSG
, szMessage
, ARRAYSIZE(szMessage
));
787 sfn
.lpstrFile
= szFileName
;
788 sfn
.nMaxFile
= ARRAYSIZE(szFileName
);
790 switch (MessageBoxW(hwndMainWindow
, szMessage
, szTitle
, MB_YESNOCANCEL
| MB_ICONINFORMATION
))
799 sfn
.lpstrFile
= NULL
;
805 if (!GetSaveFileNameW(&sfn
))
813 hEventLog
= OpenEventLogW(lpComputerName
, lpSourceLogName
);
816 ShowLastWin32Error();
820 if (!ClearEventLogW(hEventLog
, sfn
.lpstrFile
))
822 ShowLastWin32Error();
823 CloseEventLog(hEventLog
);
827 CloseEventLog(hEventLog
);
836 QueryEventMessages(lpComputerName
,
842 MyRegisterClass(HINSTANCE hInstance
)
846 wcex
.cbSize
= sizeof(wcex
);
848 wcex
.lpfnWndProc
= WndProc
;
851 wcex
.hInstance
= hInstance
;
852 wcex
.hIcon
= LoadIconW(hInstance
, MAKEINTRESOURCEW(IDI_EVENTVWR
));
853 wcex
.hCursor
= LoadCursorW(NULL
, MAKEINTRESOURCEW(IDC_ARROW
));
854 wcex
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+ 1);
855 wcex
.lpszMenuName
= MAKEINTRESOURCEW(IDM_EVENTVWR
);
856 wcex
.lpszClassName
= szWindowClass
;
857 wcex
.hIconSm
= (HICON
)LoadImageW(hInstance
,
858 MAKEINTRESOURCEW(IDI_EVENTVWR
),
864 return RegisterClassExW(&wcex
);
869 GetDisplayNameFile(IN LPCWSTR lpLogName
,
870 OUT PWCHAR lpModuleName
)
874 WCHAR szModuleName
[MAX_PATH
];
878 cbKeyPath
= (wcslen(EVENTLOG_BASE_KEY
) + wcslen(lpLogName
) + 1) * sizeof(WCHAR
);
879 KeyPath
= HeapAlloc(GetProcessHeap(), 0, cbKeyPath
);
885 StringCbCopyW(KeyPath
, cbKeyPath
, EVENTLOG_BASE_KEY
);
886 StringCbCatW(KeyPath
, cbKeyPath
, lpLogName
);
888 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, KeyPath
, 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
890 HeapFree(GetProcessHeap(), 0, KeyPath
);
894 cbData
= sizeof(szModuleName
);
895 if (RegQueryValueExW(hKey
, L
"DisplayNameFile", NULL
, NULL
, (LPBYTE
)szModuleName
, &cbData
) == ERROR_SUCCESS
)
897 ExpandEnvironmentStringsW(szModuleName
, lpModuleName
, MAX_PATH
);
901 HeapFree(GetProcessHeap(), 0, KeyPath
);
906 GetDisplayNameID(IN LPCWSTR lpLogName
)
910 DWORD dwMessageID
= 0;
914 cbKeyPath
= (wcslen(EVENTLOG_BASE_KEY
) + wcslen(lpLogName
) + 1) * sizeof(WCHAR
);
915 KeyPath
= HeapAlloc(GetProcessHeap(), 0, cbKeyPath
);
921 StringCbCopyW(KeyPath
, cbKeyPath
, EVENTLOG_BASE_KEY
);
922 StringCbCatW(KeyPath
, cbKeyPath
, lpLogName
);
924 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, KeyPath
, 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
926 HeapFree(GetProcessHeap(), 0, KeyPath
);
930 cbData
= sizeof(dwMessageID
);
931 RegQueryValueExW(hKey
, L
"DisplayNameID", NULL
, NULL
, (LPBYTE
)&dwMessageID
, &cbData
);
934 HeapFree(GetProcessHeap(), 0, KeyPath
);
947 DWORD dwMaxKeyLength
;
948 WCHAR szModuleName
[MAX_PATH
];
949 LPWSTR lpDisplayName
;
950 HANDLE hLibrary
= NULL
;
952 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, EVENTLOG_BASE_KEY
, 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
957 if (RegQueryInfoKeyW(hKey
, NULL
, NULL
, NULL
, &dwNumLogs
, &dwMaxKeyLength
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
) != ERROR_SUCCESS
)
969 LogNames
= HeapAlloc(GetProcessHeap(), 0, (dwNumLogs
+ 1) * sizeof(LPWSTR
));
977 for (dwIndex
= 0; dwIndex
< dwNumLogs
; dwIndex
++)
979 LogNames
[dwIndex
] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, ((dwMaxKeyLength
+ 1) * sizeof(WCHAR
)));
981 if (LogNames
[dwIndex
] != NULL
)
983 lpcName
= dwMaxKeyLength
+ 1;
985 if (RegEnumKeyExW(hKey
, dwIndex
, LogNames
[dwIndex
], &lpcName
, NULL
, NULL
, NULL
, NULL
) == ERROR_SUCCESS
)
987 lpDisplayName
= NULL
;
989 ZeroMemory(szModuleName
, sizeof(szModuleName
));
990 GetDisplayNameFile(LogNames
[dwIndex
], szModuleName
);
991 dwMessageID
= GetDisplayNameID(LogNames
[dwIndex
]);
993 hLibrary
= LoadLibraryExW(szModuleName
, NULL
, DONT_RESOLVE_DLL_REFERENCES
| LOAD_LIBRARY_AS_DATAFILE
);
994 if (hLibrary
!= NULL
)
996 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_HMODULE
,
1000 (LPWSTR
)&lpDisplayName
,
1003 FreeLibrary(hLibrary
);
1008 InsertMenuW(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_STRING
, ID_FIRST_LOG
+ dwIndex
, lpDisplayName
);
1012 InsertMenuW(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_STRING
, ID_FIRST_LOG
+ dwIndex
, LogNames
[dwIndex
]);
1015 LocalFree(lpDisplayName
);
1020 InsertMenuW(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_SEPARATOR
, ID_FIRST_LOG
+ dwIndex
+ 1, NULL
);
1038 for (dwIndex
= 0; dwIndex
< dwNumLogs
; dwIndex
++)
1040 if (LogNames
[dwIndex
])
1042 HeapFree(GetProcessHeap(), 0, LogNames
[dwIndex
]);
1045 DeleteMenu(hMainMenu
, ID_FIRST_LOG
+ dwIndex
, MF_BYCOMMAND
);
1048 DeleteMenu(hMainMenu
, ID_FIRST_LOG
+ dwIndex
+ 1, MF_BYCOMMAND
);
1050 HeapFree(GetProcessHeap(), 0, LogNames
);
1059 InitInstance(HINSTANCE hInstance
,
1063 LVCOLUMNW lvc
= {0};
1066 hInst
= hInstance
; // Store instance handle in our global variable
1068 hwndMainWindow
= CreateWindowW(szWindowClass
,
1070 WS_OVERLAPPEDWINDOW
| WS_CLIPCHILDREN
,
1071 CW_USEDEFAULT
, 0, CW_USEDEFAULT
, 0,
1076 if (!hwndMainWindow
)
1081 hwndStatus
= CreateWindowExW(0, // no extended styles
1082 STATUSCLASSNAMEW
, // status bar
1084 WS_CHILD
| WS_BORDER
| WS_VISIBLE
, // styles
1085 0, 0, 0, 0, // x, y, cx, cy
1086 hwndMainWindow
, // parent window
1087 (HMENU
)100, // window ID
1088 hInstance
, // instance
1089 NULL
); // window data
1091 // Create our listview child window. Note that I use WS_EX_CLIENTEDGE
1092 // and WS_BORDER to create the normal "sunken" look. Also note that
1093 // LVS_EX_ styles cannot be set in CreateWindowEx().
1094 hwndListView
= CreateWindowExW(WS_EX_CLIENTEDGE
,
1097 LVS_SHOWSELALWAYS
| WS_CHILD
| WS_VISIBLE
| LVS_REPORT
,
1107 // After the ListView is created, we can add extended list view styles.
1108 (void)ListView_SetExtendedListViewStyle (hwndListView
, LVS_EX_FULLROWSELECT
);
1110 // Create the ImageList
1111 hSmall
= ImageList_Create(GetSystemMetrics(SM_CXSMICON
),
1112 GetSystemMetrics(SM_CYSMICON
),
1117 // Add event type icons to ImageList
1118 ImageList_AddIcon(hSmall
, LoadIconW(hInstance
, MAKEINTRESOURCEW(IDI_INFORMATIONICON
)));
1119 ImageList_AddIcon(hSmall
, LoadIconW(hInstance
, MAKEINTRESOURCEW(IDI_WARNINGICON
)));
1120 ImageList_AddIcon(hSmall
, LoadIconW(hInstance
, MAKEINTRESOURCEW(IDI_ERRORICON
)));
1122 // Assign ImageList to List View
1123 (void)ListView_SetImageList(hwndListView
, hSmall
, LVSIL_SMALL
);
1125 // Now set up the listview with its columns.
1126 lvc
.mask
= LVCF_TEXT
| LVCF_WIDTH
;
1128 LoadStringW(hInstance
,
1132 lvc
.pszText
= szTemp
;
1133 (void)ListView_InsertColumn(hwndListView
, 0, &lvc
);
1136 LoadStringW(hInstance
,
1140 lvc
.pszText
= szTemp
;
1141 (void)ListView_InsertColumn(hwndListView
, 1, &lvc
);
1144 LoadStringW(hInstance
,
1148 lvc
.pszText
= szTemp
;
1149 (void)ListView_InsertColumn(hwndListView
, 2, &lvc
);
1152 LoadStringW(hInstance
,
1156 lvc
.pszText
= szTemp
;
1157 (void)ListView_InsertColumn(hwndListView
, 3, &lvc
);
1160 LoadStringW(hInstance
,
1164 lvc
.pszText
= szTemp
;
1165 (void)ListView_InsertColumn(hwndListView
, 4, &lvc
);
1168 LoadStringW(hInstance
,
1172 lvc
.pszText
= szTemp
;
1173 (void)ListView_InsertColumn(hwndListView
, 5, &lvc
);
1176 LoadStringW(hInstance
,
1180 lvc
.pszText
= szTemp
;
1181 (void)ListView_InsertColumn(hwndListView
, 6, &lvc
);
1184 LoadStringW(hInstance
,
1188 lvc
.pszText
= szTemp
;
1189 (void)ListView_InsertColumn(hwndListView
, 7, &lvc
);
1192 LoadStringW(hInstance
,
1193 IDS_COLUMNEVENTDATA
,
1196 lvc
.pszText
= szTemp
;
1197 (void)ListView_InsertColumn(hwndListView
, 8, &lvc
);
1199 // Initialize the save Dialog
1200 ZeroMemory(&sfn
, sizeof(sfn
));
1201 ZeroMemory(szSaveFilter
, sizeof(szSaveFilter
));
1203 LoadStringW(hInst
, IDS_SAVE_FILTER
, szSaveFilter
, ARRAYSIZE(szSaveFilter
));
1205 sfn
.lStructSize
= sizeof(sfn
);
1206 sfn
.hwndOwner
= hwndMainWindow
;
1207 sfn
.hInstance
= hInstance
;
1208 sfn
.lpstrFilter
= szSaveFilter
;
1209 sfn
.lpstrInitialDir
= NULL
;
1210 sfn
.Flags
= OFN_HIDEREADONLY
| OFN_SHAREAWARE
;
1211 sfn
.lpstrDefExt
= NULL
;
1213 ShowWindow(hwndMainWindow
, nCmdShow
);
1214 UpdateWindow(hwndMainWindow
);
1218 QueryEventMessages(lpComputerName
, LogNames
[0]);
1220 CheckMenuRadioItem(GetMenu(hwndMainWindow
), ID_FIRST_LOG
, ID_FIRST_LOG
+ dwNumLogs
, ID_FIRST_LOG
, MF_BYCOMMAND
);
1227 WndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
1235 hMainMenu
= GetMenu(hWnd
);
1247 switch (((LPNMHDR
)lParam
)->code
)
1250 hdr
= (NMHDR FAR
*)lParam
;
1251 if (hdr
->hwndFrom
== hwndListView
)
1253 LPNMITEMACTIVATE lpnmitem
= (LPNMITEMACTIVATE
)lParam
;
1255 if (lpnmitem
->iItem
!= -1)
1258 MAKEINTRESOURCEW(IDD_EVENTPROPERTIES
),
1269 // Parse the menu selections:
1271 if ((LOWORD(wParam
) >= ID_FIRST_LOG
) && (LOWORD(wParam
) <= ID_FIRST_LOG
+ dwNumLogs
))
1273 if (LogNames
[LOWORD(wParam
) - ID_FIRST_LOG
])
1275 if (QueryEventMessages(lpComputerName
, LogNames
[LOWORD(wParam
) - ID_FIRST_LOG
]))
1277 CheckMenuRadioItem(GetMenu(hWnd
), ID_FIRST_LOG
, ID_FIRST_LOG
+ dwNumLogs
, LOWORD(wParam
), MF_BYCOMMAND
);
1283 switch (LOWORD(wParam
))
1285 case IDM_SAVE_PROTOCOL
:
1289 case IDM_CLEAR_EVENTS
:
1301 DialogBoxW(hInst
, MAKEINTRESOURCEW(IDD_ABOUTBOX
), hWnd
, About
);
1305 MessageBoxW(hwndMainWindow
,
1306 L
"Help not implemented yet!",
1308 MB_OK
| MB_ICONINFORMATION
);
1312 DestroyWindow(hWnd
);
1316 return DefWindowProcW(hWnd
, message
, wParam
, lParam
);
1323 // Gets the window rectangle
1324 GetClientRect(hWnd
, &rect
);
1326 // Relocate the listview
1327 MoveWindow(hwndListView
,
1334 // Resize the statusbar;
1335 SendMessageW(hwndStatus
, message
, wParam
, lParam
);
1340 return DefWindowProcW(hWnd
, message
, wParam
, lParam
);
1347 // Message handler for about box.
1349 About(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
1351 UNREFERENCED_PARAMETER(lParam
);
1356 return (INT_PTR
)TRUE
;
1360 if (LOWORD(wParam
) == IDOK
|| LOWORD(wParam
) == IDCANCEL
)
1362 EndDialog(hDlg
, LOWORD(wParam
));
1363 return (INT_PTR
)TRUE
;
1368 return (INT_PTR
)FALSE
;
1372 DisplayEvent(HWND hDlg
)
1374 WCHAR szEventType
[MAX_PATH
];
1375 WCHAR szTime
[MAX_PATH
];
1376 WCHAR szDate
[MAX_PATH
];
1377 WCHAR szUser
[MAX_PATH
];
1378 WCHAR szComputer
[MAX_PATH
];
1379 WCHAR szSource
[MAX_PATH
];
1380 WCHAR szCategory
[MAX_PATH
];
1381 WCHAR szEventID
[MAX_PATH
];
1382 WCHAR szEventText
[EVENT_MESSAGE_EVENTTEXT_BUFFER
];
1383 WCHAR szEventData
[MAX_PATH
];
1384 BOOL bEventData
= FALSE
;
1386 EVENTLOGRECORD
* pevlr
;
1389 // Get index of selected item
1390 iIndex
= (int)SendMessageW(hwndListView
, LVM_GETNEXTITEM
, -1, LVNI_SELECTED
| LVNI_FOCUSED
);
1392 li
.mask
= LVIF_PARAM
;
1396 (void)ListView_GetItem(hwndListView
, &li
);
1398 pevlr
= (EVENTLOGRECORD
*)li
.lParam
;
1402 ListView_GetItemText(hwndListView
, iIndex
, 0, szEventType
, ARRAYSIZE(szEventType
));
1403 ListView_GetItemText(hwndListView
, iIndex
, 1, szDate
, ARRAYSIZE(szDate
));
1404 ListView_GetItemText(hwndListView
, iIndex
, 2, szTime
, ARRAYSIZE(szTime
));
1405 ListView_GetItemText(hwndListView
, iIndex
, 3, szSource
, ARRAYSIZE(szSource
));
1406 ListView_GetItemText(hwndListView
, iIndex
, 4, szCategory
, ARRAYSIZE(szCategory
));
1407 ListView_GetItemText(hwndListView
, iIndex
, 5, szEventID
, ARRAYSIZE(szEventID
));
1408 ListView_GetItemText(hwndListView
, iIndex
, 6, szUser
, ARRAYSIZE(szUser
));
1409 ListView_GetItemText(hwndListView
, iIndex
, 7, szComputer
, ARRAYSIZE(szComputer
));
1411 bEventData
= !(pevlr
->DataLength
== 0);
1413 if (pevlr
->DataLength
> 0)
1415 MultiByteToWideChar(CP_ACP
,
1417 (LPCSTR
)((LPBYTE
)pevlr
+ pevlr
->DataOffset
),
1423 GetEventMessage(lpSourceLogName
, szSource
, pevlr
, szEventText
);
1425 EnableWindow(GetDlgItem(hDlg
, IDC_BYTESRADIO
), bEventData
);
1426 EnableWindow(GetDlgItem(hDlg
, IDC_WORDRADIO
), bEventData
);
1428 SetDlgItemTextW(hDlg
, IDC_EVENTDATESTATIC
, szDate
);
1429 SetDlgItemTextW(hDlg
, IDC_EVENTTIMESTATIC
, szTime
);
1430 SetDlgItemTextW(hDlg
, IDC_EVENTUSERSTATIC
, szUser
);
1431 SetDlgItemTextW(hDlg
, IDC_EVENTSOURCESTATIC
, szSource
);
1432 SetDlgItemTextW(hDlg
, IDC_EVENTCOMPUTERSTATIC
, szComputer
);
1433 SetDlgItemTextW(hDlg
, IDC_EVENTCATEGORYSTATIC
, szCategory
);
1434 SetDlgItemTextW(hDlg
, IDC_EVENTIDSTATIC
, szEventID
);
1435 SetDlgItemTextW(hDlg
, IDC_EVENTTYPESTATIC
, szEventType
);
1436 SetDlgItemTextW(hDlg
, IDC_EVENTTEXTEDIT
, szEventText
);
1437 SetDlgItemTextW(hDlg
, IDC_EVENTDATAEDIT
, szEventData
);
1442 L
"No Items in ListView",
1444 MB_OK
| MB_ICONINFORMATION
);
1449 CopyEventEntry(HWND hWnd
)
1451 WCHAR output
[4130], tmpHeader
[512];
1452 WCHAR szEventType
[MAX_PATH
];
1453 WCHAR szSource
[MAX_PATH
];
1454 WCHAR szCategory
[MAX_PATH
];
1455 WCHAR szEventID
[MAX_PATH
];
1456 WCHAR szDate
[MAX_PATH
];
1457 WCHAR szTime
[MAX_PATH
];
1458 WCHAR szUser
[MAX_PATH
];
1459 WCHAR szComputer
[MAX_PATH
];
1460 WCHAR evtDesc
[ENTRY_SIZE
];
1463 if (!OpenClipboard(hWnd
))
1466 /* First, empty the clipboard before we begin to use it */
1469 /* Get the formatted text needed to place the content into */
1470 LoadStringW(hInst
, IDS_COPY
, tmpHeader
, ARRAYSIZE(tmpHeader
));
1472 /* Grabs all the information and get it ready for the clipboard */
1473 GetDlgItemTextW(hWnd
, IDC_EVENTTYPESTATIC
, szEventType
, ARRAYSIZE(szEventType
));
1474 GetDlgItemTextW(hWnd
, IDC_EVENTSOURCESTATIC
, szSource
, ARRAYSIZE(szSource
));
1475 GetDlgItemTextW(hWnd
, IDC_EVENTCATEGORYSTATIC
, szCategory
, ARRAYSIZE(szCategory
));
1476 GetDlgItemTextW(hWnd
, IDC_EVENTIDSTATIC
, szEventID
, ARRAYSIZE(szEventID
));
1477 GetDlgItemTextW(hWnd
, IDC_EVENTDATESTATIC
, szDate
, ARRAYSIZE(szDate
));
1478 GetDlgItemTextW(hWnd
, IDC_EVENTTIMESTATIC
, szTime
, ARRAYSIZE(szTime
));
1479 GetDlgItemTextW(hWnd
, IDC_EVENTUSERSTATIC
, szUser
, ARRAYSIZE(szUser
));
1480 GetDlgItemTextW(hWnd
, IDC_EVENTCOMPUTERSTATIC
, szComputer
, ARRAYSIZE(szComputer
));
1481 GetDlgItemTextW(hWnd
, IDC_EVENTTEXTEDIT
, evtDesc
, ARRAYSIZE(evtDesc
));
1483 /* Consolidate the information into on big piece */
1484 wsprintfW(output
, tmpHeader
, szEventType
, szSource
, szCategory
, szEventID
, szDate
, szTime
, szUser
, szComputer
, evtDesc
);
1486 /* Sort out the memory needed to write to the clipboard */
1487 hMem
= GlobalAlloc(GMEM_MOVEABLE
, ENTRY_SIZE
);
1488 memcpy(GlobalLock(hMem
), output
, ENTRY_SIZE
);
1491 /* Write the final content to the clipboard */
1492 SetClipboardData(CF_UNICODETEXT
, hMem
);
1494 /* Close the clipboard once we're done with it */
1500 StatusMessageWindowProc(IN HWND hwndDlg
,
1505 UNREFERENCED_PARAMETER(wParam
);
1519 InitDetailsDlg(HWND hDlg
)
1521 HANDLE nextIcon
= LoadImageW(hInst
, MAKEINTRESOURCEW(IDI_NEXT
), IMAGE_ICON
, 16, 16, LR_DEFAULTCOLOR
);
1522 HANDLE prevIcon
= LoadImageW(hInst
, MAKEINTRESOURCEW(IDI_PREV
), IMAGE_ICON
, 16, 16, LR_DEFAULTCOLOR
);
1523 HANDLE copyIcon
= LoadImageW(hInst
, MAKEINTRESOURCEW(IDI_COPY
), IMAGE_ICON
, 16, 16, LR_DEFAULTCOLOR
);
1525 SendMessageW(GetDlgItem(hDlg
, IDC_NEXT
), BM_SETIMAGE
, (WPARAM
)IMAGE_ICON
, (LPARAM
)nextIcon
);
1526 SendMessageW(GetDlgItem(hDlg
, IDC_PREVIOUS
), BM_SETIMAGE
, (WPARAM
)IMAGE_ICON
, (LPARAM
)prevIcon
);
1527 SendMessageW(GetDlgItem(hDlg
, IDC_COPY
), BM_SETIMAGE
, (WPARAM
)IMAGE_ICON
, (LPARAM
)copyIcon
);
1530 // Message handler for event details box.
1532 EventDetails(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
1534 UNREFERENCED_PARAMETER(lParam
);
1540 InitDetailsDlg(hDlg
);
1542 // Show event info on dialog box
1544 return (INT_PTR
)TRUE
;
1548 switch (LOWORD(wParam
))
1552 EndDialog(hDlg
, LOWORD(wParam
));
1553 return (INT_PTR
)TRUE
;
1557 SendMessageW(hwndListView
, WM_KEYDOWN
, VK_UP
, 0);
1559 // Show event info on dialog box
1561 return (INT_PTR
)TRUE
;
1566 SendMessageW(hwndListView
, WM_KEYDOWN
, VK_DOWN
, 0);
1568 // Show event info on dialog box
1570 return (INT_PTR
)TRUE
;
1574 CopyEventEntry(hDlg
);
1575 return (INT_PTR
)TRUE
;
1577 case IDC_BYTESRADIO
:
1578 return (INT_PTR
)TRUE
;
1581 return (INT_PTR
)TRUE
;
1585 L
"Help not implemented yet!",
1587 MB_OK
| MB_ICONINFORMATION
);
1588 return (INT_PTR
)TRUE
;
1596 return (INT_PTR
)FALSE
;