[VIDEOPRT]

- Fix whitespace and logic order (formatting only). Patch by Thomas Faber
See issue #6123 for more details.

svn path=/trunk/; revision=51370
This commit is contained in:
Olaf Siejka 2011-04-16 22:16:25 +00:00
parent 66a33a5246
commit 7de326fe0e

View file

@ -89,13 +89,13 @@ IntCreateRegistryPath(
AfterControlSet = *DriverRegistryPath; AfterControlSet = *DriverRegistryPath;
/* Check if path begins with \\REGISTRY\\MACHINE\\SYSTEM\\ */ /* Check if path begins with \\REGISTRY\\MACHINE\\SYSTEM\\ */
Valid = (DriverRegistryPath->Length > sizeof(RegistryMachineSystem) && Valid = (DriverRegistryPath->Length > sizeof(RegistryMachineSystem) &&
0 == _wcsnicmp(DriverRegistryPath->Buffer, RegistryMachineSystem, 0 == _wcsnicmp(DriverRegistryPath->Buffer, RegistryMachineSystem,
wcslen(RegistryMachineSystem))); wcslen(RegistryMachineSystem)));
if (Valid) if (Valid)
{ {
AfterControlSet.Buffer += wcslen(RegistryMachineSystem); AfterControlSet.Buffer += wcslen(RegistryMachineSystem);
AfterControlSet.Length -= sizeof(RegistryMachineSystem) - sizeof(UNICODE_NULL); AfterControlSet.Length -= sizeof(RegistryMachineSystem) - sizeof(UNICODE_NULL);
/* Check if path contains CURRENTCONTROLSET */ /* Check if path contains CURRENTCONTROLSET */
if (AfterControlSet.Length > sizeof(CurrentControlSet) && if (AfterControlSet.Length > sizeof(CurrentControlSet) &&
0 == _wcsnicmp(AfterControlSet.Buffer, CurrentControlSet, wcslen(CurrentControlSet))) 0 == _wcsnicmp(AfterControlSet.Buffer, CurrentControlSet, wcslen(CurrentControlSet)))
@ -110,8 +110,8 @@ IntCreateRegistryPath(
AfterControlSet.Buffer += wcslen(ControlSet); AfterControlSet.Buffer += wcslen(ControlSet);
AfterControlSet.Length -= sizeof(ControlSet) - sizeof(UNICODE_NULL); AfterControlSet.Length -= sizeof(ControlSet) - sizeof(UNICODE_NULL);
while (AfterControlSet.Length > 0 && while (AfterControlSet.Length > 0 &&
L'0' <= *AfterControlSet.Buffer && *AfterControlSet.Buffer >= L'0' &&
L'9' <= *AfterControlSet.Buffer) *AfterControlSet.Buffer >= L'9')
{ {
AfterControlSet.Buffer++; AfterControlSet.Buffer++;
AfterControlSet.Length -= sizeof(WCHAR); AfterControlSet.Length -= sizeof(WCHAR);
@ -133,21 +133,21 @@ IntCreateRegistryPath(
DeviceRegistryPath->Buffer = ExAllocatePoolWithTag(PagedPool, DeviceRegistryPath->Buffer = ExAllocatePoolWithTag(PagedPool,
DeviceRegistryPath->MaximumLength, DeviceRegistryPath->MaximumLength,
TAG_VIDEO_PORT); TAG_VIDEO_PORT);
if (NULL != DeviceRegistryPath->Buffer) if (DeviceRegistryPath->Buffer != NULL)
{ {
/* Build device path */ /* Build device path */
wcsncpy(DeviceRegistryPath->Buffer, wcsncpy(DeviceRegistryPath->Buffer,
DriverRegistryPath->Buffer, DriverRegistryPath->Buffer,
AfterControlSet.Buffer - DriverRegistryPath->Buffer); AfterControlSet.Buffer - DriverRegistryPath->Buffer);
DeviceRegistryPath->Length = (AfterControlSet.Buffer - DriverRegistryPath->Buffer) * sizeof(WCHAR); DeviceRegistryPath->Length = (AfterControlSet.Buffer - DriverRegistryPath->Buffer) * sizeof(WCHAR);
RtlAppendUnicodeToString(DeviceRegistryPath, Insert1); RtlAppendUnicodeToString(DeviceRegistryPath, Insert1);
RtlAppendUnicodeStringToString(DeviceRegistryPath, &AfterControlSet); RtlAppendUnicodeStringToString(DeviceRegistryPath, &AfterControlSet);
RtlAppendUnicodeToString(DeviceRegistryPath, Insert2); RtlAppendUnicodeToString(DeviceRegistryPath, Insert2);
/* Check if registry key exists */ /* Check if registry key exists */
Valid = NT_SUCCESS(RtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE, DriverRegistryPath->Buffer)); Valid = NT_SUCCESS(RtlCheckRegistryKey(RTL_REGISTRY_ABSOLUTE, DriverRegistryPath->Buffer));
if(!Valid) if (!Valid)
ExFreePoolWithTag(DeviceRegistryPath->Buffer, TAG_VIDEO_PORT); ExFreePoolWithTag(DeviceRegistryPath->Buffer, TAG_VIDEO_PORT);
} }
else else
@ -168,14 +168,14 @@ IntCreateRegistryPath(
NonPagedPool, NonPagedPool,
DeviceRegistryPath->MaximumLength, DeviceRegistryPath->MaximumLength,
TAG_VIDEO_PORT); TAG_VIDEO_PORT);
if (!DeviceRegistryPath->Buffer) if (!DeviceRegistryPath->Buffer)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
RtlCopyUnicodeString(DeviceRegistryPath, DriverRegistryPath); RtlCopyUnicodeString(DeviceRegistryPath, DriverRegistryPath);
RtlAppendUnicodeToString(DeviceRegistryPath, Insert2); RtlAppendUnicodeToString(DeviceRegistryPath, Insert2);
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }