Author: hbelusca
Date: Sun Jun 26 19:36:38 2016
New Revision: 71678

URL: http://svn.reactos.org/svn/reactos?rev=71678&view=rev
Log:
[EVENTVWR]
- No need to pop up an error box if we cannot find an event message resource 
DLL for the current event log.
- Flatten out GetEventMessageFileDLL a bit.
- Fix a comment.

Modified:
    trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c

Modified: trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c?rev=71678&r1=71677&r2=71678&view=diff
==============================================================================
--- trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c        
[iso-8859-1] (original)
+++ trunk/reactos/base/applications/mscutils/eventvwr/eventvwr.c        
[iso-8859-1] Sun Jun 26 19:36:38 2016
@@ -226,40 +226,36 @@
                       szKeyName,
                       0,
                       KEY_READ,
-                      &hAppKey) == ERROR_SUCCESS)
-    {
-        if (RegOpenKeyExW(hAppKey,
-                          SourceName,
-                          0,
-                          KEY_READ,
-                          &hSourceKey) == ERROR_SUCCESS)
-        {
-            dwSize = sizeof(szModuleName);
-            if (RegQueryValueExW(hSourceKey,
-                                 EntryName,
-                                 NULL,
-                                 NULL,
-                                 (LPBYTE)szModuleName,
-                                 &dwSize) == ERROR_SUCCESS)
-            {
-                /* Returns a string containing the requested substituted 
environment variable */
-                ExpandEnvironmentStringsW(szModuleName, ExpandedName, 
MAX_PATH);
-
-                /* Successful */
-                bReturn = TRUE;
-            }
-        }
-    }
-    else
-    {
-        ShowLastWin32Error();
-    }
-
-    if (hSourceKey != NULL)
+                      &hAppKey) != ERROR_SUCCESS)
+    {
+        return FALSE;
+    }
+
+    if (RegOpenKeyExW(hAppKey,
+                      SourceName,
+                      0,
+                      KEY_READ,
+                      &hSourceKey) == ERROR_SUCCESS)
+    {
+        dwSize = sizeof(szModuleName);
+        if (RegQueryValueExW(hSourceKey,
+                             EntryName,
+                             NULL,
+                             NULL,
+                             (LPBYTE)szModuleName,
+                             &dwSize) == ERROR_SUCCESS)
+        {
+            /* Returns a string containing the requested substituted 
environment variable */
+            ExpandEnvironmentStringsW(szModuleName, ExpandedName, MAX_PATH);
+
+            /* Successful */
+            bReturn = TRUE;
+        }
+
         RegCloseKey(hSourceKey);
-
-    if (hAppKey != NULL)
-        RegCloseKey(hAppKey);
+    }
+
+    RegCloseKey(hAppKey);
 
     return bReturn;
 }
@@ -677,14 +673,13 @@
             /* Get the computer name */
             lpszComputerName = (LPWSTR)((LPBYTE)pevlr + sizeof(EVENTLOGRECORD) 
+ (wcslen(lpszSourceName) + 1) * sizeof(WCHAR));
 
-            /* Compute the event type */
+            /* Compute the event time */
             EventTimeToSystemTime(pevlr->TimeWritten, &time);
+            GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, 
szLocalDate, ARRAYSIZE(szLocalDate));
+            GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &time, NULL, szLocalTime, 
ARRAYSIZE(szLocalTime));
 
             /* Get the username that generated the event */
             GetEventUserName(pevlr, szUsername);
-
-            GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &time, NULL, 
szLocalDate, ARRAYSIZE(szLocalDate));
-            GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &time, NULL, szLocalTime, 
ARRAYSIZE(szLocalTime));
 
             GetEventType(pevlr->EventType, szEventTypeText);
             GetEventCategory(lpLogName, lpszSourceName, pevlr, szCategory);


Reply via email to