ReactOS 0.4.16-dev-1453-g06343fa
evtdetctl.c File Reference
#include "eventvwr.h"
#include "evtdetctl.h"
#include <shellapi.h>
Include dependency graph for evtdetctl.c:

Go to the source code of this file.

Classes

struct  _DETAILDATA
 

Macros

#define COPY_EVTTEXT_SPACE_PADDING_MODE
 ReactOS-only feature: Enable or disable support for copying event info text using space padding between header titles and data, when pressing the SHIFT key while clicking on the "Copy" button, instead of using TABs as separators.
 
#define EVENT_MESSAGE_EVENTTEXT_BUFFER   (1024*10)
 

Typedefs

typedef struct _DETAILDATA DETAILDATA
 
typedef struct _DETAILDATAPDETAILDATA
 

Functions

BOOL GetEventMessage (_In_ PCWSTR KeyName, _In_ PCWSTR SourceName, _In_ PEVENTLOGRECORD pevlr, _Out_writes_z_(cchText) PWSTR EventText, _In_ SIZE_T cchText)
 
static VOID DisplayEventData (_In_ HWND hDlg, _In_ PDETAILDATA pDetailData)
 
static VOID DisplayEvent (_In_ HWND hDlg, _In_ PDETAILDATA pDetailData)
 
static UINT PrintByteDataLine (PWCHAR pBuffer, UINT uOffset, PBYTE pData, UINT uLength)
 
static UINT PrintWordDataLine (PWCHAR pBuffer, UINT uOffset, PULONG pData, UINT uLength)
 
static int my_cType3ToWidth (WORD wType, wchar_t ucs)
 
int my_wcwidth (wchar_t ucs)
 
int my_wcswidth (const wchar_t *pwcs, size_t n)
 
static VOID CopyEventEntry (_In_ HWND hWnd)
 Retrieves the already-gathered event information, structure it in text format and copy it into the clipboard for user consumption.
 
static VOID OnLink (HWND hDlg, ENLINK *penLink)
 
static VOID OnScroll (HWND hDlg, PDETAILDATA pData, INT nBar, WORD sbCode)
 
static VOID OnSize (HWND hDlg, PDETAILDATA pData, INT cx, INT cy)
 
static VOID EnableNavigationArrows (_In_ HWND hDlg, _In_ BOOL bEnable)
 
static VOID ClearContents (_In_ HWND hDlg)
 
static HFONT CreateMonospaceFont (VOID)
 
static VOID InitDetailsDlgCtrl (HWND hDlg, PDETAILDATA pData)
 
static INT_PTR CALLBACK EventDetailsCtrl (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
HWND CreateEventDetailsCtrl (HINSTANCE hInstance, HWND hParentWnd, LPARAM lParam)
 

Variables

WCHAR szTitle []
 
HWND hwndListView
 

Macro Definition Documentation

◆ COPY_EVTTEXT_SPACE_PADDING_MODE

#define COPY_EVTTEXT_SPACE_PADDING_MODE

ReactOS-only feature: Enable or disable support for copying event info text using space padding between header titles and data, when pressing the SHIFT key while clicking on the "Copy" button, instead of using TABs as separators.

See also
CopyEventEntry().

Definition at line 24 of file evtdetctl.c.

◆ EVENT_MESSAGE_EVENTTEXT_BUFFER

#define EVENT_MESSAGE_EVENTTEXT_BUFFER   (1024*10)

Definition at line 27 of file evtdetctl.c.

Typedef Documentation

◆ DETAILDATA

◆ PDETAILDATA

Function Documentation

◆ ClearContents()

static VOID ClearContents ( _In_ HWND  hDlg)
static

Definition at line 977 of file evtdetctl.c.

979{
980 /* Disable the Previous/Next and Copy buttons */
983
984 /* Disable the Bytes/Words mode buttons */
987
988 /* Clear the data fields */
997
1000}
#define IDC_COPY
Definition: resource.h:17
#define IDC_EVENTCOMPUTERSTATIC
Definition: resource.h:46
#define IDC_EVENTDATESTATIC
Definition: resource.h:39
#define IDC_WORDSRADIO
Definition: resource.h:53
#define IDC_EVENTUSERSTATIC
Definition: resource.h:45
#define IDC_EVENTTYPESTATIC
Definition: resource.h:43
#define IDC_BYTESRADIO
Definition: resource.h:52
#define IDC_EVENTTIMESTATIC
Definition: resource.h:41
#define IDC_EVENTDATAEDIT
Definition: resource.h:54
#define IDC_EVENTSOURCESTATIC
Definition: resource.h:40
#define IDC_EVENTCATEGORYSTATIC
Definition: resource.h:42
#define IDC_EVENTTEXTEDIT
Definition: resource.h:50
#define IDC_EVENTIDSTATIC
Definition: resource.h:44
#define FALSE
Definition: types.h:117
#define L(x)
Definition: resources.c:13
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
static VOID EnableNavigationArrows(_In_ HWND hDlg, _In_ BOOL bEnable)
Definition: evtdetctl.c:964
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)

Referenced by EventDetailsCtrl().

◆ CopyEventEntry()

static VOID CopyEventEntry ( _In_ HWND  hWnd)
static

Retrieves the already-gathered event information, structure it in text format and copy it into the clipboard for user consumption.

The copied event information has the following text format, where each text line ends with CR-LF newlines:

Event Type: <event_type>\r\n
Event Source: <event_source>\r\n
Event Category: <event_cat>\r\n
Event ID: <event_id>\r\n
Date: <event_date>\r\n
Time: <event_time>\r\n
User: <event_user>\r\n
Computer: <event_computer>\r\n
<event_description>\r\n
Data:\r\n
<event...
...data...
...if any>\r\n
Type
Definition: Type.h:7
static const WCHAR Description[]
Definition: oid.c:1266
static PLARGE_INTEGER Time
Definition: time.c:105
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define ID
Definition: ruserpass.c:36

For the single-line fields, the spacing between the header title and information is either a TAB (default), to facilitate data import in spreadsheet programs, or space-padding (when the user presses the SHIFT key while copying the data) to prettify information display. (This latter functionality is supported only if the program is compiled with the COPY_EVTTEXT_SPACE_PADDING_MODE define.)

Definition at line 356 of file evtdetctl.c.

