Author: hbelusca Date: Tue Mar 3 21:03:21 2015 New Revision: 66558 URL: http://svn.reactos.org/svn/reactos?rev=66558&view=rev Log: [MAGNIFY]: Fix CID 512972 and CID 512973. [EVENTLOG]: Fix CID 515148, CID 515149 and CID 512988. By Ricardo Hanke. CORE-9314 CORE-9316 #resolve #comment Committed, thanks!
Modified: trunk/reactos/base/applications/magnify/settings.c trunk/reactos/base/services/eventlog/eventlog.c trunk/reactos/base/services/eventlog/eventsource.c Modified: trunk/reactos/base/applications/magnify/settings.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/magnify/settings.c?rev=66558&r1=66557&r2=66558&view=diff ============================================================================== --- trunk/reactos/base/applications/magnify/settings.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/magnify/settings.c [iso-8859-1] Tue Mar 3 21:03:21 2015 @@ -21,37 +21,37 @@ LONG value; ULONG len; - RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0, - _T(""), 0, KEY_READ, NULL, &hkey, NULL); + if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0, KEY_READ, &hkey) == ERROR_SUCCESS) + { + if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryMagLevel"), 0, 0, (BYTE *)&value, &len)) + { + if(value >= 0 && value <= 9) + iZoom = value; + } - if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryMagLevel"), 0, 0, (BYTE *)&value, &len)) - { - if(value >= 0 && value <= 9) - iZoom = value; - } + if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("ShowWarning"), 0, 0, (BYTE *)&value, &len)) + bShowWarning = (value == 0 ? FALSE : TRUE); - if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("ShowWarning"), 0, 0, (BYTE *)&value, &len)) - bShowWarning = (value == 0 ? FALSE : TRUE); + if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryInvertColors"), 0, 0, (BYTE *)&value, &len)) + bInvertColors = (value == 0 ? FALSE : TRUE); - if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryInvertColors"), 0, 0, (BYTE *)&value, &len)) - bInvertColors = (value == 0 ? FALSE : TRUE); + if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryStartMinimized"), 0, 0, (BYTE *)&value, &len)) + bStartMinimized = (value == 0 ? FALSE : TRUE); - if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryStartMinimized"), 0, 0, (BYTE *)&value, &len)) - bStartMinimized = (value == 0 ? FALSE : TRUE); + if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackCursor"), 0, 0, (BYTE *)&value, &len)) + bFollowMouse = (value == 0 ? FALSE : TRUE); - if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackCursor"), 0, 0, (BYTE *)&value, &len)) - bFollowMouse = (value == 0 ? FALSE : TRUE); + if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackFocus"), 0, 0, (BYTE *)&value, &len)) + bFollowFocus = (value == 0 ? FALSE : TRUE); - if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackFocus"), 0, 0, (BYTE *)&value, &len)) - bFollowFocus = (value == 0 ? FALSE : TRUE); + if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, 0, (BYTE *)&value, &len)) + bFollowFocus = (value == 0 ? FALSE : TRUE); - if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, 0, (BYTE *)&value, &len)) - bFollowFocus = (value == 0 ? FALSE : TRUE); + if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackText"), 0, 0, (BYTE *)&value, &len)) + bFollowCaret = (value == 0 ? FALSE : TRUE); - if(ERROR_SUCCESS == RegQueryValueEx(hkey, _T("StationaryTrackText"), 0, 0, (BYTE *)&value, &len)) - bFollowCaret = (value == 0 ? FALSE : TRUE); - - RegCloseKey(hkey); + RegCloseKey(hkey); + } } void SaveSettings() @@ -59,32 +59,32 @@ HKEY hkey; LONG value; - RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0, - _T(""), 0, KEY_WRITE, NULL, &hkey, NULL); + if (RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Magnify"), 0, _T(""), 0, KEY_WRITE, NULL, &hkey, NULL) == ERROR_SUCCESS) + { + value = iZoom; + RegSetValueEx(hkey, _T("StationaryMagLevel"), 0, REG_DWORD, (BYTE *)&value, sizeof value); - value = iZoom; - RegSetValueEx(hkey, _T("StationaryMagLevel"), 0, REG_DWORD, (BYTE *)&value, sizeof value); + value = bShowWarning; + RegSetValueEx(hkey, _T("ShowWarning"), 0, REG_DWORD, (BYTE *)&value, sizeof value); - value = bShowWarning; - RegSetValueEx(hkey, _T("ShowWarning"), 0, REG_DWORD, (BYTE *)&value, sizeof value); + value = bInvertColors; + RegSetValueEx(hkey, _T("StationaryInvertColors"), 0, REG_DWORD, (BYTE *)&value, sizeof value); - value = bInvertColors; - RegSetValueEx(hkey, _T("StationaryInvertColors"), 0, REG_DWORD, (BYTE *)&value, sizeof value); + value = bStartMinimized; + RegSetValueEx(hkey, _T("StationaryStartMinimized"), 0, REG_DWORD, (BYTE *)&value, sizeof value); - value = bStartMinimized; - RegSetValueEx(hkey, _T("StationaryStartMinimized"), 0, REG_DWORD, (BYTE *)&value, sizeof value); + value = bFollowMouse; + RegSetValueEx(hkey, _T("StationaryTrackCursor"), 0, REG_DWORD, (BYTE *)&value, sizeof value); - value = bFollowMouse; - RegSetValueEx(hkey, _T("StationaryTrackCursor"), 0, REG_DWORD, (BYTE *)&value, sizeof value); + value = bFollowFocus; + RegSetValueEx(hkey, _T("StationaryTrackFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof value); - value = bFollowFocus; - RegSetValueEx(hkey, _T("StationaryTrackFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof value); + value = bFollowFocus; + RegSetValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof value); - value = bFollowFocus; - RegSetValueEx(hkey, _T("StationaryTrackSecondaryFocus"), 0, REG_DWORD, (BYTE *)&value, sizeof value); + value = bFollowCaret; + RegSetValueEx(hkey, _T("StationaryTrackText"), 0, REG_DWORD, (BYTE *)&value, sizeof value); - value = bFollowCaret; - RegSetValueEx(hkey, _T("StationaryTrackText"), 0, REG_DWORD, (BYTE *)&value, sizeof value); - - RegCloseKey(hkey); + RegCloseKey(hkey); + } } Modified: trunk/reactos/base/services/eventlog/eventlog.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/eventlog.c?rev=66558&r1=66557&r2=66558&view=diff ============================================================================== --- trunk/reactos/base/services/eventlog/eventlog.c [iso-8859-1] (original) +++ trunk/reactos/base/services/eventlog/eventlog.c [iso-8859-1] Tue Mar 3 21:03:21 2015 @@ -280,8 +280,13 @@ DPRINT("LoadLogFile: %S\n", LogName); - RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, &MaxValueLen, NULL, NULL); + Result = RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, &MaxValueLen, NULL, NULL); + if (Result != ERROR_SUCCESS) + { + DPRINT1("RegQueryInfoKey failed: %lu\n", Result); + return NULL; + } Buf = HeapAlloc(MyHeap, 0, MaxValueLen); if (!Buf) @@ -300,7 +305,7 @@ &ValueLen); if (Result != ERROR_SUCCESS) { - DPRINT1("RegQueryValueEx failed: %lu\n", GetLastError()); + DPRINT1("RegQueryValueEx failed: %lu\n", Result); HeapFree(MyHeap, 0, Buf); return NULL; } @@ -367,16 +372,21 @@ BOOL LoadLogFiles(HKEY eventlogKey) { - LONG result; + LONG Result; DWORD MaxLognameLen, LognameLen; WCHAR *Buf = NULL; INT i; PLOGFILE pLogFile; - RegQueryInfoKey(eventlogKey, - NULL, NULL, NULL, NULL, - &MaxLognameLen, - NULL, NULL, NULL, NULL, NULL, NULL); + Result = RegQueryInfoKey(eventlogKey, + NULL, NULL, NULL, NULL, + &MaxLognameLen, + NULL, NULL, NULL, NULL, NULL, NULL); + if (Result != ERROR_SUCCESS) + { + DPRINT1("RegQueryInfoKey failed: %lu\n", Result); + return FALSE; + } MaxLognameLen++; @@ -401,8 +411,8 @@ DPRINT("%S\n", Buf); - result = RegOpenKeyEx(eventlogKey, Buf, 0, KEY_ALL_ACCESS, &SubKey); - if (result != ERROR_SUCCESS) + Result = RegOpenKeyEx(eventlogKey, Buf, 0, KEY_ALL_ACCESS, &SubKey); + if (Result != ERROR_SUCCESS) { DPRINT1("Failed to open %S key.\n", Buf); HeapFree(MyHeap, 0, Buf); @@ -433,7 +443,7 @@ { WCHAR LogPath[MAX_PATH]; INT RetCode = 0; - LONG result; + LONG Result; HKEY elogKey; LogfListInitialize(); @@ -457,13 +467,13 @@ } else { - result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, + Result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\EventLog", 0, KEY_ALL_ACCESS, &elogKey); - if (result != ERROR_SUCCESS) + if (Result != ERROR_SUCCESS) { DPRINT1("Fatal error: can't open eventlog registry key.\n"); RetCode = 1; Modified: trunk/reactos/base/services/eventlog/eventsource.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/eventlog/eventsource.c?rev=66558&r1=66557&r2=66558&view=diff ============================================================================== --- trunk/reactos/base/services/eventlog/eventsource.c [iso-8859-1] (original) +++ trunk/reactos/base/services/eventlog/eventsource.c [iso-8859-1] Tue Mar 3 21:03:21 2015 @@ -62,11 +62,17 @@ DWORD dwEventSourceNameLength; DWORD dwIndex; WCHAR *Buf = NULL; + LONG Result; DPRINT("LoadEventSources\n"); - RegQueryInfoKeyW(hKey, NULL, NULL, NULL, NULL, &dwMaxSubKeyLength, NULL, - NULL, NULL, NULL, NULL, NULL); + Result = RegQueryInfoKeyW(hKey, NULL, NULL, NULL, NULL, &dwMaxSubKeyLength, NULL, + NULL, NULL, NULL, NULL, NULL); + if (Result != ERROR_SUCCESS) + { + DPRINT1("RegQueryInfoKey failed: %lu\n", Result); + return FALSE; + } DPRINT("dwMaxSubKeyLength: %lu\n", dwMaxSubKeyLength);