[USETUP] Formatting fixes only.

svn path=/branches/setup_improvements/; revision=75697
svn path=/branches/setup_improvements/; revision=75699
This commit is contained in:
Hermès Bélusca-Maïto 2017-08-28 13:50:40 +00:00
parent e2a92634e1
commit acd933faa0
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 136 additions and 117 deletions

View file

@ -100,7 +100,7 @@ FindMUIEntriesOfPage(
return Pages[muiIndex].MuiEntry; return Pages[muiIndex].MuiEntry;
muiIndex++; muiIndex++;
}while (Pages[muiIndex].MuiEntry != NULL); } while (Pages[muiIndex].MuiEntry != NULL);
return NULL; return NULL;
} }

View file

@ -70,113 +70,136 @@ IsAcpiComputer(VOID)
goto cleanup; goto cleanup;
} }
pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength); pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength);
if (!pDeviceInformation) if (!pDeviceInformation)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
Status = STATUS_NO_MEMORY; Status = STATUS_NO_MEMORY;
goto cleanup; goto cleanup;
} }
pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength); pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength);
if (!pValueInformation) if (!pValueInformation)
{ {
DPRINT("RtlAllocateHeap() failed\n"); DPRINT("RtlAllocateHeap() failed\n");
Status = STATUS_NO_MEMORY; Status = STATUS_NO_MEMORY;
goto cleanup; goto cleanup;
} }
while (TRUE) while (TRUE)
{ {
Status = NtEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize); Status = NtEnumerateKey(hDevicesKey,
if (Status == STATUS_NO_MORE_ENTRIES) IndexDevice,
break; KeyBasicInformation,
else if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL) pDeviceInformation,
{ DeviceInfoLength,
RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation); &RequiredSize);
DeviceInfoLength = RequiredSize; if (Status == STATUS_NO_MORE_ENTRIES)
pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength); break;
if (!pDeviceInformation) else if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
{ {
DPRINT("RtlAllocateHeap() failed\n"); RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation);
Status = STATUS_NO_MEMORY; 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; goto cleanup;
} }
Status = NtEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize); IndexDevice++;
}
if (!NT_SUCCESS(Status))
{
DPRINT("NtEnumerateKey() failed with status 0x%08lx\n", Status);
goto cleanup;
}
IndexDevice++;
/* Open device key */ /* Open device key */
DeviceName.Length = DeviceName.MaximumLength = pDeviceInformation->NameLength; DeviceName.Length = DeviceName.MaximumLength = pDeviceInformation->NameLength;
DeviceName.Buffer = pDeviceInformation->Name; DeviceName.Buffer = pDeviceInformation->Name;
InitializeObjectAttributes(&ObjectAttributes, &DeviceName, OBJ_CASE_INSENSITIVE, hDevicesKey, NULL); InitializeObjectAttributes(&ObjectAttributes,
Status = NtOpenKey( &DeviceName,
&hDeviceKey, OBJ_CASE_INSENSITIVE,
KEY_QUERY_VALUE, hDevicesKey,
&ObjectAttributes); NULL);
if (!NT_SUCCESS(Status)) Status = NtOpenKey(&hDeviceKey,
{ KEY_QUERY_VALUE,
DPRINT("NtOpenKey() failed with status 0x%08lx\n", Status); &ObjectAttributes);
goto cleanup; if (!NT_SUCCESS(Status))
} {
DPRINT("NtOpenKey() failed with status 0x%08lx\n", Status);
/* 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; 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; /* Read identifier */
ValueName.Buffer = (PWCHAR)pValueInformation->Data; Status = NtQueryValueKey(hDeviceKey,
if (ValueName.Length >= sizeof(WCHAR) && ValueName.Buffer[ValueName.Length / sizeof(WCHAR) - 1] == UNICODE_NULL) &IdentifierU,
ValueName.Length -= sizeof(WCHAR); KeyValuePartialInformation,
if (RtlCompareUnicodeString(&ValueName, &AcpiBiosIdentifier, FALSE) == 0) pValueInformation,
{ ValueInfoLength,
DPRINT("Found ACPI BIOS\n"); &RequiredSize);
ret = TRUE; if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL)
goto cleanup; {
} 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: nextdevice:
NtClose(hDeviceKey); NtClose(hDeviceKey);
hDeviceKey = NULL; hDeviceKey = NULL;
} }
cleanup: cleanup:
if (pDeviceInformation) if (pDeviceInformation)
RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation); RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation);
if (pValueInformation) if (pValueInformation)
RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation); RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation);
if (hDevicesKey) if (hDevicesKey)
NtClose(hDevicesKey); NtClose(hDevicesKey);
if (hDeviceKey) if (hDeviceKey)
NtClose(hDeviceKey); NtClose(hDeviceKey);
return ret; return ret;
} }
static static
@ -343,7 +366,7 @@ CreateComputerTypeList(
if (List == NULL) if (List == NULL)
return NULL; return NULL;
if (!SetupFindFirstLineW (InfFile, L"Computer", NULL, &Context)) if (!SetupFindFirstLineW(InfFile, L"Computer", NULL, &Context))
{ {
DestroyGenericList(List, FALSE); DestroyGenericList(List, FALSE);
return NULL; return NULL;
@ -423,8 +446,7 @@ GetDisplayIdentifier(
while (TRUE) while (TRUE)
{ {
swprintf(Buffer, L"%lu", BusInstance); swprintf(Buffer, L"%lu", BusInstance);
RtlInitUnicodeString(&KeyName, RtlInitUnicodeString(&KeyName, Buffer);
Buffer);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&KeyName, &KeyName,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
@ -442,8 +464,7 @@ GetDisplayIdentifier(
} }
/* Open the controller type key */ /* Open the controller type key */
RtlInitUnicodeString(&KeyName, RtlInitUnicodeString(&KeyName, L"DisplayController");
L"DisplayController");
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&KeyName, &KeyName,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
@ -461,8 +482,7 @@ GetDisplayIdentifier(
{ {
/* Open the pointer controller instance key */ /* Open the pointer controller instance key */
swprintf(Buffer, L"%lu", ControllerInstance); swprintf(Buffer, L"%lu", ControllerInstance);
RtlInitUnicodeString(&KeyName, RtlInitUnicodeString(&KeyName, Buffer);
Buffer);
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&KeyName, &KeyName,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
@ -482,8 +502,7 @@ GetDisplayIdentifier(
} }
/* Get controller identifier */ /* Get controller identifier */
RtlInitUnicodeString(&KeyName, RtlInitUnicodeString(&KeyName, L"Identifier");
L"Identifier");
BufferLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + BufferLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) +
256 * sizeof(WCHAR); 256 * sizeof(WCHAR);
@ -604,7 +623,7 @@ CreateDisplayDriverList(
if (List == NULL) if (List == NULL)
return NULL; return NULL;
if (!SetupFindFirstLineW (InfFile, L"Display", NULL, &Context)) if (!SetupFindFirstLineW(InfFile, L"Display", NULL, &Context))
{ {
DestroyGenericList(List, FALSE); DestroyGenericList(List, FALSE);
return NULL; return NULL;
@ -967,7 +986,7 @@ CreateKeyboardDriverList(
if (List == NULL) if (List == NULL)
return NULL; return NULL;
if (!SetupFindFirstLineW (InfFile, L"Keyboard", NULL, &Context)) if (!SetupFindFirstLineW(InfFile, L"Keyboard", NULL, &Context))
{ {
DestroyGenericList(List, FALSE); DestroyGenericList(List, FALSE);
return NULL; return NULL;
@ -975,7 +994,7 @@ CreateKeyboardDriverList(
do do
{ {
if (!INF_GetData (&Context, &KeyName, &KeyValue)) if (!INF_GetData(&Context, &KeyName, &KeyValue))
{ {
/* FIXME: Handle error! */ /* FIXME: Handle error! */
DPRINT("INF_GetData() failed\n"); DPRINT("INF_GetData() failed\n");
@ -1019,10 +1038,10 @@ CreateLanguageList(
ULONG uIndex = 0; ULONG uIndex = 0;
/* Get default language id */ /* Get default language id */
if (!SetupFindFirstLineW (InfFile, L"NLS", L"DefaultLanguage", &Context)) if (!SetupFindFirstLineW(InfFile, L"NLS", L"DefaultLanguage", &Context))
return NULL; return NULL;
if (!INF_GetData (&Context, NULL, &KeyValue)) if (!INF_GetData(&Context, NULL, &KeyValue))
return NULL; return NULL;
wcscpy(DefaultLanguage, KeyValue); wcscpy(DefaultLanguage, KeyValue);
@ -1033,7 +1052,7 @@ CreateLanguageList(
if (List == NULL) if (List == NULL)
return NULL; return NULL;
if (!SetupFindFirstLineW (InfFile, L"Language", NULL, &Context)) if (!SetupFindFirstLineW(InfFile, L"Language", NULL, &Context))
{ {
DestroyGenericList(List, FALSE); DestroyGenericList(List, FALSE);
return NULL; return NULL;
@ -1041,7 +1060,7 @@ CreateLanguageList(
do do
{ {
if (!INF_GetData (&Context, &KeyName, &KeyValue)) if (!INF_GetData(&Context, &KeyName, &KeyValue))
{ {
/* FIXME: Handle error! */ /* FIXME: Handle error! */
DPRINT("INF_GetData() failed\n"); DPRINT("INF_GetData() failed\n");
@ -1099,10 +1118,10 @@ CreateKeyboardLayoutList(
BOOL KeyboardLayoutsFound = FALSE; BOOL KeyboardLayoutsFound = FALSE;
/* Get default layout id */ /* Get default layout id */
if (!SetupFindFirstLineW (InfFile, L"NLS", L"DefaultLayout", &Context)) if (!SetupFindFirstLineW(InfFile, L"NLS", L"DefaultLayout", &Context))
return NULL; return NULL;
if (!INF_GetData (&Context, NULL, &KeyValue)) if (!INF_GetData(&Context, NULL, &KeyValue))
return NULL; return NULL;
wcscpy(DefaultKBLayout, KeyValue); wcscpy(DefaultKBLayout, KeyValue);
@ -1123,7 +1142,7 @@ CreateKeyboardLayoutList(
do do
{ {
if (!INF_GetData (&Context, &KeyName, &KeyValue)) if (!INF_GetData(&Context, &KeyName, &KeyValue))
{ {
/* FIXME: Handle error! */ /* FIXME: Handle error! */
DPRINT("INF_GetData() failed\n"); DPRINT("INF_GetData() failed\n");