358{
359#ifdef COPY_EVTTEXT_SPACE_PADDING_MODE
360 static const LONG nTabWidth = 4;
361#endif
362 static const WCHAR szCRLF[] = L"\r\n";
363 struct
364 {
365 WORD uHdrID; // Header string resource ID.
366 WORD nDlgItemID; // Dialog control ID containing the corresponding info.
367 WORD bSameLine : 1; // Info follows header on same line (TRUE) or not (FALSE).
368 WORD bOptional : 1; // Omit if info is empty (TRUE) or keep it (FALSE).
369 PCWCH pchHdrText; // Pointer to header string resource.
370 SIZE_T cchHdrLen; // Header string length (number of characters).
371 SIZE_T cchInfoLen; // Info string length (number of characters).
372#ifdef COPY_EVTTEXT_SPACE_PADDING_MODE
373 UINT nHdrWidth; // Display width of the header string.
374 UINT nSpacesPad; // Padding after header in number of spaces.
375#endif
376 } CopyData[] =
377 {
388 };
389 USHORT i;
390#ifdef COPY_EVTTEXT_SPACE_PADDING_MODE
391 BOOL bUsePad; // Use space padding (TRUE) or not (FALSE, default).
392 UINT nMaxHdrWidth = 0;
393#endif
394 SIZE_T size = 0;
395 PWSTR output;
396 PWSTR pszDestEnd;
397 size_t cchRemaining;
398 HGLOBAL hMem;
399
400 /* Try to open the clipboard */
401 if (!OpenClipboard(hWnd))
402 return;
403
404#ifdef COPY_EVTTEXT_SPACE_PADDING_MODE
405 /* Use space padding only if the user presses SHIFT */
406 bUsePad = !!(GetKeyState(VK_SHIFT) & 0x8000);
407#endif
408
409 /*
410 * Grab all the information and get it ready for the clipboard.
411 */
412
413 /* Calculate the necessary string buffer size */
414 for (i = 0; i < _countof(CopyData); ++i)
415 {
416 /* Retrieve the event info string length (without NUL terminator) */
417 CopyData[i].cchInfoLen = GetWindowTextLengthW(GetDlgItem(hWnd, CopyData[i].nDlgItemID));
418
419 /* If no data is present and is optional, ignore it */
420 if ((CopyData[i].cchInfoLen == 0) && CopyData[i].bOptional)
421 continue;
422
423 /* Load the header string from resources */
424 CopyData[i].cchHdrLen = LoadStringW(hInst, CopyData[i].uHdrID, (PWSTR)&CopyData[i].pchHdrText, 0);
425 size += CopyData[i].cchHdrLen;
426
427 if (CopyData[i].bSameLine)
428 {
429 /* The header and info are on the same line */
430#ifdef COPY_EVTTEXT_SPACE_PADDING_MODE
431 if (bUsePad)
432 {
433 /* Retrieve the maximum header string displayed
434 * width for computing space padding later */
435 CopyData[i].nHdrWidth = my_wcswidth(CopyData[i].pchHdrText, CopyData[i].cchHdrLen);
436 nMaxHdrWidth = max(nMaxHdrWidth, CopyData[i].nHdrWidth);
437 }
438 else
439#endif
440 {
441 /* Count a TAB separator */
442 size++;
443 }
444 }
445 else
446 {
447 /* The data is on a separate line, count a newline */
448 size += _countof(szCRLF)-1;
449 }
450
451 /* Count the event info string and the newline that follows it */
452 size += CopyData[i].cchInfoLen;
453 size += _countof(szCRLF)-1;
454 }
455#ifdef COPY_EVTTEXT_SPACE_PADDING_MODE
456 if (bUsePad)
457 {
458 /* Round nMaxHdrWidth to the next TAB width, and
459 * compute the space padding for each field */
460 UINT nSpaceWidth = 1; // my_wcwidth(L' ');
461 nMaxHdrWidth = ((nMaxHdrWidth / nTabWidth) + 1) * nTabWidth;
462 for (i = 0; i < _countof(CopyData); ++i)
463 {
464 /* If no data is present and is optional, ignore it */
465 if ((CopyData[i].cchInfoLen == 0) && CopyData[i].bOptional)
466 continue;
467
468 /* If the data is on a separate line, ignore padding */
469 if (!CopyData[i].bSameLine)
470 continue;
471
472 /* Compute the padding */
473 CopyData[i].nSpacesPad = (nMaxHdrWidth - CopyData[i].nHdrWidth) / nSpaceWidth;
474 size += CopyData[i].nSpacesPad;
475 }
476 }
477#endif // COPY_EVTTEXT_SPACE_PADDING_MODE
478 /* Add NUL-termination */
479 size++;
480
481 /*
482 * Consolidate the information into a single buffer to copy in the clipboard.
483 */
484 hMem = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, size * sizeof(WCHAR));
485 if (!hMem)
486 goto Quit;
487
488 output = GlobalLock(hMem);
489 if (!output)
490 {
491 GlobalFree(hMem);
492 goto Quit;
493 }
494
495 /* Build the string */
496 pszDestEnd = output;
497 cchRemaining = size;
498 for (i = 0; i < _countof(CopyData); ++i)
499 {
500 SIZE_T sizeDataStr;
501
502 /* If no data is present and is optional, ignore it */
503 if ((CopyData[i].cchInfoLen == 0) && CopyData[i].bOptional)
504 continue;
505
506 /* Copy the header string */
507 StringCchCopyNExW(pszDestEnd, cchRemaining,
508 CopyData[i].pchHdrText, CopyData[i].cchHdrLen,
509 &pszDestEnd, &cchRemaining, 0);
510
511 if (CopyData[i].bSameLine)
512 {
513 /* The header and info are on the same line, add
514 * either the space padding or the TAB separator */
515#ifdef COPY_EVTTEXT_SPACE_PADDING_MODE
516 if (bUsePad)
517 {
518 UINT j = CopyData[i].nSpacesPad;
519 while (j--)
520 {
521 *pszDestEnd++ = L' ';
522 cchRemaining--;
523 }
524 }
525 else
526#endif
527 {
528 *pszDestEnd++ = L'\t';
529 cchRemaining--;
530 }
531 }
532 else
533 {
534 /* The data is on a separate line, add a newline */
535 StringCchCopyExW(pszDestEnd, cchRemaining, szCRLF,
536 &pszDestEnd, &cchRemaining, 0);
537 }
538
539 /* Copy the event info */
540 sizeDataStr = min(cchRemaining, CopyData[i].cchInfoLen + 1);
541 sizeDataStr = GetDlgItemTextW(hWnd, CopyData[i].nDlgItemID, pszDestEnd, sizeDataStr);
542 pszDestEnd += sizeDataStr;
543 cchRemaining -= sizeDataStr;
544
545 /* A newline follows the data */
546 StringCchCopyExW(pszDestEnd, cchRemaining, szCRLF,
547 &pszDestEnd, &cchRemaining, 0);
548 }
549 /* NUL-terminate the buffer */
550 *pszDestEnd++ = UNICODE_NULL;
551 cchRemaining--;
552
553 GlobalUnlock(hMem);
554
555 /* We succeeded, empty the clipboard and write the data in it */
558
559Quit:
560 /* Close the clipboard once we are done with it */
562}
HWND hWnd
Definition: settings.c:17
#define IDS_COPY_EVTUSER
Definition: resource.h:139
#define IDS_COPY_EVTTEXT
Definition: resource.h:141
#define IDS_COPY_EVTCOMP
Definition: resource.h:140
#define IDS_COPY_EVTSRC
Definition: resource.h:134
#define IDS_COPY_EVTCAT
Definition: resource.h:135
#define IDS_COPY_EVTTIME
Definition: resource.h:138
#define IDS_COPY_EVTTYPE
Definition: resource.h:133
#define IDS_COPY_EVTDATE
Definition: resource.h:137
#define IDS_COPY_EVTDATA
Definition: resource.h:142
#define IDS_COPY_EVTID
Definition: resource.h:136
#define CF_UNICODETEXT
Definition: constants.h:408
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
INT WINAPI DECLSPEC_HOTPATCH LoadStringW(HINSTANCE instance, UINT resource_id, LPWSTR buffer, INT buflen)
Definition: string.c:1220
#define szCRLF
Definition: ftp.c:108
HINSTANCE hInst
Definition: dxdiag.c:13
int my_wcswidth(const wchar_t *pwcs, size_t n)
Definition: evtdetctl.c:301
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizeiptr size
Definition: glext.h:5919
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
CONST WCHAR * PCWCH
Definition: ntbasedef.h:423
#define UNICODE_NULL
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
#define _countof(array)
Definition: sndvol32.h:70
STRSAFEAPI StringCchCopyExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
Definition: strsafe.h:184
STRSAFEAPI StringCchCopyNExW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy, STRSAFE_LPWSTR *ppszDestEnd, size_t *pcchRemaining, STRSAFE_DWORD dwFlags)
Definition: strsafe.h:275
#define max(a, b)
Definition: svc.c:63
uint16_t * PWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define GMEM_MOVEABLE
Definition: winbase.h:327
#define GMEM_SHARE
Definition: winbase.h:338
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
int WINAPI GetWindowTextLengthW(_In_ HWND)
#define VK_SHIFT
Definition: winuser.h:2221
SHORT WINAPI GetKeyState(_In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by EventDetailsCtrl().

◆ CreateEventDetailsCtrl()

HWND CreateEventDetailsCtrl ( HINSTANCE  hInstance,
HWND  hParentWnd,
LPARAM  lParam 
)

Definition at line 1305 of file evtdetctl.c.

1308{
1311 hParentWnd, EventDetailsCtrl, lParam);
1312}
#define IDD_EVENTDETAILS_CTRL
Definition: resource.h:33
HINSTANCE hInstance
Definition: charmap.c:19
LPARAM lParam
Definition: combotst.c:139
static INT_PTR CALLBACK EventDetailsCtrl(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: evtdetctl.c:1075
HWND WINAPI CreateDialogParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by EventDetails(), and InitInstance().

◆ CreateMonospaceFont()

static HFONT CreateMonospaceFont ( VOID  )
static

Definition at line 1004 of file evtdetctl.c.

1005{
1006 LOGFONTW tmpFont = {0};
1007 HFONT hFont;
1008 HDC hDC;
1009
1010 hDC = GetDC(NULL);
1011
1012 tmpFont.lfHeight = -MulDiv(8, GetDeviceCaps(hDC, LOGPIXELSY), 72);
1013 tmpFont.lfWeight = FW_NORMAL;
1014 wcscpy(tmpFont.lfFaceName, L"Courier New");
1015
1016 hFont = CreateFontIndirectW(&tmpFont);
1017
1018 ReleaseDC(NULL, hDC);
1019
1020 return hFont;
1021}
static HDC hDC
Definition: 3dtext.c:33
HFONT hFont
Definition: main.c:53
wcscpy
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
LONG lfHeight
Definition: dimm.idl:59
LONG lfWeight
Definition: dimm.idl:63
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
#define FW_NORMAL
Definition: wingdi.h:373
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by EventDetailsCtrl().

◆ DisplayEvent()

static VOID DisplayEvent ( _In_ HWND  hDlg,
_In_ PDETAILDATA  pDetailData 
)
static

Definition at line 66 of file evtdetctl.c.

69{
70 /* Mapping of ListView column index to corresponding dialog control ID */
71 static const WORD lvColsToDlgItemIDs[] =
72 {
76 };
77
78 PEVENTLOGRECORD pevlr;
79 PEVENTLOGFILTER EventLogFilter = pDetailData->EventLogFilter;
80 INT iItem = pDetailData->iEventItem;
81 USHORT i;
82 BOOL bEventData;
83
84 WCHAR szSource[MAX_PATH];
86
87 /* Retrieve and cache the pointer to the selected event item */
88 LVITEMW li;
89 li.mask = LVIF_PARAM;
90 li.iItem = iItem;
91 li.iSubItem = 0;
93 pevlr = pDetailData->pevlr = (PEVENTLOGRECORD)li.lParam;
94
95 for (i = 0; i < _countof(lvColsToDlgItemIDs); ++i)
96 {
97 PWSTR pszBuffer = szEventText;
98 if (lvColsToDlgItemIDs[i] == IDC_EVENTSOURCESTATIC)
99 {
100 /* Use a separate buffer to store the source; used below */
101 pszBuffer = szSource;
103 szSource, _countof(szSource));
104 }
105 else
106 {
108 szEventText, _countof(szEventText));
109 }
110 SetDlgItemTextW(hDlg, lvColsToDlgItemIDs[i], pszBuffer);
111 }
112
113 bEventData = (pevlr->DataLength > 0);
114 EnableDlgItem(hDlg, IDC_BYTESRADIO, bEventData);
115 EnableDlgItem(hDlg, IDC_WORDSRADIO, bEventData);
116
117 // FIXME: At the moment we support only one event log in the filter
118 GetEventMessage(EventLogFilter->EventLogs[0]->LogName, szSource, pevlr,
119 szEventText, _countof(szEventText));
120 SetDlgItemTextW(hDlg, IDC_EVENTTEXTEDIT, szEventText);
121
122 DisplayEventData(hDlg, pDetailData);
123}
#define MAX_PATH
Definition: compat.h:34
BOOL GetEventMessage(_In_ PCWSTR KeyName, _In_ PCWSTR SourceName, _In_ PEVENTLOGRECORD pevlr, _Out_writes_z_(cchText) PWSTR EventText, _In_ SIZE_T cchText)
Definition: eventvwr.c:1658
#define EVENT_MESSAGE_EVENTTEXT_BUFFER
Definition: evtdetctl.c:27
static VOID DisplayEventData(_In_ HWND hDlg, _In_ PDETAILDATA pDetailData)
Definition: evtdetctl.c:206
HWND hwndListView
Definition: eventvwr.c:66
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
#define for
Definition: utility.h:88
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2689
#define LVIF_PARAM
Definition: commctrl.h:2316
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2399
PEVENTLOG EventLogs[ANYSIZE_ARRAY]
Definition: eventvwr.h:138
PWSTR LogName
Definition: eventvwr.h:93
int32_t INT
Definition: typedefs.h:58
struct _EVENTLOGRECORD * PEVENTLOGRECORD

