Author: hbelusca Date: Mon Aug 28 13:50:40 2017 New Revision: 75697
URL: http://svn.reactos.org/svn/reactos?rev=75697&view=rev Log: [USETUP]: Formatting fixes only.
Modified: branches/setup_improvements/base/setup/usetup/settings.c
Modified: branches/setup_improvements/base/setup/usetup/settings.c URL: http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/us... ============================================================================== --- branches/setup_improvements/base/setup/usetup/settings.c [iso-8859-1] (original) +++ branches/setup_improvements/base/setup/usetup/settings.c [iso-8859-1] Mon Aug 28 13:50:40 2017 @@ -71,113 +71,136 @@ goto cleanup; }
- pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength); - if (!pDeviceInformation) - { - DPRINT("RtlAllocateHeap() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } - - pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength); - if (!pValueInformation) - { - DPRINT("RtlAllocateHeap() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } - - while (TRUE) - { - Status = NtEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize); - if (Status == STATUS_NO_MORE_ENTRIES) - break; - else if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL) - { - RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation); - DeviceInfoLength = RequiredSize; - pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength); - if (!pDeviceInformation) - { - DPRINT("RtlAllocateHeap() failed\n"); - Status = STATUS_NO_MEMORY; + pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength); + if (!pDeviceInformation) + { + DPRINT("RtlAllocateHeap() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + + pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength); + if (!pValueInformation) + { + DPRINT("RtlAllocateHeap() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + + while (TRUE) + { + Status = NtEnumerateKey(hDevicesKey, + IndexDevice, + KeyBasicInformation, + pDeviceInformation, + DeviceInfoLength, + &RequiredSize); + if (Status == STATUS_NO_MORE_ENTRIES) + break; + else if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation); + DeviceInfoLength = RequiredSize; + pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength); + if (!pDeviceInformation) + { + DPRINT("RtlAllocateHeap() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + Status = NtEnumerateKey(hDevicesKey, + IndexDevice, + KeyBasicInformation, + pDeviceInformation, + DeviceInfoLength, + &RequiredSize); + } + if (!NT_SUCCESS(Status)) + { + DPRINT("NtEnumerateKey() failed with status 0x%08lx\n", Status); goto cleanup; - } - Status = NtEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize); - } - if (!NT_SUCCESS(Status)) - { - DPRINT("NtEnumerateKey() failed with status 0x%08lx\n", Status); - goto cleanup; - } - IndexDevice++; - - /* Open device key */ - DeviceName.Length = DeviceName.MaximumLength = pDeviceInformation->NameLength; - DeviceName.Buffer = pDeviceInformation->Name; - InitializeObjectAttributes(&ObjectAttributes, &DeviceName, OBJ_CASE_INSENSITIVE, hDevicesKey, NULL); - Status = NtOpenKey( - &hDeviceKey, - KEY_QUERY_VALUE, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - DPRINT("NtOpenKey() failed with status 0x%08lx\n", Status); - goto cleanup; - } - - /* Read identifier */ - Status = NtQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize); - if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL) - { - RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation); - ValueInfoLength = RequiredSize; - pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength); - if (!pValueInformation) - { - DPRINT("RtlAllocateHeap() failed\n"); - Status = STATUS_NO_MEMORY; + } + IndexDevice++; + + /* Open device key */ + DeviceName.Length = DeviceName.MaximumLength = pDeviceInformation->NameLength; + DeviceName.Buffer = pDeviceInformation->Name; + InitializeObjectAttributes(&ObjectAttributes, + &DeviceName, + OBJ_CASE_INSENSITIVE, + hDevicesKey, + NULL); + Status = NtOpenKey(&hDeviceKey, + KEY_QUERY_VALUE, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT("NtOpenKey() failed with status 0x%08lx\n", Status); goto cleanup; - } - Status = NtQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize); - } - if (!NT_SUCCESS(Status)) - { - DPRINT("NtQueryValueKey() failed with status 0x%08lx\n", Status); - goto nextdevice; - } - else if (pValueInformation->Type != REG_SZ) - { - DPRINT("Wrong registry type: got 0x%lx, expected 0x%lx\n", pValueInformation->Type, REG_SZ); - goto nextdevice; - } - - ValueName.Length = ValueName.MaximumLength = pValueInformation->DataLength; - ValueName.Buffer = (PWCHAR)pValueInformation->Data; - if (ValueName.Length >= sizeof(WCHAR) && ValueName.Buffer[ValueName.Length / sizeof(WCHAR) - 1] == UNICODE_NULL) - ValueName.Length -= sizeof(WCHAR); - if (RtlCompareUnicodeString(&ValueName, &AcpiBiosIdentifier, FALSE) == 0) - { - DPRINT("Found ACPI BIOS\n"); - ret = TRUE; - goto cleanup; - } + } + + /* Read identifier */ + Status = NtQueryValueKey(hDeviceKey, + &IdentifierU, + KeyValuePartialInformation, + pValueInformation, + ValueInfoLength, + &RequiredSize); + if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation); + ValueInfoLength = RequiredSize; + pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength); + if (!pValueInformation) + { + DPRINT("RtlAllocateHeap() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + Status = NtQueryValueKey(hDeviceKey, + &IdentifierU, + KeyValuePartialInformation, + pValueInformation, + ValueInfoLength, + &RequiredSize); + } + if (!NT_SUCCESS(Status)) + { + DPRINT("NtQueryValueKey() failed with status 0x%08lx\n", Status); + goto nextdevice; + } + else if (pValueInformation->Type != REG_SZ) + { + DPRINT("Wrong registry type: got 0x%lx, expected 0x%lx\n", pValueInformation->Type, REG_SZ); + goto nextdevice; + } + + ValueName.Length = ValueName.MaximumLength = pValueInformation->DataLength; + ValueName.Buffer = (PWCHAR)pValueInformation->Data; + if (ValueName.Length >= sizeof(WCHAR) && ValueName.Buffer[ValueName.Length / sizeof(WCHAR) - 1] == UNICODE_NULL) + ValueName.Length -= sizeof(WCHAR); + if (RtlEqualUnicodeString(&ValueName, &AcpiBiosIdentifier, FALSE)) + { + DPRINT("Found ACPI BIOS\n"); + ret = TRUE; + goto cleanup; + }
nextdevice: - NtClose(hDeviceKey); - hDeviceKey = NULL; - } + NtClose(hDeviceKey); + hDeviceKey = NULL; + }
cleanup: - if (pDeviceInformation) - RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation); - if (pValueInformation) - RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation); - if (hDevicesKey) - NtClose(hDevicesKey); - if (hDeviceKey) - NtClose(hDeviceKey); - return ret; + if (pDeviceInformation) + RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation); + if (pValueInformation) + RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation); + if (hDevicesKey) + NtClose(hDevicesKey); + if (hDeviceKey) + NtClose(hDeviceKey); + return ret; }
static @@ -344,7 +367,7 @@ if (List == NULL) return NULL;
- if (!SetupFindFirstLineW (InfFile, L"Computer", NULL, &Context)) + if (!SetupFindFirstLineW(InfFile, L"Computer", NULL, &Context)) { DestroyGenericList(List, FALSE); return NULL; @@ -424,8 +447,7 @@ while (TRUE) { swprintf(Buffer, L"%lu", BusInstance); - RtlInitUnicodeString(&KeyName, - Buffer); + RtlInitUnicodeString(&KeyName, Buffer); InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, @@ -443,8 +465,7 @@ }
/* Open the controller type key */ - RtlInitUnicodeString(&KeyName, - L"DisplayController"); + RtlInitUnicodeString(&KeyName, L"DisplayController"); InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, @@ -462,8 +483,7 @@ { /* Open the pointer controller instance key */ swprintf(Buffer, L"%lu", ControllerInstance); - RtlInitUnicodeString(&KeyName, - Buffer); + RtlInitUnicodeString(&KeyName, Buffer); InitializeObjectAttributes(&ObjectAttributes, &KeyName, OBJ_CASE_INSENSITIVE, @@ -483,8 +503,7 @@ }
/* Get controller identifier */ - RtlInitUnicodeString(&KeyName, - L"Identifier"); + RtlInitUnicodeString(&KeyName, L"Identifier");
BufferLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 256 * sizeof(WCHAR); @@ -605,7 +624,7 @@ if (List == NULL) return NULL;
- if (!SetupFindFirstLineW (InfFile, L"Display", NULL, &Context)) + if (!SetupFindFirstLineW(InfFile, L"Display", NULL, &Context)) { DestroyGenericList(List, FALSE); return NULL; @@ -968,7 +987,7 @@ if (List == NULL) return NULL;
- if (!SetupFindFirstLineW (InfFile, L"Keyboard", NULL, &Context)) + if (!SetupFindFirstLineW(InfFile, L"Keyboard", NULL, &Context)) { DestroyGenericList(List, FALSE); return NULL; @@ -976,7 +995,7 @@
do { - if (!INF_GetData (&Context, &KeyName, &KeyValue)) + if (!INF_GetData(&Context, &KeyName, &KeyValue)) { /* FIXME: Handle error! */ DPRINT("INF_GetData() failed\n"); @@ -1020,10 +1039,10 @@ ULONG uIndex = 0;
/* Get default language id */ - if (!SetupFindFirstLineW (InfFile, L"NLS", L"DefaultLanguage", &Context)) - return NULL; - - if (!INF_GetData (&Context, NULL, &KeyValue)) + if (!SetupFindFirstLineW(InfFile, L"NLS", L"DefaultLanguage", &Context)) + return NULL; + + if (!INF_GetData(&Context, NULL, &KeyValue)) return NULL;
wcscpy(DefaultLanguage, KeyValue); @@ -1034,7 +1053,7 @@ if (List == NULL) return NULL;
- if (!SetupFindFirstLineW (InfFile, L"Language", NULL, &Context)) + if (!SetupFindFirstLineW(InfFile, L"Language", NULL, &Context)) { DestroyGenericList(List, FALSE); return NULL; @@ -1042,7 +1061,7 @@
do { - if (!INF_GetData (&Context, &KeyName, &KeyValue)) + if (!INF_GetData(&Context, &KeyName, &KeyValue)) { /* FIXME: Handle error! */ DPRINT("INF_GetData() failed\n"); @@ -1100,10 +1119,10 @@ BOOL KeyboardLayoutsFound = FALSE;
/* Get default layout id */ - if (!SetupFindFirstLineW (InfFile, L"NLS", L"DefaultLayout", &Context)) - return NULL; - - if (!INF_GetData (&Context, NULL, &KeyValue)) + if (!SetupFindFirstLineW(InfFile, L"NLS", L"DefaultLayout", &Context)) + return NULL; + + if (!INF_GetData(&Context, NULL, &KeyValue)) return NULL;
wcscpy(DefaultKBLayout, KeyValue); @@ -1124,7 +1143,7 @@
do { - if (!INF_GetData (&Context, &KeyName, &KeyValue)) + if (!INF_GetData(&Context, &KeyName, &KeyValue)) { /* FIXME: Handle error! */ DPRINT("INF_GetData() failed\n");