mirror of
https://github.com/reactos/reactos.git
synced 2024-08-30 23:28:58 +00:00
Fix indentation and coding style. No code changes.
svn path=/trunk/; revision=45018
This commit is contained in:
parent
ce0ab52c93
commit
1145a26d92
|
@ -27,7 +27,8 @@ static BOOL bCommandLineInitialized = FALSE;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static VOID
|
||||
static
|
||||
VOID
|
||||
InitCommandLines(VOID)
|
||||
{
|
||||
PRTL_USER_PROCESS_PARAMETERS Params;
|
||||
|
@ -51,7 +52,7 @@ InitCommandLines (VOID)
|
|||
|
||||
RtlInitAnsiString(&CommandLineStringA, NULL);
|
||||
|
||||
// copy command line
|
||||
/* Copy command line */
|
||||
RtlCopyUnicodeString(&CommandLineStringW,
|
||||
&(Params->CommandLine));
|
||||
CommandLineStringW.Buffer[CommandLineStringW.Length / sizeof(WCHAR)] = 0;
|
||||
|
@ -75,7 +76,9 @@ InitCommandLines (VOID)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
LPSTR WINAPI GetCommandLineA(VOID)
|
||||
LPSTR
|
||||
WINAPI
|
||||
GetCommandLineA(VOID)
|
||||
{
|
||||
if (bCommandLineInitialized == FALSE)
|
||||
{
|
||||
|
@ -84,14 +87,16 @@ LPSTR WINAPI GetCommandLineA(VOID)
|
|||
|
||||
DPRINT("CommandLine \'%s\'\n", CommandLineStringA.Buffer);
|
||||
|
||||
return(CommandLineStringA.Buffer);
|
||||
return CommandLineStringA.Buffer;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
LPWSTR WINAPI GetCommandLineW (VOID)
|
||||
LPWSTR
|
||||
WINAPI
|
||||
GetCommandLineW(VOID)
|
||||
{
|
||||
if (bCommandLineInitialized == FALSE)
|
||||
{
|
||||
|
@ -100,7 +105,7 @@ LPWSTR WINAPI GetCommandLineW (VOID)
|
|||
|
||||
DPRINT("CommandLine \'%S\'\n", CommandLineStringW.Buffer);
|
||||
|
||||
return(CommandLineStringW.Buffer);
|
||||
return CommandLineStringW.Buffer;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -51,6 +51,7 @@ CreateJobObjectA(LPSECURITY_ATTRIBUTES lpJobAttributes,
|
|||
{
|
||||
RtlFreeUnicodeString(&UnicodeName);
|
||||
}
|
||||
|
||||
return hJob;
|
||||
}
|
||||
|
||||
|
@ -81,6 +82,7 @@ CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes,
|
|||
{
|
||||
Attributes |= OBJ_INHERIT;
|
||||
}
|
||||
|
||||
SecurityDescriptor = lpJobAttributes->lpSecurityDescriptor;
|
||||
}
|
||||
else
|
||||
|
@ -138,7 +140,6 @@ OpenJobObjectW(DWORD dwDesiredAccess,
|
|||
Status = NtOpenJobObject(&hJob,
|
||||
dwDesiredAccess,
|
||||
&ObjectAttributes);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
|
@ -225,6 +226,7 @@ AssignProcessToJobObject(HANDLE hJob,
|
|||
SetLastErrorByStatus(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -250,11 +252,13 @@ QueryInformationJobObject(HANDLE hJob,
|
|||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
PJOBOBJECT_BASIC_LIMIT_INFORMATION BasicInfo;
|
||||
|
||||
switch (JobObjectInformationClass)
|
||||
{
|
||||
case JobObjectBasicLimitInformation:
|
||||
BasicInfo = (PJOBOBJECT_BASIC_LIMIT_INFORMATION)lpJobObjectInformation;
|
||||
break;
|
||||
|
||||
case JobObjectExtendedLimitInformation:
|
||||
BasicInfo = &((PJOBOBJECT_EXTENDED_LIMIT_INFORMATION)lpJobObjectInformation)->BasicLimitInformation;
|
||||
break;
|
||||
|
@ -274,21 +278,27 @@ QueryInformationJobObject(HANDLE hJob,
|
|||
case PROCESS_PRIORITY_CLASS_IDLE:
|
||||
BasicInfo->PriorityClass = IDLE_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case PROCESS_PRIORITY_CLASS_BELOW_NORMAL:
|
||||
BasicInfo->PriorityClass = BELOW_NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case PROCESS_PRIORITY_CLASS_NORMAL:
|
||||
BasicInfo->PriorityClass = NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case PROCESS_PRIORITY_CLASS_ABOVE_NORMAL:
|
||||
BasicInfo->PriorityClass = ABOVE_NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case PROCESS_PRIORITY_CLASS_HIGH:
|
||||
BasicInfo->PriorityClass = HIGH_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
case PROCESS_PRIORITY_CLASS_REALTIME:
|
||||
BasicInfo->PriorityClass = REALTIME_PRIORITY_CLASS;
|
||||
break;
|
||||
|
||||
default:
|
||||
BasicInfo->PriorityClass = NORMAL_PRIORITY_CLASS;
|
||||
break;
|
||||
|
@ -326,6 +336,7 @@ SetInformationJobObject(HANDLE hJob,
|
|||
SetLastError(ERROR_BAD_LENGTH);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ObjectInfo = &ExtendedLimitInfo.BasicLimitInformation;
|
||||
BasicInfo = (PJOBOBJECT_BASIC_LIMIT_INFORMATION)ObjectInfo;
|
||||
RtlCopyMemory(ObjectInfo, lpJobObjectInformation, cbJobObjectInformationLength);
|
||||
|
@ -337,6 +348,7 @@ SetInformationJobObject(HANDLE hJob,
|
|||
SetLastError(ERROR_BAD_LENGTH);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ObjectInfo = &ExtendedLimitInfo;
|
||||
BasicInfo = &ExtendedLimitInfo.BasicLimitInformation;
|
||||
RtlCopyMemory(ObjectInfo, lpJobObjectInformation, cbJobObjectInformationLength);
|
||||
|
@ -358,21 +370,27 @@ SetInformationJobObject(HANDLE hJob,
|
|||
case IDLE_PRIORITY_CLASS:
|
||||
BasicInfo->PriorityClass = PROCESS_PRIORITY_CLASS_IDLE;
|
||||
break;
|
||||
|
||||
case BELOW_NORMAL_PRIORITY_CLASS:
|
||||
BasicInfo->PriorityClass = PROCESS_PRIORITY_CLASS_BELOW_NORMAL;
|
||||
break;
|
||||
|
||||
case NORMAL_PRIORITY_CLASS:
|
||||
BasicInfo->PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
|
||||
break;
|
||||
|
||||
case ABOVE_NORMAL_PRIORITY_CLASS:
|
||||
BasicInfo->PriorityClass = PROCESS_PRIORITY_CLASS_ABOVE_NORMAL;
|
||||
break;
|
||||
|
||||
case HIGH_PRIORITY_CLASS:
|
||||
BasicInfo->PriorityClass = PROCESS_PRIORITY_CLASS_HIGH;
|
||||
break;
|
||||
|
||||
case REALTIME_PRIORITY_CLASS:
|
||||
BasicInfo->PriorityClass = PROCESS_PRIORITY_CLASS_REALTIME;
|
||||
break;
|
||||
|
||||
default:
|
||||
BasicInfo->PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL;
|
||||
break;
|
||||
|
@ -413,5 +431,4 @@ TerminateJobObject(HANDLE hJob,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -33,7 +33,8 @@ RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle);
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
GetProcessAffinityMask(HANDLE hProcess,
|
||||
LPDWORD lpProcessAffinityMask,
|
||||
LPDWORD lpSystemAffinityMask)
|
||||
|
@ -73,7 +74,8 @@ GetProcessAffinityMask (HANDLE hProcess,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
SetProcessAffinityMask(HANDLE hProcess,
|
||||
DWORD dwProcessAffinityMask)
|
||||
{
|
||||
|
@ -96,7 +98,8 @@ SetProcessAffinityMask (HANDLE hProcess,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
GetProcessShutdownParameters(LPDWORD lpdwLevel,
|
||||
LPDWORD lpdwFlags)
|
||||
{
|
||||
|
@ -112,20 +115,21 @@ GetProcessShutdownParameters (LPDWORD lpdwLevel,
|
|||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level;
|
||||
*lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags;
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
SetProcessShutdownParameters(DWORD dwLevel,
|
||||
DWORD dwFlags)
|
||||
{
|
||||
|
@ -144,17 +148,18 @@ SetProcessShutdownParameters (DWORD dwLevel,
|
|||
if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
GetProcessWorkingSetSize(HANDLE hProcess,
|
||||
PSIZE_T lpMinimumWorkingSetSize,
|
||||
PSIZE_T lpMaximumWorkingSetSize)
|
||||
|
@ -170,20 +175,21 @@ GetProcessWorkingSetSize (HANDLE hProcess,
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*lpMinimumWorkingSetSize = QuotaLimits.MinimumWorkingSetSize;
|
||||
*lpMaximumWorkingSetSize = QuotaLimits.MaximumWorkingSetSize;
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
SetProcessWorkingSetSize(HANDLE hProcess,
|
||||
SIZE_T dwMinimumWorkingSetSize,
|
||||
SIZE_T dwMaximumWorkingSetSize)
|
||||
|
@ -201,17 +207,18 @@ SetProcessWorkingSetSize(HANDLE hProcess,
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
GetProcessTimes(HANDLE hProcess,
|
||||
LPFILETIME lpCreationTime,
|
||||
LPFILETIME lpExitTime,
|
||||
|
@ -229,7 +236,7 @@ GetProcessTimes(HANDLE hProcess,
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpCreationTime->dwLowDateTime = Kut.CreateTime.u.LowPart;
|
||||
|
@ -244,44 +251,48 @@ GetProcessTimes(HANDLE hProcess,
|
|||
lpUserTime->dwLowDateTime = Kut.UserTime.u.LowPart;
|
||||
lpUserTime->dwHighDateTime = Kut.UserTime.u.HighPart;
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HANDLE WINAPI
|
||||
HANDLE
|
||||
WINAPI
|
||||
GetCurrentProcess(VOID)
|
||||
{
|
||||
return((HANDLE)NtCurrentProcess());
|
||||
return (HANDLE)NtCurrentProcess();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HANDLE WINAPI
|
||||
HANDLE
|
||||
WINAPI
|
||||
GetCurrentThread(VOID)
|
||||
{
|
||||
return((HANDLE)NtCurrentThread());
|
||||
return (HANDLE)NtCurrentThread();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD WINAPI
|
||||
DWORD
|
||||
WINAPI
|
||||
GetCurrentProcessId(VOID)
|
||||
{
|
||||
return((DWORD)GetTeb()->ClientId.UniqueProcess);
|
||||
return (DWORD)GetTeb()->ClientId.UniqueProcess;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
GetExitCodeProcess(HANDLE hProcess,
|
||||
LPDWORD lpExitCode)
|
||||
{
|
||||
|
@ -296,12 +307,12 @@ GetExitCodeProcess(HANDLE hProcess,
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*lpExitCode = (DWORD)ProcessBasic.ExitStatus;
|
||||
|
||||
return(TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -333,7 +344,8 @@ GetProcessId(HANDLE Process)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
HANDLE WINAPI
|
||||
HANDLE
|
||||
WINAPI
|
||||
OpenProcess(DWORD dwDesiredAccess,
|
||||
BOOL bInheritHandle,
|
||||
DWORD dwProcessId)
|
||||
|
@ -361,6 +373,7 @@ OpenProcess(DWORD dwDesiredAccess,
|
|||
SetLastErrorByStatus(errCode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ProcessHandle;
|
||||
}
|
||||
|
||||
|
@ -368,7 +381,8 @@ OpenProcess(DWORD dwDesiredAccess,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
UINT WINAPI
|
||||
UINT
|
||||
WINAPI
|
||||
WinExec(LPCSTR lpCmdLine,
|
||||
UINT uCmdShow)
|
||||
{
|
||||
|
@ -395,13 +409,13 @@ WinExec(LPCSTR lpCmdLine,
|
|||
dosErr = GetLastError();
|
||||
return dosErr < 32 ? dosErr : ERROR_BAD_FORMAT;
|
||||
}
|
||||
|
||||
if (NULL != lpfnGlobalRegisterWaitForInputIdle)
|
||||
{
|
||||
lpfnGlobalRegisterWaitForInputIdle (
|
||||
ProcessInformation.hProcess,
|
||||
10000
|
||||
);
|
||||
lpfnGlobalRegisterWaitForInputIdle(ProcessInformation.hProcess,
|
||||
10000);
|
||||
}
|
||||
|
||||
NtClose(ProcessInformation.hProcess);
|
||||
NtClose(ProcessInformation.hThread);
|
||||
|
||||
|
@ -412,10 +426,9 @@ WinExec(LPCSTR lpCmdLine,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID WINAPI
|
||||
RegisterWaitForInputIdle (
|
||||
WaitForInputIdleType lpfnRegisterWaitForInputIdle
|
||||
)
|
||||
VOID
|
||||
WINAPI
|
||||
RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle)
|
||||
{
|
||||
lpfnGlobalRegisterWaitForInputIdle = lpfnRegisterWaitForInputIdle;
|
||||
return;
|
||||
|
@ -424,7 +437,8 @@ RegisterWaitForInputIdle (
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID WINAPI
|
||||
VOID
|
||||
WINAPI
|
||||
GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
|
||||
{
|
||||
PRTL_USER_PROCESS_PARAMETERS Params;
|
||||
|
@ -461,7 +475,8 @@ GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID WINAPI
|
||||
VOID
|
||||
WINAPI
|
||||
GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
|
||||
{
|
||||
PRTL_USER_PROCESS_PARAMETERS Params;
|
||||
|
@ -540,7 +555,8 @@ GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
FlushInstructionCache(HANDLE hProcess,
|
||||
LPCVOID lpBaseAddress,
|
||||
DWORD dwSize)
|
||||
|
@ -555,6 +571,7 @@ FlushInstructionCache (HANDLE hProcess,
|
|||
SetLastErrorByStatus(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -562,7 +579,8 @@ FlushInstructionCache (HANDLE hProcess,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID WINAPI
|
||||
VOID
|
||||
WINAPI
|
||||
ExitProcess(UINT uExitCode)
|
||||
{
|
||||
CSR_API_MESSAGE CsrRequest;
|
||||
|
@ -586,7 +604,6 @@ ExitProcess(UINT uExitCode)
|
|||
DPRINT("Failed to tell csrss about terminating process\n");
|
||||
}
|
||||
|
||||
|
||||
NtTerminateProcess(NtCurrentProcess (),
|
||||
uExitCode);
|
||||
|
||||
|
@ -599,7 +616,8 @@ ExitProcess(UINT uExitCode)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
TerminateProcess(HANDLE hProcess,
|
||||
UINT uExitCode)
|
||||
{
|
||||
|
@ -615,6 +633,7 @@ TerminateProcess (HANDLE hProcess,
|
|||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
SetLastErrorByStatus(Status);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -623,7 +642,8 @@ TerminateProcess (HANDLE hProcess,
|
|||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
VOID WINAPI
|
||||
VOID
|
||||
WINAPI
|
||||
FatalAppExitA(UINT uAction,
|
||||
LPCSTR lpMessageText)
|
||||
{
|
||||
|
@ -645,7 +665,8 @@ FatalAppExitA(UINT uAction,
|
|||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
VOID WINAPI
|
||||
VOID
|
||||
WINAPI
|
||||
FatalAppExitW(UINT uAction,
|
||||
LPCWSTR lpMessageText)
|
||||
{
|
||||
|
@ -671,7 +692,8 @@ FatalAppExitW(UINT uAction,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
VOID WINAPI
|
||||
VOID
|
||||
WINAPI
|
||||
FatalExit(int ExitCode)
|
||||
{
|
||||
ExitProcess(ExitCode);
|
||||
|
@ -681,7 +703,8 @@ FatalExit (int ExitCode)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD WINAPI
|
||||
DWORD
|
||||
WINAPI
|
||||
GetPriorityClass(HANDLE hProcess)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
@ -727,7 +750,8 @@ GetPriorityClass (HANDLE hProcess)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI
|
||||
BOOL
|
||||
WINAPI
|
||||
SetPriorityClass(HANDLE hProcess,
|
||||
DWORD dwPriorityClass)
|
||||
{
|
||||
|
@ -771,7 +795,6 @@ SetPriorityClass (HANDLE hProcess,
|
|||
ProcessPriorityClass,
|
||||
&PriorityClass,
|
||||
sizeof(PROCESS_PRIORITY_CLASS));
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
|
@ -785,7 +808,8 @@ SetPriorityClass (HANDLE hProcess,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD WINAPI
|
||||
DWORD
|
||||
WINAPI
|
||||
GetProcessVersion(DWORD ProcessId)
|
||||
{
|
||||
DWORD Version = 0;
|
||||
|
@ -801,17 +825,18 @@ GetProcessVersion(DWORD ProcessId)
|
|||
|
||||
_SEH2_TRY
|
||||
{
|
||||
/* Caller's */
|
||||
if (0 == ProcessId || GetCurrentProcessId() == ProcessId)
|
||||
{
|
||||
/* Caller's */
|
||||
BaseAddress = (PVOID) NtCurrentPeb()->ImageBaseAddress;
|
||||
NtHeader = RtlImageNtHeader(BaseAddress);
|
||||
|
||||
Version = (NtHeader->OptionalHeader.MajorOperatingSystemVersion << 16) |
|
||||
(NtHeader->OptionalHeader.MinorOperatingSystemVersion);
|
||||
}
|
||||
else /* other process */
|
||||
else
|
||||
{
|
||||
/* Other process */
|
||||
ProcessHandle = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION,
|
||||
FALSE,
|
||||
ProcessId);
|
||||
|
@ -823,14 +848,16 @@ GetProcessVersion(DWORD ProcessId)
|
|||
&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,
|
||||
|
@ -839,8 +866,11 @@ GetProcessVersion(DWORD ProcessId)
|
|||
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,
|
||||
|
@ -849,8 +879,11 @@ GetProcessVersion(DWORD ProcessId)
|
|||
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);
|
||||
|
@ -864,7 +897,8 @@ Error:
|
|||
}
|
||||
_SEH2_FINALLY
|
||||
{
|
||||
if (ProcessHandle) CloseHandle(ProcessHandle);
|
||||
if (ProcessHandle)
|
||||
CloseHandle(ProcessHandle);
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
|
@ -877,8 +911,7 @@ Error:
|
|||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
GetProcessIoCounters(
|
||||
HANDLE hProcess,
|
||||
GetProcessIoCounters(HANDLE hProcess,
|
||||
PIO_COUNTERS lpIoCounters)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
@ -891,7 +924,7 @@ GetProcessIoCounters(
|
|||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return(FALSE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
@ -982,10 +1015,8 @@ GetProcessHandleCount(HANDLE hProcess,
|
|||
*/
|
||||
BOOL
|
||||
WINAPI
|
||||
IsWow64Process(
|
||||
HANDLE hProcess,
|
||||
PBOOL Wow64Process
|
||||
)
|
||||
IsWow64Process(HANDLE hProcess,
|
||||
PBOOL Wow64Process)
|
||||
{
|
||||
ULONG pbi;
|
||||
NTSTATUS Status;
|
||||
|
@ -995,7 +1026,6 @@ IsWow64Process(
|
|||
&pbi,
|
||||
sizeof(pbi),
|
||||
NULL);
|
||||
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
|
@ -1003,6 +1033,7 @@ IsWow64Process(
|
|||
}
|
||||
|
||||
*Wow64Process = (pbi != 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1044,9 +1075,11 @@ QueryFullProcessImageNameW(HANDLE hProcess,
|
|||
&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)
|
||||
{
|
||||
|
@ -1065,6 +1098,7 @@ Cleanup:
|
|||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
}
|
||||
|
||||
return !Status;
|
||||
}
|
||||
|
||||
|
@ -1101,6 +1135,7 @@ QueryFullProcessImageNameA(HANDLE hProcess,
|
|||
lpExeName,
|
||||
*pdwSize,
|
||||
NULL, NULL));
|
||||
|
||||
if (Result)
|
||||
*pdwSize = strlen(lpExeName);
|
||||
|
||||
|
|
|
@ -294,7 +294,8 @@ BasepDuplicateAndWriteHandle(IN HANDLE ProcessHandle,
|
|||
"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(),
|
||||
|
@ -1017,7 +1018,8 @@ GetAppName:
|
|||
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 */
|
||||
|
@ -1311,7 +1313,8 @@ GetAppName:
|
|||
if(lpEnvironment && !(dwCreationFlags & CREATE_UNICODE_ENVIRONMENT))
|
||||
{
|
||||
lpEnvironment = BasepConvertUnicodeEnvironment(&EnvSize, lpEnvironment);
|
||||
if (!lpEnvironment) goto Cleanup;
|
||||
if (!lpEnvironment)
|
||||
goto Cleanup;
|
||||
}
|
||||
|
||||
/* Create Process Environment */
|
||||
|
@ -1419,21 +1422,31 @@ GetAppName:
|
|||
|
||||
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;
|
||||
|
|
|
@ -19,8 +19,11 @@ DWORD ActiveConsoleSessionId = 0;
|
|||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD WINAPI
|
||||
DosPathToSessionPathW (DWORD SessionID, LPWSTR InPath, LPWSTR * OutPath)
|
||||
DWORD
|
||||
WINAPI
|
||||
DosPathToSessionPathW(DWORD SessionID,
|
||||
LPWSTR InPath,
|
||||
LPWSTR *OutPath)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return 0;
|
||||
|
@ -39,8 +42,11 @@ DosPathToSessionPathW (DWORD SessionID, LPWSTR InPath, LPWSTR * OutPath)
|
|||
*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD WINAPI
|
||||
DosPathToSessionPathA (DWORD SessionId, LPSTR InPath, LPSTR * OutPath)
|
||||
DWORD
|
||||
WINAPI
|
||||
DosPathToSessionPathA(DWORD SessionId,
|
||||
LPSTR InPath,
|
||||
LPSTR *OutPath)
|
||||
{
|
||||
//DosPathToSessionPathW (SessionId,InPathW,OutPathW);
|
||||
UNIMPLEMENTED;
|
||||
|
@ -50,7 +56,9 @@ DosPathToSessionPathA (DWORD SessionId, LPSTR InPath, LPSTR * OutPath)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI ProcessIdToSessionId (IN DWORD dwProcessId,
|
||||
BOOL
|
||||
WINAPI
|
||||
ProcessIdToSessionId(IN DWORD dwProcessId,
|
||||
OUT DWORD *pSessionId)
|
||||
{
|
||||
PROCESS_SESSION_INFORMATION SessionInformation;
|
||||
|
@ -97,7 +105,8 @@ BOOL WINAPI ProcessIdToSessionId (IN DWORD dwProcessId,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD WINAPI
|
||||
DWORD
|
||||
WINAPI
|
||||
WTSGetActiveConsoleSessionId(VOID)
|
||||
{
|
||||
return ActiveConsoleSessionId;
|
||||
|
|
|
@ -27,7 +27,8 @@ InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
|
|||
/* Initialize the critical section and raise an exception if we failed */
|
||||
Status = RtlInitializeCriticalSection(
|
||||
(PRTL_CRITICAL_SECTION)lpCriticalSection);
|
||||
if (!NT_SUCCESS(Status)) RtlRaiseStatus(Status);
|
||||
if (!NT_SUCCESS(Status))
|
||||
RtlRaiseStatus(Status);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -75,7 +75,8 @@ CreateMutexExW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL,
|
|||
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))
|
||||
{
|
||||
|
@ -257,7 +258,8 @@ ReleaseMutex(IN HANDLE hMutex)
|
|||
|
||||
/* 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);
|
||||
|
|
|
@ -80,7 +80,8 @@ CreateSemaphoreExW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL,
|
|||
UNICODE_STRING ObjectName;
|
||||
|
||||
/* Now check if we got a name */
|
||||
if (lpName) RtlInitUnicodeString(&ObjectName, lpName);
|
||||
if (lpName)
|
||||
RtlInitUnicodeString(&ObjectName, lpName);
|
||||
|
||||
if (dwFlags != 0)
|
||||
{
|
||||
|
@ -260,7 +261,8 @@ ReleaseSemaphore(IN HANDLE hSemaphore,
|
|||
|
||||
/* 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);
|
||||
|
|
|
@ -75,7 +75,8 @@ CreateWaitableTimerExW(IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL,
|
|||
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))
|
||||
{
|
||||
|
@ -268,7 +269,8 @@ SetWaitableTimer(IN HANDLE hTimer,
|
|||
(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);
|
||||
|
@ -286,7 +288,8 @@ CancelWaitableTimer(IN HANDLE hTimer)
|
|||
|
||||
/* 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);
|
||||
|
|
|
@ -69,7 +69,8 @@ ConvertThreadToFiberEx(LPVOID lpParameter,
|
|||
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(),
|
||||
|
@ -227,7 +228,8 @@ DeleteFiber(LPVOID lpFiber)
|
|||
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(),
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
DWORD WINAPI FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback)
|
||||
DWORD
|
||||
WINAPI
|
||||
FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback)
|
||||
{
|
||||
(void)lpCallback;
|
||||
|
||||
|
@ -31,7 +33,9 @@ DWORD WINAPI FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback)
|
|||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
BOOL WINAPI FlsFree(DWORD dwFlsIndex)
|
||||
BOOL
|
||||
WINAPI
|
||||
FlsFree(DWORD dwFlsIndex)
|
||||
{
|
||||
(void)dwFlsIndex;
|
||||
|
||||
|
@ -44,16 +48,20 @@ BOOL WINAPI FlsFree(DWORD dwFlsIndex)
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
PVOID WINAPI FlsGetValue(DWORD dwFlsIndex)
|
||||
PVOID
|
||||
WINAPI
|
||||
FlsGetValue(DWORD dwFlsIndex)
|
||||
{
|
||||
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];
|
||||
|
@ -69,12 +77,15 @@ l_InvalidParam:
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL WINAPI FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData)
|
||||
BOOL
|
||||
WINAPI
|
||||
FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData)
|
||||
{
|
||||
PVOID *ppFlsSlots;
|
||||
TEB *pTeb = NtCurrentTeb();
|
||||
|
||||
if(dwFlsIndex >= 128) goto l_InvalidParam;
|
||||
if (dwFlsIndex >= 128)
|
||||
goto l_InvalidParam;
|
||||
|
||||
ppFlsSlots = pTeb->FlsData;
|
||||
|
||||
|
@ -82,14 +93,11 @@ BOOL WINAPI FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData)
|
|||
{
|
||||
PEB *pPeb = pTeb->ProcessEnvironmentBlock;
|
||||
|
||||
ppFlsSlots = RtlAllocateHeap
|
||||
(
|
||||
pPeb->ProcessHeap,
|
||||
ppFlsSlots = RtlAllocateHeap(pPeb->ProcessHeap,
|
||||
HEAP_ZERO_MEMORY,
|
||||
(128 + 2) * sizeof(PVOID)
|
||||
);
|
||||
|
||||
if(ppFlsSlots == NULL) goto l_OutOfMemory;
|
||||
(128 + 2) * sizeof(PVOID));
|
||||
if (ppFlsSlots == NULL)
|
||||
goto l_OutOfMemory;
|
||||
|
||||
pTeb->FlsData = ppFlsSlots;
|
||||
|
||||
|
|
Loading…
Reference in a new issue