Referenced by EventDetailsCtrl().

◆ DisplayEventData()

static VOID DisplayEventData ( _In_ HWND  hDlg,
_In_ PDETAILDATA  pDetailData 
)
static

Definition at line 206 of file evtdetctl.c.

209{
210 PEVENTLOGRECORD pevlr = pDetailData->pevlr;
211 BOOL bDisplayWords = pDetailData->bDisplayWords;
212
214 UINT i, uOffset;
215 UINT uBufferSize, uLineLength;
216 PWCHAR pTextBuffer, pLine;
217
218 if (!pevlr)
219 return;
220
221 if (pevlr->DataLength == 0)
222 {
224 return;
225 }
226
227 if (bDisplayWords)
228 uBufferSize = ((pevlr->DataLength / 8) + 1) * 26 * sizeof(WCHAR);
229 else
230 uBufferSize = ((pevlr->DataLength / 8) + 1) * 43 * sizeof(WCHAR);
231
232 pTextBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, uBufferSize);
233 if (!pTextBuffer)
234 return;
235
236 pLine = pTextBuffer;
237 uOffset = 0;
238
239 for (i = 0; i < pevlr->DataLength / 8; i++)
240 {
241 pData = (LPBYTE)((LPBYTE)pevlr + pevlr->DataOffset + uOffset);
242
243 if (bDisplayWords)
244 uLineLength = PrintWordDataLine(pLine, uOffset, (PULONG)pData, 8);
245 else
246 uLineLength = PrintByteDataLine(pLine, uOffset, pData, 8);
247 pLine = pLine + uLineLength;
248
249 uOffset += 8;
250 }
251
252 if (pevlr->DataLength % 8 != 0)
253 {
254 pData = (LPBYTE)((LPBYTE)pevlr + pevlr->DataOffset + uOffset);
255
256 if (bDisplayWords)
257 PrintWordDataLine(pLine, uOffset, (PULONG)pData, pevlr->DataLength % 8);
258 else
259 PrintByteDataLine(pLine, uOffset, pData, pevlr->DataLength % 8);
260 }
261
262 SetDlgItemTextW(hDlg, IDC_EVENTDATAEDIT, pTextBuffer);
263
264 HeapFree(GetProcessHeap(), 0, pTextBuffer);
265}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static UINT PrintByteDataLine(PWCHAR pBuffer, UINT uOffset, PBYTE pData, UINT uLength)
Definition: evtdetctl.c:127
static UINT PrintWordDataLine(PWCHAR pBuffer, UINT uOffset, PULONG pData, UINT uLength)
Definition: evtdetctl.c:170
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * PWCHAR
Definition: typedefs.h:56

Referenced by DisplayEvent(), and EventDetailsCtrl().

◆ EnableNavigationArrows()

static VOID EnableNavigationArrows ( _In_ HWND  hDlg,
_In_ BOOL  bEnable 
)
static

Definition at line 964 of file evtdetctl.c.

967{
968 /* Enable Previous/Next only if there is more than one item in the list */
969 if (bEnable)
973}
#define IDC_PREVIOUS
Definition: resource.h:47
#define IDC_NEXT
Definition: fontview.h:17
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2312
_In_ BOOL bEnable
Definition: winddi.h:3426

Referenced by ClearContents(), EventDetailsCtrl(), and InitDetailsDlgCtrl().

◆ EventDetailsCtrl()

static INT_PTR CALLBACK EventDetailsCtrl ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1075 of file evtdetctl.c.

