37
37
38
38
#define LVM_PROGRESS (WM_APP + 1) // Used by the subclassed ListView
39
39
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\\" ;
42
42
43
43
/* The 3 system logs that should always exist in the user's system */
44
44
static const LPCWSTR SystemLogs [] =
@@ -442,6 +442,7 @@ wWinMain(HINSTANCE hInstance,
442
442
}
443
443
}
444
444
445
+ /* Stop the enumerator thread */
445
446
SetEvent (hStartStopEnumEvent );
446
447
WaitForSingleObject (hThread , INFINITE );
447
448
CloseHandle (hThread );
@@ -1217,7 +1218,7 @@ GetEventMessageFileDLL(IN LPCWSTR lpLogName,
1217
1218
{
1218
1219
BOOL Success = FALSE;
1219
1220
LONG Result ;
1220
- DWORD Type , dwSize ;
1221
+ DWORD dwType , dwSize ;
1221
1222
WCHAR szModuleName [MAX_PATH ];
1222
1223
WCHAR szKeyName [MAX_PATH ];
1223
1224
HKEY hLogKey = NULL ;
@@ -1249,10 +1250,10 @@ GetEventMessageFileDLL(IN LPCWSTR lpLogName,
1249
1250
Result = RegQueryValueExW (hSourceKey ,
1250
1251
EntryName ,
1251
1252
NULL ,
1252
- & Type ,
1253
+ & dwType ,
1253
1254
(LPBYTE )szModuleName ,
1254
1255
& 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 ))
1256
1257
{
1257
1258
szModuleName [0 ] = UNICODE_NULL ;
1258
1259
}
@@ -1829,7 +1830,7 @@ EnumEventsThread(IN LPVOID lpParameter)
1829
1830
}
1830
1831
else if (!bResult )
1831
1832
{
1832
- /* exit on other errors (ERROR_HANDLE_EOF) */
1833
+ /* Exit on other errors (ERROR_HANDLE_EOF) */
1833
1834
break ;
1834
1835
}
1835
1836
@@ -2378,7 +2379,7 @@ MyRegisterClass(HINSTANCE hInstance)
2378
2379
wcex .hCursor = LoadCursorW (NULL , MAKEINTRESOURCEW (IDC_ARROW ));
2379
2380
wcex .hbrBackground = (HBRUSH )(COLOR_3DFACE + 1 ); // COLOR_WINDOW + 1
2380
2381
wcex .lpszMenuName = MAKEINTRESOURCEW (IDM_EVENTVWR );
2381
- wcex .lpszClassName = szWindowClass ;
2382
+ wcex .lpszClassName = EVENTVWR_WNDCLASS ;
2382
2383
wcex .hIconSm = (HICON )LoadImageW (hInstance ,
2383
2384
MAKEINTRESOURCEW (IDI_EVENTVWR ),
2384
2385
IMAGE_ICON ,
@@ -2400,7 +2401,7 @@ GetDisplayNameFileAndID(IN LPCWSTR lpLogName,
2400
2401
HKEY hLogKey ;
2401
2402
WCHAR * KeyPath ;
2402
2403
SIZE_T cbKeyPath ;
2403
- DWORD Type , cbData ;
2404
+ DWORD dwType , cbData ;
2404
2405
DWORD dwMessageID = 0 ;
2405
2406
WCHAR szModuleName [MAX_PATH ];
2406
2407
@@ -2424,10 +2425,10 @@ GetDisplayNameFileAndID(IN LPCWSTR lpLogName,
2424
2425
Result = RegQueryValueExW (hLogKey ,
2425
2426
L"DisplayNameFile" ,
2426
2427
NULL ,
2427
- & Type ,
2428
+ & dwType ,
2428
2429
(LPBYTE )szModuleName ,
2429
2430
& 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 ))
2431
2432
{
2432
2433
szModuleName [0 ] = UNICODE_NULL ;
2433
2434
}
@@ -2449,10 +2450,10 @@ GetDisplayNameFileAndID(IN LPCWSTR lpLogName,
2449
2450
Result = RegQueryValueExW (hLogKey ,
2450
2451
L"DisplayNameID" ,
2451
2452
NULL ,
2452
- & Type ,
2453
+ & dwType ,
2453
2454
(LPBYTE )& dwMessageID ,
2454
2455
& cbData );
2455
- if ((Result != ERROR_SUCCESS ) || (Type != REG_DWORD ))
2456
+ if ((Result != ERROR_SUCCESS ) || (dwType != REG_DWORD ))
2456
2457
dwMessageID = 0 ;
2457
2458
2458
2459
* pdwMessageID = dwMessageID ;
@@ -2471,7 +2472,7 @@ BuildLogListAndFilterList(IN LPCWSTR lpComputerName)
2471
2472
HKEY hEventLogKey , hLogKey ;
2472
2473
DWORD dwNumLogs = 0 ;
2473
2474
DWORD dwIndex , dwMaxKeyLength ;
2474
- DWORD Type ;
2475
+ DWORD dwType ;
2475
2476
PEVENTLOG EventLog ;
2476
2477
PEVENTLOGFILTER EventLogFilter ;
2477
2478
LPWSTR LogName = NULL ;
@@ -2554,10 +2555,10 @@ BuildLogListAndFilterList(IN LPCWSTR lpComputerName)
2554
2555
Result = RegQueryValueExW (hLogKey ,
2555
2556
L"File" ,
2556
2557
NULL ,
2557
- & Type ,
2558
+ & dwType ,
2558
2559
NULL ,
2559
2560
& 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 ))
2561
2562
{
2562
2563
// Windows' EventLog uses some kind of default value, we do not.
2563
2564
EventLog -> FileName = NULL ;
@@ -2571,7 +2572,7 @@ BuildLogListAndFilterList(IN LPCWSTR lpComputerName)
2571
2572
Result = RegQueryValueExW (hLogKey ,
2572
2573
L"File" ,
2573
2574
NULL ,
2574
- & Type ,
2575
+ & dwType ,
2575
2576
(LPBYTE )EventLog -> FileName ,
2576
2577
& lpcName );
2577
2578
if (Result != ERROR_SUCCESS )
@@ -2698,7 +2699,7 @@ InitInstance(HINSTANCE hInstance,
2698
2699
WCHAR szTemp [256 ];
2699
2700
2700
2701
/* Create the main window */
2701
- hwndMainWindow = CreateWindowW (szWindowClass ,
2702
+ hwndMainWindow = CreateWindowW (EVENTVWR_WNDCLASS ,
2702
2703
szTitle ,
2703
2704
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN ,
2704
2705
CW_USEDEFAULT , 0 , CW_USEDEFAULT , 0 ,
@@ -2731,7 +2732,7 @@ InitInstance(HINSTANCE hInstance,
2731
2732
NULL , // no text
2732
2733
WS_CHILD | PBS_SMOOTH , // styles
2733
2734
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
2735
2736
hwndStatus , // parent window
2736
2737
NULL , // window ID
2737
2738
hInstance , // instance
@@ -3053,7 +3054,7 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
3053
3054
{
3054
3055
LPWSTR pszText = item .pszText ;
3055
3056
3056
- /* Trim all whitespace */
3057
+ /* Trim leading whitespace */
3057
3058
while (* pszText && iswspace (* pszText ))
3058
3059
++ pszText ;
3059
3060
@@ -3234,41 +3235,44 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
3234
3235
}
3235
3236
3236
3237
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 ;
3242
3243
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 ))
3245
3254
{
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;
3254
3257
}
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 )
3259
3269
{
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;
3269
3272
}
3270
3273
}
3271
3274
goto Default ;
3275
+ }
3272
3276
3273
3277
case WM_LBUTTONDOWN :
3274
3278
{
@@ -3297,62 +3301,66 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
3297
3301
3298
3302
case WM_LBUTTONUP :
3299
3303
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 ;
3314
3307
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 );
3317
3313
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 );
3319
3319
}
3320
+
3321
+ /* Reset the splitter state */
3322
+ bSplit = 0 ;
3323
+
3324
+ ReleaseCapture ();
3320
3325
break ;
3326
+ }
3321
3327
3322
3328
case WM_MOUSEMOVE :
3323
- if (GetCapture () == hWnd )
3329
+ {
3330
+ if (GetCapture () != hWnd )
3331
+ break ;
3332
+
3333
+ /* Move the correct splitter */
3334
+ if (bSplit == 1 )
3324
3335
{
3325
- /* Move the correct splitter */
3326
- if (bSplit == 1 )
3327
- {
3328
- INT x = GET_X_LPARAM (lParam );
3336
+ INT x = GET_X_LPARAM (lParam );
3329
3337
3330
- GetClientRect (hWnd , & rect );
3338
+ GetClientRect (hWnd , & rect );
3331
3339
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 )
3340
3342
{
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 );
3343
3351
3344
- GetClientRect (hWnd , & rect );
3345
- GetWindowRect (hwndStatus , & rs );
3352
+ GetClientRect (hWnd , & rect );
3353
+ GetWindowRect (hwndStatus , & rs );
3346
3354
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 );
3353
3360
}
3354
3361
}
3355
3362
break ;
3363
+ }
3356
3364
3357
3365
case WM_SIZE :
3358
3366
{
@@ -3379,7 +3387,7 @@ InitPropertiesDlg(HWND hDlg, PEVENTLOG EventLog)
3379
3387
{
3380
3388
LPWSTR lpLogName = EventLog -> LogName ;
3381
3389
3382
- DWORD Result , Type ;
3390
+ DWORD Result , dwType ;
3383
3391
DWORD dwMaxSize = 0 , dwRetention = 0 ;
3384
3392
BOOL Success ;
3385
3393
WIN32_FIND_DATAW FileInfo ; // WIN32_FILE_ATTRIBUTE_DATA
@@ -3418,10 +3426,10 @@ InitPropertiesDlg(HWND hDlg, PEVENTLOG EventLog)
3418
3426
Result = RegQueryValueExW (hLogKey ,
3419
3427
L"MaxSize" ,
3420
3428
NULL ,
3421
- & Type ,
3429
+ & dwType ,
3422
3430
(LPBYTE )& dwMaxSize ,
3423
3431
& cbData );
3424
- if ((Result != ERROR_SUCCESS ) || (Type != REG_DWORD ))
3432
+ if ((Result != ERROR_SUCCESS ) || (dwType != REG_DWORD ))
3425
3433
{
3426
3434
// dwMaxSize = 512 * 1024; /* 512 kBytes */
3427
3435
dwMaxSize = 0 ;
@@ -3433,10 +3441,10 @@ InitPropertiesDlg(HWND hDlg, PEVENTLOG EventLog)
3433
3441
Result = RegQueryValueExW (hLogKey ,
3434
3442
L"Retention" ,
3435
3443
NULL ,
3436
- & Type ,
3444
+ & dwType ,
3437
3445
(LPBYTE )& dwRetention ,
3438
3446
& cbData );
3439
- if ((Result != ERROR_SUCCESS ) || (Type != REG_DWORD ))
3447
+ if ((Result != ERROR_SUCCESS ) || (dwType != REG_DWORD ))
3440
3448
{
3441
3449
/* On Windows 2003 it is 604800 (secs) == 7 days */
3442
3450
dwRetention = 0 ;
0 commit comments