[CONCFG]: Use 'Success' boolean variable instead of an obscure 'RetVal'.

svn path=/trunk/; revision=74367
This commit is contained in:
Hermès Bélusca-Maïto 2017-04-17 23:28:41 +00:00
parent 417e293fac
commit aac777cc7f

View file

@ -121,7 +121,7 @@ ConCfgOpenUserSettings(LPCWSTR ConsoleTitle,
REGSAM samDesired, REGSAM samDesired,
BOOLEAN Create) BOOLEAN Create)
{ {
BOOLEAN RetVal = TRUE; BOOLEAN Success = TRUE;
NTSTATUS Status; NTSTATUS Status;
WCHAR szBuffer[MAX_PATH] = L"Console\\"; WCHAR szBuffer[MAX_PATH] = L"Console\\";
WCHAR szBuffer2[MAX_PATH] = L""; WCHAR szBuffer2[MAX_PATH] = L"";
@ -164,35 +164,35 @@ ConCfgOpenUserSettings(LPCWSTR ConsoleTitle,
if (Create) if (Create)
{ {
/* Create the key */ /* Create the key */
RetVal = (RegCreateKeyExW(hKey, Success = (RegCreateKeyExW(hKey,
szBuffer, szBuffer,
0, NULL, 0, NULL,
REG_OPTION_NON_VOLATILE, REG_OPTION_NON_VOLATILE,
samDesired, samDesired,
NULL, NULL,
hSubKey, hSubKey,
NULL) == ERROR_SUCCESS); NULL) == ERROR_SUCCESS);
} }
else else
{ {
/* Open the key */ /* Open the key */
RetVal = (RegOpenKeyExW(hKey, Success = (RegOpenKeyExW(hKey,
szBuffer, szBuffer,
0, 0,
samDesired, samDesired,
hSubKey) == ERROR_SUCCESS); hSubKey) == ERROR_SUCCESS);
} }
/* Close the parent key and return success or not */ /* Close the parent key and return success or not */
NtClose(hKey); NtClose(hKey);
return RetVal; return Success;
} }
BOOLEAN BOOLEAN
ConCfgReadUserSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo, ConCfgReadUserSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo,
IN BOOLEAN DefaultSettings) IN BOOLEAN DefaultSettings)
{ {
BOOLEAN RetVal = FALSE; BOOLEAN Success = FALSE;
HKEY hKey; HKEY hKey;
DWORD dwNumSubKeys = 0; DWORD dwNumSubKeys = 0;
DWORD dwIndex; DWORD dwIndex;
@ -251,99 +251,99 @@ ConCfgReadUserSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo,
if (dwColorIndex < ARRAYSIZE(ConsoleInfo->ColorTable)) if (dwColorIndex < ARRAYSIZE(ConsoleInfo->ColorTable))
{ {
ConsoleInfo->ColorTable[dwColorIndex] = Value; ConsoleInfo->ColorTable[dwColorIndex] = Value;
RetVal = TRUE; Success = TRUE;
} }
} }
if (!wcscmp(szValueName, L"FaceName")) if (!wcscmp(szValueName, L"FaceName"))
{ {
wcsncpy(ConsoleInfo->FaceName, szValue, LF_FACESIZE); wcsncpy(ConsoleInfo->FaceName, szValue, LF_FACESIZE);
ConsoleInfo->FaceName[LF_FACESIZE - 1] = UNICODE_NULL; ConsoleInfo->FaceName[LF_FACESIZE - 1] = UNICODE_NULL;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"FontFamily")) else if (!wcscmp(szValueName, L"FontFamily"))
{ {
ConsoleInfo->FontFamily = Value; ConsoleInfo->FontFamily = Value;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"FontSize")) else if (!wcscmp(szValueName, L"FontSize"))
{ {
ConsoleInfo->FontSize.X = LOWORD(Value); // Width ConsoleInfo->FontSize.X = LOWORD(Value); // Width
ConsoleInfo->FontSize.Y = HIWORD(Value); // Height ConsoleInfo->FontSize.Y = HIWORD(Value); // Height
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"FontWeight")) else if (!wcscmp(szValueName, L"FontWeight"))
{ {
ConsoleInfo->FontWeight = Value; ConsoleInfo->FontWeight = Value;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"HistoryBufferSize")) else if (!wcscmp(szValueName, L"HistoryBufferSize"))
{ {
ConsoleInfo->HistoryBufferSize = Value; ConsoleInfo->HistoryBufferSize = Value;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"NumberOfHistoryBuffers")) else if (!wcscmp(szValueName, L"NumberOfHistoryBuffers"))
{ {
ConsoleInfo->NumberOfHistoryBuffers = Value; ConsoleInfo->NumberOfHistoryBuffers = Value;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"HistoryNoDup")) else if (!wcscmp(szValueName, L"HistoryNoDup"))
{ {
ConsoleInfo->HistoryNoDup = !!Value; ConsoleInfo->HistoryNoDup = !!Value;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"QuickEdit")) else if (!wcscmp(szValueName, L"QuickEdit"))
{ {
ConsoleInfo->QuickEdit = !!Value; ConsoleInfo->QuickEdit = !!Value;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"InsertMode")) else if (!wcscmp(szValueName, L"InsertMode"))
{ {
ConsoleInfo->InsertMode = !!Value; ConsoleInfo->InsertMode = !!Value;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"ScreenBufferSize")) else if (!wcscmp(szValueName, L"ScreenBufferSize"))
{ {
ConsoleInfo->ScreenBufferSize.X = LOWORD(Value); ConsoleInfo->ScreenBufferSize.X = LOWORD(Value);
ConsoleInfo->ScreenBufferSize.Y = HIWORD(Value); ConsoleInfo->ScreenBufferSize.Y = HIWORD(Value);
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"FullScreen")) else if (!wcscmp(szValueName, L"FullScreen"))
{ {
ConsoleInfo->FullScreen = Value; ConsoleInfo->FullScreen = Value;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"WindowPosition")) else if (!wcscmp(szValueName, L"WindowPosition"))
{ {
ConsoleInfo->AutoPosition = FALSE; ConsoleInfo->AutoPosition = FALSE;
ConsoleInfo->WindowPosition.x = LOWORD(Value); ConsoleInfo->WindowPosition.x = LOWORD(Value);
ConsoleInfo->WindowPosition.y = HIWORD(Value); ConsoleInfo->WindowPosition.y = HIWORD(Value);
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"WindowSize")) else if (!wcscmp(szValueName, L"WindowSize"))
{ {
ConsoleInfo->WindowSize.X = LOWORD(Value); ConsoleInfo->WindowSize.X = LOWORD(Value);
ConsoleInfo->WindowSize.Y = HIWORD(Value); ConsoleInfo->WindowSize.Y = HIWORD(Value);
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"CursorSize")) else if (!wcscmp(szValueName, L"CursorSize"))
{ {
ConsoleInfo->CursorSize = min(max(Value, 0), 100); ConsoleInfo->CursorSize = min(max(Value, 0), 100);
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"ScreenColors")) else if (!wcscmp(szValueName, L"ScreenColors"))
{ {
ConsoleInfo->ScreenAttributes = (USHORT)Value; ConsoleInfo->ScreenAttributes = (USHORT)Value;
RetVal = TRUE; Success = TRUE;
} }
else if (!wcscmp(szValueName, L"PopupColors")) else if (!wcscmp(szValueName, L"PopupColors"))
{ {
ConsoleInfo->PopupAttributes = (USHORT)Value; ConsoleInfo->PopupAttributes = (USHORT)Value;
RetVal = TRUE; Success = TRUE;
} }
} }
RegCloseKey(hKey); RegCloseKey(hKey);
return RetVal; return Success;
} }
BOOLEAN BOOLEAN