1076{
1078
1080
1081 switch (uMsg)
1082 {
1083 case WM_INITDIALOG:
1084 {
1085 RECT rect;
1086
1088 if (!pData)
1089 {
1090 EndDialog(hDlg, 0);
1091 return (INT_PTR)TRUE;
1092 }
1094
1095 if (lParam != 0)
1096 {
1098 pData->EventLogFilter = DetailInfo->EventLogFilter;
1099 pData->iEventItem = DetailInfo->iEventItem;
1100 }
1101 else
1102 {
1103 pData->iEventItem = -1;
1104 }
1105
1106 pData->bDisplayWords = FALSE;
1107 pData->hMonospaceFont = CreateMonospaceFont();
1108
1109 GetClientRect(hDlg, &rect);
1110 pData->cxOld = pData->cxMin = rect.right - rect.left;
1111 pData->cyOld = pData->cyMin = rect.bottom - rect.top;
1112 pData->scPos.x = pData->scPos.y = 0;
1113
1115 /* NOTE: Showing the event (if any) is currently delayed to later */
1116 // SendMessageW(hDlg, EVT_DISPLAY, TRUE, (LPARAM)pData->iEventItem);
1117
1118 // OnSize(hDlg, pData, pData->cxOld, pData->cyOld);
1119 return (INT_PTR)TRUE;
1120 }
1121
1122 case WM_DESTROY:
1123 if (pData)
1124 {
1125 if (pData->hMonospaceFont)
1126 DeleteObject(pData->hMonospaceFont);
1128 }
1129 return (INT_PTR)TRUE;
1130
1131 case EVT_SETFILTER:
1132 {
1133 /* Disable the display first, before changing the current filter */
1134 pData->pevlr = NULL;
1135 pData->iEventItem = -1;
1136 ClearContents(hDlg);
1137 pData->EventLogFilter = (PEVENTLOGFILTER)lParam;
1138 return (INT_PTR)TRUE;
1139 }
1140
1141 case EVT_DISPLAY:
1142 {
1143 if (wParam)
1144 {
1145 INT iEventItem = (INT)lParam;
1146
1147 /* If no filter is set, don't change anything */
1148 if (!pData->EventLogFilter)
1149 return (INT_PTR)TRUE;
1150
1151 /* If we re-enable display from previously disabled state, re-enable the buttons */
1152 if ((pData->iEventItem == -1) && (iEventItem != -1))
1153 {
1155 EnableDlgItem(hDlg, IDC_COPY, TRUE);
1156 }
1157 else
1158 /* If we disable display from previously enabled state, clear and disable it */
1159 if ((pData->iEventItem != -1) && (iEventItem == -1))
1160 {
1161 ClearContents(hDlg);
1162 }
1163
1164 /* Set the new item */
1165 pData->pevlr = NULL;
1166 pData->iEventItem = iEventItem;
1167
1168 /* Display the event info, if there is one */
1169 if (pData->iEventItem != -1)
1170 DisplayEvent(hDlg, pData);
1171 }
1172 else
1173 {
1174 /* Enable or disable the Previous/Next buttons,
1175 * but keep the existing contents, if any */
1176 EnableNavigationArrows(hDlg, (lParam != -1));
1177
1178 // HACK: Disable the Bytes/Words mode buttons
1179 // because we won't have access anymore to the
1180 // event data. (This will be fixed in the future.)
1181 pData->pevlr = NULL; // Invalidate also the cache.
1184 }
1185 return (INT_PTR)TRUE;
1186 }
1187
1188 case WM_COMMAND:
1189 switch (LOWORD(wParam))
1190 {
1191 case IDC_PREVIOUS:
1192 case IDC_NEXT:
1193 {
1194 BOOL bPrev = (LOWORD(wParam) == IDC_PREVIOUS);
1196 INT iItem, iSel;
1197
1198 if (nItems <= 0) /* No items? */
1199 break;
1200
1201 /* Get the index of the first selected item */
1203
1204 /* Select the previous/next item from our current one */
1205 iItem = ListView_GetNextItem(hwndListView, iSel,
1206 (bPrev ? LVNI_ABOVE : LVNI_BELOW));
1207 if (iItem < 0 || iItem >= nItems)
1208 {
1209 /* Confirm selection restart only if an item was previously
1210 * selected. If not, just proceed with default selection. */
1211 if (iSel != -1)
1212 {
1213 WCHAR szText[200];
1216 szText, _countof(szText));
1217 if (MessageBoxW(hDlg, szText, szTitle, MB_YESNO | MB_ICONQUESTION) != IDYES)
1218 break;
1219 }
1220
1221 /* Determine where to restart from */
1222 iItem = (bPrev ? (nItems - 1) : 0);
1223 }
1224
1225 /*
1226 * Deselect the currently selected items in the list view.
1227 * (They may be different from our current one, if multiple
1228 * event details are being displayed concurrently!)
1229 */
1230 iSel = -1;
1231 while ((iSel = ListView_GetNextItem(hwndListView, iSel, LVNI_SELECTED)) != -1)
1232 {
1235 }
1236
1237 /* Select the new item */
1242
1243 pData->pevlr = NULL;
1244 pData->iEventItem = iItem;
1245
1246 /* Display the event info */
1247 if (pData->EventLogFilter)
1248 DisplayEvent(hDlg, pData);
1249 return (INT_PTR)TRUE;
1250 }
1251
1252 case IDC_COPY:
1253 if (pData->EventLogFilter)
1254 CopyEventEntry(hDlg);
1255 return (INT_PTR)TRUE;
1256
1257 case IDC_BYTESRADIO:
1258 case IDC_WORDSRADIO:
1259 pData->bDisplayWords = (LOWORD(wParam) == IDC_WORDSRADIO);
1260 if (pData->EventLogFilter)
1261 DisplayEventData(hDlg, pData);
1262 return (INT_PTR)TRUE;
1263
1264 default:
1265 break;
1266 }
1267 break;
1268
1269 case WM_NOTIFY:
1270 {
1272
1273 if (hdr->idFrom == IDC_EVENTTEXTEDIT)
1274 {
1275 switch (hdr->code)
1276 {
1277 case EN_LINK:
1278 OnLink(hDlg, (ENLINK*)lParam);
1279 break;
1280 }
1281 }
1282 break;
1283 }
1284
1285 case WM_HSCROLL:
1286 case WM_VSCROLL:
1287 {
1288 OnScroll(hDlg, pData,
1289 (uMsg == WM_HSCROLL) ? SB_HORZ : SB_VERT,
1290 LOWORD(wParam));
1292 return (INT_PTR)TRUE;
1293 }
1294
1295 case WM_SIZE:
1298 return (INT_PTR)TRUE;
1299 }
1300
1301 return (INT_PTR)FALSE;
1302}
int nItems
Definition: appswitch.c:55
#define IDS_CONTFROMBEGINNING
Definition: resource.h:108
#define IDS_CONTFROMEND
Definition: resource.h:109
WPARAM wParam
Definition: combotst.c:138
struct _EVENTLOGFILTER * PEVENTLOGFILTER
static VOID CopyEventEntry(_In_ HWND hWnd)
Retrieves the already-gathered event information, structure it in text format and copy it into the cl...
Definition: evtdetctl.c:356
static VOID OnScroll(HWND hDlg, PDETAILDATA pData, INT nBar, WORD sbCode)
Definition: evtdetctl.c:604
static VOID InitDetailsDlgCtrl(HWND hDlg, PDETAILDATA pData)
Definition: evtdetctl.c:1025
static HFONT CreateMonospaceFont(VOID)
Definition: evtdetctl.c:1004
struct _DETAILDATA * PDETAILDATA
static VOID OnLink(HWND hDlg, ENLINK *penLink)
Definition: evtdetctl.c:566
static VOID ClearContents(_In_ HWND hDlg)
Definition: evtdetctl.c:977
static VOID DisplayEvent(_In_ HWND hDlg, _In_ PDETAILDATA pDetailData)
Definition: evtdetctl.c:66
WCHAR szTitle[]
Definition: magnifier.c:35
static VOID OnSize(HWND hDlg, PDETAILDATA pData, INT cx, INT cy)
Definition: evtdetctl.c:701
struct _EVENTDETAIL_INFO * PEVENTDETAIL_INFO
#define EVT_DISPLAY
Definition: evtdetctl.h:21
#define EVT_SETFILTER
Definition: evtdetctl.h:20
pKey DeleteObject()
char hdr[14]
Definition: iptest.cpp:33
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
#define INT
Definition: polytest.cpp:20
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2678
#define LVNI_SELECTED
Definition: commctrl.h:2429
#define LVNI_BELOW
Definition: commctrl.h:2434
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2439
#define LVIS_SELECTED
Definition: commctrl.h:2324
#define LVNI_ABOVE
Definition: commctrl.h:2433
#define LVIS_FOCUSED
Definition: commctrl.h:2323
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2524
#define EN_LINK
Definition: richedit.h:202
#define WM_NOTIFY
Definition: richedit.h:61
& rect
Definition: startmenu.cpp:1413
PEVENTLOGFILTER EventLogFilter
Definition: evtdetctl.h:16
int32_t INT_PTR
Definition: typedefs.h:64
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:883
#define GetWindowLongPtrW
Definition: winuser.h:4905
#define WM_HSCROLL
Definition: winuser.h:1762
#define WM_VSCROLL
Definition: winuser.h:1763
#define WM_SIZE
Definition: winuser.h:1630
#define SB_VERT
Definition: winuser.h:553
#define WM_COMMAND
Definition: winuser.h:1759
#define WM_INITDIALOG
Definition: winuser.h:1758
#define MB_YESNO
Definition: winuser.h:828
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
struct tagNMHDR * LPNMHDR
#define MB_ICONQUESTION
Definition: winuser.h:800
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define WM_DESTROY
Definition: winuser.h:1628
#define IDYES
Definition: winuser.h:846
#define SetWindowLongPtrW
Definition: winuser.h:5431
#define SB_HORZ
Definition: winuser.h:552
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by CreateEventDetailsCtrl().

