ReactOS 0.4.15-dev-5666-gc548b97
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 EVENT_MESSAGE_EVENTTEXT_BUFFER   (1024*10)
 

Typedefs

typedef struct _DETAILDATA DETAILDATA
 
typedef struct _DETAILDATAPDETAILDATA
 

Functions

BOOL GetEventMessage (IN LPCWSTR KeyName, IN LPCWSTR SourceName, IN PEVENTLOGRECORD pevlr, OUT PWCHAR EventText)
 
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 VOID DisplayEventData (_In_ HWND hDlg, _In_ PDETAILDATA pDetailData)
 
static HFONT CreateMonospaceFont (VOID)
 
static VOID CopyEventEntry (HWND hWnd)
 
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 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

◆ EVENT_MESSAGE_EVENTTEXT_BUFFER

#define EVENT_MESSAGE_EVENTTEXT_BUFFER   (1024*10)

Definition at line 16 of file evtdetctl.c.

Typedef Documentation

◆ DETAILDATA

◆ PDETAILDATA

Function Documentation

◆ CopyEventEntry()

static VOID CopyEventEntry ( HWND  hWnd)
static

Definition at line 267 of file evtdetctl.c.

268{
269 WCHAR tmpHeader[512];
270 WCHAR szEventType[MAX_PATH];
271 WCHAR szSource[MAX_PATH];
272 WCHAR szCategory[MAX_PATH];
273 WCHAR szEventID[MAX_PATH];
274 WCHAR szDate[MAX_PATH];
276 WCHAR szUser[MAX_PATH];
277 WCHAR szComputer[MAX_PATH];
279 ULONG size = 0;
280 LPWSTR output;
281 HGLOBAL hMem;
282
283 /* Try to open the clipboard */
284 if (!OpenClipboard(hWnd))
285 return;
286
287 /* Get the formatted text needed to place the content into */
288 size += LoadStringW(hInst, IDS_COPY, tmpHeader, ARRAYSIZE(tmpHeader));
289
290 /* Grab all the information and get it ready for the clipboard */
291 size += GetDlgItemTextW(hWnd, IDC_EVENTTYPESTATIC, szEventType, ARRAYSIZE(szEventType));
292 size += GetDlgItemTextW(hWnd, IDC_EVENTSOURCESTATIC, szSource, ARRAYSIZE(szSource));
293 size += GetDlgItemTextW(hWnd, IDC_EVENTCATEGORYSTATIC, szCategory, ARRAYSIZE(szCategory));
294 size += GetDlgItemTextW(hWnd, IDC_EVENTIDSTATIC, szEventID, ARRAYSIZE(szEventID));
298 size += GetDlgItemTextW(hWnd, IDC_EVENTCOMPUTERSTATIC, szComputer, ARRAYSIZE(szComputer));
299 size += GetDlgItemTextW(hWnd, IDC_EVENTTEXTEDIT, evtDesc, ARRAYSIZE(evtDesc));
300
301 size++; /* Null-termination */
302 size *= sizeof(WCHAR);
303
304 /*
305 * Consolidate the information into one big piece and
306 * sort out the memory needed to write to the clipboard.
307 */
309 if (hMem == NULL) goto Quit;
310
311 output = GlobalLock(hMem);
312 if (output == NULL)
313 {
314 GlobalFree(hMem);
315 goto Quit;
316 }
317
318 StringCbPrintfW(output, size,
319 tmpHeader, szEventType, szSource, szCategory, szEventID,
320 szDate, szTime, szUser, szComputer, evtDesc);
321
322 GlobalUnlock(hMem);
323
324 /* We succeeded, empty the clipboard and write the data in it */
327
328Quit:
329 /* Close the clipboard once we are done with it */
331}
HWND hWnd
Definition: settings.c:17
#define IDC_EVENTCOMPUTERSTATIC
Definition: resource.h:46
#define IDC_EVENTDATESTATIC
Definition: resource.h:39
#define IDC_EVENTUSERSTATIC
Definition: resource.h:45
#define IDC_EVENTTYPESTATIC
Definition: resource.h:43
#define IDS_COPY
Definition: resource.h:131
#define IDC_EVENTTIMESTATIC
Definition: resource.h:41
#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 CF_UNICODETEXT
Definition: constants.h:408
#define NULL
Definition: types.h:112
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATH
Definition: compat.h:34
HINSTANCE hInst
Definition: dxdiag.c:13
#define EVENT_MESSAGE_EVENTTEXT_BUFFER
Definition: evtdetctl.c:16
GLsizeiptr size
Definition: glext.h:5919
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
unsigned int ULONG
Definition: retypes.h:1
TCHAR szTime[64]
Definition: solitaire.cpp:19
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:557
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2263
#define GMEM_MOVEABLE
Definition: winbase.h:294
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
HANDLE WINAPI SetClipboardData(_In_ UINT, _In_opt_ HANDLE)
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
BOOL WINAPI EmptyClipboard(void)
Definition: ntwrapper.h:190
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by EventDetailsCtrl().

◆ CreateEventDetailsCtrl()

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

Definition at line 954 of file evtdetctl.c.

957{
960 hParentWnd, EventDetailsCtrl, lParam);
961}
#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:769
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 246 of file evtdetctl.c.

247{
248 LOGFONTW tmpFont = {0};
249 HFONT hFont;
250 HDC hDC;
251
252 hDC = GetDC(NULL);
253
254 tmpFont.lfHeight = -MulDiv(8, GetDeviceCaps(hDC, LOGPIXELSY), 72);
255 tmpFont.lfWeight = FW_NORMAL;
256 wcscpy(tmpFont.lfFaceName, L"Courier New");
257
258 hFont = CreateFontIndirectW(&tmpFont);
259
261
262 return hFont;
263}
static HDC hDC
Definition: 3dtext.c:33
HFONT hFont
Definition: main.c:53
static HDC
Definition: imagelist.c:92
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
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 43 of file evtdetctl.c.

