[KERNEL32]: Whitespace fixes only, no functional code changes.

svn path=/trunk/; revision=71687
This commit is contained in:
Hermès Bélusca-Maïto 2016-06-27 22:36:12 +00:00
parent def1d69426
commit 5113536603

View file

@ -92,7 +92,7 @@ DefineDosDeviceW(
DEV_BROADCAST_VOLUME dbcv; DEV_BROADCAST_VOLUME dbcv;
BOOL Result = TRUE; BOOL Result = TRUE;
DWORD dwRecipients; DWORD dwRecipients;
typedef long (WINAPI *BSM_type)(DWORD,LPDWORD,UINT,WPARAM,LPARAM); typedef long (WINAPI *BSM_type)(DWORD, LPDWORD, UINT, WPARAM, LPARAM);
BSM_type BSM_ptr; BSM_type BSM_ptr;
if ( (dwFlags & 0xFFFFFFF0) || if ( (dwFlags & 0xFFFFFFF0) ||
@ -250,31 +250,26 @@ QueryDosDeviceA(
if (lpDeviceName) if (lpDeviceName)
{ {
if (!RtlCreateUnicodeStringFromAsciiz (&DeviceNameU, if (!RtlCreateUnicodeStringFromAsciiz(&DeviceNameU,
(LPSTR)lpDeviceName)) (LPSTR)lpDeviceName))
{ {
SetLastError (ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return 0; return 0;
} }
} }
Buffer = RtlAllocateHeap (RtlGetProcessHeap (), Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, ucchMax * sizeof(WCHAR));
0,
ucchMax * sizeof(WCHAR));
if (Buffer == NULL) if (Buffer == NULL)
{ {
if (lpDeviceName) if (lpDeviceName)
{ {
RtlFreeHeap (RtlGetProcessHeap (), RtlFreeHeap(RtlGetProcessHeap(), 0, DeviceNameU.Buffer);
0,
DeviceNameU.Buffer);
} }
SetLastError (ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return 0; return 0;
} }
Length = QueryDosDeviceW (lpDeviceName ? DeviceNameU.Buffer : NULL, Length = QueryDosDeviceW(lpDeviceName ? DeviceNameU.Buffer : NULL,
Buffer, Buffer, ucchMax);
ucchMax);
if (Length != 0) if (Length != 0)
{ {
TargetPathA.Buffer = lpTargetPath; TargetPathA.Buffer = lpTargetPath;
@ -283,29 +278,23 @@ QueryDosDeviceA(
while (ucchMax) while (ucchMax)
{ {
CurrentLength = min (ucchMax, MAXUSHORT / 2); CurrentLength = min(ucchMax, MAXUSHORT / 2);
TargetPathU.MaximumLength = TargetPathU.Length = (USHORT)CurrentLength * sizeof(WCHAR); TargetPathU.MaximumLength = TargetPathU.Length = (USHORT)CurrentLength * sizeof(WCHAR);
TargetPathA.Length = 0; TargetPathA.Length = 0;
TargetPathA.MaximumLength = (USHORT)CurrentLength; TargetPathA.MaximumLength = (USHORT)CurrentLength;
RtlUnicodeStringToAnsiString (&TargetPathA, RtlUnicodeStringToAnsiString(&TargetPathA, &TargetPathU, FALSE);
&TargetPathU,
FALSE);
ucchMax -= CurrentLength; ucchMax -= CurrentLength;
TargetPathA.Buffer += TargetPathA.Length; TargetPathA.Buffer += TargetPathA.Length;
TargetPathU.Buffer += TargetPathU.Length / sizeof(WCHAR); TargetPathU.Buffer += TargetPathU.Length / sizeof(WCHAR);
} }
} }
RtlFreeHeap (RtlGetProcessHeap (), RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer);
0,
Buffer);
if (lpDeviceName) if (lpDeviceName)
{ {
RtlFreeHeap (RtlGetProcessHeap (), RtlFreeHeap(RtlGetProcessHeap(), 0, DeviceNameU.Buffer);
0,
DeviceNameU.Buffer);
} }
return Length; return Length;
} }
@ -337,20 +326,19 @@ QueryDosDeviceW(
PWSTR Ptr; PWSTR Ptr;
/* Open the '\??' directory */ /* Open the '\??' directory */
RtlInitUnicodeString (&UnicodeString, RtlInitUnicodeString(&UnicodeString, L"\\??");
L"\\??"); InitializeObjectAttributes(&ObjectAttributes,
InitializeObjectAttributes (&ObjectAttributes,
&UnicodeString, &UnicodeString,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
NULL, NULL,
NULL); NULL);
Status = NtOpenDirectoryObject (&DirectoryHandle, Status = NtOpenDirectoryObject(&DirectoryHandle,
DIRECTORY_QUERY, DIRECTORY_QUERY,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
WARN ("NtOpenDirectoryObject() failed (Status %lx)\n", Status); WARN("NtOpenDirectoryObject() failed (Status %lx)\n", Status);
BaseSetLastNTError (Status); BaseSetLastNTError(Status);
return 0; return 0;
} }
@ -359,21 +347,20 @@ QueryDosDeviceW(
if (lpDeviceName != NULL) if (lpDeviceName != NULL)
{ {
/* Open the lpDeviceName link object */ /* Open the lpDeviceName link object */
RtlInitUnicodeString (&UnicodeString, RtlInitUnicodeString(&UnicodeString, (PWSTR)lpDeviceName);
(PWSTR)lpDeviceName); InitializeObjectAttributes(&ObjectAttributes,
InitializeObjectAttributes (&ObjectAttributes,
&UnicodeString, &UnicodeString,
OBJ_CASE_INSENSITIVE, OBJ_CASE_INSENSITIVE,
DirectoryHandle, DirectoryHandle,
NULL); NULL);
Status = NtOpenSymbolicLinkObject (&DeviceHandle, Status = NtOpenSymbolicLinkObject(&DeviceHandle,
SYMBOLIC_LINK_QUERY, SYMBOLIC_LINK_QUERY,
&ObjectAttributes); &ObjectAttributes);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
WARN ("NtOpenSymbolicLinkObject() failed (Status %lx)\n", Status); WARN("NtOpenSymbolicLinkObject() failed (Status %lx)\n", Status);
NtClose (DirectoryHandle); NtClose(DirectoryHandle);
BaseSetLastNTError (Status); BaseSetLastNTError(Status);
return 0; return 0;
} }
@ -383,21 +370,21 @@ QueryDosDeviceW(
UnicodeString.Buffer = lpTargetPath; UnicodeString.Buffer = lpTargetPath;
ReturnLength = 0; ReturnLength = 0;
Status = NtQuerySymbolicLinkObject (DeviceHandle, Status = NtQuerySymbolicLinkObject(DeviceHandle,
&UnicodeString, &UnicodeString,
&ReturnLength); &ReturnLength);
NtClose (DeviceHandle); NtClose(DeviceHandle);
NtClose (DirectoryHandle); NtClose(DirectoryHandle);
if (!NT_SUCCESS (Status)) if (!NT_SUCCESS(Status))
{ {
WARN ("NtQuerySymbolicLinkObject() failed (Status %lx)\n", Status); WARN("NtQuerySymbolicLinkObject() failed (Status %lx)\n", Status);
BaseSetLastNTError (Status); BaseSetLastNTError(Status);
return 0; return 0;
} }
TRACE ("ReturnLength: %lu\n", ReturnLength); TRACE("ReturnLength: %lu\n", ReturnLength);
TRACE ("TargetLength: %hu\n", UnicodeString.Length); TRACE("TargetLength: %hu\n", UnicodeString.Length);
TRACE ("Target: '%wZ'\n", &UnicodeString); TRACE("Target: '%wZ'\n", &UnicodeString);
Length = UnicodeString.Length / sizeof(WCHAR); Length = UnicodeString.Length / sizeof(WCHAR);
if (Length < ucchMax) if (Length < ucchMax)
@ -408,8 +395,8 @@ QueryDosDeviceW(
} }
else else
{ {
TRACE ("Buffer is too small\n"); TRACE("Buffer is too small\n");
BaseSetLastNTError (STATUS_BUFFER_TOO_SMALL); BaseSetLastNTError(STATUS_BUFFER_TOO_SMALL);
return 0; return 0;
} }
} }
@ -422,9 +409,9 @@ QueryDosDeviceW(
while (TRUE) while (TRUE)
{ {
Status = NtQueryDirectoryObject (DirectoryHandle, Status = NtQueryDirectoryObject(DirectoryHandle,
Buffer, Buffer,
sizeof (Buffer), sizeof(Buffer),
TRUE, TRUE,
RestartScan, RestartScan,
&Context, &Context,
@ -443,13 +430,13 @@ QueryDosDeviceW(
{ {
Length = 0; Length = 0;
} }
BaseSetLastNTError (Status); BaseSetLastNTError(Status);
break; break;
} }
if (!wcscmp (DirInfo->TypeName.Buffer, L"SymbolicLink")) if (!wcscmp(DirInfo->TypeName.Buffer, L"SymbolicLink"))
{ {
TRACE ("Name: '%wZ'\n", &DirInfo->Name); TRACE("Name: '%wZ'\n", &DirInfo->Name);
NameLength = DirInfo->Name.Length / sizeof(WCHAR); NameLength = DirInfo->Name.Length / sizeof(WCHAR);
if (Length + NameLength + 1 >= ucchMax) if (Length + NameLength + 1 >= ucchMax)
@ -459,9 +446,7 @@ QueryDosDeviceW(
break; break;
} }
memcpy (Ptr, memcpy(Ptr, DirInfo->Name.Buffer, DirInfo->Name.Length);
DirInfo->Name.Buffer,
DirInfo->Name.Length);
Ptr += NameLength; Ptr += NameLength;
Length += NameLength; Length += NameLength;
*Ptr = UNICODE_NULL; *Ptr = UNICODE_NULL;
@ -472,7 +457,7 @@ QueryDosDeviceW(
RestartScan = FALSE; RestartScan = FALSE;
} }
NtClose (DirectoryHandle); NtClose(DirectoryHandle);
} }
return Length; return Length;