◆ GetEventMessage()

BOOL GetEventMessage ( _In_ PCWSTR  KeyName,
_In_ PCWSTR  SourceName,
_In_ PEVENTLOGRECORD  pevlr,
_Out_writes_z_(cchText) PWSTR  EventText,
_In_ SIZE_T  cchText 
)

Definition at line 1658 of file eventvwr.c.

1664{
1665 BOOL Success = FALSE;
1666 DWORD i;
1667 size_t cch;
1668 WCHAR SourceModuleName[1024];
1669 WCHAR ParameterModuleName[1024];
1670 BOOL IsParamModNameCached = FALSE;
1671 LPWSTR lpMsgBuf;
1672 LPWSTR szStringArray, szMessage;
1673 LPWSTR *szArguments;
1674
1675 if (cchText == 0)
1676 return FALSE;
1677
1678 /* Get the event string array */
1679 szStringArray = (LPWSTR)((LPBYTE)pevlr + pevlr->StringOffset);
1680
1681 /* NOTE: GetEventMessageFileDLL can return a comma-separated list of DLLs */
1683 SourceModuleName, _countof(SourceModuleName)))
1684 {
1685 goto Quit;
1686 }
1687
1688 /* Allocate space for insertion strings */
1689 szArguments = HeapAlloc(GetProcessHeap(), 0, pevlr->NumStrings * sizeof(LPVOID));
1690 if (!szArguments)
1691 goto Quit;
1692
1693 // TODO: Revisit this whole IsParamModNameCached later,
1694 // see commits c1ecc98f60 (r71368) and d5ba2a3784 (r71958).
1695 *ParameterModuleName = UNICODE_NULL; // TEMP fix in case GetEventMessageFileDLL fails.
1696 if (!IsParamModNameCached)
1697 {
1698 /* Now that the parameter file list is loaded, no need to reload it at the next run! */
1700 ParameterModuleName, _countof(ParameterModuleName));
1701 // FIXME: If the string loading failed the first time, no need to retry it just after???
1702 }
1703
1704 if (IsParamModNameCached)
1705 {
1706 /* Not yet support for reading messages from parameter message DLL */
1707 }
1708
1709 szMessage = szStringArray;
1710 /*
1711 * HACK:
1712 * We do some hackish preformatting of the cached event strings...
1713 * That's because below, we pass the string to FormatMessage
1714 * (via GetMessageStringFromDllList) with the FORMAT_MESSAGE_ARGUMENT_ARRAY
1715 * flag, instead of ignoring the insertion parameters and do the formatting
1716 * by ourselves. Therefore, the resulting string should have the parameter
1717 * string placeholders starting with a single '%' instead of a mix of one
1718 * and two '%'.
1719 */
1720 /* HACK part 1: Compute the full length of the string array */
1721 cch = 0;
1722 for (i = 0; i < pevlr->NumStrings; i++)
1723 {
1724 szMessage += wcslen(szMessage) + 1;
1725 }
1726 cch = szMessage - szStringArray;
1727
1728 /* HACK part 2: Now do the HACK proper! */
1729 szMessage = szStringArray;
1730 for (i = 0; i < pevlr->NumStrings; i++)
1731 {
1732 lpMsgBuf = szMessage;
1733 while ((lpMsgBuf = wcsstr(lpMsgBuf, L"%%")))
1734 {
1735 if (iswdigit(lpMsgBuf[2]))
1736 {
1737 MoveMemory(lpMsgBuf, lpMsgBuf+1, ((szStringArray + cch) - lpMsgBuf - 1) * sizeof(WCHAR));
1738 }
1739 }
1740
1741 szArguments[i] = szMessage;
1742 szMessage += wcslen(szMessage) + 1;
1743 }
1744
1745 /* Retrieve the message string without appending extra newlines */
1746 lpMsgBuf =
1747 GetMessageStringFromDllList(SourceModuleName,
1750 pevlr->EventID,
1751 0,
1752 (va_list*)szArguments);
1753 if (lpMsgBuf)
1754 {
1755 /* Trim the string */
1756 TrimNulls(lpMsgBuf);
1757
1758 szMessage = NULL;
1759 Success = (ApplyParameterStringsToMessage(ParameterModuleName,
1760 TRUE,
1761 lpMsgBuf,
1762 &szMessage) == ERROR_SUCCESS);
1763 if (Success && szMessage)
1764 {
1765 /* Free the buffer allocated by FormatMessage */
1766 LocalFree(lpMsgBuf);
1767 lpMsgBuf = szMessage;
1768 }
1769
1770 /* Copy the event text */
1771 StringCchCopyW(EventText, cchText, lpMsgBuf);
1772
1773 /* Free the buffer allocated by FormatMessage */
1774 LocalFree(lpMsgBuf);
1775 }
1776
1777 HeapFree(GetProcessHeap(), 0, szArguments);
1778
1779Quit:
1780 if (!Success)
1781 {
1782 /* Get a read-only pointer to the "Event-Not-Found" string */
1783 SIZE_T cchResLen =
1785
1786 lpMsgBuf = HeapAlloc(GetProcessHeap(), 0, (cchResLen + 1) * sizeof(WCHAR));
1787 if (lpMsgBuf)
1788 {
1789 StringCchCopyNW(lpMsgBuf, cchResLen + 1, szMessage, cchResLen);
1790 szMessage = lpMsgBuf;
1791 }
1792 else
1793 {
1794 /* Use a hardcoded format string */
1795 szMessage = L"Event ID ( %lu ), Source ( %s )\n\n";
1796 }
1797 StringCchPrintfW(EventText, cchText, szMessage, (pevlr->EventID & 0xFFFF), SourceName);
1798 if (lpMsgBuf)
1799 HeapFree(GetProcessHeap(), 0, lpMsgBuf);
1800
1801 /* Append the strings */
1802 szMessage = szStringArray;
1803 for (i = 0; i < pevlr->NumStrings; i++)
1804 {
1805 StringCchCatW(EventText, cchText, szMessage);
1806 StringCchCatW(EventText, cchText, L"\n");
1807 szMessage += wcslen(szMessage) + 1;
1808 }
1809 }
1810
1811 return Success;
1812}
char * va_list
Definition: acmsvcex.h:78
WCHAR SourceName[256]
Definition: arping.c:28
#define IDS_EVENTSTRINGIDNOTFOUND
Definition: resource.h:106
#define ERROR_SUCCESS
Definition: deptool.c:10
@ Success
Definition: eventcreate.c:712
DWORD ApplyParameterStringsToMessage(IN LPCWSTR lpMessageDllList, IN BOOL bMessagePreFormatted, IN CONST LPCWSTR pMessage, OUT LPWSTR *pFinalMessage)
Definition: eventvwr.c:903
void TrimNulls(LPWSTR s)
Definition: eventvwr.c:1441
HINSTANCE hInst
Definition: eventvwr.c:48
#define EVENT_PARAMETER_MESSAGE_FILE
Definition: eventvwr.c:41
LPWSTR GetMessageStringFromDllList(IN LPCWSTR lpMessageDllList, IN DWORD dwFlags, IN DWORD dwMessageId, IN DWORD nSize, IN va_list *Arguments OPTIONAL)
Definition: eventvwr.c:842
BOOL GetEventMessageFileDLL(_In_ PCWSTR LogName, _In_ PCWSTR SourceName, _In_ PCWSTR EntryName, _Out_writes_z_(cchName) PWSTR pModuleName, _In_ SIZE_T cchName)
Definition: eventvwr.c:1530
#define EVENT_MESSAGE_FILE
Definition: eventvwr.c:40
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define iswdigit(_c)
Definition: ctype.h:667
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CONST_RETURN wchar_t *__cdecl wcsstr(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
static DWORD DWORD void LPSTR DWORD cch
Definition: str.c:202
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:325
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
Definition: strsafe.h:236
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
#define FORMAT_MESSAGE_MAX_WIDTH_MASK
Definition: winbase.h:458
#define MoveMemory
Definition: winbase.h:1750
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:452
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:457
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:455
_In_ int cchText
Definition: winuser.h:4541
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DisplayEvent().

◆ InitDetailsDlgCtrl()

static VOID InitDetailsDlgCtrl ( HWND  hDlg,
PDETAILDATA  pData 
)
static

Definition at line 1025 of file evtdetctl.c.

1026{
1027 DWORD dwMask;
1028
1032
1036
1037 /* Set the default read-only RichEdit color */
1039
1040 /* Enable RichEdit coloured and underlined links */
1043
1044 /*
1045 * Activate automatic URL recognition by the RichEdit control. For more information, see:
1046 * https://learn.microsoft.com/en-us/archive/blogs/murrays/automatic-richedit-hyperlinks
1047 * https://learn.microsoft.com/en-us/archive/blogs/murrays/richedit-friendly-name-hyperlinks
1048 * https://learn.microsoft.com/en-us/windows/win32/controls/em-autourldetect
1049 */
1050 SendDlgItemMessageW(hDlg, IDC_EVENTTEXTEDIT, EM_AUTOURLDETECT, AURL_ENABLEURL /* | AURL_ENABLEEAURLS */, 0);
1051
1052 /* Note that the RichEdit control never gets themed under WinXP+; one would have to write code to simulate Edit-control theming */
1053
1056
1057 //ClearContents(hDlg);
1058 if (pData->iEventItem != -1)
1059 {
1061 EnableDlgItem(hDlg, IDC_COPY, TRUE);
1062 }
1063 else
1064 {
1067 }
1070}
#define IDI_PREV
Definition: resource.h:23
#define IDI_NEXT
Definition: resource.h:22
#define IDI_COPY
Definition: resource.h:24
#define AURL_ENABLEURL
Definition: eventvwr.h:44
#define EM_GETEVENTMASK
Definition: richedit.h:92
#define EM_AUTOURLDETECT
Definition: richedit.h:125
#define ENM_LINK
Definition: richedit.h:485
#define EM_SETEVENTMASK
Definition: richedit.h:102
#define EM_SETBKGNDCOLOR
Definition: richedit.h:100
#define ENM_MOUSEEVENTS
Definition: richedit.h:476
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
DWORD WINAPI GetSysColor(_In_ int)
#define IMAGE_ICON
Definition: winuser.h:212
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2540
#define BM_SETCHECK
Definition: winuser.h:1940
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BM_SETIMAGE
Definition: winuser.h:1941
#define WM_SETFONT
Definition: winuser.h:1669
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define BST_CHECKED
Definition: winuser.h:197
#define COLOR_3DFACE
Definition: winuser.h:940

Referenced by EventDetailsCtrl().

◆ my_cType3ToWidth()

static int my_cType3ToWidth ( WORD  wType,
wchar_t  ucs 
)
inlinestatic

Definition at line 270 of file evtdetctl.c.

271{
272 if (wType & C3_HALFWIDTH)
273 return 1;
274 else if (wType & (C3_FULLWIDTH | C3_KATAKANA | C3_HIRAGANA | C3_IDEOGRAPH))
275 return 2;
276 /*
277 * HACK for Wide Hangul characters not recognized by GetStringTypeW(CT_CTYPE3)
278 * See:
279 * https://unicode.org/reports/tr11/
280 * https://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt
281 * https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedEastAsianWidth.txt
282 * (or the /Public/UNIDATA/ files)
283 */
284 else if ((ucs >= 0x1100 && ucs <= 0x115F) || (ucs >= 0x302E && ucs <= 0x302F) ||
285 (ucs >= 0x3131 && ucs <= 0x318E) || (ucs >= 0x3260 && ucs <= 0x327F) ||
286 (ucs >= 0xA960 && ucs <= 0xA97C) || (ucs >= 0xAC00 && ucs <= 0xD7A3))
287 return 2;
288 else if (wType & (C3_SYMBOL | C3_KASHIDA | C3_LEXICAL | C3_ALPHA))
289 return 1;
290 else // if (wType & (C3_NONSPACING | C3_DIACRITIC | C3_VOWELMARK | C3_HIGHSURROGATE | C3_LOWSURROGATE | C3_NOTAPPLICABLE))
291 return 0;
292}
#define C3_FULLWIDTH
Definition: winnls.h:287
#define C3_ALPHA
Definition: winnls.h:291
#define C3_IDEOGRAPH
Definition: winnls.h:288
#define C3_HALFWIDTH
Definition: winnls.h:286
#define C3_SYMBOL
Definition: winnls.h:283
#define C3_LEXICAL
Definition: winnls.h:290
#define C3_KATAKANA
Definition: winnls.h:284
#define C3_KASHIDA
Definition: winnls.h:289
#define C3_HIRAGANA
Definition: winnls.h:285

Referenced by my_wcswidth(), and my_wcwidth().

◆ my_wcswidth()

int my_wcswidth ( const wchar_t pwcs,
size_t  n 
)

Definition at line 301 of file evtdetctl.c.

302{
303 int width = 0;
304 PWORD pwType, pwt;
305
306 pwType = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, n * sizeof(WORD));
307 if (!pwType)
308 return 0;
309 if (!GetStringTypeW(CT_CTYPE3, pwcs, n, pwType))
310 goto Quit;
311
312 for (pwt = pwType; n-- > 0; ++pwt, ++pwcs)
313 {
314 width += my_cType3ToWidth(*pwt, *pwcs);
315 }
316Quit:
317 HeapFree(GetProcessHeap(), 0, pwType);
318 return width;
319}
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: locale.c:3098
static int my_cType3ToWidth(WORD wType, wchar_t ucs)
Definition: evtdetctl.c:270
GLint GLint GLsizei width
Definition: gl.h:1546
GLdouble n
Definition: glext.h:7729
WORD * PWORD
Definition: pedump.c:67
_In_z_ const wchar_t * pwcs
Definition: wcstombs.cpp:85
#define CT_CTYPE3
Definition: winnls.h:257

