&ProcessBasicInfo,
sizeof(ProcessBasicInfo),
NULL);
- if (!NT_SUCCESS(Status))
- goto Error;
+
+ if (!NT_SUCCESS(Status)) goto Error;
Status = NtReadVirtualMemory(ProcessHandle,
ProcessBasicInfo.PebBaseAddress,
&Peb,
sizeof(Peb),
&Count);
- if (!NT_SUCCESS(Status) || Count != sizeof(Peb))
- goto Error;
+
+ if (!NT_SUCCESS(Status) || Count != sizeof(Peb)) goto Error;
memset(&DosHeader, 0, sizeof(DosHeader));
Status = NtReadVirtualMemory(ProcessHandle,
sizeof(DosHeader),
&Count);
- if (!NT_SUCCESS(Status) || Count != sizeof(DosHeader))
- goto Error;
-
- if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE)
- goto Error;
+ if (!NT_SUCCESS(Status) || Count != sizeof(DosHeader)) goto Error;
+ if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE) goto Error;
memset(&NtHeaders, 0, sizeof(NtHeaders));
Status = NtReadVirtualMemory(ProcessHandle,
sizeof(NtHeaders),
&Count);
- if (!NT_SUCCESS(Status) || Count != sizeof(NtHeaders))
- goto Error;
-
- if (NtHeaders.Signature != IMAGE_NT_SIGNATURE)
- goto Error;
+ if (!NT_SUCCESS(Status) || Count != sizeof(NtHeaders)) goto Error;
+ if (NtHeaders.Signature != IMAGE_NT_SIGNATURE) goto Error;
Version = MAKELONG(NtHeaders.OptionalHeader.MinorSubsystemVersion,
NtHeaders.OptionalHeader.MajorSubsystemVersion);
}
_SEH2_FINALLY
{
- if (ProcessHandle)
- CloseHandle(ProcessHandle);
+ if (ProcessHandle) CloseHandle(ProcessHandle);
}
_SEH2_END;
&Needed);
Result = DynamicBuffer;
}
- else
- Result = (PUNICODE_STRING)Buffer;
+ else Result = (PUNICODE_STRING)Buffer;
- if (!NT_SUCCESS(Status))
- goto Cleanup;
+ if (!NT_SUCCESS(Status)) goto Cleanup;
if (Result->Length / sizeof(WCHAR) + 1 > *pdwSize)
{
"Address: %p\n", ProcessHandle, StandardHandle, Address);
/* Don't touch Console Handles */
- if (IsConsoleHandle(StandardHandle))
- return;
+ if (IsConsoleHandle(StandardHandle)) return;
/* Duplicate the handle */
Status = NtDuplicateObject(NtCurrentProcess(),
CmdLineLength = wcslen(CMD_STRING) + wcslen(lpCommandLine) + 1;
/* If we found quotes, then add them into the length size */
- if (CmdLineIsAppName || FoundQuotes)
- CmdLineLength += 2;
+ if (CmdLineIsAppName || FoundQuotes) CmdLineLength += 2;
CmdLineLength *= sizeof(WCHAR);
/* Allocate space for the new command line */
if(lpEnvironment && !(dwCreationFlags & CREATE_UNICODE_ENVIRONMENT))
{
lpEnvironment = BasepConvertUnicodeEnvironment(&EnvSize, lpEnvironment);
- if (!lpEnvironment)
- goto Cleanup;
+ if (!lpEnvironment) goto Cleanup;
}
/* Create Process Environment */
Cleanup:
/* De-allocate heap strings */
- if (NameBuffer)
- RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
-
+ if (NameBuffer) RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer);
if (ApplicationName.Buffer)
RtlFreeHeap(RtlGetProcessHeap(), 0, ApplicationName.Buffer);
-
- if (CurrentDirectory)
- RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentDirectory);
-
- if (QuotedCmdLine)
- RtlFreeHeap(RtlGetProcessHeap(), 0, QuotedCmdLine);
+ if (CurrentDirectory) RtlFreeHeap(RtlGetProcessHeap(), 0, CurrentDirectory);
+ if (QuotedCmdLine) RtlFreeHeap(RtlGetProcessHeap(), 0, QuotedCmdLine);
/* Kill any handles still alive */
- if (hSection)
- NtClose(hSection);
-
+ if (hSection) NtClose(hSection);
if (hThread)
{
/* We don't know any more details then this */
NtTerminateProcess(hProcess, STATUS_UNSUCCESSFUL);
NtClose(hThread);
}
-
- if (hProcess)
- NtClose(hProcess);
+ if (hProcess) NtClose(hProcess);
/* Return Success */
return Ret;
/* Initialize the critical section and raise an exception if we failed */
Status = RtlInitializeCriticalSection(
- (PRTL_CRITICAL_SECTION)lpCriticalSection);
- if (!NT_SUCCESS(Status))
- RtlRaiseStatus(Status);
+ (PRTL_CRITICAL_SECTION)lpCriticalSection);
+ if (!NT_SUCCESS(Status)) RtlRaiseStatus(Status);
}
/*
BOOLEAN InitialOwner;
/* Now check if we got a name */
- if (lpName)
- RtlInitUnicodeString(&ObjectName, lpName);
+ if (lpName) RtlInitUnicodeString(&ObjectName, lpName);
if (dwFlags & ~(CREATE_MUTEX_INITIAL_OWNER))
{
/* Release the mutant */
Status = NtReleaseMutant(hMutex, NULL);
- if (NT_SUCCESS(Status))
- return TRUE;
+ if (NT_SUCCESS(Status)) return TRUE;
/* If we got here, then we failed */
SetLastErrorByStatus(Status);
UNICODE_STRING ObjectName;
/* Now check if we got a name */
- if (lpName)
- RtlInitUnicodeString(&ObjectName, lpName);
+ if (lpName) RtlInitUnicodeString(&ObjectName, lpName);
if (dwFlags != 0)
{
/* Release the semaphore */
Status = NtReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount);
- if (NT_SUCCESS(Status))
- return TRUE;
+ if (NT_SUCCESS(Status)) return TRUE;
/* If we got here, then we failed */
SetLastErrorByStatus(Status);
TIMER_TYPE TimerType;
/* Now check if we got a name */
- if (lpTimerName)
- RtlInitUnicodeString(&ObjectName, lpTimerName);
+ if (lpTimerName) RtlInitUnicodeString(&ObjectName, lpTimerName);
if (dwFlags & ~(CREATE_WAITABLE_TIMER_MANUAL_RESET))
{
(BOOLEAN)fResume,
lPeriod,
NULL);
- if (NT_SUCCESS(Status))
- return TRUE;
+ if (NT_SUCCESS(Status)) return TRUE;
/* If we got here, then we failed */
SetLastErrorByStatus(Status);
/* Cancel the timer */
Status = NtCancelTimer(hTimer, NULL);
- if (NT_SUCCESS(Status))
- return TRUE;
+ if (NT_SUCCESS(Status)) return TRUE;
/* If we got here, then we failed */
SetLastErrorByStatus(Status);
DPRINT1("Converting Thread to Fiber\n");
/* the current thread is already a fiber */
- if (pTeb->HasFiberData && pTeb->Tib.FiberData)
- return pTeb->Tib.FiberData;
+ if(pTeb->HasFiberData && pTeb->Tib.FiberData) return pTeb->Tib.FiberData;
/* allocate the fiber */
pfCurFiber = (PFIBER)RtlAllocateHeap(GetProcessHeap(),
RtlFreeHeap(GetProcessHeap(), 0, lpFiber);
/* the fiber is deleting itself: let the system deallocate the stack */
- if (NtCurrentTeb()->Tib.FiberData == lpFiber)
- ExitThread(1);
+ if(NtCurrentTeb()->Tib.FiberData == lpFiber) ExitThread(1);
/* deallocate the stack */
NtFreeVirtualMemory(NtCurrentProcess(),
PVOID *ppFlsSlots;
PVOID pRetVal;
- if (dwFlsIndex >= 128)
- goto l_InvalidParam;
+ if(dwFlsIndex >= 128) goto l_InvalidParam;
ppFlsSlots = NtCurrentTeb()->FlsData;
- if (ppFlsSlots == NULL)
- goto l_InvalidParam;
+ if(ppFlsSlots == NULL) goto l_InvalidParam;
SetLastError(0);
pRetVal = ppFlsSlots[dwFlsIndex + 2];
PVOID *ppFlsSlots;
TEB *pTeb = NtCurrentTeb();
- if (dwFlsIndex >= 128)
- goto l_InvalidParam;
+ if(dwFlsIndex >= 128) goto l_InvalidParam;
ppFlsSlots = pTeb->FlsData;
ppFlsSlots = RtlAllocateHeap(pPeb->ProcessHeap,
HEAP_ZERO_MEMORY,
(128 + 2) * sizeof(PVOID));
- if (ppFlsSlots == NULL)
- goto l_OutOfMemory;
+ if(ppFlsSlots == NULL) goto l_OutOfMemory;
pTeb->FlsData = ppFlsSlots;