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_CATEGORY_MESSAGE_FILE L"CategoryMessageFile"
48 #define EVENT_MESSAGE_FILE L"EventMessageFile"
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 BOOL Success
= FALSE
;
264 HMODULE hLibrary
= NULL
;
265 WCHAR szMessageDLL
[MAX_PATH
];
266 LPWSTR lpMsgBuf
= NULL
;
268 if (!GetEventMessageFileDLL(KeyName
, SourceName
, EVENT_CATEGORY_MESSAGE_FILE
, szMessageDLL
))
271 hLibrary
= LoadLibraryExW(szMessageDLL
, NULL
,
272 DONT_RESOLVE_DLL_REFERENCES
| LOAD_LIBRARY_AS_DATAFILE
);
273 if (hLibrary
== NULL
)
276 /* Retrieve the message string. */
277 if (FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_FROM_HMODULE
|
278 FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_ARGUMENT_ARRAY
,
280 pevlr
->EventCategory
,
281 MAKELANGID(LANG_NEUTRAL
, SUBLANG_DEFAULT
),
283 EVENT_MESSAGE_FILE_BUFFER
,
286 /* Trim the string */
289 /* Copy the category name */
290 StringCchCopyW(CategoryName
, MAX_PATH
, lpMsgBuf
);
294 LoadStringW(hInst
, IDS_NONE
, CategoryName
, MAX_PATH
);
297 /* Free the buffer allocated by FormatMessage */
301 if (hLibrary
!= NULL
)
302 FreeLibrary(hLibrary
);
308 LoadStringW(hInst
, IDS_NONE
, CategoryName
, MAX_PATH
);
315 GetEventMessage(IN LPCWSTR KeyName
,
316 IN LPCWSTR SourceName
,
317 IN EVENTLOGRECORD
*pevlr
,
318 OUT PWCHAR EventText
)
320 BOOL Success
= FALSE
;
322 HMODULE hLibrary
= NULL
;
323 WCHAR SourceModuleName
[1000];
324 WCHAR ParameterModuleName
[1000];
325 BOOL IsParamModNameCached
= FALSE
;
326 LPWSTR lpMsgBuf
= NULL
;
327 WCHAR szStringIDNotFound
[MAX_LOADSTRING
];
332 /* NOTE: GetEventMessageFileDLL can return a comma-separated list of DLLs */
334 if (!GetEventMessageFileDLL(KeyName
, SourceName
, EVENT_MESSAGE_FILE
, SourceModuleName
))
340 /* Get the event message */
341 szMessage
= (LPWSTR
)((LPBYTE
)pevlr
+ pevlr
->StringOffset
);
343 /* Allocate space for parameters */
344 szArguments
= HeapAlloc(GetProcessHeap(), 0, pevlr
->NumStrings
* sizeof(LPVOID
));
351 for (i
= 0; i
< pevlr
->NumStrings
; i
++)
353 if (wcsstr(szMessage
, L
"%%"))
355 if (!IsParamModNameCached
&& GetEventMessageFileDLL(KeyName
, SourceName
, EVENT_PARAMETER_MESSAGE_FILE
, ParameterModuleName
))
357 /* Now that the parameter file list is loaded, no need to reload it at the next run! */
358 IsParamModNameCached
= TRUE
;
360 /* Not yet support for reading messages from parameter message DLL */
364 szArguments
[i
] = szMessage
;
365 szMessage
+= wcslen(szMessage
) + 1;
368 /* Loop through the list of event message DLLs */
369 szDll
= wcstok(SourceModuleName
, EVENT_DLL_SEPARATOR
);
370 while ((szDll
!= NULL
) && (!Success
))
372 hLibrary
= LoadLibraryExW(szDll
, NULL
,
373 DONT_RESOLVE_DLL_REFERENCES
| LOAD_LIBRARY_AS_DATAFILE
);
374 if (hLibrary
== NULL
)
376 /* The DLL could not be loaded try the next one (if any) */
377 szDll
= wcstok(NULL
, EVENT_DLL_SEPARATOR
);
381 /* Retrieve the message string. */
382 if (FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_FROM_HMODULE
|
383 FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_ARGUMENT_ARRAY
,
386 MAKELANGID(LANG_NEUTRAL
, SUBLANG_DEFAULT
),
389 (va_list*)szArguments
) == 0)
391 /* We haven't found the string, get next DLL (if any) */
392 szDll
= wcstok(NULL
, EVENT_DLL_SEPARATOR
);
396 /* The ID was found and the message was formated */
399 /* Trim the string */
400 TrimNulls((LPWSTR
)lpMsgBuf
);
402 /* Copy the event text */
403 StringCchCopyW(EventText
, EVENT_MESSAGE_EVENTTEXT_BUFFER
, lpMsgBuf
);
406 /* Free the buffer allocated by FormatMessage */
410 FreeLibrary(hLibrary
);
413 HeapFree(GetProcessHeap(), 0, szArguments
);
418 LoadStringW(hInst
, IDS_EVENTSTRINGIDNOTFOUND
, szStringIDNotFound
, ARRAYSIZE(szStringIDNotFound
));
419 StringCchPrintfW(EventText
, EVENT_MESSAGE_EVENTTEXT_BUFFER
, szStringIDNotFound
, (pevlr
->EventID
& 0xFFFF), SourceName
);
427 GetEventType(IN WORD dwEventType
,
428 OUT PWCHAR eventTypeText
)
432 case EVENTLOG_ERROR_TYPE
:
433 LoadStringW(hInst
, IDS_EVENTLOG_ERROR_TYPE
, eventTypeText
, MAX_LOADSTRING
);
435 case EVENTLOG_WARNING_TYPE
:
436 LoadStringW(hInst
, IDS_EVENTLOG_WARNING_TYPE
, eventTypeText
, MAX_LOADSTRING
);
438 case EVENTLOG_INFORMATION_TYPE
:
439 LoadStringW(hInst
, IDS_EVENTLOG_INFORMATION_TYPE
, eventTypeText
, MAX_LOADSTRING
);
441 case EVENTLOG_AUDIT_SUCCESS
:
442 LoadStringW(hInst
, IDS_EVENTLOG_AUDIT_SUCCESS
, eventTypeText
, MAX_LOADSTRING
);
444 case EVENTLOG_AUDIT_FAILURE
:
445 LoadStringW(hInst
, IDS_EVENTLOG_AUDIT_FAILURE
, eventTypeText
, MAX_LOADSTRING
);
447 case EVENTLOG_SUCCESS
:
448 LoadStringW(hInst
, IDS_EVENTLOG_SUCCESS
, eventTypeText
, MAX_LOADSTRING
);
451 LoadStringW(hInst
, IDS_EVENTLOG_UNKNOWN_TYPE
, eventTypeText
, MAX_LOADSTRING
);
457 GetEventUserName(EVENTLOGRECORD
*pelr
,
462 WCHAR szDomain
[1024];
465 DWORD cbDomain
= 1024;
467 /* Point to the SID. */
468 lpSid
= (PSID
)((LPBYTE
)pelr
+ pelr
->UserSidOffset
);
471 if (pelr
->UserSidLength
> 0)
473 if (LookupAccountSidW(NULL
,
481 StringCchCopyW(pszUser
, MAX_PATH
, szName
);
491 ShowStatusMessageThread(IN LPVOID lpParameter
)
493 HWND
*phWnd
= (HWND
*)lpParameter
;
497 hWnd
= CreateDialogParamW(hInst
,
498 MAKEINTRESOURCEW(IDD_PROGRESSBOX
),
500 StatusMessageWindowProc
,
507 ShowWindow(hWnd
, SW_SHOW
);
509 /* Message loop for the Status window */
510 while (GetMessageW(&Msg
, NULL
, 0, 0))
512 TranslateMessage(&Msg
);
513 DispatchMessageW(&Msg
);
521 QueryEventMessages(LPWSTR lpMachineName
,
526 EVENTLOGRECORD
*pevlr
;
527 DWORD dwRead
, dwNeeded
, dwThisRecord
, dwTotalRecords
= 0, dwCurrentRecord
= 0, dwRecordsToRead
= 0, dwFlags
, dwMaxLength
;
530 LPWSTR lpComputerName
;
531 BOOL bResult
= TRUE
; /* Read succeeded. */
533 WCHAR szWindowTitle
[MAX_PATH
];
534 WCHAR szStatusText
[MAX_PATH
];
535 WCHAR szLocalDate
[MAX_PATH
];
536 WCHAR szLocalTime
[MAX_PATH
];
537 WCHAR szEventID
[MAX_PATH
];
538 WCHAR szEventTypeText
[MAX_LOADSTRING
];
539 WCHAR szCategoryID
[MAX_PATH
];
540 WCHAR szUsername
[MAX_PATH
];
541 WCHAR szCategory
[MAX_PATH
];
542 PWCHAR lpTitleTemplateEnd
;
545 LVITEMW lviEventItem
;
547 dwFlags
= EVENTLOG_FORWARDS_READ
| EVENTLOG_SEQUENTIAL_READ
;
549 /* Open the event log. */
550 hEventLog
= OpenEventLogW(lpMachineName
, lpLogName
);
551 if (hEventLog
== NULL
)
553 ShowLastWin32Error();
557 lpSourceLogName
= lpLogName
;
558 lpComputerName
= lpMachineName
;
560 /* Disable listview redraw */
561 SendMessageW(hwndListView
, WM_SETREDRAW
, FALSE
, 0);
563 /* Clear the list view */
564 (void)ListView_DeleteAllItems(hwndListView
);
567 GetOldestEventLogRecord(hEventLog
, &dwThisRecord
);
569 /* Get the total number of event log records. */
570 GetNumberOfEventLogRecords(hEventLog
, &dwTotalRecords
);
571 g_TotalRecords
= dwTotalRecords
;
573 if (dwTotalRecords
> 0)
575 EnableMenuItem(hMainMenu
, IDM_CLEAR_EVENTS
, MF_BYCOMMAND
| MF_ENABLED
);
576 EnableMenuItem(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_ENABLED
);
580 EnableMenuItem(hMainMenu
, IDM_CLEAR_EVENTS
, MF_BYCOMMAND
| MF_GRAYED
);
581 EnableMenuItem(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_GRAYED
);
584 g_RecordPtrs
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, dwTotalRecords
* sizeof(*g_RecordPtrs
));
586 /* If we have at least 1000 records show the waiting dialog */
587 if (dwTotalRecords
> 1000)
589 CloseHandle(CreateThread(NULL
,
591 ShowStatusMessageThread
,
597 while (dwCurrentRecord
< dwTotalRecords
)
599 pevlr
= HeapAlloc(GetProcessHeap(), 0, sizeof(*pevlr
));
600 g_RecordPtrs
[dwCurrentRecord
] = pevlr
;
602 bResult
= ReadEventLogW(hEventLog
, // Event log handle
603 dwFlags
, // Sequential read
604 0, // Ignored for sequential read
605 pevlr
, // Pointer to buffer
606 sizeof(*pevlr
), // Size of buffer
607 &dwRead
, // Number of bytes read
608 &dwNeeded
); // Bytes in the next record
609 if ((!bResult
) && (GetLastError () == ERROR_INSUFFICIENT_BUFFER
))
611 HeapFree(GetProcessHeap(), 0, pevlr
);
612 pevlr
= HeapAlloc(GetProcessHeap(), 0, dwNeeded
);
613 g_RecordPtrs
[dwCurrentRecord
] = pevlr
;
615 ReadEventLogW(hEventLog
, // event log handle
616 dwFlags
, // read flags
617 0, // offset; default is 0
618 pevlr
, // pointer to buffer
619 dwNeeded
, // size of buffer
620 &dwRead
, // number of bytes read
621 &dwNeeded
); // bytes in next record
626 LoadStringW(hInst
, IDS_NOT_AVAILABLE
, szUsername
, ARRAYSIZE(szUsername
));
627 LoadStringW(hInst
, IDS_NONE
, szCategory
, ARRAYSIZE(szCategory
));
629 // Get the event source name.
630 lpSourceName
= (LPWSTR
)((LPBYTE
)pevlr
+ sizeof(EVENTLOGRECORD
));
632 // Get the computer name
633 lpComputerName
= (LPWSTR
)((LPBYTE
)pevlr
+ sizeof(EVENTLOGRECORD
) + (wcslen(lpSourceName
) + 1) * sizeof(WCHAR
));
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
, ARRAYSIZE(szLocalDate
));
642 GetTimeFormatW(LOCALE_USER_DEFAULT
, 0, &time
, NULL
, szLocalTime
, ARRAYSIZE(szLocalTime
));
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
);
693 dwRead
-= pevlr
->Length
;
694 pevlr
= (EVENTLOGRECORD
*)((LPBYTE
) pevlr
+ pevlr
->Length
);
703 EndDialog(hwndDlg
, 0);
705 StringCchPrintfExW(szWindowTitle
,
706 ARRAYSIZE(szWindowTitle
),
710 szTitleTemplate
, szTitle
, lpLogName
); /* i = number of characters written */
711 /* lpComputerName can be NULL here if no records was read */
712 dwMaxLength
= (DWORD
)cchRemaining
;
714 GetComputerNameW(lpTitleTemplateEnd
, &dwMaxLength
);
716 StringCchCopyW(lpTitleTemplateEnd
, dwMaxLength
, lpComputerName
);
718 StringCbPrintfW(szStatusText
, sizeof(szStatusText
), szStatusBarTemplate
, lpLogName
, dwTotalRecords
);
720 // Update the status bar
721 SendMessageW(hwndStatus
, SB_SETTEXT
, (WPARAM
)0, (LPARAM
)szStatusText
);
723 // Set the window title
724 SetWindowTextW(hwndMainWindow
, szWindowTitle
);
726 // Resume list view redraw
727 SendMessageW(hwndListView
, WM_SETREDRAW
, TRUE
, 0);
729 // Close the event log.
730 CloseEventLog(hEventLog
);
740 WCHAR szFileName
[MAX_PATH
];
742 ZeroMemory(szFileName
, sizeof(szFileName
));
744 sfn
.lpstrFile
= szFileName
;
745 sfn
.nMaxFile
= ARRAYSIZE(szFileName
);
747 if (!GetSaveFileNameW(&sfn
))
752 hEventLog
= OpenEventLogW(lpComputerName
, lpSourceLogName
);
755 ShowLastWin32Error();
759 if (!BackupEventLogW(hEventLog
, szFileName
))
761 ShowLastWin32Error();
764 CloseEventLog(hEventLog
);
772 WCHAR szFileName
[MAX_PATH
];
773 WCHAR szMessage
[MAX_LOADSTRING
];
775 ZeroMemory(szFileName
, sizeof(szFileName
));
776 ZeroMemory(szMessage
, sizeof(szMessage
));
778 LoadStringW(hInst
, IDS_CLEAREVENTS_MSG
, szMessage
, ARRAYSIZE(szMessage
));
780 sfn
.lpstrFile
= szFileName
;
781 sfn
.nMaxFile
= ARRAYSIZE(szFileName
);
783 switch (MessageBoxW(hwndMainWindow
, szMessage
, szTitle
, MB_YESNOCANCEL
| MB_ICONINFORMATION
))
792 sfn
.lpstrFile
= NULL
;
798 if (!GetSaveFileNameW(&sfn
))
806 hEventLog
= OpenEventLogW(lpComputerName
, lpSourceLogName
);
809 ShowLastWin32Error();
813 if (!ClearEventLogW(hEventLog
, sfn
.lpstrFile
))
815 ShowLastWin32Error();
816 CloseEventLog(hEventLog
);
820 CloseEventLog(hEventLog
);
829 QueryEventMessages(lpComputerName
,
835 MyRegisterClass(HINSTANCE hInstance
)
839 wcex
.cbSize
= sizeof(wcex
);
841 wcex
.lpfnWndProc
= WndProc
;
844 wcex
.hInstance
= hInstance
;
845 wcex
.hIcon
= LoadIconW(hInstance
, MAKEINTRESOURCEW(IDI_EVENTVWR
));
846 wcex
.hCursor
= LoadCursorW(NULL
, MAKEINTRESOURCEW(IDC_ARROW
));
847 wcex
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+ 1);
848 wcex
.lpszMenuName
= MAKEINTRESOURCEW(IDM_EVENTVWR
);
849 wcex
.lpszClassName
= szWindowClass
;
850 wcex
.hIconSm
= (HICON
)LoadImageW(hInstance
,
851 MAKEINTRESOURCEW(IDI_EVENTVWR
),
857 return RegisterClassExW(&wcex
);
862 GetDisplayNameFile(IN LPCWSTR lpLogName
,
863 OUT PWCHAR lpModuleName
)
867 WCHAR szModuleName
[MAX_PATH
];
871 cbKeyPath
= (wcslen(EVENTLOG_BASE_KEY
) + wcslen(lpLogName
) + 1) * sizeof(WCHAR
);
872 KeyPath
= HeapAlloc(GetProcessHeap(), 0, cbKeyPath
);
878 StringCbCopyW(KeyPath
, cbKeyPath
, EVENTLOG_BASE_KEY
);
879 StringCbCatW(KeyPath
, cbKeyPath
, lpLogName
);
881 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, KeyPath
, 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
883 HeapFree(GetProcessHeap(), 0, KeyPath
);
887 cbData
= sizeof(szModuleName
);
888 if (RegQueryValueExW(hKey
, L
"DisplayNameFile", NULL
, NULL
, (LPBYTE
)szModuleName
, &cbData
) == ERROR_SUCCESS
)
890 ExpandEnvironmentStringsW(szModuleName
, lpModuleName
, MAX_PATH
);
894 HeapFree(GetProcessHeap(), 0, KeyPath
);
899 GetDisplayNameID(IN LPCWSTR lpLogName
)
903 DWORD dwMessageID
= 0;
907 cbKeyPath
= (wcslen(EVENTLOG_BASE_KEY
) + wcslen(lpLogName
) + 1) * sizeof(WCHAR
);
908 KeyPath
= HeapAlloc(GetProcessHeap(), 0, cbKeyPath
);
914 StringCbCopyW(KeyPath
, cbKeyPath
, EVENTLOG_BASE_KEY
);
915 StringCbCatW(KeyPath
, cbKeyPath
, lpLogName
);
917 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, KeyPath
, 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
919 HeapFree(GetProcessHeap(), 0, KeyPath
);
923 cbData
= sizeof(dwMessageID
);
924 RegQueryValueExW(hKey
, L
"DisplayNameID", NULL
, NULL
, (LPBYTE
)&dwMessageID
, &cbData
);
927 HeapFree(GetProcessHeap(), 0, KeyPath
);
940 DWORD dwMaxKeyLength
;
941 WCHAR szModuleName
[MAX_PATH
];
942 LPWSTR lpDisplayName
;
943 HMODULE hLibrary
= NULL
;
945 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE
, EVENTLOG_BASE_KEY
, 0, KEY_READ
, &hKey
) != ERROR_SUCCESS
)
950 if (RegQueryInfoKeyW(hKey
, NULL
, NULL
, NULL
, &dwNumLogs
, &dwMaxKeyLength
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
) != ERROR_SUCCESS
)
962 LogNames
= HeapAlloc(GetProcessHeap(), 0, (dwNumLogs
+ 1) * sizeof(LPWSTR
));
970 for (dwIndex
= 0; dwIndex
< dwNumLogs
; dwIndex
++)
972 LogNames
[dwIndex
] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, ((dwMaxKeyLength
+ 1) * sizeof(WCHAR
)));
974 if (LogNames
[dwIndex
] != NULL
)
976 lpcName
= dwMaxKeyLength
+ 1;
978 if (RegEnumKeyExW(hKey
, dwIndex
, LogNames
[dwIndex
], &lpcName
, NULL
, NULL
, NULL
, NULL
) == ERROR_SUCCESS
)
980 lpDisplayName
= NULL
;
982 ZeroMemory(szModuleName
, sizeof(szModuleName
));
983 GetDisplayNameFile(LogNames
[dwIndex
], szModuleName
);
984 dwMessageID
= GetDisplayNameID(LogNames
[dwIndex
]);
986 hLibrary
= LoadLibraryExW(szModuleName
, NULL
, DONT_RESOLVE_DLL_REFERENCES
| LOAD_LIBRARY_AS_DATAFILE
);
987 if (hLibrary
!= NULL
)
989 FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_HMODULE
,
993 (LPWSTR
)&lpDisplayName
,
996 FreeLibrary(hLibrary
);
1001 InsertMenuW(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_STRING
, ID_FIRST_LOG
+ dwIndex
, lpDisplayName
);
1005 InsertMenuW(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_STRING
, ID_FIRST_LOG
+ dwIndex
, LogNames
[dwIndex
]);
1008 /* Free the buffer allocated by FormatMessage */
1010 LocalFree(lpDisplayName
);
1015 InsertMenuW(hMainMenu
, IDM_SAVE_PROTOCOL
, MF_BYCOMMAND
| MF_SEPARATOR
, ID_FIRST_LOG
+ dwIndex
+ 1, NULL
);
1033 for (dwIndex
= 0; dwIndex
< dwNumLogs
; dwIndex
++)
1035 if (LogNames
[dwIndex
])
1037 HeapFree(GetProcessHeap(), 0, LogNames
[dwIndex
]);
1040 DeleteMenu(hMainMenu
, ID_FIRST_LOG
+ dwIndex
, MF_BYCOMMAND
);
1043 DeleteMenu(hMainMenu
, ID_FIRST_LOG
+ dwIndex
+ 1, MF_BYCOMMAND
);
1045 HeapFree(GetProcessHeap(), 0, LogNames
);
1054 InitInstance(HINSTANCE hInstance
,
1058 LVCOLUMNW lvc
= {0};
1061 hInst
= hInstance
; // Store instance handle in our global variable
1063 hwndMainWindow
= CreateWindowW(szWindowClass
,
1065 WS_OVERLAPPEDWINDOW
| WS_CLIPCHILDREN
,
1066 CW_USEDEFAULT
, 0, CW_USEDEFAULT
, 0,
1071 if (!hwndMainWindow
)
1076 hwndStatus
= CreateWindowExW(0, // no extended styles
1077 STATUSCLASSNAMEW
, // status bar
1079 WS_CHILD
| WS_BORDER
| WS_VISIBLE
, // styles
1080 0, 0, 0, 0, // x, y, cx, cy
1081 hwndMainWindow
, // parent window
1082 (HMENU
)100, // window ID
1083 hInstance
, // instance
1084 NULL
); // window data
1086 // Create our listview child window. Note that I use WS_EX_CLIENTEDGE
1087 // and WS_BORDER to create the normal "sunken" look. Also note that
1088 // LVS_EX_ styles cannot be set in CreateWindowEx().
1089 hwndListView
= CreateWindowExW(WS_EX_CLIENTEDGE
,
1092 LVS_SHOWSELALWAYS
| WS_CHILD
| WS_VISIBLE
| LVS_REPORT
,
1102 // After the ListView is created, we can add extended list view styles.
1103 (void)ListView_SetExtendedListViewStyle (hwndListView
, LVS_EX_FULLROWSELECT
);
1105 // Create the ImageList
1106 hSmall
= ImageList_Create(GetSystemMetrics(SM_CXSMICON
),
1107 GetSystemMetrics(SM_CYSMICON
),
1112 // Add event type icons to ImageList
1113 ImageList_AddIcon(hSmall
, LoadIconW(hInstance
, MAKEINTRESOURCEW(IDI_INFORMATIONICON
)));
1114 ImageList_AddIcon(hSmall
, LoadIconW(hInstance
, MAKEINTRESOURCEW(IDI_WARNINGICON
)));
1115 ImageList_AddIcon(hSmall
, LoadIconW(hInstance
, MAKEINTRESOURCEW(IDI_ERRORICON
)));
1117 // Assign ImageList to List View
1118 (void)ListView_SetImageList(hwndListView
, hSmall
, LVSIL_SMALL
);
1120 // Now set up the listview with its columns.
1121 lvc
.mask
= LVCF_TEXT
| LVCF_WIDTH
;
1123 LoadStringW(hInstance
,
1127 lvc
.pszText
= szTemp
;
1128 (void)ListView_InsertColumn(hwndListView
, 0, &lvc
);
1131 LoadStringW(hInstance
,
1135 lvc
.pszText
= szTemp
;
1136 (void)ListView_InsertColumn(hwndListView
, 1, &lvc
);
1139 LoadStringW(hInstance
,
1143 lvc
.pszText
= szTemp
;
1144 (void)ListView_InsertColumn(hwndListView
, 2, &lvc
);
1147 LoadStringW(hInstance
,
1151 lvc
.pszText
= szTemp
;
1152 (void)ListView_InsertColumn(hwndListView
, 3, &lvc
);
1155 LoadStringW(hInstance
,
1159 lvc
.pszText
= szTemp
;
1160 (void)ListView_InsertColumn(hwndListView
, 4, &lvc
);
1163 LoadStringW(hInstance
,
1167 lvc
.pszText
= szTemp
;
1168 (void)ListView_InsertColumn(hwndListView
, 5, &lvc
);
1171 LoadStringW(hInstance
,
1175 lvc
.pszText
= szTemp
;
1176 (void)ListView_InsertColumn(hwndListView
, 6, &lvc
);
1179 LoadStringW(hInstance
,
1183 lvc
.pszText
= szTemp
;
1184 (void)ListView_InsertColumn(hwndListView
, 7, &lvc
);
1186 // Initialize the save Dialog
1187 ZeroMemory(&sfn
, sizeof(sfn
));
1188 ZeroMemory(szSaveFilter
, sizeof(szSaveFilter
));
1190 LoadStringW(hInst
, IDS_SAVE_FILTER
, szSaveFilter
, ARRAYSIZE(szSaveFilter
));
1192 sfn
.lStructSize
= sizeof(sfn
);
1193 sfn
.hwndOwner
= hwndMainWindow
;
1194 sfn
.hInstance
= hInstance
;
1195 sfn
.lpstrFilter
= szSaveFilter
;
1196 sfn
.lpstrInitialDir
= NULL
;
1197 sfn
.Flags
= OFN_HIDEREADONLY
| OFN_SHAREAWARE
;
1198 sfn
.lpstrDefExt
= NULL
;
1200 ShowWindow(hwndMainWindow
, nCmdShow
);
1201 UpdateWindow(hwndMainWindow
);
1205 QueryEventMessages(lpComputerName
, LogNames
[0]);
1207 CheckMenuRadioItem(GetMenu(hwndMainWindow
), ID_FIRST_LOG
, ID_FIRST_LOG
+ dwNumLogs
, ID_FIRST_LOG
, MF_BYCOMMAND
);
1214 WndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
1222 hMainMenu
= GetMenu(hWnd
);
1234 switch (((LPNMHDR
)lParam
)->code
)
1237 hdr
= (NMHDR FAR
*)lParam
;
1238 if (hdr
->hwndFrom
== hwndListView
)
1240 LPNMITEMACTIVATE lpnmitem
= (LPNMITEMACTIVATE
)lParam
;
1242 if (lpnmitem
->iItem
!= -1)
1245 MAKEINTRESOURCEW(IDD_EVENTPROPERTIES
),
1256 // Parse the menu selections:
1258 if ((LOWORD(wParam
) >= ID_FIRST_LOG
) && (LOWORD(wParam
) <= ID_FIRST_LOG
+ dwNumLogs
))
1260 if (LogNames
[LOWORD(wParam
) - ID_FIRST_LOG
])
1262 if (QueryEventMessages(lpComputerName
, LogNames
[LOWORD(wParam
) - ID_FIRST_LOG
]))
1264 CheckMenuRadioItem(GetMenu(hWnd
), ID_FIRST_LOG
, ID_FIRST_LOG
+ dwNumLogs
, LOWORD(wParam
), MF_BYCOMMAND
);
1270 switch (LOWORD(wParam
))
1272 case IDM_SAVE_PROTOCOL
:
1276 case IDM_CLEAR_EVENTS
:
1288 DialogBoxW(hInst
, MAKEINTRESOURCEW(IDD_ABOUTBOX
), hWnd
, About
);
1292 MessageBoxW(hwndMainWindow
,
1293 L
"Help not implemented yet!",
1295 MB_OK
| MB_ICONINFORMATION
);
1299 DestroyWindow(hWnd
);
1303 return DefWindowProcW(hWnd
, message
, wParam
, lParam
);
1310 // Gets the window rectangle
1311 GetClientRect(hWnd
, &rect
);
1313 // Relocate the listview
1314 MoveWindow(hwndListView
,
1321 // Resize the statusbar;
1322 SendMessageW(hwndStatus
, message
, wParam
, lParam
);
1327 return DefWindowProcW(hWnd
, message
, wParam
, lParam
);
1334 // Message handler for about box.
1336 About(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
1338 UNREFERENCED_PARAMETER(lParam
);
1343 return (INT_PTR
)TRUE
;
1347 if (LOWORD(wParam
) == IDOK
|| LOWORD(wParam
) == IDCANCEL
)
1349 EndDialog(hDlg
, LOWORD(wParam
));
1350 return (INT_PTR
)TRUE
;
1355 return (INT_PTR
)FALSE
;
1359 DisplayEvent(HWND hDlg
)
1361 WCHAR szEventType
[MAX_PATH
];
1362 WCHAR szTime
[MAX_PATH
];
1363 WCHAR szDate
[MAX_PATH
];
1364 WCHAR szUser
[MAX_PATH
];
1365 WCHAR szComputer
[MAX_PATH
];
1366 WCHAR szSource
[MAX_PATH
];
1367 WCHAR szCategory
[MAX_PATH
];
1368 WCHAR szEventID
[MAX_PATH
];
1369 WCHAR szEventText
[EVENT_MESSAGE_EVENTTEXT_BUFFER
];
1370 WCHAR szEventData
[MAX_PATH
];
1371 BOOL bEventData
= FALSE
;
1373 EVENTLOGRECORD
* pevlr
;
1376 // Get index of selected item
1377 iIndex
= (int)SendMessageW(hwndListView
, LVM_GETNEXTITEM
, -1, LVNI_SELECTED
| LVNI_FOCUSED
);
1381 L
"No Items in ListView",
1383 MB_OK
| MB_ICONINFORMATION
);
1387 li
.mask
= LVIF_PARAM
;
1391 (void)ListView_GetItem(hwndListView
, &li
);
1393 pevlr
= (EVENTLOGRECORD
*)li
.lParam
;
1395 ListView_GetItemText(hwndListView
, iIndex
, 0, szEventType
, ARRAYSIZE(szEventType
));
1396 ListView_GetItemText(hwndListView
, iIndex
, 1, szDate
, ARRAYSIZE(szDate
));
1397 ListView_GetItemText(hwndListView
, iIndex
, 2, szTime
, ARRAYSIZE(szTime
));
1398 ListView_GetItemText(hwndListView
, iIndex
, 3, szSource
, ARRAYSIZE(szSource
));
1399 ListView_GetItemText(hwndListView
, iIndex
, 4, szCategory
, ARRAYSIZE(szCategory
));
1400 ListView_GetItemText(hwndListView
, iIndex
, 5, szEventID
, ARRAYSIZE(szEventID
));
1401 ListView_GetItemText(hwndListView
, iIndex
, 6, szUser
, ARRAYSIZE(szUser
));
1402 ListView_GetItemText(hwndListView
, iIndex
, 7, szComputer
, ARRAYSIZE(szComputer
));
1404 SetDlgItemTextW(hDlg
, IDC_EVENTDATESTATIC
, szDate
);
1405 SetDlgItemTextW(hDlg
, IDC_EVENTTIMESTATIC
, szTime
);
1406 SetDlgItemTextW(hDlg
, IDC_EVENTUSERSTATIC
, szUser
);
1407 SetDlgItemTextW(hDlg
, IDC_EVENTSOURCESTATIC
, szSource
);
1408 SetDlgItemTextW(hDlg
, IDC_EVENTCOMPUTERSTATIC
, szComputer
);
1409 SetDlgItemTextW(hDlg
, IDC_EVENTCATEGORYSTATIC
, szCategory
);
1410 SetDlgItemTextW(hDlg
, IDC_EVENTIDSTATIC
, szEventID
);
1411 SetDlgItemTextW(hDlg
, IDC_EVENTTYPESTATIC
, szEventType
);
1413 bEventData
= (pevlr
->DataLength
> 0);
1416 // This is the data section of the current event
1417 MultiByteToWideChar(CP_ACP
,
1419 (LPCSTR
)((LPBYTE
)pevlr
+ pevlr
->DataOffset
),
1424 SetDlgItemTextW(hDlg
, IDC_EVENTDATAEDIT
, szEventData
);
1428 SetDlgItemTextW(hDlg
, IDC_EVENTDATAEDIT
, L
"");
1430 EnableWindow(GetDlgItem(hDlg
, IDC_BYTESRADIO
), bEventData
);
1431 EnableWindow(GetDlgItem(hDlg
, IDC_WORDRADIO
), bEventData
);
1433 GetEventMessage(lpSourceLogName
, szSource
, pevlr
, szEventText
);
1434 SetDlgItemTextW(hDlg
, IDC_EVENTTEXTEDIT
, szEventText
);
1438 CopyEventEntry(HWND hWnd
)
1440 WCHAR output
[4130], tmpHeader
[512];
1441 WCHAR szEventType
[MAX_PATH
];
1442 WCHAR szSource
[MAX_PATH
];
1443 WCHAR szCategory
[MAX_PATH
];
1444 WCHAR szEventID
[MAX_PATH
];
1445 WCHAR szDate
[MAX_PATH
];
1446 WCHAR szTime
[MAX_PATH
];
1447 WCHAR szUser
[MAX_PATH
];
1448 WCHAR szComputer
[MAX_PATH
];
1449 WCHAR evtDesc
[ENTRY_SIZE
];
1452 if (!OpenClipboard(hWnd
))
1455 /* First, empty the clipboard before we begin to use it */
1458 /* Get the formatted text needed to place the content into */
1459 LoadStringW(hInst
, IDS_COPY
, tmpHeader
, ARRAYSIZE(tmpHeader
));
1461 /* Grabs all the information and get it ready for the clipboard */
1462 GetDlgItemTextW(hWnd
, IDC_EVENTTYPESTATIC
, szEventType
, ARRAYSIZE(szEventType
));
1463 GetDlgItemTextW(hWnd
, IDC_EVENTSOURCESTATIC
, szSource
, ARRAYSIZE(szSource
));
1464 GetDlgItemTextW(hWnd
, IDC_EVENTCATEGORYSTATIC
, szCategory
, ARRAYSIZE(szCategory
));
1465 GetDlgItemTextW(hWnd
, IDC_EVENTIDSTATIC
, szEventID
, ARRAYSIZE(szEventID
));
1466 GetDlgItemTextW(hWnd
, IDC_EVENTDATESTATIC
, szDate
, ARRAYSIZE(szDate
));
1467 GetDlgItemTextW(hWnd
, IDC_EVENTTIMESTATIC
, szTime
, ARRAYSIZE(szTime
));
1468 GetDlgItemTextW(hWnd
, IDC_EVENTUSERSTATIC
, szUser
, ARRAYSIZE(szUser
));
1469 GetDlgItemTextW(hWnd
, IDC_EVENTCOMPUTERSTATIC
, szComputer
, ARRAYSIZE(szComputer
));
1470 GetDlgItemTextW(hWnd
, IDC_EVENTTEXTEDIT
, evtDesc
, ARRAYSIZE(evtDesc
));
1472 /* Consolidate the information into on big piece */
1473 wsprintfW(output
, tmpHeader
, szEventType
, szSource
, szCategory
, szEventID
, szDate
, szTime
, szUser
, szComputer
, evtDesc
);
1475 /* Sort out the memory needed to write to the clipboard */
1476 hMem
= GlobalAlloc(GMEM_MOVEABLE
, ENTRY_SIZE
);
1477 memcpy(GlobalLock(hMem
), output
, ENTRY_SIZE
);
1480 /* Write the final content to the clipboard */
1481 SetClipboardData(CF_UNICODETEXT
, hMem
);
1483 /* Close the clipboard once we're done with it */
1489 StatusMessageWindowProc(IN HWND hwndDlg
,
1494 UNREFERENCED_PARAMETER(hwndDlg
);
1495 UNREFERENCED_PARAMETER(wParam
);
1496 UNREFERENCED_PARAMETER(lParam
);
1508 InitDetailsDlg(HWND hDlg
)
1510 HANDLE nextIcon
= LoadImageW(hInst
, MAKEINTRESOURCEW(IDI_NEXT
), IMAGE_ICON
, 16, 16, LR_DEFAULTCOLOR
);
1511 HANDLE prevIcon
= LoadImageW(hInst
, MAKEINTRESOURCEW(IDI_PREV
), IMAGE_ICON
, 16, 16, LR_DEFAULTCOLOR
);
1512 HANDLE copyIcon
= LoadImageW(hInst
, MAKEINTRESOURCEW(IDI_COPY
), IMAGE_ICON
, 16, 16, LR_DEFAULTCOLOR
);
1514 SendMessageW(GetDlgItem(hDlg
, IDC_NEXT
), BM_SETIMAGE
, (WPARAM
)IMAGE_ICON
, (LPARAM
)nextIcon
);
1515 SendMessageW(GetDlgItem(hDlg
, IDC_PREVIOUS
), BM_SETIMAGE
, (WPARAM
)IMAGE_ICON
, (LPARAM
)prevIcon
);
1516 SendMessageW(GetDlgItem(hDlg
, IDC_COPY
), BM_SETIMAGE
, (WPARAM
)IMAGE_ICON
, (LPARAM
)copyIcon
);
1519 // Message handler for event details box.
1521 EventDetails(HWND hDlg
, UINT message
, WPARAM wParam
, LPARAM lParam
)
1523 UNREFERENCED_PARAMETER(lParam
);
1529 InitDetailsDlg(hDlg
);
1531 // Show event info on dialog box
1533 return (INT_PTR
)TRUE
;
1537 switch (LOWORD(wParam
))
1541 EndDialog(hDlg
, LOWORD(wParam
));
1542 return (INT_PTR
)TRUE
;
1546 SendMessageW(hwndListView
, WM_KEYDOWN
, VK_UP
, 0);
1548 // Show event info on dialog box
1550 return (INT_PTR
)TRUE
;
1555 SendMessageW(hwndListView
, WM_KEYDOWN
, VK_DOWN
, 0);
1557 // Show event info on dialog box
1559 return (INT_PTR
)TRUE
;
1563 CopyEventEntry(hDlg
);
1564 return (INT_PTR
)TRUE
;
1567 case IDC_BYTESRADIO
:
1568 return (INT_PTR
)TRUE
;
1572 return (INT_PTR
)TRUE
;
1576 L
"Help not implemented yet!",
1578 MB_OK
| MB_ICONINFORMATION
);
1579 return (INT_PTR
)TRUE
;
1587 return (INT_PTR
)FALSE
;