Referenced by CopyEventEntry().

◆ my_wcwidth()

int my_wcwidth ( wchar_t  ucs)

Definition at line 294 of file evtdetctl.c.

295{
296 WORD wType = 0;
297 GetStringTypeW(CT_CTYPE3, &ucs, sizeof(ucs)/sizeof(WCHAR), &wType);
298 return my_cType3ToWidth(wType, ucs);
299}

◆ OnLink()

static VOID OnLink ( HWND  hDlg,
ENLINK penLink 
)
static

Definition at line 566 of file evtdetctl.c.

567{
568 LPWSTR pLink;
569 TEXTRANGE txtRange;
570
572
573 /* Only act on left button up events */
574 if (penLink->msg != WM_LBUTTONUP)
575 return;
576
577 /* If the range is empty, do nothing */
578 if (penLink->chrg.cpMin == penLink->chrg.cpMax)
579 return;
580
581 /* Allocate memory for the text link */
583 (max(penLink->chrg.cpMin, penLink->chrg.cpMax) -
584 min(penLink->chrg.cpMin, penLink->chrg.cpMax) + 1) * sizeof(WCHAR));
585 if (!pLink)
586 {
587 /* Not enough memory, bail out */
588 return;
589 }
590
591 txtRange.chrg = penLink->chrg;
592 txtRange.lpstrText = pLink;
594
595 /* Open the link */
596 ShellExecuteW(hDlg, L"open", pLink, NULL, NULL, SW_SHOWNOACTIVATE);
597
598 /* Free the buffer */
599 HeapFree(GetProcessHeap(), 0, pLink);
600}
#define ASSERT(a)
Definition: mode.c:44
#define EM_GETTEXTRANGE
Definition: richedit.h:108
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2607
LONG cpMax
Definition: richedit.h:501
LONG cpMin
Definition: richedit.h:500
UINT_PTR idFrom
Definition: winuser.h:3234
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
#define WM_LBUTTONUP
Definition: winuser.h:1796

Referenced by EventDetailsCtrl().

◆ OnScroll()

static VOID OnScroll ( HWND  hDlg,
PDETAILDATA  pData,
INT  nBar,
WORD  sbCode 
)
static

Definition at line 604 of file evtdetctl.c.