46{
47 PEVENTLOGFILTER EventLogFilter = pDetailData->EventLogFilter;
48 INT iItem = pDetailData->iEventItem;
49 LVITEMW li;
50 PEVENTLOGRECORD pevlr;
51 BOOL bEventData;
52
53 WCHAR szEventType[MAX_PATH];
55 WCHAR szDate[MAX_PATH];
56 WCHAR szUser[MAX_PATH];
57 WCHAR szComputer[MAX_PATH];
58 WCHAR szSource[MAX_PATH];
59 WCHAR szCategory[MAX_PATH];
60 WCHAR szEventID[MAX_PATH];
62
63 li.mask = LVIF_PARAM;
64 li.iItem = iItem;
65 li.iSubItem = 0;
67
68 pevlr = (PEVENTLOGRECORD)li.lParam;
69
70 ListView_GetItemText(hwndListView, iItem, 0, szEventType, ARRAYSIZE(szEventType));
71 ListView_GetItemText(hwndListView, iItem, 1, szDate, ARRAYSIZE(szDate));
73 ListView_GetItemText(hwndListView, iItem, 3, szSource, ARRAYSIZE(szSource));
74 ListView_GetItemText(hwndListView, iItem, 4, szCategory, ARRAYSIZE(szCategory));
75 ListView_GetItemText(hwndListView, iItem, 5, szEventID, ARRAYSIZE(szEventID));
76 ListView_GetItemText(hwndListView, iItem, 6, szUser, ARRAYSIZE(szUser));
77 ListView_GetItemText(hwndListView, iItem, 7, szComputer, ARRAYSIZE(szComputer));
78
85 SetDlgItemTextW(hDlg, IDC_EVENTIDSTATIC, szEventID);
86 SetDlgItemTextW(hDlg, IDC_EVENTTYPESTATIC, szEventType);
87
88 bEventData = (pevlr->DataLength > 0);
89 EnableDlgItem(hDlg, IDC_BYTESRADIO, bEventData);
90 EnableDlgItem(hDlg, IDC_WORDRADIO, bEventData);
91
92 // FIXME: At the moment we support only one event log in the filter
93 GetEventMessage(EventLogFilter->EventLogs[0]->LogName, szSource, pevlr, szEventText);
94 SetDlgItemTextW(hDlg, IDC_EVENTTEXTEDIT, szEventText);
95}
#define IDC_WORDRADIO
Definition: resource.h:53
#define IDC_BYTESRADIO
Definition: resource.h:52
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:55
BOOL GetEventMessage(IN LPCWSTR KeyName, IN LPCWSTR SourceName, IN PEVENTLOGRECORD pevlr, OUT PWCHAR EventText)
Definition: eventvwr.c:1639
HWND hwndListView
Definition: eventvwr.c:66
unsigned int BOOL
Definition: ntddk_ex.h:94
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
#define ListView_GetItemText(hwndLV, i, iSubItem_, pszText_, cchTextMax_)
Definition: commctrl.h:2684
#define LVIF_PARAM
Definition: commctrl.h:2311
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
PEVENTLOG EventLogs[ANYSIZE_ARRAY]
Definition: eventvwr.h:138
PWSTR LogName
Definition: eventvwr.h:93
int32_t INT
Definition: typedefs.h:58
struct _EVENTLOGRECORD * PEVENTLOGRECORD
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)

Referenced by EventDetailsCtrl().

◆ DisplayEventData()

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

Definition at line 178 of file evtdetctl.c.

181{
182 BOOL bDisplayWords = pDetailData->bDisplayWords;
183 INT iItem = pDetailData->iEventItem;
184 LVITEMW li;
185 PEVENTLOGRECORD pevlr;
186
188 UINT i, uOffset;
189 UINT uBufferSize, uLineLength;
190 PWCHAR pTextBuffer, pLine;
191
192 li.mask = LVIF_PARAM;
193 li.iItem = iItem;
194 li.iSubItem = 0;
196
197 pevlr = (PEVENTLOGRECORD)li.lParam;
198 if (pevlr->DataLength == 0)
199 {
201 return;
202 }
203
204 if (bDisplayWords)
205 uBufferSize = ((pevlr->DataLength / 8) + 1) * 26 * sizeof(WCHAR);
206 else
207 uBufferSize = ((pevlr->DataLength / 8) + 1) * 43 * sizeof(WCHAR);
208
209 pTextBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, uBufferSize);
210 if (!pTextBuffer)
211 return;
212
213 pLine = pTextBuffer;
214 uOffset = 0;
215
216 for (i = 0; i < pevlr->DataLength / 8; i++)
217 {
218 pData = (LPBYTE)((LPBYTE)pevlr + pevlr->DataOffset + uOffset);
219
220 if (bDisplayWords)
221 uLineLength = PrintWordDataLine(pLine, uOffset, (PULONG)pData, 8);
222 else
223 uLineLength = PrintByteDataLine(pLine, uOffset, pData, 8);
224 pLine = pLine + uLineLength;
225
226 uOffset += 8;
227 }
228
229 if (pevlr->DataLength % 8 != 0)
230 {
231 pData = (LPBYTE)((LPBYTE)pevlr + pevlr->DataOffset + uOffset);
232
233 if (bDisplayWords)
234 PrintWordDataLine(pLine, uOffset, (PULONG)pData, pevlr->DataLength % 8);
235 else
236 PrintByteDataLine(pLine, uOffset, pData, pevlr->DataLength % 8);
237 }
238
239 SetDlgItemTextW(hDlg, IDC_EVENTDATAEDIT, pTextBuffer);
240
241 HeapFree(GetProcessHeap(), 0, pTextBuffer);
242}
#define IDC_EVENTDATAEDIT
Definition: resource.h:54
#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:99
static UINT PrintWordDataLine(PWCHAR pBuffer, UINT uOffset, PULONG pData, UINT uLength)
Definition: evtdetctl.c:142
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
if(dx< 0)
Definition: linetemp.h:194
unsigned int * PULONG
Definition: retypes.h:1
unsigned int UINT
Definition: ndis.h:50
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
unsigned char * LPBYTE
Definition: typedefs.h:53
uint16_t * PWCHAR
Definition: typedefs.h:56

