Skip to content

Commit 0c32666

Browse files
committed
[EVENTVWR] Code style only.
1 parent fd3a6c1 commit 0c32666

File tree

2 files changed

+102
-94
lines changed

2 files changed

+102
-94
lines changed

base/applications/mscutils/eventvwr/eventvwr.c

Lines changed: 101 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737

3838
#define LVM_PROGRESS (WM_APP + 1) // Used by the subclassed ListView
3939

40-
static const LPCWSTR szWindowClass = L"EVENTVWR"; /* The main window class name */
41-
static const WCHAR EVENTLOG_BASE_KEY[] = L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\";
40+
static const LPCWSTR EVENTVWR_WNDCLASS = L"EVENTVWR"; /* The main window class name */
41+
static const LPCWSTR EVENTLOG_BASE_KEY = L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\";
4242

4343
/* The 3 system logs that should always exist in the user's system */
4444
static const LPCWSTR SystemLogs[] =
@@ -442,6 +442,7 @@ wWinMain(HINSTANCE hInstance,
442442
}
443443
}
444444

445+
/* Stop the enumerator thread */
445446
SetEvent(hStartStopEnumEvent);
446447
WaitForSingleObject(hThread, INFINITE);
447448
CloseHandle(hThread);
@@ -1217,7 +1218,7 @@ GetEventMessageFileDLL(IN LPCWSTR lpLogName,
12171218
{
12181219
BOOL Success = FALSE;
12191220
LONG Result;
1220-
DWORD Type, dwSize;
1221+
DWORD dwType, dwSize;
12211222
WCHAR szModuleName[MAX_PATH];
12221223
WCHAR szKeyName[MAX_PATH];
12231224
HKEY hLogKey = NULL;
@@ -1249,10 +1250,10 @@ GetEventMessageFileDLL(IN LPCWSTR lpLogName,
12491250
Result = RegQueryValueExW(hSourceKey,
12501251
EntryName,
12511252
NULL,
1252-
&Type,
1253+
&dwType,
12531254
(LPBYTE)szModuleName,
12541255
&dwSize);
1255-
if ((Result != ERROR_SUCCESS) || (Type != REG_EXPAND_SZ && Type != REG_SZ))
1256+
if ((Result != ERROR_SUCCESS) || (dwType != REG_EXPAND_SZ && dwType != REG_SZ))
12561257
{
12571258
szModuleName[0] = UNICODE_NULL;
12581259
}
@@ -1829,7 +1830,7 @@ EnumEventsThread(IN LPVOID lpParameter)
18291830
}
18301831
else if (!bResult)
18311832
{
1832-
/* exit on other errors (ERROR_HANDLE_EOF) */
1833+
/* Exit on other errors (ERROR_HANDLE_EOF) */
18331834
break;
18341835
}
18351836

@@ -2378,7 +2379,7 @@ MyRegisterClass(HINSTANCE hInstance)
23782379
wcex.hCursor = LoadCursorW(NULL, MAKEINTRESOURCEW(IDC_ARROW));
23792380
wcex.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); // COLOR_WINDOW + 1
23802381
wcex.lpszMenuName = MAKEINTRESOURCEW(IDM_EVENTVWR);
2381-
wcex.lpszClassName = szWindowClass;
2382+
wcex.lpszClassName = EVENTVWR_WNDCLASS;
23822383
wcex.hIconSm = (HICON)LoadImageW(hInstance,
23832384
MAKEINTRESOURCEW(IDI_EVENTVWR),
23842385
IMAGE_ICON,
@@ -2400,7 +2401,7 @@ GetDisplayNameFileAndID(IN LPCWSTR lpLogName,
24002401
HKEY hLogKey;
24012402
WCHAR *KeyPath;
24022403
SIZE_T cbKeyPath;
2403-
DWORD Type, cbData;
2404+
DWORD dwType, cbData;
24042405
DWORD dwMessageID = 0;
24052406
WCHAR szModuleName[MAX_PATH];
24062407

@@ -2424,10 +2425,10 @@ GetDisplayNameFileAndID(IN LPCWSTR lpLogName,
24242425
Result = RegQueryValueExW(hLogKey,
24252426
L"DisplayNameFile",
24262427
NULL,
2427-
&Type,
2428+
&dwType,
24282429
(LPBYTE)szModuleName,
24292430
&cbData);
2430-
if ((Result != ERROR_SUCCESS) || (Type != REG_EXPAND_SZ && Type != REG_SZ))
2431+
if ((Result != ERROR_SUCCESS) || (dwType != REG_EXPAND_SZ && dwType != REG_SZ))
24312432
{
24322433
szModuleName[0] = UNICODE_NULL;
24332434
}
@@ -2449,10 +2450,10 @@ GetDisplayNameFileAndID(IN LPCWSTR lpLogName,
24492450
Result = RegQueryValueExW(hLogKey,
24502451
L"DisplayNameID",
24512452
NULL,
2452-
&Type,
2453+
&dwType,
24532454
(LPBYTE)&dwMessageID,
24542455
&cbData);
2455-
if ((Result != ERROR_SUCCESS) || (Type != REG_DWORD))
2456+
if ((Result != ERROR_SUCCESS) || (dwType != REG_DWORD))
24562457
dwMessageID = 0;
24572458

24582459
*pdwMessageID = dwMessageID;
@@ -2471,7 +2472,7 @@ BuildLogListAndFilterList(IN LPCWSTR lpComputerName)
24712472
HKEY hEventLogKey, hLogKey;
24722473
DWORD dwNumLogs = 0;
24732474
DWORD dwIndex, dwMaxKeyLength;
2474-
DWORD Type;
2475+
DWORD dwType;
24752476
PEVENTLOG EventLog;
24762477
PEVENTLOGFILTER EventLogFilter;
24772478
LPWSTR LogName = NULL;
@@ -2554,10 +2555,10 @@ BuildLogListAndFilterList(IN LPCWSTR lpComputerName)
25542555
Result = RegQueryValueExW(hLogKey,
25552556
L"File",
25562557
NULL,
2557-
&Type,
2558+
&dwType,
25582559
NULL,
25592560
&lpcName);
2560-
if ((Result != ERROR_SUCCESS) || (Type != REG_EXPAND_SZ && Type != REG_SZ))
2561+
if ((Result != ERROR_SUCCESS) || (dwType != REG_EXPAND_SZ && dwType != REG_SZ))
25612562
{
25622563
// Windows' EventLog uses some kind of default value, we do not.
25632564
EventLog->FileName = NULL;
@@ -2571,7 +2572,7 @@ BuildLogListAndFilterList(IN LPCWSTR lpComputerName)
25712572
Result = RegQueryValueExW(hLogKey,
25722573
L"File",
25732574
NULL,
2574-
&Type,
2575+
&dwType,
25752576
(LPBYTE)EventLog->FileName,
25762577
&lpcName);
25772578
if (Result != ERROR_SUCCESS)
@@ -2698,7 +2699,7 @@ InitInstance(HINSTANCE hInstance,
26982699
WCHAR szTemp[256];
26992700

27002701
/* Create the main window */
2701-
hwndMainWindow = CreateWindowW(szWindowClass,
2702+
hwndMainWindow = CreateWindowW(EVENTVWR_WNDCLASS,
27022703
szTitle,
27032704
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
27042705
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
@@ -2731,7 +2732,7 @@ InitInstance(HINSTANCE hInstance,
27312732
NULL, // no text
27322733
WS_CHILD | PBS_SMOOTH, // styles
27332734
rs.left, rs.top, // x, y
2734-
rs.right-rs.left, rs.bottom-rs.top, // cx, cy
2735+
rs.right - rs.left, rs.bottom - rs.top, // cx, cy
27352736
hwndStatus, // parent window
27362737
NULL, // window ID
27372738
hInstance, // instance
@@ -3053,7 +3054,7 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
30533054
{
30543055
LPWSTR pszText = item.pszText;
30553056

3056-
/* Trim all whitespace */
3057+
/* Trim leading whitespace */
30573058
while (*pszText && iswspace(*pszText))
30583059
++pszText;
30593060

@@ -3234,41 +3235,44 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
32343235
}
32353236

32363237
case WM_SETCURSOR:
3237-
if (LOWORD(lParam) == HTCLIENT)
3238-
{
3239-
POINT pt;
3240-
GetCursorPos(&pt);
3241-
ScreenToClient(hWnd, &pt);
3238+
{
3239+
POINT pt;
3240+
3241+
if (LOWORD(lParam) != HTCLIENT)
3242+
goto Default;
32423243

3243-
/* Set the cursor for the vertical splitter */
3244-
if (pt.x >= nVSplitPos - SPLIT_WIDTH/2 && pt.x < nVSplitPos + SPLIT_WIDTH/2 + 1)
3244+
GetCursorPos(&pt);
3245+
ScreenToClient(hWnd, &pt);
3246+
3247+
/* Set the cursor for the vertical splitter */
3248+
if (pt.x >= nVSplitPos - SPLIT_WIDTH/2 && pt.x < nVSplitPos + SPLIT_WIDTH/2 + 1)
3249+
{
3250+
RECT rs;
3251+
GetClientRect(hWnd, &rect);
3252+
GetWindowRect(hwndStatus, &rs);
3253+
if (pt.y >= rect.top && pt.y < rect.bottom - (rs.bottom - rs.top))
32453254
{
3246-
RECT rs;
3247-
GetClientRect(hWnd, &rect);
3248-
GetWindowRect(hwndStatus, &rs);
3249-
if (pt.y >= rect.top && pt.y < rect.bottom - (rs.bottom - rs.top))
3250-
{
3251-
SetCursor(LoadCursorW(NULL, IDC_SIZEWE));
3252-
return TRUE;
3253-
}
3255+
SetCursor(LoadCursorW(NULL, IDC_SIZEWE));
3256+
return TRUE;
32543257
}
3255-
else
3256-
/* Set the cursor for the horizontal splitter, if the Event details pane is displayed */
3257-
if (hwndEventDetails &&
3258-
(pt.y >= nHSplitPos - SPLIT_WIDTH/2 && pt.y < nHSplitPos + SPLIT_WIDTH/2 + 1))
3258+
}
3259+
else
3260+
/* Set the cursor for the horizontal splitter, if the Event details pane is displayed */
3261+
if (hwndEventDetails &&
3262+
(pt.y >= nHSplitPos - SPLIT_WIDTH/2 && pt.y < nHSplitPos + SPLIT_WIDTH/2 + 1))
3263+
{
3264+
// RECT rs;
3265+
GetClientRect(hWnd, &rect);
3266+
// GetWindowRect(hwndStatus, &rs);
3267+
if (pt.x >= nVSplitPos + SPLIT_WIDTH/2 + 1 /* rect.left + (rs.bottom - rs.top) */ &&
3268+
pt.x < rect.right)
32593269
{
3260-
// RECT rs;
3261-
GetClientRect(hWnd, &rect);
3262-
// GetWindowRect(hwndStatus, &rs);
3263-
if (pt.x >= nVSplitPos + SPLIT_WIDTH/2 + 1 /* rect.left + (rs.bottom - rs.top) */ &&
3264-
pt.x < rect.right)
3265-
{
3266-
SetCursor(LoadCursorW(NULL, IDC_SIZENS));
3267-
return TRUE;
3268-
}
3270+
SetCursor(LoadCursorW(NULL, IDC_SIZENS));
3271+
return TRUE;
32693272
}
32703273
}
32713274
goto Default;
3275+
}
32723276

32733277
case WM_LBUTTONDOWN:
32743278
{
@@ -3297,62 +3301,66 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
32973301

32983302
case WM_LBUTTONUP:
32993303
case WM_RBUTTONDOWN:
3300-
if (GetCapture() == hWnd)
3301-
{
3302-
/* Adjust the correct splitter position */
3303-
if (bSplit == 1)
3304-
nVSplitPos = GET_X_LPARAM(lParam);
3305-
else if (bSplit == 2)
3306-
nHSplitPos = GET_Y_LPARAM(lParam);
3307-
3308-
/* If we are splitting, resize the windows */
3309-
if (bSplit != 0)
3310-
{
3311-
GetClientRect(hWnd, &rect);
3312-
ResizeWnd(rect.right - rect.left, rect.bottom - rect.top);
3313-
}
3304+
{
3305+
if (GetCapture() != hWnd)
3306+
break;
33143307

3315-
/* Reset the splitter state */
3316-
bSplit = 0;
3308+
/* Adjust the correct splitter position */
3309+
if (bSplit == 1)
3310+
nVSplitPos = GET_X_LPARAM(lParam);
3311+
else if (bSplit == 2)
3312+
nHSplitPos = GET_Y_LPARAM(lParam);
33173313

3318-
ReleaseCapture();
3314+
/* If we are splitting, resize the windows */
3315+
if (bSplit != 0)
3316+
{
3317+
GetClientRect(hWnd, &rect);
3318+
ResizeWnd(rect.right - rect.left, rect.bottom - rect.top);
33193319
}
3320+
3321+
/* Reset the splitter state */
3322+
bSplit = 0;
3323+
3324+
ReleaseCapture();
33203325
break;
3326+
}
33213327

33223328
case WM_MOUSEMOVE:
3323-
if (GetCapture() == hWnd)
3329+
{
3330+
if (GetCapture() != hWnd)
3331+
break;
3332+
3333+
/* Move the correct splitter */
3334+
if (bSplit == 1)
33243335
{
3325-
/* Move the correct splitter */
3326-
if (bSplit == 1)
3327-
{
3328-
INT x = GET_X_LPARAM(lParam);
3336+
INT x = GET_X_LPARAM(lParam);
33293337

3330-
GetClientRect(hWnd, &rect);
3338+
GetClientRect(hWnd, &rect);
33313339

3332-
x = min(max(x, SPLIT_WIDTH/2), rect.right - rect.left - SPLIT_WIDTH/2);
3333-
if (nVSplitPos != x)
3334-
{
3335-
nVSplitPos = x;
3336-
ResizeWnd(rect.right - rect.left, rect.bottom - rect.top);
3337-
}
3338-
}
3339-
else if (bSplit == 2)
3340+
x = min(max(x, SPLIT_WIDTH/2), rect.right - rect.left - SPLIT_WIDTH/2);
3341+
if (nVSplitPos != x)
33403342
{
3341-
RECT rs;
3342-
INT y = GET_Y_LPARAM(lParam);
3343+
nVSplitPos = x;
3344+
ResizeWnd(rect.right - rect.left, rect.bottom - rect.top);
3345+
}
3346+
}
3347+
else if (bSplit == 2)
3348+
{
3349+
RECT rs;
3350+
INT y = GET_Y_LPARAM(lParam);
33433351

3344-
GetClientRect(hWnd, &rect);
3345-
GetWindowRect(hwndStatus, &rs);
3352+
GetClientRect(hWnd, &rect);
3353+
GetWindowRect(hwndStatus, &rs);
33463354

3347-
y = min(max(y, SPLIT_WIDTH/2), rect.bottom - rect.top - SPLIT_WIDTH/2 - (rs.bottom - rs.top));
3348-
if (nHSplitPos != y)
3349-
{
3350-
nHSplitPos = y;
3351-
ResizeWnd(rect.right - rect.left, rect.bottom - rect.top);
3352-
}
3355+
y = min(max(y, SPLIT_WIDTH/2), rect.bottom - rect.top - SPLIT_WIDTH/2 - (rs.bottom - rs.top));
3356+
if (nHSplitPos != y)
3357+
{
3358+
nHSplitPos = y;
3359+
ResizeWnd(rect.right - rect.left, rect.bottom - rect.top);
33533360
}
33543361
}
33553362
break;
3363+
}
33563364

33573365
case WM_SIZE:
33583366
{
@@ -3379,7 +3387,7 @@ InitPropertiesDlg(HWND hDlg, PEVENTLOG EventLog)
33793387
{
33803388
LPWSTR lpLogName = EventLog->LogName;
33813389

3382-
DWORD Result, Type;
3390+
DWORD Result, dwType;
33833391
DWORD dwMaxSize = 0, dwRetention = 0;
33843392
BOOL Success;
33853393
WIN32_FIND_DATAW FileInfo; // WIN32_FILE_ATTRIBUTE_DATA
@@ -3418,10 +3426,10 @@ InitPropertiesDlg(HWND hDlg, PEVENTLOG EventLog)
34183426
Result = RegQueryValueExW(hLogKey,
34193427
L"MaxSize",
34203428
NULL,
3421-
&Type,
3429+
&dwType,
34223430
(LPBYTE)&dwMaxSize,
34233431
&cbData);
3424-
if ((Result != ERROR_SUCCESS) || (Type != REG_DWORD))
3432+
if ((Result != ERROR_SUCCESS) || (dwType != REG_DWORD))
34253433
{
34263434
// dwMaxSize = 512 * 1024; /* 512 kBytes */
34273435
dwMaxSize = 0;
@@ -3433,10 +3441,10 @@ InitPropertiesDlg(HWND hDlg, PEVENTLOG EventLog)
34333441
Result = RegQueryValueExW(hLogKey,
34343442
L"Retention",
34353443
NULL,
3436-
&Type,
3444+
&dwType,
34373445
(LPBYTE)&dwRetention,
34383446
&cbData);
3439-
if ((Result != ERROR_SUCCESS) || (Type != REG_DWORD))
3447+
if ((Result != ERROR_SUCCESS) || (dwType != REG_DWORD))
34403448
{
34413449
/* On Windows 2003 it is 604800 (secs) == 7 days */
34423450
dwRetention = 0;

base/applications/mscutils/eventvwr/evtdetctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ InitDetailsDlgCtrl(HWND hDlg, PDETAILDATA pData)
730730
*/
731731
SendDlgItemMessageW(hDlg, IDC_EVENTTEXTEDIT, EM_AUTOURLDETECT, AURL_ENABLEURL /* | AURL_ENABLEEAURLS */, 0);
732732

733-
/* Note that the RichEdit control never gets themed under WinXP+. One would have to write code to simulate Edit-control theming */
733+
/* Note that the RichEdit control never gets themed under WinXP+; one would have to write code to simulate Edit-control theming */
734734

735735
SendDlgItemMessageW(hDlg, pData->bDisplayWords ? IDC_WORDRADIO : IDC_BYTESRADIO, BM_SETCHECK, BST_CHECKED, 0);
736736
SendDlgItemMessageW(hDlg, IDC_EVENTDATAEDIT, WM_SETFONT, (WPARAM)pData->hMonospaceFont, (LPARAM)TRUE);

0 commit comments

Comments
 (0)