Author: hbelusca Date: Tue Aug 6 18:36:25 2013 New Revision: 59657
URL: http://svn.reactos.org/svn/reactos?rev=59657&view=rev Log: [KERNEL32] Limit indentation by avoiding many "if ()" imbrications.
Modified: trunk/reactos/dll/win32/kernel32/client/proc.c
Modified: trunk/reactos/dll/win32/kernel32/client/proc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/p... ============================================================================== --- trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/proc.c [iso-8859-1] Tue Aug 6 18:36:25 2013 @@ -60,30 +60,28 @@ { NTSTATUS Status; HANDLE DuplicatedHandle; - SIZE_T Dummy; - - /* 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); - } - } + SIZE_T NumberOfBytesWritten; + + /* 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