Referenced by EventDetailsCtrl().

◆ EventDetailsCtrl()

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

Definition at line 769 of file evtdetctl.c.

770{
772
774
775 switch (uMsg)
776 {
777 case WM_INITDIALOG:
778 {
779 RECT rect;
780
782 if (!pData)
783 {
784 EndDialog(hDlg, 0);
785 return (INT_PTR)TRUE;
786 }
788
789 if (lParam != 0)
790 {
792 pData->EventLogFilter = DetailInfo->EventLogFilter;
793 pData->iEventItem = DetailInfo->iEventItem;
794 }
795 pData->bDisplayWords = FALSE;
796 pData->hMonospaceFont = CreateMonospaceFont();
797
798 GetClientRect(hDlg, &rect);
799 pData->cxOld = pData->cxMin = rect.right - rect.left;
800 pData->cyOld = pData->cyMin = rect.bottom - rect.top;
801 pData->scPos.x = pData->scPos.y = 0;
802
804
805 // OnSize(hDlg, pData, pData->cxOld, pData->cyOld);
806 return (INT_PTR)TRUE;
807 }
808
809 case WM_DESTROY:
810 if (pData)
811 {
812 if (pData->hMonospaceFont)
813 DeleteObject(pData->hMonospaceFont);
815 }
816 return (INT_PTR)TRUE;
817
818 case EVT_SETFILTER:
819 pData->EventLogFilter = (PEVENTLOGFILTER)lParam;
820 return (INT_PTR)TRUE;
821
822 case EVT_DISPLAY:
823 {
824 pData->iEventItem = (INT)lParam;
825 if (pData->EventLogFilter)
826 {
827 /* Show event info in control */
828 DisplayEvent(hDlg, pData);
829 DisplayEventData(hDlg, pData);
830 }
831 return (INT_PTR)TRUE;
832 }
833
834 case WM_COMMAND:
835 switch (LOWORD(wParam))
836 {
837 case IDC_PREVIOUS:
838 case IDC_NEXT:
839 {
840 BOOL bPrev = (LOWORD(wParam) == IDC_PREVIOUS);
841 INT iItem, iSel;
842
843 /* Select the previous/next item from our current one */
845 pData->iEventItem,
846 bPrev ? LVNI_ABOVE : LVNI_BELOW);
847 if (iItem == -1)
848 {
849 // TODO: Localization.
850 if (MessageBoxW(hDlg,
851 bPrev
852 ? L"You have reached the beginning of the event log. Do you want to continue from the end?"
853 : L"You have reached the end of the event log. Do you want to continue from the beginning?",
854 szTitle,
856 == IDNO)
857 {
858 break;
859 }
860
861 /* Determine from where to restart */
862 if (bPrev)
864 else
865 iItem = 0;
866 }
867
868 /*
869 * Deselect the currently selected items in the list view.
870 * (They may be different from our current one, if multiple
871 * event details are being displayed concurrently!)
872 */
873 iSel = -1;
874 while ((iSel = ListView_GetNextItem(hwndListView, iSel, LVNI_SELECTED)) != -1)
875 {
878 }
879
880 /* Select the new item */
885
886 pData->iEventItem = iItem;
887
888 /* Show event info in control */
889 if (pData->EventLogFilter)
890 {
891 DisplayEvent(hDlg, pData);
892 DisplayEventData(hDlg, pData);
893 }
894 return (INT_PTR)TRUE;
895 }
896
897 case IDC_COPY:
898 if (pData->EventLogFilter)
899 CopyEventEntry(hDlg);
900 return (INT_PTR)TRUE;
901
902 case IDC_BYTESRADIO:
903 case IDC_WORDRADIO:
904 {
905 if (pData->EventLogFilter)
906 {
907 pData->bDisplayWords = (LOWORD(wParam) == IDC_WORDRADIO);
908 DisplayEventData(hDlg, pData);
909 }
910 return (INT_PTR)TRUE;
911 }
912
913 default:
914 break;
915 }
916 break;
917
918 case WM_NOTIFY:
919 {
921
922 if (hdr->idFrom == IDC_EVENTTEXTEDIT)
923 {
924 switch (hdr->code)
925 {
926 case EN_LINK:
927 OnLink(hDlg, (ENLINK*)lParam);
928 break;
929 }
930 }
931 break;
932 }
933
934 case WM_HSCROLL:
935 case WM_VSCROLL:
936 {
937 OnScroll(hDlg, pData,
938 (uMsg == WM_HSCROLL) ? SB_HORZ : SB_VERT,
939 LOWORD(wParam));
941 return (INT_PTR)TRUE;
942 }
943
944 case WM_SIZE:
947 return (INT_PTR)TRUE;
948 }
949
950 return (INT_PTR)FALSE;
951}
#define IDC_COPY
Definition: resource.h:17
#define IDC_PREVIOUS
Definition: resource.h:47
WPARAM wParam
Definition: combotst.c:138
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
struct _EVENTLOGFILTER * PEVENTLOGFILTER
static VOID OnScroll(HWND hDlg, PDETAILDATA pData, INT nBar, WORD sbCode)
Definition: evtdetctl.c:373
static VOID InitDetailsDlgCtrl(HWND hDlg, PDETAILDATA pData)
Definition: evtdetctl.c:733
static VOID CopyEventEntry(HWND hWnd)
Definition: evtdetctl.c:267
static HFONT CreateMonospaceFont(VOID)
Definition: evtdetctl.c:246
struct _DETAILDATA * PDETAILDATA
static VOID DisplayEventData(_In_ HWND hDlg, _In_ PDETAILDATA pDetailData)
Definition: evtdetctl.c:178
static VOID OnLink(HWND hDlg, ENLINK *penLink)
Definition: evtdetctl.c:335
static VOID DisplayEvent(_In_ HWND hDlg, _In_ PDETAILDATA pDetailData)
Definition: evtdetctl.c:43
WCHAR szTitle[]
Definition: magnifier.c:35
static VOID OnSize(HWND hDlg, PDETAILDATA pData, INT cx, INT cy)
Definition: evtdetctl.c:470
struct _EVENTDETAIL_INFO * PEVENTDETAIL_INFO
#define EVT_DISPLAY
Definition: evtdetctl.h:22
#define EVT_SETFILTER
Definition: evtdetctl.h:21
#define IDC_NEXT
Definition: fontview.h:17
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:2673
#define LVNI_SELECTED
Definition: commctrl.h:2424
#define LVNI_BELOW
Definition: commctrl.h:2429
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define LVNI_ABOVE
Definition: commctrl.h:2428
#define LVIS_FOCUSED
Definition: commctrl.h:2318
#define ListView_EnsureVisible(hwndLV, i, fPartialOK)
Definition: commctrl.h:2519
#define EN_LINK
Definition: richedit.h:202
#define WM_NOTIFY
Definition: richedit.h:61
& rect
Definition: startmenu.cpp:1413
PEVENTLOGFILTER EventLogFilter
Definition: evtdetctl.h:17
int32_t INT_PTR
Definition: typedefs.h:64
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:866
#define GetWindowLongPtrW
Definition: winuser.h:4819
#define WM_HSCROLL
Definition: winuser.h:1733
#define WM_VSCROLL
Definition: winuser.h:1734
#define WM_SIZE
Definition: winuser.h:1601
#define SB_VERT
Definition: winuser.h:553
#define WM_COMMAND
Definition: winuser.h:1730
#define WM_INITDIALOG
Definition: winuser.h:1729
#define MB_YESNO
Definition: winuser.h:811
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)
#define IDNO
Definition: winuser.h:830
struct tagNMHDR * LPNMHDR
#define MB_ICONQUESTION
Definition: winuser.h:783
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define WM_DESTROY
Definition: winuser.h:1599
#define SetWindowLongPtrW
Definition: winuser.h:5336
#define SB_HORZ
Definition: winuser.h:552
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by CreateEventDetailsCtrl().

