Fix the indentation mess in "settings.c" as well

svn path=/trunk/; revision=31648
This commit is contained in:
Colin Finck 2008-01-07 17:22:05 +00:00
parent 65bd222a65
commit bd334b2185

View file

@ -62,6 +62,7 @@ GetComputerIdentifier(PWSTR Identifier,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
NULL, NULL,
NULL); NULL);
Status = NtOpenKey(&ProcessorsKey, Status = NtOpenKey(&ProcessorsKey,
KEY_QUERY_VALUE , KEY_QUERY_VALUE ,
&ObjectAttributes); &ObjectAttributes);
@ -80,6 +81,7 @@ GetComputerIdentifier(PWSTR Identifier,
Size, Size,
&Size); &Size);
NtClose(ProcessorsKey); NtClose(ProcessorsKey);
if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_OVERFLOW) if (!NT_SUCCESS(Status) && Status != STATUS_BUFFER_OVERFLOW)
{ {
DPRINT("NtQueryKey() failed (Status 0x%lx)\n", Status); DPRINT("NtQueryKey() failed (Status 0x%lx)\n", Status);
@ -105,13 +107,16 @@ GetComputerIdentifier(PWSTR Identifier,
/* Computer is multi-CPUs */ /* Computer is multi-CPUs */
ComputerIdentifier = L"PC MP"; ComputerIdentifier = L"PC MP";
} }
RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo); RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo);
/* Copy computer identifier to return buffer */ /* Copy computer identifier to return buffer */
SizeNeeded = (wcslen(ComputerIdentifier) + 1) * sizeof(WCHAR); SizeNeeded = (wcslen(ComputerIdentifier) + 1) * sizeof(WCHAR);
if (SizeNeeded > IdentifierLength) if (SizeNeeded > IdentifierLength)
return FALSE; return FALSE;
RtlCopyMemory(Identifier, ComputerIdentifier, SizeNeeded); RtlCopyMemory(Identifier, ComputerIdentifier, SizeNeeded);
return TRUE; return TRUE;
} }
@ -165,8 +170,7 @@ CreateComputerTypeList(HINF InfFile)
DPRINT("Computer key: %S\n", KeyName); DPRINT("Computer key: %S\n", KeyName);
wcscpy(ComputerKey, KeyName); wcscpy(ComputerKey, KeyName);
} }
} } while (SetupFindNextLine(&Context, &Context));
while (SetupFindNextLine(&Context, &Context));
List = CreateGenericList(); List = CreateGenericList();
if (List == NULL) if (List == NULL)
@ -200,8 +204,7 @@ CreateComputerTypeList(HINF InfFile)
sprintf(Buffer, "%S", KeyValue); sprintf(Buffer, "%S", KeyValue);
AppendGenericListEntry(List, Buffer, UserData, AppendGenericListEntry(List, Buffer, UserData,
_wcsicmp(KeyName, ComputerKey) ? FALSE : TRUE); _wcsicmp(KeyName, ComputerKey) ? FALSE : TRUE);
} } while (SetupFindNextLine(&Context, &Context));
while (SetupFindNextLine(&Context, &Context));
return List; return List;
} }
@ -235,6 +238,7 @@ GetDisplayIdentifier(PWSTR Identifier,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
NULL, NULL,
NULL); NULL);
Status = NtOpenKey(&BusKey, Status = NtOpenKey(&BusKey,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes); &ObjectAttributes);
@ -255,6 +259,7 @@ GetDisplayIdentifier(PWSTR Identifier,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
BusKey, BusKey,
NULL); NULL);
Status = NtOpenKey(&BusInstanceKey, Status = NtOpenKey(&BusInstanceKey,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes); &ObjectAttributes);
@ -273,12 +278,14 @@ GetDisplayIdentifier(PWSTR Identifier,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
BusInstanceKey, BusInstanceKey,
NULL); NULL);
Status = NtOpenKey(&ControllerKey, Status = NtOpenKey(&ControllerKey,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes); &ObjectAttributes);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
ControllerInstance = 0; ControllerInstance = 0;
while (TRUE) while (TRUE)
{ {
/* Open the pointer controller instance key */ /* Open the pointer controller instance key */
@ -290,6 +297,7 @@ GetDisplayIdentifier(PWSTR Identifier,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
ControllerKey, ControllerKey,
NULL); NULL);
Status = NtOpenKey(&ControllerInstanceKey, Status = NtOpenKey(&ControllerInstanceKey,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes); &ObjectAttributes);
@ -340,6 +348,7 @@ GetDisplayIdentifier(PWSTR Identifier,
RtlFreeHeap(RtlGetProcessHeap(), RtlFreeHeap(RtlGetProcessHeap(),
0, 0,
ValueInfo); ValueInfo);
NtClose(ControllerInstanceKey); NtClose(ControllerInstanceKey);
NtClose(ControllerKey); NtClose(ControllerKey);
NtClose(BusInstanceKey); NtClose(BusInstanceKey);
@ -415,9 +424,7 @@ CreateDisplayDriverList(HINF InfFile)
DPRINT("Display key: %S\n", KeyName); DPRINT("Display key: %S\n", KeyName);
wcscpy(DisplayKey, KeyName); wcscpy(DisplayKey, KeyName);
} }
} } while (SetupFindNextLine(&Context, &Context));
while (SetupFindNextLine(&Context, &Context));
List = CreateGenericList(); List = CreateGenericList();
if (List == NULL) if (List == NULL)
@ -460,8 +467,7 @@ CreateDisplayDriverList(HINF InfFile)
Buffer, Buffer,
UserData, UserData,
_wcsicmp(KeyName, DisplayKey) ? FALSE : TRUE); _wcsicmp(KeyName, DisplayKey) ? FALSE : TRUE);
} } while (SetupFindNextLine(&Context, &Context));
while (SetupFindNextLine(&Context, &Context));
#if 0 #if 0
AppendGenericListEntry(List, "Other display driver", NULL, TRUE); AppendGenericListEntry(List, "Other display driver", NULL, TRUE);
@ -503,7 +509,7 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
NTSTATUS Status; NTSTATUS Status;
WCHAR RegPath [255]; WCHAR RegPath [255];
PWCHAR Buffer; PWCHAR Buffer;
ULONG Width, Hight, Bpp; ULONG Width, Height, Bpp;
DPRINT("ProcessDisplayRegistry() called\n"); DPRINT("ProcessDisplayRegistry() called\n");
@ -552,6 +558,7 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
DPRINT("INF_GetDataField() failed\n"); DPRINT("INF_GetDataField() failed\n");
return FALSE; return FALSE;
} }
Width = wcstoul(Buffer, NULL, 10); Width = wcstoul(Buffer, NULL, 10);
Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE, Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
RegPath, RegPath,
@ -565,18 +572,18 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
return FALSE; return FALSE;
} }
if (!INF_GetDataField(&Context, 5, &Buffer)) if (!INF_GetDataField(&Context, 5, &Buffer))
{ {
DPRINT("INF_GetDataField() failed\n"); DPRINT("INF_GetDataField() failed\n");
return FALSE; return FALSE;
} }
Hight = wcstoul(Buffer, 0, 0);
Height = wcstoul(Buffer, 0, 0);
Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE, Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
RegPath, RegPath,
L"DefaultSettings.YResolution", L"DefaultSettings.YResolution",
REG_DWORD, REG_DWORD,
&Hight, &Height,
sizeof(ULONG)); sizeof(ULONG));
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
@ -589,6 +596,7 @@ ProcessDisplayRegistry(HINF InfFile, PGENERIC_LIST List)
DPRINT("INF_GetDataField() failed\n"); DPRINT("INF_GetDataField() failed\n");
return FALSE; return FALSE;
} }
Bpp = wcstoul(Buffer, 0, 0); Bpp = wcstoul(Buffer, 0, 0);
Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE, Status = RtlWriteRegistryValue(RTL_REGISTRY_ABSOLUTE,
RegPath, RegPath,
@ -649,8 +657,7 @@ CreateKeyboardDriverList(HINF InfFile)
sprintf(Buffer, "%S", KeyValue); sprintf(Buffer, "%S", KeyValue);
AppendGenericListEntry(List, Buffer, UserData, FALSE); AppendGenericListEntry(List, Buffer, UserData, FALSE);
} } while (SetupFindNextLine(&Context, &Context));
while (SetupFindNextLine(&Context, &Context));
return List; return List;
} }
@ -710,8 +717,7 @@ CreateLanguageList(HINF InfFile, WCHAR * DefaultLanguage)
Buffer, Buffer,
UserData, UserData,
_wcsicmp(KeyName, DefaultLanguage) ? FALSE : TRUE); _wcsicmp(KeyName, DefaultLanguage) ? FALSE : TRUE);
} } while (SetupFindNextLine(&Context, &Context));
while (SetupFindNextLine(&Context, &Context));
return List; return List;
} }
@ -758,6 +764,7 @@ CreateKeyboardLayoutList(HINF InfFile, WCHAR * DefaultKBLayout)
UserData = (WCHAR*) RtlAllocateHeap(ProcessHeap, UserData = (WCHAR*) RtlAllocateHeap(ProcessHeap,
0, 0,
(wcslen(KeyName) + 1) * sizeof(WCHAR)); (wcslen(KeyName) + 1) * sizeof(WCHAR));
if (UserData == NULL) if (UserData == NULL)
{ {
/* FIXME: Handle error! */ /* FIXME: Handle error! */
@ -770,8 +777,7 @@ CreateKeyboardLayoutList(HINF InfFile, WCHAR * DefaultKBLayout)
Buffer, Buffer,
UserData, UserData,
_wcsicmp(KeyName, DefaultKBLayout) ? FALSE : TRUE); _wcsicmp(KeyName, DefaultKBLayout) ? FALSE : TRUE);
} } while (SetupFindNextLine(&Context, &Context));
while (SetupFindNextLine(&Context, &Context));
return List; return List;
} }
@ -799,14 +805,17 @@ ProcessKeyboardLayoutRegistry(PGENERIC_LIST List)
/* Open the nls language key */ /* Open the nls language key */
RtlInitUnicodeString(&KeyName, RtlInitUnicodeString(&KeyName,
L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language"); L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language");
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
&KeyName, &KeyName,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
NULL, NULL,
NULL); NULL);
Status = NtOpenKey(&KeyHandle, Status = NtOpenKey(&KeyHandle,
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS(Status)) if (!NT_SUCCESS(Status))
{ {
DPRINT1("NtOpenKey() failed (Status %lx)\n", Status); DPRINT1("NtOpenKey() failed (Status %lx)\n", Status);
@ -816,7 +825,8 @@ ProcessKeyboardLayoutRegistry(PGENERIC_LIST List)
/* Set default language */ /* Set default language */
RtlInitUnicodeString(&ValueName, RtlInitUnicodeString(&ValueName,
L"Default"); L"Default");
Status = NtSetValueKey (KeyHandle,
Status = NtSetValueKey(KeyHandle,
&ValueName, &ValueName,
0, 0,
REG_SZ, REG_SZ,