From e3cc5db0e611b47fa2bc5e586fe2f3a1829613ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Tue, 6 Aug 2013 18:36:25 +0000 Subject: [PATCH] [KERNEL32] Limit indentation by avoiding many "if ()" imbrications. svn path=/trunk/; revision=59657 --- reactos/dll/win32/kernel32/client/proc.c | 44 +++++++++++------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/reactos/dll/win32/kernel32/client/proc.c b/reactos/dll/win32/kernel32/client/proc.c index e72273a45f6..bb2bda4a858 100644 --- a/reactos/dll/win32/kernel32/client/proc.c +++ b/reactos/dll/win32/kernel32/client/proc.c @@ -60,30 +60,28 @@ StuffStdHandle(IN HANDLE ProcessHandle, { NTSTATUS Status; HANDLE DuplicatedHandle; - SIZE_T Dummy; + SIZE_T NumberOfBytesWritten; - /* Is there a handle to duplicate? */ - if (StandardHandle) - { - /* Duplicate it */ - Status = NtDuplicateObject(NtCurrentProcess(), - StandardHandle, - ProcessHandle, - &DuplicatedHandle, - 0, - 0, - DUPLICATE_SAME_ACCESS | - DUPLICATE_SAME_ATTRIBUTES); - if (NT_SUCCESS(Status)) - { - /* Write it */ - NtWriteVirtualMemory(ProcessHandle, - Address, - &DuplicatedHandle, - sizeof(HANDLE), - &Dummy); - } - } + /* If there is no handle to duplicate, return immediately */ + if (!StandardHandle) return; + + /* Duplicate the handle */ + Status = NtDuplicateObject(NtCurrentProcess(), + StandardHandle, + ProcessHandle, + &DuplicatedHandle, + 0, + 0, + DUPLICATE_SAME_ACCESS | + DUPLICATE_SAME_ATTRIBUTES); + if (!NT_SUCCESS(Status)) return; + + /* Write it */ + NtWriteVirtualMemory(ProcessHandle, + Address, + &DuplicatedHandle, + sizeof(HANDLE), + &NumberOfBytesWritten); } BOOLEAN