◆ GetEventMessage()

BOOL GetEventMessage ( IN LPCWSTR  KeyName,
IN LPCWSTR  SourceName,
IN PEVENTLOGRECORD  pevlr,
OUT PWCHAR  EventText 
)

Definition at line 1639 of file eventvwr.c.

1643{
1644 BOOL Success = FALSE;
1645 DWORD i;
1646 size_t cch;
1647 WCHAR SourceModuleName[1024];
1648 WCHAR ParameterModuleName[1024];
1649 BOOL IsParamModNameCached = FALSE;
1650 LPWSTR lpMsgBuf = NULL;
1651 LPWSTR szStringArray, szMessage;
1652 LPWSTR *szArguments;
1653
1654 /* Get the event string array */
1655 szStringArray = (LPWSTR)((LPBYTE)pevlr + pevlr->StringOffset);
1656
1657 /* NOTE: GetEventMessageFileDLL can return a comma-separated list of DLLs */
1659 goto Quit;
1660
1661 /* Allocate space for insertion strings */
1662 szArguments = HeapAlloc(GetProcessHeap(), 0, pevlr->NumStrings * sizeof(LPVOID));
1663 if (!szArguments)
1664 goto Quit;
1665
1666 if (!IsParamModNameCached)
1667 {
1668 /* Now that the parameter file list is loaded, no need to reload it at the next run! */
1669 IsParamModNameCached = GetEventMessageFileDLL(KeyName, SourceName, EVENT_PARAMETER_MESSAGE_FILE, ParameterModuleName);
1670 // FIXME: If the string loading failed the first time, no need to retry it just after???
1671 }
1672
1673 if (IsParamModNameCached)
1674 {
1675 /* Not yet support for reading messages from parameter message DLL */
1676 }
1677
1678 szMessage = szStringArray;
1679 /*
1680 * HACK:
1681 * We do some hackish preformatting of the cached event strings...
1682 * That's because after we pass the string to FormatMessage
1683 * (via GetMessageStringFromDllList) with the FORMAT_MESSAGE_ARGUMENT_ARRAY
1684 * flag, instead of ignoring the insertion parameters and do the formatting
1685 * by ourselves. Therefore, the resulting string should have the parameter
1686 * string placeholders starting with a single '%' instead of a mix of one
1687 * and two '%'.
1688 */
1689 /* HACK part 1: Compute the full length of the string array */
1690 cch = 0;
1691 for (i = 0; i < pevlr->NumStrings; i++)
1692 {
1693 szMessage += wcslen(szMessage) + 1;
1694 }
1695 cch = szMessage - szStringArray;
1696
1697 /* HACK part 2: Now do the HACK proper! */
1698 szMessage = szStringArray;
1699 for (i = 0; i < pevlr->NumStrings; i++)
1700 {
1701 lpMsgBuf = szMessage;
1702 while ((lpMsgBuf = wcsstr(lpMsgBuf, L"%%")))
1703 {
1704 if (iswdigit(lpMsgBuf[2]))
1705 {
1706 MoveMemory(lpMsgBuf, lpMsgBuf+1, ((szStringArray + cch) - lpMsgBuf - 1) * sizeof(WCHAR));
1707 }
1708 }
1709
1710 szArguments[i] = szMessage;
1711 szMessage += wcslen(szMessage) + 1;
1712 }
1713
1714 /* Retrieve the message string without appending extra newlines */
1715 lpMsgBuf =
1716 GetMessageStringFromDllList(SourceModuleName,
1719 pevlr->EventID,
1720 0,
1721 (va_list*)szArguments);
1722 if (lpMsgBuf)
1723 {
1724 /* Trim the string */
1725 TrimNulls(lpMsgBuf);
1726
1727 szMessage = NULL;
1728 Success = (ApplyParameterStringsToMessage(ParameterModuleName,
1729 TRUE,
1730 lpMsgBuf,
1731 &szMessage) == ERROR_SUCCESS);
1732 if (Success && szMessage)
1733 {
1734 /* Free the buffer allocated by FormatMessage */
1735 LocalFree(lpMsgBuf);
1736 lpMsgBuf = szMessage;
1737 }
1738
1739 /* Copy the event text */
1740 StringCchCopyW(EventText, EVENT_MESSAGE_EVENTTEXT_BUFFER, lpMsgBuf);
1741
1742 /* Free the buffer allocated by FormatMessage */
1743 LocalFree(lpMsgBuf);
1744 }
1745
1746 HeapFree(GetProcessHeap(), 0, szArguments);
1747
1748Quit:
1749 if (!Success)
1750 {
1751 /* Get a read-only pointer to the "event-not-found" string */
1754 StringCchPrintfW(EventText, EVENT_MESSAGE_EVENTTEXT_BUFFER, lpMsgBuf, (pevlr->EventID & 0xFFFF), SourceName);
1755
1756 /* Append the strings */
1757 szMessage = szStringArray;
1758 for (i = 0; i < pevlr->NumStrings; i++)
1759 {
1760 StringCchCatW(EventText, EVENT_MESSAGE_EVENTTEXT_BUFFER, szMessage);
1762 szMessage += wcslen(szMessage) + 1;
1763 }
1764 }
1765
1766 return Success;
1767}
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
BOOL GetEventMessageFileDLL(IN LPCWSTR lpLogName, IN LPCWSTR SourceName, IN LPCWSTR EntryName, OUT PWCHAR lpModuleName)
Definition: eventvwr.c:1528
#define EVENT_MESSAGE_EVENTTEXT_BUFFER
Definition: eventvwr.c:36
#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
#define EVENT_MESSAGE_FILE
Definition: eventvwr.c:40
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#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
_Must_inspect_result_ _In_ WDFDEVICE _In_ PCUNICODE_STRING KeyName
Definition: wdfdevice.h:2699
#define FORMAT_MESSAGE_MAX_WIDTH_MASK
Definition: winbase.h:425
#define MoveMemory
Definition: winbase.h:1667
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:419
#define FORMAT_MESSAGE_ARGUMENT_ARRAY
Definition: winbase.h:424
#define FORMAT_MESSAGE_FROM_HMODULE
Definition: winbase.h:422