605{
606 RECT rect;
607
608 SCROLLINFO sInfo;
609 INT oldPos, Maximum;
610 PLONG pOriginXY;
611
612 ASSERT(nBar == SB_HORZ || nBar == SB_VERT);
613
614 GetClientRect(hDlg, &rect);
615
616 if (nBar == SB_HORZ)
617 {
618 Maximum = pData->cxMin - (rect.right-rect.left) /* pData->cxOld */;
619 pOriginXY = &pData->scPos.x;
620 }
621 else // if (nBar == SB_VERT)
622 {
623 Maximum = pData->cyMin - (rect.bottom-rect.top) /* pData->cyOld */;
624 pOriginXY = &pData->scPos.y;
625 }
626
627 /* Set scrollbar sizes */
628 sInfo.cbSize = sizeof(sInfo);
630
631 if (!GetScrollInfo(hDlg, nBar, &sInfo))
632 return;
633
634 oldPos = sInfo.nPos;
635
636 switch (sbCode)
637 {
638 case SB_LINEUP: // SB_LINELEFT:
639 sInfo.nPos--;
640 break;
641
642 case SB_LINEDOWN: // SB_LINERIGHT:
643 sInfo.nPos++;
644 break;
645
646 case SB_PAGEUP: // SB_PAGELEFT:
647 sInfo.nPos -= sInfo.nPage;
648 break;
649
650 case SB_PAGEDOWN: // SB_PAGERIGHT:
651 sInfo.nPos += sInfo.nPage;
652 break;
653
654 case SB_THUMBTRACK:
655 sInfo.nPos = sInfo.nTrackPos;
656 break;
657
658 case SB_THUMBPOSITION:
659 sInfo.nPos = sInfo.nTrackPos;
660 break;
661
662 case SB_TOP: // SB_LEFT:
663 sInfo.nPos = sInfo.nMin;
664 break;
665
666 case SB_BOTTOM: // SB_RIGHT:
667 sInfo.nPos = sInfo.nMax;
668 break;
669
670 default:
671 break;
672 }
673
674 sInfo.nPos = min(max(sInfo.nPos, 0), Maximum);
675
676 if (oldPos != sInfo.nPos)
677 {
678 POINT scOldPos = pData->scPos;
679
680 /* We now modify pData->scPos */
681 *pOriginXY = sInfo.nPos;
682
683 ScrollWindowEx(hDlg,
684 (scOldPos.x - pData->scPos.x),
685 (scOldPos.y - pData->scPos.y),
686 NULL,
687 NULL,
688 NULL,
689 NULL,
691
692 sInfo.fMask = SIF_POS;
693 SetScrollInfo(hDlg, nBar, &sInfo, TRUE);
694
695 // UpdateWindow(hDlg);
696 }
697}
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
int32_t * PLONG
Definition: typedefs.h:58
#define SB_THUMBTRACK
Definition: winuser.h:573
#define SB_LINEUP
Definition: winuser.h:564
#define SW_SCROLLCHILDREN
Definition: winuser.h:2597
#define SIF_RANGE
Definition: winuser.h:1246
#define SB_BOTTOM
Definition: winuser.h:577
#define SW_INVALIDATE
Definition: winuser.h:2598
#define SIF_PAGE
Definition: winuser.h:1244
#define SIF_TRACKPOS
Definition: winuser.h:1248
#define SB_PAGEDOWN
Definition: winuser.h:569
#define SB_LINEDOWN
Definition: winuser.h:565
#define SB_TOP
Definition: winuser.h:578
#define SIF_POS
Definition: winuser.h:1245
#define SW_ERASE
Definition: winuser.h:2599
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
BOOL WINAPI GetScrollInfo(_In_ HWND, _In_ int, _Inout_ LPSCROLLINFO)
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
#define SB_PAGEUP
Definition: winuser.h:568
#define SB_THUMBPOSITION
Definition: winuser.h:572

Referenced by EventDetailsCtrl().

◆ OnSize()

static VOID OnSize ( HWND  hDlg,
PDETAILDATA  pData,
INT  cx,
INT  cy 
)
static

y += (cy - pData->cyOld) / 2 ; // + (cy - pData->cyOld) % 2;

SWP_NOMOVE |

Definition at line 701 of file evtdetctl.c.

702{
703 LONG_PTR dwStyle;
704 INT sbVXSize, sbHYSize;
705 SCROLLINFO sInfo;
706 POINT scOldPos;
707 HDWP hdwp;
708 HWND hItemWnd;
709 RECT rect;
710 INT y = 0;
711
712 if (!pData)
713 return;
714
715 dwStyle = GetWindowLongPtrW(hDlg, GWL_STYLE);
716 sbVXSize = GetSystemMetrics(SM_CXVSCROLL);
717 sbHYSize = GetSystemMetrics(SM_CYHSCROLL);
718
719 /* Compensate for existing scroll bars (because lParam values do not accommodate scroll bar) */
720 if (dwStyle & WS_HSCROLL) cy += sbHYSize; // Window currently has a horizontal scrollbar
721 if (dwStyle & WS_VSCROLL) cx += sbVXSize; // Window currently has a vertical scrollbar
722
723 /* Compensate for added scroll bars in window */
724 if (cx < pData->cxMin) cy -= sbHYSize; // Window will have a horizontal scroll bar
725 if (cy < pData->cyMin) cx -= sbVXSize; // Window will have a vertical scroll bar
726
727 /* Set scrollbar sizes */
728 sInfo.cbSize = sizeof(sInfo);
729
730 sInfo.fMask = SIF_POS;
731 if (GetScrollInfo(hDlg, SB_VERT, &sInfo))
732 scOldPos.y = sInfo.nPos;
733 else
734 scOldPos.y = pData->scPos.y;
735
736 sInfo.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
737 sInfo.nMin = 0;
738 if (pData->cyMin > cy)
739 {
740 sInfo.nMax = pData->cyMin - 1;
741 sInfo.nPage = cy;
742 sInfo.nPos = pData->scPos.y;
743 SetScrollInfo(hDlg, SB_VERT, &sInfo, TRUE);
744
745 /* Display the scrollbar if needed */
746 if (!(dwStyle & WS_VSCROLL))
747 ShowScrollBar(hDlg, SB_VERT, TRUE);
748 }
749 else
750 {
751 scOldPos.y = 0;
752
753 sInfo.nMax = pData->cyMin - 1;
754 sInfo.nPage = cy;
755 sInfo.nPos = pData->scPos.y;
756 sInfo.nPos = scOldPos.y;
757 SetScrollInfo(hDlg, SB_VERT, &sInfo, TRUE);
758
760
761 rect.left = cx - sbVXSize;
762 rect.right = cx;
763 rect.top = 0;
764 rect.bottom = cy;
765 InvalidateRect(hDlg, &rect, TRUE);
766 }
767
768 sInfo.fMask = SIF_POS;
769 if (GetScrollInfo(hDlg, SB_HORZ, &sInfo))
770 scOldPos.x = sInfo.nPos;
771 else
772 scOldPos.x = pData->scPos.x;
773
774 sInfo.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
775 sInfo.nMin = 0;
776 if (pData->cxMin > cx)
777 {
778 sInfo.nMax = pData->cxMin - 1;
779 sInfo.nPage = cx;
780 sInfo.nPos = pData->scPos.x;
781 SetScrollInfo(hDlg, SB_HORZ, &sInfo, TRUE);
782
783 /* Display the scrollbar if needed */
784 if (!(dwStyle & WS_HSCROLL))
785 ShowScrollBar(hDlg, SB_HORZ, TRUE);
786 }
787 else
788 {
789 scOldPos.x = 0;
790
791 sInfo.nMax = pData->cxMin - 1;
792 sInfo.nPage = cx;
793 sInfo.nPos = pData->scPos.x;
794 sInfo.nPos = scOldPos.x;
795 SetScrollInfo(hDlg, SB_HORZ, &sInfo, TRUE);
796
798
799 rect.left = 0;
800 rect.right = cx;
801 rect.top = cy - sbHYSize;
802 rect.bottom = cy;
803 InvalidateRect(hDlg, &rect, TRUE);
804 }
805
806 if ((scOldPos.x != pData->scPos.x) || (scOldPos.y != pData->scPos.y))
807 {
808 ScrollWindowEx(hDlg,
809 // (scOldPos.x - pData->scPos.x),
810 (pData->scPos.x - scOldPos.x),
811 // (scOldPos.y - pData->scPos.y),
812 (pData->scPos.y - scOldPos.y),
813 NULL,
814 NULL,
815 NULL,
816 NULL,
818
819 pData->scPos = scOldPos;
820 }
821
822 // /* Adjust the start of the visible area if we are attempting to show nonexistent areas */
823 // if ((pData->cxMin - pData->scPos.x) < cx) pData->scPos.x = pData->cxMin - cx;
824 // if ((pData->cyMin - pData->scPos.y) < cy) pData->scPos.y = pData->cyMin - cy;
825 // // InvalidateRect(GuiData->hWindow, NULL, TRUE);
826
827 /* Forbid resizing the control smaller than its minimal size */
828 if (cx < pData->cxMin) cx = pData->cxMin;
829 if (cy < pData->cyMin) cy = pData->cyMin;
830
831 if ((cx != pData->cxOld) || (cy != pData->cyOld))
832 {
833 hdwp = BeginDeferWindowPos(8);
834
835 /* Move the edit boxes */
836
837 GetWindowRect(hDlg, &rect);
838
839 hItemWnd = GetDlgItem(hDlg, IDC_EVENTTEXTEDIT);
840 GetWindowRect(hItemWnd, &rect);
841 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
842 // OffsetRect(&rect, 0, y);
843 // y += (cy - pData->cyOld) / 2 ; // + (cy - pData->cyOld) % 2;
845 if (cy >= pData->cyOld)
846 y += (cy - pData->cyOld) / 2 + (cy - pData->cyOld) % 2;
847 else
848 y -= (pData->cyOld - cy) / 2 + (pData->cyOld - cy) % 2;
849
850 if (hdwp)
851 hdwp = DeferWindowPos(hdwp,
852 hItemWnd,
853 0,
854 rect.left, rect.top,
855 (rect.right - rect.left) + (cx - pData->cxOld),
856 (rect.bottom - rect.top) + y, SWP_NOZORDER | SWP_NOACTIVATE);
858
859 hItemWnd = GetDlgItem(hDlg, IDC_DETAILS_STATIC);
860 GetWindowRect(hItemWnd, &rect);
861 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
862 // OffsetRect(&rect, 0, y);
863
864 if (hdwp)
865 hdwp = DeferWindowPos(hdwp,
866 hItemWnd,
867 0,
868 rect.left, rect.top + y,
869 0, 0,
871
872 hItemWnd = GetDlgItem(hDlg, IDC_BYTESRADIO);
873 GetWindowRect(hItemWnd, &rect);
874 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
875 // OffsetRect(&rect, 0, y);
876
877 if (hdwp)
878 hdwp = DeferWindowPos(hdwp,
879 hItemWnd,
880 0,
881 rect.left, rect.top + y,
882 0, 0,
884
885 hItemWnd = GetDlgItem(hDlg, IDC_WORDSRADIO);
886 GetWindowRect(hItemWnd, &rect);
887 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
888 // OffsetRect(&rect, 0, y);
889
890 if (hdwp)
891 hdwp = DeferWindowPos(hdwp,
892 hItemWnd,
893 0,
894 rect.left, rect.top + y,
895 0, 0,
897
898 hItemWnd = GetDlgItem(hDlg, IDC_EVENTDATAEDIT);
899 GetWindowRect(hItemWnd, &rect);
900 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
901 // OffsetRect(&rect, 0, y);
902 // // y -= (cy - pData->cyOld) % 2;
903
904 if (hdwp)
905 hdwp = DeferWindowPos(hdwp,
906 hItemWnd,
907 0,
908 rect.left, rect.top + y,
909 (rect.right - rect.left) + (cx - pData->cxOld),
910 (rect.bottom - rect.top) + y,
912
913 /* Move the buttons */
914
915 hItemWnd = GetDlgItem(hDlg, IDC_PREVIOUS);
916 GetWindowRect(hItemWnd, &rect);
917 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
918
919 if (hdwp)
920 hdwp = DeferWindowPos(hdwp,
921 hItemWnd,
922 0,
923 rect.left + (cx - pData->cxOld),
924 rect.top,
925 0, 0,
927
928 hItemWnd = GetDlgItem(hDlg, IDC_NEXT);
929 GetWindowRect(hItemWnd, &rect);
930 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
931
932 if (hdwp)
933 hdwp = DeferWindowPos(hdwp,
934 hItemWnd,
935 0,
936 rect.left + (cx - pData->cxOld),
937 rect.top,
938 0, 0,
940
941 hItemWnd = GetDlgItem(hDlg, IDC_COPY);
942 GetWindowRect(hItemWnd, &rect);
943 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
944
945 if (hdwp)
946 hdwp = DeferWindowPos(hdwp,
947 hItemWnd,
948 0,
949 rect.left + (cx - pData->cxOld),
950 rect.top,
951 0, 0,
953
954 if (hdwp)
955 EndDeferWindowPos(hdwp);
956
957 pData->cxOld = cx;
958 pData->cyOld = cy;
959 }
960}
#define IDC_DETAILS_STATIC
Definition: resource.h:51
static INT cxMin
Definition: eventvwr.c:4340
static INT cyMin
Definition: eventvwr.c:4340
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
if(dx< 0)
Definition: linetemp.h:194
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
#define SWP_NOACTIVATE
Definition: winuser.h:1253
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SM_CXVSCROLL
Definition: winuser.h:972
#define SWP_NOSIZE
Definition: winuser.h:1256
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define SM_CYHSCROLL
Definition: winuser.h:973
#define HWND_DESKTOP
Definition: winuser.h:1220
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define SWP_NOZORDER
Definition: winuser.h:1258
#define GWL_STYLE
Definition: winuser.h:863
int WINAPI GetSystemMetrics(_In_ int)
HDWP WINAPI BeginDeferWindowPos(_In_ int)

Referenced by EventDetailsCtrl().

◆ PrintByteDataLine()

static UINT PrintByteDataLine ( PWCHAR  pBuffer,
UINT  uOffset,
PBYTE  pData,
UINT  uLength 
)
static

Definition at line 127 of file evtdetctl.c.

128{
129 PWCHAR p = pBuffer;
130 UINT n, i, r = 0;
131
132 if (uOffset != 0)
133 {
134 n = swprintf(p, L"\r\n");
135 p += n;
136 r += n;
137 }
138
139 n = swprintf(p, L"%04lx:", uOffset);
140 p += n;
141 r += n;
142
143 for (i = 0; i < uLength; i++)
144 {
145 n = swprintf(p, L" %02x", pData[i]);
146 p += n;
147 r += n;
148 }
149
150 for (i = 0; i < 9 - uLength; i++)
151 {
152 n = swprintf(p, L" ");
153 p += n;
154 r += n;
155 }
156
157 for (i = 0; i < uLength; i++)
158 {
159 // NOTE: Normally iswprint should return FALSE for tabs...
160 n = swprintf(p, L"%c", (iswprint(pData[i]) && (pData[i] != L'\t')) ? pData[i] : L'.');
161 p += n;
162 r += n;
163 }
164
165 return r;
166}
#define swprintf
Definition: precomp.h:40
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLfloat GLfloat p
Definition: glext.h:8902
#define iswprint(_c)
Definition: ctype.h:672
PVOID pBuffer

Referenced by DisplayEventData().

◆ PrintWordDataLine()

static UINT PrintWordDataLine ( PWCHAR  pBuffer,
UINT  uOffset,
PULONG  pData,
UINT  uLength 
)
static

Definition at line 170 of file evtdetctl.c.

171{
172 PWCHAR p = pBuffer;
173 UINT n, i, r = 0;
174
175 if (uOffset != 0)
176 {
177 n = swprintf(p, L"\r\n");
178 p += n;
179 r += n;
180 }
181
182 n = swprintf(p, L"%04lx:", uOffset);
183 p += n;
184 r += n;
185
186 for (i = 0; i < uLength / sizeof(ULONG); i++)
187 {
188 n = swprintf(p, L" %08lx", pData[i]);
189 p += n;
190 r += n;
191 }
192
193 /* Display the remaining bytes if uLength was not a multiple of sizeof(ULONG) */
194 for (i = (uLength / sizeof(ULONG)) * sizeof(ULONG); i < uLength; i++)
195 {
196 n = swprintf(p, L" %02x", ((PBYTE)pData)[i]);
197 p += n;
198 r += n;
199 }
200
201 return r;
202}
BYTE * PBYTE
Definition: pedump.c:66
uint32_t ULONG
Definition: typedefs.h:59

Referenced by DisplayEventData().

Variable Documentation

◆ hwndListView

◆ szTitle

WCHAR szTitle[]
extern

Definition at line 35 of file magnifier.c.

Referenced by EventDetailsCtrl().