Referenced by DisplayEvent().

◆ InitDetailsDlgCtrl()

static VOID InitDetailsDlgCtrl ( HWND  hDlg,
PDETAILDATA  pData 
)
static

Definition at line 733 of file evtdetctl.c.

734{
735 DWORD dwMask;
736
740
744
745 /* Set the default read-only RichEdit color */
747
748 /* Enable RichEdit coloured and underlined links */
751
752 /*
753 * Activate automatic URL recognition by the RichEdit control. For more information, see:
754 * https://blogs.msdn.microsoft.com/murrays/2009/08/31/automatic-richedit-hyperlinks/
755 * https://blogs.msdn.microsoft.com/murrays/2009/09/24/richedit-friendly-name-hyperlinks/
756 * https://msdn.microsoft.com/en-us/library/windows/desktop/bb787991(v=vs.85).aspx
757 */
758 SendDlgItemMessageW(hDlg, IDC_EVENTTEXTEDIT, EM_AUTOURLDETECT, AURL_ENABLEURL /* | AURL_ENABLEEAURLS */, 0);
759
760 /* Note that the RichEdit control never gets themed under WinXP+; one would have to write code to simulate Edit-control theming */
761
764}
#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)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define IMAGE_ICON
Definition: winuser.h:212
#define BM_SETCHECK
Definition: winuser.h:1911
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BM_SETIMAGE
Definition: winuser.h:1912
#define WM_SETFONT
Definition: winuser.h:1640
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
#define BST_CHECKED
Definition: winuser.h:197
#define COLOR_3DFACE
Definition: winuser.h:923

Referenced by EventDetailsCtrl().

◆ OnLink()

static VOID OnLink ( HWND  hDlg,
ENLINK penLink 
)
static

Definition at line 335 of file evtdetctl.c.

336{
337 LPWSTR pLink;
338 TEXTRANGE txtRange;
339
341
342 /* Only act on left button up events */
343 if (penLink->msg != WM_LBUTTONUP)
344 return;
345
346 /* If the range is empty, do nothing */
347 if (penLink->chrg.cpMin == penLink->chrg.cpMax)
348 return;
349
350 /* Allocate memory for the text link */
352 (max(penLink->chrg.cpMin, penLink->chrg.cpMax) -
353 min(penLink->chrg.cpMin, penLink->chrg.cpMax) + 1) * sizeof(WCHAR));
354 if (!pLink)
355 {
356 /* Not enough memory, bail out */
357 return;
358 }
359
360 txtRange.chrg = penLink->chrg;
361 txtRange.lpstrText = pLink;
363
364 /* Open the link */
365 ShellExecuteW(hDlg, L"open", pLink, NULL, NULL, SW_SHOWNOACTIVATE);
366
367 /* Free the buffer */
368 HeapFree(GetProcessHeap(), 0, pLink);
369}
#define ASSERT(a)
Definition: mode.c:44
#define min(a, b)
Definition: monoChain.cc:55
#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:2346
LONG cpMax
Definition: richedit.h:501
LONG cpMin
Definition: richedit.h:500
UINT_PTR idFrom
Definition: winuser.h:3148
#define max(a, b)
Definition: svc.c:63
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
#define WM_LBUTTONUP
Definition: winuser.h:1767

Referenced by EventDetailsCtrl().

◆ OnScroll()

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

Definition at line 373 of file evtdetctl.c.

374{
375 RECT rect;
376
377 SCROLLINFO sInfo;
378 INT oldPos, Maximum;
379 PLONG pOriginXY;
380
381 ASSERT(nBar == SB_HORZ || nBar == SB_VERT);
382
383 GetClientRect(hDlg, &rect);
384
385 if (nBar == SB_HORZ)
386 {
387 Maximum = pData->cxMin - (rect.right-rect.left) /* pData->cxOld */;
388 pOriginXY = &pData->scPos.x;
389 }
390 else // if (nBar == SB_VERT)
391 {
392 Maximum = pData->cyMin - (rect.bottom-rect.top) /* pData->cyOld */;
393 pOriginXY = &pData->scPos.y;
394 }
395
396 /* Set scrollbar sizes */
397 sInfo.cbSize = sizeof(sInfo);
399
400 if (!GetScrollInfo(hDlg, nBar, &sInfo))
401 return;
402
403 oldPos = sInfo.nPos;
404
405 switch (sbCode)
406 {
407 case SB_LINEUP: // SB_LINELEFT:
408 sInfo.nPos--;
409 break;
410
411 case SB_LINEDOWN: // SB_LINERIGHT:
412 sInfo.nPos++;
413 break;
414
415 case SB_PAGEUP: // SB_PAGELEFT:
416 sInfo.nPos -= sInfo.nPage;
417 break;
418
419 case SB_PAGEDOWN: // SB_PAGERIGHT:
420 sInfo.nPos += sInfo.nPage;
421 break;
422
423 case SB_THUMBTRACK:
424 sInfo.nPos = sInfo.nTrackPos;
425 break;
426
427 case SB_THUMBPOSITION:
428 sInfo.nPos = sInfo.nTrackPos;
429 break;
430
431 case SB_TOP: // SB_LEFT:
432 sInfo.nPos = sInfo.nMin;
433 break;
434
435 case SB_BOTTOM: // SB_RIGHT:
436 sInfo.nPos = sInfo.nMax;
437 break;
438
439 default:
440 break;
441 }
442
443 sInfo.nPos = min(max(sInfo.nPos, 0), Maximum);
444
445 if (oldPos != sInfo.nPos)
446 {
447 POINT scOldPos = pData->scPos;
448
449 /* We now modify pData->scPos */
450 *pOriginXY = sInfo.nPos;
451
452 ScrollWindowEx(hDlg,
453 (scOldPos.x - pData->scPos.x),
454 (scOldPos.y - pData->scPos.y),
455 NULL,
456 NULL,
457 NULL,
458 NULL,
460
461 sInfo.fMask = SIF_POS;
462 SetScrollInfo(hDlg, nBar, &sInfo, TRUE);
463
464 // UpdateWindow(hDlg);
465 }
466}
signed int * PLONG
Definition: retypes.h:5
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define SB_THUMBTRACK
Definition: winuser.h:573
#define SB_LINEUP
Definition: winuser.h:564
#define SW_SCROLLCHILDREN
Definition: winuser.h:2568
#define SIF_RANGE
Definition: winuser.h:1225
#define SB_BOTTOM
Definition: winuser.h:577
#define SW_INVALIDATE
Definition: winuser.h:2569
#define SIF_PAGE
Definition: winuser.h:1223
#define SIF_TRACKPOS
Definition: winuser.h:1227
#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:1224
#define SW_ERASE
Definition: winuser.h:2570
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 470 of file evtdetctl.c.

471{
472 LONG_PTR dwStyle;
473 INT sbVXSize, sbHYSize;
474 SCROLLINFO sInfo;
475 POINT scOldPos;
476 HDWP hdwp;
477 HWND hItemWnd;
478 RECT rect;
479 INT y = 0;
480
481 if (!pData)
482 return;
483
484 dwStyle = GetWindowLongPtrW(hDlg, GWL_STYLE);
485 sbVXSize = GetSystemMetrics(SM_CXVSCROLL);
486 sbHYSize = GetSystemMetrics(SM_CYHSCROLL);
487
488 /* Compensate for existing scroll bars (because lParam values do not accommodate scroll bar) */
489 if (dwStyle & WS_HSCROLL) cy += sbHYSize; // Window currently has a horizontal scrollbar
490 if (dwStyle & WS_VSCROLL) cx += sbVXSize; // Window currently has a vertical scrollbar
491
492 /* Compensate for added scroll bars in window */
493 if (cx < pData->cxMin) cy -= sbHYSize; // Window will have a horizontal scroll bar
494 if (cy < pData->cyMin) cx -= sbVXSize; // Window will have a vertical scroll bar
495
496 /* Set scrollbar sizes */
497 sInfo.cbSize = sizeof(sInfo);
498
499 sInfo.fMask = SIF_POS;
500 if (GetScrollInfo(hDlg, SB_VERT, &sInfo))
501 scOldPos.y = sInfo.nPos;
502 else
503 scOldPos.y = pData->scPos.y;
504
505 sInfo.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
506 sInfo.nMin = 0;
507 if (pData->cyMin > cy)
508 {
509 sInfo.nMax = pData->cyMin - 1;
510 sInfo.nPage = cy;
511 sInfo.nPos = pData->scPos.y;
512 SetScrollInfo(hDlg, SB_VERT, &sInfo, TRUE);
513
514 /* Display the scrollbar if needed */
515 if (!(dwStyle & WS_VSCROLL))
516 ShowScrollBar(hDlg, SB_VERT, TRUE);
517 }
518 else
519 {
520 scOldPos.y = 0;
521
522 sInfo.nMax = pData->cyMin - 1;
523 sInfo.nPage = cy;
524 sInfo.nPos = pData->scPos.y;
525 sInfo.nPos = scOldPos.y;
526 SetScrollInfo(hDlg, SB_VERT, &sInfo, TRUE);
527
529
530 rect.left = cx - sbVXSize;
531 rect.right = cx;
532 rect.top = 0;
533 rect.bottom = cy;
534 InvalidateRect(hDlg, &rect, TRUE);
535 }
536
537 sInfo.fMask = SIF_POS;
538 if (GetScrollInfo(hDlg, SB_HORZ, &sInfo))
539 scOldPos.x = sInfo.nPos;
540 else
541 scOldPos.x = pData->scPos.x;
542
543 sInfo.fMask = SIF_RANGE | SIF_PAGE | SIF_POS;
544 sInfo.nMin = 0;
545 if (pData->cxMin > cx)
546 {
547 sInfo.nMax = pData->cxMin - 1;
548 sInfo.nPage = cx;
549 sInfo.nPos = pData->scPos.x;
550 SetScrollInfo(hDlg, SB_HORZ, &sInfo, TRUE);
551
552 /* Display the scrollbar if needed */
553 if (!(dwStyle & WS_HSCROLL))
554 ShowScrollBar(hDlg, SB_HORZ, TRUE);
555 }
556 else
557 {
558 scOldPos.x = 0;
559
560 sInfo.nMax = pData->cxMin - 1;
561 sInfo.nPage = cx;
562 sInfo.nPos = pData->scPos.x;
563 sInfo.nPos = scOldPos.x;
564 SetScrollInfo(hDlg, SB_HORZ, &sInfo, TRUE);
565
567
568 rect.left = 0;
569 rect.right = cx;
570 rect.top = cy - sbHYSize;
571 rect.bottom = cy;
572 InvalidateRect(hDlg, &rect, TRUE);
573 }
574
575 if ((scOldPos.x != pData->scPos.x) || (scOldPos.y != pData->scPos.y))
576 {
577 ScrollWindowEx(hDlg,
578 // (scOldPos.x - pData->scPos.x),
579 (pData->scPos.x - scOldPos.x),
580 // (scOldPos.y - pData->scPos.y),
581 (pData->scPos.y - scOldPos.y),
582 NULL,
583 NULL,
584 NULL,
585 NULL,
587
588 pData->scPos = scOldPos;
589 }
590
591 // /* Adjust the start of the visible area if we are attempting to show nonexistent areas */
592 // if ((pData->cxMin - pData->scPos.x) < cx) pData->scPos.x = pData->cxMin - cx;
593 // if ((pData->cyMin - pData->scPos.y) < cy) pData->scPos.y = pData->cyMin - cy;
594 // // InvalidateRect(GuiData->hWindow, NULL, TRUE);
595
596 /* Forbid resizing the control smaller than its minimal size */
597 if (cx < pData->cxMin) cx = pData->cxMin;
598 if (cy < pData->cyMin) cy = pData->cyMin;
599
600 if ((cx != pData->cxOld) || (cy != pData->cyOld))
601 {
602 hdwp = BeginDeferWindowPos(8);
603
604 /* Move the edit boxes */
605
606 GetWindowRect(hDlg, &rect);
607
608 hItemWnd = GetDlgItem(hDlg, IDC_EVENTTEXTEDIT);
609 GetWindowRect(hItemWnd, &rect);
610 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
611 // OffsetRect(&rect, 0, y);
612 // y += (cy - pData->cyOld) / 2 ; // + (cy - pData->cyOld) % 2;
614 if (cy >= pData->cyOld)
615 y += (cy - pData->cyOld) / 2 + (cy - pData->cyOld) % 2;
616 else
617 y -= (pData->cyOld - cy) / 2 + (pData->cyOld - cy) % 2;
618
619 if (hdwp)
620 hdwp = DeferWindowPos(hdwp,
621 hItemWnd,
622 0,
623 rect.left, rect.top,
624 (rect.right - rect.left) + (cx - pData->cxOld),
625 (rect.bottom - rect.top) + y, SWP_NOZORDER | SWP_NOACTIVATE);
627
628 hItemWnd = GetDlgItem(hDlg, IDC_DETAILS_STATIC);
629 GetWindowRect(hItemWnd, &rect);
630 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
631 // OffsetRect(&rect, 0, y);
632
633 if (hdwp)
634 hdwp = DeferWindowPos(hdwp,
635 hItemWnd,
636 0,
637 rect.left, rect.top + y,
638 0, 0,
640
641 hItemWnd = GetDlgItem(hDlg, IDC_BYTESRADIO);
642 GetWindowRect(hItemWnd, &rect);
643 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
644 // OffsetRect(&rect, 0, y);
645
646 if (hdwp)
647 hdwp = DeferWindowPos(hdwp,
648 hItemWnd,
649 0,
650 rect.left, rect.top + y,
651 0, 0,
653
654 hItemWnd = GetDlgItem(hDlg, IDC_WORDRADIO);
655 GetWindowRect(hItemWnd, &rect);
656 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
657 // OffsetRect(&rect, 0, y);
658
659 if (hdwp)
660 hdwp = DeferWindowPos(hdwp,
661 hItemWnd,
662 0,
663 rect.left, rect.top + y,
664 0, 0,
666
667 hItemWnd = GetDlgItem(hDlg, IDC_EVENTDATAEDIT);
668 GetWindowRect(hItemWnd, &rect);
669 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
670 // OffsetRect(&rect, 0, y);
671 // // y -= (cy - pData->cyOld) % 2;
672
673 if (hdwp)
674 hdwp = DeferWindowPos(hdwp,
675 hItemWnd,
676 0,
677 rect.left, rect.top + y,
678 (rect.right - rect.left) + (cx - pData->cxOld),
679 (rect.bottom - rect.top) + y,
681
682 /* Move the buttons */
683
684 hItemWnd = GetDlgItem(hDlg, IDC_PREVIOUS);
685 GetWindowRect(hItemWnd, &rect);
686 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
687
688 if (hdwp)
689 hdwp = DeferWindowPos(hdwp,
690 hItemWnd,
691 0,
692 rect.left + (cx - pData->cxOld),
693 rect.top,
694 0, 0,
696
697 hItemWnd = GetDlgItem(hDlg, IDC_NEXT);
698 GetWindowRect(hItemWnd, &rect);
699 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
700
701 if (hdwp)
702 hdwp = DeferWindowPos(hdwp,
703 hItemWnd,
704 0,
705 rect.left + (cx - pData->cxOld),
706 rect.top,
707 0, 0,
709
710 hItemWnd = GetDlgItem(hDlg, IDC_COPY);
711 GetWindowRect(hItemWnd, &rect);
712 MapWindowPoints(HWND_DESKTOP /*NULL*/, hDlg, (LPPOINT)&rect, sizeof(RECT)/sizeof(POINT));
713
714 if (hdwp)
715 hdwp = DeferWindowPos(hdwp,
716 hItemWnd,
717 0,
718 rect.left + (cx - pData->cxOld),
719 rect.top,
720 0, 0,
722
723 if (hdwp)
724 EndDeferWindowPos(hdwp);
725
726 pData->cxOld = cx;
727 pData->cyOld = cy;
728 }
729}
#define IDC_DETAILS_STATIC
Definition: resource.h:51
static INT cxMin
Definition: eventvwr.c:4314
static INT cyMin
Definition: eventvwr.c:4314
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#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:1232
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SM_CXVSCROLL
Definition: winuser.h:955
#define SWP_NOSIZE
Definition: winuser.h:1235
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:956
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define HWND_DESKTOP
Definition: winuser.h:1199
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:1237
#define GWL_STYLE
Definition: winuser.h:846
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 99 of file evtdetctl.c.

100{
101 PWCHAR p = pBuffer;
102 UINT n, i, r = 0;
103
104 if (uOffset != 0)
105 {
106 n = swprintf(p, L"\r\n");
107 p += n;
108 r += n;
109 }
110
111 n = swprintf(p, L"%04lx:", uOffset);
112 p += n;
113 r += n;
114
115 for (i = 0; i < uLength; i++)
116 {
117 n = swprintf(p, L" %02x", pData[i]);
118 p += n;
119 r += n;
120 }
121
122 for (i = 0; i < 9 - uLength; i++)
123 {
124 n = swprintf(p, L" ");
125 p += n;
126 r += n;
127 }
128
129 for (i = 0; i < uLength; i++)
130 {
131 // NOTE: Normally iswprint should return FALSE for tabs...
132 n = swprintf(p, L"%c", (iswprint(pData[i]) && (pData[i] != L'\t')) ? pData[i] : L'.');
133 p += n;
134 r += n;
135 }
136
137 return r;
138}
#define swprintf
Definition: precomp.h:40
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble n
Definition: glext.h:7729
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 142 of file evtdetctl.c.

143{
144 PWCHAR p = pBuffer;
145 UINT n, i, r = 0;
146
147 if (uOffset != 0)
148 {
149 n = swprintf(p, L"\r\n");
150 p += n;
151 r += n;
152 }
153
154 n = swprintf(p, L"%04lx:", uOffset);
155 p += n;
156 r += n;
157
158 for (i = 0; i < uLength / sizeof(ULONG); i++)
159 {
160 n = swprintf(p, L" %08lx", pData[i]);
161 p += n;
162 r += n;
163 }
164
165 /* Display the remaining bytes if uLength was not a multiple of sizeof(ULONG) */
166 for (i = (uLength / sizeof(ULONG)) * sizeof(ULONG); i < uLength; i++)
167 {
168 n = swprintf(p, L" %02x", ((PBYTE)pData)[i]);
169 p += n;
170 r += n;
171 }
172
173 return r;
174}
BYTE * PBYTE
Definition: pedump.c:66

Referenced by DisplayEventData().

Variable Documentation

◆ hwndListView

◆ szTitle

WCHAR szTitle[]
extern

Definition at line 35 of file magnifier.c.

Referenced by EventDetailsCtrl().